29 #ifndef __USB_CORE_H__ 30 #define __USB_CORE_H__ 52 #define USB_OTG_EP0_IDLE 0 53 #define USB_OTG_EP0_SETUP 1 54 #define USB_OTG_EP0_DATA_IN 2 55 #define USB_OTG_EP0_DATA_OUT 3 56 #define USB_OTG_EP0_STATUS_IN 4 57 #define USB_OTG_EP0_STATUS_OUT 5 58 #define USB_OTG_EP0_STALL 6 60 #define USB_OTG_EP_TX_DIS 0x0000 61 #define USB_OTG_EP_TX_STALL 0x0010 62 #define USB_OTG_EP_TX_NAK 0x0020 63 #define USB_OTG_EP_TX_VALID 0x0030 65 #define USB_OTG_EP_RX_DIS 0x0000 66 #define USB_OTG_EP_RX_STALL 0x1000 67 #define USB_OTG_EP_RX_NAK 0x2000 68 #define USB_OTG_EP_RX_VALID 0x3000 72 #define MAX_DATA_LENGTH 0x200 191 uint8_t *(*GetDeviceDescriptor)( uint8_t
speed , uint16_t *length);
192 uint8_t *(*GetLangIDStrDescriptor)( uint8_t
speed , uint16_t *length);
193 uint8_t *(*GetManufacturerStrDescriptor)( uint8_t
speed , uint16_t *length);
194 uint8_t *(*GetProductStrDescriptor)( uint8_t
speed , uint16_t *length);
195 uint8_t *(*GetSerialStrDescriptor)( uint8_t
speed , uint16_t *length);
196 uint8_t *(*GetConfigurationStrDescriptor)( uint8_t
speed , uint16_t *length);
197 uint8_t *(*GetInterfaceStrDescriptor)( uint8_t
speed , uint16_t *length);
203 uint8_t (*
Init) (
void *pdev , uint8_t cfgidx);
204 uint8_t (*
DeInit) (
void *pdev , uint8_t cfgidx);
210 uint8_t (*DataIn) (
void *pdev , uint8_t epnum);
211 uint8_t (*DataOut) (
void *pdev , uint8_t epnum);
212 uint8_t (*SOF) (
void *pdev);
213 uint8_t (*IsoINIncomplete) (
void *pdev);
214 uint8_t (*IsoOUTIncomplete) (
void *pdev);
216 uint8_t *(*GetConfigDescriptor)( uint8_t
speed , uint16_t *length);
217 #ifdef USB_OTG_HS_CORE 218 uint8_t *(*GetOtherConfigDescriptor)( uint8_t
speed , uint16_t *length);
221 #ifdef USB_SUPPORT_USER_STRING_DESC 222 uint8_t *(*GetUsrStrDescriptor)( uint8_t
speed ,uint8_t index, uint16_t *length);
233 void (*DeviceConfigured)(void);
234 void (*DeviceSuspended)(void);
235 void (*DeviceResumed)(void);
237 void (*DeviceConnected)(void);
238 void (*DeviceDisconnected)(void);
255 uint8_t setup_packet [8*3];
291 #ifdef USE_DEVICE_MODE 369 #ifdef USE_DEVICE_MODE struct _Device_TypeDef * pUSBD_DEVICE
uint8_t * pConfig_descriptor
struct USB_OTG_hc USB_OTG_HC
USB_OTG_STS USB_OTG_PhyInit(USB_OTG_CORE_HANDLE *pdev)
static uint8_t DeInit(uint32_t options)
DeInit Free all resources used by low layer and stops audio-play function.
struct USB_OTG_ep USB_OTG_EP
USB_OTG_STS USB_OTG_SetCurrentMode(USB_OTG_CORE_HANDLE *pdev, uint8_t mode)
USB_OTG_SetCurrentMode : Set ID line.
__IO uint32_t PortEnabled
static uint8_t Init(uint32_t AudioFreq, uint32_t Volume, uint32_t options)
Init Initialize and configures all required resources for audio play function.
#define USB_OTG_MAX_TX_FIFOS
USB_OTG_STS USB_OTG_DisableGlobalInt(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_DisableGlobalInt Enables the controller's Global Int in the AHB Config reg.
struct USB_OTG_hc * PUSB_OTG_HC
struct _HCD * USB_OTG_USBH_PDEV
USB_OTG_STS USB_OTG_FlushRxFifo(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_FlushRxFifo : Flush a Rx FIFO.
uint8_t device_old_status
USB_OTG_STS USB_OTG_FlushTxFifo(USB_OTG_CORE_HANDLE *pdev, uint32_t num)
USB_OTG_FlushTxFifo : Flush a Tx FIFO.
USB_OTG_STS USB_OTG_SelectCore(USB_OTG_CORE_HANDLE *pdev, USB_OTG_CORE_ID_TypeDef coreID)
USB_OTG_SelectCore Initialize core registers address.
struct USB_OTG_core_cfg * PUSB_OTG_CORE_CFGS
void * USB_OTG_ReadPacket(USB_OTG_CORE_HANDLE *pdev, uint8_t *dest, uint16_t len)
USB_OTG_ReadPacket : Reads a packet from the Rx FIFO.
uint32_t USB_OTG_GetMode(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_GetMode : Get current mode.
static uint8_t EP0_TxSent(void *pdev)
EP0_TxSent Handles the DFU control endpoint data IN stage.
uint8_t connection_status
uint32_t USB_OTG_ReadOtgItr(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_ReadOtgItr : returns the USB_OTG Interrupt register.
USBD_Usr_cb_TypeDef * usr_cb
struct _USBD_USR_PROP USBD_Usr_cb_TypeDef
uint32_t USB_OTG_ReadCoreItr(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_ReadCoreItr : returns the Core Interrupt register.
struct USB_OTG_handle USB_OTG_CORE_HANDLE
struct _Device_TypeDef USBD_DEVICE
USB_OTG_STS USB_OTG_EnableGlobalInt(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_EnableGlobalInt Enables the controller's Global Int in the AHB Config reg.
Header of the Core Layer.
struct USB_OTG_core_cfg USB_OTG_CORE_CFGS
General low level driver configuration.
struct _Device_cb USBD_Class_cb_TypeDef
static uint8_t EP0_RxReady(void *pdev)
EP0_RxReady Handles the DFU control endpoint data OUT stage.
USBD_Class_cb_TypeDef * class_cb
uint8_t USB_OTG_IsDeviceMode(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_IsDeviceMode : Check if it is device mode.
uint8_t USB_OTG_IsHostMode(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_IsHostMode : Check if it is host mode.
struct USB_OTG_ep * PUSB_OTG_EP
struct usb_setup_req USB_SETUP_REQ
struct USB_OTG_handle * PUSB_OTG_CORE_HANDLE
struct _OTG * USB_OTG_USBO_PDEV
USB_OTG_STS USB_OTG_CoreInit(USB_OTG_CORE_HANDLE *pdev)
USB_OTG_CoreInit Initializes the USB_OTG controller registers and prepares the core device mode or ho...
USB_OTG_STS USB_OTG_WritePacket(USB_OTG_CORE_HANDLE *pdev, uint8_t *src, uint8_t ch_ep_num, uint16_t len)
USB_OTG_WritePacket : Writes a packet into the Tx FIFO associated with the EP.