当前位置: 技术问答>linux和unix
求助:驱动编译出现的问题!小弟折腾好几天了,始终不得其解,各位大侠指点一下 谢谢
来源: 互联网 发布时间:2016-03-12
本文导语: 前两天参考别人的驱动写了个简单的Led 的驱动,但是编译的时候出现了一些问题,始终解决不掉,小弟乃新手,希望各位帮我看看,谢谢呀(我用的是2.4.18内核和2.95.3的编译器,在Rd9.0编译的)我把源程序 Makefile...
前两天参考别人的驱动写了个简单的Led 的驱动,但是编译的时候出现了一些问题,始终解决不掉,小弟乃新手,希望各位帮我看看,谢谢呀(我用的是2.4.18内核和2.95.3的编译器,在Rd9.0编译的)我把源程序 Makefile以及出现的错误发上来!
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define DEVICE_NAME "leds"
#define LED_MAJOR 231
static unsigned long led_table [] = {
GPIO_F6,
GPIO_F7,
};
static int leds_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
switch(cmd) {
case 0:
case 1:
if (arg > 2) {
return -EINVAL;
}
write_gpio_bit(led_table[arg], !cmd);
default:
return -EINVAL;
}
}
static struct file_operations leds_fops = {
owner: THIS_MODULE,
ioctl: leds_ioctl,
};
static devfs_handle_t devfs_handle;
static int __init leds_init(void)
{
int ret;
int i;
ret = register_chrdev(LED_MAJOR, DEVICE_NAME, &leds_fops);
if (ret
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define DEVICE_NAME "leds"
#define LED_MAJOR 231
static unsigned long led_table [] = {
GPIO_F6,
GPIO_F7,
};
static int leds_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
switch(cmd) {
case 0:
case 1:
if (arg > 2) {
return -EINVAL;
}
write_gpio_bit(led_table[arg], !cmd);
default:
return -EINVAL;
}
}
static struct file_operations leds_fops = {
owner: THIS_MODULE,
ioctl: leds_ioctl,
};
static devfs_handle_t devfs_handle;
static int __init leds_init(void)
{
int ret;
int i;
ret = register_chrdev(LED_MAJOR, DEVICE_NAME, &leds_fops);
if (ret