我根据友善提供的led.c的驱动代码自己弄了个驱动代码然后再宿主机上编译不成功啊,想了狠久都不知道为什么,具体看下面编译出现的问题.
c:26: error: 'S3C2410_GPB5' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:27: error: 'S3C2410_GPB6' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:28: error: 'S3C2410_GPB7' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:29: error: 'S3C2410_GPB8' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:34: error: 'S3C2410_GPB5_OUTP' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:34: error: initializer element is not constant
/home/liuxiong/qudong/led.c:34: error: (near initialization for 'led_cfg_table[0]')
/home/liuxiong/qudong/led.c:35: error: 'S3C2410_GPB6_OUTP' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:35: error: initializer element is not constant
/home/liuxiong/qudong/led.c:35: error: (near initialization for 'led_cfg_table[1]')
/home/liuxiong/qudong/led.c:36: error: 'S3C2410_GPB7_OUTP' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:36: error: initializer element is not constant
/home/liuxiong/qudong/led.c:36: error: (near initialization for 'led_cfg_table[2]')
/home/liuxiong/qudong/led.c:37: error: 'S3C2410_GPB8_OUTP' undeclared here (not in a function)
/home/liuxiong/qudong/led.c:37: error: initializer element is not constant
/home/liuxiong/qudong/led.c:37: error: (near initialization for 'led_cfg_table[3]')
/home/liuxiong/qudong/led.c: In function 'leds_ioctl':
/home/liuxiong/qudong/led.c:59: error: implicit declaration of function 's3c2410_gpio_setpin'
/home/liuxiong/qudong/led.c: In function 'led_init':
/home/liuxiong/qudong/led.c:90: error: implicit declaration of function 's3c2410_gpio_cfgpin'
make[2]: *** [/home/liuxiong/qudong/led.o] Error 1
我明明已经定义了static unsigned long led_table [] = {
S3C2410_GPB5,
S3C2410_GPB6,
S3C2410_GPB7,
S3C2410_GPB8,
};
static unsigned int led_cfg_table [] = {
S3C2410_GPIO_OUTP,
S3C2410_GPIO_OUTP,
S3C2410_GPIO_OUTP,
S3C2410_GPIO_OUTP,
};
友善提供的源码能编译通过,不会出现什么问题,怪就怪在这里,我的代码跟友善提供的差不多,请看下面友善的代码就知道
static unsigned long led_table [] = {
S3C2410_GPB(5),
S3C2410_GPB(6),
S3C2410_GPB(7),
S3C2410_GPB(8),
};
static unsigned int led_cfg_table [] = {
S3C2410_GPIO_OUTPUT,
S3C2410_GPIO_OUTPUT,
S3C2410_GPIO_OUTPUT,
S3C2410_GPIO_OUTPUT,
};
看到了什么区别吧,只是S3C2410_GPB(5),S3C2410_GPB(6),S3C2410_GPB(7),S3C2410_GPB(8),多了个括号而已,他的就能通过而我的不能,我想知道为什么,请斑竹帮忙啊