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

📄 uhci-hcd.h

📁 硬实时linux补丁rtai下usb协议栈
💻 H
📖 第 1 页 / 共 2 页
字号:
 * * skel int128 QH * dev 1 interrupt QH * dev 5 interrupt QH * skel int64 QH * skel int32 QH * ... * skel int1 QH * skel low-speed control QH * dev 5 control QH * skel full-speed control QH * skel bulk QH * dev 1 bulk QH * dev 2 bulk QH * skel terminating QH * * The terminating QH is used for 2 reasons: * - To place a terminating TD which is used to workaround a PIIX bug *   (see Intel errata for explanation) * - To loop back to the full-speed control queue for full-speed bandwidth *   reclamation * * Isochronous transfers are stored before the start of the skeleton * schedule and don't use QH's. While the UHCI spec doesn't forbid the * use of QH's for Isochronous, it doesn't use them either. Since we don't * need to use them either, we follow the spec diagrams in hope that it'll * be more compatible with future UHCI implementations. */#define UHCI_NUM_SKELQH		12#define skel_int128_qh		skelqh[0]#define skel_int64_qh		skelqh[1]#define skel_int32_qh		skelqh[2]#define skel_int16_qh		skelqh[3]#define skel_int8_qh		skelqh[4]#define skel_int4_qh		skelqh[5]#define skel_int2_qh		skelqh[6]#define skel_int1_qh		skelqh[7]#define skel_ls_control_qh	skelqh[8]#define skel_fs_control_qh	skelqh[9]#define skel_bulk_qh		skelqh[10]#define skel_term_qh		skelqh[11]/* * Search tree for determining where <interval> fits in the skelqh[] * skeleton. * * An interrupt request should be placed into the slowest skelqh[] * which meets the interval/period/frequency requirement. * An interrupt request is allowed to be faster than <interval> but not slower. * * For a given <interval>, this function returns the appropriate/matching * skelqh[] index value. */static inline int __interval_to_skel(int interval){	if (interval < 16) {		if (interval < 4) {			if (interval < 2)				return 7;	/* int1 for 0-1 ms */			return 6;		/* int2 for 2-3 ms */		}		if (interval < 8)			return 5;		/* int4 for 4-7 ms */		return 4;			/* int8 for 8-15 ms */	}	if (interval < 64) {		if (interval < 32)			return 3;		/* int16 for 16-31 ms */		return 2;			/* int32 for 32-63 ms */	}	if (interval < 128)		return 1;			/* int64 for 64-127 ms */	return 0;				/* int128 for 128-255 ms (Max.) */}/* * States for the root hub. * * To prevent "bouncing" in the presence of electrical noise, * when there are no devices attached we delay for 1 second in the * RUNNING_NODEVS state before switching to the AUTO_STOPPED state. *  * (Note that the AUTO_STOPPED state won't be necessary once the hub * driver learns to autosuspend.) */enum uhci_rh_state {	/* In the following states the HC must be halted.	 * These two must come first */	UHCI_RH_RESET,	UHCI_RH_SUSPENDED,	UHCI_RH_AUTO_STOPPED,	UHCI_RH_RESUMING,	/* In this state the HC changes from running to halted,	 * so it can legally appear either way. */	UHCI_RH_SUSPENDING,	/* In the following states it's an error if the HC is halted.	 * These two must come last */	UHCI_RH_RUNNING,		/* The normal state */	UHCI_RH_RUNNING_NODEVS,		/* Running with no devices attached */};#define UHCI_MAX_TD				64#define UHCI_MAX_QH				128struct dma_buffer_pool{	void *buffer;	dma_addr_t dma_address;	int in_use;};/* * This describes the full uhci information. */struct uhci_hcd {	/* debugfs */	struct dentry *dentry;	/* Grabbed from PCI */	unsigned long io_addr;	struct dma_pool 			*qh_pool;	struct dma_buffer_pool 		qh_buffer_pool[UHCI_MAX_QH];	rtdm_sem_t					qh_buffer_semaphore;		struct dma_pool *td_pool;	struct dma_buffer_pool 		td_buffer_pool[UHCI_MAX_TD];	rtdm_sem_t					td_buffer_semaphore;	struct uhci_td *term_td;	/* Terminating TD, see UHCI bug */	struct uhci_qh *skelqh[UHCI_NUM_SKELQH];	/* Skeleton QH's */	rtdm_lock_t		rt_lock;		struct uhci_frame_list *fl;		/* P: uhci->lock */	int fsbr;				/* Full-speed bandwidth reclamation */	unsigned long fsbrtimeout;		/* FSBR delay */	enum uhci_rh_state rh_state;	unsigned long auto_stop_time;		/* When to AUTO_STOP */	unsigned int frame_number;		/* As of last check */	unsigned int is_stopped;#define UHCI_IS_STOPPED		9999		/* Larger than a frame # */	unsigned int scan_in_progress:1;	/* Schedule scan is running */	unsigned int need_rescan:1;		/* Redo the schedule scan */	unsigned int hc_inaccessible:1;		/* HC is suspended or dead */	unsigned int working_RD:1;		/* Suspended root hub doesn't						   need to be polled */	/* Support for port suspend/resume/reset */	unsigned long port_c_suspend;		/* Bit-arrays of ports */	unsigned long suspended_ports;	unsigned long resuming_ports;	unsigned long ports_timeout;		/* Time to stop signalling */	/* Main list of URB's currently controlled by this HC */	struct list_head urb_list;		/* P: uhci->lock */	/* List of QH's that are done, but waiting to be unlinked (race) */	struct list_head qh_remove_list;	/* P: uhci->lock */	unsigned int qh_remove_age;		/* Age in frames */	/* List of TD's that are done, but waiting to be freed (race) */	struct list_head td_remove_list;	/* P: uhci->lock */	unsigned int td_remove_age;		/* Age in frames */	/* List of asynchronously unlinked URB's */	struct list_head urb_remove_list;	/* P: uhci->lock */	unsigned int urb_remove_age;		/* Age in frames */	/* List of URB's awaiting completion callback */	struct list_head complete_list;		/* P: uhci->lock */	int rh_numports;			/* Number of root-hub ports */	wait_queue_head_t waitqh;		/* endpoint_disable waiters */};/* Convert between a usb_hcd pointer and the corresponding uhci_hcd */static inline struct uhci_hcd *hcd_to_uhci(struct usb_hcd *hcd){	return (struct uhci_hcd *) (hcd->hcd_priv);}static inline struct usb_hcd *uhci_to_hcd(struct uhci_hcd *uhci){	return container_of((void *) uhci, struct usb_hcd, hcd_priv);}#define uhci_dev(u)	(uhci_to_hcd(u)->self.controller)struct urb_priv {	struct list_head urb_list;	struct rtdm_urb *urb;	struct uhci_qh *qh;		/* QH for this URB */	struct list_head td_list;	/* P: urb->lock */	unsigned fsbr : 1;		/* URB turned on FSBR */	unsigned fsbr_timeout : 1;	/* URB timed out on FSBR */	unsigned queued : 1;		/* QH was queued (not linked in) */	unsigned short_control_packet : 1;	/* If we get a short packet during */						/*  a control transfer, retrigger */						/*  the status phase */	unsigned long inserttime;	/* In jiffies */	unsigned long fsbrtime;		/* In jiffies */	struct list_head queue_list;	/* P: uhci->frame_list_lock */};/* * Locking in uhci.c * * Almost everything relating to the hardware schedule and processing * of URBs is protected by uhci->lock.  urb->status is protected by * urb->lock; that's the one exception. * * To prevent deadlocks, never lock uhci->lock while holding urb->lock. * The safe order of locking is: * * #1 uhci->lock * #2 urb->lock *//* Some special IDs */#define PCI_VENDOR_ID_GENESYS		0x17a0#define PCI_DEVICE_ID_GL880S_UHCI	0x8083#define PCI_DEVICE_ID_GL880S_EHCI	0x8084#endif

⌨️ 快捷键说明

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