diff options
Diffstat (limited to 'Demos/Host')
40 files changed, 172 insertions, 188 deletions
diff --git a/Demos/Host/CDCHost/CDCHost.c b/Demos/Host/CDCHost/CDCHost.c index a4194090a..b83473106 100644 --- a/Demos/Host/CDCHost/CDCHost.c +++ b/Demos/Host/CDCHost/CDCHost.c @@ -80,7 +80,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -92,7 +92,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop keyboard and USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -105,7 +105,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Start CDC Host task */
Scheduler_SetTaskMode(USB_CDC_Host, TASK_RUN);
@@ -115,7 +115,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -129,7 +129,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/CDCHost/CDCHost.h b/Demos/Host/CDCHost/CDCHost.h index 3819540d6..afec780e7 100644 --- a/Demos/Host/CDCHost/CDCHost.h +++ b/Demos/Host/CDCHost/CDCHost.h @@ -76,14 +76,13 @@ /* Task Definitions: */
TASK(USB_CDC_Host);
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
-
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void UpdateStatus(uint8_t CurrentStatus);
#endif
diff --git a/Demos/Host/CDCHost/ConfigDescriptor.c b/Demos/Host/CDCHost/ConfigDescriptor.c index faad3ccd2..baf02a216 100644 --- a/Demos/Host/CDCHost/ConfigDescriptor.c +++ b/Demos/Host/CDCHost/ConfigDescriptor.c @@ -71,7 +71,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the CDC control interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoCDCInterfaceFound;
@@ -82,14 +82,14 @@ uint8_t ProcessConfigurationDescriptor(void) {
/* Fetch the next bulk or interrupt endpoint from the current CDC interface */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Check to see if the control interface's notification pipe has been found, if so search for the data interface */
if (FoundEndpoints & (1 << CDC_NOTIFICATIONPIPE))
{
/* Get the next CDC data interface from the configuration descriptor (CDC class has two CDC interfaces) */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoCDCInterfaceFound;
@@ -110,7 +110,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the next CDC control interface from the configuration descriptor (CDC class has two CDC interfaces) */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoCDCInterfaceFound;
@@ -119,7 +119,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Fetch the next bulk or interrupt endpoint from the current CDC interface */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
@@ -186,7 +186,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextCDCControlInterface)
+uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
@@ -210,7 +210,7 @@ DESCRIPTOR_COMPARATOR(NextCDCControlInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextCDCDataInterface)
+uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
@@ -236,7 +236,7 @@ DESCRIPTOR_COMPARATOR(NextCDCDataInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextInterfaceCDCDataEndpoint)
+uint8_t DComp_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
diff --git a/Demos/Host/CDCHost/ConfigDescriptor.h b/Demos/Host/CDCHost/ConfigDescriptor.h index ea00f610f..1a118cad3 100644 --- a/Demos/Host/CDCHost/ConfigDescriptor.h +++ b/Demos/Host/CDCHost/ConfigDescriptor.h @@ -75,12 +75,11 @@ NoEndpointFound = 5, /**< Compatible CDC endpoints were not found in the device's CDC interface */
};
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextCDCControlInterface);
- DESCRIPTOR_COMPARATOR(NextCDCDataInterface);
- DESCRIPTOR_COMPARATOR(NextInterfaceCDCDataEndpoint);
-
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
-
+
+ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor);
+
#endif
diff --git a/Demos/Host/CDCHost/makefile b/Demos/Host/CDCHost/makefile index ecd6269de..d9c58a377 100644 --- a/Demos/Host/CDCHost/makefile +++ b/Demos/Host/CDCHost/makefile @@ -506,7 +506,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
diff --git a/Demos/Host/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/GenericHIDHost/ConfigDescriptor.c index 1c0a6b291..29fa60ba3 100644 --- a/Demos/Host/GenericHIDHost/ConfigDescriptor.c +++ b/Demos/Host/GenericHIDHost/ConfigDescriptor.c @@ -72,7 +72,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the HID interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoHIDInterfaceFound;
@@ -82,7 +82,7 @@ uint8_t ProcessConfigurationDescriptor(void) {
/* Get the next HID interface's data endpoint descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Not all HID devices have an OUT endpoint - if we've reached the end of the HID descriptor
* but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */
@@ -129,7 +129,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextHIDInterface)
+uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)
{
/* Determine if the current descriptor is an interface descriptor */
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
@@ -155,7 +155,7 @@ DESCRIPTOR_COMPARATOR(NextHIDInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextInterfaceHIDDataEndpoint)
+uint8_t DComp_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor)
{
/* Determine the type of the current descriptor */
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
diff --git a/Demos/Host/GenericHIDHost/ConfigDescriptor.h b/Demos/Host/GenericHIDHost/ConfigDescriptor.h index fac772979..b58d44027 100644 --- a/Demos/Host/GenericHIDHost/ConfigDescriptor.h +++ b/Demos/Host/GenericHIDHost/ConfigDescriptor.h @@ -60,11 +60,10 @@ NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */
};
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextHIDInterface);
- DESCRIPTOR_COMPARATOR(NextInterfaceHIDDataEndpoint);
-
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
+
+ uint8_t DComp_NextHIDInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceHIDDataEndpoint(void* CurrentDescriptor);
#endif
diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.c b/Demos/Host/GenericHIDHost/GenericHIDHost.c index 580612c97..e731f90cf 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.c +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.c @@ -80,7 +80,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -92,7 +92,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop HID and USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -105,7 +105,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Start HID Host task */
Scheduler_SetTaskMode(USB_HID_Host, TASK_RUN);
@@ -115,7 +115,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -129,7 +129,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.h b/Demos/Host/GenericHIDHost/GenericHIDHost.h index 3ae473e00..7e2f8b822 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.h +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.h @@ -82,15 +82,14 @@ Status_EnumerationError = 3, /**< Software error while enumerating the attached USB device */
Status_HardwareError = 4, /**< Hardware error while enumerating the attached USB device */
};
-
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void UpdateStatus(uint8_t CurrentStatus);
void ReadNextReport(void);
void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength);
diff --git a/Demos/Host/GenericHIDHost/makefile b/Demos/Host/GenericHIDHost/makefile index d261da927..617ab7e5b 100644 --- a/Demos/Host/GenericHIDHost/makefile +++ b/Demos/Host/GenericHIDHost/makefile @@ -505,7 +505,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
diff --git a/Demos/Host/KeyboardHost/ConfigDescriptor.c b/Demos/Host/KeyboardHost/ConfigDescriptor.c index b0233d98c..e586ea5d3 100644 --- a/Demos/Host/KeyboardHost/ConfigDescriptor.c +++ b/Demos/Host/KeyboardHost/ConfigDescriptor.c @@ -70,7 +70,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the keyboard interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoHIDInterfaceFound;
@@ -78,7 +78,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the keyboard interface's data endpoint descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
@@ -105,7 +105,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextKeyboardInterface)
+uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
@@ -129,7 +129,7 @@ DESCRIPTOR_COMPARATOR(NextKeyboardInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint)
+uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
diff --git a/Demos/Host/KeyboardHost/ConfigDescriptor.h b/Demos/Host/KeyboardHost/ConfigDescriptor.h index 416315b97..425f0a4be 100644 --- a/Demos/Host/KeyboardHost/ConfigDescriptor.h +++ b/Demos/Host/KeyboardHost/ConfigDescriptor.h @@ -62,12 +62,11 @@ NoHIDInterfaceFound = 4, /**< A compatible HID interface was not found in the device's Configuration Descriptor */
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */
};
-
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextKeyboardInterface);
- DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint);
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
+
+ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor);
#endif
diff --git a/Demos/Host/KeyboardHost/KeyboardHost.c b/Demos/Host/KeyboardHost/KeyboardHost.c index 628a27314..2b9bb2b0b 100644 --- a/Demos/Host/KeyboardHost/KeyboardHost.c +++ b/Demos/Host/KeyboardHost/KeyboardHost.c @@ -80,7 +80,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -92,7 +92,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop Keyboard and USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -105,7 +105,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Start Keyboard Host task */
Scheduler_SetTaskMode(USB_Keyboard_Host, TASK_RUN);
@@ -115,7 +115,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -129,7 +129,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/KeyboardHost/KeyboardHost.h b/Demos/Host/KeyboardHost/KeyboardHost.h index 6a601439a..d00b76afb 100644 --- a/Demos/Host/KeyboardHost/KeyboardHost.h +++ b/Demos/Host/KeyboardHost/KeyboardHost.h @@ -83,14 +83,13 @@ /* Task Definitions: */
TASK(USB_Keyboard_Host);
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
-
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void UpdateStatus(uint8_t CurrentStatus);
void ReadNextReport(void);
diff --git a/Demos/Host/KeyboardHost/makefile b/Demos/Host/KeyboardHost/makefile index e304974e2..9ea163e66 100644 --- a/Demos/Host/KeyboardHost/makefile +++ b/Demos/Host/KeyboardHost/makefile @@ -506,7 +506,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
diff --git a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c index 9cdf6f88a..4ee3b998f 100644 --- a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c @@ -70,7 +70,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the keyboard interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoHIDInterfaceFound;
@@ -78,7 +78,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the keyboard interface's HID descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoHIDDescriptorFound;
@@ -89,7 +89,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the keyboard interface's data endpoint descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
@@ -116,7 +116,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextKeyboardInterface)
+uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
@@ -140,7 +140,7 @@ DESCRIPTOR_COMPARATOR(NextKeyboardInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint)
+uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
@@ -163,7 +163,7 @@ DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextHID)
+uint8_t DComp_NextHID(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
diff --git a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.h b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.h index 1deff6328..338adc93b 100644 --- a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.h +++ b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.h @@ -68,13 +68,12 @@ NoHIDDescriptorFound = 5, /**< A compatible HID descriptor was not found in the device's HID interface */
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */
};
-
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextKeyboardInterface);
- DESCRIPTOR_COMPARATOR(NextInterfaceKeyboardDataEndpoint);
- DESCRIPTOR_COMPARATOR(NextHID);
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceKeyboardDataEndpoint(void* CurrentDescriptor);
+ uint8_t DComp_NextHID(void* CurrentDescriptor);
+
#endif
diff --git a/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c index 9eb3d108a..840cb90cf 100644 --- a/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -80,7 +80,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -92,7 +92,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop keyboard and USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -105,7 +105,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Start Keyboard Host task */
Scheduler_SetTaskMode(USB_Keyboard_Host, TASK_RUN);
@@ -115,7 +115,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -129,7 +129,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.h index a0e055fa6..acb5b8b3e 100644 --- a/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.h +++ b/Demos/Host/KeyboardHostWithParser/KeyboardHostWithParser.h @@ -67,14 +67,13 @@ /* Task Definitions: */
TASK(USB_Keyboard_Host);
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
-
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void UpdateStatus(uint8_t CurrentStatus);
void ProcessKeyboardReport(uint8_t* KeyboardReport);
diff --git a/Demos/Host/KeyboardHostWithParser/makefile b/Demos/Host/KeyboardHostWithParser/makefile index ad8f07253..43559d8f1 100644 --- a/Demos/Host/KeyboardHostWithParser/makefile +++ b/Demos/Host/KeyboardHostWithParser/makefile @@ -507,7 +507,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
diff --git a/Demos/Host/MassStorageHost/ConfigDescriptor.c b/Demos/Host/MassStorageHost/ConfigDescriptor.c index c02f3b0de..c951c797e 100644 --- a/Demos/Host/MassStorageHost/ConfigDescriptor.c +++ b/Demos/Host/MassStorageHost/ConfigDescriptor.c @@ -71,7 +71,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the mass storage interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoInterfaceFound;
@@ -82,7 +82,7 @@ uint8_t ProcessConfigurationDescriptor(void) {
/* Fetch the next bulk endpoint from the current mass storage interface */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
@@ -127,7 +127,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextMassStorageInterface)
+uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
@@ -152,7 +152,7 @@ DESCRIPTOR_COMPARATOR(NextMassStorageInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextInterfaceBulkDataEndpoint)
+uint8_t DComp_NextInterfaceBulkDataEndpoint(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
diff --git a/Demos/Host/MassStorageHost/ConfigDescriptor.h b/Demos/Host/MassStorageHost/ConfigDescriptor.h index b02e08828..6c0b8e6f4 100644 --- a/Demos/Host/MassStorageHost/ConfigDescriptor.h +++ b/Demos/Host/MassStorageHost/ConfigDescriptor.h @@ -65,12 +65,11 @@ NoInterfaceFound = 4, /**< A compatible MSD interface was not found in the device's Configuration Descriptor */
NoEndpointFound = 5, /**< The correct MSD endpoint descriptors were not found in the device's MSD interface */
};
-
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextMassStorageInterface);
- DESCRIPTOR_COMPARATOR(NextInterfaceBulkDataEndpoint);
-
+
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceBulkDataEndpoint(void* CurrentDescriptor);
+
#endif
diff --git a/Demos/Host/MassStorageHost/MassStorageHost.c b/Demos/Host/MassStorageHost/MassStorageHost.c index d06e3a63a..a2e6631e2 100644 --- a/Demos/Host/MassStorageHost/MassStorageHost.c +++ b/Demos/Host/MassStorageHost/MassStorageHost.c @@ -85,7 +85,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -97,7 +97,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop USB management and Mass Storage tasks */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -110,7 +110,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Once device is fully enumerated, start the Mass Storage Host task */
Scheduler_SetTaskMode(USB_MassStore_Host, TASK_RUN);
@@ -120,7 +120,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -134,7 +134,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/MassStorageHost/MassStorageHost.h b/Demos/Host/MassStorageHost/MassStorageHost.h index 216065970..1646ad75e 100644 --- a/Demos/Host/MassStorageHost/MassStorageHost.h +++ b/Demos/Host/MassStorageHost/MassStorageHost.h @@ -70,15 +70,14 @@ /* Task Definitions: */
TASK(USB_MassStore_Host);
-
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void ShowDiskReadError(char* CommandString, bool FailedAtSCSILayer, uint8_t ErrorCode);
void UpdateStatus(uint8_t CurrentStatus);
diff --git a/Demos/Host/MassStorageHost/makefile b/Demos/Host/MassStorageHost/makefile index 6987794bc..5c1de65ea 100644 --- a/Demos/Host/MassStorageHost/makefile +++ b/Demos/Host/MassStorageHost/makefile @@ -508,7 +508,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
diff --git a/Demos/Host/MouseHost/ConfigDescriptor.c b/Demos/Host/MouseHost/ConfigDescriptor.c index 435a4f90c..0f6ab59ae 100644 --- a/Demos/Host/MouseHost/ConfigDescriptor.c +++ b/Demos/Host/MouseHost/ConfigDescriptor.c @@ -70,7 +70,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the mouse interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoHIDInterfaceFound;
@@ -78,7 +78,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the mouse interface's data endpoint descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
@@ -105,7 +105,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextMouseInterface)
+uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
{
/* Determine if the current descriptor is an interface descriptor */
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
@@ -132,7 +132,7 @@ DESCRIPTOR_COMPARATOR(NextMouseInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint)
+uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor)
{
/* Determine the type of the current descriptor */
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
diff --git a/Demos/Host/MouseHost/ConfigDescriptor.h b/Demos/Host/MouseHost/ConfigDescriptor.h index 40286e546..cb1ae63ad 100644 --- a/Demos/Host/MouseHost/ConfigDescriptor.h +++ b/Demos/Host/MouseHost/ConfigDescriptor.h @@ -61,13 +61,12 @@ InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoHIDInterfaceFound = 4, /**< A compatible HID interface was not found in the device's Configuration Descriptor */
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */
- };
-
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextMouseInterface);
- DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint);
+ };
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
+
+ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor);
#endif
diff --git a/Demos/Host/MouseHost/MouseHost.c b/Demos/Host/MouseHost/MouseHost.c index 77db55282..7db95808a 100644 --- a/Demos/Host/MouseHost/MouseHost.c +++ b/Demos/Host/MouseHost/MouseHost.c @@ -80,7 +80,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -92,7 +92,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop mouse and USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -105,7 +105,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Start Mouse Host task */
Scheduler_SetTaskMode(USB_Mouse_Host, TASK_RUN);
@@ -115,7 +115,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -129,7 +129,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/MouseHost/MouseHost.h b/Demos/Host/MouseHost/MouseHost.h index 81b0412c5..7111218ba 100644 --- a/Demos/Host/MouseHost/MouseHost.h +++ b/Demos/Host/MouseHost/MouseHost.h @@ -83,14 +83,13 @@ Status_HardwareError = 4, /**< Hardware error while enumerating the attached USB device */
};
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
-
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void UpdateStatus(uint8_t CurrentStatus);
void ReadNextReport(void);
diff --git a/Demos/Host/MouseHost/makefile b/Demos/Host/MouseHost/makefile index 1cfba959a..4987c9dde 100644 --- a/Demos/Host/MouseHost/makefile +++ b/Demos/Host/MouseHost/makefile @@ -505,7 +505,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
diff --git a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c index c00852372..5d9d3f04e 100644 --- a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c @@ -70,7 +70,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the mouse interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoHIDInterfaceFound;
@@ -78,7 +78,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the mouse interface's HID descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoHIDDescriptorFound;
@@ -89,7 +89,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the mouse interface's data endpoint descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
@@ -116,7 +116,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextMouseInterface)
+uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
@@ -140,7 +140,7 @@ DESCRIPTOR_COMPARATOR(NextMouseInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint)
+uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
@@ -163,7 +163,7 @@ DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextHID)
+uint8_t DComp_NextHID(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
diff --git a/Demos/Host/MouseHostWithParser/ConfigDescriptor.h b/Demos/Host/MouseHostWithParser/ConfigDescriptor.h index 7cb12dbca..08400c50f 100644 --- a/Demos/Host/MouseHostWithParser/ConfigDescriptor.h +++ b/Demos/Host/MouseHostWithParser/ConfigDescriptor.h @@ -69,13 +69,12 @@ NoHIDDescriptorFound = 5, /**< A compatible HID descriptor was not found in the device's HID interface */
NoEndpointFound = 5, /**< A compatible HID IN endpoint was not found in the device's HID interface */
};
-
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextMouseInterface);
- DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint);
- DESCRIPTOR_COMPARATOR(NextHID);
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
+
+ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor);
+ uint8_t DComp_NextHID(void* CurrentDescriptor);
#endif
diff --git a/Demos/Host/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/MouseHostWithParser/MouseHostWithParser.c index 58a189f6b..f26e9e2a6 100644 --- a/Demos/Host/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/MouseHostWithParser/MouseHostWithParser.c @@ -80,7 +80,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -92,7 +92,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop mouse and USB management task */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -105,7 +105,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Start Mouse Host task */
Scheduler_SetTaskMode(USB_Mouse_Host, TASK_RUN);
@@ -115,7 +115,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -129,7 +129,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/MouseHostWithParser/MouseHostWithParser.h b/Demos/Host/MouseHostWithParser/MouseHostWithParser.h index 99970e261..f2cc2fd00 100644 --- a/Demos/Host/MouseHostWithParser/MouseHostWithParser.h +++ b/Demos/Host/MouseHostWithParser/MouseHostWithParser.h @@ -66,15 +66,14 @@ /* Task Definitions: */
TASK(USB_Mouse_Host);
-
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void UpdateStatus(uint8_t CurrentStatus);
void ProcessMouseReport(uint8_t* MouseReport);
diff --git a/Demos/Host/MouseHostWithParser/makefile b/Demos/Host/MouseHostWithParser/makefile index 4e1aa90b4..be8f48f7d 100644 --- a/Demos/Host/MouseHostWithParser/makefile +++ b/Demos/Host/MouseHostWithParser/makefile @@ -507,7 +507,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
diff --git a/Demos/Host/StillImageHost/ConfigDescriptor.c b/Demos/Host/StillImageHost/ConfigDescriptor.c index b58dfb8bd..108496964 100644 --- a/Demos/Host/StillImageHost/ConfigDescriptor.c +++ b/Demos/Host/StillImageHost/ConfigDescriptor.c @@ -71,7 +71,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the Still Image interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextStillImageInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextStillImageInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoInterfaceFound;
@@ -82,7 +82,7 @@ uint8_t ProcessConfigurationDescriptor(void) {
/* Fetch the next endpoint from the current Still Image interface */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- NextSImageInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+ DComp_NextSImageInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
@@ -148,7 +148,7 @@ uint8_t ProcessConfigurationDescriptor(void) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextStillImageInterface)
+uint8_t DComp_NextStillImageInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
@@ -173,7 +173,7 @@ DESCRIPTOR_COMPARATOR(NextStillImageInterface) *
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
*/
-DESCRIPTOR_COMPARATOR(NextSImageInterfaceDataEndpoint)
+uint8_t DComp_NextSImageInterfaceDataEndpoint(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
diff --git a/Demos/Host/StillImageHost/ConfigDescriptor.h b/Demos/Host/StillImageHost/ConfigDescriptor.h index cb4de5f46..29df30c0c 100644 --- a/Demos/Host/StillImageHost/ConfigDescriptor.h +++ b/Demos/Host/StillImageHost/ConfigDescriptor.h @@ -66,11 +66,10 @@ NoEndpointFound = 5, /**< The correct SI endpoint descriptors were not found in the device's SI interface */
};
- /* Configuration Descriptor Comparison Functions: */
- DESCRIPTOR_COMPARATOR(NextStillImageInterface);
- DESCRIPTOR_COMPARATOR(NextSImageInterfaceDataEndpoint);
-
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
+
+ uint8_t DComp_NextStillImageInterface(void* CurrentDescriptor);
+ uint8_t DComp_NextSImageInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
diff --git a/Demos/Host/StillImageHost/StillImageHost.c b/Demos/Host/StillImageHost/StillImageHost.c index ceec151aa..197e832f6 100644 --- a/Demos/Host/StillImageHost/StillImageHost.c +++ b/Demos/Host/StillImageHost/StillImageHost.c @@ -81,7 +81,7 @@ int main(void) /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
-EVENT_HANDLER(USB_DeviceAttached)
+void EVENT_USB_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
UpdateStatus(Status_USBEnumerating);
@@ -93,7 +93,7 @@ EVENT_HANDLER(USB_DeviceAttached) /** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
-EVENT_HANDLER(USB_DeviceUnattached)
+void EVENT_USB_DeviceUnattached(void)
{
/* Stop USB management and Still Image tasks */
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
@@ -106,7 +106,7 @@ EVENT_HANDLER(USB_DeviceUnattached) /** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
-EVENT_HANDLER(USB_DeviceEnumerationComplete)
+void EVENT_USB_DeviceEnumerationComplete(void)
{
/* Once device is fully enumerated, start the Still Image Host task */
Scheduler_SetTaskMode(USB_SImage_Host, TASK_RUN);
@@ -116,7 +116,7 @@ EVENT_HANDLER(USB_DeviceEnumerationComplete) }
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
-EVENT_HANDLER(USB_HostError)
+void EVENT_USB_HostError(const uint8_t ErrorCode)
{
USB_ShutDown();
@@ -130,7 +130,7 @@ EVENT_HANDLER(USB_HostError) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
-EVENT_HANDLER(USB_DeviceEnumerationFailed)
+void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
{
puts_P(PSTR(ESC_BG_RED "Dev Enum Error\r\n"));
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
diff --git a/Demos/Host/StillImageHost/StillImageHost.h b/Demos/Host/StillImageHost/StillImageHost.h index 4c9091cfe..909ed89bc 100644 --- a/Demos/Host/StillImageHost/StillImageHost.h +++ b/Demos/Host/StillImageHost/StillImageHost.h @@ -68,14 +68,13 @@ /* Task Definitions: */
TASK(USB_SImage_Host);
- /* Event Handlers: */
- HANDLES_EVENT(USB_DeviceAttached);
- HANDLES_EVENT(USB_DeviceUnattached);
- HANDLES_EVENT(USB_DeviceEnumerationComplete);
- HANDLES_EVENT(USB_HostError);
- HANDLES_EVENT(USB_DeviceEnumerationFailed);
-
/* Function Prototypes: */
+ void EVENT_USB_HostError(const uint8_t ErrorCode);
+ void EVENT_USB_DeviceAttached(void);
+ void EVENT_USB_DeviceUnattached(void);
+ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);
+ void EVENT_USB_DeviceEnumerationComplete(void);
+
void UnicodeToASCII(uint8_t* restrict UnicodeString, char* restrict Buffer);
void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError);
void UpdateStatus(uint8_t CurrentStatus);
diff --git a/Demos/Host/StillImageHost/makefile b/Demos/Host/StillImageHost/makefile index f78d66c03..3663d4804 100644 --- a/Demos/Host/StillImageHost/makefile +++ b/Demos/Host/StillImageHost/makefile @@ -506,7 +506,7 @@ sizeafter: checkhooks: build
@echo
@echo ------- Unhooked LUFA Events -------
- @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
+ @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
echo "(None)"
@echo ------------------------------------
|