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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

两个中断响应问题

[复制链接]

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. }
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-9 18:33 , Processed in 0.040128 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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