ehci.h
来自「linux-2.4.29操作系统的源码」· C头文件 代码 · 共 569 行 · 第 1/2 页
H
569 行
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)));/* mask NakCnt+T in qh->hw_alt_next */#define QTD_MASK __constant_cpu_to_le32 (~0x1f)#define IS_SHORT_READ(token) (QTD_LENGTH (token) != 0 && QTD_PID (token) == 1)/*-------------------------------------------------------------------------*//* 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 */ u32 *hw_next; /* (all types) */ 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 */ struct usb_device *dev; /* access to TT */} __attribute__ ((aligned (32)));/*-------------------------------------------------------------------------*//* description of one iso highspeed transaction (up to 3 KB data) */struct ehci_iso_uframe { /* These will be copied to iTD when scheduling */ u64 bufp; /* itd->hw_bufp{,_hi}[pg] |= */ u32 transaction; /* itd->hw_transaction[i] |= */ u8 cross; /* buf crosses pages */};/* temporary schedule data for highspeed packets from iso urbs * each packet is one uframe's usb transactions, in some itd, * beginning at stream->next_uframe */struct ehci_itd_sched { struct list_head itd_list; unsigned span; struct ehci_iso_uframe packet [0];};/* * ehci_iso_stream - groups all (s)itds for this endpoint. * acts like a qh would, if EHCI had them for ISO. */struct ehci_iso_stream { /* first two fields match QH, but info1 == 0 */ u32 hw_next; u32 hw_info1; u32 refcount; u8 bEndpointAddress; struct list_head itd_list; /* queued itds */ struct list_head free_itd_list; /* list of unused itds */ struct hcd_dev *dev; /* output of (re)scheduling */ unsigned long start; /* jiffies */ unsigned long rescheduled; int next_uframe; /* the rest is derived from the endpoint descriptor, * trusting urb->interval == (1 << (epdesc->bInterval - 1)), * including the extra info for hw_bufp[0..2] */ u8 interval; u8 usecs; u16 maxp; unsigned bandwidth; /* This is used to initialize iTD's hw_bufp fields */ u32 buf0; u32 buf1; u32 buf2; /* ... sITD won't use buf[012], and needs TT access ... */};/*-------------------------------------------------------------------------*//* * 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) & 0x0fff)#define EHCI_ITD_IOC (1 << 15) /* interrupt on complete */#define ISO_ACTIVE __constant_cpu_to_le32(EHCI_ISOC_ACTIVE) 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 ehci_iso_stream *stream; /* endpoint's queue */ struct list_head itd_list; /* list of stream's itds */ /* any/all hw_transactions here may be used by that urb */ unsigned frame; /* where scheduled */ unsigned pg; unsigned index[8]; /* in urb->iso_frame_desc */ u8 usecs[8];} __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 + =
减小字号Ctrl + -
显示快捷键?