📄 xsusb.h
字号:
VUINT32 RESERVED1[31];
VUINT32 UDDR2; // 64 bytes FIFO starts at 0x4060 0180
VUINT32 RESERVED2[31];
VUINT32 UDDR3; // 256 bytes FIFO starts at 0x4060 0200
VUINT32 RESERVED3[127];
VUINT32 UDDR4; // 256 bytes FIFO starts at 0x4060 0400
VUINT32 RESERVED4[127];
VUINT32 UDDR6; // 64 bytes FIFO starts at 0x4060 0600
VUINT32 RESERVED6[31];
VUINT32 UDDR7; // 64 bytes FIFO starts at 0x4060 0680
VUINT32 RESERVED7[31];
VUINT32 UDDR8; // 256 bytes FIFO starts at 0x4060 0700
VUINT32 RESERVED8[127];
VUINT32 UDDR9; // 256 bytes FIFO starts at 0x4060 0900
VUINT32 RESERVED9[127];
VUINT32 UDDR11; // 64 bytes FIFO starts at 0x4060 0b00
VUINT32 RESERVED11[31];
VUINT32 UDDR12; // 64 bytes FIFO starts at 0x4060 0b80
VUINT32 RESERVED12[31];
VUINT32 UDDR13; // 256 bytes FIFO starts at 0x4060 0c00
VUINT32 RESERVED13[127];
VUINT32 UDDR14; // 256 bytes FIFO starts at 0x4060 0e00
} UdcRegsT;
// Enumerate Endpoints
typedef enum UdcEndpointsE
{
Endpoint0 = 0,
Endpoint1,
Endpoint2,
Endpoint3,
Endpoint4,
Endpoint5,
Endpoint6,
Endpoint7,
Endpoint8,
Endpoint9,
Endpoint10,
Endpoint11,
Endpoint12,
Endpoint13,
Endpoint14,
Endpoint15
} UdcEndpointsT;
// Enumerate EP0 State machine
typedef enum EP0StateE
{
EP0_IdleState = 0,
EP0_OutDataState,
EP0_InDataState,
EP0_EndXferState
} EP0StateT;
// Enumerate Request types
typedef enum RequestTypeE
{
StandardReq = 0x00,
ClassReq = 0x01,
VendorReq = 0x02
} RequestTypeT;
// Enumerate Standard Request types value
typedef enum UsbStandardReqTypeE
{
GetStatusId = 0x00,
ClearFeatureId = 0x01,
SetFeatureId = 0x03,
SetAddressId = 0x05,
GetDescriptorId = 0x06,
SetDescriptorId = 0x07,
GetConfigurationId = 0x08,
SetConfigurationId =0x09,
GetInterfaceId = 0x0a,
SetInterfaceId = 0x0b,
SynchFrameId = 0x0c
} UsbStandardReqTypeT;
// Descriptor types
typedef enum UDCDescriptorTypeE
{
UsbDescTypeDevice = 0x01,
UsbDescTypeConfiguration = 0x02,
UsbDescTypeString = 0x03,
UsbDescTypeInterface =0x04,
UsbDescTypeEndpoint = 0x05
} UDCDescriptorTypeT;
// Usb transfer types
typedef enum UDCTransferTypeE {
UsbControl = 0,
UsbIsochronous = 1,
UsbBulk = 2,
UsbInterrupt = 3
} UDCTransferTypeT;
// Vendor Requests
typedef enum UdcVendorReqTypeE {
UsbSetupInEp = 0x01,
UsbSetupOutEp = 0x02,
UsbSetupIntEp = 0x03,
UsbSetupLoopback = 0x04
} UdcVendorReqTypeT;
typedef struct UdcSetupDataS
{
UCHAR bmRequestType;
UCHAR bRequest;
UINT16 wValue;
UINT16 wIndex;
UINT16 wLength;
} UdcSetupDataT;
// Enumerate Interrupt Sources
typedef enum UdcRSRIntE
{
ResetInt = 0x40,
SuspendInt = 0x10,
ResumeInt = 0x08,
SOFInt = 0x80
} UdcRSRInt;
// Enumerate Endpoints Interrupt Sources
typedef enum UdcEP07IntE
{
EP0Int = 0x01,
EP1Int = 0x02,
EP2Int = 0x04,
EP3Int = 0x08,
EP4Int = 0x10,
EP5Int = 0x20,
EP6Int = 0x40,
EP7Int = 0x80
} UdcEP07IntT;
// Enumerate Endpoints Interrupt Sources
typedef enum UdcEP815IntE
{
EP8Int = 0x01,
EP9Int = 0x02,
EP10Int = 0x04,
EP11Int = 0x08,
EP12Int = 0x10,
EP13Int = 0x20,
EP14Int = 0x40,
EP15Int = 0x80
} UdcEP815IntT;
// Enumerate Client Configurations
typedef enum UdcConfigE
{
EP1EP2_64 = 1,
EP3EP4_256 = 2,
EP5_8 = 3
} UdcConfigT;
// UDC interface
typedef UINT32 (*UdcSetupT) (void * ctxP);
typedef UINT32 (*UdcCleanupT) (void * ctxP);
// UDC Interrupt statistics structure
typedef struct UdcIntCountS
{
INT ResetAssertCount;
INT ResetNegateCount;
INT SuspendCount;
INT ResumeCount;
INT SOFCount;
INT EPIntCount[NUM_EP];
INT EPPackets;
INT EPShortPackets;
INT EPZeroPackets;
UINT RegDbg[UDC_DEBUG_TOTAL];
PUINT RegDbgP;
UINT TotalCapturedCnt;
} UdcIntCountT;
// UDC transaction structure
typedef struct UdcXferElementsS
{
XsDmaDescriptorElementsT * firstDescVtP;
PCHAR EPDataP;
INT dmaChannel;
INT xferLength;
INT xferDataCounter;
INT maxPacketSize;
INT xferComplete;
INT enableLoopback;
} UdcXferElementsT;
// UDC Context Structure
typedef struct UdcContextS {
UdcRegsT * regsP; // Pointer to UDC's register base
UINT32 loggedError; // Used to report tests and drivers errors
UdcIntCountT * intCountP; // Used to keep track ot the interrupts statistics
UdcXferElementsT EPXferTable[NUM_EP]; // Used to support the transfers
INT configNum; // Used to pass a user selected configuration
INT interfaceNum; // Used to pass a user selected interface
INT enableDma; // Used by the tests to select DMA for bulk and ISO transfers
INT enableSOF; // The SOF interrupt can be selected to service ISO transfer
INT setupComplete; // Used by the tests to tell the HOST to start enumeration
INT enumerateComplete; // Used by the tests to track the complition of the enumerate command
INT cableAttached; // Used by the tests to monitor the cable attachment and disconnect
XsIcL1IntHandlerFnPT intHandlerUdcFnP; // Pointer to UDC's interrupt handler
} UdcContextT;
/*
************************************************************************************
* GLOBAL VARIABLES
************************************************************************************
*/
EXTRN UdcContextT UsbDeviceController;
/*
************************************************************************************
* FUNCTION PROTOTYPES
************************************************************************************
*/
VOID XsUdcSWInit (VOID);
UINT32 XsUdcHWSetup (VOID);
UINT32 XsUdcHWShutdown (VOID);
UINT XsUdcGetFrameNumber (UdcRegsT * regsP);
VOID XsUdcDumpStatistics (PUINT buffP, PUINT totalCaptured);
UINT32 XsUdcFreeMemory (UdcContextT * ctxP);
#undef EXTRN
#endif /* _xsusb_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -