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

📄 os_core.txt

📁 ucos2.86版本结合STM板极支持包
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;248        OSInitHookBegin();                                           /* Call port specific initialization code   */
000336  f7fff7ff          BL       OSInitHookBegin
;;;249    
;;;250        OS_InitMisc();                                               /* Initialize miscellaneous variables       */
00033a  f7fff7ff          BL       OS_InitMisc
;;;251    
;;;252        OS_InitRdyList();                                            /* Initialize the Ready List                */
00033e  f7fff7ff          BL       OS_InitRdyList
;;;253    
;;;254        OS_InitTCBList();                                            /* Initialize the free list of OS_TCBs      */
000342  f7fff7ff          BL       OS_InitTCBList
;;;255    
;;;256        OS_InitEventList();                                          /* Initialize the free list of OS_EVENTs    */
000346  f7fff7ff          BL       OS_InitEventList
;;;257    
;;;258    #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
;;;259        OS_FlagInit();                                               /* Initialize the event flag structures     */
00034a  f7fff7ff          BL       OS_FlagInit
;;;260    #endif
;;;261    
;;;262    #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
;;;263        OS_MemInit();                                                /* Initialize the memory manager            */
00034e  f7fff7ff          BL       OS_MemInit
;;;264    #endif
;;;265    
;;;266    #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
;;;267        OS_QInit();                                                  /* Initialize the message queue structures  */
000352  f7fff7ff          BL       OS_QInit
;;;268    #endif
;;;269    
;;;270        OS_InitTaskIdle();                                           /* Create the Idle Task                     */
000356  f7fff7ff          BL       OS_InitTaskIdle
;;;271    #if OS_TASK_STAT_EN > 0
;;;272        OS_InitTaskStat();                                           /* Create the Statistic Task                */
00035a  f7fff7ff          BL       OS_InitTaskStat
;;;273    #endif
;;;274    
;;;275    #if OS_TMR_EN > 0
;;;276        OSTmr_Init();                                                /* Initialize the Timer Manager             */
00035e  f7fff7ff          BL       OSTmr_Init
;;;277    #endif
;;;278    
;;;279        OSInitHookEnd();                                             /* Call port specific init. code            */
000362  f7fff7ff          BL       OSInitHookEnd
;;;280    
;;;281    #if OS_DEBUG_EN > 0
;;;282        OSDebugInit();
000366  e8bde8bd          POP      {r4,lr}
00036a  f7fff7ff          B.W      OSDebugInit
;;;283    #endif
;;;284    }
;;;285    /*$PAGE*/
                          ENDP

                  OSIntEnter PROC
;;;312    {
;;;313        if (OSRunning == OS_TRUE) {
00036e  4936              LDR      r1,|L1.1096|
000370  79c8              LDRB     r0,[r1,#7]  ; OSRunning
000372  2801              CMP      r0,#1
000374  d104              BNE      |L1.896|
;;;314            if (OSIntNesting < 255u) {
000376  7888              LDRB     r0,[r1,#2]  ; OSIntNesting
000378  28ff              CMP      r0,#0xff
00037a  d201              BCS      |L1.896|
;;;315                OSIntNesting++;                      /* Increment ISR nesting level                        */
00037c  1c40              ADDS     r0,r0,#1
00037e  7088              STRB     r0,[r1,#2]  ; OSIntNesting
                  |L1.896|
;;;316            }
;;;317        }
;;;318    }
000380  4770              BX       lr
;;;319    /*$PAGE*/
                          ENDP

                  OS_SchedNew PROC
;;;1258   
;;;1259       y             = OSUnMapTbl[OSRdyGrp];
000382  4931              LDR      r1,|L1.1096|
000384  4a3e              LDR      r2,|L1.1152|
000386  7988              LDRB     r0,[r1,#6]  ; OSRdyGrp
000388  5c10              LDRB     r0,[r2,r0]
;;;1260       OSPrioHighRdy = (INT8U)((y << 3) + OSUnMapTbl[OSRdyTbl[y]]);
00038a  f101f101          ADD      r3,r1,#0x1c
00038e  5c1b              LDRB     r3,[r3,r0]
000390  5cd2              LDRB     r2,[r2,r3]
000392  eb02eb02          ADD      r0,r2,r0,LSL #3
000396  7148              STRB     r0,[r1,#5]  ; OSPrioHighRdy
;;;1261   #else                                            /* We support up to 256 tasks                         */
;;;1262       INT8U   y;
;;;1263       INT16U *ptbl;
;;;1264   
;;;1265   
;;;1266       if ((OSRdyGrp & 0xFF) != 0) {
;;;1267           y = OSUnMapTbl[OSRdyGrp & 0xFF];
;;;1268       } else {
;;;1269           y = OSUnMapTbl[(OSRdyGrp >> 8) & 0xFF] + 8;
;;;1270       }
;;;1271       ptbl = &OSRdyTbl[y];
;;;1272       if ((*ptbl & 0xFF) != 0) {
;;;1273           OSPrioHighRdy = (INT8U)((y << 4) + OSUnMapTbl[(*ptbl & 0xFF)]);
;;;1274       } else {
;;;1275           OSPrioHighRdy = (INT8U)((y << 4) + OSUnMapTbl[(*ptbl >> 8) & 0xFF] + 8);
;;;1276       }
;;;1277   #endif
;;;1278   }
000398  4770              BX       lr
;;;1279   
                          ENDP

                  OSIntExit PROC
;;;339    void  OSIntExit (void)
;;;340    {
00039a  b570              PUSH     {r4-r6,lr}
;;;341    #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
;;;342        OS_CPU_SR  cpu_sr = 0;
;;;343    #endif
;;;344    
;;;345    
;;;346    
;;;347        if (OSRunning == OS_TRUE) {
00039c  4c2a              LDR      r4,|L1.1096|
00039e  79e0              LDRB     r0,[r4,#7]  ; OSRunning
0003a0  2801              CMP      r0,#1
0003a2  d121              BNE      |L1.1000|
;;;348            OS_ENTER_CRITICAL();
0003a4  f7fff7ff          BL       OS_CPU_SR_Save
0003a8  4605              MOV      r5,r0
;;;349            if (OSIntNesting > 0) {                            /* Prevent OSIntNesting from wrapping       */
0003aa  78a1              LDRB     r1,[r4,#2]  ; OSIntNesting
0003ac  b109              CBZ      r1,|L1.946|
;;;350                OSIntNesting--;
0003ae  1e48              SUBS     r0,r1,#1
0003b0  70a0              STRB     r0,[r4,#2]  ; OSIntNesting
                  |L1.946|
;;;351            }
;;;352            if (OSIntNesting == 0) {                           /* Reschedule only if all ISRs complete ... */
0003b2  78a0              LDRB     r0,[r4,#2]  ; OSIntNesting
0003b4  b998              CBNZ     r0,|L1.990|
;;;353                if (OSLockNesting == 0) {                      /* ... and not locked.                      */
0003b6  78e0              LDRB     r0,[r4,#3]  ; OSLockNesting
0003b8  b988              CBNZ     r0,|L1.990|
;;;354                    OS_SchedNew();
0003ba  f7fff7ff          BL       OS_SchedNew
;;;355                    if (OSPrioHighRdy != OSPrioCur) {          /* No Ctx Sw if current task is highest rdy */
0003be  7961              LDRB     r1,[r4,#5]  ; OSPrioHighRdy
0003c0  7920              LDRB     r0,[r4,#4]  ; OSPrioCur
0003c2  4281              CMP      r1,r0
0003c4  d00b              BEQ      |L1.990|
;;;356                        OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
0003c6  4821              LDR      r0,|L1.1100|
0003c8  f850f850          LDR      r1,[r0,r1,LSL #2]
0003cc  62e1              STR      r1,[r4,#0x2c]  ; OSTCBHighRdy
;;;357    #if OS_TASK_PROFILE_EN > 0
;;;358                        OSTCBHighRdy->OSTCBCtxSwCtr++;         /* Inc. # of context switches to this task  */
0003ce  6b48              LDR      r0,[r1,#0x34]
0003d0  1c40              ADDS     r0,r0,#1
0003d2  6348              STR      r0,[r1,#0x34]
;;;359    #endif
;;;360                        OSCtxSwCtr++;                          /* Keep track of the number of ctx switches */
0003d4  68e0              LDR      r0,[r4,#0xc]  ; OSCtxSwCtr
0003d6  1c40              ADDS     r0,r0,#1
0003d8  60e0              STR      r0,[r4,#0xc]  ; OSCtxSwCtr
;;;361                        OSIntCtxSw();                          /* Perform interrupt level ctx switch       */
0003da  f7fff7ff          BL       OSIntCtxSw
                  |L1.990|
;;;362                    }
;;;363                }
;;;364            }
;;;365            OS_EXIT_CRITICAL();
0003de  4628              MOV      r0,r5
0003e0  e8bde8bd          POP      {r4-r6,lr}
0003e4  f7fff7ff          B.W      OS_CPU_SR_Restore
                  |L1.1000|
;;;366        }
;;;367    }
0003e8  bd70              POP      {r4-r6,pc}
;;;368    /*$PAGE*/
                          ENDP

                  OSSchedLock PROC
;;;386    void  OSSchedLock (void)
;;;387    {
0003ea  b510              PUSH     {r4,lr}
;;;388    #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
;;;389        OS_CPU_SR  cpu_sr = 0;
;;;390    #endif
;;;391    
;;;392    
;;;393    
;;;394        if (OSRunning == OS_TRUE) {                  /* Make sure multitasking is running                  */
0003ec  4c16              LDR      r4,|L1.1096|
0003ee  79e0              LDRB     r0,[r4,#7]  ; OSRunning
0003f0  2801              CMP      r0,#1
0003f2  d10c              BNE      |L1.1038|
;;;395            OS_ENTER_CRITICAL();
0003f4  f7fff7ff          BL       OS_CPU_SR_Save
;;;396            if (OSIntNesting == 0) {                 /* Can't call from an ISR                             */
0003f8  78a1              LDRB     r1,[r4,#2]  ; OSIntNesting
0003fa  b921              CBNZ     r1,|L1.1030|
;;;397                if (OSLockNesting < 255u) {          /* Prevent OSLockNesting from wrapping back to 0      */
0003fc  78e1              LDRB     r1,[r4,#3]  ; OSLockNesting
0003fe  29ff              CMP      r1,#0xff
000400  d201              BCS      |L1.1030|
;;;398                    OSLockNesting++;                 /* Increment lock nesting level                       */
000402  1c49              ADDS     r1,r1,#1
000404  70e1              STRB     r1,[r4,#3]  ; OSLockNesting
                  |L1.1030|
;;;399                }
;;;400            }
;;;401            OS_EXIT_CRITICAL();
000406  e8bde8bd          POP      {r4,lr}
00040a  f7fff7ff          B.W      OS_CPU_SR_Restore
                  |L1.1038|
;;;402        }
;;;403    }
00040e  bd10              POP      {r4,pc}
;;;404    #endif
                          ENDP

                  OS_Sched PROC
;;;1211   void  OS_Sched (void)
;;;1212   {
000410  b570              PUSH     {r4-r6,lr}
;;;1213   #if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
;;;1214       OS_CPU_SR  cpu_sr = 0;
;;;1215   #endif
;;;1216   
;;;1217   
;;;1218   
;;;1219       OS_ENTER_CRITICAL();
000412  f7fff7ff          BL       OS_CPU_SR_Save
000416  4605              MOV      r5,r0
;;;1220       if (OSIntNesting == 0) {                           /* Schedule only if all ISRs done and ...       */
000418  4c0b              LDR      r4,|L1.1096|
00041a  78a0              LDRB     r0,[r4,#2]  ; OSIntNesting
00041c  b998              CBNZ     r0,|L1.1094|
;;;1221           if (OSLockNesting == 0) {                      /* ... scheduler is not locked                  */
00041e  78e0              LDRB     r0,[r4,#3]  ; OSLockNesting
000420  b988              CBNZ     r0,|L1.1094|
;;;1222               OS_SchedNew();
000422  f7fff7ff          BL       OS_SchedNew
;;;1223               if (OSPrioHighRdy != OSPrioCur) {          /* No Ctx Sw if current task is highest rdy     */
000426  7961              LDRB     r1,[r4,#5]  ; OSPrioHighRdy
000428  7920              LDRB     r0,[r4,#4]  ; OSPrioCur
00042a  4281              CMP      r1,r0
00042c  d00b              BEQ      |L1.1094|
;;;1224                   OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
00042e  4807              LDR      r0,|L1.1100|
000430  f850f850          LDR      r1,[r0,r1,LSL #2]
000434  62e1              STR      r1,[r4,#0x2c]  ; OSTCBHighRdy
;;;1225   #if OS_TASK_PROFILE_EN > 0
;;;1226                   OSTCBHighRdy->OSTCBCtxSwCtr++;         /* Inc. # of context switches to this task      */
000436  6b48              LDR      r0,[r1,#0x34]
000438  1c40              ADDS     r0,r0,#1
00043a  6348              STR      r0,[r1,#0x34]
;;;1227   #endif
;;;1228                   OSCtxSwCtr++;                          /* Increment context switch counter             */
00043c  68e0              LDR      r0,[r4,#0xc]  ; OSCtxSwCtr
00043e  1c40              ADDS     r0,r0,#1
000440  60e0              STR      r0,[r4,#0xc]  ; OSCtxSwCtr
;;;1229                   OS_TASK_SW();                          /* Perform a context switch                     */
000442  f7fff7ff          BL       OSCtxSw
                  |L1.1094|
;;;1230               }
;;;1231           }
;;;1232       }
;;;1233       OS_EXIT_CRITICAL();
000446  e01d              B        |L1.1156|
                  |L1.1096|
000448  00000000          DCD      ||.data||
                  |L1.1100|
00044c  00000540          DCD      ||.bss||+0x540
                  |L1.1104|
000450  00000140          DCD      ||.bss||+0x140

⌨️ 快捷键说明

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