| 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_hw.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id: mw_usbd_hw.h.rca 1.4 Tue Nov 1 11:45:07 2011 nlv09221 Experimental $
3 *
4 * Project: USB device ROM Stack
5 *
6 * Description:
7 * USB Hardware Function prototypes.
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 __USBHW_H__
25 #define __USBHW_H__
26
27 #include "error.h"
28 #include "usbd.h"
29 #include "usbd_core.h"
30
48 enum USBD_EVENT_T {
49 USB_EVT_SETUP =1,
50 USB_EVT_OUT,
51 USB_EVT_IN,
52 USB_EVT_OUT_NAK,
53 USB_EVT_IN_NAK,
54 USB_EVT_OUT_STALL,
55 USB_EVT_IN_STALL,
56 USB_EVT_OUT_DMA_EOT,
57 USB_EVT_IN_DMA_EOT,
58 USB_EVT_OUT_DMA_NDR,
59 USB_EVT_IN_DMA_NDR,
60 USB_EVT_OUT_DMA_ERR,
61 USB_EVT_IN_DMA_ERR,
62 USB_EVT_RESET,
63 USB_EVT_SOF,
64 USB_EVT_DEV_STATE,
65 USB_EVT_DEV_ERROR
66 };
67
75 typedef struct USBD_HW_API
76 {
88 uint32_t (*GetMemSize)(USBD_API_INIT_PARAM_T* param);
89
104 ErrorCode_t (*Init)(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param);
105
119 void (*Connect)(USBD_HANDLE_T hUsb, uint32_t con);
120
132 void (*ISR)(USBD_HANDLE_T hUsb);
133
144 void (*Reset)(USBD_HANDLE_T hUsb);
145
157 void (*ForceFullSpeed )(USBD_HANDLE_T hUsb, uint32_t cfg);
158
176 void (*WakeUpCfg)(USBD_HANDLE_T hUsb, uint32_t cfg);
177
193 void (*SetAddress)(USBD_HANDLE_T hUsb, uint32_t adr);
194
209 void (*Configure)(USBD_HANDLE_T hUsb, uint32_t cfg);
210
226 void (*ConfigEP)(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);
227
242 void (*DirCtrlEP)(USBD_HANDLE_T hUsb, uint32_t dir);
243
254 void (*EnableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
255
266 void (*DisableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
267
278 void (*ResetEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
279
290 void (*SetStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
291
302 void (*ClrStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
303
320 ErrorCode_t (*SetTestMode)(USBD_HANDLE_T hUsb, uint8_t mode);
321
334 uint32_t (*ReadEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);
335
350 uint32_t (*ReadReqEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);
351
364 uint32_t (*ReadSetupPkt)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData);
365
379 uint32_t (*WriteEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);
380
394 void (*WakeUp)(USBD_HANDLE_T hUsb);
395
411 ErrorCode_t (*EnableEvent)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type,
412 uint32_t enable);
413
414 } USBD_HW_API_T;
415
416 /*-----------------------------------------------------------------------------
417 * Private functions & structures prototypes used by stack internally
418 *-----------------------------------------------------------------------------*/
421 /* Driver functions */
422 uint32_t hwUSB_GetMemSize(USBD_API_INIT_PARAM_T* param);
423 ErrorCode_t hwUSB_Init(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param);
424 void hwUSB_Connect(USBD_HANDLE_T hUsb, uint32_t con);
425 void hwUSB_ISR(USBD_HANDLE_T hUsb);
426
427 /* USB Hardware Functions */
428 extern void hwUSB_Reset(USBD_HANDLE_T hUsb);
429 extern void hwUSB_ForceFullSpeed (USBD_HANDLE_T hUsb, uint32_t con);
430 extern void hwUSB_WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t cfg);
431 extern void hwUSB_SetAddress(USBD_HANDLE_T hUsb, uint32_t adr);
432 extern void hwUSB_Configure(USBD_HANDLE_T hUsb, uint32_t cfg);
433 extern void hwUSB_ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);
434 extern void hwUSB_DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir);
435 extern void hwUSB_EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
436 extern void hwUSB_DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
437 extern void hwUSB_ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
438 extern void hwUSB_SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
439 extern void hwUSB_ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
440 extern ErrorCode_t hwUSB_SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode); /* for FS only devices return ERR_USBD_INVALID_REQ */
441 extern uint32_t hwUSB_ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);
442 extern uint32_t hwUSB_ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);
443 extern uint32_t hwUSB_ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t, uint32_t *);
444 extern uint32_t hwUSB_WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);
445
446 /* generate resume signalling on the bus */
447 extern void hwUSB_WakeUp(USBD_HANDLE_T hUsb);
448 extern ErrorCode_t hwUSB_EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable);
449 /* TODO implement following routines
450 - function to program TD and queue them to ep Qh
451 */
452
456 #endif /* __USBHW_H__ */