📄 ehci.h
字号:
#define QTD_STS_HALT (1 << 6) /* halted on error */#define QTD_STS_DBE (1 << 5) /* data buffer error (in HC) */#define QTD_STS_BABBLE (1 << 4) /* device was babbling (qtd halted) */#define QTD_STS_XACT (1 << 3) /* device gave illegal response */#define QTD_STS_MMF (1 << 2) /* incomplete split transaction */#define QTD_STS_STS (1 << 1) /* split transaction state */#define QTD_STS_PING (1 << 0) /* issue PING? */ u32 hw_buf [5]; /* see EHCI 3.5.4 */ u32 hw_buf_hi [5]; /* Appendix B */ /* the rest is HCD-private */ dma_addr_t qtd_dma; /* qtd address */ struct list_head qtd_list; /* sw qtd list */ struct urb *urb; /* qtd's urb */ size_t length; /* length of buffer */} __attribute__ ((aligned (32)));#define QTD_MASK cpu_to_le32 (~0x1f) /* mask NakCnt+T in qh->hw_alt_next *//*-------------------------------------------------------------------------*//* type tag from {qh,itd,sitd,fstn}->hw_next */#define Q_NEXT_TYPE(dma) ((dma) & __constant_cpu_to_le32 (3 << 1))/* values for that type tag */#define Q_TYPE_ITD __constant_cpu_to_le32 (0 << 1)#define Q_TYPE_QH __constant_cpu_to_le32 (1 << 1)#define Q_TYPE_SITD __constant_cpu_to_le32 (2 << 1)#define Q_TYPE_FSTN __constant_cpu_to_le32 (3 << 1)/* next async queue entry, or pointer to interrupt/periodic QH */#define QH_NEXT(dma) (cpu_to_le32(((u32)dma)&~0x01f)|Q_TYPE_QH)/* for periodic/async schedules and qtd lists, mark end of list */#define EHCI_LIST_END __constant_cpu_to_le32(1) /* "null pointer" to hw *//* * Entries in periodic shadow table are pointers to one of four kinds * of data structure. That's dictated by the hardware; a type tag is * encoded in the low bits of the hardware's periodic schedule. Use * Q_NEXT_TYPE to get the tag. * * For entries in the async schedule, the type tag always says "qh". */union ehci_shadow { struct ehci_qh *qh; /* Q_TYPE_QH */ struct ehci_itd *itd; /* Q_TYPE_ITD */ struct ehci_sitd *sitd; /* Q_TYPE_SITD */ struct ehci_fstn *fstn; /* Q_TYPE_FSTN */ void *ptr;};/*-------------------------------------------------------------------------*//* * EHCI Specification 0.95 Section 3.6 * QH: describes control/bulk/interrupt endpoints * See Fig 3-7 "Queue Head Structure Layout". * * These appear in both the async and (for interrupt) periodic schedules. */struct ehci_qh { /* first part defined by EHCI spec */ u32 hw_next; /* see EHCI 3.6.1 */ u32 hw_info1; /* see EHCI 3.6.2 */#define QH_HEAD 0x00008000 u32 hw_info2; /* see EHCI 3.6.2 */ u32 hw_current; /* qtd list - see EHCI 3.6.4 */ /* qtd overlay (hardware parts of a struct ehci_qtd) */ u32 hw_qtd_next; u32 hw_alt_next; u32 hw_token; u32 hw_buf [5]; u32 hw_buf_hi [5]; /* the rest is HCD-private */ dma_addr_t qh_dma; /* address of qh */ union ehci_shadow qh_next; /* ptr to qh; or periodic */ struct list_head qtd_list; /* sw qtd list */ struct ehci_qtd *dummy; struct ehci_qh *reclaim; /* next to reclaim */ atomic_t refcount; unsigned stamp; u8 qh_state;#define QH_STATE_LINKED 1 /* HC sees this */#define QH_STATE_UNLINK 2 /* HC may still see this */#define QH_STATE_IDLE 3 /* HC doesn't see this */#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on reclaim q */#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */ /* periodic schedule info */ u8 usecs; /* intr bandwidth */ u8 gap_uf; /* uframes split/csplit gap */ u8 c_usecs; /* ... split completion bw */ unsigned short period; /* polling interval */ unsigned short start; /* where polling starts */#define NO_FRAME ((unsigned short)~0) /* pick new start */} __attribute__ ((aligned (32)));/*-------------------------------------------------------------------------*//* * EHCI Specification 0.95 Section 3.3 * Fig 3-4 "Isochronous Transaction Descriptor (iTD)" * * Schedule records for high speed iso xfers */struct ehci_itd { /* first part defined by EHCI spec */ u32 hw_next; /* see EHCI 3.3.1 */ u32 hw_transaction [8]; /* see EHCI 3.3.2 */#define EHCI_ISOC_ACTIVE (1<<31) /* activate transfer this slot */#define EHCI_ISOC_BUF_ERR (1<<30) /* Data buffer error */#define EHCI_ISOC_BABBLE (1<<29) /* babble detected */#define EHCI_ISOC_XACTERR (1<<28) /* XactErr - transaction error */#define EHCI_ITD_LENGTH(tok) (((tok)>>16) & 0x7fff)#define EHCI_ITD_IOC (1 << 15) /* interrupt on complete */ u32 hw_bufp [7]; /* see EHCI 3.3.3 */ u32 hw_bufp_hi [7]; /* Appendix B */ /* the rest is HCD-private */ dma_addr_t itd_dma; /* for this itd */ union ehci_shadow itd_next; /* ptr to periodic q entry */ struct urb *urb; struct list_head itd_list; /* list of urb frames' itds */ dma_addr_t buf_dma; /* frame's buffer address */ /* for now, only one hw_transaction per itd */ u32 transaction; u16 index; /* in urb->iso_frame_desc */ u16 uframe; /* in periodic schedule */ u16 usecs;} __attribute__ ((aligned (32)));/*-------------------------------------------------------------------------*//* * EHCI Specification 0.95 Section 3.4 * siTD, aka split-transaction isochronous Transfer Descriptor * ... describe low/full speed iso xfers through TT in hubs * see Figure 3-5 "Split-transaction Isochronous Transaction Descriptor (siTD) */struct ehci_sitd { /* first part defined by EHCI spec */ u32 hw_next;/* uses bit field macros above - see EHCI 0.95 Table 3-8 */ u32 hw_fullspeed_ep; /* see EHCI table 3-9 */ u32 hw_uframe; /* see EHCI table 3-10 */ u32 hw_tx_results1; /* see EHCI table 3-11 */ u32 hw_tx_results2; /* see EHCI table 3-12 */ u32 hw_tx_results3; /* see EHCI table 3-12 */ u32 hw_backpointer; /* see EHCI table 3-13 */ u32 hw_buf_hi [2]; /* Appendix B */ /* the rest is HCD-private */ dma_addr_t sitd_dma; union ehci_shadow sitd_next; /* ptr to periodic q entry */ struct urb *urb; dma_addr_t buf_dma; /* buffer address */ unsigned short usecs; /* start bandwidth */ unsigned short c_usecs; /* completion bandwidth */} __attribute__ ((aligned (32)));/*-------------------------------------------------------------------------*//* * EHCI Specification 0.96 Section 3.7 * Periodic Frame Span Traversal Node (FSTN) * * Manages split interrupt transactions (using TT) that span frame boundaries * into uframes 0/1; see 4.12.2.2. In those uframes, a "save place" FSTN * makes the HC jump (back) to a QH to scan for fs/ls QH completions until * it hits a "restore" FSTN; then it returns to finish other uframe 0/1 work. */struct ehci_fstn { u32 hw_next; /* any periodic q entry */ u32 hw_prev; /* qh or EHCI_LIST_END */ /* the rest is HCD-private */ dma_addr_t fstn_dma; union ehci_shadow fstn_next; /* ptr to periodic q entry */} __attribute__ ((aligned (32)));/*-------------------------------------------------------------------------*/#include <linux/version.h>#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,32)#define SUBMIT_URB(urb,mem_flags) usb_submit_urb(urb)#define STUB_DEBUG_FILESstatic inline int hcd_register_root (struct usb_hcd *hcd){ return usb_new_device (hcd_to_bus (hcd)->root_hub);}#else /* LINUX_VERSION_CODE */// hcd_to_bus() eventually moves to hcd.h on 2.5 toostatic inline struct usb_bus *hcd_to_bus (struct usb_hcd *hcd) { return &hcd->self; }// ... as does hcd_register_root()static inline int hcd_register_root (struct usb_hcd *hcd){ return usb_register_root_hub ( hcd_to_bus (hcd)->root_hub, &hcd->pdev->dev);}#define SUBMIT_URB(urb,mem_flags) usb_submit_urb(urb,mem_flags)#ifndef DEBUG#define STUB_DEBUG_FILES#endif /* DEBUG */#endif /* LINUX_VERSION_CODE *//*-------------------------------------------------------------------------*/#endif /* __LINUX_EHCI_HCD_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -