Commit 8f6b4ddf authored by Dean Camera's avatar Dean Camera
Browse files

Fixed GenericHIDHost demo report write routine incorrect for control type...

Fixed GenericHIDHost demo report write routine incorrect for control type requests (thanks to Andrei Krainev).

Removed Endpoint_ClearCurrentBank() and Pipe_ClearCurrentBank() in favour of new Endpoint_ClearIN(), Endpoint_ClearOUT(), Endpoint_ClearControlIN(), Endpoint_ClearControlOUT(), Pipe_ClearIN(), Pipe_ClearOUT(), Pipe_ClearControlIN() and Pipe_ClearControlOUT() macros (done to allow for the detection of packets of zero length).

Renamed *_ReadWriteAllowed() macros to *_IsReadWriteAllowed() to remain consistent with the rest of the LUFA API.

Endpoint_IsSetupReceived() macro has been renamed to Endpoint_IsSETUPReceived(), Endpoint_ClearSetupReceived() macro has been renamed to Endpoint_ClearControlSETUP(), the Pipe_IsSetupSent() macro has been renamed to Pipe_IsSETUPSent() and the Pipe_ClearSetupSent() macro is no longer applicable and should be removed - changes made to compliment the new endpoint and pipe bank management API.

Updated all demos, bootloaders and projects to use the new endpoint and pipe management APIs (thanks to Roman Thiel).

Updated library doxygen documentation, added groups, changed documentation macro functions to real functions for clarity.

Removed old endpoint and pipe aliased read/write/discard routines which did not have an explicit endian specifier for clarity.

Removed the ButtLoadTag.h header file, as no one used for its intended purpose anyway.
parent ef06bfd1
......@@ -90,7 +90,7 @@ int main(void)
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
/* Wait until any pending transmissions have completed before shutting down */
while (!(Endpoint_ReadWriteAllowed()));
while (!(Endpoint_IsINReady()));
/* Shut down the USB subsystem */
USB_ShutDown();
......@@ -160,45 +160,45 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
case REQ_GetLineEncoding:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
for (uint8_t i = 0; i < sizeof(LineCoding); i++)
Endpoint_Write_Byte(*(LineCodingData++));
Endpoint_ClearSetupIN();
Endpoint_ClearControlIN();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
}
break;
case REQ_SetLineEncoding:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
while (!(Endpoint_IsSetupOUTReceived()));
while (!(Endpoint_IsOUTReceived()));
for (uint8_t i = 0; i < sizeof(LineCoding); i++)
*(LineCodingData++) = Endpoint_Read_Byte();
Endpoint_ClearSetupOUT();
Endpoint_ClearControlOUT();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
}
break;
case REQ_SetControlLineState:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
}
break;
......@@ -332,10 +332,10 @@ static uint8_t FetchNextCommandByte(void)
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
/* If OUT endpoint empty, clear it and wait for the next packet from the host */
if (!(Endpoint_ReadWriteAllowed()))
while (!(Endpoint_IsReadWriteAllowed()))
{
Endpoint_ClearCurrentBank();
while (!(Endpoint_ReadWriteAllowed()));
Endpoint_ClearOUT();
while (!(Endpoint_IsOUTReceived()));
}
/* Fetch the next byte from the OUT endpoint */
......@@ -353,10 +353,10 @@ static void WriteNextResponseByte(const uint8_t Response)
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
/* If OUT endpoint empty, clear it and wait for the next packet from the host */
if (!(Endpoint_ReadWriteAllowed()))
if (!(Endpoint_IsReadWriteAllowed()))
{
Endpoint_ClearCurrentBank();
while (!(Endpoint_ReadWriteAllowed()));
Endpoint_ClearIN();
while (!(Endpoint_IsINReady()));
}
/* Write the next byte to the OUT endpoint */
......@@ -372,7 +372,7 @@ TASK(CDC_Task)
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
/* Check if endpoint has a command in it sent from the host */
if (Endpoint_ReadWriteAllowed())
if (Endpoint_IsOUTReceived())
{
/* Read in the bootloader command (first byte sent from host) */
uint8_t Command = FetchNextCommandByte();
......@@ -557,22 +557,22 @@ TASK(CDC_Task)
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
/* Remember if the endpoint is completely full before clearing it */
bool IsEndpointFull = !(Endpoint_ReadWriteAllowed());
bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
/* Send the endpoint data to the host */
Endpoint_ClearCurrentBank();
Endpoint_ClearIN();
/* If a full endpoint's worth of data was sent, we need to send an empty packet afterwards to signal end of transfer */
if (IsEndpointFull)
{
while (!(Endpoint_ReadWriteAllowed()));
Endpoint_ClearCurrentBank();
while (!(Endpoint_IsINReady()));
Endpoint_ClearIN();
}
/* Select the OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
/* Acknowledge the command from the host */
Endpoint_ClearCurrentBank();
Endpoint_ClearOUT();
}
}
......@@ -163,7 +163,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
switch (bRequest)
{
case DFU_DNLOAD:
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Check if bootloader is waiting to terminate */
if (WaitForExit)
......@@ -178,7 +178,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* If the request has a data stage, load it into the command struct */
if (SentCommand.DataSize)
{
while (!(Endpoint_IsSetupOUTReceived()));
while (!(Endpoint_IsOUTReceived()));
/* First byte of the data stage is the DNLOAD request's command */
SentCommand.Command = Endpoint_Read_Byte();
......@@ -235,8 +235,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Check if endpoint is empty - if so clear it and wait until ready for next packet */
if (!(Endpoint_BytesInEndpoint()))
{
Endpoint_ClearSetupOUT();
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearControlOUT();
while (!(Endpoint_IsOUTReceived()));
}
/* Write the next word into the current flash page */
......@@ -279,8 +279,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Check if endpoint is empty - if so clear it and wait until ready for next packet */
if (!(Endpoint_BytesInEndpoint()))
{
Endpoint_ClearSetupOUT();
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearControlOUT();
while (!(Endpoint_IsOUTReceived()));
}
/* Read the byte from the USB interface and write to to the EEPROM */
......@@ -296,17 +296,17 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
}
}
Endpoint_ClearSetupOUT();
Endpoint_ClearControlOUT();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
break;
case DFU_UPLOAD:
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
while (!(Endpoint_IsSetupINReady()));
while (!(Endpoint_IsINReady()));
if (DFU_State != dfuUPLOAD_IDLE)
{
......@@ -343,8 +343,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Check if endpoint is full - if so clear it and wait until ready for next packet */
if (Endpoint_BytesInEndpoint() == FIXED_CONTROL_ENDPOINT_SIZE)
{
Endpoint_ClearSetupIN();
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearControlIN();
while (!(Endpoint_IsINReady()));
}
/* Read the flash word and send it via USB to the host */
......@@ -368,8 +368,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Check if endpoint is full - if so clear it and wait until ready for next packet */
if (Endpoint_BytesInEndpoint() == FIXED_CONTROL_ENDPOINT_SIZE)
{
Endpoint_ClearSetupIN();
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearControlIN();
while (!(Endpoint_IsINReady()));
}
/* Read the EEPROM byte and send it via USB to the host */
......@@ -384,15 +384,15 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
DFU_State = dfuIDLE;
}
Endpoint_ClearSetupIN();
Endpoint_ClearControlIN();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
break;
case DFU_GETSTATUS:
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Write 8-bit status value */
Endpoint_Write_Byte(DFU_Status);
......@@ -407,46 +407,46 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Write 8-bit state string ID number */
Endpoint_Write_Byte(0);
Endpoint_ClearSetupIN();
Endpoint_ClearControlIN();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
break;
case DFU_CLRSTATUS:
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Reset the status value variable to the default OK status */
DFU_Status = OK;
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
break;
case DFU_GETSTATE:
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Write the current device state to the endpoint */
Endpoint_Write_Byte(DFU_State);
Endpoint_ClearSetupIN();
Endpoint_ClearControlIN();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearControlOUT();
break;
case DFU_ABORT:
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Reset the current state variable to the default idle state */
DFU_State = dfuIDLE;
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
break;
}
......@@ -463,10 +463,10 @@ static void DiscardFillerBytes(uint8_t NumberOfBytes)
{
if (!(Endpoint_BytesInEndpoint()))
{
Endpoint_ClearSetupOUT();
Endpoint_ClearControlOUT();
/* Wait until next data packet received */
while (!(Endpoint_IsSetupOUTReceived()));
while (!(Endpoint_IsOUTReceived()));
}
Endpoint_Discard_Byte();
......
......@@ -101,10 +101,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
case REQ_SetReport:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Wait until the command (report) has been sent by the host */
while (!(Endpoint_IsSetupOUTReceived()));
while (!(Endpoint_IsOUTReceived()));
/* Read in the write destination address */
uint16_t PageAddress = Endpoint_Read_Word_LE();
......@@ -126,8 +126,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Check if endpoint is empty - if so clear it and wait until ready for next packet */
if (!(Endpoint_BytesInEndpoint()))
{
Endpoint_ClearSetupOUT();
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearControlOUT();
while (!(Endpoint_IsOUTReceived()));
}
/* Write the next data word to the FLASH page */
......@@ -142,11 +142,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
boot_rww_enable();
}
Endpoint_ClearSetupOUT();
Endpoint_ClearControlOUT();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
}
break;
......
......@@ -36,12 +36,6 @@
#include "AudioInput.h"
/* Project Tags, for reading out using the ButtLoad project */
BUTTLOADTAG(ProjName, "LUFA AudioIn App");
BUTTLOADTAG(BuildTime, __TIME__);
BUTTLOADTAG(BuildDate, __DATE__);
BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
/* Scheduler Task List */
TASK_LIST
{
......@@ -145,7 +139,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
{
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
if (wValue)
......@@ -160,8 +154,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
}
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
}
break;
......@@ -201,8 +195,8 @@ TASK(USB_Audio_Task)
/* Select the audio stream endpoint */
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
/* Check if the current endpoint can be read from (contains a packet) and that the next sample should be stored */
if (Endpoint_ReadWriteAllowed() && (TIFR0 & (1 << OCF0A)))
/* Check if the current endpoint can be written to and that the next sample should be stored */
if (Endpoint_IsINReady() && (TIFR0 & (1 << OCF0A)))
{
/* Clear the sample reload timer */
TIFR0 |= (1 << OCF0A);
......@@ -219,10 +213,10 @@ TASK(USB_Audio_Task)
Endpoint_Write_Word_LE(AudioSample);
/* Check to see if the bank is now full */
if (!(Endpoint_ReadWriteAllowed()))
if (!(Endpoint_IsReadWriteAllowed()))
{
/* Send the full packet to the host */
Endpoint_ClearCurrentBank();
Endpoint_ClearIN();
}
}
}
......@@ -44,7 +44,6 @@
#include "Descriptors.h"
#include <LUFA/Version.h> // Library Version Information
#include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
#include <LUFA/Drivers/AT90USBXXX/ADC.h> // ADC driver
......
......@@ -36,12 +36,6 @@
#include "AudioOutput.h"
/* Project Tags, for reading out using the ButtLoad project */
BUTTLOADTAG(ProjName, "LUFA AudioOut App");
BUTTLOADTAG(BuildTime, __TIME__);
BUTTLOADTAG(BuildDate, __DATE__);
BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
/* Scheduler Task List */
TASK_LIST
{
......@@ -172,7 +166,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
{
uint16_t wValue = Endpoint_Read_Word_LE();
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
if (wValue)
......@@ -187,8 +181,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
}
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
}
break;
......@@ -231,7 +225,7 @@ TASK(USB_Audio_Task)
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
/* Check if the current endpoint can be read from (contains a packet) and that the next sample should be read */
if (Endpoint_ReadWriteAllowed() && (TIFR0 & (1 << OCF0A)))
if (Endpoint_IsOUTReceived() && (TIFR0 & (1 << OCF0A)))
{
/* Clear the sample reload timer */
TIFR0 |= (1 << OCF0A);
......@@ -241,10 +235,10 @@ TASK(USB_Audio_Task)
int16_t RightSample_16Bit = (int16_t)Endpoint_Read_Word_LE();
/* Check to see if the bank is now empty */
if (!(Endpoint_ReadWriteAllowed()))
if (!(Endpoint_IsReadWriteAllowed()))
{
/* Acknowledge the packet, clear the bank ready for the next packet */
Endpoint_ClearCurrentBank();
Endpoint_ClearOUT();
}
/* Massage signed 16-bit left and right audio samples into signed 8-bit */
......
......@@ -44,7 +44,6 @@
#include "Descriptors.h"
#include <LUFA/Version.h> // Library Version Information
#include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
#include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
......
......@@ -36,12 +36,6 @@
#include "CDC.h"
/* Project Tags, for reading out using the ButtLoad project */
BUTTLOADTAG(ProjName, "LUFA CDC App");
BUTTLOADTAG(BuildTime, __TIME__);
BUTTLOADTAG(BuildDate, __DATE__);
BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
/* Scheduler Task List */
TASK_LIST
{
......@@ -172,13 +166,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* 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_ClearSetupOUT();
Endpoint_ClearControlOUT();
}
break;
......@@ -186,13 +180,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* 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_ClearSetupIN();
Endpoint_ClearControlIN();
}
break;
......@@ -211,11 +205,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
#endif
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
}
break;
......@@ -276,7 +270,7 @@ TASK(CDC_Task)
Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));
Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask));
Endpoint_ClearCurrentBank();
Endpoint_ClearIN();
#endif
/* Determine if a joystick action has occurred */
......@@ -307,19 +301,19 @@ TASK(CDC_Task)
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString));
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearCurrentBank();
Endpoint_ClearIN();
/* Wait until the endpoint is ready for another packet */
while (!(Endpoint_ReadWriteAllowed()));
while (!(Endpoint_IsINReady()));
/* Send an empty packet to ensure that the host does not buffer data sent to it */
Endpoint_ClearCurrentBank();
Endpoint_ClearIN();
}
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
/* Throw away any received data from the host */
if (Endpoint_ReadWriteAllowed())
Endpoint_ClearCurrentBank();
if (Endpoint_IsOUTReceived())
Endpoint_ClearOUT();
}
......@@ -45,7 +45,6 @@
#include "Descriptors.h"
#include <LUFA/Version.h> // Library Version Information
#include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/Board/Joystick.h> // Joystick driver
#include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
......
......@@ -36,12 +36,6 @@
#include "DualCDC.h"
/* Project Tags, for reading out using the ButtLoad project */
BUTTLOADTAG(ProjName, "LUFA DualCDC App");
BUTTLOADTAG(BuildTime, __TIME__);
BUTTLOADTAG(BuildDate, __DATE__);
BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
/* Scheduler Task List */
TASK_LIST
{
......@@ -195,7 +189,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
uint8_t* LineCodingData;
/* Discard the unused wValue parameter */
Endpoint_Ignore_Word();
Endpoint_Discard_Word();
/* wIndex indicates the interface being controlled */
uint16_t wIndex = Endpoint_Read_Word_LE();
......@@ -210,13 +204,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* 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_ClearSetupOUT();
Endpoint_ClearControlOUT();
}
break;
......@@ -224,13 +218,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* 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_ClearSetupIN();
Endpoint_ClearControlIN();
}
break;
......@@ -238,11 +232,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Acknowledge the SETUP packet, ready for data transfer */
Endpoint_ClearSetupReceived();
Endpoint_ClearControlSETUP();
/* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
while (!(Endpoint_IsINReady()));
Endpoint_ClearControlIN();
}