Linux设备驱动程序,程序从哪里开始? [英] Linux Device Driver Program, where the program starts?
问题描述
我已经开始学习 Linux 驱动程序,但我发现它有点困难.
I've started to learn Linux driver programs, but I'm finding it a little difficult.
我一直在研究 i2c 驱动程序,我对驱动程序的入口点感到很困惑.驱动程序是否从 MOUDULE_INIT()
宏开始?
I've been studying the i2c driver, and I got quite confused regarding the entry-point of the driver program. Does the driver program start at the MOUDULE_INIT()
macro?
而且我也想知道怎么知道驱动程序运行的过程.我拿到了 Linux Device Driver 这本书,但我仍然很困惑.你可以帮帮我吗?非常感谢.
And I'd also like to know how I can know the process of how the driver program runs. I got the book, Linux Device Driver, but I'm still quite confused. Could you help me? Thanks a lot.
我将以 i2c 驱动程序为例.里面的函数实在是太多了,我就是想知道如何在i2c驱动中得到这些函数的协调关系?
I'll take the i2c driver as an example. There are just so many functions in it, I just wanna know how I can get coordinating relation of the functions in the i2c drivers?
推荐答案
Linux 设备驱动程序"是本好书,但很旧!
"Linux Device Driver" is a good book but it's old!
基本示例:
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Name and e-mail");
MODULE_DESCRIPTION("my_first_driver");
static int __init insert_mod(void)
{
printk(KERN_INFO "Module constructor");
return 0;
}
static void __exit remove_mod(void)
{
printk(KERN_INFO "Module destructor");
}
module_init(insert_mod);
module_exit(remove_mod);
最新的教程,写得真好,是Linux 设备驱动程序系列"
An up-to-date tutorial, really well written, is "Linux Device Drivers Series"
这篇关于Linux设备驱动程序,程序从哪里开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!