当前位置:网站首页>Detailed analysis of the 110th blog of the fledgling Xiao Li in stm32__ NVIC_ Setprioritygrouping (uint32_t prioritygroup) function
Detailed analysis of the 110th blog of the fledgling Xiao Li in stm32__ NVIC_ Setprioritygrouping (uint32_t prioritygroup) function
2022-07-23 07:55:00 【Fledgling Xiao Li】
__NVIC_SetPriorityGrouping(uint32_t PriorityGroup) Introduce
This function is implemented in the kernel file 
Code parsing
__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
{
uint32_t reg_value;
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
reg_value = SCB->AIRCR;
reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk));
reg_value = (reg_value |
((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
(PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) );
SCB->AIRCR = reg_value;
}
The meaning of the first sentence
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
take PriorityGroup This parameter is low 3 position Use and operate 7 The binary number of is 111
The meaning of the second sentence
reg_value = SCB->AIRCR;
// Read the current AIRCR Register value
The meaning of the third sentence
reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change /* SCB Application Interrupt and Reset Control Register Definitions */
#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
//SCB_AIRCR_VECTKEY_Msk Mask 1 Used to clear the high of the register 16 position FFFF<<16
//SCB_AIRCR_PRIGROUP_Msk Mask 2 Used to remove The register of 10 9 8 position 7<<8
The fourth sentence code meaning
reg_value = (reg_value |
((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
(PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) );
Turn the register high 16 The value bit is set to 0x05FA;
Put the register 10 9 8 Set the three digits to PriorityGroupTmp The value taken in the first step .
Finally, assign the result to the register
summary
This function assigns the result of a number to the specified position of a register , The designated position here is high 16 Bit and 8 9 10 position , 8 9 10 Bits affect interrupt priority grouping , By setting the values of these three bits The values of these three bits are 000 001 010 011 100 101 110 111 this 8 In this case , This realizes the grouping of interrupt priority .
The specific grouping is as follows (PriorityGroup Value 0 - 7)
Other related functions and descriptions

- Set priority groups
- Get priority groups
- Coding priority
- Parsing priorities

边栏推荐
- 局域网SDN技术硬核内幕 4 从计算虚拟化到网络虚拟化
- 局域网SDN技术硬核内幕 - 16 三 从物到人 园区用户漫游的EVPN实现
- Delete the duplicate items in the array (keep the last duplicate elements and ensure the original order of the array)
- VScode配置用户代码片段
- redis 哨兵模式,主节点检查脚本
- 多传感器融合综述---FOV与BEV
- How to use the order flow analysis tool (in)
- (五)数电——公式化简法
- 直播实录 | 37 手游如何用 StarRocks 实现用户画像分析
- 文件上传,服务器文件名中文乱码文件上传,服务器文件名中文乱码
猜你喜欢

Graduation project ----- Internet of things environment detection system based on stm32

一次 MySQL 误操作导致的事故,「高可用」都顶不住了

无代码生产新模式探索

NB-IOT的四大特性

Mysql的索引为什么用B+树而不是跳表?

Amazon's zoox passed the safety test and applied for a test drive in California

Kubernetes deployment strategy

Why does MySQL index use b+ tree instead of jump table?

Scala idea prompt function parameters

Delete the duplicate items in the array (keep the last duplicate elements and ensure the original order of the array)
随机推荐
scala 主构造器_Scala主构造器深度
How to use the order flow analysis tool (in)
真人踩过的坑,告诉你避免自动化测试常犯的10个错误
squid代理服务+ip代理池
Copytexture, copytoresolvetarget of UE4 engine
pny 文件转图片
Mysql的索引为什么用B+树而不是跳表?
yolov5 test.py BrokenPipeError: [Errno 32] Broken pipe问题解决
如何配置CANoe Network-based access模式的以太网网络拓扑
VScode配置用户代码片段
C语音实现tcp客户端和tcp服务端,Qt调用测试
局域网SDN技术硬核内幕 9 从软件Overlay到硬件Overlay
记一次线上SQL死锁事故:如何避免死锁?
LAN SDN technology hard core insider 5 implementation of virtualized network
Patrick McHardy事件对开源社区的影响
With 130 new services and functions a year, this storage "family bucket" has grown again
局域网SDN硬核技术内幕 20 亢龙有悔——规格与限制(上)
Implementation of remove function
etcdv3·watch操作实现及相关重点说明
局域网SDN硬核技术内幕 18 美丽新世界