主题 : mini2440 linux 设备驱动问题 复制链接 | 浏览器收藏 | 打印
跪在坚持
级别: 新手上路
UID: 67527
精华: 0
发帖: 7
金钱: 35 两
威望: 7 点
综合积分: 14 分
注册时间: 2012-04-12
最后登录: 2012-06-05
楼主  发表于: 2012-04-12 14:16

 mini2440 linux 设备驱动问题

在2.6.32.2内核中,make 自己写的一个nRF24L01模块,在编译的时候 出现找不到那些头文件::#include <linux/config.h>和#include <linux/devfs_fs_kernel.h>
为什么在内核当中找不到以上的两个头文件!
请高手和馆主解答下  万分感谢
谁做过nrf24L01驱动 求代码 给我一份参考
级别: 圣骑士
UID: 44407
精华: 0
发帖: 386
金钱: 1945 两
威望: 389 点
综合积分: 772 分
注册时间: 2011-04-25
最后登录: 2014-08-25
1楼  发表于: 2012-04-12 14:30
試試吧!  有時候google是很有用的

http://mblog.sigma.me/2011/11/04/resolve-linux-configh-problem.html

由于实验需要,写的代码需要的ring0下跑,最后解决方法就是把代码编译成一个内核模块加载到内核中。

写内核模块时参考了:http://tldp.org/LDP/lkmpg/2.6/html/

但是写完后,编译,发现报“linux/config.h: No such file or directory”

网上搜了下,原因是2.6.19之后的内核没有了config.h文件,因此直接把对应的include注释掉即可。
跪在坚持
级别: 新手上路
UID: 67527
精华: 0
发帖: 7
金钱: 35 两
威望: 7 点
综合积分: 14 分
注册时间: 2012-04-12
最后登录: 2012-06-05
2楼  发表于: 2012-04-12 15:17

 回 1楼(kazaya) 的帖子

恩恩 谢谢 但是我还有问题 怎么联系你  请教下
跪在坚持
级别: 新手上路
UID: 67527
精华: 0
发帖: 7
金钱: 35 两
威望: 7 点
综合积分: 14 分
注册时间: 2012-04-12
最后登录: 2012-06-05
3楼  发表于: 2012-04-12 15:18

 回 1楼(kazaya) 的帖子

[root@bogon linux]# make
make -C /root/build_kernel/linux-2.6.32.2 M=/mnt/hgfs/nRF24L01P/linux modules
make[1]: Entering directory `/root/build_kernel/linux-2.6.32.2'
  CC [M]  /mnt/hgfs/nRF24L01P/linux/nrf.o
/mnt/hgfs/nRF24L01P/linux/nrf.c: In function 'init_NRF24L01':
/mnt/hgfs/nRF24L01P/linux/nrf.c:159:2: error: implicit declaration of function 's3c2410_gpio_pullup'
/mnt/hgfs/nRF24L01P/linux/nrf.c:160:2: error: implicit declaration of function 's3c2410_gpio_cfgpin'
/mnt/hgfs/nRF24L01P/linux/nrf.c:160:2: error: expected ')' before '_OUTPUT'
/mnt/hgfs/nRF24L01P/linux/nrf.c:161:2: error: expected ')' before '_OUTPUT'
/mnt/hgfs/nRF24L01P/linux/nrf.c:162:2: error: expected ')' before '_OUTPUT'
/mnt/hgfs/nRF24L01P/linux/nrf.c:163:2: error: expected ')' before '_OUTPUT'
/mnt/hgfs/nRF24L01P/linux/nrf.c:164:2: error: expected ')' before '_INPUT'
/mnt/hgfs/nRF24L01P/linux/nrf.c:165:2: error: expected ')' before '_INPUT'
/mnt/hgfs/nRF24L01P/linux/nrf.c:169:2: error: implicit declaration of function 's3c2410_gpio_setpin'
/mnt/hgfs/nRF24L01P/linux/nrf.c:175:2: warning: passing argument 2 of 'SPI_Write_Buf' discards qualifiers from pointer target type
/mnt/hgfs/nRF24L01P/linux/nrf.c:131:15: note: expected 'unsigned char *' but argument is of type 'const unsigned char *'
/mnt/hgfs/nRF24L01P/linux/nrf.c:176:2: warning: passing argument 2 of 'SPI_Write_Buf' discards qualifiers from pointer target type
/mnt/hgfs/nRF24L01P/linux/nrf.c:131:15: note: expected 'unsigned char *' but argument is of type 'const unsigned char *'
/mnt/hgfs/nRF24L01P/linux/nrf.c: In function 'SPI_RW':
/mnt/hgfs/nRF24L01P/linux/nrf.c:222:3: error: implicit declaration of function 's3c2410_gpio_getpin'
/mnt/hgfs/nRF24L01P/linux/nrf.c: In function 'SPI_Read_Buf':
/mnt/hgfs/nRF24L01P/linux/nrf.c:270:23: error: expected identifier or '(' before 'unsigned'
/mnt/hgfs/nRF24L01P/linux/nrf.c:276:6: error: 'char_ctr' undeclared (first use in this function)
/mnt/hgfs/nRF24L01P/linux/nrf.c:276:6: note: each undeclared identifier is reported only once for each function it appears in
/mnt/hgfs/nRF24L01P/linux/nrf.c:278:8: error: expected expression before 'unsigned'
/mnt/hgfs/nRF24L01P/linux/nrf.c: In function 'SPI_Write_Buf':
/mnt/hgfs/nRF24L01P/linux/nrf.c:291:23: error: expected identifier or '(' before 'unsigned'
/mnt/hgfs/nRF24L01P/linux/nrf.c:296:6: error: 'char_ctr' undeclared (first use in this function)
/mnt/hgfs/nRF24L01P/linux/nrf.c: In function 'nRF24L01_TxPacket':
/mnt/hgfs/nRF24L01P/linux/nrf.c:343:2: warning: passing argument 2 of 'SPI_Write_Buf' discards qualifiers from pointer target type
/mnt/hgfs/nRF24L01P/linux/nrf.c:289:15: note: expected 'unsigned char *' but argument is of type 'const unsigned char *'
/mnt/hgfs/nRF24L01P/linux/nrf.c: In function 'nrf24l01_init':
/mnt/hgfs/nRF24L01P/linux/nrf.c:429:2: error: implicit declaration of function 'devfs_mk_cdev'
make[2]: *** [/mnt/hgfs/nRF24L01P/linux/nrf.o] 错误 1
make[1]: *** [_module_/mnt/hgfs/nRF24L01P/linux] 错误 2
make[1]: Leaving directory `/root/build_kernel/linux-2.6.32.2'
make: *** [all] 错误 2
[root@bogon linux]#