From e6881fd166586793a5a90effeefe4188092f383b Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 8 Jun 2009 07:46:07 +0000 Subject: [PATCH] Error status LEDs shown when device endpoint configuration fails to complete. MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready. --- Demos/Device/LowLevel/AudioInput/AudioInput.c | 13 ++-- .../Device/LowLevel/AudioOutput/AudioOutput.c | 13 ++-- Demos/Device/LowLevel/CDC/CDC.c | 35 +++++---- Demos/Device/LowLevel/DualCDC/DualCDC.c | 72 ++++++++++++------- Demos/Device/LowLevel/GenericHID/GenericHID.c | 26 ++++--- Demos/Device/LowLevel/Joystick/Joystick.c | 13 ++-- Demos/Device/LowLevel/Keyboard/Keyboard.c | 28 +++++--- .../LowLevel/KeyboardMouse/KeyboardMouse.c | 35 +++++---- Demos/Device/LowLevel/MIDI/MIDI.c | 29 +++++--- .../Device/LowLevel/MassStorage/MassStorage.c | 22 +++--- Demos/Device/LowLevel/Mouse/Mouse.c | 13 ++-- .../LowLevel/RNDISEthernet/RNDISEthernet.c | 33 +++++---- .../Device/LowLevel/USBtoSerial/USBtoSerial.c | 35 +++++---- LUFA/ChangeLog.txt | 3 +- 14 files changed, 231 insertions(+), 139 deletions(-) diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index 7757ef10c6..50e7f4df45 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -109,13 +109,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup audio stream endpoint */ - Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, - ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE, - ENDPOINT_BANK_DOUBLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup audio stream endpoint */ + if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, + ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE, + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c index 7a9c6eca04..07418d5d90 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c @@ -136,13 +136,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup audio stream endpoint */ - Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, - ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE, - ENDPOINT_BANK_DOUBLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup audio stream endpoint */ + if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, + ENDPOINT_DIR_OUT, AUDIO_STREAM_EPSIZE, + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/CDC/CDC.c b/Demos/Device/LowLevel/CDC/CDC.c index 3db4c1e55c..99343894e6 100644 --- a/Demos/Device/LowLevel/CDC/CDC.c +++ b/Demos/Device/LowLevel/CDC/CDC.c @@ -105,21 +105,30 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup CDC Notification, Rx and Tx Endpoints */ - Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup CDC Notification, Rx and Tx Endpoints */ + if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/DualCDC/DualCDC.c b/Demos/Device/LowLevel/DualCDC/DualCDC.c index 839d6d98ed..1031068ad0 100644 --- a/Demos/Device/LowLevel/DualCDC/DualCDC.c +++ b/Demos/Device/LowLevel/DualCDC/DualCDC.c @@ -116,35 +116,53 @@ void EVENT_USB_Disconnect(void) * of the USB device after enumeration - the device endpoints are configured and the CDC management tasks are started. */ void EVENT_USB_ConfigurationChanged(void) -{ - /* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */ - Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */ - Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - +{ /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup CDC Notification, Rx and Tx Endpoints for the first CDC */ + if (!(Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + /* Setup CDC Notification, Rx and Tx Endpoints for the second CDC */ + if (!(Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c index a604bbe8d3..40de8b94ae 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.c +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c @@ -94,18 +94,24 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Generic IN Report Endpoint */ - Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, GENERIC_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Setup Generic OUT Report Endpoint */ - Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_OUT, GENERIC_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Generic IN Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(GENERIC_IN_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, GENERIC_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + /* Setup Generic OUT Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(GENERIC_OUT_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_OUT, GENERIC_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/Joystick/Joystick.c b/Demos/Device/LowLevel/Joystick/Joystick.c index 94763b82ae..0c018aa8d6 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.c +++ b/Demos/Device/LowLevel/Joystick/Joystick.c @@ -92,13 +92,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Joystick Report Endpoint */ - Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, JOYSTICK_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Joystick Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(JOYSTICK_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, JOYSTICK_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c index 06806b58b9..35ef41ba8a 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.c +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c @@ -118,19 +118,25 @@ void EVENT_USB_Disconnect(void) * of the USB device after enumeration, and configures the keyboard device endpoints. */ void EVENT_USB_ConfigurationChanged(void) -{ - /* Setup Keyboard Keycode Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, KEYBOARD_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Setup Keyboard LED Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE, - ENDPOINT_BANK_SINGLE); - +{ /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Keyboard Keycode Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, KEYBOARD_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + /* Setup Keyboard LED Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_LEDS_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_OUT, KEYBOARD_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c index 9127fea9ed..ddfe05a4b4 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c @@ -100,23 +100,32 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Keyboard Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, HID_EPSIZE, - ENDPOINT_BANK_SINGLE); + /* Indicate USB connected and ready */ + LEDs_SetAllLEDs(LEDMASK_USB_READY); + /* Setup Keyboard Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, HID_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + /* Setup Keyboard LED Report Endpoint */ - Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_OUT, HID_EPSIZE, - ENDPOINT_BANK_SINGLE); + if (!(Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_OUT, HID_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } /* Setup Mouse Report Endpoint */ - Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, HID_EPSIZE, - ENDPOINT_BANK_SINGLE); - - /* Indicate USB connected and ready */ - LEDs_SetAllLEDs(LEDMASK_USB_READY); + if (!(Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, HID_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/MIDI/MIDI.c b/Demos/Device/LowLevel/MIDI/MIDI.c index 6dd38af85a..856f7dbe94 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.c +++ b/Demos/Device/LowLevel/MIDI/MIDI.c @@ -90,17 +90,23 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup MIDI stream endpoints */ - Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup MIDI stream endpoints */ + if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them @@ -159,8 +165,9 @@ void MIDI_Task(void) */ void SendMIDINoteChange(const uint8_t Pitch, const bool OnOff, const uint8_t CableID, const uint8_t Channel) { - /* Wait until endpoint ready for more data */ - while (!(Endpoint_IsReadWriteAllowed())); + /* If endpoint ready for more data, abort */ + if (!(Endpoint_IsReadWriteAllowed())) + return; /* Check if the message should be a Note On or Note Off command */ uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF); diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index 62c7f21da7..ee2a9d7928 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -106,17 +106,23 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { + /* Indicate USB connected and ready */ + LEDs_SetAllLEDs(LEDMASK_USB_READY); + /* Setup Mass Storage In and Out Endpoints */ - Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK, + if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE, - ENDPOINT_BANK_DOUBLE); - - Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK, + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE, - ENDPOINT_BANK_DOUBLE); - - /* Indicate USB connected and ready */ - LEDs_SetAllLEDs(LEDMASK_USB_READY); + ENDPOINT_BANK_DOUBLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c index 422153672e..c586b5971d 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.c +++ b/Demos/Device/LowLevel/Mouse/Mouse.c @@ -119,13 +119,16 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup Mouse Report Endpoint */ - Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, MOUSE_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup Mouse Report Endpoint */ + if (!(Endpoint_ConfigureEndpoint(MOUSE_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, MOUSE_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c index e651a1b128..84fc5b4c9d 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c @@ -99,21 +99,30 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup CDC Notification, Rx and Tx Endpoints */ - Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); + /* Indicate USB connected and ready */ + LEDs_SetAllLEDs(LEDMASK_USB_READY); - Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); + /* Setup CDC Notification, Rx and Tx Endpoints */ + if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } - Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); + if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } - /* Indicate USB connected and ready */ - LEDs_SetAllLEDs(LEDMASK_USB_READY); + if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c index ee4208f19f..3ed406db4f 100644 --- a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c @@ -113,21 +113,30 @@ void EVENT_USB_Disconnect(void) */ void EVENT_USB_ConfigurationChanged(void) { - /* Setup CDC Notification, Rx and Tx Endpoints */ - Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, - ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - - Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, - ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, - ENDPOINT_BANK_SINGLE); - /* Indicate USB connected and ready */ LEDs_SetAllLEDs(LEDMASK_USB_READY); + + /* Setup CDC Notification, Rx and Tx Endpoints */ + if (!(Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, + ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } + + if (!(Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK, + ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE, + ENDPOINT_BANK_SINGLE))) + { + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + } } /** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index f65c62aeed..7e37ac45bf 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -12,7 +12,6 @@ - Convert Host mode demos to class drivers - Convert Host mode demos to schedulerless - Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES - - Device demos error if endpoint config fail ============================ /** \page Page_ChangeLog Project Changelog @@ -23,6 +22,8 @@ * - Added new class drivers and matching demos to the library for rapid application development * - Added incomplete device and host mode demos for later enhancement * - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed + * - Error status LEDs shown when device endpoint configuration fails to complete + * - MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready * * * \section Sec_ChangeLog090605 Version 090605