• «
  • 1
  • 2
  • »
  • Pages: 2/2     Go
主题 : spi片选的问题!!!!!求救救 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 16814
精华: 0
发帖: 11
金钱: 55 两
威望: 11 点
综合积分: 22 分
注册时间: 2010-03-22
最后登录: 2011-07-08
10楼  发表于: 2010-04-10 11:26
恩,呵呵,我的不是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);挂掉,发现基址不对啊??在哪里设的呢??感激不尽啊
级别: 新手上路
UID: 16814
精华: 0
发帖: 11
金钱: 55 两
威望: 11 点
综合积分: 22 分
注册时间: 2010-03-22
最后登录: 2011-07-08
11楼  发表于: 2010-04-10 11:29

 回 9楼(kasim) 的帖子

恩,呵呵,我的不是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);挂掉,发现基址不对啊??在哪里设的呢??感激不尽啊
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
12楼  发表于: 2010-04-10 12:00

 回 11楼(allenseu) 的帖子

"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 16814
精华: 0
发帖: 11
金钱: 55 两
威望: 11 点
综合积分: 22 分
注册时间: 2010-03-22
最后登录: 2011-07-08
13楼  发表于: 2010-04-10 12:11
??????你可以说下啊???代码我也有啊????O(∩_∩)O~,谢谢
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
14楼  发表于: 2010-04-10 12:13

 回 13楼(allenseu) 的帖子

你想我说什么?代码逻辑看不懂我可以解释,C语言的基本概念不需要我再讲一遍了吧
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 16814
精华: 0
发帖: 11
金钱: 55 两
威望: 11 点
综合积分: 22 分
注册时间: 2010-03-22
最后登录: 2011-07-08
15楼  发表于: 2010-04-10 13:09

 回 14楼(kasim) 的帖子

O(∩_∩)O~。。。。看到了,O(∩_∩)O~
  • «
  • 1
  • 2
  • »
  • Pages: 2/2     Go