⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s3c2510usb.h

📁 S3c2510下的VXWORKS的BSP源代码(包括了以太网、串口、USB等等驱动)
💻 H
字号:
/* s3c2510Usb.h - SAMSUNG S3C2510 USB header */

/* Copyright 2002 SAMSUNG ELECTRONICS */

/*
modification history
--------------------
01a,22apr02,jmLee   created.
*/


#ifndef __INCs3c2510Usbh
#define __INCs3c2510Usbh

#ifdef  __cplusplus
extern "C" {
#endif


/* USB Definitions */

#undef  USB_EP1_IN                                          /* Endpoint 0 is OUT Mode */
#define USB_EP2_IN                                          /* Endpoint 0 is IN Mode */
#undef  USB_EP3_IN                                          /* Endpoint 0 is OUT Mode */
#define USB_EP4_IN                                          /* Endpoint 0 is IN Mode */

#define USB_MAX_ENDPOINT                4                   /* Maximum Endpoint, exclude Control */

#define USB_DEVICE_CLASS                USB_CLASS_RESERVED  /* USB Device Class */
#define USB_DEVICE_SUBCLASS             0                   /* USB Device Sub-Class */
#define USB_DEVICE_PROTOCOL             0                   /* USB Device Protocol */

#define USB_EP0_MAXP_SIZE               64                  /* Endpoint 0 MAXP_SIZE */
#define USB_EP1_MAXP_SIZE               32                  /* Endpoint 1 MAXP_SIZE */
#define USB_EP2_MAXP_SIZE               32                  /* Endpoint 2 MAXP_SIZE */
#define USB_EP3_MAXP_SIZE               64                  /* Endpoint 3 MAXP_SIZE */
#define USB_EP4_MAXP_SIZE               64                  /* Endpoint 4 MAXP_SIZE */

#define USB_EP1_TYPE                    USB_ENDPOINT_TYPE_INTERRUPT /* Endpoint 1 Type */
#define USB_EP2_TYPE                    USB_ENDPOINT_TYPE_INTERRUPT /* Endpoint 2 Type */
#define USB_EP3_TYPE                    USB_ENDPOINT_TYPE_BULK      /* Endpoint 3 Type */
#define USB_EP4_TYPE                    USB_ENDPOINT_TYPE_BULK      /* Endpoint 4 Type */

#define USB_EP1_INTERVAL                2                   /* Endpoint 1 Interval, 2ms */
#define USB_EP2_INTERVAL                10                  /* Endpoint 2 Interval, 10ms */
#define USB_EP3_INTERVAL                0                   /* Endpoint 3 Interval, 0 for Bulk */
#define USB_EP4_INTERVAL                0                   /* Endpoint 4 Interval, 0 for Bulk */

#define USB_RELEASE                     0x0100              /* USB Release, 1.00 */
#define USB_VENDOR_ID                   0x0419              /* Vendor ID */
#define USB_PRODUCT_ID                  0x0130              /* Product ID */
#define USB_DEVICE_RELEASE              0x0100              /* Device Release, 1.00 */


#if     (_BYTE_ORDER == _BIG_ENDIAN)

#define FROM_LITTLEW(w)                 (MSB((w)) | (LSB((w)) << 8))
#define FROM_LITTLEL(l)                 (LONGSWAP((l)))
#define FROM_BIGW(w)                    (w)
#define FROM_BIGL(l)                    (l)

#else

#define FROM_LITTLEW(w)                 (w)
#define FROM_LITTLEL(l)                 (l)
#define FROM_BIGW(w)                    (MSB((w)) | (LSB((w)) << 8))
#define FROM_BIGL(l)                    (LONGSWAP((l)))

#endif

#define TO_LITTLEW(w)                   FROM_LITTLEW((w))
#define TO_LITTLEL(l)                   FROM_LITTLEL((l))
#define TO_BIGW(w)                      FROM_BIGW((w))
#define TO_BIGL(w)                      FROM_BIGL((l))


/* USB 1.0 Specifications */

#define MAXIMUM_USB_STRING_LENGTH       255

/* USB Device Classes */

#define USB_CLASS_RESERVED              0x00
#define USB_CLASS_AUDIO                 0x01
#define USB_CLASS_COMMUNICATIONS        0x02
#define USB_CLASS_HUMAN_INTERFACE       0x03
#define USB_CLASS_MONITOR               0x04
#define USB_CLASS_PHYSICAL_INTERFACE    0x05
#define USB_CLASS_POWER                 0x06
#define USB_CLASS_PRINTER               0x07
#define USB_CLASS_STORAGE               0x08
#define USB_CLASS_HUB                   0x09
#define USB_CLASS_VENDOR_SPECIFIC       0xFF

/* USB Request Codes */

#define USB_REQUEST_GET_STATUS          0x00
#define USB_REQUEST_CLEAR_FEATURE       0x01
#define USB_REQUEST_GET_STATE           0x02
#define USB_REQUEST_SET_FEATURE         0x03
#define USB_REQUEST_SET_ADDRESS         0x05
#define USB_REQUEST_GET_DESCRIPTOR      0x06
#define USB_REQUEST_SET_DESCRIPTOR      0x07
#define USB_REQUEST_GET_CONFIGURATION   0x08
#define USB_REQUEST_SET_CONFIGURATION   0x09
#define USB_REQUEST_GET_INTERFACE       0x0A
#define USB_REQUEST_SET_INTERFACE       0x0B
#define USB_REQUEST_SYNC_FRAME          0x0C

/* Endpoint Direction Bit, stored in Address */

#define USB_ENDPOINT_DIRECTION_MASK     0x80
#define     USB_ENDPOINT_DIRECTION_OUT	    0x00
#define     USB_ENDPOINT_DIRECTION_IN	    0x80

/* USB requestType (bmRequestType) bit fields */

#define USB_RT_DIRECTION_MASK           0x80
#define     USB_RT_HOST_TO_DEV              0x00
#define     USB_RT_DEV_TO_HOST              0x80
#define USB_RT_CATEGORY_MASK            0x60
#define     USB_RT_STANDARD                 0x00
#define     USB_RT_CLASS                    0x20
#define     USB_RT_VENDOR                   0x40
#define     USB_RT_RESERVED                 0x60
#define USB_RT_RECIPIENT_MASK           0x03
#define     USB_RT_DEVICE                   0x00
#define     USB_RT_INTERFACE                0x01
#define     USB_RT_ENDPOINT                 0x02
#define     USB_RT_OTHER                    0x03

/* USB Descriptor Types */

#define USB_DESCRIPTOR_DEVICE	        0x01
#define USB_DESCRIPTOR_CONFIGURATION    0x02
#define USB_DESCRIPTOR_STRING	        0x03
#define USB_DESCRIPTOR_INTERFACE	    0x04
#define USB_DESCRIPTOR_ENDPOINT	        0x05
#define USB_DESCRIPTOR_RESERVED         0x06
#define USB_DESCRIPTOR_CONFIG_POWER     0x07
#define USB_DESCRIPTOR_INTERFACE_POWER  0x08
#define USB_DESCRIPTOR_HID		        0x21
#define USB_DESCRIPTOR_REPORT	        0x22
#define USB_DESCRIPTOR_PHYSICAL	        0x23
#define USB_DESCRIPTOR_HUB		        0x29

#define USB_DESCRIPTOR_TYPE_SHIFT       8
#define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((UINT16)((USHORT)d<<8 | i))

/* Definitions for bits in the bmAttributes field of a Configuration Descriptor. */

#define USB_CONFIG_POWERED_MASK         0xc0
#define     USB_CONFIG_BUS_POWERED          0x80
#define     USB_CONFIG_SELF_POWERED         0x40
#define     USB_CONFIG_REMOTE_WAKEUP        0x20

/* Definitions for bits in the bmAttributes field of an Endpoint Descriptor */

#define USB_ENDPOINT_TYPE_MASK          0x03
#define     USB_ENDPOINT_TYPE_CONTROL       0x00
#define     USB_ENDPOINT_TYPE_ISOCHRONOUS   0x01
#define     USB_ENDPOINT_TYPE_BULK          0x02
#define     USB_ENDPOINT_TYPE_INTERRUPT     0x03

/* USB Core defined Feature Selectors */

#define USB_FEATURE_ENDPOINT_STALL      0x0000
#define USB_FEATURE_REMOTE_WAKEUP       0x0001

/* USB DWG defined Feature Selectors */

#define USB_FEATURE_INTERFACE_POWER_D0  0x0002
#define USB_FEATURE_INTERFACE_POWER_D1  0x0003
#define USB_FEATURE_INTERFACE_POWER_D2  0x0004
#define USB_FEATURE_INTERFACE_POWER_D3  0x0005

/* USB Device Status */
#define USB_DEV_STATUS_SELF_POWERED     0x01
#define USB_DEV_STATUS_REMOTE_WAKEUP    0x02

/* USB Endpoint Status */
#define USB_EP_STATUS_HALT              0x01

typedef struct _USB_SETUP {
    UINT8   bmRequestType;
    UINT8   bRequest;
    UINT16  wValue;
    UINT16  wIndex;
    UINT16  wLength;
} USB_SETUP, *PUSB_SETUP;

#define USB_SETUP_LEN                   8

typedef struct _USB_STANDARD_STATUS {
    UINT16  status;
} USB_STANDARD_STATUS, *PUSB_STANDARD_STATUS;

#define USB_STANDARD_STATUS_LEN         2

typedef struct _USB_DEVICE_DESCRIPTOR {
    UINT8   bLength;
    UINT8   bDescriptorType;
    UINT16  bcdUSB;
    UINT8   bDeviceClass;
    UINT8   bDeviceSubClass;
    UINT8   bDeviceProtocol;
    UINT8   bMaxPacketSize0;
    UINT16  idVendor;
    UINT16  idProduct;
    UINT16  bcdDevice;
    UINT8   iManufacturer;
    UINT8   iProduct;
    UINT8   iSerialNumber;
    UINT8   bNumConfigurations;
} USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;

#define USB_DEVICE_DESCR_LEN            18

typedef struct _USB_CONFIGURATION_DESCRIPTOR {
    UINT8   bLength;
    UINT8   bDescriptorType;
    UINT16  wTotalLength;
    UINT8   bNumInterfaces;
    UINT8   bConfigurationValue;
    UINT8   iConfiguration;
    UINT8   bmAttributes;
    UINT8   MaxPower;
} USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;

#define USB_CONFIG_DESCR_LEN            9

typedef struct _USB_INTERFACE_DESCRIPTOR {
    UINT8   bLength;
    UINT8   bDescriptorType;
    UINT8   bInterfaceNumber;
    UINT8   bAlternateSetting;
    UINT8   bNumEndpoints;
    UINT8   bInterfaceClass;
    UINT8   bInterfaceSubClass;
    UINT8   bInterfaceProtocol;
    UINT8   iInterface;
} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;

#define USB_INTERFACE_DESCR_LEN         9

typedef struct _USB_ENDPOINT_DESCRIPTOR {
    UINT8   bLength;
    UINT8   bDescriptorType;
    UINT8   bEndpointAddress;
    UINT8   bmAttributes;
    UINT16  wMaxPacketSize;
    UINT8   bInterval;
} USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;

#define USB_ENDPOINT_DESCR_LEN          7

typedef struct _USB_LANGUAGE_DESCRIPTOR {
    UCHAR   bLength;
    UCHAR   bDescriptorType;
    UINT16  wLANGID[1];
} USB_LANGUAGE_DESCRIPTOR, *PUSB_LANGUAGE_DESCRIPTOR;

typedef struct _USB_STRING_DESCRIPTOR {
    UCHAR   bLength;
    UCHAR   bDescriptorType;
    UINT16  bString[1];
} USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;

typedef struct _USB_COMMON_DESCRIPTOR {
    UCHAR   bLength;
    UCHAR   bDescriptorType;
} USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;


/* Function Prototypes */

#if defined(__STDC__) || defined(__cplusplus)

IMPORT STATUS   s3c2510UsbInit(void);


#else  /* defined(__STDC__) || defined(__cplusplus) */

IMPORT STATUS   s3c2510UsbInit();

#endif  /* defined(__STDC__) || defined(__cplusplus) */


#ifdef __cplusplus
}
#endif

#endif  /* __INCs3c2510Usbh */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -