打印

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

[复制链接]
4669|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 (24.21 KB )

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是什么

使用特权

评论回复
5
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

粉丝