完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
OSCtxSw OSIntCtxSw汇编代码相同,怎么体现出区别的?
osctxsw()需要保存出口状态。 osintctxsw()不需要。 但是汇编代码都一样,为什么? OSCtxSw PUSH {R4, R5} LDR R4, =NVIC_INT_CTRL ;´¥·¢endSVÒì³£ (causes context switch) LDR R5, =NVIC_PENDSVSET STR R5, [R4] POP {R4, R5} BX LR OSIntCtxSw PUSH {R4, R5} LDR R4, =NVIC_INT_CTRL ;´¥·¢endSVÒì³£ (causes context switch) LDR R5, =NVIC_PENDSVSET STR R5, [R4] POP {R4, R5} BX LR NOP |
|
相关推荐
6个回答
|
|
|
|
|
|
|
|
|
你好,OSCtxSw OSIntCtxSw这两个函数都在临界区里,这两个函数需要触发pendsv中断处理函数。临界区不是不能产生中断了吗?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
就是说调度器函数 中的任务切换函数OS_TASK_SW(); 在临界区中,PendSV中断不响应,当退出临界区时Pendsv才进行任务切换工作,这样理解对吗?
void OS_Sched (void) { #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */ OS_CPU_SR cpu_sr = 0u; #endif OS_ENTER_CRITICAL(); if (OSIntNesting == 0u) { /* Schedule only if all ISRs done and ... */ if (OSLockNesting == 0u) { /* ... scheduler is not locked */ OS_SchedNew(); OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy]; if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */ #if OS_TASK_PROFILE_EN > 0u OSTCBHighRdy->OSTCBCtxSwCtr++; /* Inc. # of context switches to this task */ #endif OSCtxSwCtr++; /* Increment context switch counter */ OS_TASK_SW(); /* Perform a context switch */ } } } OS_EXIT_CRITICAL(); } |
|
|
|
|
|
没看懂为什么这俩相同?
|
|
|
|
|
只有小组成员才能发言,加入小组>>
1026 浏览 1 评论
1856 浏览 0 评论
1837 浏览 1 评论
3261 浏览 5 评论
3587 浏览 9 评论
1026浏览 1评论
1853浏览 1评论
如何知道嵌入式电子控制单元 (ECU) 中的RAM使用情况?
1365浏览 1评论
1856浏览 0评论
1181浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 08:50 , Processed in 0.901526 second(s), Total 86, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1772