主题 : spi中断问题!!!!!急 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 16814
精华: 0
发帖: 11
金钱: 55 两
威望: 11 点
综合积分: 22 分
注册时间: 2010-03-22
最后登录: 2011-07-08
楼主  发表于: 2010-04-12 20:57

 spi中断问题!!!!!急

请问2410的spi是怎么调用中断的???是在发送一个字节的地方进去的???那句话说明进入中断服务的???谢谢回答
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2010-04-13 10:35
请问2410的spi是怎么调用中断的???是在发送一个字节的地方进去的???

中断不是调用而是触发的,对于S3C2440的SPI Controller来说,当配置为中断模式时,向SPTDAT寄存器写入要发送的数据就会触发中断。
在2.6.29的SPI驱动中(http://lxr.linux.no/#linux+v2.6.29/drivers/spi/spi_s3c24xx.c):

183static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
184{
185        struct s3c24xx_spi *hw = to_hw(spi);
186
  ......
195        init_completion(&hw->done);
196
197        /* send the first byte */
198        writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
199
200        wait_for_completion(&hw->done);

从wait_for_completion(&hw->done);开始就可以等硬件中断了。

那句话说明进入中断服务的???

进入s3c24xx_spi_irq()这个函数了就说明进中断已经触发并进入中断处理了。
"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."