aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-04-16 08:50:34 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-04-16 08:50:34 +0000
commit8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c (patch)
tree65c37548f19c26de3971639067d6f290095f5843 /Demos/Device
parentef06bfd1c0ef5272c32808e23d0fd60d2d1bca9c (diff)
downloadlufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.tar.gz
lufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.tar.bz2
lufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.zip
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.
Diffstat (limited to 'Demos/Device')
-rw-r--r--Demos/Device/AudioInput/AudioInput.c20
-rw-r--r--Demos/Device/AudioInput/AudioInput.h1
-rw-r--r--Demos/Device/AudioOutput/AudioOutput.c18
-rw-r--r--Demos/Device/AudioOutput/AudioOutput.h1
-rw-r--r--Demos/Device/CDC/CDC.c32
-rw-r--r--Demos/Device/CDC/CDC.h1
-rw-r--r--Demos/Device/DualCDC/DualCDC.c46
-rw-r--r--Demos/Device/DualCDC/DualCDC.h1
-rw-r--r--Demos/Device/GenericHID/GenericHID.c56
-rw-r--r--Demos/Device/GenericHID/GenericHID.h1
-rw-r--r--Demos/Device/Joystick/Joystick.c20
-rw-r--r--Demos/Device/Joystick/Joystick.h1
-rw-r--r--Demos/Device/Keyboard/Keyboard.c76
-rw-r--r--Demos/Device/Keyboard/Keyboard.h1
-rw-r--r--Demos/Device/KeyboardMouse/KeyboardMouse.c34
-rw-r--r--Demos/Device/KeyboardMouse/KeyboardMouse.h1
-rw-r--r--Demos/Device/MIDI/MIDI.c16
-rw-r--r--Demos/Device/MIDI/MIDI.h1
-rw-r--r--Demos/Device/MassStorage/DataflashManager.c24
-rw-r--r--Demos/Device/MassStorage/MassStorage.c28
-rw-r--r--Demos/Device/MassStorage/MassStorage.h1
-rw-r--r--Demos/Device/MassStorage/SCSI.c6
-rw-r--r--Demos/Device/Mouse/Mouse.c42
-rw-r--r--Demos/Device/Mouse/Mouse.h1
-rw-r--r--Demos/Device/RNDISEthernet/RNDISEthernet.c26
-rw-r--r--Demos/Device/RNDISEthernet/RNDISEthernet.h1
-rw-r--r--Demos/Device/USBtoSerial/USBtoSerial.c45
-rw-r--r--Demos/Device/USBtoSerial/USBtoSerial.h1
28 files changed, 212 insertions, 290 deletions
diff --git a/Demos/Device/AudioInput/AudioInput.c b/Demos/Device/AudioInput/AudioInput.c
index fca24c360..c0166944b 100644
--- a/Demos/Device/AudioInput/AudioInput.c
+++ b/Demos/Device/AudioInput/AudioInput.c
@@ -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();
}
}
}
diff --git a/Demos/Device/AudioInput/AudioInput.h b/Demos/Device/AudioInput/AudioInput.h
index 02c838039..c068baff9 100644
--- a/Demos/Device/AudioInput/AudioInput.h
+++ b/Demos/Device/AudioInput/AudioInput.h
@@ -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
diff --git a/Demos/Device/AudioOutput/AudioOutput.c b/Demos/Device/AudioOutput/AudioOutput.c
index ffeee418e..fcd881277 100644
--- a/Demos/Device/AudioOutput/AudioOutput.c
+++ b/Demos/Device/AudioOutput/AudioOutput.c
@@ -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 */
diff --git a/Demos/Device/AudioOutput/AudioOutput.h b/Demos/Device/AudioOutput/AudioOutput.h
index 0ad9e5bf9..05b24ad07 100644
--- a/Demos/Device/AudioOutput/AudioOutput.h
+++ b/Demos/Device/AudioOutput/AudioOutput.h
@@ -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
diff --git a/Demos/Device/CDC/CDC.c b/Demos/Device/CDC/CDC.c
index 5e153f652..3dc624057 100644
--- a/Demos/Device/CDC/CDC.c
+++ b/Demos/Device/CDC/CDC.c
@@ -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();
}
diff --git a/Demos/Device/CDC/CDC.h b/Demos/Device/CDC/CDC.h
index a36fdc921..1537f0ba3 100644
--- a/Demos/Device/CDC/CDC.h
+++ b/Demos/Device/CDC/CDC.h
@@ -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
diff --git a/Demos/Device/DualCDC/DualCDC.c b/Demos/Device/DualCDC/DualCDC.c
index fecbaff60..56eebb305 100644
--- a/Demos/Device/DualCDC/DualCDC.c
+++ b/Demos/Device/DualCDC/DualCDC.c
@@ -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();
}
break;
@@ -313,15 +307,21 @@ TASK(CDC1_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_IsINReady()));
+
+ /* Send an empty packet to ensure that the host does not buffer data sent to it */
+ Endpoint_ClearIN();
}
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC1_RX_EPNUM);
/* Throw away any received data from the host */
- if (Endpoint_ReadWriteAllowed())
- Endpoint_ClearCurrentBank();
+ if (Endpoint_IsOUTReceived())
+ Endpoint_ClearOUT();
}
/** Function to manage CDC data transmission and reception to and from the host for the second CDC interface, which echoes back
@@ -333,7 +333,7 @@ TASK(CDC2_Task)
Endpoint_SelectEndpoint(CDC2_RX_EPNUM);
/* Check to see if any data has been received */
- if (Endpoint_ReadWriteAllowed())
+ if (Endpoint_IsOUTReceived())
{
/* Create a temp buffer big enough to hold the incoming endpoint packet */
uint8_t Buffer[Endpoint_BytesInEndpoint()];
@@ -345,7 +345,7 @@ TASK(CDC2_Task)
Endpoint_Read_Stream_LE(&Buffer, DataLength);
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
/* Select the Serial Tx Endpoint */
Endpoint_SelectEndpoint(CDC2_TX_EPNUM);
@@ -354,6 +354,12 @@ TASK(CDC2_Task)
Endpoint_Write_Stream_LE(&Buffer, DataLength);
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
+
+ /* Wait until the endpoint is ready for the next packet */
+ while (!(Endpoint_IsINReady()));
+
+ /* Send an empty packet to prevent host buffering */
+ Endpoint_ClearIN();
}
}
diff --git a/Demos/Device/DualCDC/DualCDC.h b/Demos/Device/DualCDC/DualCDC.h
index 84be114e9..65f661f97 100644
--- a/Demos/Device/DualCDC/DualCDC.h
+++ b/Demos/Device/DualCDC/DualCDC.h
@@ -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
diff --git a/Demos/Device/GenericHID/GenericHID.c b/Demos/Device/GenericHID/GenericHID.c
index 3b5f97267..a9ecfa7d7 100644
--- a/Demos/Device/GenericHID/GenericHID.c
+++ b/Demos/Device/GenericHID/GenericHID.c
@@ -36,12 +36,6 @@
#include "GenericHID.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA GenHID App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -171,7 +165,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
case REQ_GetReport:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
uint8_t GenericData[GENERIC_REPORT_SIZE];
@@ -181,32 +175,32 @@ 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_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
}
break;
case REQ_SetReport:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Wait until the generic report has been sent by the host */
- while (!(Endpoint_IsSetupOUTReceived()));
+ while (!(Endpoint_IsOUTReceived()));
uint8_t GenericData[GENERIC_REPORT_SIZE];
- Endpoint_Read_Control_Stream(&GenericData, sizeof(GenericData));
+ Endpoint_Read_Control_Stream_LE(&GenericData, sizeof(GenericData));
ProcessGenericHIDReport(GenericData);
/* Clear the endpoint data */
- Endpoint_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
/* Wait until the host is ready to receive the request confirmation */
- while (!(Endpoint_IsSetupINReady()));
+ while (!(Endpoint_IsINReady()));
/* Handshake the request by sending an empty IN packet */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
}
break;
@@ -280,24 +274,30 @@ TASK(USB_HID_Report)
{
Endpoint_SelectEndpoint(GENERIC_OUT_EPNUM);
- if (Endpoint_ReadWriteAllowed())
+ /* Check to see if a packet has been sent from the host */
+ if (Endpoint_IsOUTReceived())
{
- /* Create a temporary buffer to hold the read in report from the host */
- uint8_t GenericData[GENERIC_REPORT_SIZE];
-
- /* Read Generic Report Data */
- Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData));
-
- /* Process Generic Report Data */
- ProcessGenericHIDReport(GenericData);
+ /* Check to see if the packet contains data */
+ if (Endpoint_IsReadWriteAllowed())
+ {
+ /* Create a temporary buffer to hold the read in report from the host */
+ uint8_t GenericData[GENERIC_REPORT_SIZE];
+
+ /* Read Generic Report Data */
+ Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData));
+
+ /* Process Generic Report Data */
+ ProcessGenericHIDReport(GenericData);
+ }
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
}
Endpoint_SelectEndpoint(GENERIC_IN_EPNUM);
- if (Endpoint_ReadWriteAllowed())
+ /* Check to see if the host is ready to accept another packet */
+ if (Endpoint_IsINReady())
{
/* Create a temporary buffer to hold the report to send to the host */
uint8_t GenericData[GENERIC_REPORT_SIZE];
@@ -309,7 +309,7 @@ TASK(USB_HID_Report)
Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
}
}
}
@@ -363,7 +363,7 @@ ISR(ENDPOINT_PIPE_vect, ISR_BLOCK)
Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
}
/* Check if Generic OUT endpoint has interrupted */
@@ -388,7 +388,7 @@ ISR(ENDPOINT_PIPE_vect, ISR_BLOCK)
ProcessGenericHIDReport(GenericData);
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
}
#endif
diff --git a/Demos/Device/GenericHID/GenericHID.h b/Demos/Device/GenericHID/GenericHID.h
index d13e6debf..817d37748 100644
--- a/Demos/Device/GenericHID/GenericHID.h
+++ b/Demos/Device/GenericHID/GenericHID.h
@@ -48,7 +48,6 @@
#include <LUFA/Version.h> // Library Version Information
#include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
- #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
diff --git a/Demos/Device/Joystick/Joystick.c b/Demos/Device/Joystick/Joystick.c
index cd8822705..c5d90e76f 100644
--- a/Demos/Device/Joystick/Joystick.c
+++ b/Demos/Device/Joystick/Joystick.c
@@ -36,12 +36,6 @@
#include "Joystick.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA Joystick App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -151,13 +145,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > sizeof(JoystickReportData))
wLength = sizeof(JoystickReportData);
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* 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_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
}
break;
@@ -241,8 +235,8 @@ TASK(USB_Joystick_Report)
/* Select the Joystick Report Endpoint */
Endpoint_SelectEndpoint(JOYSTICK_EPNUM);
- /* Check if Joystick Endpoint Ready for Read/Write */
- if (Endpoint_ReadWriteAllowed())
+ /* Check to see if the host is ready for another packet */
+ if (Endpoint_IsINReady())
{
USB_JoystickReport_Data_t JoystickReportData;
@@ -253,12 +247,10 @@ TASK(USB_Joystick_Report)
Endpoint_Write_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Clear the report data afterwards */
- JoystickReportData.X = 0;
- JoystickReportData.Y = 0;
- JoystickReportData.Button = 0;
+ memset(&JoystickReportData, 0, sizeof(JoystickReportData));
}
}
}
diff --git a/Demos/Device/Joystick/Joystick.h b/Demos/Device/Joystick/Joystick.h
index 79c7e498f..2a5cc2588 100644
--- a/Demos/Device/Joystick/Joystick.h
+++ b/Demos/Device/Joystick/Joystick.h
@@ -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
diff --git a/Demos/Device/Keyboard/Keyboard.c b/Demos/Device/Keyboard/Keyboard.c
index d118edea6..8c4157a56 100644
--- a/Demos/Device/Keyboard/Keyboard.c
+++ b/Demos/Device/Keyboard/Keyboard.c
@@ -37,12 +37,6 @@
#include "Keyboard.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA Keyboard App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -222,23 +216,23 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > sizeof(KeyboardReportData))
wLength = sizeof(KeyboardReportData);
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* 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_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
}
break;
case REQ_SetReport:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Wait until the LED report has been sent by the host */
- while (!(Endpoint_IsSetupOUTReceived()));
+ while (!(Endpoint_IsOUTReceived()));
/* Read in the LED report from the host */
uint8_t LEDStatus = Endpoint_Read_Byte();
@@ -247,28 +241,28 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
ProcessLEDReport(LEDStatus);
/* Clear the endpoint data */
- Endpoint_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
case REQ_GetProtocol:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the current protocol flag to the host */
Endpoint_Write_Byte(UsingReportProtocol);
/* Send the flag to the host */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupOUTReceived()));
- Endpoint_ClearSetupOUT();
+ while (!(Endpoint_IsOUTReceived()));
+ Endpoint_ClearControlOUT();
}
break;
@@ -278,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_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* 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_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
@@ -295,31 +289,31 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Read in the wValue parameter containing the idle period */
uint16_t wValue = Endpoint_Read_Word_LE();
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Get idle period in MSB */
IdleCount = (wValue >> 8);
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
case REQ_GetIdle:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the current idle duration to the host */
Endpoint_Write_Byte(IdleCount);
/* Send the flag to the host */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupOUTReceived()));
- Endpoint_ClearSetupOUT();
+ while (!(Endpoint_IsOUTReceived()));
+ Endpoint_ClearControlOUT();
}
break;
@@ -415,13 +409,13 @@ static inline void SendNextReport(void)
Endpoint_SelectEndpoint(KEYBOARD_EPNUM);
/* Check if Keyboard Endpoint Ready for Read/Write, and if we should send a report */
- if (Endpoint_ReadWriteAllowed() && SendReport)
+ if (Endpoint_IsReadWriteAllowed() && SendReport)
{
/* Write Keyboard Report Data */
Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
}
}
@@ -431,18 +425,22 @@ static inline void ReceiveNextReport(void)
/* Select the Keyboard LED Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_LEDS_EPNUM);
- /* Check if Keyboard LED Endpoint Ready for Read/Write */
- if (!(Endpoint_ReadWriteAllowed()))
- return;
-
- /* Read in the LED report from the host */
- uint8_t LEDReport = Endpoint_Read_Byte();
+ /* Check if Keyboard LED Endpoint contains a packet */
+ if (Endpoint_IsOUTReceived())
+ {
+ /* Check to see if the packet contains data */
+ if (Endpoint_IsReadWriteAllowed())
+ {
+ /* Read in the LED report from the host */
+ uint8_t LEDReport = Endpoint_Read_Byte();
- /* Handshake the OUT Endpoint - clear endpoint and ready for next report */
- Endpoint_ClearCurrentBank();
+ /* Process the read LED report from the host */
+ ProcessLEDReport(LEDReport);
+ }
- /* Process the read LED report from the host */
- ProcessLEDReport(LEDReport);
+ /* Handshake the OUT Endpoint - clear endpoint and ready for next report */
+ Endpoint_ClearOUT();
+ }
}
/** Function to manage status updates to the user. This is done via LEDs on the given board, if available, but may be changed to
diff --git a/Demos/Device/Keyboard/Keyboard.h b/Demos/Device/Keyboard/Keyboard.h
index 143ffc654..76b770582 100644
--- a/Demos/Device/Keyboard/Keyboard.h
+++ b/Demos/Device/Keyboard/Keyboard.h
@@ -49,7 +49,6 @@
#include <LUFA/Version.h> // Library Version Information
#include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
- #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
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.c b/Demos/Device/KeyboardMouse/KeyboardMouse.c
index 3ee101b8d..71e23ab1e 100644
--- a/Demos/Device/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/KeyboardMouse/KeyboardMouse.c
@@ -37,12 +37,6 @@
#include "KeyboardMouse.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA MouseKBD App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -150,7 +144,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
case REQ_GetReport:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_Ignore_Word();
+ Endpoint_Discard_Word();
uint16_t wIndex = Endpoint_Read_Word_LE();
@@ -173,7 +167,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > ReportSize)
wLength = ReportSize;
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(ReportData, wLength);
@@ -182,17 +176,17 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
memset(ReportData, 0, ReportSize);
/* Finalize the stream transfer to send the last packet or clear the host abort */
- Endpoint_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
}
break;
case REQ_SetReport:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Wait until the LED report has been sent by the host */
- while (!(Endpoint_IsSetupOUTReceived()));
+ while (!(Endpoint_IsOUTReceived()));
/* Read in the LED report from the host */
uint8_t LEDStatus = Endpoint_Read_Byte();
@@ -211,11 +205,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
LEDs_SetAllLEDs(LEDMask);
/* Clear the endpoint data */
- Endpoint_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
@@ -281,13 +275,13 @@ TASK(USB_Keyboard)
Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
/* Check if Keyboard Endpoint Ready for Read/Write */
- if (Endpoint_ReadWriteAllowed())
+ if (Endpoint_IsReadWriteAllowed())
{
/* Write Keyboard Report Data */
Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Clear the report data afterwards */
memset(&KeyboardReportData, 0, sizeof(KeyboardReportData));
@@ -297,7 +291,7 @@ TASK(USB_Keyboard)
Endpoint_SelectEndpoint(KEYBOARD_OUT_EPNUM);
/* Check if Keyboard LED Endpoint Ready for Read/Write */
- if (Endpoint_ReadWriteAllowed())
+ if (Endpoint_IsReadWriteAllowed())
{
/* Read in the LED report from the host */
uint8_t LEDStatus = Endpoint_Read_Byte();
@@ -316,7 +310,7 @@ TASK(USB_Keyboard)
LEDs_SetAllLEDs(LEDMask);
/* Handshake the OUT Endpoint - clear endpoint and ready for next report */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
}
}
}
@@ -352,13 +346,13 @@ TASK(USB_Mouse)
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
/* Check if Mouse Endpoint Ready for Read/Write */
- if (Endpoint_ReadWriteAllowed())
+ if (Endpoint_IsReadWriteAllowed())
{
/* Write Mouse Report Data */
Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Clear the report data afterwards */
memset(&MouseReportData, 0, sizeof(MouseReportData));
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.h b/Demos/Device/KeyboardMouse/KeyboardMouse.h
index 9794159fc..a69293c41 100644
--- a/Demos/Device/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/KeyboardMouse/KeyboardMouse.h
@@ -42,7 +42,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
diff --git a/Demos/Device/MIDI/MIDI.c b/Demos/Device/MIDI/MIDI.c
index c0e4f9df9..e286dcbd6 100644
--- a/Demos/Device/MIDI/MIDI.c
+++ b/Demos/Device/MIDI/MIDI.c
@@ -36,12 +36,6 @@
#include "MIDI.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA MIDI App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -134,7 +128,7 @@ TASK(USB_MIDI_Task)
Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPNUM);
/* Check if endpoint is ready to be written to */
- if (Endpoint_ReadWriteAllowed())
+ if (Endpoint_IsINReady())
{
/* Get current joystick mask, XOR with previous to detect joystick changes */
uint8_t JoystickStatus = Joystick_GetStatus();
@@ -166,8 +160,8 @@ TASK(USB_MIDI_Task)
Endpoint_SelectEndpoint(MIDI_STREAM_OUT_EPNUM);
/* Check if endpoint is ready to be read from, if so discard its (unused) data */
- if (Endpoint_ReadWriteAllowed())
- Endpoint_ClearCurrentBank();
+ if (Endpoint_IsOUTReceived())
+ Endpoint_ClearOUT();
}
/** Function to manage status updates to the user. This is done via LEDs on the given board, if available, but may be changed to
@@ -207,7 +201,7 @@ void UpdateStatus(uint8_t CurrentStatus)
void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel)
{
/* Wait until endpoint ready for more data */
- while (!(Endpoint_ReadWriteAllowed()));
+ while (!(Endpoint_IsReadWriteAllowed()));
/* Check if the message should be a Note On or Note Off command */
uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
@@ -221,5 +215,5 @@ void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t Cab
Endpoint_Write_Byte(MIDI_STANDARD_VELOCITY);
/* Send the data in the endpoint to the host */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
}
diff --git a/Demos/Device/MIDI/MIDI.h b/Demos/Device/MIDI/MIDI.h
index 733a7baed..4e81c8c2a 100644
--- a/Demos/Device/MIDI/MIDI.h
+++ b/Demos/Device/MIDI/MIDI.h
@@ -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
diff --git a/Demos/Device/MassStorage/DataflashManager.c b/Demos/Device/MassStorage/DataflashManager.c
index 7b02ed6c8..4b624190f 100644
--- a/Demos/Device/MassStorage/DataflashManager.c
+++ b/Demos/Device/MassStorage/DataflashManager.c
@@ -64,7 +64,7 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress, uint16_t TotalBlo
Dataflash_SendAddressBytes(0, CurrDFPageByte);
/* Wait until endpoint is ready before continuing */
- while (!(Endpoint_ReadWriteAllowed()));
+ while (!(Endpoint_IsReadWriteAllowed()));
while (TotalBlocks)
{
@@ -74,13 +74,13 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress, uint16_t TotalBlo
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
/* Check if the endpoint is currently empty */
- if (!(Endpoint_ReadWriteAllowed()))
+ if (!(Endpoint_IsReadWriteAllowed()))
{
/* Clear the current endpoint bank */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
/* Wait until the host has sent another packet */
- while (!(Endpoint_ReadWriteAllowed()));
+ while (!(Endpoint_IsReadWriteAllowed()));
}
/* Check if end of dataflash page reached */
@@ -157,8 +157,8 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress, uint16_t TotalBlo
Dataflash_WaitWhileBusy();
/* If the endpoint is empty, clear it ready for the next packet from the host */
- if (!(Endpoint_ReadWriteAllowed()))
- Endpoint_ClearCurrentBank();
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearOUT();
/* Deselect all dataflash chips */
Dataflash_DeselectChip();
@@ -187,7 +187,7 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress, uint16_t TotalBloc
Dataflash_SendByte(0x00);
/* Wait until endpoint is ready before continuing */
- while (!(Endpoint_ReadWriteAllowed()));
+ while (!(Endpoint_IsReadWriteAllowed()));
while (TotalBlocks)
{
@@ -197,13 +197,13 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress, uint16_t TotalBloc
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
/* Check if the endpoint is currently full */
- if (!(Endpoint_ReadWriteAllowed()))
+ if (!(Endpoint_IsReadWriteAllowed()))
{
/* Clear the endpoint bank to send its contents to the host */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Wait until the endpoint is ready for more data */
- while (!(Endpoint_ReadWriteAllowed()));
+ while (!(Endpoint_IsReadWriteAllowed()));
}
/* Check if end of dataflash page reached */
@@ -259,8 +259,8 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress, uint16_t TotalBloc
}
/* If the endpoint is full, send its contents to the host */
- if (!(Endpoint_ReadWriteAllowed()))
- Endpoint_ClearCurrentBank();
+ if (!(Endpoint_IsReadWriteAllowed()))
+ Endpoint_ClearIN();
/* Deselect all dataflash chips */
Dataflash_DeselectChip();
diff --git a/Demos/Device/MassStorage/MassStorage.c b/Demos/Device/MassStorage/MassStorage.c
index 56bc19a94..48ce5f34d 100644
--- a/Demos/Device/MassStorage/MassStorage.c
+++ b/Demos/Device/MassStorage/MassStorage.c
@@ -37,12 +37,6 @@
#define INCLUDE_FROM_MASSSTORAGE_C
#include "MassStorage.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA MassStore App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -159,30 +153,30 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
case REQ_MassStorageReset:
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Indicate that the current transfer should be aborted */
IsMassStoreReset = true;
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
case REQ_GetMaxLUN:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- /* Indicate to the host the number of supported LUNs (virtual disks) on the device */
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
+ /* Indicate to the host the number of supported LUNs (virtual disks) on the device */
Endpoint_Write_Byte(TOTAL_LUNS - 1);
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupOUTReceived()));
- Endpoint_ClearSetupOUT();
+ while (!(Endpoint_IsOUTReceived()));
+ Endpoint_ClearControlOUT();
}
break;
@@ -234,7 +228,7 @@ TASK(USB_MassStorage)
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
/* Check to see if a command from the host has been issued */
- if (Endpoint_ReadWriteAllowed())
+ if (Endpoint_IsReadWriteAllowed())
{
/* Indicate busy */
UpdateStatus(Status_ProcessingCommandBlock);
@@ -326,7 +320,7 @@ static bool ReadInCommandBlock(void)
return false;
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
return true;
}
@@ -367,7 +361,7 @@ static void ReturnCommandStatus(void)
return;
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
}
/** Stream callback function for the Endpoint stream read and write functions. This callback will abort the current stream transfer
diff --git a/Demos/Device/MassStorage/MassStorage.h b/Demos/Device/MassStorage/MassStorage.h
index a30e7f746..17acca6b7 100644
--- a/Demos/Device/MassStorage/MassStorage.h
+++ b/Demos/Device/MassStorage/MassStorage.h
@@ -46,7 +46,6 @@
#include "DataflashManager.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/Board/Dataflash.h> // Dataflash chip driver
diff --git a/Demos/Device/MassStorage/SCSI.c b/Demos/Device/MassStorage/SCSI.c
index d50f63d91..e92be7ff8 100644
--- a/Demos/Device/MassStorage/SCSI.c
+++ b/Demos/Device/MassStorage/SCSI.c
@@ -174,7 +174,7 @@ static bool SCSI_Command_Inquiry(void)
Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), AbortOnMassStoreReset);
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
CommandBlock.DataTransferLength -= BytesTransferred;
@@ -201,7 +201,7 @@ static bool SCSI_Command_Request_Sense(void)
Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), AbortOnMassStoreReset);
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
CommandBlock.DataTransferLength -= BytesTransferred;
@@ -227,7 +227,7 @@ static bool SCSI_Command_Read_Capacity_10(void)
return false;
/* Send the endpoint data packet to the host */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
CommandBlock.DataTransferLength -= 8;
diff --git a/Demos/Device/Mouse/Mouse.c b/Demos/Device/Mouse/Mouse.c
index 076ac5bbd..e74002b7c 100644
--- a/Demos/Device/Mouse/Mouse.c
+++ b/Demos/Device/Mouse/Mouse.c
@@ -36,12 +36,6 @@
#include "Mouse.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA Mouse App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -212,7 +206,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (wLength > sizeof(MouseReportData))
wLength = sizeof(MouseReportData);
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&MouseReportData, wLength);
@@ -221,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_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
}
break;
case REQ_GetProtocol:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the current protocol flag to the host */
Endpoint_Write_Byte(UsingReportProtocol);
/* Send the flag to the host */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupOUTReceived()));
- Endpoint_ClearSetupOUT();
+ while (!(Endpoint_IsOUTReceived()));
+ Endpoint_ClearControlOUT();
}
break;
@@ -248,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_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* 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_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
@@ -265,31 +259,31 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Read in the wValue parameter containing the idle period */
uint16_t wValue = Endpoint_Read_Word_LE();
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Get idle period in MSB */
IdleCount = (wValue >> 8);
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupINReady()));
- Endpoint_ClearSetupIN();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_ClearControlIN();
}
break;
case REQ_GetIdle:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* Write the current idle duration to the host */
Endpoint_Write_Byte(IdleCount);
/* Send the flag to the host */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Acknowledge status stage */
- while (!(Endpoint_IsSetupOUTReceived()));
- Endpoint_ClearSetupOUT();
+ while (!(Endpoint_IsOUTReceived()));
+ Endpoint_ClearControlOUT();
}
break;
@@ -367,13 +361,13 @@ static inline void SendNextReport(void)
Endpoint_SelectEndpoint(MOUSE_EPNUM);
/* Check if Mouse Endpoint Ready for Read/Write and if we should send a new report */
- if (Endpoint_ReadWriteAllowed() && SendReport)
+ if (Endpoint_IsReadWriteAllowed() && SendReport)
{
/* Write Mouse Report Data */
Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
}
}
diff --git a/Demos/Device/Mouse/Mouse.h b/Demos/Device/Mouse/Mouse.h
index c9854a8f9..714f8d6e8 100644
--- a/Demos/Device/Mouse/Mouse.h
+++ b/Demos/Device/Mouse/Mouse.h
@@ -47,7 +47,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
diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.c b/Demos/Device/RNDISEthernet/RNDISEthernet.c
index d573a769b..5e14bb76a 100644
--- a/Demos/Device/RNDISEthernet/RNDISEthernet.c
+++ b/Demos/Device/RNDISEthernet/RNDISEthernet.c
@@ -36,12 +36,6 @@
#include "RNDISEthernet.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA RNDIS App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -162,13 +156,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Clear the SETUP packet, ready for data transfer */
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* 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_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Process the RNDIS message */
ProcessRNDISControlMessage();
@@ -191,13 +185,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
wLength = MessageHeader->MessageLength;
/* Clear the SETUP packet, ready for data transfer */
- Endpoint_ClearSetupReceived();
+ Endpoint_ClearControlSETUP();
/* 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_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
/* Reset the message header once again after transmission */
MessageHeader->MessageLength = 0;
@@ -247,7 +241,7 @@ TASK(RNDIS_Task)
Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);
/* Check if a message response is ready for the host */
- if (Endpoint_ReadWriteAllowed() && ResponseReady)
+ if (Endpoint_IsINReady() && ResponseReady)
{
USB_Notification_t Notification = (USB_Notification_t)
{
@@ -262,7 +256,7 @@ TASK(RNDIS_Task)
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Indicate a response is no longer ready */
ResponseReady = false;
@@ -278,7 +272,7 @@ TASK(RNDIS_Task)
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
/* Check if the data OUT endpoint contains data, and that the IN buffer is empty */
- if (Endpoint_ReadWriteAllowed() && !(FrameIN.FrameInBuffer))
+ if (Endpoint_IsOUTReceived() && !(FrameIN.FrameInBuffer))
{
/* Read in the packet message header */
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_PACKET_MSG_t));
@@ -294,7 +288,7 @@ TASK(RNDIS_Task)
Endpoint_Read_Stream_LE(FrameIN.FrameData, RNDISPacketHeader.DataLength);
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
/* Store the size of the Ethernet frame */
FrameIN.FrameLength = RNDISPacketHeader.DataLength;
@@ -307,7 +301,7 @@ TASK(RNDIS_Task)
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
/* Check if the data IN endpoint is ready for more data, and that the IN buffer is full */
- if (Endpoint_ReadWriteAllowed() && FrameOUT.FrameInBuffer)
+ if (Endpoint_IsINReady() && FrameOUT.FrameInBuffer)
{
/* Clear the packet header with all 0s so that the relevant fields can be filled */
memset(&RNDISPacketHeader, 0, sizeof(RNDIS_PACKET_MSG_t));
@@ -325,7 +319,7 @@ TASK(RNDIS_Task)
Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength);
/* Finalize the stream transfer to send the last packet */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
/* Indicate Ethernet OUT buffer no longer full */
FrameOUT.FrameInBuffer = false;
diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.h b/Demos/Device/RNDISEthernet/RNDISEthernet.h
index 83e49ce84..f21ace774 100644
--- a/Demos/Device/RNDISEthernet/RNDISEthernet.h
+++ b/Demos/Device/RNDISEthernet/RNDISEthernet.h
@@ -52,7 +52,6 @@
#include "Webserver.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
diff --git a/Demos/Device/USBtoSerial/USBtoSerial.c b/Demos/Device/USBtoSerial/USBtoSerial.c
index a9f0434cb..87d531c4d 100644
--- a/Demos/Device/USBtoSerial/USBtoSerial.c
+++ b/Demos/Device/USBtoSerial/USBtoSerial.c
@@ -30,12 +30,6 @@
#include "USBtoSerial.h"
-/* Project Tags, for reading out using the ButtLoad project */
-BUTTLOADTAG(ProjName, "LUFA USB RS232 App");
-BUTTLOADTAG(BuildTime, __TIME__);
-BUTTLOADTAG(BuildDate, __DATE__);
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
-
/* Scheduler Task List */
TASK_LIST
{
@@ -165,13 +159,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(LineCoding));
/* Finalize the stream transfer to send the last packet or clear the host abort */
- Endpoint_ClearSetupOUT();
+ Endpoint_ClearControlOUT();
}
break;
@@ -179,13 +173,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(LineCoding));
/* Finalize the stream transfer to clear the last packet from the host */
- Endpoint_ClearSetupIN();
+ Endpoint_ClearControlIN();
/* Reconfigure the USART with the new settings */
ReconfigureUSART();
@@ -207,11 +201,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;
@@ -244,13 +238,13 @@ 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
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
- if (Endpoint_ReadWriteAllowed())
+ if (Endpoint_IsOUTReceived())
{
/* Read the received data endpoint into the transmission buffer */
while (Endpoint_BytesInEndpoint())
@@ -263,7 +257,7 @@ TASK(CDC_Task)
}
/* Clear the endpoint buffer */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearOUT();
}
/* Check if Rx buffer contains data */
@@ -284,27 +278,20 @@ TASK(CDC_Task)
if (Tx_Buffer.Elements)
{
/* Wait until Serial Tx Endpoint Ready for Read/Write */
- while (!(Endpoint_ReadWriteAllowed()));
-
- /* Check before sending the data if the endpoint is completely full */
- bool IsFull = (Endpoint_BytesInEndpoint() == CDC_TXRX_EPSIZE);
+ while (!(Endpoint_IsReadWriteAllowed()));
/* Write the transmission buffer contents to the received data endpoint */
while (Tx_Buffer.Elements && (Endpoint_BytesInEndpoint() < CDC_TXRX_EPSIZE))
Endpoint_Write_Byte(Buffer_GetElement(&Tx_Buffer));
/* Send the data */
- Endpoint_ClearCurrentBank();
+ Endpoint_ClearIN();
- /* If a full endpoint was sent, we need to send an empty packet afterwards to terminate the transfer */
- if (IsFull)
- {
- /* Wait until Serial Tx Endpoint Ready for Read/Write */
- while (!(Endpoint_ReadWriteAllowed()));
+ /* Wait until Serial Tx Endpoint Ready for Read/Write */
+ while (!(Endpoint_IsReadWriteAllowed()));
- /* Send an empty packet to terminate the transfer */
- Endpoint_ClearCurrentBank();
- }
+ /* Send an empty packet to terminate the transfer */
+ Endpoint_ClearIN();
}
}
}
diff --git a/Demos/Device/USBtoSerial/USBtoSerial.h b/Demos/Device/USBtoSerial/USBtoSerial.h
index 092660069..8fb2c1617 100644
--- a/Demos/Device/USBtoSerial/USBtoSerial.h
+++ b/Demos/Device/USBtoSerial/USBtoSerial.h
@@ -46,7 +46,6 @@
#include "RingBuff.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/AT90USBXXX/Serial.h> // USART driver
#include <LUFA/Drivers/Board/LEDs.h> // LEDs driver