Skip to content

Commit

Permalink
实现OS_TCB结构体中.FlagsPend.FlagsRdy.FlagsOpt成员变量
Browse files Browse the repository at this point in the history
  • Loading branch information
mysterywolf committed Nov 15, 2020
1 parent bf4881c commit b01ea1d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
16 changes: 6 additions & 10 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
- 增加`flag_example.c`例程
- 实现`OS_CFG_FLAG_MODE_CLR_EN`功能
- `OSQPost`和`OSFlagPost`函数改为对`OS_OPT_POST_NO_SCHED`选项忽略
- 实现`OS_TCB`结构体中`.FlagsPend`、`.FlagsRdy`、`.FlagsOpt`成员变量



Expand Down Expand Up @@ -554,7 +555,7 @@
## v0.11.0
对齐并整理注释
对齐并整理注释
**[del]** 删除无用的钩子函数(已被RT-Thread钩子函数接管)
Expand Down Expand Up @@ -608,20 +609,15 @@
**[adjust]** `OSQPost`和`OSFlagPost`函数改为对`OS_OPT_POST_NO_SCHED`选项忽略
**[add]** 实现`OS_TCB`结构体中`.FlagsPend`、`.FlagsRdy`、`.FlagsOpt`成员变量
# TODO
## v1.1.0
1. OS_TCB
```c
OS_FLAGS FlagsPend; /* Event flag(s) to wait on */
OS_FLAGS FlagsRdy; /* Event flags that made task ready to run */
OS_OPT FlagsOpt; /* Options (See OS_OPT_FLAG_xxx) */
```
1. 实现广播消息队列
2. 实现广播消息队列
5. 尽力实现`os_pend_multi.c`
2. 尽力实现`os_pend_multi.c`
2 changes: 1 addition & 1 deletion uCOS-III/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ extern "C" {
#define OS_TASK_PEND_ON_FLAG (OS_STATE)( 1u) /* Pending on event flag group */
#define OS_TASK_PEND_ON_TASK_Q (OS_STATE)( 2u) /* Pending on message to be sent to task */
//#define OS_TASK_PEND_ON_MULTI (OS_STATE)( 3u) /* Pending on multiple semaphores and/or queues */
//#define OS_TASK_PEND_ON_COND (OS_STATE)( 3u) /* Pending on condition variable 3.08 */
#define OS_TASK_PEND_ON_MUTEX (OS_STATE)( 4u) /* Pending on mutual exclusion semaphore */
#define OS_TASK_PEND_ON_Q (OS_STATE)( 5u) /* Pending on queue */
#define OS_TASK_PEND_ON_SEM (OS_STATE)( 6u) /* Pending on semaphore */
#define OS_TASK_PEND_ON_TASK_SEM (OS_STATE)( 7u) /* Pending on signal to be sent to task */
//#define OS_TASK_PEND_ON_COND (OS_STATE)( 8u) /* Pending on condition variable 3.08 */

/*
------------------------------------------------------------------------------------------------------------------------
Expand Down
16 changes: 13 additions & 3 deletions uCOS-III/os_flag.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,14 @@ OS_FLAGS OSFlagPend (OS_FLAG_GRP *p_grp,
p_tcb->PendStatus = OS_STATUS_PEND_OK; /* Clear pend status */
p_tcb->TaskState |= OS_TASK_STATE_PEND;
p_tcb->PendOn = OS_TASK_PEND_ON_FLAG;
#if OS_CFG_DBG_EN > 0u && !defined PKG_USING_UCOSIII_WRAPPER_TINY
#ifndef PKG_USING_UCOSIII_WRAPPER_TINY
#if OS_CFG_DBG_EN > 0u
p_tcb->DbgNamePtr = p_grp->NamePtr;
p_grp->DbgNamePtr = p_tcb->Task.name;
#endif
p_tcb->FlagsPend = flags; /* Save the flags that we need to wait for */
p_tcb->FlagsOpt = opt; /* Save the type of wait we are doing */
p_tcb->FlagsRdy = 0u;
#endif
CPU_CRITICAL_EXIT();

Expand All @@ -551,7 +556,10 @@ OS_FLAGS OSFlagPend (OS_FLAG_GRP *p_grp,
CPU_CRITICAL_ENTER();
p_tcb->TaskState &= ~OS_TASK_STATE_PEND; /* 更新任务状态 */
p_tcb->PendOn = OS_TASK_PEND_ON_NOTHING; /* 清除当前任务等待状态 */
#if OS_CFG_DBG_EN > 0u && !defined PKG_USING_UCOSIII_WRAPPER_TINY

#ifndef PKG_USING_UCOSIII_WRAPPER_TINY
p_tcb->FlagsRdy = p_grp->FlagGrp.set; /* Save flags that were ready */
#if OS_CFG_DBG_EN > 0u
p_tcb->DbgNamePtr = (CPU_CHAR *)((void *)" ");
if(!rt_list_isempty(&(p_grp->FlagGrp.parent.suspend_thread)))
{
Expand All @@ -563,7 +571,9 @@ OS_FLAGS OSFlagPend (OS_FLAG_GRP *p_grp,
{
p_grp->DbgNamePtr =(CPU_CHAR *)((void *)" "); /* 若为空,则清空当前.DbgNamePtr */
}
#endif
#endif
#endif

if(p_tcb->PendStatus == OS_STATUS_PEND_ABORT) /* Indicate that we aborted */
{
CPU_CRITICAL_EXIT();
Expand Down

0 comments on commit b01ea1d

Please sign in to comment.