6.1 介绍
platform_driver结构体在头文件“vim include/linux/platform_device.h”中
probe函数:platform_match函数匹配之后,驱动调用的初始化函数
remove函数:移除驱动函数
suspend函数:悬挂(休眠)驱动函数
resume函数:休眠后恢复驱动函数
结构体的两个参数:name和注册的设备name要一致,owner一般赋值THIS_MODULE
platform_driver_register(struct platform_driver *):驱动注册
platform_driver_unregister(struct platform_driver *):驱动卸载
驱动的几个状态:初始化,移除,休眠,复位
6.2 实验:在mini_linux_module.c程序基础上添加驱动注册部分
详见程序probe_linux_module.c
写好程序修改好makefile后拷贝到/home/topeet/probe_linux_module
make zImage编译
把生成的ko文件传送到开发板
加载驱动:insmod /…./wenjian.ko
查看驱动:lsmod
卸载驱动:rmmod qudongming