Linux3.0.1中源码中spidev_test.c编译出错
想测试一下内核的SPI驱动,可是连内核自带的测试程序怎么编译都编译不过,# arm-linux-gcc spidev_test.c -o spidev_test
出现一下错误:
spidev_test.c: In function 'parse_opts':
spidev_test.c:145: error: 'SPI_NO_CS' undeclared (first use in this function)
spidev_test.c:145: error: (Each undeclared identifier is reported only once
spidev_test.c:145: error: for each function it appears in.)
spidev_test.c:148: error: 'SPI_READY' undeclared (first use in this function)
大家是怎么编译的呢? 大家都可以编译成可执行性文件? SPI_NO_CS' undeclared (first use in this function)
这里说没有声明,找找这个定义在哪个头文件里。 在include/linux/spi/spidev.h中声明了
#define SPI_NO_CS 0x40
#define SPI_READY 0x80 我把
#define SPI_NO_CS 0x40
#define SPI_READY 0x80
复制到在spidev_test.c中声明后编译过了,将开发板的USER IO中SPIMISO和SPIMOSI短接,在开发板注册
#mknod /dev/spidev1.1 c 1 1
#chmod 777 spidev_test
#./spidev_test
又出现以下错误:
can't set spi mode: Inappropriate ioctl for device
Aborted can't set spi mode: Inappropriate ioctl for device
看看哪里打印了这个信息,继续调试
页:
[1]