21 #ifndef ARM_CORTEX_COMMON_SCB_HPP_INCLUDED 22 #define ARM_CORTEX_COMMON_SCB_HPP_INCLUDED 30 template<
unsigned priority_bits>
35 static void set_priority_group(uint32_t group) {
38 SCB::AIRCR::set<SCB::AIRCR::VECTKEY, SCB::AIRCR::PRIGROUP>
39 ( SCB::AIRCR::VECTKEY ::shifted_value(0x5FA) |
40 SCB::AIRCR::PRIGROUP::shifted_value(group) );
43 static uint32_t get_priority_group(
void) {
44 return SCB::AIRCR::PRIGROUP::test_and_shift();
48 static void set_priority(uint32_t priority) {
49 static_assert(irqn < 0 && irqn > -13,
"illegal core exception interrupt number");
50 SCB::SHPR<((uint32_t)irqn & 0xf)-4>::store((priority << (8 - priority_bits)) & 0xff);
54 static uint32_t get_priority(
void) {
55 static_assert(irqn < 0 && irqn > -13,
"illegal core exception interrupt number");
56 return((uint32_t)(SCB::SHPR<((uint32_t)irqn & 0xf)-4>::load() >> (8 - priority_bits)));
64 #endif // ARM_CORTEX_COMMON_SCB_HPP_INCLUDED