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

📄 os_time.txt

📁 IARSOURCECODE是基于LPC2478嵌入式软件IAR EWARM V4.42的应用实例代码
💻 TXT
📖 第 1 页 / 共 2 页
字号:
;;;164        OS_CPU_SR  cpu_sr = 0;
000188  e3a06000          MOV      r6,#0
;;;165    #endif
;;;166    
;;;167    
;;;168    
;;;169        if (prio >= OS_LOWEST_PRIO) {
00018c  e354001f          CMP      r4,#0x1f
000190  ba000002          BLT      |L1.416|
;;;170            return (OS_ERR_PRIO_INVALID);
000194  e3a0002a          MOV      r0,#0x2a
                  |L1.408|
000198  e8bd4070          POP      {r4-r6,lr}
;;;171        }
;;;172        OS_ENTER_CRITICAL();
;;;173        ptcb = OSTCBPrioTbl[prio];                                 /* Make sure that task exist            */
;;;174        if (ptcb == (OS_TCB *)0) {
;;;175            OS_EXIT_CRITICAL();
;;;176            return (OS_ERR_TASK_NOT_EXIST);                        /* The task does not exist              */
;;;177        }
;;;178        if (ptcb == (OS_TCB *)1) {
;;;179            OS_EXIT_CRITICAL();
;;;180            return (OS_ERR_TASK_NOT_EXIST);                        /* The task does not exist              */
;;;181        }
;;;182        if (ptcb->OSTCBDly == 0) {                                 /* See if task is delayed               */
;;;183            OS_EXIT_CRITICAL();
;;;184            return (OS_ERR_TIME_NOT_DLY);                          /* Indicate that task was not delayed   */
;;;185        }
;;;186    
;;;187        ptcb->OSTCBDly = 0;                                        /* Clear the time delay                 */
;;;188        if ((ptcb->OSTCBStat & OS_STAT_PEND_ANY) != OS_STAT_RDY) {
;;;189            ptcb->OSTCBStat     &= ~OS_STAT_PEND_ANY;              /* Yes, Clear status flag               */
;;;190            ptcb->OSTCBStatPend  =  OS_STAT_PEND_TO;               /* Indicate PEND timeout                */
;;;191        } else {
;;;192            ptcb->OSTCBStatPend  =  OS_STAT_PEND_OK;
;;;193        }
;;;194        if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) {  /* Is task suspended?                   */
;;;195            OSRdyGrp               |= ptcb->OSTCBBitY;             /* No,  Make ready                      */
;;;196            OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
;;;197            OS_EXIT_CRITICAL();
;;;198            OS_Sched();                                            /* See if this is new highest priority  */
;;;199        } else {
;;;200            OS_EXIT_CRITICAL();                                    /* Task may be suspended                */
;;;201        }
;;;202        return (OS_ERR_NONE);
;;;203    }
00019c  e12fff1e          BX       lr
                  |L1.416|
0001a0  ebfffffe          BL       OS_CPU_SR_Save
0001a4  e1a06000          MOV      r6,r0
0001a8  e59f014c          LDR      r0,|L1.764|
0001ac  e7905104          LDR      r5,[r0,r4,LSL #2]
0001b0  e3550000          CMP      r5,#0
0001b4  1a000003          BNE      |L1.456|
0001b8  e1a00006          MOV      r0,r6
0001bc  ebfffffe          BL       OS_CPU_SR_Restore
0001c0  e3a00043          MOV      r0,#0x43
0001c4  eafffff3          B        |L1.408|
                  |L1.456|
0001c8  e3550001          CMP      r5,#1
0001cc  1a000003          BNE      |L1.480|
0001d0  e1a00006          MOV      r0,r6
0001d4  ebfffffe          BL       OS_CPU_SR_Restore
0001d8  e3a00043          MOV      r0,#0x43
0001dc  eaffffed          B        |L1.408|
                  |L1.480|
0001e0  e1d502ba          LDRH     r0,[r5,#0x2a]
0001e4  e3500000          CMP      r0,#0
0001e8  1a000003          BNE      |L1.508|
0001ec  e1a00006          MOV      r0,r6
0001f0  ebfffffe          BL       OS_CPU_SR_Restore
0001f4  e3a00050          MOV      r0,#0x50
0001f8  eaffffe6          B        |L1.408|
                  |L1.508|
0001fc  e3a00000          MOV      r0,#0
000200  e1c502ba          STRH     r0,[r5,#0x2a]
000204  e5d5002c          LDRB     r0,[r5,#0x2c]
000208  e3100037          TST      r0,#0x37
00020c  0a000005          BEQ      |L1.552|
000210  e5d5002c          LDRB     r0,[r5,#0x2c]
000214  e3c00037          BIC      r0,r0,#0x37
000218  e5c5002c          STRB     r0,[r5,#0x2c]
00021c  e3a00001          MOV      r0,#1
000220  e5c5002d          STRB     r0,[r5,#0x2d]
000224  ea000001          B        |L1.560|
                  |L1.552|
000228  e3a00000          MOV      r0,#0
00022c  e5c5002d          STRB     r0,[r5,#0x2d]
                  |L1.560|
000230  e5d5002c          LDRB     r0,[r5,#0x2c]
000234  e3100008          TST      r0,#8
000238  1a000011          BNE      |L1.644|
00023c  e5d50032          LDRB     r0,[r5,#0x32]
000240  e59f10ac          LDR      r1,|L1.756|
000244  e5d11000          LDRB     r1,[r1,#0]  ; OSRdyGrp
000248  e1800001          ORR      r0,r0,r1
00024c  e59f10a0          LDR      r1,|L1.756|
000250  e5c10000          STRB     r0,[r1,#0]  ; OSRdyGrp
000254  e5d50030          LDRB     r0,[r5,#0x30]
000258  e59f1090          LDR      r1,|L1.752|
00025c  e7d10000          LDRB     r0,[r1,r0]
000260  e5d51031          LDRB     r1,[r5,#0x31]
000264  e1800001          ORR      r0,r0,r1
000268  e5d51030          LDRB     r1,[r5,#0x30]
00026c  e59f207c          LDR      r2,|L1.752|
000270  e7c20001          STRB     r0,[r2,r1]
000274  e1a00006          MOV      r0,r6
000278  ebfffffe          BL       OS_CPU_SR_Restore
00027c  ebfffffe          BL       OS_Sched
000280  ea000001          B        |L1.652|
                  |L1.644|
000284  e1a00006          MOV      r0,r6
000288  ebfffffe          BL       OS_CPU_SR_Restore
                  |L1.652|
00028c  e3a00000          MOV      r0,#0
000290  eaffffc0          B        |L1.408|
                          ENDP

                  OSTimeGet PROC
;;;220    INT32U  OSTimeGet (void)
;;;221    {
000294  e92d4070          PUSH     {r4-r6,lr}
;;;222        INT32U     ticks;
;;;223    #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
;;;224        OS_CPU_SR  cpu_sr = 0;
000298  e3a05000          MOV      r5,#0
;;;225    #endif
;;;226    
;;;227    
;;;228    
;;;229        OS_ENTER_CRITICAL();
00029c  ebfffffe          BL       OS_CPU_SR_Save
0002a0  e1a05000          MOV      r5,r0
;;;230        ticks = OSTime;
0002a4  e59f0054          LDR      r0,|L1.768|
0002a8  e5904000          LDR      r4,[r0,#0]  ; OSTime
;;;231        OS_EXIT_CRITICAL();
0002ac  e1a00005          MOV      r0,r5
0002b0  ebfffffe          BL       OS_CPU_SR_Restore
;;;232        return (ticks);
0002b4  e1a00004          MOV      r0,r4
0002b8  e8bd4070          POP      {r4-r6,lr}
;;;233    }
0002bc  e12fff1e          BX       lr
                          ENDP

                  OSTimeSet PROC
;;;249    void  OSTimeSet (INT32U ticks)
;;;250    {
0002c0  e92d4070          PUSH     {r4-r6,lr}
0002c4  e1a04000          MOV      r4,r0
;;;251    #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
;;;252        OS_CPU_SR  cpu_sr = 0;
0002c8  e3a05000          MOV      r5,#0
;;;253    #endif
;;;254    
;;;255    
;;;256    
;;;257        OS_ENTER_CRITICAL();
0002cc  ebfffffe          BL       OS_CPU_SR_Save
0002d0  e1a05000          MOV      r5,r0
;;;258        OSTime = ticks;
0002d4  e59f0024          LDR      r0,|L1.768|
0002d8  e5804000          STR      r4,[r0,#0]  ; OSTime
;;;259        OS_EXIT_CRITICAL();
0002dc  e1a00005          MOV      r0,r5
0002e0  ebfffffe          BL       OS_CPU_SR_Restore
;;;260    }
0002e4  e8bd4070          POP      {r4-r6,lr}
0002e8  e12fff1e          BX       lr
                          ENDP

                  |L1.748|
0002ec  00000000          DCD      OSTCBCur
                  |L1.752|
0002f0  00000000          DCD      OSRdyTbl
                  |L1.756|
0002f4  00000000          DCD      OSRdyGrp
                  |L1.760|
0002f8  0000ffff          DCD      0x0000ffff
                  |L1.764|
0002fc  00000000          DCD      OSTCBPrioTbl
                  |L1.768|
000300  00000000          DCD      OSTime

⌨️ 快捷键说明

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