LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usbd_dfuuser.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id: mw_usbd_dfuuser.h.rca 1.2 Tue Nov 1 11:45:07 2011 nlv09221 Experimental $
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 "usbd.h"
29 #include "usbd_dfu.h"
30 #include "usbd_core.h"
31 
62 typedef struct USBD_DFU_INIT_PARAM
63 {
64  /* memory allocation params */
65  uint32_t mem_base;
70  uint32_t mem_size;
73  /* DFU paramas */
74  uint16_t wTransferSize;
80  uint16_t pad;
85  uint8_t* intf_desc;
86  /* user defined functions */
106  uint8_t (*DFU_Write)( uint32_t block_num, uint8_t** src, uint32_t length, uint8_t* bwPollTimeout);
107 
121  uint32_t (*DFU_Read)( uint32_t block_num, uint8_t** dst, uint32_t length);
122 
132  void (*DFU_Done)(void);
133 
150  void (*DFU_Detach)(USBD_HANDLE_T hUsb);
151 
171  ErrorCode_t (*DFU_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
172 
174 
175 
182 typedef struct USBD_DFU_API
183 {
196 
218 
220 
221 /*-----------------------------------------------------------------------------
222  * Private functions & structures prototypes
223  *-----------------------------------------------------------------------------*/
226 typedef struct _USBD_DFU_CTRL_T
227 {
228  /*ALIGNED(4)*/ DFU_STATUS_T dfu_req_get_status;
229  uint16_t pad;
230  uint8_t dfu_state;
231  uint8_t dfu_status;
232  uint8_t download_done;
233  uint8_t if_num; /* interface number */
234 
235  uint8_t* xfr_buf;
236  USB_DFU_FUNC_DESCRIPTOR* dfu_desc;
237 
238  USB_CORE_CTRL_T* pUsbCtrl;
239  /* user defined functions */
240  /* return DFU_STATUS_ values defined in mw_usbd_dfu.h */
241  uint8_t (*DFU_Write)( uint32_t block_num, uint8_t** src, uint32_t length, uint8_t* bwPollTimeout);
242  /* return
243  * DFU_STATUS_ : values defined in mw_usbd_dfu.h in case of errors
244  * 0 : If end of memory reached
245  * length : Amount of data copied to destination buffer
246  */
247  uint32_t (*DFU_Read)( uint32_t block_num, uint8_t** dst, uint32_t length);
248  /* callback called after download is finished */
249  void (*DFU_Done)(void);
250  /* callback called after USB_REQ_DFU_DETACH is recived */
251  void (*DFU_Detach)(USBD_HANDLE_T hUsb);
252 
253 } USBD_DFU_CTRL_T;
254 
262 #endif /* __DFUUSER_H__ */