CH579文檔有說(shuō)中斷優(yōu)先級(jí)可設(shè)置,但卻沒有相關(guān)寄存器說(shuō)明。
例程中有關(guān)于中斷優(yōu)先級(jí)函數(shù),但也沒有相關(guān)設(shè)置說(shuō)明,有多少個(gè)等級(jí),以及嵌套中斷等信息。
/** \brief? Set Interrupt Priority
? ? The function sets the priority of an interrupt.
? ? \note The priority cannot be set for every core interrupt.
? ? \param [in]? ? ? IRQn? Interrupt number.
? ? \param [in]? priority? Priority to set.
?*/
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
{
? if(IRQn < 0) {
? ? SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
? ? ? ? (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
? else {
? ? NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) |
? ? ? ? (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); }
}
關(guān)于priority值的定義沒有注釋。