📄 xsusbhostapi.h
字号:
unsigned int PortResetStatus : 1;
unsigned int Reserved1 : 3;
unsigned int PortPowerStatus : 1;
unsigned int LowSpeedDeviceAttached : 1;
unsigned int Reserved2 : 6;
unsigned int ConnectStatusChange : 1;
unsigned int PortEnableStatusChange : 1;
unsigned int PortSuspendStatusChange : 1;
unsigned int PortOverCurrentIndicatorChange : 1;
unsigned int PortResetStatusChange : 1;
unsigned int Reserved3 : 11;
} r;
struct HcRhPortStatusW_S {
#define USB_ClearPortEnable_M (1 << 0)
#define USB_SetPortEnable_M (1 << 1)
#define USB_SetPortSuspend_M (1 << 2)
#define USB_ClearSuspendStatus_M (1 << 3)
#define USB_SetPortReset_M (1 << 4)
#define USB_SetPortPower_M (1 << 8)
#define USB_ClearPortPower_M (1 << 9)
#define USB_ConnectStatusChange_M (1 << 16)
#define USB_PortEnableStatusChange_M (1 << 17)
#define USB_PortSuspendStatusChange_M (1 << 18)
#define USB_PortOverCurrentIndicatorChange_M (1 << 19)
#define USB_PortResetStatusChange_M (1 << 20)
unsigned int ClearPortEnable : 1;
unsigned int SetPortEnable : 1;
unsigned int SetPortSuspend : 1;
unsigned int ClearSuspendStatus : 1;
unsigned int SetPortReset : 1;
unsigned int Reserved1 : 3;
unsigned int SetPortPower : 1;
unsigned int ClearPortPower : 1;
unsigned int Reserved2 : 6;
unsigned int ConnectStatusChange : 1;
unsigned int PortEnableStatusChange : 1;
unsigned int PortSuspendStatusChange : 1;
unsigned int PortOverCurrentIndicatorChange : 1;
unsigned int PortResetStatusChange : 1;
unsigned int Reserved3 : 11;
} w_DoNotUseThis_SeeAbove;
unsigned int d;
} HcRhPortStatus[15];
} USB_HostPortRegs_T;
//The Host Controller Communications Area
typedef struct USB_HostControllerCommunicationArea_S {
union {
unsigned int d;
void * p;
#define USB_HCCA_MAX_INT_LIST 32
} HccaInterruptTable[USB_HCCA_MAX_INT_LIST];
unsigned short HccaFrameNumber;
unsigned short HccaPad1;
union {
unsigned int d;
void * p;
} HccaDoneHead;
unsigned int Reserved[30];
} USB_HostControllerCommunicationArea_T;
// 4.3.3 Completion codes
typedef enum Completion_S {
UsbNoError = 0,
UsbCrcError = 1,
UsbBitStuffingError = 2,
UsbDataToggleMismatchError = 3,
UsbStallError = 4,
UsbDeviceNotRespondingError = 5,
UsbPIDCheckFailureError = 6,
UsbUnexpectedPIDError = 7,
UsbDataOverrunError = 8,
UsbDataUnderrunError = 9,
UsbReservedError = 10,
UsbReservedErrorX = 11,
UsbBufferOverrunError = 12,
UsbBufferUnderrunError = 13,
UsbNotAccessed0 = 14,
UsbNotAccessed = 15
} Completion_T;
// 4.2 End point descriptor. One for each end point in the network. Added
// dynamically as end points are discovered and removed as end points are
// disconnected.
typedef enum USB_DirectionED_E {
UsbEDFromTD = 0,
UsbEDOut = 1,
UsbEDIn = 2,
UsbEDFromTD1 = 3
} USB_DirectionED_T;
typedef enum USB_EndpointTransferType_E {
UsbFormatGeneral = 0,
UsbFormatIsochronous = 1
} USB_EndpointTransferType_T;
typedef enum USB_EndpointSpeedType_E {
UsbHighSpeed = 0,
UsbLowSpeed = 1
} USB_EndpointSpeedType_T;
typedef enum USBD_CompletionReason_E {
USBD_CompletionNormal = 0,
USBD_CompletionHalted
} USBD_CompletionReason_T;
typedef void *USBD_CallbackParam_T;
typedef void (*USBD_CompletionCallback_T)(int reason,
void * tdP,
USBD_CallbackParam_T arg,
int frameNumber);
typedef struct USB_EndpointDescriptor_S {
union {
struct EDControl_S {
unsigned int FunctionAddress : 7;
unsigned int EndpointNumber : 4;
unsigned int Direction : 2;
unsigned int Speed : 1;
unsigned int sKip : 1;
unsigned int Format : 1;
unsigned int MaximumPacketSize : 11;
unsigned int Used : 1; /* Internal use only */
unsigned int EndpointId : 4;
} s;
unsigned int d;
} Control;
volatile union {
struct TailP_S {
unsigned int NA : 4;
unsigned int TailP : 28;
} s;
unsigned int d;
struct USB_TransferDescriptor_S * p;
struct USB_IsoTransferDescriptor_S * ip;
} TailP;
volatile union {
struct HeadP_S {
unsigned int Halted : 1;
unsigned int ToggleCarry : 1;
unsigned int Zero : 2;
unsigned int HeadP : 28;
} s;
unsigned int d;
struct USB_TransferDescriptor_S * p;
struct USB_IsoTransferDescriptor_S * ip;
} HeadP;
volatile union {
struct NextED_S {
unsigned int NA : 4;
unsigned int NextED : 28;
} s;
unsigned int d;
struct USB_EndpointDescriptor_S * p;
} NextED;
// Internal use only, this extension is not used by the HC
unsigned short TotalOutstandingTD;
unsigned short TotalTransferBytes;
unsigned char EndpointId;
unsigned char Reserved1;
unsigned short IsoStartFrame;
USBD_CompletionCallback_T CompletionFunction;
USBD_CallbackParam_T CompletionParam;
} USB_EndpointDescriptor_T;
// 4.3.1 General transfer descriptor. Each represents a message to be sent and
// is queued on the EndPoint Descriptor list.
typedef enum USB_DirectionTD_E {
UsbTDSetup = 0,
UsbTDOut = 1,
UsbTDIn = 2,
UsbTDReserved = 3
} USB_DirectionTD_T;
typedef struct USB_TransferDescriptor_S {
union {
struct TDControl_S {
unsigned int EndpointId : 4; /* Internal use only */
unsigned int Used : 1; /* Internal use only */
unsigned int DataTransfer : 1; /* Internal use only */
unsigned int ByteCount : 10; /* Internal use only */
unsigned int Format : 1; /* Internal use only */
unsigned int LastTD : 1; /* Internal use only */
unsigned int BufferRounding : 1;
unsigned int Direction_PID : 2;
#define USB_NoInterrupt 7
unsigned int DelayInterrupt : 3;
#define USB_SetupToggle 2 /* Force to use DATA0 */
#define USB_DataToggle 0 /* Use running toggle */
#define USB_SetupDataToggle 3 /* Force to use DATA1 */
#define USB_StatusToggle 3 /* Force to use DATA1 */
unsigned int DataToggle : 2;
#define USB_MaxErrorCount 3
unsigned int ErrorCount : 2;
unsigned int ConditionCode : 4;
} s;
unsigned int d;
} Control;
union {
unsigned int d;
void * p;
} CurrentBufferPointer;
union {
struct NextTD_S {
unsigned int NA : 4;
unsigned int NextTD : 28;
} s;
unsigned int d;
struct USB_TransferDescriptor_S * p;
} NextTD;
union {
unsigned int d;
void * p;
} BufferEnd;
} USB_TransferDescriptor_T;
/*
* 4.3.2 Isochronous transfer descriptor. Each represents a message to be
* sent in a specific timeslot (frame) and is queued on the EndPoint
* Descriptor list. Note: The Used bit overlaps the Format bit in the
* General transfer descriptor. The DoneQueue handling function uses this
* to distinguish the two descriptor types. Since all descriptors on the
* DoneQueue are 'Used', Iso descriptors have the format bit set.
*/
typedef struct USB_IsoTransferDescriptor_S {
union {
struct ITDControl_S {
unsigned int StartFrame: 16;
unsigned int Used : 1; /* Internal use only */
unsigned int EndpointId : 4; /* Internal use only */
unsigned int DelayInterrupt : 3;
unsigned int FrameCount : 3;
unsigned int NA : 1;
unsigned int ConditionCode : 4;
} s;
unsigned int d;
} Control;
union {
struct BufferPage_S {
unsigned int NA: 12;
unsigned int BufferPage: 20;
} s;
unsigned int d;
void * p;
} BufferPage0;
union {
struct NextITD_S {
unsigned int NA : 4;
unsigned int NextTD : 28;
} s;
unsigned int d;
struct USB_IsoTransferDescriptor_S * p;
} NextTD;
union {
unsigned int d;
void * p;
} BufferEnd;
#define USB_IsoFrames 8
union {
unsigned short Offset[USB_IsoFrames];
unsigned short PSW[USB_IsoFrames];
} OffsetPSW;
} USB_IsoTransferDescriptor_T;
// Device request types
typedef enum USB_DeviceRequestType_E {
UsbGetStatus = 0,
UsbClearFeature = 1,
UsbReserved2 = 2,
UsbSetFeature = 3,
UsbReserved4 = 4,
UsbSetAddress = 5,
UsbGetDescriptor = 6,
UsbSetDescriptor = 7,
UsbGetConfiguration = 8,
UsbSetConfiguration = 9,
UsbGetInterface = 10,
UsbSetInterface = 11,
UsbSyncFrame = 12
} USB_DeviceRequestType_T;
typedef enum USB_FeatureType_E {
UsbFeatureHalt = 0,
UsbFeatureRemoteWakeup = 1
} USB_FeatureType_T;
typedef enum USB_BmRequestTypeType_E {
UsbReqTypeStandard = 0,
UsbReqTypeClass = 1,
UsbReqTypeVendor = 2,
UsbReqTypeReserved = 3
} USB_BmRequestTypeType_T;
typedef enum USB_BmRequestTypeRecipient_E {
UsbReqTypeDevice = 0,
UsbReqTypeInterface = 1,
UsbReqTypeEndpoint = 2,
UsbReqTypeOther = 3
} USB_BmRequestTypeRecipient_T;
typedef __packed struct USB_DeviceRequest_S {
__packed union { /* 1 byte union */
__packed struct {
unsigned recipient : 5;
unsigned type : 2;
unsigned toHost : 1;
} s;
unsigned char d;
} bmRequestType;
unsigned char bRequest;
__packed union { /* 2 byte union */
__packed struct {
unsigned char index;
unsigned char type;
} desc;
unsigned short d;
} wValue;
__packed union {
unsigned short d;
} wIndex;
unsigned short wLength;
} USB_DeviceRequest_T;
// Descriptor types
typedef enum USB_DescriptorType_E {
UsbDescTypeDevice = 1,
UsbDescTypeConfiguration = 2,
UsbDescTypeString = 3,
UsbDescTypeInterface = 4,
UsbDescTypeEndpoint = 5
} USB_DescriptorType_T;
typedef __packed struct USB_DeviceDescriptor_S {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short bcdUSB;
unsigned char bDeviceClass;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -