完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
#if OS_EVENT_EN > 0
INT8U OS_EventTaskRdy (OS_EVENT *pevent, void *msg, INT8U msk) { OS_TCB *ptcb; INT8U x; INT8U y; INT8U bitx; INT8U bity; INT8U prio; y = OSUnMapTbl[pevent->OSEventGrp]; /* Find highest prio. task waiting for message */ bity = OSMapTbl[y]; x = OSUnMapTbl[pevent->OSEventTbl[y]]; bitx = OSMapTbl[x]; prio = (INT8U)((y << 3) + x); /* Find priority of task getting the msg */ if ((pevent->OSEventTbl[y] &= ~bitx) == 0x00) { /* Remove this task from the waiting list */ pevent->OSEventGrp &= ~bity; /* Clr group bit if this was only task pending */ } ptcb = OSTCBPrioTbl[prio]; /* Point to this task's OS_TCB */ ptcb->OSTCBDly = 0; /* Prevent OSTimeTick() from readying task */ ptcb->OSTCBEventPtr = (OS_EVENT *)0; /* Unlink ECB from this task */ #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) ptcb->OSTCBMsg = msg; /* Send message directly to waiting task */ #else msg = msg; /* Prevent compiler warning if not used */ #endif ptcb->OSTCBStat &= ~msk; /* Clear bit associated with event type */ if (ptcb->OSTCBStat == OS_STAT_RDY) { /* See if task is ready (could be susp'd) */ OSRdyGrp |= bity; /* Put task in the ready to run list */ OSRdyTbl[y] |= bitx; } return (prio); } #endif 以上是ucos ii OS_CORE.C源代码中关于事件就绪代码的部分, y = OSUnMapTbl[pevent->OSEventGrp]; bity = OSMapTbl[y]; x = OSUnMapTbl[pevent->OSEventTbl[y]]; bitx = OSMapTbl[x]; 明显可以看到bity的值就是等于pevent->OSEventGrp为什么要多此一举的使用“bity”这个参数? 这又是出于什么目的考虑呢? |
|
相关推荐
4 个讨论
|
|
bity 可不是 pevent->OSEventGrp,你再仔细看看,如果还不懂可以Q3988Q4440
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
UCOSII中断中添加OSSemPost(Sem);程序无法运行
4913 浏览 1 评论
在BC5.0上编译uC/OS-II出现"eeror writing object file",怎样处理???
3139 浏览 1 评论
487浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-9-10 23:21 , Processed in 0.490626 second(s), Total 51, Slave 43 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191