我们先看下面一段代码: static struct usb_driver usb_storage_driver = { .owner = THIS_MODULE, .name = \"usb-storage\", .probe = storage_probe, .disconnect = storage_disconnect, .id_table = storage_usb_ids, }; 1. 2. 3. 4. 5. 6. 我们在阅读GNU/Linux内核代码时,我们会经常遇到上述...
我们先看下面一段代码: staticstructusb_driverusb_storage_driver={.owner=THIS_MODULE,.name=\"usb-storage\",.probe=storage_probe,.disconnect=storage_disconnect,.id_table=storage_usb_ids,}; 我们在阅读GNU/Linux内核代码时,我们会经常遇到上述这样一种特殊的结构初始化方式,这种方式称为指定初始化。这种初...
我们先看下面一段代码: staticstructusb_driverusb_storage_driver={.owner=THIS_MODULE,.name=\"usb-storage\",.probe=storage_probe,.disconnect=storage_disconnect,.id_table=storage_usb_ids,}; 我们在阅读GNU/Linux内核代码时,我们会经常遇到上述这样一种特殊的结构初始化方式,这种方式称为指定初始化。这种初...
USB_DEVICE_INFO(class, subclass, protocol) 创建一个structusb_device_id, 可用来只匹配一个特定类的 USB 设备. USB_INTERFACE_INFO(class, subclass, protocol) 创建一个structusb_device_id, 可用来只匹配一个特定类的 USB 接口. struct usb_device_id 结构提供了这个驱动支持的一个不同类型 USB 设备的列...
static struct usb_driver usb_storage_driver = { .owner = THIS_MODULE, .name = "usb-storage", .probe = storage_probe, .disconnect = storage_disconnect, .id_table = storage_usb_ids, }; 乍⼀看,这与我们之前学过的结构体初始化差距甚远。其实这就是前⾯所说的指定初始化在Linux设备驱动程序...
相比PCI、USB,它主要用于描述SOC上的片上资源。platform 所描述的资源有一个共同点:在CPU 的总线上直接取址。 平台设备会分到一个名称(用在驱动绑定中)以及一系列诸如地址和中断请求号(IRQ)之类的资源。 设备用platform_device表示,驱动用platform_driver进行注册。
unsigned long timeout = USB_CONNECT_TIMEOUT; @@ -2374,7 +2379,15 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd) goto fail; }if (usb_gadget_register_driver(ð_driver) < 0) l_priv->eth_driver.speed = DEVSPEED; ...
1 struct bus_type { 2 char * name; 3 4 struct subsystem subsys; 5 struct kset drivers; 6 struct kset devices; 7 8 struct bus_attribute * bus_attrs; 9 struct device_attribute * dev_attrs; 10 struct driver_attribute * drv_attrs; 11 12 int (*match)(struct device * dev, struct ...
Indicates whether the subunit driver itself serves as a clock provider. This is TRUE if this stream also serves as a clock provider, Otherwise, this is FALSE.ClockHandleSpecifies a handle to a clock provider other than the subunit driver itself.StreamHeader...
对于USB、PCI等设备驱动,通常会创建一个MODULE_DEVICE_TABLE。 5、Linux 内核模块的编译 5.1 makefile Linux 内核模块的编译需要编写makefile文件,具体的makefile文件编写介绍详见附件。 5.2 内核模块的makefile文件 编写一个简单的 Makefile: KVERS = $(shell uname -r) #显示内核版本号 ...