-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
允许重写中断控制API以支持独立的中断管理 #9305
允许重写中断控制API以支持独立的中断管理 #9305
Conversation
…pi to support independent interrupts management
@Evlers PR的描述内容可以整理一份readme放在这个目录下吗,在PR描述感觉容易被忽略掉。 |
@@ -208,6 +211,10 @@ rt_hw_context_switch_to: | |||
CPSIE F | |||
CPSIE I | |||
|
|||
/* clear the BASEPRI register to disable masking priority */ | |||
MOV r0, #0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我看已经实现了虚定义,原来的这块为什么还要改呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 因为在
rtthread_startup
函数中调用了rt_hw_interrupt_disable
函数来屏蔽中断,但是之后没有再调用rt_hw_interrupt_enable
函数来禁用屏蔽中断,而是直接在rt_system_scheduler_start
函数中调用rt_hw_context_switch_to
来启用中断。 - 而
rt_hw_context_switch_to
中使用CPSIE
指令来启用中断,所以需要在CPSIE
之后清除basepri
寄存器以禁用中断优先级的屏蔽。
好的,我整理一份 |
希望后面可以把其他的Cortex-M系列都改成这种方式吧 |
好嘞,我有空把支持的系列都改下。 |
m0可以不用管,m0本身也没太多的实时控制场景吧,应该是偏向低功耗的 |
感谢~ |
…pi to support independent interrupts management
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
在程序需要精准的中断响应时,由于
rt-thread
多处地方调用rt_hw_interrupt_disable
导致中断延迟的问题你的解决方案是什么 (what is your solution)
libcpu
中的rt_hw_interrupt_disable
函数添加weak
修饰以实现临界区的重写board.c
文件中添加如下代码board
目录Kconfig
文件中添加如下配置RT_MAX_SYSCALL_INTERRUPT_PRIORITY
配置为0x01,则系统只屏蔽0x01-0xFF
优先级的中断rt-thread
中的任何API
RT_MAX_SYSCALL_INTERRUPT_PRIORITY
的中断不能调用任何系统API在不重写
rt_hw_interrupt_disable & rt_hw_interrupt_enable
函数的情况下不影响之前的临界区代码请提供验证的bsp和config (provide the config and bsp)
#define RT_USING_INDEPENDENT_INTERRUPT_MANAGEMENT
#define RT_MAX_SYSCALL_INTERRUPT_PRIORITY 2
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up