misc混杂设备:
说明:
混杂设备包括nvram,看门狗,ds1286时钟,lcd等.混杂设备本质还是字符设备,其功能实现于file_operations.
混杂设备主设备号为10.
变量:
struct miscdevice{
int minor;
char *name
file_operatios *fops
list_head list;
struct device *parent;
struct device *this_device;
}
函数:
misc_register(struct miscdevice *dev);
misc_unregister(struct miscdevice *dev);
sysfs设备:
说明:
sysfs设备没有在dev目录下有节点,但是可以在用户侧直接访问.通过sysfs_create_file创建的文件,每个device的attribute对应一个文件
文件通过show和store方法来存取.
变量:
sysdev_driver{
list_head entry;
(add)(struct sys_device);
(remove)(struct sys_device );
(shutdown)(struct sys_device );
(suspend)(struct sys_device );
(resume)(struct sys_device);
}struct attribute{
const char name;
umode_t mode;
}struct device_attribute{
struct attribute attr
ssize_t (show)(struct device *dev,struct device_attribute);
ssize_t (store)(struct device *dev,struct device_attribute);
}struct bin_attribute{
struct attribute attr;
size
read
}
函数:
sysdev_driver_register(struct sysdev_class*,struct sysdev_driver*);
sysdev_driver_unregister(struct sysdev_class ,struct sysdev_driver);
sysdev_create_file(struct sys_device dev,struct sysdev_attribute);
sysdev_remove_file(struct sys_device dev,struct sysdev_attribute);
相关函数:
sysfs_create_file(struct kobject*obj,struct attribute *);
sysfs_remove_file(struct kobject*obj,struct attribute *);
device_create_file(struct device*dev,struct device_arrtibute*);
device_remove_file(struct device*dev,struct device_arrtibute*);
sysfs_create_bin_file(struct kobject,struct bin_attribure *);