Removed specialized Endpoint_ClearControl* and Pipe_ClearControl* macros in favour of the standard Endpoint_Clear* and Pipe_Clear* macros (Atmel have confirmed no effect from setting FIFOCON on control endpoints).

This commit is contained in:
Dean Camera 2009-04-21 06:05:50 +00:00
parent ba7cd3f22e
commit e5e7eaee7a
23 changed files with 169 additions and 228 deletions

View file

@ -139,7 +139,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
{
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
if (wValue)
@ -155,7 +155,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;

View file

@ -166,7 +166,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
{
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
if (wValue)
@ -182,7 +182,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;

View file

@ -166,13 +166,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
Endpoint_Write_Control_Stream_LE(LineCodingData, sizeof(CDC_Line_Coding_t));
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
@ -180,13 +180,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Read the line coding data in from the host into the global struct */
Endpoint_Read_Control_Stream_LE(LineCodingData, sizeof(CDC_Line_Coding_t));
/* Finalize the stream transfer to clear the last packet from the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
@ -205,11 +205,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
#endif
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;

View file

@ -204,13 +204,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
Endpoint_Write_Control_Stream_LE(LineCodingData, sizeof(CDC_Line_Coding_t));
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
@ -218,13 +218,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Read the line coding data in from the host into the global struct */
Endpoint_Read_Control_Stream_LE(LineCodingData, sizeof(CDC_Line_Coding_t));
/* Finalize the stream transfer to clear the last packet from the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
@ -232,11 +232,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;

View file

@ -165,7 +165,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
case REQ_GetReport:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
uint8_t GenericData[GENERIC_REPORT_SIZE];
@ -175,14 +175,14 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_Write_Control_Stream_LE(&GenericData, sizeof(GenericData));
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
case REQ_SetReport:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Wait until the generic report has been sent by the host */
while (!(Endpoint_IsOUTReceived()));
@ -194,13 +194,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
ProcessGenericHIDReport(GenericData);
/* Clear the endpoint data */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
/* Wait until the host is ready to receive the request confirmation */
while (!(Endpoint_IsINReady()));
/* Handshake the request by sending an empty IN packet */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;

View file

@ -145,13 +145,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > sizeof(JoystickReportData))
wLength = sizeof(JoystickReportData);
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&JoystickReportData, wLength);
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;

View file

@ -216,20 +216,20 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > sizeof(KeyboardReportData))
wLength = sizeof(KeyboardReportData);
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&KeyboardReportData, wLength);
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
case REQ_SetReport:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Wait until the LED report has been sent by the host */
while (!(Endpoint_IsOUTReceived()));
@ -241,28 +241,28 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
ProcessLEDReport(LEDStatus);
/* Clear the endpoint data */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
case REQ_GetProtocol:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the current protocol flag to the host */
Endpoint_Write_Byte(UsingReportProtocol);
/* Send the flag to the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
/* Acknowledge status stage */
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
@ -272,14 +272,14 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Read in the wValue parameter containing the new protocol mode */
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
UsingReportProtocol = (wValue != 0x0000);
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
@ -289,31 +289,31 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Read in the wValue parameter containing the idle period */
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Get idle period in MSB */
IdleCount = (wValue >> 8);
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
case REQ_GetIdle:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the current idle duration to the host */
Endpoint_Write_Byte(IdleCount);
/* Send the flag to the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
/* Acknowledge status stage */
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;

View file

@ -167,7 +167,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > ReportSize)
wLength = ReportSize;
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(ReportData, wLength);
@ -176,14 +176,14 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
memset(ReportData, 0, ReportSize);
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
case REQ_SetReport:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Wait until the LED report has been sent by the host */
while (!(Endpoint_IsOUTReceived()));
@ -205,11 +205,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
LEDs_SetAllLEDs(LEDMask);
/* Clear the endpoint data */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;

View file

@ -153,30 +153,30 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
case REQ_MassStorageReset:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Indicate that the current transfer should be aborted */
IsMassStoreReset = true;
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
case REQ_GetMaxLUN:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Indicate to the host the number of supported LUNs (virtual disks) on the device */
Endpoint_Write_Byte(TOTAL_LUNS - 1);
Endpoint_ClearControlIN();
Endpoint_ClearIN();
/* Acknowledge status stage */
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;

View file

@ -206,7 +206,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > sizeof(MouseReportData))
wLength = sizeof(MouseReportData);
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&MouseReportData, wLength);
@ -215,24 +215,24 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
memset(&MouseReportData, 0, sizeof(MouseReportData));
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
case REQ_GetProtocol:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the current protocol flag to the host */
Endpoint_Write_Byte(UsingReportProtocol);
/* Send the flag to the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
/* Acknowledge status stage */
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
@ -242,14 +242,14 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Read in the wValue parameter containing the new protocol mode */
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
UsingReportProtocol = (wValue != 0x0000);
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
@ -259,31 +259,31 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Read in the wValue parameter containing the idle period */
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Get idle period in MSB */
IdleCount = (wValue >> 8);
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;
case REQ_GetIdle:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the current idle duration to the host */
Endpoint_Write_Byte(IdleCount);
/* Send the flag to the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
/* Acknowledge status stage */
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;

View file

@ -156,13 +156,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Clear the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Read in the RNDIS message into the message buffer */
Endpoint_Read_Control_Stream_LE(RNDISMessageBuffer, wLength);
/* Finalize the stream transfer to clear the last packet from the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
/* Process the RNDIS message */
ProcessRNDISControlMessage();
@ -185,13 +185,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
wLength = MessageHeader->MessageLength;
/* Clear the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the message response data to the endpoint */
Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, wLength);
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
/* Reset the message header once again after transmission */
MessageHeader->MessageLength = 0;

View file

@ -159,13 +159,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
Endpoint_Write_Control_Stream_LE(LineCodingData, sizeof(LineCoding));
/* Finalize the stream transfer to send the last packet or clear the host abort */
Endpoint_ClearControlOUT();
Endpoint_ClearOUT();
}
break;
@ -173,13 +173,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Read the line coding data in from the host into the global struct */
Endpoint_Read_Control_Stream_LE(LineCodingData, sizeof(LineCoding));
/* Finalize the stream transfer to clear the last packet from the host */
Endpoint_ClearControlIN();
Endpoint_ClearIN();
/* Reconfigure the USART with the new settings */
ReconfigureUSART();
@ -201,11 +201,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
#endif
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearControlSETUP();
Endpoint_ClearSETUP();
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
Endpoint_ClearIN();
}
break;