两个中断响应问题 - TMS320C6748 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4111|回复: 4
打印 上一主题 下一主题

两个中断响应问题

[复制链接]

9

主题

21

帖子

116

积分

注册会员

Rank: 2

积分
116
跳转到指定楼层
楼主
发表于 2015-12-28 12:23:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
因为中断引脚用了GPIO0_9、GPIO0_8,所以每次中断触发的时候bank0都响应了,
现在怎么在中断函数中区分是哪个引脚触发的中断?谢谢指导。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

0

主题

184

帖子

1137

积分

QQ游客

积分
1137
沙发
发表于 2015-12-29 13:37:36 | 只看该作者
不能将 GPIO_BANK_0 中断映射到两个中断服务函数,正确的做法是将GPIO_BANK_0中断映射到一个中断服务函数,使能GPIO0_8和GPIO0_9上升或者下降沿中断,在GPIO_BANK_0产生中断后在中断服务函数里查询是GPIO0_8产生中断还是GPIO0_9产生中断。
回复 支持 反对

使用道具 举报

9

主题

21

帖子

116

积分

注册会员

Rank: 2

积分
116
板凳
 楼主| 发表于 2015-12-29 13:40:49 | 只看该作者
Lewis 发表于 2015-12-29 13:37
不能将 GPIO_BANK_0 中断映射到两个中断服务函数,正确的做法是将GPIO_BANK_0中断映射到一个中断服务函数, ...

谢谢您的回复,现在就是这么做的,但是现在不会查询,是GPIO0_8,还是GPIO0_9产生的中断,具体的说就是不知用那个函数进行查询,能具体说一下嘛?
回复 支持 反对

使用道具 举报

15

主题

1357

帖子

4579

积分

创龙

Rank: 8Rank: 8

积分
4579
地板
发表于 2015-12-29 16:53:35 | 只看该作者
jackding 发表于 2015-12-29 13:40
谢谢您的回复,现在就是这么做的,但是现在不会查询,是GPIO0_8,还是GPIO0_9产生的中断,具体的说就是不 ...
  1. /**
  2. * \brief    This function determines the status of interrupt on a specified
  3. *           pin.  
  4. *
  5. * \param    baseAdd    The memory address of the GPIO instance being used.

  6. * \param    pinNumber  The serial number of the GPIO pin to be accessed.
  7. *                      The 144 GPIO pins have serial numbers from 1 to 144.

  8. * \return   This returns a value which expresses the status of an interrupt
  9. *           raised over the specified pin.
  10. *           1> GPIO_INT_NOPEND, if no interrupts are left to be serviced.
  11. *           2> GPIO_INT_PEND, if the interrupt raised over that pin is yet
  12. *              to be cleared and serviced.
  13. *              
  14. * \note     If an interrupt over a pin is found to be pending, then the
  15. *           application can call GPIOPinIntClear() to clear the interrupt
  16. *           status.  
  17. *           
  18. *
  19. */
  20. unsigned int GPIOPinIntStatus(unsigned int baseAdd, unsigned int pinNumber)
  21. {
  22.     unsigned int intStatus = GPIO_INT_NOPEND;
  23.     unsigned int regNumber = 0;
  24.     unsigned int pinOffset = 0;

  25.     /*
  26.     ** Each register contains settings for each pin of two banks. The 32 bits
  27.     ** represent 16 pins each from the banks. Thus the register number must be
  28.     ** calculated based on 32 pins boundary.
  29.     */
  30.     regNumber = (pinNumber - 1)/32;
  31.    
  32.     /*
  33.     ** In every register the least significant bits starts with a GPIO number on
  34.     ** a boundary of 32. Thus the pin offset must be calculated based on 32
  35.     ** pins boundary. Ex: 'pinNumber' of 1 corresponds to bit 0 in
  36.     ** 'register_name01'.
  37.     */

  38.     pinOffset = (pinNumber - 1) % 32;

  39.     if(HWREG(baseAdd + GPIO_INTSTAT(regNumber)) & (1 << pinOffset))
  40.     {
  41.         intStatus = GPIO_INT_PEND;
  42.     }
  43.         
  44.     return intStatus;
  45. }
复制代码
回复 支持 反对

使用道具 举报

9

主题

21

帖子

116

积分

注册会员

Rank: 2

积分
116
5#
 楼主| 发表于 2016-1-3 11:16:05 | 只看该作者
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2024-5-6 14:29 , Processed in 0.039222 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表