专注电子技术学习与研究
当前位置:单片机教程网 >> MCU设计实例 >> 浏览文章

Cortex-M3中断优先级

作者:佚名   来源:本站原创   点击数:  更新时间:2014年08月18日   【字体:

STM32(Cortex-M3)中有两个优先级的概念——抢占式优先级和响应优先级,有人把响应优先级称作'亚优先级'或'副优先级(有关这个概念在下面附加内容有)',每个中断源都需要被指定这两种优先级。 
具有高抢占式优先级的中断可以在具有低抢占式优先级的中断处理过程中被响应,即中断嵌套,或者说高抢占式优先级的中断可以嵌套低抢占式优先级的中断。
当两个中断源的抢占式优先级相同时,这两个中断将没有嵌套关系,当一个中断到来后,如果正在处理另一个中断,这个后到来的中断就要等到前一个中断处理完之后才能被处理。如果这两个中断同时到达,则中断控制器根据他们的响应优先级高低来决定先处理哪一个;如果他们的抢占式优先级和响应优先级都相等,则根据他们在中断表中的排位顺序决定先处理哪一个。


The PRIGROUP field indicates the position of the binary point that splits the PRI_n fields in the Interrupt
Priority Registers into separate group priority and subpriority fields. Table 4.18 (p. 100) shows how
the PRIGROUP value controls this split.
Table 4.18. Priority grouping
Interrupt priority level value, PRI_N[7:0]                    Number of         Number of
PRIGROUP  Binary point   Group priority bits Subpriority bits Group priorities Subpriorities
b100-b000 bxxx.00000       [7:5]               None               8                  1
b101      bxx.y00000       [7:6]                [5]               4                  2
b110      bx.yy00000       [7]                 [6:5]              2                  4
b111      b.yyy00000        None               [7:5]              1                  8
1PRI_n[7:0] field showing the binary point. x denotes a group priority field bit, and y denotes a subpriority field bit.
 以上是EFM32的中断优先级的设置情况,EFM32TG用3个位表示优先级(M3最多用8个位),字节中的最高三位,抢占式与响应式的各个位如上所示
关闭窗口