📄 usbmain.pp
字号:
/* is a linked list */
/* to fill up the data buffer with */
/* to max packet size before sending */
/* or receiving a data packet */
/* ends when the end of the linked */
/* list reached */
/******************************************************************************/
/* Symbolic constants for USB interrupt Events */
/* */
/* USB_EVENT_EOT is not an actual hardware interrupt, this */
/* flag is set by the USB event dispatcher to indicate the completion */
/* of the last requested data transfer. */
/* */
/******************************************************************************/
/*-------------5/16/00 4:00PM---------------*/
/* -----------01/05/01 $MH$---------------- */
/************************************************/
/* */
/* Enumerated Data Types */
/* */
/************************************************/
/****************************11/24/00 $MH$*************************************/
/* */
/* USB Endpoints */
/* */
/* These values are use by the CSL GUI or the USB API to initialize the */
/* USB Endpoint Objects */
/* */
/******************************************************************************/
typedef enum
{ /* OUT ENDPOINTS */
USB_OUT_EP0 = 0x00, /* Out Endpoint 0 - Control Out Endpoint */
USB_OUT_EP1 = 0x01, /* Out Endpoint 1 */
USB_OUT_EP2 = 0x02, /* Out Endpoint 2 */
USB_OUT_EP3 = 0x03, /* Out Endpoint 3 */
USB_OUT_EP4 = 0x04, /* Out Endpoint 4 */
USB_OUT_EP5 = 0x05, /* Out Endpoint 5 */
USB_OUT_EP6 = 0x06, /* Out Endpoint 6 */
USB_OUT_EP7 = 0x07, /* Out Endpoint 7 */
/* IN ENDPOINTS */
USB_IN_EP0 = 0x08, /* In Endpoint 0 - Control In Endpoint */
USB_IN_EP1 = 0x09, /* In Endpoint 1 */
USB_IN_EP2 = 0x0A, /* In Endpoint 2 */
USB_IN_EP3 = 0x0B, /* In Endpoint 3 */
USB_IN_EP4 = 0x0C, /* In Endpoint 4 */
USB_IN_EP5 = 0x0D, /* In Endpoint 5 */
USB_IN_EP6 = 0x0E, /* In Endpoint 6 */
USB_IN_EP7 = 0x0F /* In Endpoint 7 */
}USB_EpNum;
/****************************11/24/00 $MH$*************************************/
/* */
/* USB Transfer Tytes */
/* */
/* These values are use by the CSL GUI or the USB API to initialize the */
/* USB Endpoint Objects */
/* */
/******************************************************************************/
typedef enum
{
USB_CTRL = 0x00, /* Endpoint functions as control endpint */
USB_BULK = 0x01, /* Endpoint functions as bulk endpint */
USB_INTR = 0x02, /* Endpoint functions as interrupt endpint */
USB_ISO = 0x03, /* Endpoint functions as isochronous endpint */
USB_HPORT = 0x04 /* Endpoint functions as Host Port - special */
/* feature - not a part USB spec */
}USB_XferType;
/****************************11/24/00 $MH$*************************************/
/* */
/* USB device number - only useful if multiple exists on the */
/* same DSP. Currently only USB0 supported. Used by Device Control, */
/* Status Query and Data Transfer APIs */
/* */
/******************************************************************************/
typedef enum
{
USB0 = 0x00, /* 1st USB module - */
USB1 = 0x01, /* 2nd USB module - if the DSP support 2 USB module */
USB2 = 0x02 /* 3rd USB module - if the DSP support 3 USB module */
}USB_DevNum;
/****************************01/15/01 $MH$*************************************/
/* */
/* USB EP0 data dir type enumeration, used for setting and clearing */
/* DIR bit of USB Control Register (USBCTL).Used by Device Control macro */
/* USB_SET_EP0_DATA_DIR(DevNun, DataDir) */
/* */
/******************************************************************************/
typedef enum
{
EP0_DATA_OUT = 0x00, /* Endpoint0 data dir: Host -> Target */
EP0_DATA_IN = 0x01 /* Endpoint0 data dir: Target -> host */
} USB_EP0DataDir;
/******************************************************************************/
/* */
/* USB_BOOLEAN */
/* */
/******************************************************************************/
typedef enum
{
USB_FALSE = 0,
USB_TRUE
}USB_Boolean;
/************************************************/
/* */
/* USB Data Structures */
/* */
/************************************************/
/****************************01/15/01 $MH$*************************************/
/* */
/* USB_SetupStruct */
/* Data structure to hold USB setup packet. Used by USB API */
/* USB_getSetupPacket(USB_DevNum DevNum, USB_SetupStruct *USB_Setup) */
/* */
/******************************************************************************/
typedef struct
{
int New; /* New = 1, structure holds new setup packet */
Uint16 bmRequestType; /* Byte 0 of setup packet */
Uint16 bRequest; /* Byte 1 of setup packet */
Uint16 wValue; /* Byte 2 and 3 of setup packet */
Uint16 wIndex; /* Byte 4 and 5 setup packet */
Uint16 wLength; /* Byte 6 and 7 of setup packet */
}USB_SetupStruct;
/****************************01/15/01 $MH$*************************************/
/* */
/* USB_DataStruct */
/* Structure used by the USB Data Transfer API to send and received */
/* USB data in linked list form. USB Descriptors should be created as a */
/* linked list of USB_DataStruct type */
/* */
/******************************************************************************/
typedef struct USB_DataStructDef
{
Uint16 Bytes; /* Total number of bytes in the buf */
Uint16 *pBuffer; /* pointer to the start of buffer */
struct USB_DataStructDef *pNextBuffer; /* pointer to the next structure */
}USB_DataStruct;
/******************************************************************************/
/* */
/* USB_EVENT_ISR */
/* Type definition for USB Event ISR pointer */
/* */
/******************************************************************************/
typedef void (*USB_EVENT_ISR)();
/******************************************************************************/
/* */
/* USB_EvISR_NONE */
/* NULL pointer for USB Event ISR */
/* */
/******************************************************************************/
/******************************02/08/01 $MH$***********************************/
/* */
/* Data Structure for USB Enpoint Object */
/* Every active USB endpoint is associated with an endpoint object which */
/* keeps track of the endpoint related initialization and runtime information*/
/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -