📄 usb.h
字号:
/****************************************Copyright (c)**************************************************
** 广州周立功单片机发展有限公司
** 研 究 所
** http://www.zlgmcu.com
**--------------当前版本修订------------------------------------------------------------------------------
** 修改人: 刘英斌
** 日 期:2003-03-13
** 描 述:ISP1581 V1.0
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
//#define ENDPT_NUMBER 8
//#define INTERFACE_NO 2
#define ENDPT_NUMBER 4
#define INTERFACE_NO 1
#define SWAP(x) ((((x) & 0xFF) << 8) | (((x) >> 8) & 0xFF))
#define CONFIG_LENGTH sizeof(CONFIGURATION_DESCRIPTOR) + \
(INTERFACE_NO * sizeof(INTERFACE_DESCRIPTOR)) + \
(ENDPT_NUMBER * sizeof(ENDPOINT_DESCRIPTOR))
typedef struct DEVICE_DESCRIPTOR
{
UC bLength;
UC bDescriptorType;
UI bcdUSB;
UC bDeviceClass;
UC bDeviceSubClass;
UC bDeviceProtocol;
UC bMaxPacketSize0;
UI idVendor;
UI idProduct;
UI bcdDevice;
UC iManufacturer;
UC iProduct;
UC iSerialNumber;
UC bNumConfigurations;
} DEVICE_DESCRIPTOR;
typedef struct HS_DEVICE_QUALIFIER
{
UC bLength; //length of HS Device Descriptor
UC bQualifier; //HS Device Qualifier Type
UI wVersion; // USB 2.0 version
UC bDeviceClass; //Device class
UC bDeviceSubClasss; //Device SubClass
UC bProtocol; //Device Protocol Code
UC MaxPktSize; //Maximum Packet SIze for other speed
UC bOther_Config; //Number of Other speed configurations
UC Reserved; //Reserved
}HS_DEVICE_QUALIFIER;
typedef struct CONFIGURATION_DESCRIPTOR
{
UC bLength;
UC bDescriptorType;
UI wTotalLength;
UC bNumInterfaces;
UC bConfigurationValue;
UC iConfiguration;
UC bmAttributes;
UC MaxPower;
} CONFIGURATION_DESCRIPTOR;
typedef struct OTHER_SPEED_CONFIG_DESCRIPTOR
{
UC bLength; //length of other speed configuration descriptor
UC bDescriptorType; //Other speed configuration Type
UI bTotalLength; //Total length
UC No_Interface; //No of interface supported
UC Configuration_Value; //Configuration Value
UC String_Index_Descriptor; //Index of string descriptor
UC Config_Characteristic; //Configurations Characteristic
UC Max_Power; //Maximun Power
}OTHER_SPEED_CONFIG_DESCRIPTOR;
typedef struct INTERFACE_DESCRIPTOR
{
UC bLength;
UC bDescriptorType;
UC bInterfaceNumber;
UC bAlternateSetting;
UC bNumEndpoints;
UC bInterfaceClass;
UC bInterfaceSubClass;
UC bInterfaceProtocol;
UC iInterface;
} INTERFACE_DESCRIPTOR;
typedef struct ENDPOINT_DESCRIPTOR
{
UC bLength;
UC bDescriptorType;
UC bEndpointAddress;
UC bmAttributes;
UI wMaxPacketSize;
UC bInterval;
} ENDPOINT_DESCRIPTOR;
typedef struct STRING_ID
{
UC bLength;
UC bDescriptorType;
UC bString[2];
} STRING_ID;
typedef struct STRING_DESCRIPTOR
{
UC bLength;
UC bDescriptorType;
UC bString[30];
} STRING_DESCRIPTOR;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -