⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbd.h

📁 Microsoft WinCE 6.0 BSP FINAL release source code for use with the i.MX27ADS TO2 WCE600_FINAL_MX27_S
💻 H
📖 第 1 页 / 共 2 页
字号:
                             // 1 – Disable the zero length packet on transfers that are equal in length to a multiple Maximum Packet Length.
    unsigned int mult:2;     // This field is used to indicate the number of packets executed per transaction
                             // 00 – Execute N Transactions as demonstrated by the USB variable length packet protocol where N is computed using the Maximum Packet Length (dQH) and the    Total Bytes field (dTD)
                             // 01 – Execute 1 Transaction.
                             // 10 – Execute 2 Transactions.
                             // 11 – Execute 3 Transactions.
                             // Note: Non-ISO endpoints must set Mult=”00”.
                             // Note: ISO endpoints must set Mult=”01”, “10”, or “11” as needed.
                            
    unsigned int r3:5;       // Reserved. Bits reserved for future use and should be set to zero.
    unsigned int curr_dTD:27;// Current dTD. 
                             // This field is a pointer to the dTD that is represented in the transfer overlay area. This field will be modified by the Device Controller to next dTD pointer during endpoint priming or queue advance.
                            
    USBD_dTD_T  dtd;         // Overlay dTD    area                        

    unsigned int r4;         // Reserved. Bits reserved for future use and should be set to zero. for 64 bytes alignment

    //The set-up buffer is dedicated storage for the 8-byte data that follows a set-up PID.
    unsigned int SB0:32;     // Setup Buffer 0. 
                             // This buffer contains bytes 3 to 0 of an incoming setup buffer packet and is written by the device controller to be read by software.
    unsigned int SB1:32;     // Setup Buffer 1. 
                             // This buffer contains bytes 7 to 4 of an incoming setup buffer packet and is written by the device controller to be read by software.
    unsigned int r5[4];      // Reserved. Bits reserved for future use and should be set to zero. for 64 bytes alignment
} USBD_dQH_T, *PUSBD_dQH_T;


//------------------------------------------------------------------------------
//
//  Define:  USBD_IRQ_MASK
//
//  This is composite interrupt mask used in driver.
//  UE | UEE | PCE |URE |SLE | ULPI
//#define USBD_IRQ_MASK  0x547 
// SLE | URE | SEE | PCE | UEE | UE
#define USBD_IRQ_MASK 0x157

#define USBD_EP_NUM                 0x000F          // EP number

#define MAX_PACKET_SIZE    4096
//#define MAX_PACKET_SIZE    8192

#define MAX_SIZE_PER_BP   4096
#define MAX_SIZE_PER_TD   (16 * 1024)

#define USB_MAX_TRANSFER   (256 * 1024)   // 256 k transfers at most
#define USB_MAX_DESC_COUNT ((USB_MAX_TRANSFER / 4096)+1)

//------------------------------------------------------------------------------
//
//  Type:  USBFN_EP
//
//  Internal PDD structure which holds info about endpoint direction, 
//  max packet size and active transfer.
//
typedef struct
{
    WORD maxPacketSize;
    BOOL dirRx;
    BOOL fZeroLengthNeeded;
    
    STransfer *pTransfer;

    BOOL  bPagesLocked;
    LPBYTE pMappedBufPtr;
    DWORD pdwPageList[USB_MAX_DESC_COUNT];  // list of physical pages for transfer buffer
    DWORD dwNextPageIdx;                    // index of next physical page to be used in TD
    DWORD dwNumPages;


} USBFN_EP;


typedef struct _USBFN_QH_BUF
{
    USBD_dQH_T qh[2*USBD_EP_COUNT];
    USBD_dTD_R_T  td[USBD_EP_COUNT*2];
    BOOL bPrimed[USBD_EP_COUNT];  // indicate if it has been primed before CheckEventLost, 
								  // Endpoint 0 IN is used by USBD_EP_COUNT-1
								  // Endpoint 0 OUT is used by 0

    								  // Rest of endpoint have no in and out.
} USBFN_QH_BUF_T;

//------------------------------------------------------------------------------
//
//  Type:  USBFN_PDD
//
//  Internal PDD context structure.
//
typedef struct _USBFN_PDD
{
    DWORD memBase;
    DWORD memLen;
    DWORD priority256;
    DWORD irq;
    
    VOID *pMddContext;
    PFN_UFN_MDD_NOTIFY pfnNotify;

    HANDLE hParentBus;
    CSP_USB_REGS*pUSBDRegs;

    DWORD sysIntr;
    HANDLE hIntrEvent;
    BOOL exitIntrThread;
    HANDLE hIntrThread;
    
    CEDEVICE_POWER_STATE    m_CurPMPowerState;
    CEDEVICE_POWER_STATE    m_CurSelfPowerState;
    CEDEVICE_POWER_STATE    m_CurActualPowerState;
    

    DWORD devState;
    BOOL selfPowered;
    BOOL selfPoweredh;

    CRITICAL_SECTION epCS;
    USBFN_EP *ep[USBD_EP_COUNT];    
    USBFN_EP epf[USBD_EP_COUNT];
    USBFN_EP eph[USBD_EP_COUNT];
    BOOL highspeed;
    UCHAR  addr;

    USBFN_QH_BUF_T * qhbuffer;    
    DWORD         qhbuf_phy;
    BOOL fakeDsChange;                  // To workaround MDD problem
    BOOL NSend0ACK;

    // Add for USB OTG Support
    BOOL IsOTGSupport;
    TCHAR szOTGGroup[15];
    BOOL bInUSBFN;
    BOOL bResume;

	DWORD dwUSBIntrValue;  // USBINTR value to be saved before power down
	BOOL  bUSBCoreClk;     // TRUE - Core Clock running, FALSE - Stop running
	BOOL  bUSBPanicMode;	   // TRUE - Panic Mode (1.65V), FALSE - Non-panic mode
	BOOL  bUSBPanicIntrMask; // Panic Mode Interrupt Mask

    BOOL bEnterTestMode;
    int  iTestMode;

} USBFN_PDD;

extern BOOL HardwareInitialize(CSP_USB_REGS * regs);
extern BOOL HardwarePullupDP(CSP_USB_REGS * regs);
extern DWORD GetSysIntr(void);

#define MAX_RCV_TOTAL_TD 32
#define MAX_RCV_TD 30
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -