aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-10-06 13:22:23 -0700
committerDean Camera <dean@fourwalledcubicle.com>2013-10-06 13:22:23 -0700
commit7ce4d35c3909e0b55d0a184c3d9b2b8cb35b0131 (patch)
tree3abbab4d1860ea31d30d7a72496fc9959fecb858 /Bootloaders
parent8e2476a125d6a4bd0385eb0f9569ac597bdbf9ed (diff)
parent9ef29ea2293dde7225360fe258224d22d3a68756 (diff)
downloadlufa-7ce4d35c3909e0b55d0a184c3d9b2b8cb35b0131.tar.gz
lufa-7ce4d35c3909e0b55d0a184c3d9b2b8cb35b0131.tar.bz2
lufa-7ce4d35c3909e0b55d0a184c3d9b2b8cb35b0131.zip
Merge pull request #8 from mondalaci/extract-interface-numbers
Extract interface numbers into enums.
Diffstat (limited to 'Bootloaders')
-rw-r--r--Bootloaders/CDC/Descriptors.c4
-rw-r--r--Bootloaders/CDC/Descriptors.h16
-rw-r--r--Bootloaders/DFU/BootloaderDFU.h4
-rw-r--r--Bootloaders/DFU/Descriptors.c2
-rw-r--r--Bootloaders/DFU/Descriptors.h15
-rw-r--r--Bootloaders/HID/Descriptors.c2
-rw-r--r--Bootloaders/HID/Descriptors.h11
-rw-r--r--Bootloaders/MassStorage/BootloaderMassStorage.c2
-rw-r--r--Bootloaders/MassStorage/Descriptors.c2
-rw-r--r--Bootloaders/MassStorage/Descriptors.h10
-rw-r--r--Bootloaders/Printer/BootloaderPrinter.c2
-rw-r--r--Bootloaders/Printer/Descriptors.c2
-rw-r--r--Bootloaders/Printer/Descriptors.h15
13 files changed, 67 insertions, 20 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: */