📄 usb.h
字号:
//***********************************************************************
// *
// P H I L I P S P R O P R I E T A R Y *
// *
// COPYRIGHT (c) 1999 BY PHILIPS SINGAPORE (APIC). *
// -- ALL RIGHTS RESERVED -- *
// *
// File Name : USB.h *
// Author : Albert Goh *
// Created : 3 March 2000 *
// *
//***********************************************************************
//***********************************************************************
// *
// Module History *
// ************** *
// *
// Date Version Author Changes *
// ==== ======= ====== ======= *
// 030300 0.1 Albert Created *
// *
// *
//***********************************************************************
#define ISO_MODE
#undef BULK_MODE
//#define ENDPT_NUMBER 8
//#define INTERFACE_NO 2
//#define ENDPT_NUMBER 4
// The ENDPT_NUMBER shall set to 4 for Full speed (2-default EPs + 2-alternate EPs).
#define ENDPT_NUMBER 2
// The INTERFACE_NO shall set to 2 for Full speed (1-default setting + 1-alternate setting).
#define INTERFACE_NO 3
// The ENDPT_NUMBER shall set to 8 for High speed.(2-default EPs + 6-alternate EPs).
#define HS_ENDPT_NUMBER 2
// The INTERFACE_NO shall set to 4 for High speed.(1-default setting + 3-alternate setting).
#define HS_INTERFACE_NO 3
//15/05/2002 #define HS_INTERFACE_NO 2
#define SWAP(x) ((((x) & 0xFF) << 8) | (((x) >> 8) & 0xFF))
#define FS_CONFIG_LENGTH sizeof(CONFIGURATION_DESCRIPTOR) + INTERFACE_NO * (sizeof(INTERFACE_DESCRIPTOR) + ENDPT_NUMBER * sizeof(ENDPOINT_DESCRIPTOR))
#define HS_CONFIG_LENGTH sizeof(CONFIGURATION_DESCRIPTOR) + HS_INTERFACE_NO * (sizeof(INTERFACE_DESCRIPTOR) + HS_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 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
}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 + -