完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
下面两个系统调度函数运行完切换函数XX——SW(),是否就直接跳转任务啦,因为任务切换函数是用的BX LR,直接跳转啦。那么后面还有一句OS_EXIT_CRItiCAL();退出临界区函数还没执行?
请问具体的操作顺序是什么样的? 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(); } void OSIntExit (void) { #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */ OS_CPU_SR cpu_sr = 0u; #endif if (OSRunning == OS_TRUE) { OS_ENTER_CRITICAL(); if (OSIntNesting > 0u) { /* Prevent OSIntNesting from wrapping */ OSIntNesting--; } if (OSIntNesting == 0u) { /* Reschedule only if all ISRs complete ... */ if (OSLockNesting == 0u) { /* ... and 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++; /* Keep track of the number of ctx switches */ OSIntCtxSw(); /* Perform interrupt level ctx switch */ } } } OS_EXIT_CRITICAL(); } } |
|
相关推荐
3个回答
|
|
汇编不懂,但是既然OS_ENTER_CRITICAL锁住了,应该是OS_EXIT_CRITICAL之后才能真正切换任务。不然设计没意义了
|
|
|
|
|
|
|
|
这块 我也不明白,帮顶
|
|
|
|
只有小组成员才能发言,加入小组>>
1243 浏览 0 评论
1381 浏览 1 评论
2829 浏览 5 评论
3116 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
3045 浏览 6 评论
1285浏览 1评论
如何知道嵌入式电子控制单元 (ECU) 中的RAM使用情况?
904浏览 1评论
891浏览 0评论
这个BSP包有基础的例程的,不懂的话,3284494788@qq.com我发给您吧
826浏览 0评论
1243浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-7-7 00:59 , Processed in 1.289143 second(s), Total 83, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191