📄 os_time.s
字号:
.module OS_TIME.C
.area text(rom, con, rel)
.dbfile G:\IccPro\ucos_m8_icc\source\OS_TIME.C
.dbfunc e OSTimeDly _OSTimeDly fV
; ticks -> R10,R11
.even
_OSTimeDly::
rcall push_gset3x
movw R10,R16
.dbline -1
.dbline 23
;
; #ifndef OS_MASTER_FILE
; #include "includes.h"
; #endif
;
; /*
; *********************************************************************************************************
; * DELAY TASK 'n' TICKS (n from 0 to 65535)
; *
; * Description: This function is called to delay execution of the currently running task until the
; * specified number of system ticks expires. This, of course, directly equates to delaying
; * the current task for some time to expire. No delay will result If the specified delay is
; * 0. If the specified delay is greater than 0 then, a context switch will result.
; *
; * Arguments : ticks is the time delay that the task will be suspended in number of clock 'ticks'.
; * Note that by specifying 0, the task will not be delayed.
; *
; * Returns : none
; *********************************************************************************************************
; */
;
; void OSTimeDly (INT16U ticks)
; {
.dbline 24
; if (ticks > 0) { /* 0 means no delay! */
tst R10
brne X0
tst R11
brne X1
rjmp L3
X1:
X0:
.dbline 24
.dbline 25
; OS_ENTER_CRITICAL();
st -y,r16
in r16,0x3F
cli
push r16
ld r16,y+
.dbline 25
.dbline 26
; if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) { /* Delay current task */
ldi R24,<_OSRdyTbl
ldi R25,>_OSRdyTbl
lds R30,_OSTCBCur
lds R31,_OSTCBCur+1
ldd R2,z+11
clr R3
add R2,R24
adc R3,R25
lds R30,_OSTCBCur
lds R31,_OSTCBCur+1
ldd R4,z+12
com R4
movw R30,R2
ldd R5,z+0
and R5,R4
mov R4,R5
std z+0,R4
tst R5
brne L5
.dbline 26
.dbline 27
; OSRdyGrp &= ~OSTCBCur->OSTCBBitY;
lds R30,_OSTCBCur
lds R31,_OSTCBCur+1
ldd R2,z+13
com R2
lds R3,_OSRdyGrp
and R3,R2
sts _OSRdyGrp,R3
.dbline 28
; }
L5:
.dbline 29
lds R30,_OSTCBCur
lds R31,_OSTCBCur+1
std z+7,R11
std z+6,R10
.dbline 30
st -y,r16
pop r16
out 0x3F,r16
ld r16,y+
.dbline 30
.dbline 31
rcall _OSSched
.dbline 32
L3:
.dbline -2
L2:
rcall pop_gset3x
.dbline 0 ; func end
ret
.dbsym r ticks 10 i
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -