为了方便设备模型的实现,内核规定,系统中的每个设备都要连接在一个Bus上,这个Bus可以是一个内部Bus、虚拟Bus或者Platform Bus。 内核通过struct bus_type结构,抽象Bus,它是在include/linux/device.h中定义的。本文会围绕该结构,描述Linux内核中Bus的功能,以及相关的实现逻辑。最后,会简单的介绍一些标准的Bus(如Platfor...
* A bus is represented by the bus_type structure. It contains the name, the * default attributes, the bus' methods, PM operations, and the driver core's * private data. */ struct bus_type { const char *name; const char *dev_name; struct device *dev_root; struct device_attribute *...
一、bus注册过程 bus_type结构体代表一条总线,如下所示: struct bus_type { const char *name; //名称 const char *dev_name; struct device *dev_root; struct device_attribute *dev_attrs; /* use dev_groups instead */ const struct attribute_group **bus_groups; ...
在Linux设备模型中,Bus(总线)是一类特殊的设备,它是连接处理器和其它设备之间的通道(channel)。为了方便设备模型的实现,内核规定,系统中的每个设备都要连接在一个Bus上,这个Bus可以是一个内部Bus、虚拟Bus或者platform Bus。 内核通过struct bus_type结构抽象Bus,它是在include/linux/device.h中定义的...
每个phy 芯片会创建一个 struct phy_device 类型的设备,对应的有 struct phy_driver 类型的驱动,这两者实际上是挂载在 mdio_bus_type 总线上的,mac 会被注册成 struct net_device。 phy_devicestructphy_device{ structphy_driver*drv;// PHY设备驱动 ...
struct linux module makefile attributes null 本文测试系统为:Ubuntu 10.10 x86_64 2.6.35-24-generic 上节中,除了简单的框架,我们还看到了一个和总线驱动相关的结构体bus_type 。这个结构体的定义在include/linux/device.h 中。本节先简单介绍结构体中的成员,再对每个成员作详细描述。[cpp]01.s t r...
structdevice{ structkobjectkobj;//内核对象,用于管理设备的属性 constchar*init_name;//设备的名称 structbus_type*bus;//指向设备所在总线的指针 structdevice*parent;//指向父设备的指针 structdevice_driver*driver;//指向设备所使用的驱动程序的指针
内核管理的所有的驱动,都必须包含一个叫struct device_driver成员, //男性描述的硬件,必须包含struct device结构体成员。 //女性 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; /* used for built-in modules */ bool suppress_bind_attrs...
在bus_type和class结构中都有一个指向struct subsys_private的指针,用于保存bus_type和class结构的驱动程序核心部分的私有数据。从命名上似乎不容易理解struct subsys_private,由于bus_type和clsss结构中都有一个struct subsys_private指针,所以可以将subsys_private理解成bus_type和class的上层,包含了bus和class。 struct...
structbus_type{constchar*name;// 总线名称,如:usb, pci等字符串;structbus_attribute*attributes;// 总线属性列表structdevice_driver*drivers;// 驱动程序列表structdevice*devices;// 设备列表// ... 其他字段 ...};---作用: ·抽象层:struct bus_type为设备驱动程序提供了一个抽象层,使得它们可以与不同...