📄 os_core.src
字号:
; }
; SOURCE LINE # 384
; }
; SOURCE LINE # 385
?C0028:
MOV DPTR,#03H
LJMP ?C?ADDXBP
; END OF _?OSTimeTick
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * GET VERSION
; *
; * Description: This function is used to return the version number of uC/OS-II. The returned value
; * corresponds to uC/OS-II's version number multiplied by 100. In other words, version 2.00
; * would be returned as 200.
; *
; * Arguments : none
; *
; * Returns : the version number of uC/OS-II multiplied by 100.
; *********************************************************************************************************
; */
;
; INT16U OSVersion (void) reentrant
RSEG ?PR?_?OSVersion?OS_CORE
_?OSVersion:
USING 0
; SOURCE LINE # 401
; {
; return (OS_VERSION);
; SOURCE LINE # 403
MOV R6,#00H
MOV R7,#0FCH
; }
; SOURCE LINE # 404
?C0029:
RET
; END OF _?OSVersion
;
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * DUMMY FUNCTION
; *
; * Description: This function doesn't do anything. It is called by OSTaskDel().
; *
; * Arguments : none
; *
; * Returns : none
; *********************************************************************************************************
; */
;
; #if OS_TASK_DEL_EN > 0
; void OS_Dummy (void)
; {
; }
; #endif
;
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * MAKE TASK READY TO RUN BASED ON EVENT OCCURING
; *
; * Description: This function is called by other uC/OS-II services and is used to ready a task that was
; * waiting for an event to occur.
; *
; * Arguments : pevent is a pointer to the event control block corresponding to the event.
; *
; * msg is a pointer to a message. This pointer is used by message oriented services
; * such as MAILBOXEs and QUEUEs. The pointer is not used when called by other
; * service functions.
; *
; * msk is a mask that is used to clear the status byte of the TCB. For example,
; * OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc.
; *
; * Returns : none
; *
; * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
; *********************************************************************************************************
; */
; #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
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * MAKE TASK WAIT FOR EVENT TO OCCUR
; *
; * Description: This function is called by other uC/OS-II services to suspend a task because an event has
; * not occurred.
; *
; * Arguments : pevent is a pointer to the event control block for which the task will be waiting for.
; *
; * Returns : none
; *
; * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
; *********************************************************************************************************
; */
; #if OS_EVENT_EN > 0
; void OS_EventTaskWait (OS_EVENT *pevent)
; {
; OSTCBCur->OSTCBEventPtr = pevent; /* Store pointer to event control block in TCB */
; if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) { /* Task no longer ready */
; OSRdyGrp &= ~OSTCBCur->OSTCBBitY; /* Clear event grp bit if this was only task pending */
; }
; pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX; /* Put task in waiting list */
; pevent->OSEventGrp |= OSTCBCur->OSTCBBitY;
; }
; #endif
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
; *
; * Description: This function is called by other uC/OS-II services to make a task ready to run because a
; * timeout occurred.
; *
; * Arguments : pevent is a pointer to the event control block which is readying a task.
; *
; * Returns : none
; *
; * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
; *********************************************************************************************************
; */
; #if OS_EVENT_EN > 0
; void OS_EventTO (OS_EVENT *pevent)
; {
; if ((pevent->OSEventTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) {
; pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
; }
; OSTCBCur->OSTCBStat = OS_STAT_RDY; /* Set status to ready */
; OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0; /* No longer waiting for event */
; }
; #endif
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * INITIALIZE EVENT CONTROL BLOCK'S WAIT LIST
; *
; * Description: This function is called by other uC/OS-II services to initialize the event wait list.
; *
; * Arguments : pevent is a pointer to the event control block allocated to the event.
; *
; * Returns : none
; *
; * Note : This function is INTERNAL to uC/OS-II and your application should not call it.
; *********************************************************************************************************
; */
; #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) || (OS_SEM_EN > 0) || (OS_MUTEX_EN > 0)
; void OS_EventWaitListInit (OS_EVENT *pevent)
; {
; INT8U *ptbl;
;
;
; pevent->OSEventGrp = 0x00; /* No task waiting on event */
; ptbl = &pevent->OSEventTbl[0];
;
; #if OS_EVENT_TBL_SIZE > 0
; *ptbl++ = 0x00;
; #endif
;
; #if OS_EVENT_TBL_SIZE > 1
; *ptbl++ = 0x00;
; #endif
;
; #if OS_EVENT_TBL_SIZE > 2
; *ptbl++ = 0x00;
; #endif
;
; #if OS_EVENT_TBL_SIZE > 3
; *ptbl++ = 0x00;
; #endif
;
; #if OS_EVENT_TBL_SIZE > 4
; *ptbl++ = 0x00;
; #endif
;
; #if OS_EVENT_TBL_SIZE > 5
; *ptbl++ = 0x00;
; #endif
;
; #if OS_EVENT_TBL_SIZE > 6
; *ptbl++ = 0x00;
; #endif
;
; #if OS_EVENT_TBL_SIZE > 7
; *ptbl = 0x00;
; #endif
; }
; #endif
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * INITIALIZATION
; * INITIALIZE THE FREE LIST OF EVENT CONTROL BLOCKS
; *
; * Description: This function is called by OSInit() to initialize the free list of event control blocks.
; *
; * Arguments : none
; *
; * Returns : none
; *********************************************************************************************************
; */
;
; static void OS_InitEventList (void)
RSEG ?PR?OS_InitEventList?OS_CORE
OS_InitEventList:
; SOURCE LINE # 603
; {
; SOURCE LINE # 604
; #if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
; #if (OS_MAX_EVENTS > 1)
; INT16U i;
; OS_EVENT *pevent1;
; OS_EVENT *pevent2;
;
;
; pevent1 = &OSEventTbl[0];
; pevent2 = &OSEventTbl[1];
; for (i = 0; i < (OS_MAX_EVENTS - 1); i++) { /* Init. list of free EVENT control blocks */
; pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
; pevent1->OSEventPtr = pevent2;
; pevent1++;
; pevent2++;
; }
; pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
; pevent1->OSEventPtr = (OS_EVENT *)0;
; OSEventFreeList = &OSEventTbl[0];
; #else
; OSEventFreeList = &OSEventTbl[0]; /* Only have ONE event control block */
; OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
; OSEventFreeList->OSEventPtr = (OS_EVENT *)0;
; #endif
; #endif
; }
; SOURCE LINE # 629
RET
; END OF OS_InitEventList
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * INITIALIZATION
; * INITIALIZE MISCELLANEOUS VARIABLES
; *
; * Description: This function is called by OSInit() to initialize miscellaneous variables.
; *
; * Arguments : none
; *
; * Returns : none
; *********************************************************************************************************
; */
;
; static void OS_InitMisc (void)
RSEG ?PR?OS_InitMisc?OS_CORE
OS_InitMisc:
USING 0
; SOURCE LINE # 644
; {
; SOURCE LINE # 645
; #if OS_TIME_GET_SET_EN > 0
; OSTime = 0L; /* Clear the 32-bit system clock */
; SOURCE LINE # 647
MOV DPTR,#OSTime
LCALL ?C?LSTKXDATA
DB 00H
DB 00H
DB 00H
DB 00H
; #endif
;
; OSIntNesting = 0; /* Clear the interrupt nesting counter */
; SOURCE LINE # 650
CLR A
MOV DPTR,#OSIntNesting
MOVX @DPTR,A
; OSLockNesting = 0; /* Clear the scheduling lock counter */
; SOURCE LINE # 651
MOV DPTR,#OSLockNesting
MOVX @DPTR,A
;
; OSTaskCtr = 0; /* Clear the number of tasks */
; SOURCE LINE # 653
MOV DPTR,#OSTaskCtr
MOVX @DPTR,A
;
; OSRunning = FALSE; /* Indicate that multitasking not started */
; SOURCE LINE # 655
MOV R0,#LOW (OSRunning)
MOV @R0,A
;
; OSCtxSwCtr = 0; /* Clear the context switch counter */
; SOURCE LINE # 657
MOV DPTR,#OSCtxSwCtr
LCALL ?C?LSTKXDATA
DB 00H
DB 00H
DB 00H
DB 00H
; OSIdleCtr = 0L; /* Clear the 32-bit idle counter */
; SOURCE LINE # 658
MOV DPTR,#OSIdleCtr
LCALL ?C?LSTKXDATA
DB 00H
DB 00H
DB 00H
DB 00H
;
; #if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
; OSIdleCtrRun = 0L;
; OSIdleCtrMax = 0L;
; OSStatRdy = FALSE; /* Statistic task is not ready */
; #endif
; }
; SOURCE LINE # 665
RET
; END OF OS_InitMisc
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * INITIALIZATION
; * INITIALIZE THE READY LIST
; *
; * Description: This function is called by OSInit() to initialize the Ready List.
; *
; * Arguments : none
; *
; * Returns : none
; *********************************************************************************************************
; */
;
; static void OS_InitRdyList (void)
RSEG ?PR?OS_InitRdyList?OS_CORE
OS_InitRdyList:
USING 0
; SOURCE LINE # 680
; {
; SOURCE LINE # 681
; INT16U i;
; INT8U *prdytbl;
;
;
; OSRdyGrp = 0x00; /* Clear the ready list */
; SOURCE LINE # 686
CLR A
MOV DPTR,#OSRdyGrp
MOVX @DPTR,A
; prdytbl = &OSRdyTbl[0];
; SOURCE LINE # 687
MOV DPTR,#prdytbl?1041
INC A
MOVX @DPTR,A
INC DPTR
MOV A,#HIGH (OSRdyTbl)
MOVX @DPTR,A
INC DPTR
MOV A,#LOW (OSRdyTbl)
MOVX @DPTR,A
; for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
; SOURCE LINE # 688
;---- Variable 'i?1040' assigned to Register 'R6/R7' ----
CLR A
MOV R7,A
MOV R6,A
?C0032:
; *prdytbl++ = 0x00;
; SOURCE LINE # 689
MOV DPTR,#prdytbl?1041
MOVX A,@DPTR
MOV R3,A
INC DPTR
CLR A
MOV B,#01H
LCALL ?C?ILDIX
MOV R1,B
MOV R2,A
CLR A
LCALL ?C?CSTPTR
; }
; SOURCE LINE # 690
INC R7
CJNE R7,#00H,?C0053
INC R6
?C0053:
MOV A,R7
XRL A,#02H
ORL A,R6
JNZ ?C0032
?C0033:
;
; OSPrioCur = 0;
; SOURCE LINE # 692
CLR A
MOV R0,#LOW (OSPrioCur)
MOV @R0,A
; OSPrioHighRdy = 0;
; SOURCE LINE # 693
INC R0
MOV @R0,A
;
; OSTCBHighRdy = (OS_TCB *)0;
; SOURCE LINE # 695
MOV R0,#LOW (OSTCBHighRdy)
MOV @R0,A
INC R0
MOV @R0,A
INC R0
MOV @R0,A
; OSTCBCur = (OS_TCB *)0;
; SOURCE LINE # 696
MOV R0,#LOW (OSTCBCur)
MOV @R0,A
INC R0
MOV @R0,A
INC R0
MOV @R0,A
; }
; SOURCE LINE # 697
RET
; END OF OS_InitRdyList
;
; /*$PAGE*/
; /*
; *********************************************************************************************************
; * INITIALIZATION
; * CREATING THE IDLE TASK
; *
; * Description: This function creates the Idle Task.
; *
; * Arguments : none
; *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -