00001 /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 00002 * File Name : otgd_fs_pcd.h 00003 * Author : MCD Application Team 00004 * Version : V3.1.1 00005 * Date : 04/07/2010 00006 * Description : Header file of the High Layer device mode interface and 00007 * wrapping layer 00008 ******************************************************************************** 00009 * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 00010 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 00011 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 00012 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 00013 * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 00014 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 00015 *******************************************************************************/ 00016 00017 #ifndef __USB_OTG_PCD_H__ 00018 #define __USB_OTG_PCD_H__ 00019 00020 #include "otgd_fs_regs.h" 00021 00022 #define MAX_EP0_SIZE 0x40 00023 #define MAX_PACKET_SIZE 0x400 00024 00025 00026 #define USB_ENDPOINT_XFER_CONTROL 0 00027 #define USB_ENDPOINT_XFER_ISOC 1 00028 #define USB_ENDPOINT_XFER_BULK 2 00029 #define USB_ENDPOINT_XFER_INT 3 00030 #define USB_ENDPOINT_XFERTYPE_MASK 3 00031 00032 00033 /******************************************************************************** 00034 ENUMERATION TYPE 00035 ********************************************************************************/ 00036 enum usb_device_speed { 00037 USB_SPEED_UNKNOWN = 0, 00038 USB_SPEED_LOW, USB_SPEED_FULL, 00039 USB_SPEED_HIGH 00040 }; 00041 /******************************************************************************** 00042 Data structure type 00043 ********************************************************************************/ 00044 typedef struct usb_ep_descriptor 00045 { 00046 uint8_t bLength; 00047 uint8_t bDescriptorType; 00048 uint8_t bEndpointAddress; 00049 uint8_t bmAttributes; 00050 uint16_t wMaxPacketSize; 00051 uint8_t bInterval; 00052 } 00053 EP_DESCRIPTOR , *PEP_DESCRIPTOR; 00054 /******************************************************************************** 00055 USBF LAYER UNION AND STRUCTURES 00056 ********************************************************************************/ 00057 typedef struct USB_OTG_USBF 00058 { 00059 00060 USB_OTG_EP ep0; 00061 uint8_t ep0state; 00062 USB_OTG_EP in_ep[ MAX_TX_FIFOS - 1]; 00063 USB_OTG_EP out_ep[ MAX_TX_FIFOS - 1]; 00064 } 00065 USB_OTG_PCD_DEV , *USB_OTG_PCD_PDEV; 00066 /******************************************************************************** 00067 EXPORTED FUNCTION FROM THE USB_OTG LAYER 00068 ********************************************************************************/ 00069 void OTGD_FS_PCD_Init(void); 00070 void OTGD_FS_PCD_DevConnect (void); 00071 void OTGD_FS_PCD_DevDisconnect (void); 00072 void OTGD_FS_PCD_EP_SetAddress (uint8_t address); 00073 uint32_t OTGD_FS_PCD_EP_Open(EP_DESCRIPTOR *epdesc); 00074 uint32_t OTGD_FS_PCD_EP_Close ( uint8_t ep_addr); 00075 uint32_t OTGD_FS_PCD_EP_Read ( uint8_t ep_addr, uint8_t *pbuf, uint32_t buf_len); 00076 uint32_t OTGD_FS_PCD_EP_Write ( uint8_t ep_addr, uint8_t *pbuf, uint32_t buf_len); 00077 uint32_t OTGD_FS_PCD_EP_Stall (uint8_t epnum); 00078 uint32_t OTGD_FS_PCD_EP_ClrStall (uint8_t epnum); 00079 uint32_t OTGD_FS_PCD_EP_Flush (uint8_t epnum); 00080 uint32_t OTGD_FS_PCD_Handle_ISR(void); 00081 00082 USB_OTG_EP* OTGD_FS_PCD_GetOutEP(uint32_t ep_num) ; 00083 USB_OTG_EP* OTGD_FS_PCD_GetInEP(uint32_t ep_num); 00084 void OTGD_FS_PCD_EP0_OutStart(void); 00085 00086 #endif 00087 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/