一、USB Device 

1. struct device:

 The Basic Device Structure, generic device interface(所有设备的抽象)
  -struct bus_type *bus;            /* type of bus device is on */
  -struct device_driver *driver;  /* which driver has allocated this device */

 

2. struct usb_device:

kernel's representation of a USB device (它包含struct device,USB设备)

  -struct device dev;  /* generic device interface */

  -struct usb_device_descriptor descriptor; /* USB device descriptor */
  - struct usb_bus *bus;                               /* bus we're part of */
  -struct usb_host_endpoint ep0;                /* endpoint 0 data (default control pipe) */

  -struct usb_host_config *config;          /* all of the device's configs */
  -struct usb_host_config *actconfig;       /* the active configuration */
  -struct usb_host_endpoint *ep_in[16];     /* array of IN endpoints */
  -struct usb_host_endpoint *ep_out[16];    /* array of OUT endpoints */

 

3. struct usb_host_config

representation of a device's configuration

/* array of pointers to usb_interface structures, one for each  interface in the configuration. These pointers are valid only while the the configuration is active.*/

 -struct usb_interface *interface[USB_MAXINTERFACES];    

 

/* array of pointers to usb_interface_cache structures, one  for each interface in the configuration.  These structures exist  for the entirelife of the device. Interface information availableeven when this isnot activeconfiguration */

 -struct usb_interface_cache *intf_cache[USB_MAXINTERFACES];

 

4. struct usb_interface

what usb device drivers talk to

 /* array of alternate settings for this interface, stored in no particular order. one for each alternate setting that may be selected.  Each one includes a set of endpoint configurations. */
 -struct usb_host_interface *altsetting;
 -struct usb_host_interface *cur_altsetting; /* the currently

 

5. struct usb_host_interface
host-side wrapper for one interface setting's parsed descriptors
-struct usb_interface_descriptor desc;
/* array of desc.bNumEndpoint endpoints associated with this interface setting.  these will be in no particular order.*/
-struct usb_host_endpoint *endpoint;

 

6. struct usb_host_endpoint

 host-side endpoint descriptor and queue

 /* descriptor for this endpoint, e.g.: wMaxPacketSize */

 -struct usb_endpoint_descriptor desc;   

 /*urbs queued to this endpoint; maintained by usbcore*/
 -struct list_head  urb_list;     

  /* for use by HCD; typically holds hardware dma queue head (QH) */
 -void    *hcpriv;        

 /* ep_device for sysfs info*/

 -struct ep_device   *ep_dev;   

 

7. usb_alloc_dev

usb device constructor (usbcore-internal)
struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1)

   @parent: hub to which device is connected; null to allocate a root hub
  @bus: bus used to access the device
  @port1: one-based index of port; ignored for root hubs

 

 


 

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐