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

📄 uhci-hcd.h

📁 usb driver for 2.6.17
💻 H
📖 第 1 页 / 共 2 页
字号:
	return le32_to_cpu(status);}/* *	Skeleton Queue Headers *//* * The UHCI driver uses QHs with Interrupt, Control and Bulk URBs for * automatic queuing. To make it easy to insert entries into the schedule, * we have a skeleton of QHs for each predefined Interrupt latency, * low-speed control, full-speed control, bulk, and terminating QH * (see explanation for the terminating QH below). * * When we want to add a new QH, we add it to the end of the list for the * skeleton QH.  For instance, the schedule list can look like this: * * 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), and * - To loop back to the full-speed control queue for full-speed bandwidth *   reclamation. * * There's a special skeleton QH for Isochronous QHs.  It never appears * on the schedule, and Isochronous TDs go on the schedule before the * the skeleton QHs.  The hardware accesses them directly rather than * through their QH, which is used only for bookkeeping purposes. * While the UHCI spec doesn't forbid the use of QHs for Isochronous, * it doesn't use them either.  And the spec says that queues never * advance on an error completion status, which makes them totally * unsuitable for Isochronous transfers. */#define UHCI_NUM_SKELQH		14#define skel_unlink_qh		skelqh[0]#define skel_iso_qh		skelqh[1]#define skel_int128_qh		skelqh[2]#define skel_int64_qh		skelqh[3]#define skel_int32_qh		skelqh[4]#define skel_int16_qh		skelqh[5]#define skel_int8_qh		skelqh[6]#define skel_int4_qh		skelqh[7]#define skel_int2_qh		skelqh[8]#define skel_int1_qh		skelqh[9]#define skel_ls_control_qh	skelqh[10]#define skel_fs_control_qh	skelqh[11]#define skel_bulk_qh		skelqh[12]#define skel_term_qh		skelqh[13]/* * 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 9;	/* int1 for 0-1 ms */			return 8;		/* int2 for 2-3 ms */		}		if (interval < 8)			return 7;		/* int4 for 4-7 ms */		return 6;			/* int8 for 8-15 ms */	}	if (interval < 64) {		if (interval < 32)			return 5;		/* int16 for 16-31 ms */		return 4;			/* int32 for 32-63 ms */	}	if (interval < 128)		return 3;			/* int64 for 64-127 ms */	return 2;				/* int128 for 128-255 ms (Max.) */}/* *	The UHCI controller and root hub *//* * 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 */};/* * The full UHCI controller information: */struct uhci_hcd {	/* debugfs */	struct dentry *dentry;	/* Grabbed from PCI */	unsigned long io_addr;	struct dma_pool *qh_pool;	struct dma_pool *td_pool;	struct uhci_td *term_td;	/* Terminating TD, see UHCI bug */	struct uhci_qh *skelqh[UHCI_NUM_SKELQH];	/* Skeleton QHs */	struct uhci_qh *next_qh;	/* Next QH to scan */	spinlock_t lock;	dma_addr_t frame_dma_handle;	/* Hardware frame list */	__le32 *frame;	void **frame_cpu;		/* CPU's frame list */	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 */	unsigned int is_initialized:1;		/* Data structure is usable */	/* Support for port suspend/resume/reset */	unsigned long port_c_suspend;		/* Bit-arrays of ports */	unsigned long resuming_ports;	unsigned long ports_timeout;		/* Time to stop signalling */	/* List of TDs that are done, but waiting to be freed (race) */	struct list_head td_remove_list;	unsigned int td_remove_age;		/* Age in frames */	struct list_head idle_qh_list;		/* Where the idle QHs live */	int rh_numports;			/* Number of root-hub ports */	wait_queue_head_t waitqh;		/* endpoint_disable waiters */	int num_waiting;			/* Number of 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)/* *	Private per-URB data */struct urb_priv {	struct list_head node;		/* Node in the QH's urbp list */	struct urb *urb;	struct uhci_qh *qh;		/* QH for this URB */	struct list_head td_list;	unsigned fsbr : 1;		/* URB turned on FSBR */	unsigned short_transfer : 1;	/* URB got a short transfer, no					 * need to rescan */};/* * 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#endif

⌨️ 快捷键说明

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