]> git.sur5r.net Git - armstart-ibdap/blobdiff - inc/usbd/usbd_hw.h
initial commit
[armstart-ibdap] / inc / usbd / usbd_hw.h
diff --git a/inc/usbd/usbd_hw.h b/inc/usbd/usbd_hw.h
new file mode 100644 (file)
index 0000000..b7e0f10
--- /dev/null
@@ -0,0 +1,457 @@
+/***********************************************************************\r
+* $Id:: mw_usbd_hw.h 331 2012-08-09 18:54:34Z usb10131                        $\r
+*\r
+* Project: USB device ROM Stack\r
+*\r
+* Description:\r
+*     USB Hardware Function prototypes.\r
+*\r
+***********************************************************************\r
+*   Copyright(C) 2011, NXP Semiconductor\r
+*   All rights reserved.\r
+*\r
+* Software that is described herein is for illustrative purposes only\r
+* which provides customers with programming information regarding the\r
+* products. This software is supplied "AS IS" without any warranties.\r
+* NXP Semiconductors assumes no responsibility or liability for the\r
+* use of the software, conveys no license or title under any patent,\r
+* copyright, or mask work right to the product. NXP Semiconductors\r
+* reserves the right to make changes in the software without\r
+* notification. NXP Semiconductors also make no representation or\r
+* warranty that such application will be suitable for the specified\r
+* use without further testing or modification.\r
+**********************************************************************/\r
+#ifndef __USBHW_H__\r
+#define __USBHW_H__\r
+\r
+#include "error.h"\r
+#include "usbd.h"\r
+#include "usbd_core.h"\r
+\r
+/** \file\r
+ *  \brief USB Hardware Function prototypes.\r
+ *\r
+ *  Definition of functions exported by ROM based Device Controller Driver (DCD).\r
+ *\r
+ */\r
+\r
+/** \ingroup Group_USBD\r
+ *  @defgroup USBD_HW USB Device Controller Driver \r
+ *  \section Sec_HWModDescription Module Description\r
+ *  The Device Controller Driver Layer implements the routines to deal directly with the hardware. \r
+ */\r
+\r
+/** \ingroup USBD_HW\r
+*  USB Endpoint/class handler Callback Events. \r
+* \r
+*/\r
+enum USBD_EVENT_T {\r
+  USB_EVT_SETUP =1,    /**< 1   Setup Packet received */\r
+  USB_EVT_OUT,         /**< 2   OUT Packet received */\r
+  USB_EVT_IN,          /**< 3    IN Packet sent */\r
+  USB_EVT_OUT_NAK,     /**< 4   OUT Packet - Not Acknowledged */\r
+  USB_EVT_IN_NAK,      /**< 5    IN Packet - Not Acknowledged */\r
+  USB_EVT_OUT_STALL,   /**< 6   OUT Packet - Stalled */\r
+  USB_EVT_IN_STALL,    /**< 7    IN Packet - Stalled */\r
+  USB_EVT_OUT_DMA_EOT, /**< 8   DMA OUT EP - End of Transfer */\r
+  USB_EVT_IN_DMA_EOT,  /**< 9   DMA  IN EP - End of Transfer */\r
+  USB_EVT_OUT_DMA_NDR, /**< 10  DMA OUT EP - New Descriptor Request */\r
+  USB_EVT_IN_DMA_NDR,  /**< 11  DMA  IN EP - New Descriptor Request */\r
+  USB_EVT_OUT_DMA_ERR, /**< 12  DMA OUT EP - Error */\r
+  USB_EVT_IN_DMA_ERR,  /**< 13  DMA  IN EP - Error */\r
+  USB_EVT_RESET,       /**< 14  Reset event recieved */\r
+  USB_EVT_SOF,         /**< 15  Start of Frame event */\r
+  USB_EVT_DEV_STATE,   /**< 16  Device status events */\r
+  USB_EVT_DEV_ERROR   /**< 17  Device error events */\r
+};\r
+\r
+/** \r
+ *  \brief Hardware API functions structure.\r
+ *  \ingroup USBD_HW\r
+ *\r
+ *  This module exposes functions which interact directly with USB device controller hardware.\r
+ *\r
+ */\r
+typedef struct USBD_HW_API\r
+{\r
+  /** \fn uint32_t GetMemSize(USBD_API_INIT_PARAM_T* param)\r
+   *  Function to determine the memory required by the USB device stack's DCD and core layers.\r
+   * \r
+   *  This function is called by application layer before calling pUsbApi->hw->Init(), to allocate memory used\r
+   *  by DCD and core layers. The application should allocate the memory which is accessible by USB\r
+   *  controller/DMA controller. \r
+   *  \note Some memory areas are not accessible by all bus masters.\r
+   *\r
+   *  \param[in] param Structure containing USB device stack initialization parameters.\r
+   *  \return Returns the required memory size in bytes.\r
+   */\r
+  uint32_t (*GetMemSize)(USBD_API_INIT_PARAM_T* param);\r
+  \r
+  /** \fn ErrorCode_t Init(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param)\r
+   *  Function to initialize USB device stack's DCD and core layers.\r
+   * \r
+   *  This function is called by application layer to initialize USB hardware and core layers. \r
+   *  On successful initialization the function returns a handle to USB device stack which should\r
+   *  be passed to the rest of the functions.  \r
+   *\r
+   *  \param[in,out] phUsb Pointer to the USB device stack handle of type USBD_HANDLE_T. \r
+   *  \param[in]  pDesc Structure containing pointers to various descriptor arrays needed by the stack.\r
+   *                    These descriptors are reported to USB host as part of enumerations process.\r
+   *  \param[in]  param Structure containing USB device stack initialization parameters.\r
+   *  \return Returns \ref ErrorCode_t type to indicate success or error condition.\r
+   *          \retval LPC_OK(0) On success\r
+   *          \retval ERR_USBD_BAD_MEM_BUF(0x0004000b) When insufficient memory buffer is passed or memory\r
+   *                                             is not aligned on 2048 boundary.\r
+   */\r
+  ErrorCode_t (*Init)(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param);\r
+  \r
+  /** \fn void Connect(USBD_HANDLE_T hUsb, uint32_t con)\r
+   *  Function to make USB device visible/invisible on the USB bus.\r
+   *\r
+   *  This function is called after the USB initialization. This function uses the soft connect\r
+   *  feature to make the device visible on the USB bus. This function is called only after the\r
+   *  application is ready to handle the USB data. The enumeration process is started by the\r
+   *  host after the device detection. The driver handles the enumeration process according to\r
+   *  the USB descriptors passed in the USB initialization function.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] con  States whether to connect (1) or to disconnect (0).\r
+   *  \return Nothing.\r
+   */\r
+  void (*Connect)(USBD_HANDLE_T hUsb, uint32_t con);\r
+  \r
+  /** \fn void ISR(USBD_HANDLE_T hUsb)\r
+   *  Function to USB device controller interrupt events.\r
+   *  \r
+   *  When the user application is active the interrupt handlers are mapped in the user flash\r
+   *  space. The user application must provide an interrupt handler for the USB interrupt and\r
+   *  call this function in the interrupt handler routine. The driver interrupt handler takes\r
+   *  appropriate action according to the data received on the USB bus. \r
+   *  \r
+   *  \param[in]  hUsb Handle to the USB device stack. \r
+   *  \return Nothing.\r
+   */\r
+  void (*ISR)(USBD_HANDLE_T hUsb);\r
+\r
+  /** \fn void Reset(USBD_HANDLE_T hUsb)\r
+   *  Function to Reset USB device stack and hardware controller.\r
+   *  \r
+   *  Reset USB device stack and hardware controller. Disables all endpoints except EP0.\r
+   *  Clears all pending interrupts and resets endpoint transfer queues.\r
+   *  This function is called internally by pUsbApi->hw->init() and from reset event.\r
+   *  \r
+   *  \param[in]  hUsb Handle to the USB device stack. \r
+   *  \return Nothing.\r
+   */\r
+  void  (*Reset)(USBD_HANDLE_T hUsb);\r
+  \r
+  /** \fn void ForceFullSpeed(USBD_HANDLE_T hUsb, uint32_t cfg)\r
+   *  Function to force high speed USB device to operate in full speed mode.\r
+   *\r
+   *  This function is useful for testing the behavior of current device when connected\r
+   *  to a full speed only hosts.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] cfg  When 1 - set force full-speed or \r
+   *                       0 - clear force full-speed.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*ForceFullSpeed )(USBD_HANDLE_T hUsb, uint32_t cfg);\r
+  \r
+  /** \fn void WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t cfg)\r
+   *  Function to configure USB device controller to wake-up host on remote events.\r
+   *\r
+   *  This function is called by application layer to configure the USB device controller \r
+   *  to wakeup on remote events. It is recommended to call this function from users's \r
+   *  USB_WakeUpCfg() callback routine registered with stack. \r
+   *  \note User's USB_WakeUpCfg() is registered with stack by setting the USB_WakeUpCfg member \r
+   *  of USBD_API_INIT_PARAM_T structure before calling pUsbApi->hw->Init() routine.\r
+   *  Certain USB device controllers needed to keep some clocks always on to generate \r
+   *  resume signaling through pUsbApi->hw->WakeUp(). This hook is provided to support \r
+   *  such controllers. In most controllers cases this is an empty routine.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] cfg  When 1 - Configure controller to wake on remote events or \r
+   *                       0 - Configure controller not to wake on remote events.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*WakeUpCfg)(USBD_HANDLE_T hUsb, uint32_t  cfg);\r
+  \r
+  /** \fn void SetAddress(USBD_HANDLE_T hUsb, uint32_t adr)\r
+   *  Function to set USB address assigned by host in device controller hardware.\r
+   *\r
+   *  This function is called automatically when USB_REQUEST_SET_ADDRESS request is received  \r
+   *  by the stack from USB host.\r
+   *  This interface is provided to users to invoke this function in other scenarios which are not \r
+   *  handle by current stack. In most user applications this function is not called directly.\r
+   *  Also this function can be used by users who are selectively modifying the USB device stack's \r
+   *  standard handlers through callback interface exposed by the stack. \r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] adr  USB bus Address to which the device controller should respond. Usually \r
+   *                  assigned by the USB host.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*SetAddress)(USBD_HANDLE_T hUsb, uint32_t adr);\r
+\r
+  /** \fn void Configure(USBD_HANDLE_T hUsb, uint32_t cfg)\r
+   *  Function to configure device controller hardware with selected configuration.\r
+   *\r
+   *  This function is called automatically when USB_REQUEST_SET_CONFIGURATION request is received  \r
+   *  by the stack from USB host.\r
+   *  This interface is provided to users to invoke this function in other scenarios which are not \r
+   *  handle by current stack. In most user applications this function is not called directly.\r
+   *  Also this function can be used by users who are selectively modifying the USB device stack's \r
+   *  standard handlers through callback interface exposed by the stack. \r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] cfg  Configuration index. \r
+   *  \return Nothing.\r
+   */\r
+  void  (*Configure)(USBD_HANDLE_T hUsb, uint32_t  cfg);\r
+\r
+  /** \fn void ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD)\r
+   *  Function to configure USB Endpoint according to descriptor.\r
+   *\r
+   *  This function is called automatically when USB_REQUEST_SET_CONFIGURATION request is received  \r
+   *  by the stack from USB host. All the endpoints associated with the selected configuration\r
+   *  are configured.\r
+   *  This interface is provided to users to invoke this function in other scenarios which are not \r
+   *  handle by current stack. In most user applications this function is not called directly.\r
+   *  Also this function can be used by users who are selectively modifying the USB device stack's \r
+   *  standard handlers through callback interface exposed by the stack. \r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] pEPD Endpoint descriptor structure defined in USB 2.0 specification.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*ConfigEP)(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);\r
+\r
+  /** \fn void DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir)\r
+   *  Function to set direction for USB control endpoint EP0.\r
+   *\r
+   *  This function is called automatically by the stack on need basis.\r
+   *  This interface is provided to users to invoke this function in other scenarios which are not \r
+   *  handle by current stack. In most user applications this function is not called directly.\r
+   *  Also this function can be used by users who are selectively modifying the USB device stack's \r
+   *  standard handlers through callback interface exposed by the stack. \r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] cfg  When 1 - Set EP0 in IN transfer mode \r
+   *                       0 - Set EP0 in OUT transfer mode\r
+   *  \return Nothing.\r
+   */\r
+  void  (*DirCtrlEP)(USBD_HANDLE_T hUsb, uint32_t dir);\r
+\r
+  /** \fn void EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum)\r
+   *  Function to enable selected USB endpoint.\r
+   *\r
+   *  This function enables interrupts on selected endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*EnableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+\r
+  /** \fn void DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum)\r
+   *  Function to disable selected USB endpoint.\r
+   *\r
+   *  This function disables interrupts on selected endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*DisableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+\r
+  /** \fn void ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum)\r
+   *  Function to reset selected USB endpoint.\r
+   *\r
+   *  This function flushes the endpoint buffers and resets data toggle logic.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \return Nothing.\r
+  */\r
+  void  (*ResetEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+\r
+  /** \fn void SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum)\r
+   *  Function to STALL selected USB endpoint.\r
+   *\r
+   *  Generates STALL signaling for requested endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*SetStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+\r
+  /** \fn void ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum)\r
+   *  Function to clear STALL state for the requested endpoint.\r
+   *\r
+   *  This function clears STALL state for the requested endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \return Nothing.\r
+   */\r
+  void  (*ClrStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+\r
+  /** \fn ErrorCode_t SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode)\r
+   *  Function to set high speed USB device controller in requested test mode.\r
+   *\r
+   *  USB-IF requires the high speed device to be put in various test modes\r
+   *  for electrical testing. This USB device stack calls this function whenever\r
+   *  it receives USB_REQUEST_CLEAR_FEATURE request for USB_FEATURE_TEST_MODE. \r
+   *  Users can put the device in test mode by directly calling this function.\r
+   *  Returns ERR_USBD_INVALID_REQ when device controller is full-speed only.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] mode  Test mode defined in USB 2.0 electrical testing specification.\r
+   *  \return Returns \ref ErrorCode_t type to indicate success or error condition.\r
+   *          \retval LPC_OK(0) - On success\r
+   *          \retval ERR_USBD_INVALID_REQ(0x00040001) - Invalid test mode or \r
+   *                                             Device controller is full-speed only.\r
+   */\r
+  ErrorCode_t (*SetTestMode)(USBD_HANDLE_T hUsb, uint8_t mode); \r
+\r
+  /** \fn uint32_t ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData)\r
+   *  Function to read data received on the requested endpoint.\r
+   *\r
+   *  This function is called by USB stack and the application layer to read the data\r
+   *  received on the requested endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \param[in,out] pData Pointer to the data buffer where data is to be copied. \r
+   *  \return Returns the number of bytes copied to the buffer.\r
+   */\r
+  uint32_t (*ReadEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);\r
+\r
+  /** \fn uint32_t ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len)\r
+   *  Function to queue read request on the specified endpoint.\r
+   *\r
+   *  This function is called by USB stack and the application layer to queue a read request\r
+   *  on the specified endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \param[in,out] pData Pointer to the data buffer where data is to be copied. This buffer\r
+   *                       address should be accessible by USB DMA master.\r
+   *  \param[in] len  Length of the buffer passed. \r
+   *  \return Returns the length of the requested buffer.\r
+   */\r
+  uint32_t (*ReadReqEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);\r
+\r
+  /** \fn uint32_t ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData)\r
+   *  Function to read setup packet data received on the requested endpoint.\r
+   *\r
+   *  This function is called by USB stack and the application layer to read setup packet data\r
+   *  received on the requested endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP0_IN is represented by 0x80 number.\r
+   *  \param[in,out] pData Pointer to the data buffer where data is to be copied. \r
+   *  \return Returns the number of bytes copied to the buffer.\r
+   */\r
+  uint32_t (*ReadSetupPkt)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData);\r
+\r
+  /** \fn uint32_t WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt)\r
+   *  Function to write data to be sent on the requested endpoint.\r
+   *\r
+   *  This function is called by USB stack and the application layer to send data\r
+   *  on the requested endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number as per USB specification. \r
+   *                    ie. An EP1_IN is represented by 0x81 number.\r
+   *  \param[in] pData Pointer to the data buffer from where data is to be copied. \r
+   *  \param[in] cnt  Number of bytes to write. \r
+   *  \return Returns the number of bytes written.\r
+   */\r
+  uint32_t (*WriteEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);\r
+\r
+  /** \fn void WakeUp(USBD_HANDLE_T hUsb)\r
+   *  Function to generate resume signaling on bus for remote host wakeup.\r
+   *\r
+   *  This function is called by application layer to remotely wakeup host controller \r
+   *  when system is in suspend state. Application should indicate this remote wakeup\r
+   *  capability by setting USB_CONFIG_REMOTE_WAKEUP in bmAttributes of Configuration \r
+   *  Descriptor. Also this routine will generate resume signalling only if host\r
+   *  enables USB_FEATURE_REMOTE_WAKEUP by sending SET_FEATURE request before suspending\r
+   *  the bus.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \return Nothing.\r
+   */\r
+  void  (*WakeUp)(USBD_HANDLE_T hUsb);\r
+\r
+  /** \fn void EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable)\r
+   *  Function to enable/disable selected USB event.\r
+   *\r
+   *  This function enables interrupts on selected endpoint.\r
+   *  \r
+   *  \param[in] hUsb Handle to the USB device stack. \r
+   *  \param[in] EPNum  Endpoint number corresponding to the event.\r
+   *                    ie. An EP1_IN is represented by 0x81 number. For device events \r
+   *                    set this param to 0x0. \r
+   *  \param[in] event_type  Type of endpoint event. See \ref USBD_EVENT_T for more details.\r
+   *  \param[in] enable  1 - enable event, 0 - disable event.\r
+   *  \return Returns \ref ErrorCode_t type to indicate success or error condition.\r
+   *          \retval LPC_OK(0) - On success\r
+   *          \retval ERR_USBD_INVALID_REQ(0x00040001) - Invalid event type.\r
+   */\r
+  ErrorCode_t  (*EnableEvent)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable);\r
+\r
+} USBD_HW_API_T;\r
+\r
+/*-----------------------------------------------------------------------------\r
+ *  Private functions & structures prototypes used by stack internally\r
+ *-----------------------------------------------------------------------------*/\r
+/** @cond  DIRECT_API */\r
+\r
+/* Driver functions */\r
+uint32_t hwUSB_GetMemSize(USBD_API_INIT_PARAM_T* param);\r
+ErrorCode_t hwUSB_Init(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param);\r
+void hwUSB_Connect(USBD_HANDLE_T hUsb, uint32_t con);\r
+void hwUSB_ISR(USBD_HANDLE_T hUsb);\r
+\r
+/* USB Hardware Functions */\r
+extern void  hwUSB_Reset(USBD_HANDLE_T hUsb);\r
+extern void  hwUSB_ForceFullSpeed (USBD_HANDLE_T hUsb, uint32_t con);\r
+extern void  hwUSB_WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t  cfg);\r
+extern void  hwUSB_SetAddress(USBD_HANDLE_T hUsb, uint32_t adr);\r
+extern void  hwUSB_Configure(USBD_HANDLE_T hUsb, uint32_t  cfg);\r
+extern void  hwUSB_ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);\r
+extern void  hwUSB_DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir);\r
+extern void  hwUSB_EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+extern void  hwUSB_DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+extern void  hwUSB_ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+extern void  hwUSB_SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+extern void  hwUSB_ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);\r
+extern ErrorCode_t hwUSB_SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode); /* for FS only devices return ERR_USBD_INVALID_REQ */\r
+extern uint32_t hwUSB_ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);\r
+extern uint32_t hwUSB_ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);\r
+extern uint32_t hwUSB_ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t, uint32_t *);\r
+extern uint32_t hwUSB_WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);\r
+\r
+/* generate resume signaling on the bus */\r
+extern void  hwUSB_WakeUp(USBD_HANDLE_T hUsb);\r
+extern ErrorCode_t  hwUSB_EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable);\r
+/* TODO implement following routines\r
+- function to program TD and queue them to ep Qh\r
+*/\r
+\r
+/** @endcond */\r
+\r
+\r
+#endif  /* __USBHW_H__ */\r