当前位置: 首页 > news >正文

platform框架

platform框架

  • 注册设备进入总线
    • platform_device_register函数
  • 注册驱动进入总线
    • platform_driver_register函数

在这里插入图片描述

注册设备进入总线

platform_device_register函数

int platform_device_register(struct platform_device *pdev)

struct platform_device {const char	* name; 名字与驱动名一定要相同int		id;struct device	dev;u32		num_resources;struct resource	* resource;struct platform_device_id	*id_entry;/* arch specific additions */struct pdev_archdata	archdata;
};

#########

struct device {struct device		*parent;struct device_private	*p;struct kobject kobj;const char		*init_name;/* initial name of the device */struct device_type	*type;struct semaphore	sem;	/* semaphore to synchronize calls to* its driver.*/struct bus_type	*bus;		/* type of bus device is on */struct device_driver *driver;	/* which driver has allocated thisdevice */void		*platform_data;	/* Platform specific data, devicecore doesn't touch it */struct dev_pm_info	power;#ifdef CONFIG_NUMAint		numa_node;	/* NUMA node this device is close to */
#endifu64		*dma_mask;	/* dma mask (if dma'able device) */u64		coherent_dma_mask;/* Like dma_mask, but foralloc_coherent mappings asnot all hardware supports64 bit addresses for consistentallocations such descriptors. */struct device_dma_parameters *dma_parms;struct list_head	dma_pools;	/* dma pools (if dma'ble) */struct dma_coherent_mem	*dma_mem; /* internal for coherent memoverride *//* arch specific additions */struct dev_archdata	archdata;dev_t			devt;	/* dev_t, creates the sysfs "dev" */spinlock_t		devres_lock;struct list_head	devres_head;struct klist_node	knode_class;struct class		*class;const struct attribute_group **groups;	/* optional groups */void	(*release)(struct device *dev);
};

注册驱动进入总线

platform_driver_register函数

int platform_driver_register(struct platform_driver *drv)

struct platform_driver {int (*probe)(struct platform_device *);int (*remove)(struct platform_device *);void (*shutdown)(struct platform_device *);int (*suspend)(struct platform_device *, pm_message_t state);int (*resume)(struct platform_device *);struct device_driver driver;struct platform_device_id *id_table;
};

在probe中初始化
在remove中删除

http://www.lryc.cn/news/431696.html

相关文章:

  • 零成本搞定静态博客——十分钟安装hugo与主题
  • windows C++ 并行编程-转换使用取消的 OpenMP 循环以使用并发运行时
  • 经验笔记:跨站脚本攻击(Cross-Site Scripting,简称XSS)
  • 演示:基于WPF的DrawingVisual和谷歌地图瓦片开发的地图(完全独立不依赖第三方库)
  • 【C++】static作用总结
  • 视频提取字幕的软件有哪些?高效转录用这些
  • (4)SVG-path中的椭圆弧A(绝对)或a(相对)
  • docker国内镜像源报错解决方案
  • 《C++进阶之路:探寻预处理宏的替代方案》
  • 【综合案例】使用鸿蒙编写掘金评论列表案例
  • 【springboot】使用缓存
  • <Linux> 基础IO
  • OpenFeign的使用(一)
  • 【Python报错已解决】`AttributeError: move_to requires a WebElement`
  • 数据结构(邓俊辉)学习笔记】排序 2——快速排序:性能分析
  • 在postman中使用javascript脚本生成sign签名
  • 设计模式—2—单例模式
  • 服务器数据恢复—磁盘坏扇区导致raid6阵列崩溃的数据恢复案例
  • 原码、反码、补码
  • 排序算法之计数排序详细解读(附带Java代码解读)
  • Linux:如何使用 Crontab
  • AI模型:追求全能还是专精?-- 之7 智能工厂程序设计
  • 如何在本地服务器部署SeaFile自托管文件共享服务结合内网穿透打造私有云盘?
  • 学习记录:js算法(二十五):合并两个有序链表
  • 43. 1 ~ n 整数中 1 出现的次数【难】
  • K8S - 理解volumeMounts 中的subpath
  • java工程师成功转型大数据
  • visual studio 2022更新以后,之前的有些工程编译出错,升级到Visual studio Enterprise 2022 Preview解决
  • Linux 性能调优技巧
  • 【网络安全】WordPress Uncontrolled Resource Consumption