Updated DFU api such that can be called from C. Also used new enums in DFU desc.

This commit is contained in:
Ross Owen
2014-03-06 10:18:54 +00:00
parent 5009e74a1e
commit 5d2ae2740f

View File

@@ -2,6 +2,9 @@
#ifndef _DFU_H_ #ifndef _DFU_H_
#define _DFU_H_ 1 #define _DFU_H_ 1
#include <xccompat.h>
#include "usb_std_descriptors.h"
#ifndef DFU_VENDOR_ID #ifndef DFU_VENDOR_ID
#error DFU_VENDOR_ID not defined! #error DFU_VENDOR_ID not defined!
#endif #endif
@@ -51,7 +54,7 @@ unsigned char DFUdevDesc[] = {
unsigned char DFUcfgDesc[] = { unsigned char DFUcfgDesc[] = {
/* Standard USB device descriptor */ /* Standard USB device descriptor */
0x09, /* 0 bLength */ 0x09, /* 0 bLength */
USB_CONFIGURATION, /* 1 bDescriptorType */ USB_DESCTYPE_CONFIGURATION, /* 1 bDescriptorType */
0x1b, /* 2 wTotalLength */ 0x1b, /* 2 wTotalLength */
0x00, /* 3 wTotalLength */ 0x00, /* 3 wTotalLength */
1, /* 4 bNumInterface: Number of interfaces*/ 1, /* 4 bNumInterface: Number of interfaces*/
@@ -83,8 +86,12 @@ unsigned char DFUcfgDesc[] = {
0x01, /* 8 bcdDFUVersion */ 0x01, /* 8 bcdDFUVersion */
}; };
int DFUReportResetState(chanend ?c_user_cmd); int DFUReportResetState(NULLABLE_RESOURCE(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, NULLABLE_REFERENCE_PARAM(XUD_ep, ep0_in), REFERENCE_PARAM(USB_SetupPacket_t, sp),
NULLABLE_RESOURCE(chanend, c_user_cmd), unsigned int altInterface, unsigned int user_reset);
/* Helper function for C */
void DFUDelay(unsigned d);
#endif /* _DFU_H_ */ #endif /* _DFU_H_ */