From 9ef29ea2293dde7225360fe258224d22d3a68756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 6 Oct 2013 22:16:20 +0200 Subject: Extract interface numbers into enums. --- Bootloaders/CDC/Descriptors.c | 4 +-- Bootloaders/CDC/Descriptors.h | 16 +++++++-- Bootloaders/DFU/BootloaderDFU.h | 4 +-- Bootloaders/DFU/Descriptors.c | 2 +- Bootloaders/DFU/Descriptors.h | 15 +++++++-- Bootloaders/HID/Descriptors.c | 2 +- Bootloaders/HID/Descriptors.h | 11 ++++++- Bootloaders/MassStorage/BootloaderMassStorage.c | 2 +- Bootloaders/MassStorage/Descriptors.c | 2 +- Bootloaders/MassStorage/Descriptors.h | 10 ++++++ Bootloaders/Printer/BootloaderPrinter.c | 2 +- Bootloaders/Printer/Descriptors.c | 2 +- Bootloaders/Printer/Descriptors.h | 15 +++++++-- Demos/Device/ClassDriver/AudioInput/AudioInput.c | 4 +-- Demos/Device/ClassDriver/AudioInput/Descriptors.c | 6 ++-- Demos/Device/ClassDriver/AudioInput/Descriptors.h | 16 +++++++-- Demos/Device/ClassDriver/AudioOutput/AudioOutput.c | 4 +-- Demos/Device/ClassDriver/AudioOutput/Descriptors.c | 6 ++-- Demos/Device/ClassDriver/AudioOutput/Descriptors.h | 16 +++++++-- .../ClassDriver/DualVirtualSerial/Descriptors.c | 8 ++--- .../ClassDriver/DualVirtualSerial/Descriptors.h | 18 ++++++++-- .../DualVirtualSerial/DualVirtualSerial.c | 4 +-- Demos/Device/ClassDriver/GenericHID/Descriptors.c | 2 +- Demos/Device/ClassDriver/GenericHID/Descriptors.h | 17 +++++++--- Demos/Device/ClassDriver/GenericHID/GenericHID.c | 2 +- Demos/Device/ClassDriver/Joystick/Descriptors.c | 2 +- Demos/Device/ClassDriver/Joystick/Descriptors.h | 15 +++++++-- Demos/Device/ClassDriver/Joystick/Joystick.c | 2 +- Demos/Device/ClassDriver/Keyboard/Descriptors.c | 2 +- Demos/Device/ClassDriver/Keyboard/Descriptors.h | 15 +++++++-- Demos/Device/ClassDriver/Keyboard/Keyboard.c | 2 +- .../Device/ClassDriver/KeyboardMouse/Descriptors.c | 38 ++++++++++++---------- .../Device/ClassDriver/KeyboardMouse/Descriptors.h | 16 +++++++-- .../ClassDriver/KeyboardMouse/KeyboardMouse.c | 4 +-- .../KeyboardMouseMultiReport/Descriptors.c | 2 +- .../KeyboardMouseMultiReport/Descriptors.h | 15 +++++++-- .../KeyboardMouseMultiReport.c | 2 +- Demos/Device/ClassDriver/MIDI/Descriptors.c | 4 +-- Demos/Device/ClassDriver/MIDI/Descriptors.h | 16 +++++++-- Demos/Device/ClassDriver/MIDI/MIDI.c | 2 +- Demos/Device/ClassDriver/MassStorage/Descriptors.c | 2 +- Demos/Device/ClassDriver/MassStorage/Descriptors.h | 15 +++++++-- Demos/Device/ClassDriver/MassStorage/MassStorage.c | 2 +- .../ClassDriver/MassStorageKeyboard/Descriptors.c | 4 +-- .../ClassDriver/MassStorageKeyboard/Descriptors.h | 16 +++++++-- .../MassStorageKeyboard/MassStorageKeyboard.c | 4 +-- Demos/Device/ClassDriver/Mouse/Descriptors.c | 2 +- Demos/Device/ClassDriver/Mouse/Descriptors.h | 17 +++++++--- Demos/Device/ClassDriver/Mouse/Mouse.c | 2 +- .../Device/ClassDriver/RNDISEthernet/Descriptors.c | 4 +-- .../Device/ClassDriver/RNDISEthernet/Descriptors.h | 16 +++++++-- .../ClassDriver/RNDISEthernet/RNDISEthernet.c | 2 +- .../Device/ClassDriver/VirtualSerial/Descriptors.c | 4 +-- .../Device/ClassDriver/VirtualSerial/Descriptors.h | 16 +++++++-- .../ClassDriver/VirtualSerial/VirtualSerial.c | 2 +- .../VirtualSerialMassStorage/Descriptors.c | 6 ++-- .../VirtualSerialMassStorage/Descriptors.h | 17 ++++++++-- .../VirtualSerialMassStorage.c | 4 +-- .../ClassDriver/VirtualSerialMouse/Descriptors.c | 6 ++-- .../ClassDriver/VirtualSerialMouse/Descriptors.h | 17 ++++++++-- .../VirtualSerialMouse/VirtualSerialMouse.c | 4 +-- .../Incomplete/TestAndMeasurement/Descriptors.c | 2 +- .../Incomplete/TestAndMeasurement/Descriptors.h | 15 +++++++-- Demos/Device/LowLevel/AudioInput/Descriptors.c | 6 ++-- Demos/Device/LowLevel/AudioInput/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/AudioOutput/Descriptors.c | 6 ++-- Demos/Device/LowLevel/AudioOutput/Descriptors.h | 16 +++++++-- .../LowLevel/DualVirtualSerial/Descriptors.c | 8 ++--- .../LowLevel/DualVirtualSerial/Descriptors.h | 18 ++++++++-- Demos/Device/LowLevel/GenericHID/Descriptors.c | 2 +- Demos/Device/LowLevel/GenericHID/Descriptors.h | 19 ++++++++--- Demos/Device/LowLevel/Joystick/Descriptors.c | 2 +- Demos/Device/LowLevel/Joystick/Descriptors.h | 17 +++++++--- Demos/Device/LowLevel/Keyboard/Descriptors.c | 2 +- Demos/Device/LowLevel/Keyboard/Descriptors.h | 19 ++++++++--- Demos/Device/LowLevel/KeyboardMouse/Descriptors.c | 38 ++++++++++++---------- Demos/Device/LowLevel/KeyboardMouse/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/MIDI/Descriptors.c | 4 +-- Demos/Device/LowLevel/MIDI/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/MassStorage/Descriptors.c | 2 +- Demos/Device/LowLevel/MassStorage/Descriptors.h | 15 +++++++-- Demos/Device/LowLevel/Mouse/Descriptors.c | 2 +- Demos/Device/LowLevel/Mouse/Descriptors.h | 17 +++++++--- Demos/Device/LowLevel/RNDISEthernet/Descriptors.c | 4 +-- Demos/Device/LowLevel/RNDISEthernet/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/VirtualSerial/Descriptors.c | 4 +-- Demos/Device/LowLevel/VirtualSerial/Descriptors.h | 16 +++++++-- .../ClassDriver/MouseHostDevice/Descriptors.c | 2 +- .../ClassDriver/MouseHostDevice/Descriptors.h | 17 +++++++--- .../ClassDriver/MouseHostDevice/DeviceFunctions.c | 2 +- Projects/AVRISP-MKII/AVRISPDescriptors.c | 2 +- Projects/AVRISP-MKII/AVRISPDescriptors.h | 17 +++++++--- Projects/Benito/Benito.c | 2 +- Projects/Benito/Descriptors.c | 4 +-- Projects/Benito/Descriptors.h | 16 +++++++-- Projects/LEDNotifier/Descriptors.c | 4 +-- Projects/LEDNotifier/Descriptors.h | 16 +++++++-- Projects/LEDNotifier/LEDNotifier.c | 2 +- Projects/MIDIToneGenerator/Descriptors.c | 4 +-- Projects/MIDIToneGenerator/Descriptors.h | 16 +++++++-- Projects/MIDIToneGenerator/MIDIToneGenerator.c | 2 +- Projects/Magstripe/Descriptors.c | 2 +- Projects/Magstripe/Descriptors.h | 17 +++++++--- Projects/Magstripe/Magstripe.c | 2 +- Projects/MediaController/Descriptors.c | 2 +- Projects/MediaController/Descriptors.h | 17 +++++++--- Projects/MediaController/MediaController.c | 2 +- Projects/RelayBoard/Descriptors.c | 2 +- Projects/RelayBoard/Descriptors.h | 17 +++++++--- Projects/SerialToLCD/Descriptors.c | 4 +-- Projects/SerialToLCD/Descriptors.h | 16 +++++++-- Projects/SerialToLCD/SerialToLCD.c | 2 +- Projects/SerialToLCD/SerialToLCD.h | 26 +++++++-------- Projects/TempDataLogger/Descriptors.c | 4 +-- Projects/TempDataLogger/Descriptors.h | 16 +++++++-- Projects/TempDataLogger/TempDataLogger.c | 4 +-- Projects/USBtoSerial/Descriptors.c | 4 +-- Projects/USBtoSerial/Descriptors.h | 16 +++++++-- Projects/USBtoSerial/USBtoSerial.c | 2 +- Projects/Webserver/Descriptors.c | 6 ++-- Projects/Webserver/Descriptors.h | 17 ++++++++-- Projects/Webserver/USBDeviceMode.c | 4 +-- Projects/XPLAINBridge/USARTDescriptors.c | 4 +-- Projects/XPLAINBridge/USARTDescriptors.h | 18 +++++++--- Projects/XPLAINBridge/XPLAINBridge.c | 2 +- 125 files changed, 780 insertions(+), 319 deletions(-) diff --git a/Bootloaders/CDC/Descriptors.c b/Bootloaders/CDC/Descriptors.c index bbf4e7621..2b85b0126 100644 --- a/Bootloaders/CDC/Descriptors.c +++ b/Bootloaders/CDC/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -141,7 +141,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Bootloaders/CDC/Descriptors.h b/Bootloaders/CDC/Descriptors.h index 24d1a398e..f35a4d1f8 100644 --- a/Bootloaders/CDC/Descriptors.h +++ b/Bootloaders/CDC/Descriptors.h @@ -127,15 +127,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h index 3d6d90649..949f7e8a5 100644 --- a/Bootloaders/DFU/BootloaderDFU.h +++ b/Bootloaders/DFU/BootloaderDFU.h @@ -170,7 +170,7 @@ dfuMANIFEST = 7, dfuMANIFEST_WAIT_RESET = 8, dfuUPLOAD_IDLE = 9, - dfuERROR = 10 + dfuERROR = 10 }; /** DFU command status error codes. Refer to the DFU class specification for information on each error code. */ @@ -191,7 +191,7 @@ errUSBR = 12, errPOR = 13, errUNKNOWN = 14, - errSTALLEDPKT = 15 + errSTALLEDPKT = 15 }; /* Function Prototypes: */ diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c index 5901dad12..9cd74cfd2 100644 --- a/Bootloaders/DFU/Descriptors.c +++ b/Bootloaders/DFU/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_DFU, .AlternateSetting = 0, .TotalEndpoints = 0, diff --git a/Bootloaders/DFU/Descriptors.h b/Bootloaders/DFU/Descriptors.h index c33e388c0..8bd46793e 100644 --- a/Bootloaders/DFU/Descriptors.h +++ b/Bootloaders/DFU/Descriptors.h @@ -164,15 +164,24 @@ USB_Descriptor_DFU_Functional_t DFU_Functional; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_DFU = 0, /**< DFU interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Bootloaders/HID/Descriptors.c b/Bootloaders/HID/Descriptors.c index ac27b760b..6754d81d4 100644 --- a/Bootloaders/HID/Descriptors.c +++ b/Bootloaders/HID/Descriptors.c @@ -110,7 +110,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Printer, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Bootloaders/HID/Descriptors.h b/Bootloaders/HID/Descriptors.h index 4ef30ed8f..c10b51678 100644 --- a/Bootloaders/HID/Descriptors.h +++ b/Bootloaders/HID/Descriptors.h @@ -51,9 +51,18 @@ // Generic HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_VendorHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Printer = 0, /**< Printer interface descriptor ID */ + }; + /* Macros: */ /** Endpoint address of the HID data IN endpoint. */ #define HID_IN_EPADDR (ENDPOINT_DIR_IN | 1) diff --git a/Bootloaders/MassStorage/BootloaderMassStorage.c b/Bootloaders/MassStorage/BootloaderMassStorage.c index 1b6eda438..9d15a81af 100644 --- a/Bootloaders/MassStorage/BootloaderMassStorage.c +++ b/Bootloaders/MassStorage/BootloaderMassStorage.c @@ -44,7 +44,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, diff --git a/Bootloaders/MassStorage/Descriptors.c b/Bootloaders/MassStorage/Descriptors.c index 7ae0a7da9..1186ea079 100644 --- a/Bootloaders/MassStorage/Descriptors.c +++ b/Bootloaders/MassStorage/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Bootloaders/MassStorage/Descriptors.h b/Bootloaders/MassStorage/Descriptors.h index 2e97c6d8a..ea89cb27b 100644 --- a/Bootloaders/MassStorage/Descriptors.h +++ b/Bootloaders/MassStorage/Descriptors.h @@ -68,6 +68,16 @@ USB_Descriptor_Endpoint_t MS_DataOutEndpoint; } USB_Descriptor_Configuration_t; + + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */ + }; + /* Function Prototypes: */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, diff --git a/Bootloaders/Printer/BootloaderPrinter.c b/Bootloaders/Printer/BootloaderPrinter.c index 1e60cdd6d..3fec7217d 100644 --- a/Bootloaders/Printer/BootloaderPrinter.c +++ b/Bootloaders/Printer/BootloaderPrinter.c @@ -43,7 +43,7 @@ USB_ClassInfo_PRNT_Device_t TextOnly_Printer_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Printer, .DataINEndpoint = { .Address = PRINTER_IN_EPADDR, diff --git a/Bootloaders/Printer/Descriptors.c b/Bootloaders/Printer/Descriptors.c index 0fbb3ae7e..5329afc86 100644 --- a/Bootloaders/Printer/Descriptors.c +++ b/Bootloaders/Printer/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Printer, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Bootloaders/Printer/Descriptors.h b/Bootloaders/Printer/Descriptors.h index fba326a93..d5c9b71ee 100644 --- a/Bootloaders/Printer/Descriptors.h +++ b/Bootloaders/Printer/Descriptors.h @@ -66,15 +66,24 @@ USB_Descriptor_Endpoint_t Printer_DataOutEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each string descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Printer = 0, /**< Printer interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 9eec39ca2..02bd1e45a 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -44,8 +44,8 @@ USB_ClassInfo_Audio_Device_t Microphone_Audio_Interface = { .Config = { - .ControlInterfaceNumber = 0, - .StreamingInterfaceNumber = 1, + .ControlInterfaceNumber = INTERFACE_ID_AudioControl, + .StreamingInterfaceNumber = INTERFACE_ID_AudioStream, .DataINEndpoint = { .Address = AUDIO_STREAM_EPADDR, diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.c b/Demos/Device/ClassDriver/AudioInput/Descriptors.c index eb4c21c02..a48738735 100644 --- a/Demos/Device/ClassDriver/AudioInput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -150,7 +150,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -166,7 +166,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.h b/Demos/Device/ClassDriver/AudioInput/Descriptors.h index 1bb38ff65..fe099570f 100644 --- a/Demos/Device/ClassDriver/AudioInput/Descriptors.h +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ + INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 81fd95b16..432f5e0fa 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -44,8 +44,8 @@ USB_ClassInfo_Audio_Device_t Speaker_Audio_Interface = { .Config = { - .ControlInterfaceNumber = 0, - .StreamingInterfaceNumber = 1, + .ControlInterfaceNumber = INTERFACE_ID_AudioControl, + .StreamingInterfaceNumber = INTERFACE_ID_AudioStream, .DataOUTEndpoint = { .Address = AUDIO_STREAM_EPADDR, diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c index 4ced7a0eb..aec2c5f51 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -150,7 +150,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -166,7 +166,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h index 80f142683..cb67f02ec 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h +++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ + INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c index d0992de4b..245231852 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC1_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -156,7 +156,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC1_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -206,7 +206,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_CDC2_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -257,7 +257,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 3, + .InterfaceNumber = INTERFACE_ID_CDC2_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h index 1105ab7b3..98170269a 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h +++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h @@ -102,15 +102,27 @@ USB_Descriptor_Endpoint_t CDC2_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC1_CCI = 0, /**< CDC1 CCI interface descriptor ID */ + INTERFACE_ID_CDC1_DCI = 1, /**< CDC1 DCI interface descriptor ID */ + INTERFACE_ID_CDC2_CCI = 2, /**< CDC2 CCI interface descriptor ID */ + INTERFACE_ID_CDC2_DCI = 3, /**< CDC2 DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c index eaba6185a..070ebc791 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c @@ -45,7 +45,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC1_CCI, .DataINEndpoint = { .Address = CDC1_TX_EPADDR, @@ -76,7 +76,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 2, + .ControlInterfaceNumber = INTERFACE_ID_CDC2_CCI, .DataINEndpoint = { .Address = CDC2_TX_EPADDR, diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.c b/Demos/Device/ClassDriver/GenericHID/Descriptors.c index 57c3502b9..b070d8640 100644 --- a/Demos/Device/ClassDriver/GenericHID/Descriptors.c +++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.c @@ -108,7 +108,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_GenericHID, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.h b/Demos/Device/ClassDriver/GenericHID/Descriptors.h index b598e9889..4500f2c10 100644 --- a/Demos/Device/ClassDriver/GenericHID/Descriptors.h +++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.h @@ -55,18 +55,27 @@ // Generic HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_GenericHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_GenericHID = 0, /**< GenericHID interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 182aa5a58..8f5b86131 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_GenericHID, .ReportINEndpoint = { .Address = GENERIC_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.c b/Demos/Device/ClassDriver/Joystick/Descriptors.c index 8a6ef2052..2d416528b 100644 --- a/Demos/Device/ClassDriver/Joystick/Descriptors.c +++ b/Demos/Device/ClassDriver/Joystick/Descriptors.c @@ -108,7 +108,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Joystick, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.h b/Demos/Device/ClassDriver/Joystick/Descriptors.h index 89c0584d9..839cd28eb 100644 --- a/Demos/Device/ClassDriver/Joystick/Descriptors.h +++ b/Demos/Device/ClassDriver/Joystick/Descriptors.h @@ -56,15 +56,24 @@ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Joystick = 0, /**< Joystick interface desciptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index 809c41060..bbe85584a 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Joystick, .ReportINEndpoint = { .Address = JOYSTICK_EPADDR, diff --git a/Demos/Device/ClassDriver/Keyboard/Descriptors.c b/Demos/Device/ClassDriver/Keyboard/Descriptors.c index f40e3b932..4340ec657 100644 --- a/Demos/Device/ClassDriver/Keyboard/Descriptors.c +++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.c @@ -104,7 +104,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Keyboard, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/Keyboard/Descriptors.h b/Demos/Device/ClassDriver/Keyboard/Descriptors.h index abaf9c62a..ce029bb75 100644 --- a/Demos/Device/ClassDriver/Keyboard/Descriptors.h +++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.h @@ -56,15 +56,24 @@ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Keyboard = 0, /**< Keyboard interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index b3cc67e1e..68e3fbe1b 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_EPADDR, diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c index c3b2e2c7b..0d350c764 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c @@ -120,7 +120,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Keyboard, .AlternateSetting = 0x00, .TotalEndpoints = 1, @@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x01, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, @@ -269,28 +269,30 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, break; case HID_DTYPE_HID: - if (!(wIndex)) + switch (wIndex) { - Address = &ConfigurationDescriptor.HID1_KeyboardHID; - Size = sizeof(USB_HID_Descriptor_HID_t); - } - else - { - Address = &ConfigurationDescriptor.HID2_MouseHID; - Size = sizeof(USB_HID_Descriptor_HID_t); + case INTERFACE_ID_Keyboard: + Address = &ConfigurationDescriptor.HID1_KeyboardHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; + case INTERFACE_ID_Mouse: + Address = &ConfigurationDescriptor.HID2_MouseHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; } break; case HID_DTYPE_Report: - if (!(wIndex)) + switch (wIndex) { - Address = &KeyboardReport; - Size = sizeof(KeyboardReport); - } - else - { - Address = &MouseReport; - Size = sizeof(MouseReport); + case INTERFACE_ID_Keyboard: + Address = &KeyboardReport; + Size = sizeof(KeyboardReport); + break; + case INTERFACE_ID_Mouse: + Address = &MouseReport; + Size = sizeof(MouseReport); + break; } break; diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h index 27120eb34..1a45f74bd 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h @@ -61,15 +61,25 @@ USB_Descriptor_Endpoint_t HID2_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Keyboard = 0, /**< Keyboard interface descriptor ID */ + INTERFACE_ID_Mouse = 1, /**< Mouse interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index f663f1683..789fc215d 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -51,7 +51,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_IN_EPADDR, @@ -72,7 +72,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface = { .Config = { - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c index a36147321..477cad0a4 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c @@ -167,7 +167,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_KeyboardAndMouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h index a47d18577..f5d68be69 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h @@ -56,15 +56,24 @@ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_KeyboardAndMouse = 0, /**< Combined keyboard and mouse interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c index f15d134ff..0ec878894 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Device_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_KeyboardAndMouse, .ReportINEndpoint = { .Address = HID_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.c b/Demos/Device/ClassDriver/MIDI/Descriptors.c index 5413f27f5..746bcc484 100644 --- a/Demos/Device/ClassDriver/MIDI/Descriptors.c +++ b/Demos/Device/ClassDriver/MIDI/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MidiAudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -118,7 +118,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_MidiAudioStreaming, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.h b/Demos/Device/ClassDriver/MIDI/Descriptors.h index 92c6c38d9..d6f230a8d 100644 --- a/Demos/Device/ClassDriver/MIDI/Descriptors.h +++ b/Demos/Device/ClassDriver/MIDI/Descriptors.h @@ -77,15 +77,25 @@ USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_MidiAudioControl = 0, /**< MIDI audio control interface descriptor ID */ + INTERFACE_ID_MidiAudioStreaming = 1, /**< MIDI audio streaming interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index bec442883..79a831762 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -44,7 +44,7 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface = { .Config = { - .StreamingInterfaceNumber = 1, + .StreamingInterfaceNumber = INTERFACE_ID_MidiAudioStreaming, .DataINEndpoint = { .Address = MIDI_STREAM_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.c b/Demos/Device/ClassDriver/MassStorage/Descriptors.c index d069bcece..2be052b07 100644 --- a/Demos/Device/ClassDriver/MassStorage/Descriptors.c +++ b/Demos/Device/ClassDriver/MassStorage/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.h b/Demos/Device/ClassDriver/MassStorage/Descriptors.h index 3b9a96c8a..674bd2960 100644 --- a/Demos/Device/ClassDriver/MassStorage/Descriptors.h +++ b/Demos/Device/ClassDriver/MassStorage/Descriptors.h @@ -68,15 +68,24 @@ USB_Descriptor_Endpoint_t MS_DataOutEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 82f02b918..32b4c2634 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -44,7 +44,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c index 2209d5144..5749b365f 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c @@ -106,7 +106,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -142,7 +142,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_Keyboard, .AlternateSetting = 0, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h index 2b70e11b4..606e47d91 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h @@ -80,15 +80,25 @@ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */ + INTERFACE_ID_Keyboard = 1, /**< Keyboard interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 2ed3f411b..8ed0d3b64 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -45,7 +45,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, @@ -73,7 +73,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_EPADDR, diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.c b/Demos/Device/ClassDriver/Mouse/Descriptors.c index c21a8cc65..09278a790 100644 --- a/Demos/Device/ClassDriver/Mouse/Descriptors.c +++ b/Demos/Device/ClassDriver/Mouse/Descriptors.c @@ -109,7 +109,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.h b/Demos/Device/ClassDriver/Mouse/Descriptors.h index a5380a11a..3b637e21f 100644 --- a/Demos/Device/ClassDriver/Mouse/Descriptors.h +++ b/Demos/Device/ClassDriver/Mouse/Descriptors.h @@ -60,18 +60,27 @@ // Mouse HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MouseHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Mouse = 0, /**< Mouse interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 8432b65a9..1e8f7ab93 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_EPADDR, diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c index ca70633be..7474e5499 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -141,7 +141,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h index be5015725..c782a5ea7 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h @@ -81,15 +81,25 @@ USB_Descriptor_Endpoint_t RNDIS_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index 54d551142..e38dfec26 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -44,7 +44,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c index 9432562cc..33f63371d 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h index e2d09b218..20caec05c 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h +++ b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h @@ -79,15 +79,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c index 0079acbfa..56b248d3c 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c @@ -44,7 +44,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c index e41a91a18..b8a07f4c2 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -156,7 +156,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -192,7 +192,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h index 25d31bff8..ac6e4fa8e 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h @@ -96,15 +96,26 @@ USB_Descriptor_Endpoint_t MS_DataOutEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + INTERFACE_ID_MassStorage = 2, /**< Mass storage interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c index 03f422b45..6dc1ab662 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c @@ -44,7 +44,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, @@ -74,7 +74,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c index 42c77dde8..43c849b79 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c @@ -124,7 +124,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -175,7 +175,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -211,7 +211,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h index 1bce49627..7ac638bd6 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h @@ -91,15 +91,26 @@ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + INTERFACE_ID_Mouse = 2, /**< Mouse interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c index 73f9e3875..d4aba4851 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c @@ -44,7 +44,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, @@ -77,7 +77,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface = { .Config = { - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_EPADDR, diff --git a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c index 8bf92371d..6b27db8b3 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c +++ b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c @@ -92,7 +92,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_TestAndMeasurement, .AlternateSetting = 0x00, .TotalEndpoints = 3, diff --git a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h index 9beb3d272..07464486d 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h +++ b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h @@ -74,15 +74,24 @@ USB_Descriptor_Endpoint_t TM_NotificationEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_TestAndMeasurement = 0, /**< Test and measurement interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.c b/Demos/Device/LowLevel/AudioInput/Descriptors.c index b3490d005..444f16046 100644 --- a/Demos/Device/LowLevel/AudioInput/Descriptors.c +++ b/Demos/Device/LowLevel/AudioInput/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -150,7 +150,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -166,7 +166,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.h b/Demos/Device/LowLevel/AudioInput/Descriptors.h index a3d3ec3ef..7dbb9aa22 100644 --- a/Demos/Device/LowLevel/AudioInput/Descriptors.h +++ b/Demos/Device/LowLevel/AudioInput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ + INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.c b/Demos/Device/LowLevel/AudioOutput/Descriptors.c index 43f717549..7879c3463 100644 --- a/Demos/Device/LowLevel/AudioOutput/Descriptors.c +++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -150,7 +150,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -166,7 +166,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.h b/Demos/Device/LowLevel/AudioOutput/Descriptors.h index b8ae901d7..07d1becbd 100644 --- a/Demos/Device/LowLevel/AudioOutput/Descriptors.h +++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ + INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c index d0992de4b..245231852 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c +++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC1_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -156,7 +156,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC1_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -206,7 +206,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_CDC2_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -257,7 +257,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 3, + .InterfaceNumber = INTERFACE_ID_CDC2_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h index a5a87dc3d..dc19cfe34 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h +++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h @@ -102,15 +102,27 @@ USB_Descriptor_Endpoint_t CDC2_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC1_CCI = 0, /**< CDC1 CCI interface descriptor ID */ + INTERFACE_ID_CDC1_DCI = 1, /**< CDC1 DCI interface descriptor ID */ + INTERFACE_ID_CDC2_CCI = 2, /**< CDC2 CCI interface descriptor ID */ + INTERFACE_ID_CDC2_DCI = 3, /**< CDC2 DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.c b/Demos/Device/LowLevel/GenericHID/Descriptors.c index bcbb386ce..2e7536001 100644 --- a/Demos/Device/LowLevel/GenericHID/Descriptors.c +++ b/Demos/Device/LowLevel/GenericHID/Descriptors.c @@ -116,7 +116,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_GenericHID, .AlternateSetting = 0x00, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.h b/Demos/Device/LowLevel/GenericHID/Descriptors.h index 884233445..c37c68b13 100644 --- a/Demos/Device/LowLevel/GenericHID/Descriptors.h +++ b/Demos/Device/LowLevel/GenericHID/Descriptors.h @@ -55,19 +55,28 @@ // Generic HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_GenericHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; - USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_GenericHID = 0, /**< GenericHID interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/LowLevel/Joystick/Descriptors.c b/Demos/Device/LowLevel/Joystick/Descriptors.c index 376238708..2f9eb0099 100644 --- a/Demos/Device/LowLevel/Joystick/Descriptors.c +++ b/Demos/Device/LowLevel/Joystick/Descriptors.c @@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Joystick, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/Joystick/Descriptors.h b/Demos/Device/LowLevel/Joystick/Descriptors.h index f06b3cae3..2600e0cac 100644 --- a/Demos/Device/LowLevel/Joystick/Descriptors.h +++ b/Demos/Device/LowLevel/Joystick/Descriptors.h @@ -53,18 +53,27 @@ // Joystick HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_JoystickHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Joystick = 0, /**< Joystick interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/LowLevel/Keyboard/Descriptors.c b/Demos/Device/LowLevel/Keyboard/Descriptors.c index e3da4b6a9..6a644d80c 100644 --- a/Demos/Device/LowLevel/Keyboard/Descriptors.c +++ b/Demos/Device/LowLevel/Keyboard/Descriptors.c @@ -133,7 +133,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Keyboard, .AlternateSetting = 0x00, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/Keyboard/Descriptors.h b/Demos/Device/LowLevel/Keyboard/Descriptors.h index f9d54243a..dcd757233 100644 --- a/Demos/Device/LowLevel/Keyboard/Descriptors.h +++ b/Demos/Device/LowLevel/Keyboard/Descriptors.h @@ -54,19 +54,28 @@ // Keyboard HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_KeyboardHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; - USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Keyboard = 0, /**< Keyboard interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c index d45cd593f..4a339f415 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c +++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c @@ -168,7 +168,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Keyboard, .AlternateSetting = 0x00, .TotalEndpoints = 2, @@ -215,7 +215,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x01, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, @@ -327,27 +327,29 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, break; case HID_DTYPE_HID: - if (!(wIndex)) + switch (wIndex) { - Address = &ConfigurationDescriptor.HID1_KeyboardHID; - Size = sizeof(USB_HID_Descriptor_HID_t); - } - else - { - Address = &ConfigurationDescriptor.HID2_MouseHID; - Size = sizeof(USB_HID_Descriptor_HID_t); + case (INTERFACE_ID_Keyboard): + Address = &ConfigurationDescriptor.HID1_KeyboardHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; + case (INTERFACE_ID_Mouse): + Address = &ConfigurationDescriptor.HID2_MouseHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; } break; case HID_DTYPE_Report: - if (!(wIndex)) + switch (wIndex) { - Address = &KeyboardReport; - Size = sizeof(KeyboardReport); - } - else - { - Address = &MouseReport; - Size = sizeof(MouseReport); + case INTERFACE_ID_Keyboard: + Address = &KeyboardReport; + Size = sizeof(KeyboardReport); + break; + case INTERFACE_ID_Mouse: + Address = &MouseReport; + Size = sizeof(MouseReport); + break; } break; diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h index 6d2543ac2..99f423e1b 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h +++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h @@ -63,15 +63,25 @@ USB_Descriptor_Endpoint_t HID2_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Keyboard = 0, /**< Keyboard interface descriptor ID */ + INTERFACE_ID_Mouse = 1, /**< Mouse interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/Device/LowLevel/MIDI/Descriptors.c b/Demos/Device/LowLevel/MIDI/Descriptors.c index 5413f27f5..220d37dff 100644 --- a/Demos/Device/LowLevel/MIDI/Descriptors.c +++ b/Demos/Device/LowLevel/MIDI/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -118,7 +118,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/MIDI/Descriptors.h b/Demos/Device/LowLevel/MIDI/Descriptors.h index 1572b1cbc..649b2acb6 100644 --- a/Demos/Device/LowLevel/MIDI/Descriptors.h +++ b/Demos/Device/LowLevel/MIDI/Descriptors.h @@ -77,15 +77,25 @@ USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ + INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/MassStorage/Descriptors.c b/Demos/Device/LowLevel/MassStorage/Descriptors.c index d069bcece..2be052b07 100644 --- a/Demos/Device/LowLevel/MassStorage/Descriptors.c +++ b/Demos/Device/LowLevel/MassStorage/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/MassStorage/Descriptors.h b/Demos/Device/LowLevel/MassStorage/Descriptors.h index dc6748f85..7c3196b93 100644 --- a/Demos/Device/LowLevel/MassStorage/Descriptors.h +++ b/Demos/Device/LowLevel/MassStorage/Descriptors.h @@ -68,15 +68,24 @@ USB_Descriptor_Endpoint_t MS_DataOutEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.c b/Demos/Device/LowLevel/Mouse/Descriptors.c index 99780a44d..23e8d7f44 100644 --- a/Demos/Device/LowLevel/Mouse/Descriptors.c +++ b/Demos/Device/LowLevel/Mouse/Descriptors.c @@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.h b/Demos/Device/LowLevel/Mouse/Descriptors.h index a5380a11a..3b637e21f 100644 --- a/Demos/Device/LowLevel/Mouse/Descriptors.h +++ b/Demos/Device/LowLevel/Mouse/Descriptors.h @@ -60,18 +60,27 @@ // Mouse HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MouseHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Mouse = 0, /**< Mouse interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c index ca70633be..7474e5499 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -141,7 +141,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h index 763bc0c7c..9db67965f 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h @@ -81,15 +81,25 @@ USB_Descriptor_Endpoint_t RNDIS_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/Device/LowLevel/VirtualSerial/Descriptors.c b/Demos/Device/LowLevel/VirtualSerial/Descriptors.c index 9432562cc..33f63371d 100644 --- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.c +++ b/Demos/Device/LowLevel/VirtualSerial/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/VirtualSerial/Descriptors.h b/Demos/Device/LowLevel/VirtualSerial/Descriptors.h index a704614a6..8ece697fd 100644 --- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.h +++ b/Demos/Device/LowLevel/VirtualSerial/Descriptors.h @@ -79,15 +79,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c index 6b714eb7d..13c6cbcc7 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c @@ -109,7 +109,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h index eca1e7981..a19b61267 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h @@ -53,18 +53,27 @@ // Mouse HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MouseHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Mouse = 0, /**< Mouse interface descriptor ID (must be zero) */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c index ef9280ce8..2bbeb2dee 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_EPADDR, diff --git a/Projects/AVRISP-MKII/AVRISPDescriptors.c b/Projects/AVRISP-MKII/AVRISPDescriptors.c index cb19051f4..c185cb9f4 100644 --- a/Projects/AVRISP-MKII/AVRISPDescriptors.c +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.c @@ -101,7 +101,7 @@ AVRISP_USB_Descriptor_Configuration_t AVRISP_ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AVRISP, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/AVRISP-MKII/AVRISPDescriptors.h b/Projects/AVRISP-MKII/AVRISPDescriptors.h index 2f1192384..68bb10359 100644 --- a/Projects/AVRISP-MKII/AVRISPDescriptors.h +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.h @@ -86,16 +86,25 @@ USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint; } AVRISP_USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AVRISP = 0, /**< AVRISP interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum AVRISP_StringDescriptors_t { - AVRISP_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - AVRISP_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - AVRISP_STRING_ID_Product = 2, /**< Product string ID */ - AVRISP_STRING_ID_Serial = 3, /**< Serial number string ID */ + AVRISP_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + AVRISP_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + AVRISP_STRING_ID_Product = 2, /**< Product string ID */ + AVRISP_STRING_ID_Serial = 3, /**< Serial number string ID */ }; /* External Variables: */ diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c index a89e6caf6..2ecee0711 100644 --- a/Projects/Benito/Benito.c +++ b/Projects/Benito/Benito.c @@ -62,7 +62,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/Benito/Descriptors.c b/Projects/Benito/Descriptors.c index ebb11cac5..8bd0907d5 100644 --- a/Projects/Benito/Descriptors.c +++ b/Projects/Benito/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -141,7 +141,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/Benito/Descriptors.h b/Projects/Benito/Descriptors.h index 12be7bf9c..5c67e7174 100644 --- a/Projects/Benito/Descriptors.h +++ b/Projects/Benito/Descriptors.h @@ -81,15 +81,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/LEDNotifier/Descriptors.c b/Projects/LEDNotifier/Descriptors.c index 1875bba01..f228c69ef 100644 --- a/Projects/LEDNotifier/Descriptors.c +++ b/Projects/LEDNotifier/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/LEDNotifier/Descriptors.h b/Projects/LEDNotifier/Descriptors.h index 363951c5b..ed19d84f8 100644 --- a/Projects/LEDNotifier/Descriptors.h +++ b/Projects/LEDNotifier/Descriptors.h @@ -79,15 +79,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c index d6a8fdca3..e1d5dd97f 100644 --- a/Projects/LEDNotifier/LEDNotifier.c +++ b/Projects/LEDNotifier/LEDNotifier.c @@ -44,7 +44,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/MIDIToneGenerator/Descriptors.c b/Projects/MIDIToneGenerator/Descriptors.c index 5413f27f5..220d37dff 100644 --- a/Projects/MIDIToneGenerator/Descriptors.c +++ b/Projects/MIDIToneGenerator/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -118,7 +118,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/MIDIToneGenerator/Descriptors.h b/Projects/MIDIToneGenerator/Descriptors.h index cb8789187..dab2fd5a6 100644 --- a/Projects/MIDIToneGenerator/Descriptors.h +++ b/Projects/MIDIToneGenerator/Descriptors.h @@ -79,15 +79,25 @@ USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ + INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/MIDIToneGenerator/MIDIToneGenerator.c index 662c815bc..ed2d33420 100644 --- a/Projects/MIDIToneGenerator/MIDIToneGenerator.c +++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.c @@ -44,7 +44,7 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface = { .Config = { - .StreamingInterfaceNumber = 1, + .StreamingInterfaceNumber = INTERFACE_ID_AudioStream, .DataINEndpoint = { .Address = MIDI_STREAM_IN_EPADDR, diff --git a/Projects/Magstripe/Descriptors.c b/Projects/Magstripe/Descriptors.c index 680944092..c707c1cf6 100644 --- a/Projects/Magstripe/Descriptors.c +++ b/Projects/Magstripe/Descriptors.c @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Keyboard, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Projects/Magstripe/Descriptors.h b/Projects/Magstripe/Descriptors.h index 0f4869fb7..46218fc2c 100644 --- a/Projects/Magstripe/Descriptors.h +++ b/Projects/Magstripe/Descriptors.h @@ -56,18 +56,27 @@ // Keyboard HID Interface USB_Descriptor_Interface_t HID_Interface; /**< Keyboard interface descriptor */ USB_HID_Descriptor_HID_t HID_KeyboardHID; /**< Keyboard HID descriptor */ - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; /**< Keyboard key report endpoint descriptor */ + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; /**< Keyboard key report endpoint descriptor */ } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Keyboard = 0, /**< Keyboard interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c index 8dba7370b..a0b6f1b01 100644 --- a/Projects/Magstripe/Magstripe.c +++ b/Projects/Magstripe/Magstripe.c @@ -56,7 +56,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_EPADDR, diff --git a/Projects/MediaController/Descriptors.c b/Projects/MediaController/Descriptors.c index 636bbb618..353e5fe2f 100644 --- a/Projects/MediaController/Descriptors.c +++ b/Projects/MediaController/Descriptors.c @@ -122,7 +122,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_HID, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Projects/MediaController/Descriptors.h b/Projects/MediaController/Descriptors.h index 9f889641e..827885de6 100644 --- a/Projects/MediaController/Descriptors.h +++ b/Projects/MediaController/Descriptors.h @@ -53,18 +53,27 @@ // Media Controller HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MediaControlHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_HID = 0, /**< HID interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Projects/MediaController/MediaController.c b/Projects/MediaController/MediaController.c index d12a21aac..bda252a55 100644 --- a/Projects/MediaController/MediaController.c +++ b/Projects/MediaController/MediaController.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t MediaControl_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_HID, .ReportINEndpoint = { .Address = MEDIACONTROL_HID_EPADDR, diff --git a/Projects/RelayBoard/Descriptors.c b/Projects/RelayBoard/Descriptors.c index c6b2d8f56..646f7ca08 100644 --- a/Projects/RelayBoard/Descriptors.c +++ b/Projects/RelayBoard/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_RelayBoard, .AlternateSetting = 0, .TotalEndpoints = 0, diff --git a/Projects/RelayBoard/Descriptors.h b/Projects/RelayBoard/Descriptors.h index 97ed22516..c2fc16efa 100644 --- a/Projects/RelayBoard/Descriptors.h +++ b/Projects/RelayBoard/Descriptors.h @@ -54,16 +54,25 @@ USB_Descriptor_Interface_t RelayBoardInterface; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_RelayBoard = 0, /**< Relay board interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ - STRING_ID_Serial = 3, /**< Serial number string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Serial = 3, /**< Serial number string ID */ }; /* Function Prototypes: */ diff --git a/Projects/SerialToLCD/Descriptors.c b/Projects/SerialToLCD/Descriptors.c index 8a55f82a4..baf33c0ce 100644 --- a/Projects/SerialToLCD/Descriptors.c +++ b/Projects/SerialToLCD/Descriptors.c @@ -103,7 +103,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -154,7 +154,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/SerialToLCD/Descriptors.h b/Projects/SerialToLCD/Descriptors.h index 5776098e3..f6619296d 100644 --- a/Projects/SerialToLCD/Descriptors.h +++ b/Projects/SerialToLCD/Descriptors.h @@ -80,15 +80,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/SerialToLCD/SerialToLCD.c b/Projects/SerialToLCD/SerialToLCD.c index aac4fadfb..21a5d68cb 100644 --- a/Projects/SerialToLCD/SerialToLCD.c +++ b/Projects/SerialToLCD/SerialToLCD.c @@ -51,7 +51,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/SerialToLCD/SerialToLCD.h b/Projects/SerialToLCD/SerialToLCD.h index 22537d609..bafc03c27 100644 --- a/Projects/SerialToLCD/SerialToLCD.h +++ b/Projects/SerialToLCD/SerialToLCD.h @@ -37,28 +37,28 @@ #ifndef _SERIALTOLCD_H_ #define _SERIALTOLCD_H_ - /* Includes: */ - #include - #include - #include - #include + /* Includes: */ + #include + #include + #include + #include - #include "Descriptors.h" + #include "Descriptors.h" #include "Lib/HD44780.h" - #include - #include - #include + #include + #include + #include #include /* Macros: */ #define COMMAND_ESCAPE 0x1B - /* Function Prototypes: */ - void SetupHardware(void); + /* Function Prototypes: */ + void SetupHardware(void); - void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_ControlRequest(void); #endif diff --git a/Projects/TempDataLogger/Descriptors.c b/Projects/TempDataLogger/Descriptors.c index 6ec6f64aa..452c4c6ec 100644 --- a/Projects/TempDataLogger/Descriptors.c +++ b/Projects/TempDataLogger/Descriptors.c @@ -109,7 +109,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -145,7 +145,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_HID, .AlternateSetting = 0, .TotalEndpoints = 1, diff --git a/Projects/TempDataLogger/Descriptors.h b/Projects/TempDataLogger/Descriptors.h index 91e238fc1..63c3fae02 100644 --- a/Projects/TempDataLogger/Descriptors.h +++ b/Projects/TempDataLogger/Descriptors.h @@ -56,15 +56,25 @@ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */ + INTERFACE_ID_HID = 1, /**< HID interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c index bbbea47f2..66f933586 100644 --- a/Projects/TempDataLogger/TempDataLogger.c +++ b/Projects/TempDataLogger/TempDataLogger.c @@ -44,7 +44,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, @@ -72,7 +72,7 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface = { .Config = { - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_HID, .ReportINEndpoint = { .Address = GENERIC_IN_EPADDR, diff --git a/Projects/USBtoSerial/Descriptors.c b/Projects/USBtoSerial/Descriptors.c index b2d228588..ea0a84a0c 100644 --- a/Projects/USBtoSerial/Descriptors.c +++ b/Projects/USBtoSerial/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/USBtoSerial/Descriptors.h b/Projects/USBtoSerial/Descriptors.h index 363951c5b..ed19d84f8 100644 --- a/Projects/USBtoSerial/Descriptors.h +++ b/Projects/USBtoSerial/Descriptors.h @@ -79,15 +79,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c index 6df906340..84ec2befa 100644 --- a/Projects/USBtoSerial/USBtoSerial.c +++ b/Projects/USBtoSerial/USBtoSerial.c @@ -56,7 +56,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/Webserver/Descriptors.c b/Projects/Webserver/Descriptors.c index 8fcba5cc8..b8acf42a2 100644 --- a/Projects/Webserver/Descriptors.c +++ b/Projects/Webserver/Descriptors.c @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -156,7 +156,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -192,7 +192,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/Webserver/Descriptors.h b/Projects/Webserver/Descriptors.h index 2c25512e4..c649cf56f 100644 --- a/Projects/Webserver/Descriptors.h +++ b/Projects/Webserver/Descriptors.h @@ -96,15 +96,26 @@ USB_Descriptor_Endpoint_t MS_DataOutEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + INTERFACE_ID_MassStorage = 2, /**< Mass storage interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c index 7d5beb93a..f889b6be6 100644 --- a/Projects/Webserver/USBDeviceMode.c +++ b/Projects/Webserver/USBDeviceMode.c @@ -44,7 +44,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, @@ -76,7 +76,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, diff --git a/Projects/XPLAINBridge/USARTDescriptors.c b/Projects/XPLAINBridge/USARTDescriptors.c index 0e0ac8534..b1bfd4e81 100644 --- a/Projects/XPLAINBridge/USARTDescriptors.c +++ b/Projects/XPLAINBridge/USARTDescriptors.c @@ -91,7 +91,7 @@ const USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/XPLAINBridge/USARTDescriptors.h b/Projects/XPLAINBridge/USARTDescriptors.h index 954867c18..130c695b9 100644 --- a/Projects/XPLAINBridge/USARTDescriptors.h +++ b/Projects/XPLAINBridge/USARTDescriptors.h @@ -81,22 +81,32 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USART_USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum USART_InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum USART_StringDescriptors_t { - USART_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - USART_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - USART_STRING_ID_Product = 2, /**< Product string ID */ + USART_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + USART_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + USART_STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, const void** const DescriptorAddress, - uint8_t* const DescriptorMemorySpace); + uint8_t* const DescriptorMemorySpace); #endif diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index 2ef1d20ee..1c63b71d8 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -47,7 +47,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, -- cgit v1.2.3