?? usb.h
字號:
#if 0
#define Usb_set_STALLRQ() (UEPSTAX |= 0x20)
/* USB Driver */
#define USB_PU_CTRL FALSE /* no pull-up control */
#define VENDOR_ID 0xEB03 /* Atmel vendor ID = 03EBh */
#define PRODUCT_ID 0x0220 /* Atmel Product ID: 2002h */
#define RELEASE_NUMBER 0x0001
#define MSK_EP_DIR 0x7F
#define REQUEST_DEVICE_STATUS 0x80
#define REQUEST_INTERFACE_STATUS 0x81
#define REQUEST_ENDPOINT_STATUS 0x82
#define ENDPOINT_0 0x00
#define ENDPOINT_1 0x81
#define ENDPOINT_2 0x02
#define ZERO_TYPE 0x00
#define INTERFACE_TYPE 0x01
#define ENDPOINT_TYPE 0x02
/* mass storage define */
#define FREE 0x00
#define Usb_set_STALLRQ() (UEPSTAX |= MSK_STALLRQ)
#define Usb_clear_STALLRQ() (UEPSTAX &= ~MSK_STALLRQ)
#define Usb_clear_STALLED() (UEPSTAX &= ~MSK_STALLED)
#define Usb_STALL_requested() (UEPSTAX & MSK_STALLRQ)
#define Usb_STALL_sent() (UEPSTAX & MSK_STALLED)
#define Usb_set_no_data_phase() (no_data_phase = 1)
#define Usb_clear_no_data_phase() (no_data_phase = 0)
/* USB Mass Storage ! unicode char */
#define USB_MANUFACTURER_NAME {'A'<<8,'T'<<8,'M'<<8,'E'<<8,'L'<<8}
#define USB_MN_LENGTH 5
#define USB_PRODUCT_NAME {'S'<<8,'N'<<8,'D'<<8,'1'<<8,' '<<8,'S'<<8,'t'<<8,\
'o'<<8,'r'<<8,'a'<<8,'g'<<8,'e'<<8}
#define USB_PN_LENGTH 12
#define USB_SERIAL_NUMBER {'4'<<8,'7'<<8,'1'<<8,'0'<<8,'7'<<8,'6'<<8,'5'<<8,\
'0'<<8,'6'<<8,'6'<<8,'4'<<8,'5'<<8,'1'<<8}
#define USB_SN_LENGTH 13
/* SCSI Mass Storage */
#define SBC_VENDOR_ID {'G','e','n','e','r','i','c',' '}
#define SBC_PRODUCT_ID {'S','N','D','1',' ','M','P','3',' ','P','l','a','y','e','r',' '}
#define SBC_REVISION_ID {'0','.','0','0'}
/*_____ M A C R O S ________________________________________________________*/
#define CONTROL 0x80
#define BULK_IN 0x86
#define BULK_OUT 0x82
#define INTERRUPT_IN 0x87
#define INTERRUPT_OUT 0x83
#define ISOCHRONOUS_IN 0x85
#define ISOCHRONOUS_OUT 0x81
#define BULK_MAX_SIZE ((Byte)64)
#define GET_DEVICE_DESCRIPTOR 1
#define GET_CONFIGURATION_DESCRIPTOR 4
/*_____ S T A N D A R D R E Q U E S T S __________________________________*/
#define GET_STATUS 0x00
#define GET_DEVICE 0x01
#define CLEAR_FEATURE 0x01 /* see FEATURES below */
#define GET_STRING 0x03
#define SET_FEATURE 0x03 /* see FEATURES below */
#define SET_ADDRESS 0x05
#define GET_DESCRIPTOR 0x06
#define SET_DESCRIPTOR 0x07
#define GET_CONFIGURATION 0x08
#define SET_CONFIGURATION 0x09
#define GET_INTERFACE 0x0A
#define SET_INTERFACE 0x0B
#define SYNC_FRAME 0x0C
#define GET_MAX_LUN 0xFE
#define MASS_STORAGE_RESET 0xFF
/*_____ D E S C R I P T O R T Y P E S ____________________________________*/
#define DEVICE 0x01
#define CONFIGURATION 0x02
#define STRING 0x03
#define INTERFACE 0x04
#define ENDPOINT 0x05
#define LANG_ID 0x00
#define MAN_INDEX 0x01
#define PROD_INDEX 0x02
#define SN_INDEX 0x03
/*_____ S T A N D A R D F E A T U R E S __________________________________*/
#define DEVICE_REMOTE_WAKEUP_FEATURE 0x01
#define ENDPOINT_HALT_FEATURE 0x00
/*_____ D E V I C E S T A T U S ___________________________________________*/
#define SELF_POWERED 1
/*_____ D E V I C E S T A T E _____________________________________________*/
#define ATTACHED 0
#define POWERED 1
#define DEFAULT 2
#define ADDRESSED 3
#define CONFIGURED 4
#define SUSPENDED 5
#define USB_CONFIG_BUSPOWERED 0x80
#define USB_CONFIG_SELFPOWERED 0x40
#define USB_CONFIG_REMOTEWAKEUP 0x20
/*_____ M A S S S T O R A G E E N D P O I N T S _________________________*/
#define EP_CONTROL 0x00
#define EP_IN 0x01
#define EP_OUT 0x02
#define EP_CONTROL_LENGTH 8
#define EP_IN_LENGTH 64
#define EP_OUT_LENGTH 64
/*_________________________________________________________ S T R U C T _____*/
/*_____ U S B D E V I C E R E Q U E S T _________________________________*/
struct Endpoint_information_st
{
Uint16 fifo_size ; /* size of the endpoint FIFO */
Uint16 fifo_left ;
};
struct USB_request_st
{
Byte bmRequestType; /* Characteristics of the request */
Byte bRequest; /* Specific request */
Uint16 wValue; /* field that varies according to request */
Uint16 wIndex; /* field that varies according to request */
Uint16 wLength; /* Number of bytes to transfer if Data */
};
/*_____ U S B D E V I C E D E S C R I P T O R ___________________________*/
struct usb_st_device_descriptor
{
Byte bLength; /* Size of this descriptor in bytes */
Byte bDescriptorType; /* DEVICE descriptor type */
Uint16 bscUSB; /* Binay Coded Decimal Spec. release */
Byte bDeviceClass; /* Class code assigned by the USB */
Byte bDeviceSubClass; /* Sub-class code assigned by the USB */
Byte bDeviceProtocol; /* Protocol code assigned by the USB */
Byte bMaxPacketSize0; /* Max packet size for EP0 */
Uint16 idVendor; /* Vendor ID. ATMEL = 0x03EB */
Uint16 idProduct; /* Product ID assigned by the manufacturer */
Uint16 bcdDevice; /* Device release number */
Byte iManufacturer; /* Index of manu. string descriptor */
Byte iProduct; /* Index of prod. string descriptor */
Byte iSerialNumber; /* Index of S.N. string descriptor */
Byte bNumConfigurations; /* Number of possible configurations */
};
/*_____ U S B C O N F I G U R A T I O N D E S C R I P T O R _____________*/
struct usb_st_configuration_descriptor
{
Byte bLength; /* size of this descriptor in bytes */
Byte bDescriptorType; /* CONFIGURATION descriptor type */
Uint16 wTotalLength; /* total length of data returned */
Byte bNumInterfaces; /* number of interfaces for this conf. */
Byte bConfigurationValue; /* value for SetConfiguration resquest */
Byte iConfiguration; /* index of string descriptor */
Byte bmAttibutes; /* Configuration characteristics */
Byte MaxPower; /* maximum power consumption */
};
/*_____ U S B M A N U F A C T U R E R D E S C R I P T O R _______________*/
struct usb_st_manufacturer
{
Byte bLength; /* size of this descriptor in bytes */
Byte bDescriptorType; /* STRING descriptor type */
Uint16 wstring[USB_MN_LENGTH];/* unicode characters */
};
/*_____ U S B P R O D U C T D E S C R I P T O R _________________________*/
struct usb_st_product
{
Byte bLength; /* size of this descriptor in bytes */
Byte bDescriptorType; /* STRING descriptor type */
Uint16 wstring[USB_PN_LENGTH];/* unicode characters */
};
/*_____ U S B S E R I A L N U M B E R D E S C R I P T O R _____________*/
struct usb_st_serial_number
{
Byte bLength; /* size of this descriptor in bytes */
Byte bDescriptorType; /* STRING descriptor type */
Uint16 wstring[USB_SN_LENGTH];/* unicode characters */
};
/*_____ U S B L A N G U A G E D E S C R I P T O R ______________________*/
struct usb_st_language_descriptor
{
Byte bLength; /* size of this descriptor in bytes */
Byte bDescriptorType; /* STRING descriptor type */
Uint16 wlangid; /* language id */
};
/*_____ U S B I N T E R F A C E D E S C R I P T O R _____________________*/
struct usb_st_interface_descriptor
{
Byte bLength; /* size of this descriptor in bytes */
Byte bDescriptorType; /* INTERFACE descriptor type */
Byte bInterfaceNumber; /* Number of interface */
Byte bAlternateSetting; /* value to select alternate setting */
Byte bNumEndpoints; /* Number of EP except EP 0 */
Byte bInterfaceClass; /* Class code assigned by the USB */
Byte bInterfaceSubClass; /* Sub-class code assigned by the USB */
Byte bInterfaceProtocol; /* Protocol code assigned by the USB */
Byte iInterface; /* Index of string descriptor */
};
/*_____ U S B E N D P O I N T D E S C R I P T O R _______________________*/
struct usb_st_endpoint_descriptor
{
Byte bLength; /* Size of this descriptor in bytes */
Byte bDescriptorType; /* ENDPOINT descriptor type */
Byte bEndpointAddress; /* Address of the endpoint */
Byte bmAttributes; /* Endpoint's attributes */
Uint16 wMaxPacketSize; /* Maximum packet size for this EP */
Byte bInterval; /* Interval for polling EP in ms */
};
/*_____ U S B L I T T L E E N D I A N <--> B I G E N D I A N _________*/
extern bdata bit bmCBWFlag7;
extern bdata bit status_ready;
extern data Byte status;
extern bdata bit rx_bank;
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -