打印

关于NVIC修改中断优先级的问题求解!!!

[复制链接]
239|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
第8号打板工|  楼主 | 2019-11-27 15:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
小弟最近在看stm32的红外实验,其中有一个函数NVIC_SetPriority (SysTick_IRQn, 0);
static __INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
{
  if(IRQn < 0) {
    SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M3 System Interrupts */
  else {
    NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff);    }        /* set Priority for device specific Interrupts  */
}
问题1:这个SCB是什么东西啊?如何找到它的定义啊?
问题2:我想了解  NVIC->IP[(uint32_t)(IRQn)]是什么?根据如下的结构体,我还是没有办法把它与寄存器联系起来啊,恳请大神指教
typedef struct
{
  __IO uint32_t ISER[8];                      /*!< Offset: 0x000  Interrupt Set Enable Register           */
       uint32_t RESERVED0[24];                                   
  __IO uint32_t ICER[8];                      /*!< Offset: 0x080  Interrupt Clear Enable Register         */
       uint32_t RSERVED1[24];                                    
  __IO uint32_t ISPR[8];                      /*!< Offset: 0x100  Interrupt Set Pending Register          */
       uint32_t RESERVED2[24];                                   
  __IO uint32_t ICPR[8];                      /*!< Offset: 0x180  Interrupt Clear Pending Register        */
       uint32_t RESERVED3[24];                                   
  __IO uint32_t IABR[8];                      /*!< Offset: 0x200  Interrupt Active bit Register           */
       uint32_t RESERVED4[56];                                   
  __IO uint8_t  IP[240];                      /*!< Offset: 0x300  Interrupt Priority Register (8Bit wide) */我该如何才能知道这个数组是用来干嘛的呢?
       uint32_t RESERVED5[644];                                 
  __O  uint32_t STIR;                         /*!< Offset: 0xE00  Software Trigger Interrupt Register     */
}  NVIC_Type;

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

393

主题

393

帖子

0

粉丝