⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_time.lis

📁 1.将uC/OS-II操作系统移植到Mega16上 2.建立两个任务
💻 LIS
字号:
                        .module OS_TIME.C
                        .area text(rom, con, rel)
 0000                   .dbfile C:\icc\examples.avr\AVR_PQ1A_DEMO\21_uCOSII\OS_TIME.C
 0000                   .dbfunc e OSTimeDly _OSTimeDly fV
 0000           ;          ticks -> R20,R21
                        .even
 0000           _OSTimeDly::
 0000 0E940000          xcall push_gset1
 0004 A801              movw R20,R16
 0006                   .dbline -1
 0006                   .dbline 23
 0006           ; 
 0006           ; #ifndef  OS_MASTER_FILE
 0006           ; #include "includes.h"
 0006           ; #endif
 0006           ; 
 0006           ; /*
 0006           ; *********************************************************************************************************
 0006           ; *                                DELAY TASK 'n' TICKS   (n from 0 to 65535)
 0006           ; *
 0006           ; * Description: This function is called to delay execution of the currently running task until the 
 0006           ; *              specified number of system ticks expires.  This, of course, directly equates to delaying
 0006           ; *              the current task for some time to expire.  No delay will result If the specified delay is 
 0006           ; *              0.  If the specified delay is greater than 0 then, a context switch will result.
 0006           ; *
 0006           ; * Arguments  : ticks     is the time delay that the task will be suspended in number of clock 'ticks'.  
 0006           ; *                        Note that by specifying 0, the task will not be delayed.
 0006           ; *
 0006           ; * Returns    : none
 0006           ; *********************************************************************************************************
 0006           ; */
 0006           ; 
 0006           ; void OSTimeDly (INT16U ticks)
 0006           ; {
 0006                   .dbline 24
 0006           ;     if (ticks > 0) 
 0006 4030              cpi R20,0
 0008 4507              cpc R20,R21
 000A 09F4              brne X1
 000C 2FC0              xjmp L3
 000E           X1:
 000E           X0:
 000E                   .dbline 25
 000E           ;       {                                                      /* 0 means no delay!         */
 000E                   .dbline 26
 000E           ;         OS_ENTER_CRITICAL();
 000E 0A93              st -y,r16
 0010 0FB7              in r16,0x3f
 0012 F894              cli
 0014 0F93              push r16
 0016 0991              ld r16,y+
 0018                   .dbline 26
 0018                   .dbline 27
 0018           ;         if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) {  /* Delay current task        */
 0018 80E0              ldi R24,<_OSRdyTbl
 001A 90E0              ldi R25,>_OSRdyTbl
 001C E0910000          lds R30,_OSTCBCur
 0020 F0910100          lds R31,_OSTCBCur+1
 0024 2384              ldd R2,z+11
 0026 3324              clr R3
 0028 280E              add R2,R24
 002A 391E              adc R3,R25
 002C 4484              ldd R4,z+12
 002E 4094              com R4
 0030 F101              movw R30,R2
 0032 5080              ldd R5,z+0
 0034 5420              and R5,R4
 0036 452C              mov R4,R5
 0038 4082              std z+0,R4
 003A 5520              tst R5
 003C 59F4              brne L5
 003E                   .dbline 27
 003E                   .dbline 28
 003E           ;             OSRdyGrp &= ~OSTCBCur->OSTCBBitY;
 003E E0910000          lds R30,_OSTCBCur
 0042 F0910100          lds R31,_OSTCBCur+1
 0046 2584              ldd R2,z+13
 0048 2094              com R2
 004A 30900000          lds R3,_OSRdyGrp
 004E 3220              and R3,R2
 0050 30920000          sts _OSRdyGrp,R3
 0054                   .dbline 29
 0054           ;         }
 0054           L5:
 0054                   .dbline 30
 0054 E0910000          lds R30,_OSTCBCur
 0058 F0910100          lds R31,_OSTCBCur+1
 005C 4683              std z+6,R20
 005E 5783              std z+7,R21
 0060                   .dbline 31
 0060 0A93              st -y,r16
 0062 0F91              pop r16
 0064 0FBF              out 0x3F,r16
 0066 0991              ld r16,y+
 0068                   .dbline 31
 0068                   .dbline 32
 0068 0E940000          xcall _OSSched
 006C                   .dbline 33
 006C           L3:
 006C                   .dbline -2
 006C                   .dbline 34
 006C           ;         OSTCBCur->OSTCBDly = ticks;                                       /* Load ticks in TCB         */
 006C           ;         OS_EXIT_CRITICAL();
 006C           ;         OSSched();                                                        /* Find next task to run!    */
 006C           ;     }
 006C           ; }
 006C           L2:
 006C 0E940000          xcall pop_gset1
 0070                   .dbline 0 ; func end
 0070 0895              ret
 0072                   .dbsym r ticks 20 i
 0072                   .dbend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -