| USBD ROM Stack 1.0 ROM based USB device stack

mw_usbd_hw.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id:: mw_usbd_hw.h 331 2012-08-09 18:54:34Z usb10131 $
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 "mw_usbd.h"
29 #include "mw_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 {
87 uint32_t (*GetMemSize)(USBD_API_INIT_PARAM_T *param);
88
105 ErrorCode_t (*Init)(USBD_HANDLE_T *phUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *param);
106
120 void (*Connect)(USBD_HANDLE_T hUsb, uint32_t con);
121
133 void (*ISR)(USBD_HANDLE_T hUsb);
134
145 void (*Reset)(USBD_HANDLE_T hUsb);
146
158 void (*ForceFullSpeed )(USBD_HANDLE_T hUsb, uint32_t cfg);
159
177 void (*WakeUpCfg)(USBD_HANDLE_T hUsb, uint32_t cfg);
178
194 void (*SetAddress)(USBD_HANDLE_T hUsb, uint32_t adr);
195
210 void (*Configure)(USBD_HANDLE_T hUsb, uint32_t cfg);
211
227 void (*ConfigEP)(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);
228
243 void (*DirCtrlEP)(USBD_HANDLE_T hUsb, uint32_t dir);
244
255 void (*EnableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
256
267 void (*DisableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
268
279 void (*ResetEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
280
291 void (*SetStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
292
303 void (*ClrStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
304
321 ErrorCode_t (*SetTestMode)(USBD_HANDLE_T hUsb, uint8_t mode);
322
335 uint32_t (*ReadEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);
336
351 uint32_t (*ReadReqEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);
352
365 uint32_t (*ReadSetupPkt)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData);
366
380 uint32_t (*WriteEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);
381
395 void (*WakeUp)(USBD_HANDLE_T hUsb);
396
412 ErrorCode_t (*EnableEvent)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, 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
424 ErrorCode_t hwUSB_Init(USBD_HANDLE_T *phUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *param);
425
426 void hwUSB_Connect(USBD_HANDLE_T hUsb, uint32_t con);
427
428 void hwUSB_ISR(USBD_HANDLE_T hUsb);
429
430 /* USB Hardware Functions */
431 extern void hwUSB_Reset(USBD_HANDLE_T hUsb);
432
433 extern void hwUSB_ForceFullSpeed (USBD_HANDLE_T hUsb, uint32_t con);
434
435 extern void hwUSB_WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t cfg);
436
437 extern void hwUSB_SetAddress(USBD_HANDLE_T hUsb, uint32_t adr);
438
439 extern void hwUSB_Configure(USBD_HANDLE_T hUsb, uint32_t cfg);
440
441 extern void hwUSB_ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);
442
443 extern void hwUSB_DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir);
444
445 extern void hwUSB_EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
446
447 extern void hwUSB_DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
448
449 extern void hwUSB_ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
450
451 extern void hwUSB_SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
452
453 extern void hwUSB_ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
454
455 extern ErrorCode_t hwUSB_SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode); /* for FS only devices return ERR_USBD_INVALID_REQ */
456
457 extern uint32_t hwUSB_ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);
458
459 extern uint32_t hwUSB_ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);
460
461 extern uint32_t hwUSB_ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t, uint32_t *);
462
463 extern uint32_t hwUSB_WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);
464
465 /* generate resume signaling on the bus */
466 extern void hwUSB_WakeUp(USBD_HANDLE_T hUsb);
467
468 extern ErrorCode_t hwUSB_EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable);
469
470 /* TODO implement following routines
471 - function to program TD and queue them to ep Qh
472 */
473
476 #endif /* __USBHW_H__ */
ErrorCode_t
ErrorCode_t
Definition: error.h:38
mw_usbd_core.h
ROM API for USB device stack.
USBD_EVENT_T
USBD_EVENT_T
Definition: mw_usbd_hw.h:48
USB_EVT_OUT_DMA_EOT
Definition: mw_usbd_hw.h:56
USB_EVT_SETUP
Definition: mw_usbd_hw.h:49
USB_EVT_IN_DMA_EOT
Definition: mw_usbd_hw.h:57
USB_EVT_OUT_DMA_NDR
Definition: mw_usbd_hw.h:58
USB_EVT_OUT
Definition: mw_usbd_hw.h:50
USB_EVT_IN_DMA_ERR
Definition: mw_usbd_hw.h:61
USB_CORE_DESCS_T
USB descriptors data structure.
Definition: mw_usbd_core.h:119
USB_EVT_RESET
Definition: mw_usbd_hw.h:62
error.h
Error code returned by Boot ROM drivers/library functions.This file contains unified error codes to b...
USB_EVT_DEV_ERROR
Definition: mw_usbd_hw.h:65
USB_EVT_IN_NAK
Definition: mw_usbd_hw.h:53
USB_EVT_IN
Definition: mw_usbd_hw.h:51
USB_EVT_SOF
Definition: mw_usbd_hw.h:63
USB_EVT_OUT_DMA_ERR
Definition: mw_usbd_hw.h:60
mw_usbd.h
Common definitions and declarations for the USB stack.
USB_EVT_IN_DMA_NDR
Definition: mw_usbd_hw.h:59
USB_EVT_OUT_NAK
Definition: mw_usbd_hw.h:52
USB_EVT_DEV_STATE
Definition: mw_usbd_hw.h:64
USB_EVT_OUT_STALL
Definition: mw_usbd_hw.h:54
USBD_HANDLE_T
void * USBD_HANDLE_T
Definition: mw_usbd.h:704
USBD_API_INIT_PARAM_T
USB device stack initialization parameter data structure.
Definition: mw_usbd_core.h:151
USBD_HW_API_T
Hardware API functions structure.This module exposes functions which interact directly with USB devic...
Definition: mw_usbd_hw.h:75
USB_EVT_IN_STALL
Definition: mw_usbd_hw.h:55