Altered all endpoint/pipe stream transfers so that the new BytesProcessed parameter now points to a location where the number of bytes in the transfer that have been completed can be stored (or NULL if entire transaction should be performed in one chunk).

Added new Endpoint_Null_Stream() and Pipe_Null_stream() functions.

Removed the NO_STREAM_CALLBACKS compile time option due to the new partial stream transfer feature replacing it.

Fixed errors in the incomplete Test and Measurement device demo preventing proper operation (thanks to Pavel Plotnikov).
pull/1469/head
Dean Camera 14 years ago
parent 477a2047f4
commit f555ad7ced

@ -122,7 +122,6 @@ LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENAB
LUFA_OPTS += -D NO_INTERNAL_SERIAL
LUFA_OPTS += -D NO_DEVICE_SELF_POWER
LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D NO_SOF_EVENTS
#LUFA_OPTS += -D NO_BLOCK_SUPPORT

@ -122,7 +122,6 @@ LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENAB
LUFA_OPTS += -D NO_INTERNAL_SERIAL
LUFA_OPTS += -D NO_DEVICE_SELF_POWER
LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D NO_SOF_EVENTS

@ -169,12 +169,10 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NULL);
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -197,10 +195,8 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NULL);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
@ -221,8 +217,8 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
uint32_t LastBlockAddressInLUN = (LUN_MEDIA_BLOCKS - 1);
uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NULL);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */

@ -169,12 +169,10 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NULL);
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -197,10 +195,8 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NULL);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
@ -221,8 +217,8 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
uint32_t LastBlockAddressInLUN = (LUN_MEDIA_BLOCKS - 1);
uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NULL);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */

@ -48,7 +48,7 @@ void Sideshow_ProcessCommandPacket(void)
SideShow_PacketHeader_t PacketHeader;
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
Endpoint_Read_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Read_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
PacketHeader.Type.TypeFields.Response = true;
@ -104,14 +104,14 @@ void Sideshow_ProcessCommandPacket(void)
default:
PacketHeader.Length -= sizeof(SideShow_PacketHeader_t);
Endpoint_Discard_Stream(PacketHeader.Length);
Endpoint_Discard_Stream(PacketHeader.Length, NULL);
Endpoint_ClearOUT();
PacketHeader.Length = sizeof(SideShow_PacketHeader_t);
PacketHeader.Type.TypeFields.NAK = true;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
printf(" UNK");
@ -123,7 +123,7 @@ static void SideShow_Ping(SideShow_PacketHeader_t* const PacketHeader)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -131,15 +131,15 @@ static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader)
{
GUID_t ProtocolGUID;
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t), NULL);
Endpoint_ClearOUT();
if (!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID)))
PacketHeader->Type.TypeFields.NAK = true;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t), NULL);
Endpoint_ClearIN();
}
@ -150,7 +150,7 @@ static void SideShow_GetCurrentUser(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + UserSID.LengthInBytes;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
SideShow_Write_Unicode_String(&UserSID);
Endpoint_ClearIN();
}
@ -163,7 +163,7 @@ static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -172,7 +172,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
SideShow_PropertyKey_t Property;
SideShow_PropertyData_t PropertyData;
Endpoint_Read_Stream_LE(&Property, sizeof(SideShow_PropertyKey_t));
Endpoint_Read_Stream_LE(&Property, sizeof(SideShow_PropertyKey_t), NULL);
Endpoint_ClearOUT();
printf(" ID: %lu", Property.PropertyID);
@ -255,7 +255,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
}
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
if (!(PacketHeader->Type.TypeFields.NAK))
{
@ -263,12 +263,12 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
{
case VT_UI4:
case VT_I4:
Endpoint_Write_Stream_LE(&PropertyData.Data.Data32, sizeof(uint32_t));
Endpoint_Write_Stream_LE(&PropertyData.Data.Data32, sizeof(uint32_t), NULL);
break;
case VT_UI2:
case VT_I2:
case VT_BOOL:
Endpoint_Write_Stream_LE(&PropertyData.Data.Data16, sizeof(uint16_t));
Endpoint_Write_Stream_LE(&PropertyData.Data.Data16, sizeof(uint16_t), NULL);
break;
case VT_LPWSTR:
SideShow_Write_Unicode_String((Unicode_String_t*)PropertyData.Data.Data16);
@ -289,7 +289,7 @@ static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
sizeof(uint32_t) + ((Unicode_String_t*)UnicodeStruct)->LengthInBytes;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
SideShow_Write_Unicode_String(UnicodeStruct);
Endpoint_ClearIN();
}
@ -310,13 +310,13 @@ static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHe
sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t));
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_Write_DWord_LE(TotalApplications);
for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
{
if (InstalledApplications[App].InUse)
Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t));
Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t), NULL);
}
Endpoint_ClearIN();
@ -331,9 +331,9 @@ static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* const Packet
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + sizeof(GUID_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_Write_DWord_LE(1);
Endpoint_Write_Stream_LE(&SupportedEndpointGUID, sizeof(GUID_t));
Endpoint_Write_Stream_LE(&SupportedEndpointGUID, sizeof(GUID_t), NULL);
Endpoint_ClearIN();
}
@ -342,7 +342,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
SideShow_Application_t* CurrApp;
GUID_t ApplicationID;
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t), NULL);
CurrApp = SideShow_GetApplicationFromGUID(&ApplicationID);
@ -353,7 +353,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
{
PacketHeader->Length -= sizeof(SideShow_PacketHeader_t) + sizeof(GUID_t);
Endpoint_Discard_Stream(PacketHeader->Length);
Endpoint_Discard_Stream(PacketHeader->Length, NULL);
Endpoint_ClearOUT();
PacketHeader->Type.TypeFields.NAK = true;
@ -361,10 +361,10 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
else
{
CurrApp->ApplicationID = ApplicationID;
Endpoint_Read_Stream_LE(&CurrApp->EndpointID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&CurrApp->EndpointID, sizeof(GUID_t), NULL);
SideShow_Read_Unicode_String(&CurrApp->ApplicationName, sizeof(CurrApp->ApplicationName.UnicodeString));
Endpoint_Read_Stream_LE(&CurrApp->CachePolicy, sizeof(uint32_t));
Endpoint_Read_Stream_LE(&CurrApp->OnlineOnly, sizeof(uint32_t));
Endpoint_Read_Stream_LE(&CurrApp->CachePolicy, sizeof(uint32_t), NULL);
Endpoint_Read_Stream_LE(&CurrApp->OnlineOnly, sizeof(uint32_t), NULL);
SideShow_Discard_Byte_Stream();
SideShow_Discard_Byte_Stream();
SideShow_Discard_Byte_Stream();
@ -378,7 +378,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -386,7 +386,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHead
{
GUID_t ApplicationGUID;
Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t), NULL);
Endpoint_ClearOUT();
SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID);
@ -399,7 +399,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHead
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -411,7 +411,7 @@ static void SideShow_DeleteAllApplications(SideShow_PacketHeader_t* const Packet
InstalledApplications[App].InUse = false;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -421,8 +421,8 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader)
GUID_t EndpointID;
SideShow_Application_t* Application;
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t), NULL);
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t), NULL);
Application = SideShow_GetApplicationFromGUID(&ApplicationID);
@ -441,7 +441,7 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -451,9 +451,9 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* const PacketHeader)
GUID_t EndpointID;
uint32_t ContentID;
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t));
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t), NULL);
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t), NULL);
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t), NULL);
Endpoint_ClearOUT();
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
@ -466,7 +466,7 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* const PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}
@ -475,8 +475,8 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* const PacketHeade
GUID_t ApplicationID;
GUID_t EndpointID;
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t), NULL);
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t), NULL);
Endpoint_ClearOUT();
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
@ -489,7 +489,7 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* const PacketHeade
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t), NULL);
Endpoint_ClearIN();
}

@ -36,13 +36,13 @@ uint16_t SideShow_Read_Unicode_String(void* const UnicodeString,
Unicode_String_t* const UnicodeStruct = (Unicode_String_t*)UnicodeString;
uint32_t UnicodeCharsToRead;
Endpoint_Read_Stream_LE(&UnicodeCharsToRead, sizeof(uint32_t));
Endpoint_Read_Stream_LE(&UnicodeCharsToRead, sizeof(uint32_t), NULL);
int UnicodeData[UnicodeCharsToRead];
UnicodeStruct->LengthInBytes = (UnicodeCharsToRead << 1);
Endpoint_Read_Stream_LE(&UnicodeData, UnicodeStruct->LengthInBytes);
Endpoint_Read_Stream_LE(&UnicodeData, UnicodeStruct->LengthInBytes, NULL);
if (UnicodeStruct->LengthInBytes > MaxBytes)
UnicodeStruct->LengthInBytes = MaxBytes;
@ -58,15 +58,15 @@ void SideShow_Write_Unicode_String(void* const UnicodeString)
uint32_t StringSizeInCharacters = (UnicodeStruct->LengthInBytes >> 1);
Endpoint_Write_Stream_LE(&StringSizeInCharacters, sizeof(uint32_t));
Endpoint_Write_Stream_LE(&UnicodeStruct->UnicodeString, UnicodeStruct->LengthInBytes);
Endpoint_Write_Stream_LE(&StringSizeInCharacters, sizeof(uint32_t), NULL);
Endpoint_Write_Stream_LE(&UnicodeStruct->UnicodeString, UnicodeStruct->LengthInBytes, NULL);
}
void SideShow_Discard_Byte_Stream(void)
{
uint32_t StreamSize;
Endpoint_Read_Stream_LE(&StreamSize, sizeof(uint32_t));
Endpoint_Discard_Stream(StreamSize);
Endpoint_Read_Stream_LE(&StreamSize, sizeof(uint32_t), NULL);
Endpoint_Discard_Stream(StreamSize, NULL);
}

@ -37,19 +37,19 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
uint32_t ContentSize;
uint32_t ContentID;
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t));
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t), NULL);
PacketHeader->Length -= sizeof(uint32_t);
if (Application->CurrentContentID != ContentID)
{
Endpoint_Discard_Stream(PacketHeader->Length);
Endpoint_Discard_Stream(PacketHeader->Length, NULL);
return false;
}
Endpoint_Read_Stream_LE(&ContentSize, sizeof(uint32_t));
Endpoint_Read_Stream_LE(&Application->CurrentContent, sizeof(XML_START_TAG) - 1);
Endpoint_Read_Stream_LE(&ContentSize, sizeof(uint32_t), NULL);
Endpoint_Read_Stream_LE(&Application->CurrentContent, (sizeof(XML_START_TAG) - 1), NULL);
PacketHeader->Length -= sizeof(uint32_t) + (sizeof(XML_START_TAG) - 1);
@ -57,14 +57,14 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
{
SideShow_ProcessXMLContent(&Application->CurrentContent, (ContentSize - (sizeof(XML_END_TAG) - 1)));
Endpoint_Discard_Stream(sizeof(XML_END_TAG) - 1);
Endpoint_Discard_Stream((sizeof(XML_END_TAG) - 1), NULL);
Application->HaveContent = true;
}
else
{
printf(" BINARY");
Endpoint_Discard_Stream(ContentSize);
Endpoint_Discard_Stream(ContentSize, NULL);
}
return true;
@ -74,6 +74,6 @@ static void SideShow_ProcessXMLContent(void* ContentData,
uint32_t ContentSize)
{
printf(" XML");
Endpoint_Discard_Stream(ContentSize);
Endpoint_Discard_Stream(ContentSize, NULL);
}

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -64,6 +64,8 @@ bool IsTMCBulkOUTReset = false;
/** Last used tag value for data transfers */
uint8_t CurrentTransferTag = 0;
/** Length of last data transfer, for reporting to the host in case an in-progress tranfer is aborted */
uint32_t LastTransferLength = 0;
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
@ -190,7 +192,7 @@ void EVENT_USB_Device_ControlRequest(void)
/* Write the request response bytes */
Endpoint_Write_Byte(TMCRequestStatus);
Endpoint_Write_Word_LE(0);
Endpoint_Write_DWord_LE(0); // TODO - Last transfer length
Endpoint_Write_DWord_LE(LastTransferLength);
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
@ -245,7 +247,7 @@ void EVENT_USB_Device_ControlRequest(void)
/* Write the request response bytes */
Endpoint_Write_Byte(TMCRequestStatus);
Endpoint_Write_Word_LE(0);
Endpoint_Write_DWord_LE(0); // TODO - Last transfer length
Endpoint_Write_DWord_LE(LastTransferLength);
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
@ -324,6 +326,7 @@ void TMC_Task(void)
return;
TMC_MessageHeader_t MessageHeader;
uint16_t BytesTransferred;
/* Try to read in a TMC message from the interface, process if one is available */
if (ReadTMCHeader(&MessageHeader))
@ -334,16 +337,33 @@ void TMC_Task(void)
switch (MessageHeader.MessageID)
{
case TMC_MESSAGEID_DEV_DEP_MSG_OUT:
Endpoint_Discard_Stream(MessageHeader.TransferSize, StreamCallback_AbortOUTOnRequest);
BytesTransferred = 0;
while (Endpoint_Discard_Stream(MessageHeader.TransferSize, &BytesTransferred) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
if (IsTMCBulkOUTReset)
break;
}
LastTransferLength = BytesTransferred;
Endpoint_ClearOUT();
break;
case TMC_MESSAGEID_DEV_DEP_MSG_IN:
Endpoint_ClearOUT();
MessageHeader.TransferSize = 3;
MessageHeader.MessageIDSpecific.DeviceOUT.LastMessageTransaction = true;
WriteTMCHeader(&MessageHeader);
Endpoint_Write_Stream_LE("TMC", 3, StreamCallback_AbortINOnRequest);
BytesTransferred = 0;
while (Endpoint_Write_Stream_LE("TMC", MessageHeader.TransferSize, &BytesTransferred) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
if (IsTMCBulkINReset)
break;
}
LastTransferLength = BytesTransferred;
Endpoint_ClearIN();
break;
default:
@ -367,6 +387,8 @@ void TMC_Task(void)
*/
bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader)
{
uint16_t BytesTransferred;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(TMC_OUT_EPNUM);
@ -375,7 +397,13 @@ bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader)
return false;
/* Read in the header of the command from the host */
Endpoint_Read_Stream_LE(MessageHeader, sizeof(TMC_MessageHeader_t), StreamCallback_AbortOUTOnRequest);
BytesTransferred = 0;
while (Endpoint_Read_Stream_LE(MessageHeader, sizeof(TMC_MessageHeader_t), &BytesTransferred) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
if (IsTMCBulkOUTReset)
break;
}
/* Store the new command tag value for later use */
CurrentTransferTag = MessageHeader->Tag;
@ -386,9 +414,7 @@ bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader)
bool WriteTMCHeader(TMC_MessageHeader_t* const MessageHeader)
{
/* Compute the next transfer tag value, must be between 1 and 254 */
if (++CurrentTransferTag == 0xFF)
CurrentTransferTag = 1;
uint16_t BytesTransferred;
/* Set the message tag of the command header */
MessageHeader->Tag = CurrentTransferTag;
@ -398,35 +424,14 @@ bool WriteTMCHeader(TMC_MessageHeader_t* const MessageHeader)
Endpoint_SelectEndpoint(TMC_IN_EPNUM);
/* Send the command header to the host */
Endpoint_Write_Stream_LE(MessageHeader, sizeof(TMC_MessageHeader_t), StreamCallback_AbortINOnRequest);
BytesTransferred = 0;
while (Endpoint_Write_Stream_LE(MessageHeader, sizeof(TMC_MessageHeader_t), &BytesTransferred) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
if (IsTMCBulkINReset)
break;
}
/* Indicate if the command has been aborted or not */
return !(IsTMCBulkINReset);
}
/** Stream callback function for the Endpoint stream write functions. This callback will abort the current stream transfer
* if a TMC Abort Bulk IN request has been issued to the control endpoint.
*/
uint8_t StreamCallback_AbortINOnRequest(void)
{
/* Abort if a TMC Bulk Data IN abort was received */
if (IsTMCBulkINReset)
return STREAMCALLBACK_Abort;
/* Continue with the current stream operation */
return STREAMCALLBACK_Continue;
}
/** Stream callback function for the Endpoint stream read functions. This callback will abort the current stream transfer
* if a TMC Abort Bulk OUT request has been issued to the control endpoint.
*/
uint8_t StreamCallback_AbortOUTOnRequest(void)
{
/* Abort if a TMC Bulk Data IN abort was received */
if (IsTMCBulkOUTReset)
return STREAMCALLBACK_Abort;
/* Continue with the current stream operation */
return STREAMCALLBACK_Continue;
}

@ -150,8 +150,5 @@
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_ControlRequest(void);
uint8_t StreamCallback_AbortINOnRequest(void);
uint8_t StreamCallback_AbortOUTOnRequest(void);
#endif

@ -227,7 +227,7 @@ void CDC1_Task(void)
Endpoint_SelectEndpoint(CDC1_TX_EPNUM);
/* Write the String to the Endpoint */
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString));
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -269,7 +269,7 @@ void CDC2_Task(void)
uint16_t DataLength = Endpoint_BytesInEndpoint();
/* Read in the incoming packet into the buffer */
Endpoint_Read_Stream_LE(&Buffer, DataLength);
Endpoint_Read_Stream_LE(&Buffer, DataLength, NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearOUT();
@ -278,7 +278,7 @@ void CDC2_Task(void)
Endpoint_SelectEndpoint(CDC2_TX_EPNUM);
/* Write the received data to the endpoint */
Endpoint_Write_Stream_LE(&Buffer, DataLength);
Endpoint_Write_Stream_LE(&Buffer, DataLength, NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -198,7 +198,7 @@ void HID_Task(void)
uint8_t GenericData[GENERIC_REPORT_SIZE];
/* Read Generic Report Data */
Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData));
Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData), NULL);
/* Process Generic Report Data */
ProcessGenericHIDReport(GenericData);
@ -220,7 +220,7 @@ void HID_Task(void)
CreateGenericHIDReport(GenericData);
/* Write Generic Report Data */
Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData));
Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -194,7 +194,7 @@ void HID_Task(void)
GetNextReport(&JoystickReportData);
/* Write Joystick Report Data */
Endpoint_Write_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));
Endpoint_Write_Stream_LE(&JoystickReportData, sizeof(JoystickReportData), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -324,7 +324,7 @@ void SendNextReport(void)
PrevKeyboardReportData = KeyboardReportData;
/* Write Keyboard Report Data */
Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -41,7 +41,7 @@
USB_KeyboardReport_Data_t KeyboardReportData;
/** Global structure to hold the current mouse interface HID report, for transmission to the host */
USB_MouseReport_Data_t MouseReportData;
USB_MouseReport_Data_t MouseReportData;
/** Main program entry point. This routine configures the hardware required by the application, then
@ -242,7 +242,7 @@ void Keyboard_HID_Task(void)
if (Endpoint_IsReadWriteAllowed())
{
/* Write Keyboard Report Data */
Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -300,7 +300,7 @@ void Mouse_HID_Task(void)
if (Endpoint_IsReadWriteAllowed())
{
/* Write Mouse Report Data */
Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));
Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -171,7 +171,7 @@ void MIDI_Task(void)
};
/* Write the MIDI event packet to the endpoint */
Endpoint_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
Endpoint_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL);
/* Send the data in the endpoint to the host */
Endpoint_ClearIN();
@ -190,7 +190,7 @@ void MIDI_Task(void)
MIDI_EventPacket_t MIDIEvent;
/* Read the MIDI event packet from the endpoint */
Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL);
/* Check to see if the sent command is a note on message with a non-zero velocity */
if ((MIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && (MIDIEvent.Data3 > 0))

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -166,12 +166,10 @@ static bool SCSI_Command_Inquiry(void)
}
/* Write the INQUIRY data to the endpoint */
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NULL);
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), StreamCallback_AbortOnMassStoreReset);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -193,12 +191,10 @@ static bool SCSI_Command_Request_Sense(void)
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
/* Send the SENSE data - this indicates to the host the status of the last command */
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NULL);
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), StreamCallback_AbortOnMassStoreReset);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -221,6 +221,8 @@ void MassStorage_Task(void)
*/
static bool ReadInCommandBlock(void)
{
uint16_t BytesTransferred;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
@ -229,12 +231,14 @@ static bool ReadInCommandBlock(void)
return false;
/* Read in command block header */
Endpoint_Read_Stream_LE(&CommandBlock, (sizeof(CommandBlock) - sizeof(CommandBlock.SCSICommandData)),
StreamCallback_AbortOnMassStoreReset);
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return false;
BytesTransferred = 0;
while (Endpoint_Read_Stream_LE(&CommandBlock, (sizeof(CommandBlock) - sizeof(CommandBlock.SCSICommandData)),
&BytesTransferred) == ENDPOINT_RWSTREAM_IncompleteTransfer)
{
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return false;
}
/* Verify the command block - abort if invalid */
if ((CommandBlock.Signature != MS_CBW_SIGNATURE) ||
@ -252,13 +256,14 @@ static bool ReadInCommandBlock(void)
}
/* Read in command block command data */
Endpoint_Read_Stream_LE(&CommandBlock.SCSICommandData,
CommandBlock.SCSICommandLength,
StreamCallback_AbortOnMassStoreReset);
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return false;
BytesTransferred = 0;
while (Endpoint_Read_Stream_LE(&CommandBlock.SCSICommandData, CommandBlock.SCSICommandLength,
&BytesTransferred) == ENDPOINT_RWSTREAM_IncompleteTransfer)
{
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return false;
}
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearOUT();
@ -271,6 +276,8 @@ static bool ReadInCommandBlock(void)
*/
static void ReturnCommandStatus(void)
{
uint16_t BytesTransferred;
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
@ -294,27 +301,15 @@ static void ReturnCommandStatus(void)
}
/* Write the CSW to the endpoint */
Endpoint_Write_Stream_LE(&CommandStatus, sizeof(CommandStatus),
StreamCallback_AbortOnMassStoreReset);
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return;
BytesTransferred = 0;
while (Endpoint_Write_Stream_LE(&CommandStatus, sizeof(CommandStatus),
&BytesTransferred) == ENDPOINT_RWSTREAM_IncompleteTransfer)
{
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return;
}
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
}
/** Stream callback function for the Endpoint stream read and write functions. This callback will abort the current stream transfer
* if a Mass Storage Reset request has been issued to the control endpoint.
*/
uint8_t StreamCallback_AbortOnMassStoreReset(void)
{
/* Abort if a Mass Storage reset command was received */
if (IsMassStoreReset)
return STREAMCALLBACK_Abort;
/* Continue with the current stream operation */
return STREAMCALLBACK_Continue;
}

@ -280,7 +280,7 @@ void SendNextReport(void)
PrevMouseReportData = MouseReportData;
/* Write Mouse Report Data */
Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));
Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -182,7 +182,7 @@ void RNDIS_Task(void)
};
/* Indicate that a message response is ready for the host */
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -204,7 +204,7 @@ void RNDIS_Task(void)
if (Endpoint_IsOUTReceived() && !(FrameIN.FrameInBuffer))
{
/* Read in the packet message header */
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t));
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
/* Stall the request if the data is too large */
if (RNDISPacketHeader.DataLength > ETHERNET_FRAME_SIZE_MAX)
@ -214,7 +214,7 @@ void RNDIS_Task(void)
}
/* Read in the Ethernet frame into the buffer */
Endpoint_Read_Stream_LE(FrameIN.FrameData, RNDISPacketHeader.DataLength);
Endpoint_Read_Stream_LE(FrameIN.FrameData, RNDISPacketHeader.DataLength, NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearOUT();
@ -242,10 +242,10 @@ void RNDIS_Task(void)
RNDISPacketHeader.DataLength = FrameOUT.FrameLength;
/* Send the packet header to the host */
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t));
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
/* Send the Ethernet frame data to the host */
Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength);
Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength, NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D NO_DECODE_ETHERNET
LUFA_OPTS += -D NO_DECODE_ARP

@ -203,7 +203,7 @@ void CDC_Task(void)
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
/* Write the String to the Endpoint */
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString));
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString), NULL);
/* Remember if the packet to send completely fills the endpoint */
bool IsFull = (Endpoint_BytesInEndpoint() == CDC_TXRX_EPSIZE);

@ -121,7 +121,6 @@ LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -147,7 +147,7 @@ void ReadNextReport(void)
uint8_t ReportINData[Pipe_BytesInPipe()];
/* Read in HID report data */
Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData));
Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData), NULL);
/* Print report data through the serial port */
for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
@ -198,7 +198,7 @@ void WriteNextReport(uint8_t* ReportOUTData,
Pipe_Write_Byte(ReportIndex);
/* Write out HID report data */
Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
Pipe_Write_Stream_LE(ReportOUTData, ReportLength, NULL);
/* Clear the OUT endpoint, send last data packet */
Pipe_ClearOUT();

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -224,7 +224,7 @@ void Joystick_HID_Task(void)
uint8_t JoystickReport[Pipe_BytesInPipe()];
/* Load in the joystick report */
Pipe_Read_Stream_LE(JoystickReport, Pipe_BytesInPipe());
Pipe_Read_Stream_LE(JoystickReport, Pipe_BytesInPipe(), NULL);
/* Process the read in joystick report from the device */
ProcessJoystickReport(JoystickReport);

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -149,7 +149,7 @@ void ReadNextReport(void)
if (Pipe_IsReadWriteAllowed())
{
/* Read in keyboard report data */
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport));
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport), NULL);
/* Indicate if the modifier byte is non-zero (special key such as shift is being pressed) */
LEDs_ChangeLEDs(LEDS_LED1, (KeyboardReport.Modifier) ? LEDS_LED1 : 0);

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -225,7 +225,7 @@ void Keyboard_HID_Task(void)
uint8_t KeyboardReport[Pipe_BytesInPipe()];
/* Load in the keyboard report */
Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe());
Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe(), NULL);
/* Process the read in keyboard report from the device */
ProcessKeyboardReport(KeyboardReport);

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -181,7 +181,10 @@ void MIDI_Host_Task(void)
{
MIDI_EventPacket_t MIDIEvent;
Pipe_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
Pipe_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL);
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
bool NoteOnEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON >> 4));
bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
@ -191,10 +194,7 @@ void MIDI_Host_Task(void)
printf_P(PSTR("MIDI Note %s - Channel %d, Pitch %d, Velocity %d\r\n"), NoteOnEvent ? "On" : "Off",
((MIDIEvent.Data1 & 0x0F) + 1),
MIDIEvent.Data2, MIDIEvent.Data3);
}
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
}
}
Pipe_SelectPipe(MIDI_DATA_OUT_PIPE);
@ -255,7 +255,7 @@ void MIDI_Host_Task(void)
};
/* Write the MIDI event packet to the pipe */
Pipe_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
Pipe_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL);
/* Send the data in the pipe to the device */
Pipe_ClearOUT();

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -80,8 +80,11 @@ static uint8_t MassStore_SendCommand(MS_CommandBlockWrapper_t* const SCSICommand
Pipe_Unfreeze();
/* Write the CBW command to the OUT pipe */
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t))) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t), NULL)) !=
PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
/* Send the data in the OUT pipe to the attached device */
Pipe_ClearOUT();
@ -200,7 +203,7 @@ static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICom
Pipe_Unfreeze();
/* Read in the block data from the pipe */
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Acknowledge the packet */
@ -213,7 +216,7 @@ static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICom
Pipe_Unfreeze();
/* Write the block data to the pipe */
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Acknowledge the packet */
@ -251,9 +254,12 @@ static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t* const SCSI
Pipe_Unfreeze();
/* Load in the CSW from the attached device */
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t))) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t), NULL)) !=
PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
/* Clear the data ready for next reception */
Pipe_ClearIN();

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D USB_STREAM_TIMEOUT_MS=5000

@ -153,7 +153,7 @@ void ReadNextReport(void)
if (Pipe_IsReadWriteAllowed())
{
/* Read in mouse report data */
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport), NULL);
/* Alter status LEDs according to mouse X movement */
if (MouseReport.X > 0)

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -225,7 +225,7 @@ void Mouse_HID_Task(void)
uint8_t MouseReport[Pipe_BytesInPipe()];
/* Load in the mouse report */
Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe());
Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe(), NULL);
/* Process the read in mouse report from the device */
ProcessMouseReport(MouseReport);

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -52,7 +52,7 @@ uint8_t Printer_SendData(const void* const PrinterCommands,
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, CommandSize)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, CommandSize, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -294,14 +294,15 @@ uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength)
RNDIS_Packet_Message_t DeviceMessage;
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t))) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t), NULL)) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
*PacketLength = (uint16_t)DeviceMessage.DataLength;
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)));
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)),
NULL);
Pipe_Freeze();

@ -147,13 +147,13 @@ void PrintIncomingPackets(void)
if (PacketLength > 1024)
{
puts_P(PSTR(ESC_FG_RED "Packet too large.\r\n" ESC_FG_WHITE));
Pipe_Discard_Stream(PacketLength);
Pipe_Discard_Stream(PacketLength, NULL);
}
else
{
uint8_t PacketBuffer[PacketLength];
Pipe_Read_Stream_LE(&PacketBuffer, PacketLength);
Pipe_Read_Stream_LE(&PacketBuffer, PacketLength, NULL);
for (uint16_t i = 0; i < PacketLength; i++)
printf("0x%02x ", PacketBuffer[i]);

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -55,7 +55,7 @@ void SImage_SendBlockHeader(void)
Pipe_Unfreeze();
/* Write the PIMA block to the data OUT pipe */
Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0));
Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0), NULL);
/* If the block type is a command, send its parameters (if any) */
if (PIMA_SendBlock.Type == PIMA_CONTAINER_CommandBlock)
@ -67,7 +67,7 @@ void SImage_SendBlockHeader(void)
if (ParamBytes)
{
/* Write the PIMA parameters to the data OUT pipe */
Pipe_Write_Stream_LE(&PIMA_SendBlock.Params, ParamBytes);
Pipe_Write_Stream_LE(&PIMA_SendBlock.Params, ParamBytes, NULL);
}
/* Send the PIMA command block to the attached device */
@ -91,7 +91,7 @@ uint8_t SImage_ReceiveEventHeader(void)
Pipe_Unfreeze();
/* Read in the event data into the global structure */
ErrorCode = Pipe_Read_Stream_LE(&PIMA_EventBlock, sizeof(PIMA_EventBlock));
ErrorCode = Pipe_Read_Stream_LE(&PIMA_EventBlock, sizeof(PIMA_EventBlock), NULL);
/* Clear the pipe after read complete to prepare for next event */
Pipe_ClearIN();
@ -166,7 +166,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
}
/* Load in the response from the attached device */
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock, PIMA_COMMAND_SIZE(0));
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock, PIMA_COMMAND_SIZE(0), NULL);
/* Check if the returned block type is a response block */
if (PIMA_ReceivedBlock.Type == PIMA_CONTAINER_ResponseBlock)
@ -178,7 +178,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
if (ParamBytes)
{
/* Read the PIMA parameters from the data IN pipe */
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock.Params, ParamBytes);
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock.Params, ParamBytes, NULL);
}
/* Clear pipe bank after use */
@ -208,7 +208,7 @@ uint8_t SImage_SendData(void* const Buffer,
Pipe_Unfreeze();
/* Write the data contents to the pipe */
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes);
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NULL);
/* Send the last packet to the attached device */
Pipe_ClearOUT();
@ -236,7 +236,7 @@ uint8_t SImage_ReadData(void* const Buffer,
Pipe_Unfreeze();
/* Read in the data into the buffer */
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes);
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NULL);
/* Freeze the pipe again after use */
Pipe_Freeze();

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

@ -190,7 +190,7 @@ void CDC_Host_Task(void)
uint8_t Buffer[BufferLength];
/* Read in the pipe data to the temporary buffer */
Pipe_Read_Stream_LE(Buffer, BufferLength);
Pipe_Read_Stream_LE(Buffer, BufferLength, NULL);
/* Print out the buffer contents to the USART */
for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)

@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"

File diff suppressed because one or more lines are too long

@ -1433,7 +1433,7 @@ PREDEFINED = __DOXYGEN__ \
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code.
EXPAND_AS_DEFINED = __CALLBACK_PARAM
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all references to function-like macros

@ -69,10 +69,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_AUDIO_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief Audio Class Device Mode Configuration and State Structure.

@ -161,7 +161,7 @@ uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo
return ENDPOINT_RWSTREAM_DeviceDisconnected;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
return Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
return Endpoint_Write_Stream_LE(Data, Length, NULL);
}
uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
@ -275,10 +275,10 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDC
.wLength = sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
};
Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL);
Endpoint_Write_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
NO_STREAM_CALLBACK);
NULL);
Endpoint_ClearIN();
}

@ -87,10 +87,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_CDC_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief CDC Class Device Mode Configuration and State Structure.

@ -179,7 +179,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
if (ReportID)
Endpoint_Write_Byte(ReportID);
Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NULL);
Endpoint_ClearIN();
}

@ -69,11 +69,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_HID_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief HID Class Device Mode Configuration and State Structure.

@ -96,7 +96,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != ENDPOINT_RWSTREAM_NoError)
if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError)
return ErrorCode;
if (!(Endpoint_IsReadWriteAllowed()))
@ -136,7 +136,7 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
if (!(Endpoint_IsReadWriteAllowed()))
return false;
Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL);
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearOUT();

@ -69,10 +69,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MIDI_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Define: */
/** \brief MIDI Class Device Mode Configuration and State Structure.

@ -36,8 +36,6 @@
#define __INCLUDE_FROM_MASSSTORAGE_DEVICE_C
#include "MassStorage.h"
static volatile bool* CallbackIsResetSource;
void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
if (!(Endpoint_IsSETUPReceived()))
@ -159,14 +157,21 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
uint16_t BytesProcessed;
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
if (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock,
(sizeof(MS_CommandBlockWrapper_t) - 16),
StreamCallback_MS_Device_AbortOnMassStoreReset))
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
BytesProcessed = 0;
while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock,
(sizeof(MS_CommandBlockWrapper_t) - 16), &BytesProcessed) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
return false;
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
if (MSInterfaceInfo->State.IsMassStoreReset)
return false;
}
if ((MSInterfaceInfo->State.CommandBlock.Signature != MS_CBW_SIGNATURE) ||
@ -182,12 +187,17 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
if (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock.SCSICommandData,
MSInterfaceInfo->State.CommandBlock.SCSICommandLength,
StreamCallback_MS_Device_AbortOnMassStoreReset))
BytesProcessed = 0;
while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock.SCSICommandData,
MSInterfaceInfo->State.CommandBlock.SCSICommandLength, &BytesProcessed) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
return false;
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
if (MSInterfaceInfo->State.IsMassStoreReset)
return false;
}
Endpoint_ClearOUT();
@ -221,27 +231,20 @@ static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInt
return;
}
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
if (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, sizeof(MS_CommandStatusWrapper_t),
StreamCallback_MS_Device_AbortOnMassStoreReset))
uint16_t BytesProcessed = 0;
while (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus,
sizeof(MS_CommandStatusWrapper_t), &BytesProcessed) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
return;
}
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
Endpoint_ClearIN();
}
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void)
{
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
if (*CallbackIsResetSource)
return STREAMCALLBACK_Abort;
else
return STREAMCALLBACK_Continue;
}
#endif

@ -69,10 +69,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MASSSTORAGE_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief Mass Storage Class Device Mode Configuration and State Structure.
@ -159,9 +155,8 @@
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_MASSSTORAGE_DEVICE_C)
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void);
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
#endif
#endif

@ -177,7 +177,7 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
.wLength = 0,
};
Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL);
Endpoint_ClearIN();
@ -192,7 +192,7 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
if (Endpoint_IsOUTReceived() && !(RNDISInterfaceInfo->State.FrameIN.FrameInBuffer))
{
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
if (RNDISPacketHeader.DataLength > ETHERNET_FRAME_SIZE_MAX)
{
@ -200,7 +200,7 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
return;
}
Endpoint_Read_Stream_LE(RNDISInterfaceInfo->State.FrameIN.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(RNDISInterfaceInfo->State.FrameIN.FrameData, RNDISPacketHeader.DataLength, NULL);
Endpoint_ClearOUT();
@ -220,8 +220,8 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
RNDISPacketHeader.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
RNDISPacketHeader.DataLength = RNDISInterfaceInfo->State.FrameOUT.FrameLength;
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(RNDISInterfaceInfo->State.FrameOUT.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
Endpoint_Write_Stream_LE(RNDISInterfaceInfo->State.FrameOUT.FrameData, RNDISPacketHeader.DataLength, NULL);
Endpoint_ClearIN();
RNDISInterfaceInfo->State.FrameOUT.FrameInBuffer = false;

@ -69,11 +69,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_RNDIS_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief RNDIS Class Device Mode Configuration and State Structure.

@ -236,14 +236,14 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
if (Pipe_IsINReceived())
{
USB_Request_Header_t Notification;
Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL);
if ((Notification.bRequest == CDC_NOTIF_SerialState) &&
(Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)))
{
Pipe_Read_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
NO_STREAM_CALLBACK);
NULL);
Pipe_ClearIN();
@ -323,7 +323,7 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
ErrorCode = Pipe_Write_Stream_LE(Data, Length, NULL);
Pipe_Freeze();
return ErrorCode;

@ -70,10 +70,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_CDC_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief CDC Class Host Mode Configuration and State Structure.

@ -251,7 +251,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
ReportSize = Pipe_BytesInPipe();
}
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearIN();
@ -280,9 +280,9 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
Pipe_Unfreeze();
if (ReportID)
Pipe_Write_Stream_LE(&ReportID, sizeof(ReportID), NO_STREAM_CALLBACK);
Pipe_Write_Stream_LE(&ReportID, sizeof(ReportID), NULL);
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();

@ -69,11 +69,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_HID_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some HID Host functions, indicating a logical (and not hardware) error. */

@ -203,7 +203,7 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber);
if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if (!(Pipe_IsReadWriteAllowed()))
@ -223,7 +223,7 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
if (!(Pipe_IsReadWriteAllowed()))
return false;
Pipe_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK);
Pipe_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL);
if (!(Pipe_IsReadWriteAllowed()))
Pipe_ClearIN();

@ -67,10 +67,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MIDI_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief MIDI Class Host Mode Configuration and State Structure.

@ -181,7 +181,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t),
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();
@ -272,7 +272,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearIN();
@ -282,7 +282,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();
@ -311,7 +311,7 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t),
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
NULL)) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}

@ -67,10 +67,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some Mass Storage Host functions, indicating a logical (and not hardware) error. */

@ -298,7 +298,7 @@ uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();

@ -67,10 +67,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_PRINTER_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief Printer Class Host Mode Configuration and State Structure.

@ -450,7 +450,7 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
RNDIS_Packet_Message_t DeviceMessage;
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
NULL)) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
@ -458,9 +458,9 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
*PacketLength = (uint16_t)DeviceMessage.DataLength;
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)),
NO_STREAM_CALLBACK);
NULL);
Pipe_Read_Stream_LE(Buffer, *PacketLength, NO_STREAM_CALLBACK);
Pipe_Read_Stream_LE(Buffer, *PacketLength, NULL);
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
@ -491,12 +491,12 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
NULL)) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
Pipe_Write_Stream_LE(Buffer, PacketLength, NO_STREAM_CALLBACK);
Pipe_Write_Stream_LE(Buffer, PacketLength, NULL);
Pipe_ClearOUT();
Pipe_Freeze();

@ -71,10 +71,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_RNDIS_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief RNDIS Class Host Mode Configuration and State Structure.

@ -206,14 +206,14 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
if (ParamBytes)
{
if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
}
@ -271,14 +271,14 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
return PIPE_RWSTREAM_DeviceDisconnected;
}
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK);
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NULL);
if (PIMAHeader->Type == PIMA_CONTAINER_ResponseBlock)
{
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
if (ParamBytes)
Pipe_Read_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK);
Pipe_Read_Stream_LE(&PIMAHeader->Params, ParamBytes, NULL);
Pipe_ClearIN();
}
@ -300,7 +300,7 @@ uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NO_STREAM_CALLBACK);
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NULL);
Pipe_ClearOUT();
Pipe_Freeze();
@ -320,7 +320,7 @@ uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NO_STREAM_CALLBACK);
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NULL);
Pipe_Freeze();
@ -356,7 +356,7 @@ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NO_STREAM_CALLBACK);
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NULL);
Pipe_ClearIN();
Pipe_Freeze();

@ -67,10 +67,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some Still Image Host functions, indicating a logical (and not hardware) error. */

@ -36,13 +36,17 @@
#include "EndpointStream.h"
#if !defined(CONTROL_ONLY_DEVICE)
uint8_t Endpoint_Discard_Stream(uint16_t Length
__CALLBACK_PARAM)
uint8_t Endpoint_Discard_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t ErrorCode;
uint8_t ErrorCode;
uint16_t BytesInTransfer = 0;
if ((ErrorCode = Endpoint_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
Length -= *BytesProcessed;
while (Length)
{
@ -50,10 +54,11 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
{
Endpoint_ClearOUT();
#if !defined(NO_STREAM_CALLBACKS)
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
return ENDPOINT_RWSTREAM_CallbackAborted;
#endif
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return ENDPOINT_RWSTREAM_IncompleteTransfer;
}
if ((ErrorCode = Endpoint_WaitUntilReady()))
return ErrorCode;
@ -61,7 +66,48 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
else
{
Endpoint_Discard_Byte();
Length--;
BytesInTransfer++;
}
}
return ENDPOINT_RWSTREAM_NoError;
}
uint8_t Endpoint_Null_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t ErrorCode;
uint16_t BytesInTransfer = 0;
if ((ErrorCode = Endpoint_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
Length -= *BytesProcessed;
while (Length)
{
if (!(Endpoint_IsReadWriteAllowed()))
{
Endpoint_ClearIN();
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return ENDPOINT_RWSTREAM_IncompleteTransfer;
}
if ((ErrorCode = Endpoint_WaitUntilReady()))
return ErrorCode;
}
else
{
Endpoint_Write_Byte(0);
Length--;
BytesInTransfer++;
}
}
@ -72,122 +118,142 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*BufferPtr)
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte(BufferPtr))
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte(BufferPtr))
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*BufferPtr)
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte(BufferPtr))
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte(BufferPtr))
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Endpoint_Read_Byte()
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Endpoint_Read_Byte()
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_RW.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_RW.c"
#endif
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*BufferPtr)
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte(BufferPtr))
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte(BufferPtr))
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*BufferPtr)
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte(BufferPtr))
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte(BufferPtr))
#include "Template/Template_Endpoint_Control_W.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Endpoint_Read_Byte()
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_Control_R.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_Control_R.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Endpoint_Read_Byte()
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_Byte()
#include "Template/Template_Endpoint_Control_R.c"
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_Control_R.c"
#endif

@ -57,10 +57,6 @@
#include "../../../Common/Common.h"
#include "USBTask.h"
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
#include "StreamCallbacks.h"
#endif
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
@ -72,12 +68,6 @@
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
#define __CALLBACK_PARAM , StreamCallbackPtr_t Callback
#else
#define __CALLBACK_PARAM
#endif
/* Public Interface - May be used in end-application: */
/* Enums: */
/** Enum for the possible error return codes of the \c Endpoint_*_Stream_* functions. */
@ -98,8 +88,10 @@
* within the software timeout period set by the
* \ref USB_STREAM_TIMEOUT_MS macro.
*/
ENDPOINT_RWSTREAM_CallbackAborted = 5, /**< Indicates that the stream's callback function
* aborted the transfer early.
ENDPOINT_RWSTREAM_IncompleteTransfer = 5, /**< Indicates that the endpoint bank became full or empty before
* the complete contents of the current stream could be
* transferred. The endpoint stream function should be called
* again to process the next chunk of data in the transfer.
*/
};
@ -118,194 +110,274 @@
};
/* Function Prototypes: */
/** Reads and discards the given number of bytes from the endpoint from the given buffer,
/** \name Stream functions for null data */
//@{
/** Reads and discards the given number of bytes from the currently selected endpoint's bank,
* discarding fully read packets from the host as needed. The last packet is not automatically
* discarded once the remaining bytes has been read; the user is responsible for manually
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. Between
* each USB packet, the given stream callback function is executed repeatedly until the next
* packet is ready, allowing for early aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token \c NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro.
*
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
* storage location, the transfer will instead be performed as a series of chunks. Each time
* the endpoint bank becomes empty while there is still data to process (and after the current
* packet has been acknowledged) the BytesProcessed location will be updated with the total number
* of bytes processed in the stream, and the function will exit with an error code of
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
* in the user code - to continue the transfer, call the function again with identical parameters
* and it will resume until the BytesProcessed value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t ErrorCode;
*
* if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \note This routine should not be used on CONTROL type endpoints.
*
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
* \param[in] Length Number of bytes to discard via the currently selected endpoint.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Discard_Stream(uint16_t Length
__CALLBACK_PARAM);
/** Writes the given number of bytes to the endpoint from the given buffer in little endian,
* sending full packets to the host as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Endpoint_ClearIN() macro. Between each USB packet, the given stream callback function
* is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early
* aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token \c NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
uint8_t Endpoint_Discard_Stream(uint16_t Length,
uint16_t* const BytesProcessed);
/** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending
* full packets to the host as needed. The last packet is not automatically sent once the
* remaining bytes have been written; the user is responsible for manually sending the last
* packet to the host via the \ref Endpoint_ClearIN() macro.
*
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
* storage location, the transfer will instead be performed as a series of chunks. Each time
* the endpoint bank becomes full while there is still data to process (and after the current
* packet transmission has been initiated) the BytesProcessed location will be updated with the
* total number of bytes processed in the stream, and the function will exit with an error code of
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
* in the user code - to continue the transfer, call the function again with identical parameters
* and it will resume until the BytesProcessed value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t ErrorCode;
*
* if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \note This routine should not be used on CONTROL type endpoints.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
* \param[in] Length Number of zero bytes to send via the currently selected endpoint.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_Stream_LE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Endpoint_Null_Stream(uint16_t Length,
uint16_t* const BytesProcessed);
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_EStream_LE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
//@}
/** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
/** \name Stream functions for RAM source/destination data */
//@{
/** Writes the given number of bytes to the endpoint from the given buffer in little endian,
* sending full packets to the host as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Endpoint_ClearIN() macro.
*
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
* storage location, the transfer will instead be performed as a series of chunks. Each time
* the endpoint bank becomes full while there is still data to process (and after the current
* packet transmission has been initiated) the BytesProcessed location will be updated with the
* total number of bytes processed in the stream, and the function will exit with an error code of
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
* in the user code - to continue the transfer, call the function again with identical parameters
* and it will resume until the BytesProcessed value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
*
* if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
* NULL)) != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream),
* &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
* \note This routine should not be used on CONTROL type endpoints.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_PStream_LE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Endpoint_Write_Stream_LE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** Writes the given number of bytes to the endpoint from the given buffer in big endian,
* sending full packets to the host as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Endpoint_ClearIN() macro. Between each USB packet, the given stream callback function
* is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early
* aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token \c NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
* \ref Endpoint_ClearIN() macro.
*
* \note This routine should not be used on CONTROL type endpoints.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_Stream_BE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_EStream_BE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_PStream_BE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** Reads the given number of bytes from the endpoint from the given buffer in little endian,
* discarding fully read packets from the host as needed. The last packet is not automatically
* discarded once the remaining bytes has been read; the user is responsible for manually
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. Between
* each USB packet, the given stream callback function is executed repeatedly until the endpoint
* is ready to accept the next packet, allowing for early aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token \c NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro.
*
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
* storage location, the transfer will instead be performed as a series of chunks. Each time
* the endpoint bank becomes empty while there is still data to process (and after the current
* packet has been acknowledged) the BytesProcessed location will be updated with the total number
* of bytes processed in the stream, and the function will exit with an error code of
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
* in the user code - to continue the transfer, call the function again with identical parameters
* and it will resume until the BytesProcessed value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
*
* if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
* NULL)) != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream),
* &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \note This routine should not be used on CONTROL type endpoints.
*
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_Stream_LE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE().
*
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_EStream_LE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** Reads the given number of bytes from the endpoint from the given buffer in big endian,
* discarding fully read packets from the host as needed. The last packet is not automatically
* discarded once the remaining bytes has been read; the user is responsible for manually
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. Between
* each USB packet, the given stream callback function is executed repeatedly until the endpoint
* is ready to accept the next packet, allowing for early aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token \c NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro.
*
* \note This routine should not be used on CONTROL type endpoints.
*
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_Stream_BE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE().
*
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, \c NULL if no callback.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_EStream_BE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,
* sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
@ -329,7 +401,10 @@
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,
* sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
* in both failure and success states; the user is responsible for manually clearing the setup OUT to
* finalize the transfer via the \ref Endpoint_ClearOUT() macro.
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -345,12 +420,13 @@
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_Control_EStream_LE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,
* discarding fully read packets from the host as needed. The device IN acknowledgement is not
* automatically sent after success or failure states; the user is responsible for manually sending the
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -361,18 +437,18 @@
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_Control_PStream_LE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,
* sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
* in both failure and success states; the user is responsible for manually clearing the setup OUT to
* finalize the transfer via the \ref Endpoint_ClearOUT() macro.
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,
* discarding fully read packets from the host as needed. The device IN acknowledgement is not
* automatically sent after success or failure states; the user is responsible for manually sending the
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -383,15 +459,71 @@
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
//@}
/** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
/** \name Stream functions for EEPROM source/destination data */
//@{
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_EStream_LE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_EStream_BE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE().
*
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_EStream_LE(void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE().
*
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_EStream_BE(void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -407,12 +539,10 @@
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_Control_EStream_BE(const void* Buffer,
uint8_t Endpoint_Write_Control_EStream_LE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
/** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -428,13 +558,10 @@
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_Control_PStream_BE(const void* Buffer,
uint8_t Endpoint_Write_Control_EStream_BE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,
* discarding fully read packets from the host as needed. The device IN acknowledgement is not
* automatically sent after success or failure states; the user is responsible for manually sending the
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -450,10 +577,10 @@
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Endpoint_Read_Control_EStream_LE(void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -469,13 +596,46 @@
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_Control_EStream_LE(void* Buffer,
uint8_t Endpoint_Read_Control_EStream_BE(void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
//@}
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,
* discarding fully read packets from the host as needed. The device IN acknowledgement is not
* automatically sent after success or failure states; the user is responsible for manually sending the
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
/** \name Stream functions for PROGMEM source/destination data */
//@{
/** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_PStream_LE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current
* transaction should be updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Write_PStream_BE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -486,15 +646,17 @@
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
uint8_t Endpoint_Write_Control_PStream_LE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
@ -505,13 +667,14 @@
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
* \param[out] Buffer Pointer to the destination data buffer to write to.
* \param[in] Length Number of bytes to send via the currently selected endpoint.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
*
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
uint8_t Endpoint_Read_Control_EStream_BE(void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Endpoint_Write_Control_PStream_BE(const void* Buffer,
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
//@}
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)

@ -35,26 +35,31 @@
#include "PipeStream.h"
uint8_t Pipe_Discard_Stream(uint16_t Length
__CALLBACK_PARAM)
uint8_t Pipe_Discard_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t ErrorCode;
uint16_t BytesInTransfer = 0;
Pipe_SetPipeToken(PIPE_TOKEN_IN);
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
Length -= *BytesProcessed;
while (Length)
{
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_ClearIN();
#if !defined(NO_STREAM_CALLBACKS)
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
return PIPE_RWSTREAM_CallbackAborted;
#endif
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return PIPE_RWSTREAM_IncompleteTransfer;
}
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
@ -62,7 +67,50 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
else
{
Pipe_Discard_Byte();
Length--;
BytesInTransfer++;
}
}
return PIPE_RWSTREAM_NoError;
}
uint8_t Pipe_Null_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t ErrorCode;
uint16_t BytesInTransfer = 0;
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
Length -= *BytesProcessed;
while (Length)
{
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_ClearOUT();
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return PIPE_RWSTREAM_IncompleteTransfer;
}
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
}
else
{
Pipe_Write_Byte(0);
Length--;
BytesInTransfer++;
}
}
@ -77,7 +125,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*BufferPtr)
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_LE
@ -85,7 +134,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_LE
@ -93,7 +143,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE
@ -101,7 +152,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*BufferPtr)
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_BE
@ -109,7 +161,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_BE
@ -117,7 +170,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE
@ -125,7 +179,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Pipe_Read_Byte()
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_Byte()
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_LE
@ -133,7 +188,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr++, Pipe_Read_Byte())
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_Byte())
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE
@ -141,7 +197,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Pipe_Read_Byte()
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_Byte()
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_BE
@ -149,7 +206,8 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Pipe_Read_Byte())
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_Byte())
#include "Template/Template_Pipe_RW.c"
#endif

@ -57,10 +57,6 @@
#include "../../../Common/Common.h"
#include "USBTask.h"
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
#include "StreamCallbacks.h"
#endif
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
@ -71,12 +67,6 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
#define __CALLBACK_PARAM , StreamCallbackPtr_t Callback
#else
#define __CALLBACK_PARAM
#endif
/* Public Interface - May be used in end-application: */
/* Enums: */
@ -92,200 +82,377 @@
* within the software timeout period set by the
* \ref USB_STREAM_TIMEOUT_MS macro.
*/
PIPE_RWSTREAM_CallbackAborted = 4, /**< Indicates that the stream's callback function aborted
* the transfer early.
PIPE_RWSTREAM_IncompleteTransfer = 4, /**< Indicates that the pipe bank became full/empty before the
* complete contents of the stream could be transferred.
*/
};
/* Function Prototypes: */
/** \name Stream functions for null data */
//@{
/** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host
* as needed. The last packet is not automatically discarded once the remaining bytes has been read; the
* user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro.
* Between each USB packet, the given stream callback function is executed repeatedly until the next packet is ready,
* allowing for early aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or
* succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer
* will instead be performed as a series of chunks. Each time the pipe bank becomes empty while there is still data
* to process (and after the current packet has been acknowledged) the BytesProcessed location will be updated with
* the total number of bytes processed in the stream, and the function will exit with an error code of
* \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to
* continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed
* value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t ErrorCode;
*
* if ((ErrorCode = Pipe_Discard_Stream(512, NULL)) != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Pipe_Discard_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[in] Length Number of bytes to discard via the currently selected pipe.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be processed at once.
*
* The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[in] Length Number of bytes to send via the currently selected pipe.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Discard_Stream(uint16_t Length,
uint16_t* const BytesProcessed);
/** Writes a given number of zeroed bytes to the pipe, sending full pipe packets from the host to the device
* as needed. The last packet is not automatically sent once the remaining bytes has been written; the
* user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearOUT() macro.
*
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or
* succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer
* will instead be performed as a series of chunks. Each time the pipe bank becomes full while there is still data
* to process (and after the current packet transmission has been initiated) the BytesProcessed location will be
* updated with the total number of bytes processed in the stream, and the function will exit with an error code of
* \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to
* continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed
* value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t ErrorCode;
*
* if ((ErrorCode = Pipe_Null_Stream(512, NULL)) != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Pipe_Null_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[in] Length Number of zero bytes to write via the currently selected pipe.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be processed at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Discard_Stream(uint16_t Length
__CALLBACK_PARAM);
uint8_t Pipe_Null_Stream(uint16_t Length,
uint16_t* const BytesProcessed);
//@}
/** \name Stream functions for RAM source/destination data */
//@{
/** Writes the given number of bytes to the pipe from the given buffer in little endian,
* sending full packets to the device as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
*
* The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
* storage location, the transfer will instead be performed as a series of chunks. Each time
* the pipe bank becomes full while there is still data to process (and after the current
* packet transmission has been initiated) the BytesProcessed location will be updated with the
* total number of bytes processed in the stream, and the function will exit with an error code of
* \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
* in the user code - to continue the transfer, call the function again with identical parameters
* and it will resume until the BytesProcessed value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
*
* if ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream),
* NULL)) != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream),
* &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Write_Stream_LE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Write_EStream_LE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Pipe_Write_Stream_LE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Write_PStream_LE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** Writes the given number of bytes to the pipe from the given buffer in big endian,
* sending full packets to the device as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
*
* The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
* \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Write_Stream_BE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().
/** Reads the given number of bytes from the pipe into the given buffer in little endian,
* sending full packets to the device as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once,
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid
* storage location, the transfer will instead be performed as a series of chunks. Each time
* the pipe bank becomes empty while there is still data to process (and after the current
* packet has been acknowledged) the BytesProcessed location will be updated with the total number
* of bytes processed in the stream, and the function will exit with an error code of
* \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed
* in the user code - to continue the transfer, call the function again with identical parameters
* and it will resume until the BytesProcessed value reaches the total transfer length.
*
* <b>Single Stream Transfer Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
*
* if ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream),
* NULL)) != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* <b>Partial Stream Transfers Example:</b>
* \code
* uint8_t DataStream[512];
* uint8_t ErrorCode;
* uint16_t BytesProcessed;
*
* BytesProcessed = 0;
* while ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream),
* &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer)
* {
* // Stream not yet complete - do other actions here, abort if required
* }
*
* if (ErrorCode != PIPE_RWSTREAM_NoError)
* {
* // Stream failed to complete - check ErrorCode here
* }
* \endcode
*
* \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Write_EStream_BE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Pipe_Write_Stream_BE().
uint8_t Pipe_Read_Stream_LE(void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** Reads the given number of bytes from the pipe into the given buffer in big endian,
* sending full packets to the device as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
* \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
*
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Write_PStream_BE(const void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Pipe_Read_Stream_BE(void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
//@}
/** Reads the given number of bytes from the pipe into the given buffer in little endian,
* sending full packets to the device as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
/** \name Stream functions for EEPROM source/destination data */
//@{
/** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be written at once.
*
* The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Write_EStream_LE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Read_Stream_LE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Pipe_Write_EStream_BE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Read_EStream_LE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** Reads the given number of bytes from the pipe into the given buffer in big endian,
* sending full packets to the device as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
* \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is
* executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().
*
* The callback routine should be created according to the information in \ref Group_StreamCallbacks.
* If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
* disabled and this function has the Callback parameter omitted.
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be read at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Read_EStream_BE(void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
//@}
/** \name Stream functions for PROGMEM source/destination data */
//@{
/** FLASH buffer source version of \ref Pipe_Write_Stream_LE().
*
* The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
* having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Read_Stream_BE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Pipe_Write_PStream_LE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().
/** FLASH buffer source version of \ref Pipe_Write_Stream_BE().
*
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
* \param[in] Buffer Pointer to the source data buffer to read from.
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
* \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should
* updated, \c NULL if the entire stream should be written at once.
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t Pipe_Read_EStream_BE(void* Buffer,
uint16_t Length
__CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
uint8_t Pipe_Write_PStream_BE(const void* Buffer,
uint16_t Length,
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1);
//@}
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)

@ -1,87 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief USB endpoint/pipe stream callback management.
*
* This file contains definitions for the creation of optional callback routines which can be passed to the
* endpoint and/or pipe stream APIs, to abort the transfer currently in progress when a condition is met.
*
* \note This file should not be included directly. It is automatically included as needed by the USB driver
* dispatch header located in LUFA/Drivers/USB/USB.h.
*/
/** \ingroup Group_USB
* @defgroup Group_StreamCallbacks Endpoint and Pipe Stream Callbacks
*
* Macros and enums for the stream callback routines. This module contains the code required to easily set up
* stream callback functions which can be used to force early abort of a stream read/write process. Each callback
* should take no arguments, and return a value from the \ref StreamCallback_Return_ErrorCodes_t enum.
*
* @{
*/
#ifndef __STREAMCALLBACK_H__
#define __STREAMCALLBACK_H__
/* Includes: */
#include <stdint.h>
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream
* call has no callback function to be called between USB packets.
*/
#define NO_STREAM_CALLBACK NULL
/* Enums: */
/** Enum for the possible error return codes of a stream callback function. */
enum StreamCallback_Return_ErrorCodes_t
{
STREAMCALLBACK_Continue = 0, /**< Continue sending or receiving the stream. */
STREAMCALLBACK_Abort = 1, /**< Abort the stream send or receiving process. */
};
/* Type Defines: */
/** Type define for a Stream Callback function (function taking no arguments and retuning a
* uint8_t value). Stream callback functions should have an identical function signature if they
* are to be used as the callback parameter of the stream functions.
*/
typedef uint8_t (* const StreamCallbackPtr_t)(void);
#endif
/** @} */

@ -22,6 +22,7 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
while (Length && Endpoint_BytesInEndpoint())
{
TEMPLATE_TRANSFER_BYTE(DataStream);
TEMPLATE_BUFFER_MOVE(DataStream, 1);
Length--;
}
@ -44,5 +45,6 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
#undef TEMPLATE_BUFFER_OFFSET
#undef TEMPLATE_BUFFER_MOVE
#undef TEMPLATE_FUNC_NAME
#undef TEMPLATE_TRANSFER_BYTE

@ -29,6 +29,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
while (Length && (BytesInEndpoint < USB_ControlEndpointSize))
{
TEMPLATE_TRANSFER_BYTE(DataStream);
TEMPLATE_BUFFER_MOVE(DataStream, 1);
Length--;
BytesInEndpoint++;
}
@ -52,5 +53,6 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
}
#undef TEMPLATE_BUFFER_OFFSET
#undef TEMPLATE_BUFFER_MOVE
#undef TEMPLATE_FUNC_NAME
#undef TEMPLATE_TRANSFER_BYTE

@ -1,23 +1,31 @@
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint16_t BytesInTransfer = 0;
uint8_t ErrorCode;
if ((ErrorCode = Endpoint_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
{
Length -= *BytesProcessed;
TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed);
}
while (Length)
{
if (!(Endpoint_IsReadWriteAllowed()))
{
TEMPLATE_CLEAR_ENDPOINT();
#if !defined(NO_STREAM_CALLBACKS)
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
return ENDPOINT_RWSTREAM_CallbackAborted;
#endif
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return ENDPOINT_RWSTREAM_IncompleteTransfer;
}
if ((ErrorCode = Endpoint_WaitUntilReady()))
return ErrorCode;
@ -25,7 +33,9 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
else
{
TEMPLATE_TRANSFER_BYTE(DataStream);
TEMPLATE_BUFFER_MOVE(DataStream, 1);
Length--;
BytesInTransfer++;
}
}
@ -37,3 +47,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
#undef TEMPLATE_TRANSFER_BYTE
#undef TEMPLATE_CLEAR_ENDPOINT
#undef TEMPLATE_BUFFER_OFFSET
#undef TEMPLATE_BUFFER_MOVE

@ -1,8 +1,9 @@
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
uint16_t Length
__CALLBACK_PARAM)
uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint16_t BytesInTransfer = 0;
uint8_t ErrorCode;
Pipe_SetPipeToken(TEMPLATE_TOKEN);
@ -10,16 +11,23 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
{
Length -= *BytesProcessed;
TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed);
}
while (Length)
{
if (!(Pipe_IsReadWriteAllowed()))
{
TEMPLATE_CLEAR_PIPE();
#if !defined(NO_STREAM_CALLBACKS)
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
return PIPE_RWSTREAM_CallbackAborted;
#endif
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return PIPE_RWSTREAM_IncompleteTransfer;
}
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
@ -27,7 +35,9 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
else
{
TEMPLATE_TRANSFER_BYTE(DataStream);
TEMPLATE_BUFFER_MOVE(DataStream, 1);
Length--;
BytesInTransfer++;
}
}
@ -40,4 +50,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
#undef TEMPLATE_TRANSFER_BYTE
#undef TEMPLATE_CLEAR_PIPE
#undef TEMPLATE_BUFFER_OFFSET
#undef TEMPLATE_BUFFER_MOVE

@ -156,6 +156,10 @@ uint8_t Endpoint_WaitUntilReady(void)
return ENDPOINT_READYWAIT_NoError;
}
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
uint8_t USB_DeviceState_LCL = USB_DeviceState;
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)

@ -172,6 +172,10 @@ uint8_t Pipe_WaitUntilReady(void)
return PIPE_READYWAIT_NoError;
}
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
if (Pipe_IsStalled())
return PIPE_READYWAIT_PipeStalled;
else if (USB_HostState == HOST_STATE_Unattached)

@ -15,6 +15,7 @@
* - Added a new general RingBuff.h miscellaneous ring buffer library driver header
* - Added new GCC_FORCE_POINTER_ACCESS() macro to correct GCC's mishandling of struct pointer accesses
* - Added basic driver example use code to the library documentation
* - Added new Endpoint_Null_Stream() and Pipe_Null_stream() functions
* - Library Applications:
* - Added ability to write protect Mass Storage disk write operations from the host OS
*
@ -26,6 +27,10 @@
* - The USARTStream global is now public and documented in the SerialStream module, allowing for the serial USART
* stream to be accessed via its handle rather than via the implicit stdout and stdin streams
* - The FAST_STREAM_TRANSFERS compile time option has been removed due to lack of use and low cost/benefit ratio
* - Altered all endpoint/pipe stream transfers so that the new BytesProcessed parameter now points to a location
* where the number of bytes in the transfer that have been completed can be stored (or NULL if entire transaction
* should be performed in one chunk)
* - The NO_STREAM_CALLBACKS compile time option has now been removed due to the new partial stream transfer feature
* - Library Applications:
* - Changed the XPLAINBridge software UART to use the regular timer CTC mode instead of the alternative CTC mode
* via the Input Capture register, to reduce user confusion
@ -49,6 +54,7 @@
* timeout period on received packets as set by USB_STREAM_TIMEOUT_MS (thanks to Justin Rajewski)
* - Fixed possible programming problem in the AVRISP-MKII clone project when programming specific patterns into a target
* memory space that is only byte (not page) addressable
* - Fixed errors in the incomplete Test and Measurement device demo preventing proper operation (thanks to Pavel Plotnikov)
*
*
* \section Sec_ChangeLog101122 Version 101122

@ -82,14 +82,6 @@
* prevent data corruption issues. However, by default LUFA employs a workaround to allow for unordered Endpoint/Pipe initialisation. This compile
* time token may be used to restrict the intialisation order to ascending indexes only in exchange for a smaller compiled binary size.
*
* <b>NO_STREAM_CALLBACKS</b> - ( \ref Group_EndpointPacketManagement , \ref Group_PipePacketManagement )\n
* Both the endpoint and the pipe driver code contains stream functions, allowing for arrays of data to be sent to or from the
* host easily via a single function call (rather than complex routines worrying about sending full packets, waiting for the endpoint/
* pipe to become ready, etc.). By default, these stream functions require a callback function which is executed after each byte processed,
* allowing for early-aborts of stream transfers by the application. If callbacks are not required in an application, they can be removed
* by defining this token, reducing the compiled binary size. When removed, the stream functions no longer accept a callback function as
* a parameter.
*
* <b>USE_STATIC_OPTIONS</b>=<i>x</i> - ( \ref Group_USBManagement ) \n
* By default, the USB_Init() function accepts dynamic options at runtime to alter the library behaviour, including whether the USB pad
* voltage regulator is enabled, and the device speed when in device mode. By defining this token to a mask comprised of the USB options

@ -45,6 +45,7 @@
* - EMUCOMBOX, a USB-RS422 adapter for E-Mu Emax samplers: http://users.skynet.be/emxp/EMUCOMBOX.htm
* - Estick JTAG, an ARM JTAG debugger: http://code.google.com/p/estick-jtag/
* - "Fingerlicking Wingdinger" (WARNING: Bad Language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/
* - Flyatar, a real-time fly tracking system: https://github.com/peterpolidoro/Flyatar
* - Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master
* - Generic HID Device Creator: http://generichid.sourceforge.net/
* - Ghetto Drum, a MIDI drum controller: http://noisybox.net/art/gdrum/

@ -17,6 +17,20 @@
* size, the new ORDERED_EP_CONFIG compile time option may be defined in the project makefile to restrict the ordering
* in exchange for a smaller compiled binary size.
*
* <b>Device Mode</b>
* - The Endpoint stream functions now all require a BytesProcessed parameter instead of the previous callback parameter.
* This should be set to NULL to retain previous behaviour of the functions, or point to a location where the number of bytes
* processed in the current transaction can be stored. If the BytesProcessed parameter is non-NULL, each time the endpoint
* bank becomes full and the packet is sent, the routine will exit with the new \ref ENDPOINT_RWSTREAM_IncompleteTransfer
* error code to allow the user application to determine when to send the next chunk of data.
*
* <b>Host Mode</b>
* - The Pipe stream functions now all require a BytesProcessed parameter instead of the previous callback parameter.
* This should be set to NULL to retain previous behaviour of the functions, or point to a location where the number of bytes
* processed in the current transaction can be stored. If the BytesProcessed parameter is non-NULL, each time the pipe
* bank becomes full and the packet is sent, the routine will exit with the new \ref PIPE_RWSTREAM_IncompleteTransfer
* error code to allow the user application to determine when to send the next chunk of data.
*
* \section Sec_Migration101122 Migrating from 100807 to 101122
* <b>USB Core</b>
* - A new USB driver source file, Drivers/USB/HighLevel/EndpointStream.c now exists. This source file should be added

@ -40,7 +40,7 @@
* into difficulties or need some advice. In addition, you can also email the library author to receive personalized
* support when you need it (subject to author's schedule).
*
* <small>* Atmel Stack Mouse Device Demo 4292 bytes, LUFA Mouse Low Level Device Demo 3332 bytes, under identical build
* <small>* Atmel Stack Mouse Device Demo 4218 bytes, LUFA Mouse Low Level Device Demo 3472 bytes, under identical build
* environments</small>
*/

@ -54,7 +54,7 @@ void ISPProtocol_EnterISPMode(void)
uint8_t EnterProgBytes[4];
} Enter_ISP_Params;
Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -109,7 +109,7 @@ void ISPProtocol_LeaveISPMode(void)
uint8_t PostDelayMS;
} Leave_ISP_Params;
Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -145,7 +145,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
} Write_Memory_Params; // whole page and ACK the packet as fast as possible to prevent it from aborting
Endpoint_Read_Stream_LE(&Write_Memory_Params, (sizeof(Write_Memory_Params) -
sizeof(Write_Memory_Params.ProgData)), NO_STREAM_CALLBACK);
sizeof(Write_Memory_Params.ProgData)), NULL);
Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
@ -160,7 +160,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
return;
}
Endpoint_Read_Stream_LE(&Write_Memory_Params.ProgData, Write_Memory_Params.BytesToWrite, NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Write_Memory_Params.ProgData, Write_Memory_Params.BytesToWrite, NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -279,7 +279,7 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
uint8_t ReadMemoryCommand;
} Read_Memory_Params;
Endpoint_Read_Stream_LE(&Read_Memory_Params, sizeof(Read_Memory_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Read_Memory_Params, sizeof(Read_Memory_Params), NULL);
Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);
Endpoint_ClearOUT();
@ -353,7 +353,7 @@ void ISPProtocol_ChipErase(void)
uint8_t EraseCommandBytes[4];
} Erase_Chip_Params;
Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -389,7 +389,7 @@ void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
uint8_t ReadCommandBytes[4];
} Read_FuseLockSigOSCCAL_Params;
Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -420,7 +420,7 @@ void ISPProtocol_WriteFuseLock(uint8_t V2Command)
uint8_t WriteCommandBytes[4];
} Write_FuseLockSig_Params;
Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -447,8 +447,8 @@ void ISPProtocol_SPIMulti(void)
uint8_t TxData[255];
} SPI_Multi_Params;
Endpoint_Read_Stream_LE(&SPI_Multi_Params, (sizeof(SPI_Multi_Params) - sizeof(SPI_Multi_Params.TxData)), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&SPI_Multi_Params, (sizeof(SPI_Multi_Params) - sizeof(SPI_Multi_Params.TxData)), NULL);
Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);

@ -185,7 +185,7 @@ static void V2Protocol_SignOn(void)
Endpoint_Write_Byte(CMD_SIGN_ON);
Endpoint_Write_Byte(STATUS_CMD_OK);
Endpoint_Write_Byte(sizeof(PROGRAMMER_ID) - 1);
Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NULL);
Endpoint_ClearIN();
}
@ -249,7 +249,7 @@ static void V2Protocol_GetSetParam(const uint8_t V2Command)
*/
static void V2Protocol_LoadAddress(void)
{
Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);

@ -62,7 +62,7 @@ void XPROGProtocol_SetMode(void)
uint8_t Protocol;
} SetMode_XPROG_Params;
Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -163,7 +163,7 @@ static void XPROGProtocol_Erase(void)
uint32_t Address;
} Erase_XPROG_Params;
Endpoint_Read_Stream_LE(&Erase_XPROG_Params, sizeof(Erase_XPROG_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&Erase_XPROG_Params, sizeof(Erase_XPROG_Params), NULL);
Erase_XPROG_Params.Address = SwapEndian_32(Erase_XPROG_Params.Address);
Endpoint_ClearOUT();
@ -243,10 +243,10 @@ static void XPROGProtocol_WriteMemory(void)
} WriteMemory_XPROG_Params;
Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params, (sizeof(WriteMemory_XPROG_Params) -
sizeof(WriteMemory_XPROG_Params).ProgData), NO_STREAM_CALLBACK);
sizeof(WriteMemory_XPROG_Params).ProgData), NULL);
WriteMemory_XPROG_Params.Address = SwapEndian_32(WriteMemory_XPROG_Params.Address);
WriteMemory_XPROG_Params.Length = SwapEndian_16(WriteMemory_XPROG_Params.Length);
Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length, NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
@ -326,7 +326,7 @@ static void XPROGProtocol_ReadMemory(void)
uint16_t Length;
} ReadMemory_XPROG_Params;
Endpoint_Read_Stream_LE(&ReadMemory_XPROG_Params, sizeof(ReadMemory_XPROG_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&ReadMemory_XPROG_Params, sizeof(ReadMemory_XPROG_Params), NULL);
ReadMemory_XPROG_Params.Address = SwapEndian_32(ReadMemory_XPROG_Params.Address);
ReadMemory_XPROG_Params.Length = SwapEndian_16(ReadMemory_XPROG_Params.Length);
@ -354,7 +354,7 @@ static void XPROGProtocol_ReadMemory(void)
Endpoint_Write_Byte(ReturnStatus);
if (ReturnStatus == XPRG_ERR_OK)
Endpoint_Write_Stream_LE(ReadBuffer, ReadMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(ReadBuffer, ReadMemory_XPROG_Params.Length, NULL);
Endpoint_ClearIN();
}
@ -371,7 +371,7 @@ static void XPROGProtocol_ReadCRC(void)
uint8_t CRCType;
} ReadCRC_XPROG_Params;
Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NULL);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);

@ -170,12 +170,10 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NULL);
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -198,10 +196,8 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NULL);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
@ -222,8 +218,8 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NULL);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */

@ -269,7 +269,7 @@ void WriteNextReport(uint8_t* const ReportOUTData,
}
/* Write out HID report data */
Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
Pipe_Write_Stream_LE(ReportOUTData, ReportLength, NULL);
/* Clear the OUT endpoint, send last data packet */
Pipe_ClearOUT();

@ -120,7 +120,6 @@ LUFA_OPTS = -D USB_HOST_ONLY
LUFA_OPTS += -D HOST_STATE_AS_GPIOR=0
LUFA_OPTS += -D ORDERED_EP_CONFIG
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
LUFA_OPTS += -D NO_STREAM_CALLBACKS
# Create the LUFA source path variables by including the LUFA root makefile

@ -169,12 +169,10 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NULL);
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -197,10 +195,8 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NULL);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
@ -221,8 +217,8 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NULL);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */

@ -169,12 +169,10 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NULL);
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
@ -197,10 +195,8 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NULL);
Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
@ -221,8 +217,8 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
uint32_t LastBlockAddressInLUN = (VIRTUAL_MEMORY_BLOCKS - 1);
uint32_t MediaBlockSize = VIRTUAL_MEMORY_BLOCK_SIZE;
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NULL);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NULL);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */

Loading…
Cancel
Save