[英]Kernel driver not being included
我正在编写一个基本的内核驱动程序来访问一些内存位置。 它编译得很好,但是每当我尝试对其进行修改时,它就会挂起,不知道为什么,这是我的代码
#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/module.h>
#define GPIO5_OE 0x4805B134
MODULE_LICENSE("Dual BSD/GPL");
static unsigned long *ptr;
static int hello_init(void)
{
#if 0
ptr = ioremap_nocache(GPIO5_OE, 4095);
ptr = phys_to_virt(GPIO5_OE);
*ptr = 0xFFFFFFFF;
if (ptr == NULL) {
printk(KERN_ALERT "nonon");
} else {
printk(KERN_ALERT "yaya");
}
writeb(0xFFFFFFFF, ptr);
#endif
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.