📄 os.h
字号:
};
/*
------------------------------------------------------------------------------------------------------------------------
* EVENT FLAGS
------------------------------------------------------------------------------------------------------------------------
*/
struct os_flag_grp { /* Event Flag Group */
OS_OBJ_TYPE Type; /* Should be set to OS_OBJ_TYPE_FLAG */
CPU_CHAR *NamePtr; /* Pointer to Event Flag Name (NUL terminated ASCII) */
OS_PEND_LIST PendList; /* List of tasks waiting on event flag group */
#if OS_CFG_DBG_EN > 0u
OS_FLAG_GRP *DbgPrevPtr;
OS_FLAG_GRP *DbgNextPtr;
CPU_CHAR *DbgNamePtr;
#endif
OS_FLAGS Flags; /* 8, 16 or 32 bit flags */
CPU_TS TS; /* Timestamp of when last post occurred */
};
/*$PAGE*/
/*
------------------------------------------------------------------------------------------------------------------------
* MEMORY PARTITIONS
------------------------------------------------------------------------------------------------------------------------
*/
struct os_mem { /* MEMORY CONTROL BLOCK */
OS_OBJ_TYPE Type; /* Should be set to OS_OBJ_TYPE_MEM */
void *AddrPtr; /* Pointer to beginning of memory partition */
CPU_CHAR *NamePtr;
void *FreeListPtr; /* Pointer to list of free memory blocks */
OS_MEM_SIZE BlkSize; /* Size (in bytes) of each block of memory */
OS_MEM_QTY NbrMax; /* Total number of blocks in this partition */
OS_MEM_QTY NbrFree; /* Number of memory blocks remaining in this partition */
#if OS_CFG_DBG_EN > 0u
OS_MEM *DbgPrevPtr;
OS_MEM *DbgNextPtr;
#endif
};
/*$PAGE*/
/*
------------------------------------------------------------------------------------------------------------------------
* MESSAGES
------------------------------------------------------------------------------------------------------------------------
*/
struct os_msg { /* MESSAGE CONTROL BLOCK */
OS_MSG *NextPtr; /* Pointer to next message */
void *MsgPtr; /* Actual message */
OS_MSG_SIZE MsgSize; /* Size of the message (in # bytes) */
CPU_TS MsgTS; /* Time stamp of when message was sent */
};
struct os_msg_pool { /* OS_MSG POOL */
OS_MSG *NextPtr; /* Pointer to next message */
OS_MSG_QTY NbrFree; /* Number of messages available from this pool */
OS_MSG_QTY NbrUsed; /* Number of messages used */
};
struct os_msg_q { /* OS_MSG_Q */
OS_MSG *InPtr; /* Pointer to next OS_MSG to be inserted in the queue */
OS_MSG *OutPtr; /* Pointer to next OS_MSG to be extracted from the queue */
OS_MSG_QTY NbrEntriesSize; /* Maximum allowable number of entries in the queue */
OS_MSG_QTY NbrEntries; /* Current number of entries in the queue */
OS_MSG_QTY NbrEntriesMax; /* Peak number of entries in the queue */
};
/*$PAGE*/
/*
------------------------------------------------------------------------------------------------------------------------
* MUTUAL EXCLUSION SEMAPHORES
------------------------------------------------------------------------------------------------------------------------
*/
struct os_mutex {
OS_OBJ_TYPE Type; /* Mutual Exclusion Semaphore */
CPU_CHAR *NamePtr; /* Should be set to OS_OBJ_TYPE_MUTEX */
OS_PEND_LIST PendList; /* Pointer to Mutex Name (NUL terminated ASCII) */
#if OS_CFG_DBG_EN > 0u
OS_MUTEX *DbgPrevPtr;
OS_MUTEX *DbgNextPtr;
CPU_CHAR *DbgNamePtr;
#endif
OS_TCB *OwnerTCBPtr; /* List of tasks waiting on event flag group */
OS_PRIO OwnerOriginalPrio;
OS_NESTING_CTR OwnerNestingCtr; /* Mutex is available when the counter is 0 */
CPU_TS TS;
};
/*$PAGE*/
/*
------------------------------------------------------------------------------------------------------------------------
* MESSAGE QUEUES
------------------------------------------------------------------------------------------------------------------------
*/
struct os_q {
OS_OBJ_TYPE Type; /* Message Queue */
CPU_CHAR *NamePtr; /* Should be set to OS_OBJ_TYPE_Q */
OS_PEND_LIST PendList; /* Pointer to Message Queue (NUL terminated ASCII) */
#if OS_CFG_DBG_EN > 0u
OS_Q *DbgPrevPtr;
OS_Q *DbgNextPtr;
CPU_CHAR *DbgNamePtr;
#endif
OS_MSG_Q MsgQ; /* List of tasks waiting on event flag group */
};
/*$PAGE*/
/*
------------------------------------------------------------------------------------------------------------------------
* SEMAPHORES
------------------------------------------------------------------------------------------------------------------------
*/
struct os_sem {
OS_OBJ_TYPE Type; /* Semaphore */
CPU_CHAR *NamePtr; /* Should be set to OS_OBJ_TYPE_SEM */
OS_PEND_LIST PendList; /* Pointer to Semaphore Name (NUL terminated ASCII) */
#if OS_CFG_DBG_EN > 0u
OS_SEM *DbgPrevPtr;
OS_SEM *DbgNextPtr;
CPU_CHAR *DbgNamePtr;
#endif
OS_SEM_CTR Ctr; /* List of tasks waiting on event flag group */
CPU_TS TS;
};
/*$PAGE*/
/*
------------------------------------------------------------------------------------------------------------------------
* TASK CONTROL BLOCK
------------------------------------------------------------------------------------------------------------------------
*/
struct os_tcb {
CPU_STK *StkPtr; /* Pointer to current top of stack */
void *ExtPtr; /* Pointer to user definable data for TCB extension */
CPU_STK *StkLimitPtr; /* Pointer used to set stack 'watermark' limit */
OS_TCB *NextPtr; /* Pointer to next TCB in the TCB list */
OS_TCB *PrevPtr; /* Pointer to previous TCB in the TCB list */
OS_TCB *TickNextPtr;
OS_TCB *TickPrevPtr;
OS_TICK_SPOKE *TickSpokePtr; /* Pointer to tick spoke if task is in the tick list */
CPU_CHAR *NamePtr; /* Pointer to task name */
CPU_STK *StkBasePtr; /* Pointer to base address of stack */
OS_TASK_PTR TaskEntryAddr; /* Pointer to task entry point address */
void *TaskEntryArg; /* Argument passed to task when it was created */
OS_PEND_DATA *PendDataTblPtr; /* Pointer to list containing objects pended on */
OS_STATE PendOn; /* Indicates what task is pending on */
OS_STATUS PendStatus; /* Pend status */
OS_STATE TaskState; /* See OS_TASK_STATE_xxx */
OS_PRIO Prio; /* Task priority (0 == highest) */
CPU_STK_SIZE StkSize; /* Size of task stack (in number of stack elements) */
OS_OPT Opt; /* Task options as passed by OSTaskCreate() */
OS_OBJ_QTY PendDataTblEntries; /* Size of array of objects to pend on */
CPU_TS TS; /* Timestamp */
OS_SEM_CTR SemCtr; /* Task specific semaphore counter */
/* DELAY / TIMEOUT */
OS_TICK TickCtrPrev; /* Previous time when task was ready */
OS_TICK TickCtrMatch; /* Absolute time when task is going to be ready */
OS_TICK TickRemain; /* Number of ticks remaining for a match (updated at ... */
/* ... run-time by OS_StatTask() */
OS_TICK TimeQuanta;
OS_TICK TimeQuantaCtr;
#if OS_MSG_EN > 0u
void *MsgPtr; /* Message received */
OS_MSG_SIZE MsgSize;
#endif
#if OS_CFG_TASK_Q_EN > 0u
OS_MSG_Q MsgQ; /* Message queue associated with task */
#if OS_CFG_TASK_PROFILE_EN > 0u
CPU_TS MsgQPendTime; /* Time it took for signal to be received */
CPU_TS MsgQPendTimeMax; /* Max amount of time it took for signal to be received */
#endif
#endif
#if OS_CFG_TASK_REG_TBL_SIZE > 0u
OS_REG RegTbl[OS_CFG_TASK_REG_TBL_SIZE]; /* Task specific registers */
#endif
#if OS_CFG_FLAG_EN > 0u
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) */
#endif
#if OS_CFG_TASK_SUSPEND_EN > 0u
OS_NESTING_CTR SuspendCtr; /* Nesting counter for OSTaskSuspend() */
#endif
#if OS_CFG_TASK_PROFILE_EN > 0u
OS_CPU_USAGE CPUUsage; /* CPU Usage of task (0-100%) */
OS_CTX_SW_CTR CtxSwCtr; /* Number of time the task was switched in */
CPU_TS CyclesDelta; /* value of OS_TS_GET() - .CyclesStart */
CPU_TS CyclesStart; /* Snapshot of cycle counter at start of task resumption */
OS_CYCLES CyclesTotal; /* Total number of # of cycles the task has been running */
OS_CYCLES CyclesTotalPrev; /* Snapshot of previous # of cycles */
CPU_TS SemPendTime; /* Time it took for signal to be received */
CPU_TS SemPendTimeMax; /* Max amount of time it took for signal to be received */
#endif
#if OS_CFG_STAT_TASK_STK_CHK_EN > 0u
CPU_STK_SIZE StkUsed; /* Number of stack elements used from the stack */
CPU_STK_SIZE StkFree; /* Number of stack elements free on the stack */
#endif
#ifdef CPU_CFG_INT_DIS_MEAS_EN
CPU_TS IntDisTimeMax; /* Maximum interrupt disable time */
#endif
#if OS_CFG_SCHED_LOCK_TIME_MEAS_EN > 0u
CPU_TS SchedLockTimeMax; /* Maximum scheduler lock time */
#endif
#if OS_CFG_DBG_EN > 0u
OS_TCB *DbgPrevPtr;
OS_TCB *DbgNextPtr;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -