diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index cbcfd7e6c761daa508121af13e128c2a75a0278d..6769a0c2d6c0d400df444adf172035f70ac4f7a1 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -119,7 +119,7 @@ void ResetHardware(void) /** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user * application started. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Upon disconnection, run user application */ RunBootloader = false; @@ -128,7 +128,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready * to relay data to and from the attached USB host. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Setup CDC Notification, Rx and Tx Endpoints */ Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, @@ -144,11 +144,11 @@ void EVENT_USB_ConfigurationChanged(void) ENDPOINT_BANK_SINGLE); } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library, so that they can be handled appropriately * for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { uint8_t* LineCodingData = (uint8_t*)&LineCoding; diff --git a/Bootloaders/CDC/BootloaderCDC.h b/Bootloaders/CDC/BootloaderCDC.h index fa98a15b3896f94f07c7eae07b065702b523a9aa..13a4f9f5ef78b64fea5c6d84abd69c6cda18f5cf 100644 --- a/Bootloaders/CDC/BootloaderCDC.h +++ b/Bootloaders/CDC/BootloaderCDC.h @@ -118,9 +118,9 @@ void SetupHardware(void); void ResetHardware(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__) static void ReadWriteMemoryBlock(const uint8_t Command); diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index f9c8195f37910ba7d9066434d20beb407e1f4f0d..fb326a1d9855c3f64f8dc817c7d4a2edef635124 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -144,17 +144,17 @@ void ResetHardware(void) /** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user * application started. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Upon disconnection, run user application */ RunBootloader = false; } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the DFU commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Get the size of the command and data from the wLength value */ SentCommand.DataSize = USB_ControlRequest.wLength; diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h index 9366c2284534b70f5b3d2e4c31f6d532fd906b86..11d91db796fc6309a00d7037b3b92f1812eb31e8 100644 --- a/Bootloaders/DFU/BootloaderDFU.h +++ b/Bootloaders/DFU/BootloaderDFU.h @@ -191,8 +191,8 @@ void SetupHardware(void); void ResetHardware(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #if defined(INCLUDE_FROM_BOOTLOADER_C) static void DiscardFillerBytes(uint8_t NumberOfBytes); diff --git a/Bootloaders/TeensyHID/TeensyHID.c b/Bootloaders/TeensyHID/TeensyHID.c index 52526689a02d4174d75b80551a847ccc985b18ab..bb5a0c70838f5609357dcc56dd1cf66c5dbea9da 100644 --- a/Bootloaders/TeensyHID/TeensyHID.c +++ b/Bootloaders/TeensyHID/TeensyHID.c @@ -84,7 +84,7 @@ void SetupHardware(void) /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready * to relay data to and from the attached USB host. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Setup HID Report Endpoint */ Endpoint_ConfigureEndpoint(HID_EPNUM, EP_TYPE_INTERRUPT, @@ -92,11 +92,11 @@ void EVENT_USB_ConfigurationChanged(void) ENDPOINT_BANK_SINGLE); } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the HID commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) diff --git a/Bootloaders/TeensyHID/TeensyHID.h b/Bootloaders/TeensyHID/TeensyHID.h index 3c59605954b822ac0a1cb7509749099c584fe44a..a05729a50a7c0b96a91774fac7b7b3babcaee82b 100644 --- a/Bootloaders/TeensyHID/TeensyHID.h +++ b/Bootloaders/TeensyHID/TeensyHID.h @@ -64,7 +64,7 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Bootloaders/TeensyHID/TeensyHID.txt b/Bootloaders/TeensyHID/TeensyHID.txt index 93862c67463ed03475e72647421a8846671343d0..4cf13082b9a22acaafa76bd43b5d95ebd9537ff7 100644 --- a/Bootloaders/TeensyHID/TeensyHID.txt +++ b/Bootloaders/TeensyHID/TeensyHID.txt @@ -47,7 +47,7 @@ * This bootloader enumerates to the host as a HID Class device, allowing for Teensy compatible programming * software to load firmware onto the AVR, such as the official software at http://www.pjrc.com/teensy/. * - * Out of the box this bootloader builds for the USB162, and will fit into 2KB of bootloader space. + * Out of the box this bootloader builds for the AT90USB162, and will fit into 4KB of bootloader space. * * This spoofs (with permission) the official Teensy bootloader's VID and PID, so that the software remains * compatible with no changes. diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 59d2129f44f9c9a6dcfd51a5fb626d5744c02194..3aa26ae856d616440844e0fb4e4d28dd3cc861ac 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -112,7 +112,7 @@ void ProcessNextSample(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -123,7 +123,7 @@ void EVENT_USB_Connect(void) } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Stop the sample reload timer */ TCCR0B = 0; @@ -132,7 +132,7 @@ void EVENT_USB_Disconnect(void) } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -140,8 +140,8 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - Audio_Device_ProcessControlPacket(&Microphone_Audio_Interface); + Audio_Device_ProcessControlRequest(&Microphone_Audio_Interface); } diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h index f26267339c5bc1d86beb553d590a8fcbc4c0df82..03e2a6da3b9702c48a674ce372f3202304da4972 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.h +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h @@ -76,9 +76,9 @@ void SetupHardware(void); void ProcessNextSample(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 9a8804a45e0040f6f7608dfee496ca7b33565175..d7de7d5b01d44201d990438a777de07c746f5de8 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -140,7 +140,7 @@ void ProcessNextSample(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -169,7 +169,7 @@ void EVENT_USB_Connect(void) } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -194,7 +194,7 @@ void EVENT_USB_Disconnect(void) } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -202,8 +202,8 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - Audio_Device_ProcessControlPacket(&Speaker_Audio_Interface); + Audio_Device_ProcessControlRequest(&Speaker_Audio_Interface); } diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h index 9846a7634185c154cc495312f37a87955625afab..d31a8e6b659896ab404a16b460e2c37bcba9c701 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h @@ -68,9 +68,9 @@ void SetupHardware(void); void ProcessNextSample(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/ClassDriver/CDC/CDC.c b/Demos/Device/ClassDriver/CDC/CDC.c index 8e3530ca22b38e9bab52b387211c1932a391fcd6..4f64646ea0a9309734050134ffb84fe492f08482 100644 --- a/Demos/Device/ClassDriver/CDC/CDC.c +++ b/Demos/Device/ClassDriver/CDC/CDC.c @@ -155,19 +155,19 @@ void CheckJoystickMovement(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -175,8 +175,8 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface); + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } diff --git a/Demos/Device/ClassDriver/CDC/CDC.h b/Demos/Device/ClassDriver/CDC/CDC.h index 255cd86119ee60c6ef5ad3a88f1ea471f8b8e795..ee375a46653dca46d634469c3b42e2ae8e3c7584 100644 --- a/Demos/Device/ClassDriver/CDC/CDC.h +++ b/Demos/Device/ClassDriver/CDC/CDC.h @@ -67,9 +67,9 @@ void SetupHardware(void); void CheckJoystickMovement(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/ClassDriver/DualCDC/DualCDC.c b/Demos/Device/ClassDriver/DualCDC/DualCDC.c index 82ed59d515f16240940f2c04190a85e44f822f86..e5406a4baeccb9cc7f78a73d90de2539e97e2b04 100644 --- a/Demos/Device/ClassDriver/DualCDC/DualCDC.c +++ b/Demos/Device/ClassDriver/DualCDC/DualCDC.c @@ -163,19 +163,19 @@ void CheckJoystickMovement(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -186,9 +186,9 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - CDC_Device_ProcessControlPacket(&VirtualSerial1_CDC_Interface); - CDC_Device_ProcessControlPacket(&VirtualSerial2_CDC_Interface); + CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface); + CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface); } diff --git a/Demos/Device/ClassDriver/DualCDC/DualCDC.h b/Demos/Device/ClassDriver/DualCDC/DualCDC.h index 0f1a76498de71358489579130bf50f40bfc81b19..2f12aca88ea322acd298c06ec73d3e67544c3a70 100644 --- a/Demos/Device/ClassDriver/DualCDC/DualCDC.h +++ b/Demos/Device/ClassDriver/DualCDC/DualCDC.h @@ -67,9 +67,9 @@ void SetupHardware(void); void CheckJoystickMovement(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 323d69336d83faab41e5c71c10b3c15bdb4b64ec..13db6bf74e47dff4e2c2083ed0951dc8f4c8bfd8 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -103,19 +103,19 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -123,10 +123,10 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - HID_Device_ProcessControlPacket(&Generic_HID_Interface); + HID_Device_ProcessControlRequest(&Generic_HID_Interface); } /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h index 50a92ec1eeea04ca900ae8f6614fa133f1ca0b0a..8cf0afc5df252fd2cddf68a21b8130c75209cd1b 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h @@ -67,10 +67,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, void* ReportData, uint16_t* ReportSize); diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index f4dc32d9b76564665717b73985f0f880f89519a1..ea85aaddeea52f8f9b5a9618df34dbaa69855a97 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -97,19 +97,19 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -117,10 +117,10 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - HID_Device_ProcessControlPacket(&Joystick_HID_Interface); + HID_Device_ProcessControlRequest(&Joystick_HID_Interface); } /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h index 764de1723d3ec90a67030da8d1d87c1f81bc647d..493dfa072c173da696aae74fc5c57afb8541acb6 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.h +++ b/Demos/Device/ClassDriver/Joystick/Joystick.h @@ -78,10 +78,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, void* ReportData, uint16_t* ReportSize); diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 040aec453e73751424363012116013bc9eb13042..6f0bd1d1a8a3c13755c46c34c3416e192558ce74 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -98,19 +98,19 @@ void SetupHardware() } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -118,10 +118,10 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - HID_Device_ProcessControlPacket(&Keyboard_HID_Interface); + HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); } /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h index 4a28d20ff2f0de700879adb374455342ec3a1fd9..0f7176ce01881f4e3746461324a740ea0a5a339c 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h @@ -81,10 +81,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, void* ReportData, uint16_t* ReportSize); diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index abaf3808b167ea1705e85483cf7a0b726a6391c6..e21999049c2352bb4fbe318c9565bd0ec889509f 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -121,19 +121,19 @@ void SetupHardware() } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -144,11 +144,11 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - HID_Device_ProcessControlPacket(&Keyboard_HID_Interface); - HID_Device_ProcessControlPacket(&Mouse_HID_Interface); + HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); + HID_Device_ProcessControlRequest(&Mouse_HID_Interface); } /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h index 15532c816988e23b05896a3715205be270c3034d..297564157e49f07b6c4d02f464ede77ba038f50c 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h @@ -85,10 +85,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, void* ReportData, uint16_t* ReportSize); diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index fcb86d661e4aff010c97609d66bb330f05727395..f1a0d9afcd91744f18d84769ac3237808e8cf79d 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -157,19 +157,19 @@ void CheckJoystickMovement(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -177,8 +177,8 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - MIDI_Device_ProcessControlPacket(&Keyboard_MIDI_Interface); + MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); } diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.h b/Demos/Device/ClassDriver/MIDI/MIDI.h index bc9038207b0541d1fb7e911ab8226cd2f9640e72..7c1484d4b0c2c44780ed28fc2fe851ab7282009c 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.h +++ b/Demos/Device/ClassDriver/MIDI/MIDI.h @@ -69,9 +69,9 @@ void SetupHardware(void); void CheckJoystickMovement(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 6a4612e4cde3458c4a54d90002ce06d36b150b90..52ed2d93837c11b2829eb7b376eed76ddaa9b84d 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -92,19 +92,19 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -112,10 +112,10 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - MS_Device_ProcessControlPacket(&Disk_MS_Interface); + MS_Device_ProcessControlRequest(&Disk_MS_Interface); } /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h index 71497780e8e01905de75ce867537590783bf6fa3..e6b2bf99f4321551eeb94235bb853b90f01d8e31 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h @@ -78,10 +78,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo); diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 08e87e672de031d0dc1581a4a3534ef8c6863817..d26101381b46d3a03dc48ab9502fa0fb561153d4 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -96,20 +96,20 @@ void SetupHardware(void) TIMSK0 = (1 << OCIE0A); } -/** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +/** Event handler for the library USB WakeUp event. */ +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } -/** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +/** Event handler for the library USB Suspend event. */ +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -117,10 +117,10 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_Device_UnhandledControlRequest(void) { - HID_Device_ProcessControlPacket(&Mouse_HID_Interface); + HID_Device_ProcessControlRequest(&Mouse_HID_Interface); } /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h index 57e4a693dd918fb91d84b240f167b4997b4589d5..709077fab81aef12f6d10c4f8b14c58150b01eab 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.h +++ b/Demos/Device/ClassDriver/Mouse/Mouse.h @@ -80,10 +80,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Device_Connect(void); + void EVENT_USB_Device_Device_Disconnect(void); + void EVENT_USB_Device_Device_ConfigurationChanged(void); + void EVENT_USB_Device_Device_UnhandledControlRequest(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, void* ReportData, uint16_t* ReportSize); diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index 81d31c9cd5d728b2213ff36d7dc22304404d568e..905f4efd0aad9fb5048b3b75aaf1a5d3167727cf 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -107,19 +107,19 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -127,8 +127,8 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - RNDIS_Device_ProcessControlPacket(&Ethernet_RNDIS_Interface); + RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface); } diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h index c5503e286eb2a2d74de7caa3c9e1edfb5607e08c..b91a54d21a4e34de3110182d432165c2630bbce0 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h @@ -76,9 +76,9 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c index e51963c7a491d8a111fca5101314fb31e209d92b..b78a6d3317400759e586cb76063d865db5b41a83 100644 --- a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.c @@ -116,19 +116,19 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -136,10 +136,10 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlPacket(void) { - CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface); + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } /** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer diff --git a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h index 3ee7e89edff362aafd1aa10d4c9c0a3f3654a4d4..4ceb931a3dc06ca05f4ed33b192057ce799d25b6 100644 --- a/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h +++ b/Demos/Device/ClassDriver/USBtoSerial/USBtoSerial.h @@ -69,10 +69,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.c b/Demos/Device/Incomplete/Sideshow/Sideshow.c index d67fae03fb74f103b038fc30394e9e81a43d46ed..fdf4265e64098ca7a2ebee59eb2ddc1618699868 100644 --- a/Demos/Device/Incomplete/Sideshow/Sideshow.c +++ b/Demos/Device/Incomplete/Sideshow/Sideshow.c @@ -82,17 +82,17 @@ void SetupHardware(void) SerialStream_Init(9600, false); } -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -112,7 +112,7 @@ void EVENT_USB_ConfigurationChanged(void) } } -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process UFI specific control requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.h b/Demos/Device/Incomplete/Sideshow/Sideshow.h index c8d3b53111c52459069499b5be1eec9b7ae9b537..f2890ef21c32b3c52173509452b77f5ffc0ea10c 100644 --- a/Demos/Device/Incomplete/Sideshow/Sideshow.h +++ b/Demos/Device/Incomplete/Sideshow/Sideshow.h @@ -65,9 +65,9 @@ void SetupHardware(void); void SideShow_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index bf790169ddd1f1e4264ee5855b149597a07f23a0..a01c6729cc48e57381a872444cbf45c464137610 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -78,7 +78,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and * configures the sample update and PWM timers. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -92,7 +92,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Stop the sample reload timer */ TCCR0B = 0; @@ -107,7 +107,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -121,11 +121,11 @@ void EVENT_USB_ConfigurationChanged(void) } } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the Audio class-specific * requests) so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process General and Audio specific control requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.h b/Demos/Device/LowLevel/AudioInput/AudioInput.h index 591d3f355d97dc2d7eaa696ec7d1bbc76244dd4f..f74491dac5fcbae77e62cec2716d57d90d497f4c 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.h +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.h @@ -74,9 +74,9 @@ void SetupHardware(void); void USB_Audio_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c index 7dde84bb335e3618b195e1dfc1b6cc4c83ab7643..1128e8f4e52133c01671badf4ca9de10e71509a7 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c @@ -73,7 +73,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and * configures the sample update and PWM timers. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -105,7 +105,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Stop the timers */ TCCR0B = 0; @@ -134,7 +134,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -148,11 +148,11 @@ void EVENT_USB_ConfigurationChanged(void) } } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the Audio class-specific * requests) so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process General and Audio specific control requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h index 6c8d733f31a96b46f3fee8030debf703b75db29d..362a5540a1bb8b0b2fc2037c3ac7404c3fa5fa1a 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h @@ -65,9 +65,9 @@ void SetupHardware(void); void USB_Audio_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/LowLevel/CDC/CDC.c b/Demos/Device/LowLevel/CDC/CDC.c index 4b5409f5c49b4ecec5d14e9bc0ddcd1d54078238..9ee744ea044c4cba351cb49ed12680a748cf1605 100644 --- a/Demos/Device/LowLevel/CDC/CDC.c +++ b/Demos/Device/LowLevel/CDC/CDC.c @@ -143,7 +143,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -152,7 +152,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the USB management and CDC management tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -161,7 +161,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured and the CDC management task started. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -187,13 +187,16 @@ void EVENT_USB_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } + + /* Reset line encoding baud rate so that the host knows to send new values */ + LineEncoding.BaudRateBPS = 0; } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the CDC control commands, * which are all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process CDC specific control requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/CDC/CDC.h b/Demos/Device/LowLevel/CDC/CDC.h index a8f7199abee45579f820cea31d6fb4bad4c86464..4a7b6b1586cece6ee661bd01175bb24263cb5a9e 100644 --- a/Demos/Device/LowLevel/CDC/CDC.h +++ b/Demos/Device/LowLevel/CDC/CDC.h @@ -175,9 +175,9 @@ void SetupHardware(void); void CDC_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/LowLevel/DualCDC/DualCDC.c b/Demos/Device/LowLevel/DualCDC/DualCDC.c index 654ce863e9b44d08882d39d66f326bf91edce149..c49a1ad85bd3785db5cd62b7892c35b5fa3388dd 100644 --- a/Demos/Device/LowLevel/DualCDC/DualCDC.c +++ b/Demos/Device/LowLevel/DualCDC/DualCDC.c @@ -97,7 +97,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -106,7 +106,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the USB management and CDC management tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -115,7 +115,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -163,13 +163,17 @@ void EVENT_USB_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } + + /* Reset line encoding baud rates so that the host knows to send new values */ + LineEncoding1.BaudRateBPS = 0; + LineEncoding2.BaudRateBPS = 0; } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the CDC control commands, * which are all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Determine which interface's Line Coding data is being set from the wIndex parameter */ uint8_t* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? (uint8_t*)&LineEncoding1 : (uint8_t*)&LineEncoding2; diff --git a/Demos/Device/LowLevel/DualCDC/DualCDC.h b/Demos/Device/LowLevel/DualCDC/DualCDC.h index d6f09e6434adbfe983ae770fc19244baccea2cc2..b2085c452bb839671c778677df8187268b4ec233 100644 --- a/Demos/Device/LowLevel/DualCDC/DualCDC.h +++ b/Demos/Device/LowLevel/DualCDC/DualCDC.h @@ -111,9 +111,9 @@ void CDC2_Task(void); void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c index 34c991f12fa646aaf9addf54eaf072b4851d2ec2..5a8bb51875f3999706cf2f1471c86dfc7516950b 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.c +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c @@ -74,7 +74,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -83,7 +83,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the USB management task. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -92,7 +92,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration * of the USB device after enumeration, and configures the generic HID device endpoints. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -114,11 +114,11 @@ void EVENT_USB_ConfigurationChanged(void) } } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the HID commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h index fbd0a7f8d09b7f3f0d219cae5341fef58e1d7538..c0365177398cba2e21997e71b476cc4bf0ed50a8 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.h +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h @@ -73,10 +73,10 @@ void SetupHardware(void); void HID_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); void ProcessGenericHIDReport(uint8_t* DataArray); void CreateGenericHIDReport(uint8_t* DataArray); diff --git a/Demos/Device/LowLevel/Joystick/Joystick.c b/Demos/Device/LowLevel/Joystick/Joystick.c index db2415e4bcfd6eb0ed91a51492f4ad38640a4bd5..306baa9e02f34a1d5c195c3f0f7f81cab0f61b3d 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.c +++ b/Demos/Device/LowLevel/Joystick/Joystick.c @@ -72,7 +72,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -81,7 +81,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the USB management and joystick reporting tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -90,7 +90,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured and the joystick reporting task started. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -104,11 +104,11 @@ void EVENT_USB_ConfigurationChanged(void) } } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the HID commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/Joystick/Joystick.h b/Demos/Device/LowLevel/Joystick/Joystick.h index c50d7f01b51299ac99406561bb49609170658d22..db280ee5c82f03b9c880aa597b3e0115cba760e0 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.h +++ b/Demos/Device/LowLevel/Joystick/Joystick.h @@ -81,10 +81,10 @@ void SetupHardware(void); void HID_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); bool GetNextReport(USB_JoystickReport_Data_t* ReportData); diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c index e27b22827fed54834b8774fd05b3ecf9a2dc8fb3..f8310abb48267068d3895c07d8560ed2fd9fbfd1 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.c +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c @@ -96,7 +96,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -108,7 +108,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -117,7 +117,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration * of the USB device after enumeration, and configures the keyboard device endpoints. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -139,11 +139,11 @@ void EVENT_USB_ConfigurationChanged(void) } } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the HID commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.h b/Demos/Device/LowLevel/Keyboard/Keyboard.h index 2a2ebdc49bf01a11579e6dbcb704447c0d03f59d..bc478f31728fa8e04fc32fc6386a77b573c30313 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.h +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.h @@ -101,10 +101,10 @@ void SetupHardware(void); void HID_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); void CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData); void ProcessLEDReport(uint8_t LEDReport); diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c index 7d486e16e38ab32909b688e9060fb299541f860a..bfd337a2ae237f68a4e53e605a244841b44f6090 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c @@ -80,7 +80,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -89,7 +89,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the USB management task. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -98,7 +98,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration * of the USB device after enumeration, and configures the keyboard and mouse device endpoints. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -132,7 +132,7 @@ void EVENT_USB_ConfigurationChanged(void) * control requests that are not handled internally by the USB library (including the HID commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { uint8_t* ReportData; uint8_t ReportSize; diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h index 138f0fc1da42d061fae7f9e1d7e8e38369e46c78..37cb7f6514f8bb9f9f92da1c17f4a10e2a1c42b1 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h @@ -98,9 +98,9 @@ void Keyboard_HID_Task(void); void Mouse_HID_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/LowLevel/MIDI/MIDI.c b/Demos/Device/LowLevel/MIDI/MIDI.c index 8aed527dbe82206a780c80fd90bfd950077ebc73..4dfb9b7e684df51cf3150e95a855c200e239f033 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.c +++ b/Demos/Device/LowLevel/MIDI/MIDI.c @@ -70,7 +70,7 @@ void SetupHardware(void) } /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -79,7 +79,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs, disables the sample update and PWM output timers and stops the USB and MIDI management tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -88,7 +88,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured and the MIDI management task started. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); diff --git a/Demos/Device/LowLevel/MIDI/MIDI.h b/Demos/Device/LowLevel/MIDI/MIDI.h index 3b9b938a5de76a201ece5cb2f11f1821a611b184..3e7a06d6d0e1775f3bb2fbb855ad8ef84791f4e8 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.h +++ b/Demos/Device/LowLevel/MIDI/MIDI.h @@ -95,8 +95,8 @@ void SetupHardware(void); void MIDI_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); #endif diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index 01d27f043aa529f091b2bb86596110a375c08bbb..1a2d8d468a6f27de66c2e61aec9c34027bffb629 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -83,7 +83,7 @@ void SetupHardware(void) } /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -95,7 +95,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the Mass Storage management task. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -104,7 +104,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured and the Mass Storage management task started. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -129,7 +129,7 @@ void EVENT_USB_ConfigurationChanged(void) * control requests that are not handled internally by the USB library (including the Mass Storage class-specific * requests) so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process UFI specific control requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h index 81fba00002cea0e673ebcc70d6866f261e01c846..868daf09a633f475fcb7418441fdf897bc3240b5 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.h +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h @@ -136,10 +136,10 @@ void SetupHardware(void); void MassStorage_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #if defined(INCLUDE_FROM_MASSSTORAGE_C) static bool ReadInCommandBlock(void); diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c index d15f688d64f2259bf0039202a05638efd46fe29a..48f04612bf50b2aa76a133973019e121ea798535 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.c +++ b/Demos/Device/LowLevel/Mouse/Mouse.c @@ -96,7 +96,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -108,7 +108,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the USB management and Mouse reporting tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -117,7 +117,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration * of the USB device after enumeration - the device endpoints are configured and the mouse reporting task started. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -131,11 +131,11 @@ void EVENT_USB_ConfigurationChanged(void) } } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the HID commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h index 8ff8b8fc341a34ed1e946d07795c8a50b4ed6f80..b244ffa58114f20e2452d15f00b45c6ed3285302 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.h +++ b/Demos/Device/LowLevel/Mouse/Mouse.h @@ -101,10 +101,10 @@ void SetupHardware(void); void Mouse_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); void CreateMouseReport(USB_MouseReport_Data_t* ReportData); diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c index ca38c24d601f7e1c06c12290c67c988ba0492ed8..b722187c6ce3902b3308118f0001cd0e695afc88 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c @@ -79,7 +79,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -88,7 +88,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops all the relevant tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Indicate USB not ready */ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -97,7 +97,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration * of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -125,11 +125,11 @@ void EVENT_USB_ConfigurationChanged(void) } } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the RNDIS control commands, * which set up the USB RNDIS network adapter), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process RNDIS class commands */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h index 5cbddee523c6d63d6e82bccd6179f93bb2ad5ca5..3ae896607bc89d9c65046841837f1ed1962b6034 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h @@ -94,9 +94,9 @@ void RNDIS_Task(void); void Ethernet_Task(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c index 2765064f786d506f796936af283a7b27ab1e0ff9..bb1b4da2d3ca8cbebe84e4d43740291d6db2b73d 100644 --- a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c @@ -89,7 +89,7 @@ void SetupHardware(void) /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and * starts the library USB task to begin the enumeration and USB management process. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { /* Indicate USB enumerating */ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -98,7 +98,7 @@ void EVENT_USB_Connect(void) /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via * the status LEDs and stops the USB management and CDC management tasks. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { /* Reset Tx and Rx buffers, device disconnected */ Buffer_Initialize(&Rx_Buffer); @@ -111,7 +111,7 @@ void EVENT_USB_Disconnect(void) /** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration * of the USB device after enumeration - the device endpoints are configured and the CDC management task started. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); @@ -137,13 +137,16 @@ void EVENT_USB_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } + + /* Reset line encoding baud rate so that the host knows to send new values */ + LineEncoding.BaudRateBPS = 0; } -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the CDC control commands, * which are all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Process CDC specific control requests */ switch (USB_ControlRequest.bRequest) diff --git a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.h b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.h index 51c47c94329b6769c6f53f283084c7d9e6ae5c66..d9567a154bc0036985cf380ef44806f13cfd2656 100644 --- a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.h +++ b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.h @@ -178,9 +178,9 @@ void CDC_Task(void); void ReconfigureUSART(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #endif diff --git a/Demos/Host/ClassDriver/CDCHost/CDCHost.c b/Demos/Host/ClassDriver/CDCHost/CDCHost.c index 6678b2276662971a90457db3e02d094490493ed0..92a558ca2b3cb5abb25401ae9bb4b0a38566429f 100644 --- a/Demos/Host/ClassDriver/CDCHost/CDCHost.c +++ b/Demos/Host/ClassDriver/CDCHost/CDCHost.c @@ -130,7 +130,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR("Device Attached.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -139,7 +139,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR("\r\nDevice Unattached.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -148,13 +148,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -168,7 +168,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/ClassDriver/CDCHost/CDCHost.h b/Demos/Host/ClassDriver/CDCHost/CDCHost.h index c219a193bdc6f6056707370ccb1195eba1240a6e..87a0bbcac2c2fd7d8d9783c6bd6b05064732631e 100644 --- a/Demos/Host/ClassDriver/CDCHost/CDCHost.h +++ b/Demos/Host/ClassDriver/CDCHost/CDCHost.h @@ -66,10 +66,10 @@ /* Function Prototypes: */ void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); #endif diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.c b/Demos/Host/ClassDriver/MouseHost/MouseHost.c index ec431638657a08639043ceb0c575745f8bfc95ba..76a1238cad1219f8c7815f2a232370af44a63f2e 100644 --- a/Demos/Host/ClassDriver/MouseHost/MouseHost.c +++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.c @@ -132,7 +132,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR("Device Attached.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -141,7 +141,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR("\r\nDevice Unattached.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -150,13 +150,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -170,7 +170,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.h b/Demos/Host/ClassDriver/MouseHost/MouseHost.h index 02878257d38976e2472bfccaa3fbf866ea02cc45..9f92be0865ace412e4756adae2c774e7024e2c27 100644 --- a/Demos/Host/ClassDriver/MouseHost/MouseHost.h +++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.h @@ -66,10 +66,10 @@ /* Function Prototypes: */ void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); #endif diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c index a52ba7cb674e2faa04bf04c0548b9cc461d62279..25c15a92205cea6c179d1aa41e331d280ee4c50a 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c @@ -75,26 +75,26 @@ void SetupHardware(void) USB_Init(); } -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } -void EVENT_USB_HostError(uint8_t ErrorCode) +void EVENT_USB_Host_HostError(uint8_t ErrorCode) { USB_ShutDown(); @@ -105,7 +105,7 @@ void EVENT_USB_HostError(uint8_t ErrorCode) for(;;); } -void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); @@ -158,9 +158,6 @@ void Bluetooth_Management_Task(void) break; } - USB_HostState = HOST_STATE_Configured; - break; - case HOST_STATE_Configured: puts_P(PSTR("Getting Config Data.\r\n")); /* Get and process the configuration descriptor data */ @@ -183,7 +180,7 @@ void Bluetooth_Management_Task(void) puts_P(PSTR("Bluetooth Dongle Enumerated.\r\n")); - USB_HostState = HOST_STATE_Ready; + USB_HostState = HOST_STATE_Configured; break; } } diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h index d44a38a2afcdead1dc6529b5a71ae0f0f6cd5cc4..0246bff82644fab9a01c4f0278e0ceff4b7c3f09 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h @@ -70,11 +70,11 @@ void Bluetooth_Management_Task(void); /* Event Handlers: */ - void EVENT_USB_DeviceAttached(void); - void EVENT_USB_DeviceUnattached(void); - void EVENT_USB_DeviceEnumerationComplete(void); - void EVENT_USB_HostError(uint8_t ErrorCode); - void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationComplete(void); + void EVENT_USB_Host_HostError(uint8_t ErrorCode); + void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode); /* Function Prototypes: */ void SetupHardware(void); diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c index 54291bf7528249030bc85ce8638063835933b6f1..3b8bcde892afd7c5b91c2f2893eab799746e0eae 100644 --- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c +++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c @@ -398,7 +398,7 @@ void Bluetooth_ProcessHCICommands(void) { while (!(Bluetooth_GetNextHCIEventHeader())) { - if (USB_DeviceState == DEVICE_STATE_Unattached) + if (USB_HostState == HOST_STATE_Unattached) return; } diff --git a/Demos/Host/LowLevel/CDCHost/CDCHost.c b/Demos/Host/LowLevel/CDCHost/CDCHost.c index e20fa2cfcc86a2353441804fefbecff524745b29..a423b90eb8d2a491a26303735d451c6a15cb3612 100644 --- a/Demos/Host/LowLevel/CDCHost/CDCHost.c +++ b/Demos/Host/LowLevel/CDCHost/CDCHost.c @@ -73,7 +73,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/CDCHost/CDCHost.h b/Demos/Host/LowLevel/CDCHost/CDCHost.h index 9e1d638640da6c3c1fb029067a0264c68dce7fa9..95faa7d53236fd8efba0763136578ddd128ae085 100644 --- a/Demos/Host/LowLevel/CDCHost/CDCHost.h +++ b/Demos/Host/LowLevel/CDCHost/CDCHost.h @@ -117,10 +117,10 @@ void SetupHardware(void); void CDC_Host_Task(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); #endif diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c index d360643332fea8602a4969ed03f3d89a765e9ed0..33397b64305e52b145a7b09ddd539f3e272126ad 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c +++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c @@ -73,7 +73,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h index 415dae02315c1d91939c2abc52ca2e4546f2bffd..4a64b57915b4eeb0a88e54b4778d1a1fcfefcee2 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h +++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h @@ -84,11 +84,11 @@ void SetupHardware(void); void HID_Host_Task(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void ReadNextReport(void); void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength); diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c index 1a53526bab93e70d6d207375a42038b4f439ba97..f40e7b9a002df2ed1958a097f8cda4c510881d81 100644 --- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c +++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c @@ -73,7 +73,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h index 98a9e37a7fafca2253c4cfa68b296c00ed7387fa..aed6ca6290a3d7e37c98560a7c0d5565438daf44 100644 --- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h +++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h @@ -84,11 +84,11 @@ void Keyboard_HID_Task(void); void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void ReadNextReport(void); diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c index 2cc08a13ddc19660a6ecb9d2301e3df586573524..ef73b77b00a3fe2fbd781659d1c38f3fcbb3df47 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -73,7 +73,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h index 90db94a2aa2fdb82c640ee2e1d072dd3d9586584..8453bb6612ee9077035f7f00733c053ff95df366 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h @@ -67,11 +67,11 @@ void Keyboard_HID_Task(void); void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void ProcessKeyboardReport(uint8_t* KeyboardReport); diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c index 6cfe669f6bbadceaf3d8debda3e05bffa4819ed6..60eb98a0476a74bbb1c0cc8a2b83f7740dd371cd 100644 --- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c +++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c @@ -79,7 +79,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -88,7 +88,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -97,7 +97,7 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } @@ -117,7 +117,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h index 1307a1af2ae839db84c7ac606cc1522c96ec568f..c07109919363c6beeb2d28c01266bad4775405ba 100644 --- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h +++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h @@ -76,11 +76,11 @@ void MassStorage_Task(void); void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void ShowDiskReadError(char* CommandString, bool FailedAtSCSILayer, uint8_t ErrorCode); diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.c b/Demos/Host/LowLevel/MouseHost/MouseHost.c index b98f4bf968f43966b43d7899544a53d46b1444f0..44147481be49fecc753baf2b32c8daa52cfb4c37 100644 --- a/Demos/Host/LowLevel/MouseHost/MouseHost.c +++ b/Demos/Host/LowLevel/MouseHost/MouseHost.c @@ -73,7 +73,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.h b/Demos/Host/LowLevel/MouseHost/MouseHost.h index 1abd56068720ce96b2879325258e6871db130d27..4a3838289e4e09f5d825ed8a2ca3af629106607a 100644 --- a/Demos/Host/LowLevel/MouseHost/MouseHost.h +++ b/Demos/Host/LowLevel/MouseHost/MouseHost.h @@ -84,11 +84,11 @@ void Mouse_HID_Task(void); void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void ReadNextReport(void); diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c index 8ea5e7201d8d7b53b912244589bf748aeee67fb7..b5b41ce6709f5a627e40f56741a53fc91ea4b28c 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c @@ -73,7 +73,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -111,7 +111,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h index 71d11a1eedd1ceafd73ce074f10efebb82b25d77..c5bfce52f401ae87471ad9811e2e792e0ec62fcb 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h @@ -67,11 +67,11 @@ void Mouse_HID_Task(void); void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void ProcessMouseReport(uint8_t* MouseReport); diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c index bbda0c24b5d4d3ab1bbd464b1f23310ab8a59eb2..bd84f19ebdd29ca888ccb023f31e29c901038afe 100644 --- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c +++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c @@ -73,7 +73,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -82,7 +82,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -91,13 +91,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(uint8_t ErrorCode) +void EVENT_USB_Host_HostError(uint8_t ErrorCode) { USB_ShutDown(); @@ -111,7 +111,7 @@ void EVENT_USB_HostError(uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h index f6afcc796c191c9cc9f35934c99fc1b3f0d6b171..db7a9fe7e2b6514458bc4b45fafc3dc7d63ed6c7 100644 --- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h +++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h @@ -70,11 +70,11 @@ #define LEDMASK_USB_BUSY (LEDS_LED2) /* Function Prototypes: */ - void EVENT_USB_DeviceAttached(void); - void EVENT_USB_DeviceUnattached(void); - void EVENT_USB_DeviceEnumerationComplete(void); - void EVENT_USB_HostError(uint8_t ErrorCode); - void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationComplete(void); + void EVENT_USB_Host_HostError(uint8_t ErrorCode); + void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode); void SetupHardware(void); diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c index ca0771a94bee197fd5df35ede92000f7916cd38e..6c56d5f3e8293fced53bcea0c2d4c927cb412790 100644 --- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c +++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c @@ -74,7 +74,7 @@ void SetupHardware(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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); @@ -83,7 +83,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); @@ -92,13 +92,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -112,7 +112,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n")); printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h b/Demos/Host/LowLevel/StillImageHost/StillImageHost.h index 1896b8fe5ae923e8a07e0d2f0a3818236497cdf1..89956e0f5d69aaa9e99c3a6e9c7da74c932cbaeb 100644 --- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h +++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.h @@ -72,11 +72,11 @@ void StillImage_Task(void); void SetupHardware(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void UnicodeToASCII(uint8_t* restrict UnicodeString, char* restrict Buffer); void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError); diff --git a/Demos/OTG/TestApp/TestEvents.c b/Demos/OTG/TestApp/TestEvents.c index d0bc805dba1ad62befe16d4c564ec406262f2939..aee2b16ae37d89104a0b2d4d8010d57435a67f72 100644 --- a/Demos/OTG/TestApp/TestEvents.c +++ b/Demos/OTG/TestApp/TestEvents.c @@ -54,71 +54,17 @@ static void Abort_Program(void) for (;;); } -/** Event handler for the USB_VBUSChange event. When fired, the event is logged to the USART. */ -void EVENT_USB_VBUSChange(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "VBUS Change\r\n" ESC_FG_WHITE)); -} - -/** Event handler for the USB_VBUSConnect event. When fired, the event is logged to the USART. */ -void EVENT_USB_VBUSConnect(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "VBUS +\r\n" ESC_FG_WHITE)); -} - -/** Event handler for the USB_VBUSDisconnect event. When fired, the event is logged to the USART. */ -void EVENT_USB_VBUSDisconnect(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "VBUS -\r\n" ESC_FG_WHITE)); -} - -/** - * Event handler for the USB_Connect event. When fired, the event is logged to the USART and the - * USB task started. - */ -void EVENT_USB_Connect(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB +\r\n" ESC_FG_WHITE)); -} - -/** - * Event handler for the USB_Disconnect event. When fired, the event is logged to the USART and the - * USB task stopped. - */ -void EVENT_USB_Disconnect(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB -\r\n" ESC_FG_WHITE)); -} - -/** Event handler for the USB_Suspend event. When fired, the event is logged to the USART. */ -void EVENT_USB_Suspend(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Sleep\r\n" ESC_FG_WHITE)); -} - -/** Event handler for the USB_WakeUp event. When fired, the event is logged to the USART. */ -void EVENT_USB_WakeUp(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Wakeup\r\n" ESC_FG_WHITE)); -} - -/** Event handler for the USB_Reset event. When fired, the event is logged to the USART. */ -void EVENT_USB_Reset(void) -{ - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Reset\r\n" ESC_FG_WHITE)); -} - /** Event handler for the USB_UIDChange event. When fired, the event is logged to the USART. */ void EVENT_USB_UIDChange(void) { char* ModeStrPtr; - puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "UID Change\r\n")); + puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "UID Change\r\n")); if (USB_CurrentMode == USB_MODE_DEVICE) - ModeStrPtr = PSTR("HOST"); - else if (USB_CurrentMode == USB_MODE_HOST) ModeStrPtr = PSTR("DEVICE"); + else if (USB_CurrentMode == USB_MODE_HOST) + ModeStrPtr = PSTR("HOST"); else ModeStrPtr = PSTR("N/A"); @@ -126,7 +72,7 @@ void EVENT_USB_UIDChange(void) } /** - * Event handler for the USB_PowerOnFail event. When fired, the event is logged to the USART and the program + * Event handler for the USB_InitFailure event. When fired, the event is logged to the USART and the program * execution aborted. */ void EVENT_USB_InitFailure(const uint8_t ErrorCode) @@ -148,29 +94,38 @@ void EVENT_USB_InitFailure(const uint8_t ErrorCode) Abort_Program(); } -/** - * Event handler for the USB_HostError event. When fired, the event is logged to the USART and the program - * execution aborted. - */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +/** Event handler for the USB_Device_Connect event. When fired, the event is logged to the USART. */ +void EVENT_USB_Device_Connect(void) { - puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Host Mode Error\r\n")); - printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); + puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "USB Connect\r\n" ESC_FG_WHITE)); +} - Abort_Program(); +/** Event handler for the USB_Device_Disconnect event. When fired, the event is logged to the USART. */ +void EVENT_USB_Device_Disconnect(void) +{ + puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "USB Disconnect\r\n" ESC_FG_WHITE)); } -/** Event handler for the USB_DeviceEnumerationFailed event. When fired, the event is logged to the USART. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +/** Event handler for the USB_Device_Suspend event. When fired, the event is logged to the USART. */ +void EVENT_USB_Device_Suspend(void) { - puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Dev Enum Error\r\n")); - printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); - printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode); - printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState); + puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Sleep\r\n" ESC_FG_WHITE)); +} + +/** Event handler for the USB_Device_WakeUp event. When fired, the event is logged to the USART. */ +void EVENT_USB_Device_WakeUp(void) +{ + puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Wakeup\r\n" ESC_FG_WHITE)); +} + +/** Event handler for the USB_Device_Reset event. When fired, the event is logged to the USART. */ +void EVENT_USB_Device_Reset(void) +{ + puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "USB Reset\r\n" ESC_FG_WHITE)); } -/** Event handler for the USB_UnhandledControlPacket event. When fired, the event is logged to the USART. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the USB_Device_UnhandledControlRequest event. When fired, the event is logged to the USART. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Ctrl Request\r\n")); printf_P(PSTR(" -- Req Data %d\r\n"), USB_ControlRequest.bRequest); @@ -178,26 +133,47 @@ void EVENT_USB_UnhandledControlPacket(void) printf_P(PSTR(" -- Req Length %d\r\n" ESC_FG_WHITE), USB_ControlRequest.wLength); } -/** Event handler for the USB_ConfigurationChanged event. When fired, the event is logged to the USART. */ -void EVENT_USB_ConfigurationChanged(void) +/** Event handler for the USB_Device_ConfigurationChanged event. When fired, the event is logged to the USART. */ +void EVENT_USB_Device_ConfigurationChanged(void) { puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Configuration Number Changed\r\n" ESC_FG_WHITE)); } -/** Event handler for the USB_DeviceAttached event. When fired, the event is logged to the USART. */ -void EVENT_USB_DeviceAttached(void) +/** + * Event handler for the USB_Host_HostError event. When fired, the event is logged to the USART and the program + * execution aborted. + */ +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { - puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device +\r\n" ESC_FG_WHITE)); + puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Host Mode Error\r\n")); + printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); + + Abort_Program(); } -/** Event handler for the USB_DeviceUnattached event. When fired, the event is logged to the USART. */ -void EVENT_USB_DeviceUnattached(void) +/** Event handler for the USB_Host_DeviceEnumerationFailed event. When fired, the event is logged to the USART. */ +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { - puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device -\r\n" ESC_FG_WHITE)); + puts_P(PSTR(ESC_FG_RED EVENT_PREFIX "Dev Enum Error\r\n")); + printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode); + printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode); + printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState); } -/** Event handler for the USB_DeviceEnumerationComplete event. When fired, the event is logged to the USART. */ -void EVENT_USB_DeviceEnumerationComplete(void) +/** Event handler for the USB_Host_DeviceEnumerationComplete event. When fired, the event is logged to the USART. */ +void EVENT_USB_Host_DeviceEnumerationComplete(void) { puts_P(PSTR(ESC_FG_YELLOW EVENT_PREFIX "Device Enumeration Complete\r\n" ESC_FG_WHITE)); } + +/** Event handler for the USB_Host_DeviceAttached event. When fired, the event is logged to the USART. */ +void EVENT_USB_Host_DeviceAttached(void) +{ + puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device Attached\r\n" ESC_FG_WHITE)); +} + +/** Event handler for the USB_Host_DeviceUnattached event. When fired, the event is logged to the USART. */ +void EVENT_USB_Host_DeviceUnattached(void) +{ + puts_P(PSTR(ESC_FG_GREEN EVENT_PREFIX "Device Unattached\r\n" ESC_FG_WHITE)); +} diff --git a/Demos/OTG/TestApp/TestEvents.h b/Demos/OTG/TestApp/TestEvents.h index b82936fb47512cdd6534473246f781263ca1a189..ee00dd728e3392e7ee91862dae8e644231727b2d 100644 --- a/Demos/OTG/TestApp/TestEvents.h +++ b/Demos/OTG/TestApp/TestEvents.h @@ -54,22 +54,19 @@ static void Abort_Program(void) ATTR_NO_RETURN; #endif - void EVENT_USB_VBUSChange(void); - void EVENT_USB_VBUSConnect(void); - void EVENT_USB_VBUSDisconnect(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); void EVENT_USB_InitFailure(const uint8_t ErrorCode); void EVENT_USB_UIDChange(void); - 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 EVENT_USB_UnhandledControlPacket(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_Suspend(void); - void EVENT_USB_WakeUp(void); - void EVENT_USB_Reset(void); + void EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_Suspend(void); + void EVENT_USB_Device_WakeUp(void); + void EVENT_USB_Device_Reset(void); #endif diff --git a/LUFA/Drivers/USB/Class/Device/Audio.c b/LUFA/Drivers/USB/Class/Device/Audio.c index 210a3c80010df1336d11405abae92ece781346d6..c4fbc3d9c9b9011628c227a0e14458355af13c99 100644 --- a/LUFA/Drivers/USB/Class/Device/Audio.c +++ b/LUFA/Drivers/USB/Class/Device/Audio.c @@ -33,7 +33,7 @@ #include "Audio.h" -void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) +void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) return; diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h index 2c91dae7c54b23d72aceda863b8f53d6f2a53dba..b1c5046c6cbed5f8f3c836b5b4004aa738b4dcd6 100644 --- a/LUFA/Drivers/USB/Class/Device/Audio.h +++ b/LUFA/Drivers/USB/Class/Device/Audio.h @@ -97,7 +97,7 @@ /* Function Prototypes: */ /** Configures the endpoints of a given Audio interface, ready for use. This should be linked to the library - * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the + * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the * given Audio interface is selected. * * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. @@ -107,11 +107,11 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo); /** Processes incomming control requests from the host, that are directed to the given Audio class interface. This should be - * linked to the library \ref EVENT_USB_UnhandledControlPacket() event. + * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. */ - void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo); + void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo); /** General management task for a given Audio class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index 9ed20e4846684e9d4e73b44bfa3c0d5e0e63d29e..9da0ed1ebf56a60375a979f760c1ad469e5fce71 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -39,7 +39,7 @@ void CDC_Device_Event_Stub(void) } -void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) +void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) return; diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h index 2a8f1ecd8fd5edb146b1e96d6c81d2a4f64893ee..7332f56cc6bad8786df01797ed425e1d01145ce6 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.h +++ b/LUFA/Drivers/USB/Class/Device/CDC.h @@ -108,8 +108,8 @@ /* Function Prototypes: */ /** Configures the endpoints of a given CDC interface, ready for use. This should be linked to the library - * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the - * given CDC interface is selected. + * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing + * the given CDC interface is selected. * * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. * @@ -118,11 +118,11 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); /** Processes incomming control requests from the host, that are directed to the given CDC class interface. This should be - * linked to the library \ref EVENT_USB_UnhandledControlPacket() event. + * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. */ - void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); + void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); /** General management task for a given CDC class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c index 40f7d2f49864c1c7df0fac2ee3e1db089a0eb691..937214b94691e4e056dd004b8f1ee124b43f65eb 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.c +++ b/LUFA/Drivers/USB/Class/Device/HID.c @@ -33,7 +33,7 @@ #include "HID.h" -void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) +void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) return; diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h index b8ca47980a7deb1754e19688af3468496aa6c48d..0c141e62c9010c747c0c5d1e0366e41659da935e 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.h +++ b/LUFA/Drivers/USB/Class/Device/HID.h @@ -95,7 +95,7 @@ /* Function Prototypes: */ /** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library - * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration + * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * containing the given HID interface is selected. * * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. @@ -105,11 +105,11 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo); /** Processes incomming control requests from the host, that are directed to the given HID class interface. This should be - * linked to the library \ref EVENT_USB_UnhandledControlPacket() event. + * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. */ - void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo); + void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo); /** General management task for a given HID class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.c b/LUFA/Drivers/USB/Class/Device/MIDI.c index ed3aaa7231aa0856fba84125e6b5376aa17e8ed2..a74e7a619295713902305ee37f8eaeb193d50924 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDI.c +++ b/LUFA/Drivers/USB/Class/Device/MIDI.c @@ -33,7 +33,7 @@ #include "MIDI.h" -void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) +void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) { } diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.h b/LUFA/Drivers/USB/Class/Device/MIDI.h index 980ddc5bf2c7672edac1337790e9476437c407db..c7e46ba97fac8a1fac814a1340c38d5ccd3d5408 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDI.h +++ b/LUFA/Drivers/USB/Class/Device/MIDI.h @@ -86,7 +86,7 @@ /* Function Prototypes: */ /** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library - * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration + * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * containing the given MIDI interface is selected. * * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. @@ -96,11 +96,11 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo); /** Processes incomming control requests from the host, that are directed to the given MIDI class interface. This should be - * linked to the library \ref EVENT_USB_UnhandledControlPacket() event. + * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. */ - void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo); + void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo); /** General management task for a given MIDI class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c index 6160641bf0912df5149d21bcc47df3b95f080da8..04c63fca736395c674eba8ef110bbaf2018b768b 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c @@ -36,7 +36,7 @@ static USB_ClassInfo_MS_Device_t* CallbackMSInterfaceInfo; -void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) +void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) return; diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.h b/LUFA/Drivers/USB/Class/Device/MassStorage.h index cd7a8ef1d7bd4e6b8fb7852f1aa95d968d5993fe..b207c237e250e4327920f8f779d6ef5887bdc919 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Device/MassStorage.h @@ -95,7 +95,7 @@ /* Function Prototypes: */ /** Configures the endpoints of a given Mass Storage interface, ready for use. This should be linked to the library - * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration + * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * containing the given Mass Storage interface is selected. * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. @@ -105,11 +105,11 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); /** Processes incomming control requests from the host, that are directed to the given Mass Storage class interface. This should be - * linked to the library \ref EVENT_USB_UnhandledControlPacket() event. + * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. */ - void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); + void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); /** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.c b/LUFA/Drivers/USB/Class/Device/RNDIS.c index 8131d87576bfc4f0e225fc968274aa6e41414507..13d82a5bf40ba74ecb5991b12a01ec81050bf284 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Device/RNDIS.c @@ -65,7 +65,7 @@ static const uint32_t PROGMEM AdapterSupportedOIDList[] = OID_802_3_XMIT_MORE_COLLISIONS, }; -void RNDIS_Device_ProcessControlPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) +void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) return; diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.h b/LUFA/Drivers/USB/Class/Device/RNDIS.h index 8855aac175642dbc5b79c7a2630d32af94fb7f79..d9a5d7f0be8b525ceee470672ec644198409d860 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Device/RNDIS.h @@ -103,7 +103,7 @@ /* Function Prototypes: */ /** Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library - * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration + * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration * containing the given HID interface is selected. * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. @@ -113,11 +113,11 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); /** Processes incomming control requests from the host, that are directed to the given RNDIS class interface. This should be - * linked to the library \ref EVENT_USB_UnhandledControlPacket() event. + * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event. * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. */ - void RNDIS_Device_ProcessControlPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); + void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); /** General management task for a given HID class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h index 4042d46703ee2f8e2a5127c06f87aa9a9f40b41d..1e638314cfff682e14fd4a8d26e1a3cc891b8fea 100644 --- a/LUFA/Drivers/USB/HighLevel/Events.h +++ b/LUFA/Drivers/USB/HighLevel/Events.h @@ -62,67 +62,7 @@ /* Public Interface - May be used in end-application: */ /* Pseudo-Functions for Doxygen: */ #if !defined(INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__) - /** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from - * high to low or vice-versa, before the new VBUS level is sampled and the appropriate action - * taken. - * - * \note This event is only available on USB AVR models which support VBUS notification interrupts. - */ - void EVENT_USB_VBUSChange(void); - - /** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when - * the VBUS line of the USB AVR changes from low to high (after the VBUS events have been handled), - * signalling the attachment of the USB device to a host, before the enumeration process has begun. - * - * \note This event is only available on USB AVR models which support VBUS notification interrupts. - */ - void EVENT_USB_VBUSConnect(void); - - /** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when - * the VBUS line of the USB AVR changes from high to low (after the VBUS events have been handled), - * signalling the detatchment of the USB device from a host, regardless of its enumeration state. - * - * \note This event is only available on USB AVR models which support VBUS notification interrupts. - */ - void EVENT_USB_VBUSDisconnect(void); - - /** Event for USB device connection. This event fires when the AVR is in USB host mode and a device - * has been attached (but not yet fully enumerated), or when in device mode and the device is connected - * to a host, beginning the enumeration process. - * - * When in device mode, this can be used to programmatically start the USB management task to reduce - * CPU usage. - * - * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller. - * this means that the current connection state is derived from the bus suspension and wake up events by default, - * which is not always accurate (host may suspend the bus while still connected). If the actual connection state - * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by - * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection - * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. - * - * \see USBTask.h for more information on the USB management task and reducing CPU usage. - */ - void EVENT_USB_Connect(void); - - /** Event for USB device disconnection. This event fires when the AVR is in USB host mode and an - * attached and enumerated device has been disconnected, or when in device mode and the device is - * disconnected from the host. - * - * When in device mode, this can be used to programmatically stop the USB management task to reduce - * CPU usage. - * - * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller. - * this means that the current connection state is derived from the bus suspension and wake up events by default, - * which is not always accurate (host may suspend the bus while still connected). If the actual connection state - * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by - * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection - * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. - * - * \see USBTask.h for more information on the USB management task and reducing CPU usage. - */ - void EVENT_USB_Disconnect(void); - - /** Event for USB initialization failure. This event fires when the USB interface fails to + /** Event for USB stack initialization failure. This event fires when the USB interface fails to * initialize correctly due to a hardware or software fault. * * \note This event only exists on USB AVR models which support dual role modes. @@ -133,8 +73,8 @@ /** Event for USB mode pin level change. This event fires when the USB interface is set to dual role * mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires - * before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Disconnect event - * has fired (if connected before the role change). + * before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Device_Disconnect + * event has fired (if connected before the role change). * * \note This event only exists on USB AVR models which support dual role modes. * @@ -153,12 +93,12 @@ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). */ - void EVENT_USB_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_HostError(const uint8_t ErrorCode); /** Event for USB device attachment. This event fires when a the USB interface is in host mode, and * a USB device has been connected to the USB interface. This is interrupt driven, thus fires before - * the standard \ref EVENT_USB_Connect event and so can be used to programmatically start the USB management - * task to reduce CPU consumption. + * the standard \ref EVENT_USB_Device_Connect event and so can be used to programmatically start the USB + * management task to reduce CPU consumption. * * \note This event only exists on USB AVR models which supports host mode. * @@ -167,7 +107,7 @@ * * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. */ - void EVENT_USB_DeviceAttached(void); + void EVENT_USB_Host_DeviceAttached(void); /** Event for USB device removal. This event fires when a the USB interface is in host mode, and * a USB device has been removed the USB interface whether or not it has been enumerated. This @@ -180,7 +120,7 @@ * * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. */ - void EVENT_USB_DeviceUnattached(void); + void EVENT_USB_Host_DeviceUnattached(void); /** Event for USB device enumeration failure. This event fires when a the USB interface is * in host mode, and an attached USB device has failed to enumerate completely. @@ -197,14 +137,41 @@ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). */ - void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); /** Event for USB device enumeration completion. This event fires when a the USB interface is * in host mode and an attached USB device has been completely enumerated and is ready to be - * controlled by the user application, or when the library is in device mode, and the Host - * has finished enumerating the device. + * controlled by the user application. */ - void EVENT_USB_DeviceEnumerationComplete(void); + void EVENT_USB_Host_DeviceEnumerationComplete(void); + + /** Event for USB device connection. This event fires when the AVR in device mode and the device is connected + * to a host, beginning the enumeration process, measured by a rising level on the AVR's VBUS pin. + * + * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller. + * this means that the current connection state is derived from the bus suspension and wake up events by default, + * which is not always accurate (host may suspend the bus while still connected). If the actual connection state + * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by + * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection + * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. + * + * \see USBTask.h for more information on the USB management task and reducing CPU usage. + */ + void EVENT_USB_Device_Connect(void); + + /** Event for USB device disconnection. This event fires when the AVR in device mode and the device is disconnected + * from a host, measured by a falling level on the AVR's VBUS pin. + * + * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller. + * this means that the current connection state is derived from the bus suspension and wake up events by default, + * which is not always accurate (host may suspend the bus while still connected). If the actual connection state + * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by + * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection + * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. + * + * \see USBTask.h for more information on the USB management task and reducing CPU usage. + */ + void EVENT_USB_Device_Disconnect(void); /** Event for unhandled control requests. This event fires when a the USB host issues a control * request to the control endpoint (address 0) that the library does not handle. This may either @@ -220,7 +187,7 @@ * request SETUP parameters into the \ref USB_ControlRequest structure which should then be used * by the application to determine how to handle the issued request. */ - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_UnhandledControlRequest(void); /** Event for USB configuration number changed. This event fires when a the USB host changes the * selected configuration number while in device mode. This event should be hooked in device @@ -231,7 +198,7 @@ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). */ - void EVENT_USB_ConfigurationChanged(void); + void EVENT_USB_Device_ConfigurationChanged(void); /** Event for USB suspend. This event fires when a the USB host suspends the device by halting its * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move @@ -242,9 +209,9 @@ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). * - * \see \ref EVENT_USB_WakeUp() event for accompanying Wake Up event. + * \see \ref EVENT_USB_Device_WakeUp() event for accompanying Wake Up event. */ - void EVENT_USB_Suspend(void); + void EVENT_USB_Device_Suspend(void); /** Event for USB wake up. This event fires when a the USB interface is suspended while in device * mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally @@ -255,9 +222,9 @@ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). * - * \see \ref EVENT_USB_Suspend() event for accompanying Suspend event. + * \see \ref EVENT_USB_Device_Suspend() event for accompanying Suspend event. */ - void EVENT_USB_WakeUp(void); + void EVENT_USB_Device_WakeUp(void); /** Event for USB interface reset. This event fires when the USB interface is in device mode, and * a the USB host requests that the device reset its interface. This event fires after the control @@ -266,7 +233,7 @@ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). */ - void EVENT_USB_Reset(void); + void EVENT_USB_Device_Reset(void); #endif /* Private Interface - For use in library only: */ @@ -274,35 +241,30 @@ /* Function Prototypes: */ #if defined(INCLUDE_FROM_EVENTS_C) void USB_Event_Stub(void) ATTR_CONST; - - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - void EVENT_USB_VBUSChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_VBUSConnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_VBUSDisconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - #endif - void EVENT_USB_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - #if defined(USB_CAN_BE_BOTH) void EVENT_USB_InitFailure(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); #endif #if defined(USB_CAN_BE_HOST) - void EVENT_USB_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) + void EVENT_USB_Host_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Host_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Host_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Host_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); #endif - void EVENT_USB_UnhandledControlPacket(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + #if defined(USB_CAN_BE_DEVICE) + void EVENT_USB_Device_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_UnhandledControlRequest(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + #endif #endif #endif diff --git a/LUFA/Drivers/USB/HighLevel/StdRequestType.h b/LUFA/Drivers/USB/HighLevel/StdRequestType.h index b9ae04598b5687067dd8b075457f20d597e458d1..c5be544b97069778900004e7bf2da984ac11bebc 100644 --- a/LUFA/Drivers/USB/HighLevel/StdRequestType.h +++ b/LUFA/Drivers/USB/HighLevel/StdRequestType.h @@ -160,41 +160,41 @@ { REQ_GetStatus = 0, /**< Implemented in the library for device, endpoint and interface * recipients. Passed to the user application for other recipients - * via the \ref EVENT_USB_UnhandledControlPacket() event when received in + * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_ClearFeature = 1, /**< Implemented in the library for device, endpoint and interface * recipients. Passed to the user application for other recipients - * via the \ref EVENT_USB_UnhandledControlPacket() event when received in + * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_SetFeature = 3, /**< Implemented in the library for device, endpoint and interface * recipients. Passed to the user application for other recipients - * via the \ref EVENT_USB_UnhandledControlPacket() event when received in + * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed * to the user application for other recipients via the - * \ref EVENT_USB_UnhandledControlPacket() event when received in + * \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_GetDescriptor = 6, /**< Implemented in the library for all recipients and all request * types. */ REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_UnhandledControlPacket() event when received in + * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed * to the user application for other recipients via the - * \ref EVENT_USB_UnhandledControlPacket() event when received in + * \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed * to the user application for other recipients via the - * \ref EVENT_USB_UnhandledControlPacket() event when received in + * \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_UnhandledControlPacket() event when received in + * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_UnhandledControlPacket() event when received in + * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_UnhandledControlPacket() event when received in + * via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in * device mode. */ }; diff --git a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c index 51a761ae7ffe7dfabceab993aaf515c779d7fc1f..56e54f25ace72a6a5fdc350c37c57ca3cecb54cd 100644 --- a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c +++ b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c @@ -72,36 +72,15 @@ ISR(USB_GEN_vect, ISR_BLOCK) { USB_INT_Clear(USB_INT_VBUS); - EVENT_USB_VBUSChange(); - if (USB_VBUS_GetStatus()) { - EVENT_USB_VBUSConnect(); - - if (USB_DeviceState != DEVICE_STATE_Unattached) - EVENT_USB_Disconnect(); - - USB_ResetInterface(); - USB_DeviceState = DEVICE_STATE_Powered; - EVENT_USB_Connect(); + EVENT_USB_Device_Connect(); } else { - USB_DeviceState = DEVICE_STATE_Unattached; - EVENT_USB_Disconnect(); - - USB_Detach(); - USB_CLK_Freeze(); - - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - USB_PLL_Off(); - - USB_REG_Off(); - - EVENT_USB_VBUSDisconnect(); - - USB_INT_Clear(USB_INT_VBUS); + USB_DeviceState = DEVICE_STATE_Unattached; + EVENT_USB_Device_Disconnect(); } } #endif @@ -120,10 +99,10 @@ ISR(USB_GEN_vect, ISR_BLOCK) #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) USB_DeviceState = DEVICE_STATE_Unattached; - EVENT_USB_Disconnect(); + EVENT_USB_Device_Disconnect(); #else USB_DeviceState = DEVICE_STATE_Suspended; - EVENT_USB_Suspend(); + EVENT_USB_Device_Suspend(); #endif } @@ -143,11 +122,11 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Enable(USB_INT_SUSPEND); #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) - USB_DeviceState = DEVICE_STATE_Powered; - EVENT_USB_Connect(); + USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; + EVENT_USB_Device_Connect(); #else USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Addressed; - EVENT_USB_WakeUp(); + EVENT_USB_Device_WakeUp(); #endif } @@ -172,7 +151,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Enable(USB_INT_ENDPOINT_SETUP); #endif - EVENT_USB_Reset(); + EVENT_USB_Device_Reset(); } #endif @@ -183,8 +162,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Clear(USB_INT_DCONNI); USB_INT_Disable(USB_INT_DDISCI); - EVENT_USB_DeviceUnattached(); - EVENT_USB_Disconnect(); + EVENT_USB_Host_DeviceUnattached(); USB_ResetInterface(); } @@ -196,8 +174,8 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_Host_VBUS_Manual_Off(); USB_Host_VBUS_Auto_Off(); - EVENT_USB_HostError(HOST_ERROR_VBusVoltageDip); - EVENT_USB_DeviceUnattached(); + EVENT_USB_Host_HostError(HOST_ERROR_VBusVoltageDip); + EVENT_USB_Host_DeviceUnattached(); USB_HostState = HOST_STATE_Unattached; } @@ -207,7 +185,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Clear(USB_INT_SRPI); USB_INT_Disable(USB_INT_SRPI); - EVENT_USB_DeviceAttached(); + EVENT_USB_Host_DeviceAttached(); USB_INT_Enable(USB_INT_DDISCI); @@ -218,11 +196,8 @@ ISR(USB_GEN_vect, ISR_BLOCK) { USB_INT_Clear(USB_INT_BCERRI); - EVENT_USB_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0); - EVENT_USB_DeviceUnattached(); - - if (USB_HostState != HOST_STATE_Unattached) - EVENT_USB_Disconnect(); + EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0); + EVENT_USB_Host_DeviceUnattached(); USB_ResetInterface(); } @@ -237,15 +212,11 @@ ISR(USB_GEN_vect, ISR_BLOCK) EVENT_USB_Disconnect(); if (USB_HostState != HOST_STATE_Unattached) - { - EVENT_USB_Disconnect(); - EVENT_USB_DeviceUnattached(); - } - - EVENT_USB_Disconnect(); - - EVENT_USB_UIDChange(); + EVENT_USB_Host_DeviceUnattached(); + USB_CurrentMode = USB_GetUSBModeFromUID(); + EVENT_USB_UIDChange(); + USB_ResetInterface(); } #endif diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.c b/LUFA/Drivers/USB/HighLevel/USBTask.c index c02a38bf6c42724c37f36297047e2bc47e2a1ca2..f1277b9a7a19a6c6dd13bc637285383cba1fa953 100644 --- a/LUFA/Drivers/USB/HighLevel/USBTask.c +++ b/LUFA/Drivers/USB/HighLevel/USBTask.c @@ -68,7 +68,7 @@ static void USB_DeviceTask(void) Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); if (Endpoint_IsSETUPReceived()) - USB_Device_ProcessControlPacket(); + USB_Device_ProcessControlRequest(); Endpoint_SelectEndpoint(PrevEndpoint); } diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h index 9138e687f36cc8f28e5776d78f6c425af5b29c04..08accc1ef38d854dd985871ac42d2f9dd0c5ed32 100644 --- a/LUFA/Drivers/USB/HighLevel/USBTask.h +++ b/LUFA/Drivers/USB/HighLevel/USBTask.h @@ -65,7 +65,7 @@ extern volatile bool USB_IsInitialized; /** Structure containing the last received Control request when in Device mode (for use in user-applications - * inside of the \ref EVENT_USB_UnhandledControlPacket() event, or for filling up with a control request to issue when + * inside of the \ref EVENT_USB_Device_UnhandledControlRequest() event, or for filling up with a control request to issue when * in Host mode before calling \ref USB_Host_SendControlRequest(). * * \ingroup Group_USBManagement @@ -108,7 +108,7 @@ * * This value should not be altered by the user application as it is handled automatically by the * library. The only exception to this rule is if the NO_LIMITED_CONTROLLER_CONNECT token is used - * (see \ref EVENT_USB_Connect() and \ref EVENT_USB_Disconnect() events). + * (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events). * * To reduce program size and speed up checks of this global, it can be placed into one of the AVR's * GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value @@ -142,12 +142,12 @@ * The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode. * The task may be serviced at all times, or (for minimum CPU consumption): * - * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Connect() event - * and disabled again on the firing of the \ref EVENT_USB_Disconnect() event. + * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect() + * event and disabled again on the firing of the \ref EVENT_USB_Device_Disconnect() event. * - * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_DeviceAttached() - * event and disabled again on the firing of the \ref EVENT_USB_DeviceEnumerationComplete() or - * \ref EVENT_USB_DeviceEnumerationFailed() events. + * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Host_DeviceAttached() + * event and disabled again on the firing of the \ref EVENT_USB_Host_DeviceEnumerationComplete() or + * \ref EVENT_USB_Host_DeviceEnumerationFailed() events. * * If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library * by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch. diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c index f9c52e666a7c3f688dbcc61a60f9a123c9046e3a..033db094eaeced6da3dfdbf10e9e923f530ef3bc 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c @@ -39,7 +39,7 @@ uint8_t USB_ConfigurationNumber; bool USB_RemoteWakeupEnabled; bool USB_CurrentlySelfPowered; -void USB_Device_ProcessControlPacket(void) +void USB_Device_ProcessControlRequest(void) { bool RequestHandled = false; uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest; @@ -106,7 +106,7 @@ void USB_Device_ProcessControlPacket(void) } if (!(RequestHandled)) - EVENT_USB_UnhandledControlPacket(); + EVENT_USB_Device_UnhandledControlRequest(); if (Endpoint_IsSETUPReceived()) { @@ -139,8 +139,6 @@ static void USB_Device_SetAddress(void) static void USB_Device_SetConfiguration(void) { - bool AlreadyConfigured = (USB_ConfigurationNumber != 0); - #if defined(FIXED_NUM_CONFIGURATIONS) if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS) return; @@ -195,18 +193,11 @@ static void USB_Device_SetConfiguration(void) Endpoint_ClearIN(); if (USB_ConfigurationNumber) - { - USB_DeviceState = DEVICE_STATE_Configured; - - if (!(AlreadyConfigured)) - EVENT_USB_DeviceEnumerationComplete(); - } + USB_DeviceState = DEVICE_STATE_Configured; else - { - USB_DeviceState = DEVICE_STATE_Addressed; - } + USB_DeviceState = DEVICE_STATE_Addressed; - EVENT_USB_ConfigurationChanged(); + EVENT_USB_Device_ConfigurationChanged(); } void USB_Device_GetConfiguration(void) diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.h b/LUFA/Drivers/USB/LowLevel/DevChapter9.h index a70dd066e356e252366e007c435eebcd8bedf853..e6baca2be0b18290c1f1138b1732c7fc286c4f77 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.h +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.h @@ -113,7 +113,7 @@ #endif /* Function Prototypes: */ - void USB_Device_ProcessControlPacket(void); + void USB_Device_ProcessControlRequest(void); #if defined(INCLUDE_FROM_DEVCHAPTER9_C) static void USB_Device_SetAddress(void); diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c index 3d99b25947e893e5342247702bee277feb7e38eb..8a51ae5bfc77821b852517b0681ba251212ca1ce 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.c +++ b/LUFA/Drivers/USB/LowLevel/Host.c @@ -92,8 +92,6 @@ void USB_Host_ProcessNextHostState(void) USB_INT_Clear(USB_INT_VBERRI); USB_INT_Enable(USB_INT_VBERRI); - - EVENT_USB_Connect(); USB_Host_ResumeBus(); Pipe_ClearPipes(); @@ -185,19 +183,18 @@ void USB_Host_ProcessNextHostState(void) case HOST_STATE_Default_PostAddressSet: USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS); - EVENT_USB_DeviceEnumerationComplete(); + EVENT_USB_Host_DeviceEnumerationComplete(); USB_HostState = HOST_STATE_Addressed; break; } if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached)) { - EVENT_USB_DeviceEnumerationFailed(ErrorCode, SubErrorCode); + EVENT_USB_Host_DeviceEnumerationFailed(ErrorCode, SubErrorCode); USB_Host_VBUS_Auto_Off(); - EVENT_USB_DeviceUnattached(); - EVENT_USB_Disconnect(); + EVENT_USB_Host_DeviceUnattached(); USB_ResetInterface(); } diff --git a/LUFA/Drivers/USB/LowLevel/Host.h b/LUFA/Drivers/USB/LowLevel/Host.h index a602cee77100b50c92cd5b8b4a04312615903f97..50912ad7dc77e1a86bb5b271394523407eeba228 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.h +++ b/LUFA/Drivers/USB/LowLevel/Host.h @@ -312,7 +312,7 @@ */ }; - /** Enum for the error codes for the \ref EVENT_USB_HostError() event. + /** Enum for the error codes for the \ref EVENT_USB_Host_HostError() event. * * \see \ref Group_Events for more information on this event. */ @@ -326,14 +326,14 @@ */ }; - /** Enum for the error codes for the \ref EVENT_USB_DeviceEnumerationFailed() event. + /** Enum for the error codes for the \ref EVENT_USB_Host_DeviceEnumerationFailed() event. * * \see \ref Group_Events for more information on this event. */ enum USB_Host_EnumerationErrorCodes_t { HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid - * ErrorCode parameter value for the \ref EVENT_USB_DeviceEnumerationFailed() + * ErrorCode parameter value for the \ref EVENT_USB_Host_DeviceEnumerationFailed() * event. */ HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index 3ad1e983097ff10f59ffe6c18e7dd6c959d2891b..e6791098a10c8c782965bb754c0e3018a98ef3f2 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -108,16 +108,6 @@ void USB_Init( void USB_ShutDown(void) { - #if defined(USB_CAN_BE_DEVICE) - if (USB_DeviceState != DEVICE_STATE_Unattached) - EVENT_USB_Disconnect(); - #endif - - #if defined(USB_CAN_BE_HOST) - if (USB_HostState != HOST_STATE_Unattached) - EVENT_USB_Disconnect(); - #endif - USB_ResetInterface(); USB_Detach(); USB_Controller_Disable(); @@ -191,8 +181,6 @@ void USB_ResetInterface(void) USB_Device_SetLowSpeed(); else USB_Device_SetFullSpeed(); - - USB_INT_Enable(USB_INT_VBUS); } #endif @@ -204,11 +192,11 @@ void USB_ResetInterface(void) if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) { #if defined(USE_RAM_DESCRIPTORS) - USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; + USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; #elif defined(USE_EEPROM_DESCRIPTORS) - USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); #else - USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); #endif } } @@ -216,13 +204,19 @@ void USB_ResetInterface(void) USB_Attach(); - #if defined(USB_DEVICE_ONLY) + #if defined(USB_DEVICE_ONLY) + USB_INT_Clear(USB_INT_SUSPEND); USB_INT_Enable(USB_INT_SUSPEND); + USB_INT_Clear(USB_INT_EORSTI); USB_INT_Enable(USB_INT_EORSTI); - #if defined(CONTROL_ONLY_DEVICE) - UENUM = ENDPOINT_CONTROLEP; - #endif - + + #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + USB_INT_Enable(USB_INT_VBUS); + #endif + + #if defined(CONTROL_ONLY_DEVICE) + UENUM = ENDPOINT_CONTROLEP; + #endif #elif defined(USB_HOST_ONLY) USB_Host_HostMode_On(); @@ -237,9 +231,15 @@ void USB_ResetInterface(void) #else if (USB_CurrentMode == USB_MODE_DEVICE) { + USB_INT_Clear(USB_INT_SUSPEND); USB_INT_Enable(USB_INT_SUSPEND); + USB_INT_Clear(USB_INT_EORSTI); USB_INT_Enable(USB_INT_EORSTI); + #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + USB_INT_Enable(USB_INT_VBUS); + #endif + #if defined(CONTROL_ONLY_DEVICE) UENUM = ENDPOINT_CONTROLEP; #endif diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/LowLevel.h index 1ca54ed9d431e86ce31baf42ce8b394500f0ca65..b8f7b9de121c331f0fdc72dca5c8e6d9ab3b21d6 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.h +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.h @@ -191,7 +191,7 @@ #endif /** Detaches the device from the USB bus. This has the effect of removing the device from any - * host if, ceasing USB communications. If no host is present, this prevents any host from + * attached host, ceasing USB communications. If no host is present, this prevents any host from * enumerating the device once attached until \ref USB_Attach() is called. */ #define USB_Detach() MACROS{ UDCON |= (1 << DETACH); }MACROE @@ -342,7 +342,7 @@ #define USB_Controller_Enable() MACROS{ USBCON |= (1 << USBE); }MACROE #define USB_Controller_Disable() MACROS{ USBCON &= ~(1 << USBE); }MACROE - #define USB_Controller_Reset() MACROS{ uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \ + #define USB_Controller_Reset() MACROS{ const uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \ USBCON = (Temp | (1 << USBE)); }MACROE /* Inline Functions: */ diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index c674a5595fece2a2239ac4391cc67192cf8224ab..ec310a21e9eef394ca66db956fffe55c84225949 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -60,6 +60,8 @@ * - AudioOutput demos now always output to board LEDs, regardless of output mode (removed AUDIO_OUT_LEDS project option) * - Removed SINGLE_DEVICE_CONFIGURATION compile time option in favour of the new FIXED_NUM_CONFIGURATIONS option so that the exact number * of device configurations can be defined statically + * - Removed VBUS events, as they are already exposed to the user application via the regular device connection and disconnection events + * - Renamed and altered existing events to properly seperate out Host and Device mode events * * <b>Fixed:</b> * - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed to fix diff --git a/LUFA/ManPages/CompileTimeTokens.txt b/LUFA/ManPages/CompileTimeTokens.txt index f3cb27b0a1d855490d926801bf611bb061207474..387af21df155cb3766779d761a3b6e3c94425df4 100644 --- a/LUFA/ManPages/CompileTimeTokens.txt +++ b/LUFA/ManPages/CompileTimeTokens.txt @@ -172,8 +172,8 @@ * VBUS events, the library attempts to determine the connection state via the bus suspension and wake up events instead. This however may be * slightly inaccurate due to the possibility of the host suspending the bus while the device is still connected. If accurate connection status is * required, the VBUS line of the USB connector should be routed to an AVR pin to detect its level, so that the USB_DeviceState global - * can be accurately set and the USB_Connect and USB_Disconnect events manually raised by the RAISE_EVENT macro. When defined, this token disables - * the library's auto-detection of the connection state by the aforementioned suspension and wake up events. + * can be accurately set and the \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events manually raised by the RAISE_EVENT macro. + * When defined, this token disables the library's auto-detection of the connection state by the aforementioned suspension and wake up events. * * <b>INTERRUPT_CONTROL_ENDPOINT</b> - ( \ref Group_USBManagement ) \n * Some applications prefer to not call the USB_USBTask() management task reguarly while in device mode, as it can complicate code significantly. diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt index 4efc1831b4de6165d1dea24ce3d6b1604c909f49..6335324c9a516ab961c9d1dc04dffcb15ed42a5e 100644 --- a/LUFA/ManPages/MigrationInformation.txt +++ b/LUFA/ManPages/MigrationInformation.txt @@ -39,6 +39,8 @@ * state. * - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_HostState explicitly to ensure the host is * in the desired state instead. + * - The USB event names have been changed and their firing conditions changed to properly seperate out Host mode events from Device mode + * events. See the \ref Group_Events page for details on the new event names and firing conditions. * * <b>Device Mode</b> * - The \ref CALLBACK_USB_GetDescriptor() function now takes an extra parameter to specify the descriptor's memory space so that @@ -47,7 +49,9 @@ * - The USB_IsSuspended global has been removed - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead. * - The USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_DeviceState explicitly to ensure the device * is in the desired state instead. - * + * - The VBUS events have been removed, as they are already exposed to the user via the USB_Connect and USB_Disconnect events. + * - The USB event names have been changed and their firing conditions changed to properly seperate out Host mode events from Device mode + * events. See the \ref Group_Events page for details on the new event names and firing conditions. * * * \section Sec_Migration090605 Migrating from 090510 to 090605 * diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c index 26c56649620bf536c42cdaf3cc99c61196364a13..d7e0413a6d1b403a7d4a377c0214e48f13ceb874 100644 --- a/Projects/Benito/Benito.c +++ b/Projects/Benito/Benito.c @@ -155,21 +155,21 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { PingPongMSRemaining = PING_PONG_LED_PULSE_MS; LEDs_SetAllLEDs(LEDMASK_TX); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { PingPongMSRemaining = 0; LEDs_TurnOffLEDs(LEDMASK_BUSY); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { PingPongMSRemaining = 0; LEDs_TurnOffLEDs(LEDMASK_BUSY); @@ -178,10 +178,10 @@ void EVENT_USB_ConfigurationChanged(void) LEDs_TurnOnLEDs(LEDMASK_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface); + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } /** Event handler for the CDC Class driver Line Encoding Changed event. diff --git a/Projects/Benito/Benito.h b/Projects/Benito/Benito.h index 740319f64eaa724a5b4348ee7c3fb81aa078d798..3b0dfcd2cbb516eba34961f3a26997f8af1e9c99 100644 --- a/Projects/Benito/Benito.h +++ b/Projects/Benito/Benito.h @@ -64,10 +64,10 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c index f0fd8a7d0e0af4f3a9d37d96309d70cebfad848e..5be34492ac95dab6177230e3a828a06cdbf88789 100644 --- a/Projects/Magstripe/Magstripe.c +++ b/Projects/Magstripe/Magstripe.c @@ -145,15 +145,15 @@ void ReadMagstripeData(void) } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); } /** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { - HID_Device_ProcessControlPacket(&Keyboard_HID_Interface); + HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); } /** Timer 0 CTC ISR, firing once each millisecond to keep track of elapsed idle time in the HID interface. */ diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h index 279e3db2eb86fabdeef04f5e235458aebd43d4ed..7cbda8302d15fbcf2f02038027d1553c2b18f32f 100644 --- a/Projects/Magstripe/Magstripe.h +++ b/Projects/Magstripe/Magstripe.h @@ -82,8 +82,8 @@ void SetupHardware(void); void ReadMagstripeData(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, void* ReportData, uint16_t* ReportSize); diff --git a/Projects/MissileLauncher/MissileLauncher.c b/Projects/MissileLauncher/MissileLauncher.c index 50a8009bbacd550efc73e48cf9a44b2aec47a630..d15613eb8f404ecb487eb664dc0f4be6c55c911a 100644 --- a/Projects/MissileLauncher/MissileLauncher.c +++ b/Projects/MissileLauncher/MissileLauncher.c @@ -186,7 +186,7 @@ void Send_Command(uint8_t* Command) /** 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. */ -void EVENT_USB_DeviceAttached(void) +void EVENT_USB_Host_DeviceAttached(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } @@ -194,7 +194,7 @@ void EVENT_USB_DeviceAttached(void) /** 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. */ -void EVENT_USB_DeviceUnattached(void) +void EVENT_USB_Host_DeviceUnattached(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } @@ -202,13 +202,13 @@ void EVENT_USB_DeviceUnattached(void) /** 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. */ -void EVENT_USB_DeviceEnumerationComplete(void) +void EVENT_USB_Host_DeviceEnumerationComplete(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); } /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ -void EVENT_USB_HostError(const uint8_t ErrorCode) +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); @@ -219,7 +219,7 @@ void EVENT_USB_HostError(const uint8_t ErrorCode) /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ -void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } diff --git a/Projects/MissileLauncher/MissileLauncher.h b/Projects/MissileLauncher/MissileLauncher.h index 3730b2c8711f458a38e7b819a7c14671cce3d6da..86fbe86020c936038dbe36ac97183ddcccb5bb3c 100644 --- a/Projects/MissileLauncher/MissileLauncher.h +++ b/Projects/MissileLauncher/MissileLauncher.h @@ -87,11 +87,11 @@ void HID_Host_Task(void); - 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 EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode); + void EVENT_USB_Host_DeviceEnumerationComplete(void); void DiscardNextReport(void); void WriteNextReport(uint8_t* ReportOUTData, uint16_t ReportLength);