| USBD ROM Stack 2.0 ROM based USB device stack

mw_usbd_dfuuser.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id:: mw_usbd_dfuuser.h 331 2012-08-09 18:54:34Z usb10131 $
3 *
4 * Project: USB device ROM Stack
5 *
6 * Description:
7 * Device Firmware Upgrade Class Custom User Module Definitions.
8 *
9 ***********************************************************************
10 * Copyright(C) 2011, NXP Semiconductor
11 * All rights reserved.
12 *
13 * Software that is described herein is for illustrative purposes only
14 * which provides customers with programming information regarding the
15 * products. This software is supplied "AS IS" without any warranties.
16 * NXP Semiconductors assumes no responsibility or liability for the
17 * use of the software, conveys no license or title under any patent,
18 * copyright, or mask work right to the product. NXP Semiconductors
19 * reserves the right to make changes in the software without
20 * notification. NXP Semiconductors also make no representation or
21 * warranty that such application will be suitable for the specified
22 * use without further testing or modification.
23 **********************************************************************/
24
25 #ifndef __DFUUSER_H__
26 #define __DFUUSER_H__
27
28 #include "mw_usbd.h"
29 #include "mw_usbd_dfu.h"
30 #include "mw_usbd_core.h"
31
61 typedef struct USBD_DFU_INIT_PARAM {
62 /* memory allocation params */
63 uint32_t mem_base;
68 uint32_t mem_size;
71 /* DFU paramas */
72 uint16_t wTransferSize;
78 uint16_t pad;
83 uint8_t *intf_desc;
84 /* user defined functions */
105 uint8_t (*DFU_Write)(uint32_t block_num, uint8_t * *src, uint32_t length, uint8_t *bwPollTimeout);
106
127 uint32_t (*DFU_Read)(uint32_t block_num, uint8_t * *dst, uint32_t length);
128
138 void (*DFU_Done)(void);
139
156 void (*DFU_Detach)(USBD_HANDLE_T hUsb);
157
177 ErrorCode_t (*DFU_Ep0_Hdlr)(USBD_HANDLE_T hUsb, void *data, uint32_t event);
178
199 uint32_t (*DFU_GetStatus)(uint32_t *timeout, int32_t last);
200
201 } USBD_DFU_INIT_PARAM_T;
202
209 typedef struct USBD_DFU_API {
221 uint32_t (*GetMemSize)(USBD_DFU_INIT_PARAM_T *param);
222
243 ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T *param, uint32_t init_state);
244
245 } USBD_DFU_API_T;
246
247 /*-----------------------------------------------------------------------------
248 * Private functions & structures prototypes
249 *-----------------------------------------------------------------------------*/
252 typedef struct _USBD_DFU_CTRL_T {
253 /*ALIGNED(4)*/ DFU_STATUS_T dfu_req_get_status;
254 uint16_t pad;
255 uint8_t dfu_state;
256 uint8_t dfu_status;
257 uint8_t download_done;
258 uint8_t if_num; /* interface number */
259
260 uint8_t *xfr_buf;
261 USB_DFU_FUNC_DESCRIPTOR *dfu_desc;
262
263 USB_CORE_CTRL_T *pUsbCtrl;
264 /* user defined functions */
265 /* return DFU_STATUS_ values defined in mw_usbd_dfu.h */
266 uint8_t (*DFU_Write)(uint32_t block_num, uint8_t * *src, uint32_t length, uint8_t *bwPollTimeout);
267 /* return
268 * DFU_STATUS_ : values defined in mw_usbd_dfu.h in case of errors
269 * 0 : If end of memory reached
270 * length : Amount of data copied to destination buffer
271 */
272 uint32_t (*DFU_Read)(uint32_t block_num, uint8_t * *dst, uint32_t length);
273 /* callback called after download is finished */
274 void (*DFU_Done)(void);
275 /* callback called after USB_REQ_DFU_DETACH is recived */
276 void (*DFU_Detach)(USBD_HANDLE_T hUsb);
277 /* Callback called after USB_REQ_DFU_GETSTATUS */
278 uint32_t (*DFU_GetStatus)(uint32_t *timeout, int32_t last);
279
280 } USBD_DFU_CTRL_T;
281
283 uint32_t mwDFU_GetMemSize(USBD_DFU_INIT_PARAM_T *param);
284
285 extern ErrorCode_t mwDFU_init(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T *param, uint32_t init_state);
286
291 #endif /* __DFUUSER_H__ */
ErrorCode_t
ErrorCode_t
Definition: error.h:38
mw_usbd_core.h
ROM API for USB device stack.
USBD_DFU_INIT_PARAM_T
USB descriptors data structure.
Definition: mw_usbd_dfuuser.h:61
mw_usbd_dfu.h
Device Firmware Upgrade (DFU) class descriptors.
USBD_DFU_INIT_PARAM_T::wTransferSize
uint16_t wTransferSize
Definition: mw_usbd_dfuuser.h:72
USBD_DFU_API_T
DFU class API functions structure.This module exposes functions which interact directly with USB devi...
Definition: mw_usbd_dfuuser.h:209
mw_usbd.h
Common definitions and declarations for the USB stack.
USBD_DFU_INIT_PARAM_T::intf_desc
uint8_t * intf_desc
Definition: mw_usbd_dfuuser.h:83
USBD_DFU_INIT_PARAM_T::mem_size
uint32_t mem_size
Definition: mw_usbd_dfuuser.h:68
USBD_HANDLE_T
void * USBD_HANDLE_T
Definition: mw_usbd.h:704
USBD_DFU_INIT_PARAM_T::mem_base
uint32_t mem_base
Definition: mw_usbd_dfuuser.h:63