| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usbd_mscuser.h
Go to the documentation of this file.
1 /*
2 * @brief Definition of functions exported by ROM based MSC function driver
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * All rights reserved.
7 *
8 * @par
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
22 *
23 * @par
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
29 * this code.
30 */
31
32 #include "error.h"
33 #include "usbd.h"
34 #include "usbd_msc.h"
35 #include "usbd_core.h"
36
37 #ifndef __MSCUSER_H__
38 #define __MSCUSER_H__
39
40
59 typedef struct USBD_MSC_INIT_PARAM
60 {
61 /* memory allocation params */
62 uint32_t mem_base;
67 uint32_t mem_size;
70 /* mass storage paramas */
71 uint8_t* InquiryStr;
75 uint32_t BlockCount;
76 uint32_t BlockSize;
77 uint32_t MemorySize;
82 uint8_t* intf_desc;
83 /* user defined functions */
84
98 void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length);
119 void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length);
135 ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t buf[], uint32_t length);
152 void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length);
153
173 ErrorCode_t (*MSC_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
174
175 } USBD_MSC_INIT_PARAM_T;
176
183 typedef struct USBD_MSC_API
184 {
196 uint32_t (*GetMemSize)(USBD_MSC_INIT_PARAM_T* param);
197
214 ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_MSC_INIT_PARAM_T* param);
215
216 } USBD_MSC_API_T;
217
218 /*-----------------------------------------------------------------------------
219 * Private functions & structures prototypes
220 *-----------------------------------------------------------------------------*/
223 typedef struct _MSC_CTRL_T
224 {
225 /* If it's a USB HS, the max packet is 512, if it's USB FS,
226 the max packet is 64. Use 512 for both HS and FS. */
227 /*ALIGNED(4)*/ uint8_t BulkBuf[512]; /* Bulk In/Out Buffer */
228 /*ALIGNED(4)*/MSC_CBW CBW; /* Command Block Wrapper */
229 /*ALIGNED(4)*/MSC_CSW CSW; /* Command Status Wrapper */
230
231 USB_CORE_CTRL_T* pUsbCtrl;
232
233 uint32_t Offset; /* R/W Offset */
234 uint32_t Length; /* R/W Length */
235 uint32_t BulkLen; /* Bulk In/Out Length */
236 uint8_t* rx_buf;
237
238 uint8_t BulkStage; /* Bulk Stage */
239 uint8_t if_num; /* interface number */
240 uint8_t epin_num; /* BULK IN endpoint number */
241 uint8_t epout_num; /* BULK OUT endpoint number */
242 uint32_t MemOK; /* Memory OK */
243
244 uint8_t* InquiryStr;
245 uint32_t BlockCount;
246 uint32_t BlockSize;
247 uint32_t MemorySize;
248 /* user defined functions */
249 void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length);
250 void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length);
251 ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t src[], uint32_t length);
252 /* optional call back for MSC_Write optimization */
253 void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length);
254
255
256 }USB_MSC_CTRL_T;
257
258
262 #endif /* __MSCUSER_H__ */