📄 os_cpu_c.lst
字号:
=2 } OS_Q_DATA;
=2 #endif
196 =2
197 =2 /*
198 =2 *********************************************************************************************************
199 =2 * SEMAPHORE DATA
200 =2 *********************************************************************************************************
201 =2 */
202 =2
203 =2 #if OS_SEM_EN
204 =2 typedef struct {
205 =2 INT16U OSCnt; /* Semaphore count */
206 =2 INT8U OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */
207 =2 INT8U OSEventGrp; /* Group corresponding to tasks waiting for event to occur */
208 =2 } OS_SEM_DATA;
209 =2 #endif
210 =2
211 =2 /*
212 =2 *********************************************************************************************************
213 =2 * TASK STACK DATA
214 =2 *********************************************************************************************************
215 =2 */
216 =2
217 =2 #if OS_TASK_CREATE_EXT_EN
=2 typedef struct {
=2 INT32U OSFree; /* Number of free bytes on the stack */
=2 INT32U OSUsed; /* Number of bytes used on the stack */
=2 } OS_STK_DATA;
=2 #endif
223 =2
224 =2 /*$PAGE*/
225 =2 /*
226 =2 *********************************************************************************************************
227 =2 * TASK CONTROL BLOCK
228 =2 *********************************************************************************************************
229 =2 */
230 =2
231 =2 typedef struct os_tcb {
232 =2 OS_STK *OSTCBStkPtr; /* Pointer to current top of stack */
233 =2
234 =2 #if OS_TASK_CREATE_EXT_EN
=2 void *OSTCBExtPtr; /* Pointer to user definable data for TCB extension */
=2 OS_STK *OSTCBStkBottom; /* Pointer to bottom of stack */
=2 INT32U OSTCBStkSize; /* Size of task stack (in bytes) */
=2 INT16U OSTCBOpt; /* Task options as passed by OSTaskCreateExt() */
=2 INT16U OSTCBId; /* Task ID (0..65535) */
C51 COMPILER V7.01 OS_CPU_C 02/20/2003 17:21:50 PAGE 8
=2 #endif
241 =2
242 =2 struct os_tcb *OSTCBNext; /* Pointer to next TCB in the TCB list */
243 =2 struct os_tcb *OSTCBPrev; /* Pointer to previous TCB in the TCB list */
244 =2
245 =2 #if (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_MBOX_EN || OS_SEM_EN
246 =2 OS_EVENT *OSTCBEventPtr; /* Pointer to event control block */
247 =2 #endif
248 =2
249 =2 #if (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_MBOX_EN
=2 void *OSTCBMsg; /* Message received from OSMboxPost() or OSQPost() */
=2 #endif
252 =2
253 =2 INT16U OSTCBDly; /* Nbr ticks to delay task or, timeout waiting for event */
254 =2 INT8U OSTCBStat; /* Task status */
255 =2 INT8U OSTCBPrio; /* Task priority (0 == highest, 63 == lowest) */
256 =2
257 =2 INT8U OSTCBX; /* Bit position in group corresponding to task priority (0..7) */
258 =2 INT8U OSTCBY; /* Index into ready table corresponding to task priority */
259 =2 INT8U OSTCBBitX; /* Bit mask to access bit position in ready table */
260 =2 INT8U OSTCBBitY; /* Bit mask to access bit position in ready group */
261 =2
262 =2 #if OS_TASK_DEL_EN
=2 BOOLEAN OSTCBDelReq; /* Indicates whether a task needs to delete itself */
=2 #endif
265 =2 } OS_TCB;
266 =2
267 =2 /*$PAGE*/
268 =2 /*
269 =2 *********************************************************************************************************
270 =2 * GLOBAL VARIABLES
271 =2 *********************************************************************************************************
272 =2 */
273 =2
274 =2 OS_EXT INT32U OSCtxSwCtr; /* Counter of number of context switches */
275 =2
276 =2 #if (OS_MAX_EVENTS >= 2)
277 =2 OS_EXT OS_EVENT *OSEventFreeList; /* Pointer to list of free EVENT control blocks */
278 =2 OS_EXT OS_EVENT OSEventTbl[OS_MAX_EVENTS];/* Table of EVENT control blocks */
279 =2 #endif
280 =2
281 =2 OS_EXT INT32U OSIdleCtr; /* Idle counter */
282 =2
283 =2 #if OS_TASK_STAT_EN
=2 OS_EXT INT8S OSCPUUsage; /* Percentage of CPU used */
=2 OS_EXT INT32U OSIdleCtrMax; /* Maximum value that idle counter can take in 1 sec. */
=2 OS_EXT INT32U OSIdleCtrRun; /* Value reached by idle counter at run time in 1 sec. */
=2 OS_EXT BOOLEAN OSStatRdy; /* Flag indicating that the statistic task is ready */
=2 #endif
289 =2
290 =2 OS_EXT INT8U OSIntNesting; /* Interrupt nesting level */
291 =2
292 =2 OS_EXT INT8U OSLockNesting; /* Multitasking lock nesting level */
293 =2
294 =2 OS_EXT idata INT8U OSPrioCur; /* Priority of current task */
295 =2 OS_EXT idata INT8U OSPrioHighRdy; /* Priority of highest priority task */
296 =2
297 =2 OS_EXT INT8U OSRdyGrp; /* Ready list group */
298 =2 OS_EXT INT8U OSRdyTbl[OS_RDY_TBL_SIZE]; /* Table of tasks which are ready to run */
299 =2
300 =2 OS_EXT idata BOOLEAN OSRunning; /* Flag indicating that kernel is running */
301 =2
C51 COMPILER V7.01 OS_CPU_C 02/20/2003 17:21:50 PAGE 9
302 =2 #if OS_TASK_CREATE_EN || OS_TASK_CREATE_EXT_EN || OS_TASK_DEL_EN
303 =2 OS_EXT INT8U OSTaskCtr; /* Number of tasks created */
304 =2 #endif
305 =2
306 =2 OS_EXT idata OS_TCB *OSTCBCur; /* Pointer to currently running TCB *
-/
307 =2 OS_EXT OS_TCB *OSTCBFreeList; /* Pointer to list of free TCBs *
-/
308 =2 OS_EXT idata OS_TCB *OSTCBHighRdy; /* Pointer to highest priority TCB ready to run *
-/
309 =2 OS_EXT OS_TCB *OSTCBList; /* Pointer to doubly linked list of TCBs *
-/
310 =2 OS_EXT OS_TCB *OSTCBPrioTbl[OS_LOWEST_PRIO + 1];/* Table of pointers to created TCBs *
-/
311 =2
312 =2 OS_EXT INT32U OSTime; /* Current value of system time (in ticks) */
313 =2
314 =2
315 =2 extern INT8U const OSMapTbl[]; /* Priority->Bit Mask lookup table */
316 =2 extern INT8U const OSUnMapTbl[]; /* Priority->Index lookup table */
317 =2
318 =2 /*$PAGE*/
319 =2 /*
320 =2 *********************************************************************************************************
321 =2 * FUNCTION PROTOTYPES
322 =2 * (Target Independant Functions)
323 =2 *********************************************************************************************************
324 =2 */
325 =2
326 =2 /*
327 =2 *********************************************************************************************************
328 =2 * MESSAGE MAILBOX MANAGEMENT
329 =2 *********************************************************************************************************
330 =2 */
331 =2 #if OS_MBOX_EN
=2 void *OSMboxAccept(OS_EVENT *pevent) reentrant;
=2 OS_EVENT *OSMboxCreate(void *msg) reentrant;
=2 void *OSMboxPend(OS_EVENT *pevent, INT16U timeout, INT8U *err) reentrant;
=2 INT8U OSMboxPost(OS_EVENT *pevent, void *msg) reentrant;
=2 INT8U OSMboxQuery(OS_EVENT *pevent, OS_MBOX_DATA *ppdata) reentrant;
=2 #endif
338 =2 /*
339 =2 *********************************************************************************************************
340 =2 * MEMORY MANAGEMENT
341 =2 *********************************************************************************************************
342 =2 */
343 =2 #if OS_MEM_EN && (OS_MAX_MEM_PART >= 2)
=2 OS_MEM *OSMemCreate(void *addr, INT32U nblks, INT32U blksize, INT8U *err) reentrant;
=2 void *OSMemGet(OS_MEM *pmem, INT8U *err) reentrant;
=2 INT8U OSMemPut(OS_MEM *pmem, void *pblk) reentrant;
=2 INT8U OSMemQuery(OS_MEM *pmem, OS_MEM_DATA *ppdata) reentrant;
=2 #endif
349 =2 /*
350 =2 *********************************************************************************************************
351 =2 * MESSAGE QUEUE MANAGEMENT
352 =2 *********************************************************************************************************
353 =2 */
354 =2 #if OS_Q_EN && (OS_MAX_QS >= 2)
=2 void *OSQAccept(OS_EVENT *pevent) reentrant;
=2 OS_EVENT *OSQCreate(void **start, INT16U size) reentrant;
=2 INT8U OSQFlush(OS_EVENT *pevent) reentrant;
=2 void *OSQPend(OS_EVENT *pevent, INT16U timeout, INT8U *err) reentrant;
C51 COMPILER V7.01 OS_CPU_C 02/20/2003 17:21:50 PAGE 10
=2 INT8U OSQPost(OS_EVENT *pevent, void *msg) reentrant;
=2 INT8U OSQPostFront(OS_EVENT *pevent, void *msg) reentrant;
=2 INT8U OSQQuery(OS_EVENT *pevent, OS_Q_DATA *ppdata) reentrant;
=2 #endif
363 =2 /*$PAGE*/
364 =2 /*
365 =2 *********************************************************************************************************
366 =2 * SEMAPHORE MANAGEMENT
367 =2 *********************************************************************************************************
368 =2 */
369 =2 #if OS_SEM_EN
370 =2 INT16U OSSemAccept(OS_EVENT *pevent) reentrant;
371 =2 OS_EVENT *OSSemCreate(INT16U value) reentrant;
372 =2 void OSSemPend(OS_EVENT *pevent, INT16U timeout, INT8U *err) reentrant;
373 =2 INT8U OSSemPost(OS_EVENT *pevent) reentrant;
374 =2 INT8U OSSemQuery(OS_EVENT *pevent, OS_SEM_DATA *ppdata) reentrant;
375 =2 #endif
376 =2 /*
377 =2 *********************************************************************************************************
378 =2 * TASK MANAGEMENT
379 =2 *********************************************************************************************************
380 =2 */
381 =2 #if OS_TASK_CHANGE_PRIO_EN
=2 INT8U OSTaskChangePrio(INT8U oldprio, INT8U newprio) reentrant;
=2 #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -