📄 os_core.s
字号:
; if (ptcb->OSTCBDly != 0) { /* Delayed or waiting for event with TO */
movw R30,R20
ldd R2,z+9
ldd R3,z+10
tst R2
brne X4
tst R3
brne X7
xjmp L27
X7:
X4:
.dbline 382
.dbline 383
; if (--ptcb->OSTCBDly == 0) { /* Decrement nbr of ticks to end of delay */
movw R24,R20
adiw R24,9
movw R30,R24
ldd R24,z+0
ldd R25,z+1
sbiw R24,1
movw R4,R24
std z+1,R5
std z+0,R4
cpi R24,0
cpc R24,R25
breq X8
xjmp L29
X8:
X5:
.dbline 383
.dbline 384
; if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) { /* Is task suspended? */
movw R30,R20
ldd R2,z+11
sbrc R2,3
rjmp L31
.dbline 384
.dbline 385
; OSRdyGrp |= ptcb->OSTCBBitY; /* No, Make task R-to-R (timed out)*/
movw R30,R20
ldd R2,z+16
lds R3,_OSRdyGrp
or R3,R2
sts _OSRdyGrp,R3
.dbline 386
; OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
ldi R24,<_OSRdyTbl
ldi R25,>_OSRdyTbl
movw R30,R20
ldd R2,z+14
clr R3
add R2,R24
adc R3,R25
movw R30,R20
ldd R4,z+15
movw R30,R2
ldd R5,z+0
or R5,R4
std z+0,R5
.dbline 387
xjmp L32
L31:
.dbline 387
; } else { /* Yes, Leave 1 tick to prevent ... */
.dbline 388
; ptcb->OSTCBDly = 1; /* ... loosing the task when the ... */
ldi R24,1
ldi R25,0
movw R30,R20
std z+10,R25
std z+9,R24
.dbline 389
; } /* ... suspension is removed. */
L32:
.dbline 390
; }
L29:
.dbline 391
; }
L27:
.dbline 392
movw R30,R20
ldd R20,z+2
ldd R21,z+3
.dbline 393
st -y,r16
pop r16
out 0x3F,r16
ld r16,y+
.dbline 393
.dbline 394
L25:
.dbline 380
movw R30,R20
ldd R24,z+12
cpi R24,20
breq X9
xjmp L24
X9:
.dbline 395
L22:
.dbline -2
L21:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r ptcb 20 pS[os_tcb]
.dbend
.dbfunc e OSVersion _OSVersion fi
.even
_OSVersion::
.dbline -1
.dbline 413
; ptcb = ptcb->OSTCBNext; /* Point at next TCB in TCB list */
; OS_EXIT_CRITICAL();
; }
; }
; }
;
; /*
; *********************************************************************************************************
; * 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)
; {
.dbline 414
; return (OS_VERSION);
ldi R16,252
ldi R17,0
.dbline -2
L33:
.dbline 0 ; func end
ret
.dbend
.dbfunc e OS_Dummy _OS_Dummy fV
.even
_OS_Dummy::
.dbline -1
.dbline 432
; }
;
;
; /*
; *********************************************************************************************************
; * 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)
; {
.dbline -2
L34:
.dbline 0 ; func end
ret
.dbend
.dbfunc s OS_InitEventList _OS_InitEventList fV
.even
_OS_InitEventList:
.dbline -1
.dbline 615
; }
; #endif
;
;
; /*
; *********************************************************************************************************
; * 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
;
; /*
; *********************************************************************************************************
; * 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
;
; /*
; *********************************************************************************************************
; * 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
;
; /*
; *********************************************************************************************************
; * 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
;
; /*
; *********************************************************************************************************
; * 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)
; {
.dbline -2
L35:
.dbline 0 ; func end
ret
.dbend
.dbfunc s OS_InitMisc _OS_InitMisc fV
.even
_OS_InitMisc:
xcall push_gset2
.dbline -1
.dbline 656
; #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
; }
;
; /*
; *********************************************************************************************************
; * INITIALIZATION
; * INITIALIZE MISCELLANEOUS VARIABLES
; *
; * Description: This function is called by OSInit() to initialize miscellaneous variables.
; *
; * Arguments : none
; *
; * Returns : none
; *********************************************************************************************************
; */
;
; static void OS_InitMisc (void)
; {
.dbline 661
; #if OS_TIME_GET_SET_EN > 0
; OSTime = 0L; /* Clear the 32-bit system clock */
; #endif
;
; OSIntNesting = 0; /* Clear the interrupt nesting counter */
clr R2
sts _OSIntNesting,R2
.dbline 662
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -