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设备驱动程序》这本书,但是我还是很困惑.你可以帮帮我吗?非常感谢.
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屋!