扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
下面我们列举一个字符设备驱动程序的框架.来说明这个过程. /* some include files*/ #include"param.h" #include"user.h" #include"tty.h" #include"dir.h" #include”fs.h" /* the include files modules need*/ #include"Linux/kernel.h" #include"Linux/module.h" #if CONFIG_MODBERSIONS==1 degine MODBERSIONS #include" Linux.modversions.h" #endif #difine devicename mydevice /* the init funcion*/ int init_module() { int tag=module_register_chrdev(0,mydevice,&Fops); if (tag<0) { printk("the device init is erro!\n"); return 1; } return 0; } /*the funcion which the device will be used */ int device_open () { ……. |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。