恩,呵呵,我的不是root目录下[root@localhost spi]# arm-linux-gcc -I/linux-2.6.27/include spidev_test.c 就好了
static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
{
struct s3c24xx_spi *hw = to_hw(spi);
dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n",
t->tx_buf, t->rx_buf, t->len);
hw->tx = t->tx_buf;
hw->rx = t->rx_buf;
hw->len = t->len;
hw->count = 0;
init_completion(&hw->done);
/* send the first byte */
writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
wait_for_completion(&hw->done);
return hw->count;
}
这里的hw->regs 是怎么索引到基址的呢???哪里赋值的啊??我在传数据时,在writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);挂掉,发现基址不对啊??在哪里设的呢??感激不尽啊