LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usbd_mscuser.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id: mw_usbd_mscuser.h.rca 1.2 Tue Nov 1 11:45:07 2011 nlv09221 Experimental $
3 *
4 * Project: USB device ROM Stack
5 *
6 * Description:
7 * Mass Storage 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 #ifndef __MSCUSER_H__
25 #define __MSCUSER_H__
26 
27 #include "error.h"
28 #include "usbd.h"
29 #include "usbd_msc.h"
30 #include "usbd_core.h"
31 #include "app_usbd_cfg.h"
32 
58 typedef struct USBD_MSC_INIT_PARAM
59 {
60  /* memory allocation params */
61  uint32_t mem_base;
66  uint32_t mem_size;
69  /* mass storage paramas */
70  uint8_t* InquiryStr;
74  uint32_t BlockCount;
75  uint32_t BlockSize;
76  uint32_t MemorySize;
81  uint8_t* intf_desc;
82  /* user defined functions */
83 
97  void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length);
118  void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length);
134  ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t buf[], uint32_t length);
151  void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length);
152 
172  ErrorCode_t (*MSC_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
173 
175 
182 typedef struct USBD_MSC_API
183 {
196 
214 
216 
217 /*-----------------------------------------------------------------------------
218  * Private functions & structures prototypes
219  *-----------------------------------------------------------------------------*/
222 typedef struct _MSC_CTRL_T
223 {
224  /* If it's a USB HS, the max packet is 512, if it's USB FS,
225  the max packet is 64. Use 512 for both HS and FS. */
226  /*ALIGNED(4)*/ uint8_t BulkBuf[USB_HS_MAX_BULK_PACKET]; /* Bulk In/Out Buffer */
227  /*ALIGNED(4)*/MSC_CBW CBW; /* Command Block Wrapper */
228  /*ALIGNED(4)*/MSC_CSW CSW; /* Command Status Wrapper */
229 
230  USB_CORE_CTRL_T* pUsbCtrl;
231 
232  uint32_t Offset; /* R/W Offset */
233  uint32_t Length; /* R/W Length */
234  uint32_t BulkLen; /* Bulk In/Out Length */
235  uint8_t* rx_buf;
236 
237  uint8_t BulkStage; /* Bulk Stage */
238  uint8_t if_num; /* interface number */
239  uint8_t epin_num; /* BULK IN endpoint number */
240  uint8_t epout_num; /* BULK OUT endpoint number */
241  uint32_t MemOK; /* Memory OK */
242 
243  uint8_t* InquiryStr;
244  uint32_t BlockCount;
245  uint32_t BlockSize;
246  uint32_t MemorySize;
247  /* user defined functions */
248  void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length);
249  void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length);
250  ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t src[], uint32_t length);
251  /* optional call back for MSC_Write optimization */
252  void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length);
253 
254 
255 }USB_MSC_CTRL_T;
256 
265 #endif /* __MSCUSER_H__ */