diff options
Diffstat (limited to 'usb/device')
-rw-r--r-- | usb/device/dfu/dfu.h | 2 | ||||
-rw-r--r-- | usb/device/dfu/dfu_driver.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/usb/device/dfu/dfu.h b/usb/device/dfu/dfu.h index bf07d43..5ca1baf 100644 --- a/usb/device/dfu/dfu.h +++ b/usb/device/dfu/dfu.h @@ -130,7 +130,7 @@ extern int USBDFU_handle_upload(uint8_t altif, unsigned int offset, void USBDFU_Runtime_RequestHandler(const USBGenericRequest *request); void USBDFU_DFU_RequestHandler(const USBGenericRequest *request); -void USBDFU_Initialize(const USBDDriverDescriptors *pDescriptors, unsigned char *pInterfaces); +void USBDFU_Initialize(const USBDDriverDescriptors *pDescriptors); #define DFU_RET_NOTHING 0 #define DFU_RET_ZLP 1 diff --git a/usb/device/dfu/dfu_driver.c b/usb/device/dfu/dfu_driver.c index 53f690c..c6c1a18 100644 --- a/usb/device/dfu/dfu_driver.c +++ b/usb/device/dfu/dfu_driver.c @@ -37,6 +37,7 @@ /// Standard device driver instance. static USBDDriver usbdDriver; +static unsigned char if_altsettings[1]; __dfudata struct dfu dfu = { .state = DFU_STATE_appIDLE, @@ -99,7 +100,7 @@ static void dnload_cb(void *arg, unsigned char status, unsigned int transferred, return; } - rc = USBDFU_handle_dnload(0, dfu.total_bytes, dfu_buf, transferred); + rc = USBDFU_handle_dnload(if_altsettings[0], dfu.total_bytes, dfu_buf, transferred); switch (rc) { case DFU_RET_ZLP: dfu.total_bytes += transferred; @@ -183,7 +184,7 @@ static int handle_upload(uint16_t val, uint16_t len, int first) } /* FIXME: altif */ - rc = USBDFU_handle_upload(0, dfu.total_bytes, dfu_buf, len); + rc = USBDFU_handle_upload(if_altsettings[0], dfu.total_bytes, dfu_buf, len); if (rc < 0) { TRACE_ERROR("application handle_upload() returned %d\n\r", rc); return DFU_RET_STALL; @@ -454,12 +455,12 @@ out: } } -void USBDFU_Initialize(const USBDDriverDescriptors *pDescriptors, unsigned char *pInterfaces) +void USBDFU_Initialize(const USBDDriverDescriptors *pDescriptors) { /* We already start in DFU idle mode */ dfu.state = DFU_STATE_dfuIDLE; - USBDDriver_Initialize(&usbdDriver, pDescriptors, pInterfaces); + USBDDriver_Initialize(&usbdDriver, pDescriptors, if_altsettings); USBD_Init(); } |