Tidyup of defines etc

This commit is contained in:
Ross Owen
2013-09-05 23:15:43 +01:00
parent 1d6290aea3
commit 439ec036fb

View File

@@ -1,34 +1,30 @@
#ifndef _DFU_H_
#define _DFU_H_ 1
#ifndef DFU_VENDOR_ID #ifndef DFU_VENDOR_ID
#define DFU_VENDOR_ID 0x20B1 #error DFU_VENDOR_ID not defined!
#endif #endif
//#ifndef DFU_PRODUCT_ID #ifndef DFU_PID
//#define DFU_PRODUCT_ID 0x0003 #error DFU_PID not defined!
//#error DFU_PRODUCT_ID not defined!
//#endif
#ifndef PID_DFU
#error PID_DFU not defined!
#endif #endif
#ifndef DFU_BCD_DEVICE #ifndef DFU_BCD_DEVICE
#warning DFU_BCD_DEVICE NOT DEFINED #error DFU_BCD_DEVICE not defined!
#define DFU_BCD_DEVICE 0x0000
#endif #endif
#ifndef DFU_SERIAL_STR_INDEX #ifndef DFU_SERIAL_STR_INDEX
/* By default no serial string */ /* By default no serial string */
#define DFU_SERIAL_STR_INDEX 0x00 #define DFU_SERIAL_STR_INDEX (0x00)
#endif #endif
#ifndef DFU_PRODUCT_INDEX #ifndef DFU_PRODUCT_STR_INDEX
#error DFU_PROFUCT_INDEX NOT DEFINED! #error DFU_PROFUCT_INDEX not defined!!
//#define DFU_PRODUCT_INDEX 0x1
#endif #endif
#ifndef DFU_MANUFACTURER_INDEX #ifndef DFU_MANUFACTURER_STR_INDEX
#error DFU_MANUFACTURING_INDEX NOT DEFINED! #error DFU_MANUFACTURE_STR_INDEX not defined!!
//#define DFU_MANUFACTURER_INDEX 0x2
#endif #endif
unsigned char DFUdevDesc[] = { unsigned char DFUdevDesc[] = {
@@ -42,12 +38,12 @@ unsigned char DFUdevDesc[] = {
64, /* 7 bMaxPacketSize */ 64, /* 7 bMaxPacketSize */
(DFU_VENDOR_ID & 0xFF), /* 8 idVendor */ (DFU_VENDOR_ID & 0xFF), /* 8 idVendor */
(DFU_VENDOR_ID >> 8), /* 9 idVendor */ (DFU_VENDOR_ID >> 8), /* 9 idVendor */
(PID_DFU & 0xFF), /* 10 idProduct */ (DFU_PID & 0xFF), /* 10 idProduct */
(PID_DFU >> 8), /* 11 idProduct */ (DFU_PID >> 8), /* 11 idProduct */
(DFU_BCD_DEVICE & 0xFF), /* 12 bcdDevice : Device release number */ (DFU_BCD_DEVICE & 0xFF), /* 12 bcdDevice : Device release number */
(DFU_BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */ (DFU_BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
DFU_MANUFACTURER_INDEX, /* 14 iManufacturer : Index of manufacturer string */ DFU_MANUFACTURER_STR_INDEX, /* 14 iManufacturer : Index of manufacturer string */
DFU_PRODUCT_INDEX, /* 15 iProduct : Index of product string descriptor */ DFU_PRODUCT_STR_INDEX, /* 15 iProduct : Index of product string descriptor */
DFU_SERIAL_STR_INDEX, /* 16 iSerialNumber : Index of serial number decriptor */ DFU_SERIAL_STR_INDEX, /* 16 iSerialNumber : Index of serial number decriptor */
0x01 /* 17 bNumConfigurations : Number of possible configs */ 0x01 /* 17 bNumConfigurations : Number of possible configs */
}; };
@@ -75,16 +71,6 @@ unsigned char DFUcfgDesc[] = {
0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */ 0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
0x00, /* 8 iInterface : Unused. (field size 1 bytes) */ 0x00, /* 8 iInterface : Unused. (field size 1 bytes) */
#if 0
/* DFU 1.0 Standard DFU class functional descriptor */
0x07,
0x21,
0x07,
0xFA,
0x00,
0x40,
0x00
#else
/* DFU 1.1 Run-Time DFU Functional Descriptor */ /* DFU 1.1 Run-Time DFU Functional Descriptor */
0x09, /* 0 Size */ 0x09, /* 0 Size */
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */ 0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
@@ -94,16 +80,11 @@ unsigned char DFUcfgDesc[] = {
0x40, /* 5 wTransferSize */ 0x40, /* 5 wTransferSize */
0x00, /* 6 wTransferSize */ 0x00, /* 6 wTransferSize */
0x10, /* 7 bcdDFUVersion */ 0x10, /* 7 bcdDFUVersion */
0x01, /* 7 bcdDFUVersion */ 0x01, /* 8 bcdDFUVersion */
#endif
}; };
int DFUReportResetState(chanend ?c_user_cmd); int DFUReportResetState(chanend ?c_user_cmd);
int DFUDeviceRequests(XUD_ep c_ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset); int DFUDeviceRequests(XUD_ep c_ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset);
#endif /* _DFU_H_ */