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).
This commit is contained in:
parent
477a2047f4
commit
f555ad7ced
107 changed files with 1257 additions and 943 deletions
|
@ -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)"
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue