ST V3.3库 core_cm3.h中的函数NVIC_SetPriority,疑问?

[复制链接]
5776|4
 楼主| PackBot 发表于 2010-8-16 13:32 | 显示全部楼层 |阅读模式
vi, ST, se, rio, ic
有哪位大侠能解释一下,下面红线部分,有那些内核中断不能被设置?

/**
* @brief  Set the priority for an interrupt
*
* @param  IRQn      The number of the interrupt for set priority
* @param  priority  The priority to set
*
* Set the priority for the specified interrupt.  
* The interrupt number can be positive to specify an external
(device specific) interrupt, or negative to specify an internal (core) interrupt.
*
* Note: 这个优先级并不能设置每一个内核中断。---The priority cannot be set for every core interrupt.
*/
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  */
}
香水城 发表于 2010-8-16 14:32 | 显示全部楼层
不能设置哪些被硬件固定死的内核中断:
STM32_Vector_Table.GIF
 楼主| PackBot 发表于 2010-8-16 16:22 | 显示全部楼层
版主就是版主,谢了!:)
qdchaoyue 发表于 2012-12-30 12:07 | 显示全部楼层
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  */
}
SCB->SHP  SHP是什么
TT5656 发表于 2012-12-30 13:58 | 显示全部楼层
qdchaoyue 发表于 2012-12-30 12:07
static __INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
{
  if(IRQn < 0) {

System handler priority registers.
见编程手册4.4.8,配置异常优先级的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:创新是一个民族的灵魂!

0

主题

50

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部