From c5038f1bf44aea75f1ae1ed035cb7d523ccfdacb Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 5 Aug 2009 06:36:31 +0000 Subject: [PATCH] Renamed all library events to properly seperate out Device and Host mode events. Changed the firing conditions for some events to ensure that events are fired by their own USB mode only. Remove VBUS events - not needed as the library takes care of VBUS detection and feedback on supported AVRs via the USB_Device_Connected and USB_Device_Disconnected events. Fixed incorrect Host state assignment in the incomplete BluetoothHost demo. --- Bootloaders/CDC/BootloaderCDC.c | 8 +- Bootloaders/CDC/BootloaderCDC.h | 6 +- Bootloaders/DFU/BootloaderDFU.c | 6 +- Bootloaders/DFU/BootloaderDFU.h | 4 +- Bootloaders/TeensyHID/TeensyHID.c | 6 +- Bootloaders/TeensyHID/TeensyHID.h | 4 +- Bootloaders/TeensyHID/TeensyHID.txt | 2 +- .../ClassDriver/AudioInput/AudioInput.c | 12 +- .../ClassDriver/AudioInput/AudioInput.h | 8 +- .../ClassDriver/AudioOutput/AudioOutput.c | 12 +- .../ClassDriver/AudioOutput/AudioOutput.h | 8 +- Demos/Device/ClassDriver/CDC/CDC.c | 12 +- Demos/Device/ClassDriver/CDC/CDC.h | 8 +- Demos/Device/ClassDriver/DualCDC/DualCDC.c | 14 +- Demos/Device/ClassDriver/DualCDC/DualCDC.h | 8 +- .../ClassDriver/GenericHID/GenericHID.c | 12 +- .../ClassDriver/GenericHID/GenericHID.h | 8 +- Demos/Device/ClassDriver/Joystick/Joystick.c | 12 +- Demos/Device/ClassDriver/Joystick/Joystick.h | 8 +- Demos/Device/ClassDriver/Keyboard/Keyboard.c | 12 +- Demos/Device/ClassDriver/Keyboard/Keyboard.h | 8 +- .../ClassDriver/KeyboardMouse/KeyboardMouse.c | 14 +- .../ClassDriver/KeyboardMouse/KeyboardMouse.h | 8 +- Demos/Device/ClassDriver/MIDI/MIDI.c | 12 +- Demos/Device/ClassDriver/MIDI/MIDI.h | 8 +- .../ClassDriver/MassStorage/MassStorage.c | 12 +- .../ClassDriver/MassStorage/MassStorage.h | 8 +- Demos/Device/ClassDriver/Mouse/Mouse.c | 16 +- Demos/Device/ClassDriver/Mouse/Mouse.h | 8 +- .../ClassDriver/RNDISEthernet/RNDISEthernet.c | 12 +- .../ClassDriver/RNDISEthernet/RNDISEthernet.h | 8 +- .../ClassDriver/USBtoSerial/USBtoSerial.c | 12 +- .../ClassDriver/USBtoSerial/USBtoSerial.h | 8 +- Demos/Device/Incomplete/Sideshow/Sideshow.c | 8 +- Demos/Device/Incomplete/Sideshow/Sideshow.h | 8 +- Demos/Device/LowLevel/AudioInput/AudioInput.c | 10 +- Demos/Device/LowLevel/AudioInput/AudioInput.h | 8 +- .../Device/LowLevel/AudioOutput/AudioOutput.c | 10 +- .../Device/LowLevel/AudioOutput/AudioOutput.h | 8 +- Demos/Device/LowLevel/CDC/CDC.c | 13 +- Demos/Device/LowLevel/CDC/CDC.h | 8 +- Demos/Device/LowLevel/DualCDC/DualCDC.c | 14 +- Demos/Device/LowLevel/DualCDC/DualCDC.h | 8 +- Demos/Device/LowLevel/GenericHID/GenericHID.c | 10 +- Demos/Device/LowLevel/GenericHID/GenericHID.h | 8 +- Demos/Device/LowLevel/Joystick/Joystick.c | 10 +- Demos/Device/LowLevel/Joystick/Joystick.h | 8 +- Demos/Device/LowLevel/Keyboard/Keyboard.c | 10 +- Demos/Device/LowLevel/Keyboard/Keyboard.h | 8 +- .../LowLevel/KeyboardMouse/KeyboardMouse.c | 8 +- .../LowLevel/KeyboardMouse/KeyboardMouse.h | 8 +- Demos/Device/LowLevel/MIDI/MIDI.c | 6 +- Demos/Device/LowLevel/MIDI/MIDI.h | 6 +- .../Device/LowLevel/MassStorage/MassStorage.c | 8 +- .../Device/LowLevel/MassStorage/MassStorage.h | 8 +- Demos/Device/LowLevel/Mouse/Mouse.c | 10 +- Demos/Device/LowLevel/Mouse/Mouse.h | 8 +- .../LowLevel/RNDISEthernet/RNDISEthernet.c | 10 +- .../LowLevel/RNDISEthernet/RNDISEthernet.h | 8 +- .../Device/LowLevel/USBtoSerial/USBtoSerial.c | 13 +- .../Device/LowLevel/USBtoSerial/USBtoSerial.h | 8 +- Demos/Host/ClassDriver/CDCHost/CDCHost.c | 10 +- Demos/Host/ClassDriver/CDCHost/CDCHost.h | 10 +- Demos/Host/ClassDriver/MouseHost/MouseHost.c | 10 +- Demos/Host/ClassDriver/MouseHost/MouseHost.h | 10 +- .../Incomplete/BluetoothHost/BluetoothHost.c | 15 +- .../Incomplete/BluetoothHost/BluetoothHost.h | 10 +- .../BluetoothHost/Lib/BluetoothHCICommands.c | 2 +- Demos/Host/LowLevel/CDCHost/CDCHost.c | 10 +- Demos/Host/LowLevel/CDCHost/CDCHost.h | 10 +- .../LowLevel/GenericHIDHost/GenericHIDHost.c | 10 +- .../LowLevel/GenericHIDHost/GenericHIDHost.h | 10 +- .../Host/LowLevel/KeyboardHost/KeyboardHost.c | 10 +- .../Host/LowLevel/KeyboardHost/KeyboardHost.h | 10 +- .../KeyboardHostWithParser.c | 10 +- .../KeyboardHostWithParser.h | 10 +- .../MassStorageHost/MassStorageHost.c | 8 +- .../MassStorageHost/MassStorageHost.h | 10 +- Demos/Host/LowLevel/MouseHost/MouseHost.c | 10 +- Demos/Host/LowLevel/MouseHost/MouseHost.h | 10 +- .../MouseHostWithParser/MouseHostWithParser.c | 10 +- .../MouseHostWithParser/MouseHostWithParser.h | 10 +- Demos/Host/LowLevel/PrinterHost/PrinterHost.c | 10 +- Demos/Host/LowLevel/PrinterHost/PrinterHost.h | 10 +- .../LowLevel/StillImageHost/StillImageHost.c | 10 +- .../LowLevel/StillImageHost/StillImageHost.h | 10 +- Demos/OTG/TestApp/TestEvents.c | 144 +++++++--------- Demos/OTG/TestApp/TestEvents.h | 27 ++- LUFA/Drivers/USB/Class/Device/Audio.c | 2 +- LUFA/Drivers/USB/Class/Device/Audio.h | 6 +- LUFA/Drivers/USB/Class/Device/CDC.c | 2 +- LUFA/Drivers/USB/Class/Device/CDC.h | 8 +- LUFA/Drivers/USB/Class/Device/HID.c | 2 +- LUFA/Drivers/USB/Class/Device/HID.h | 6 +- LUFA/Drivers/USB/Class/Device/MIDI.c | 2 +- LUFA/Drivers/USB/Class/Device/MIDI.h | 6 +- LUFA/Drivers/USB/Class/Device/MassStorage.c | 2 +- LUFA/Drivers/USB/Class/Device/MassStorage.h | 6 +- LUFA/Drivers/USB/Class/Device/RNDIS.c | 2 +- LUFA/Drivers/USB/Class/Device/RNDIS.h | 6 +- LUFA/Drivers/USB/HighLevel/Events.h | 158 +++++++----------- LUFA/Drivers/USB/HighLevel/StdRequestType.h | 20 +-- LUFA/Drivers/USB/HighLevel/USBInterrupt.c | 67 +++----- LUFA/Drivers/USB/HighLevel/USBTask.c | 2 +- LUFA/Drivers/USB/HighLevel/USBTask.h | 14 +- LUFA/Drivers/USB/LowLevel/DevChapter9.c | 19 +-- LUFA/Drivers/USB/LowLevel/DevChapter9.h | 2 +- LUFA/Drivers/USB/LowLevel/Host.c | 9 +- LUFA/Drivers/USB/LowLevel/Host.h | 6 +- LUFA/Drivers/USB/LowLevel/LowLevel.c | 40 ++--- LUFA/Drivers/USB/LowLevel/LowLevel.h | 4 +- LUFA/ManPages/ChangeLog.txt | 2 + LUFA/ManPages/CompileTimeTokens.txt | 4 +- LUFA/ManPages/MigrationInformation.txt | 6 +- Projects/Benito/Benito.c | 12 +- Projects/Benito/Benito.h | 8 +- Projects/Magstripe/Magstripe.c | 6 +- Projects/Magstripe/Magstripe.h | 4 +- Projects/MissileLauncher/MissileLauncher.c | 10 +- Projects/MissileLauncher/MissileLauncher.h | 10 +- 120 files changed, 665 insertions(+), 758 deletions(-) diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index cbcfd7e6c7..6769a0c2d6 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 fa98a15b38..13a4f9f5ef 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 f9c8195f37..fb326a1d98 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 9366c22845..11d91db796 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 52526689a0..bb5a0c7083 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 3c59605954..a05729a50a 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 93862c6746..4cf13082b9 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 59d2129f44..3aa26ae856 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 f26267339c..03e2a6da3b 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 9a8804a45e..d7de7d5b01 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 9846a76341..d31a8e6b65 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 8e3530ca22..4f64646ea0 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 255cd86119..ee375a4665 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 82ed59d515..e5406a4bae 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 0f1a76498d..2f12aca88e 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 323d69336d..13db6bf74e 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 50a92ec1ee..8cf0afc5df 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 f4dc32d9b7..ea85aaddee 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 764de1723d..493dfa072c 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 040aec453e..6f0bd1d1a8 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 4a28d20ff2..0f7176ce01 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 abaf3808b1..e21999049c 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 15532c8169..297564157e 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 fcb86d661e..f1a0d9afcd 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 bc9038207b..7c1484d4b0 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 6a4612e4cd..52ed2d9383 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 71497780e8..e6b2bf99f4 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 08e87e672d..d26101381b 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 57e4a693dd..709077fab8 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 81d31c9cd5..905f4efd0a 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 c5503e286e..b91a54d21a 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 e51963c7a4..b78a6d3317 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 3ee7e89edf..4ceb931a3d 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 d67fae03fb..fdf4265e64 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 c8d3b53111..f2890ef21c 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 bf790169dd..a01c6729cc 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 591d3f355d..f74491dac5 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 7dde84bb33..1128e8f4e5 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 6c8d733f31..362a5540a1 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 4b5409f5c4..9ee744ea04 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 a8f7199abe..4a7b6b1586 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 654ce863e9..c49a1ad85b 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 d6f09e6434..b2085c452b 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 34c991f12f..5a8bb51875 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 fbd0a7f8d0..c036517739 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 db2415e4bc..306baa9e02 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 c50d7f01b5..db280ee5c8 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 e27b22827f..f8310abb48 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 2a2ebdc49b..bc478f3172 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 7d486e16e3..bfd337a2ae 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 138f0fc1da..37cb7f6514 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 8aed527dbe..4dfb9b7e68 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 3b9b938a5d..3e7a06d6d0 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 01d27f043a..1a2d8d468a 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 81fba00002..868daf09a6 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 d15f688d64..48f04612bf 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 8ff8b8fc34..b244ffa581 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 ca38c24d60..b722187c6c 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 5cbddee523..3ae896607b 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 2765064f78..bb1b4da2d3 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 51c47c9432..d9567a154b 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 6678b22766..92a558ca2b 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 c219a193bd..87a0bbcac2 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 ec43163865..76a1238cad 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 02878257d3..9f92be0865 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 a52ba7cb67..25c15a9220 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 d44a38a2af..0246bff826 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 54291bf752..3b8bcde892 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 e20fa2cfcc..a423b90eb8 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 9e1d638640..95faa7d532 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 d360643332..33397b6430 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 415dae0231..4a64b57915 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 1a53526bab..f40e7b9a00 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 98a9e37a7f..aed6ca6290 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 2cc08a13dd..ef73b77b00 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 90db94a2aa..8453bb6612 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 6cfe669f6b..60eb98a047 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 1307a1af2a..c071099193 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 b98f4bf968..44147481be 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 1abd560687..4a3838289e 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 8ea5e7201d..b5b41ce670 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 71d11a1eed..c5bfce52f4 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 bbda0c24b5..bd84f19ebd 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 f6afcc796c..db7a9fe7e2 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 ca0771a94b..6c56d5f3e8 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 1896b8fe5a..89956e0f5d 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 d0bc805dba..aee2b16ae3 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 b82936fb47..ee00dd728e 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 210a3c8001..c4fbc3d9c9 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 2c91dae7c5..b1c5046c6c 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 9ed20e4846..9da0ed1ebf 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 2a8f1ecd8f..7332f56cc6 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 40f7d2f498..937214b946 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 b8ca47980a..0c141e62c9 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 ed3aaa7231..a74e7a6192 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 980ddc5bf2..c7e46ba97f 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 6160641bf0..04c63fca73 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 cd7a8ef1d7..b207c237e2 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 8131d87576..13d82a5bf4 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 8855aac175..d9a5d7f0be 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 4042d46703..1e638314cf 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 b9ae04598b..c5be544b97 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 51a761ae7f..56e54f25ac 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 c02a38bf6c..f1277b9a7a 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 9138e687f3..08accc1ef3 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 f9c52e666a..033db094ea 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 a70dd066e3..e6baca2be0 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 3d99b25947..8a51ae5bfc 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 a602cee771..50912ad7dc 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 3ad1e98309..e6791098a1 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 1ca54ed9d4..b8f7b9de12 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 c674a5595f..ec310a21e9 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 * * Fixed: * - 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 f3cb27b0a1..387af21df1 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. * * INTERRUPT_CONTROL_ENDPOINT - ( \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 4efc1831b4..6335324c9a 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. * * Device Mode * - 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 26c5664962..d7e0413a6d 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 740319f64e..3b0dfcd2cb 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 f0fd8a7d0e..5be34492ac 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 279e3db2eb..7cbda8302d 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 50a8009bba..d15613eb8f 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 3730b2c871..86fbe86020 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);