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

📄 os_core.txt

📁 uc/os在lpc2100系列的KEIL模板 uc/os在lpc2100系列的real view模板 uc/os在lpc210X系列的real view模板
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;631        pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
000188  e5c03000          STRB     r3,[r0,#0]
;;;632        pevent1->OSEventPtr  = (OS_EVENT *)0;
00018c  e5803004          STR      r3,[r0,#4]
;;;633        OSEventFreeList      = &OSEventTbl[0];
000190  e59f06c4          LDR      r0,|L1.2140|
000194  e580c010          STR      r12,[r0,#0x10]  ; OSEventFreeList
;;;634    #else
;;;635        OSEventFreeList              = &OSEventTbl[0];               /* Only have ONE event control block        */
;;;636        OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
;;;637        OSEventFreeList->OSEventPtr  = (OS_EVENT *)0;
;;;638    #endif
;;;639    #endif
;;;640    }
000198  e12fff1e          BX       lr
;;;641    /*$PAGE*/
                          ENDP

                  OS_InitTCBList PROC
;;;830    static  void  OS_InitTCBList (void)
;;;831    {
00019c  e52de004          PUSH     {lr}
;;;832        INT8U    i;
;;;833        OS_TCB  *ptcb1;
;;;834        OS_TCB  *ptcb2;
;;;835    
;;;836    
;;;837        OSTCBList     = (OS_TCB *)0;                                 /* TCB Initialization                       */
0001a0  e59fc6b4          LDR      r12,|L1.2140|
0001a4  e3a03000          MOV      r3,#0
0001a8  e58c302c          STR      r3,[r12,#0x2c]  ; OSTCBList
;;;838        for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table                 */
0001ac  e3a00000          MOV      r0,#0
0001b0  e59f16c4          LDR      r1,|L1.2172|
                  |L1.436|
;;;839            OSTCBPrioTbl[i] = (OS_TCB *)0;
0001b4  e7813100          STR      r3,[r1,r0,LSL #2]
0001b8  e2800001          ADD      r0,r0,#1              ;838
0001bc  e20000ff          AND      r0,r0,#0xff           ;838
0001c0  e350000d          CMP      r0,#0xd               ;838
0001c4  3afffffa          BCC      |L1.436|
;;;840        }
;;;841        ptcb1 = &OSTCBTbl[0];
0001c8  e59f06b0          LDR      r0,|L1.2176|
;;;842        ptcb2 = &OSTCBTbl[1];
0001cc  e280e000          ADD      lr,r0,#0
0001d0  e28e1034          ADD      r1,lr,#0x34
;;;843        for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs                  */
0001d4  e3a02000          MOV      r2,#0
                  |L1.472|
;;;844            ptcb1->OSTCBNext = ptcb2;
0001d8  e5801014          STR      r1,[r0,#0x14]
;;;845            ptcb1++;
0001dc  e2800034          ADD      r0,r0,#0x34
;;;846            ptcb2++;
0001e0  e2811034          ADD      r1,r1,#0x34
0001e4  e2822001          ADD      r2,r2,#1              ;843
0001e8  e20220ff          AND      r2,r2,#0xff           ;843
0001ec  e352000c          CMP      r2,#0xc               ;843
0001f0  3afffff8          BCC      |L1.472|
;;;847        }
;;;848        ptcb1->OSTCBNext = (OS_TCB *)0;                              /* Last OS_TCB                              */
0001f4  e5803014          STR      r3,[r0,#0x14]
;;;849        OSTCBFreeList    = &OSTCBTbl[0];
0001f8  e58ce024          STR      lr,[r12,#0x24]  ; OSTCBFreeList
;;;850    }
0001fc  e49de004          POP      {lr}
000200  e12fff1e          BX       lr
;;;851    /*$PAGE*/
                          ENDP

                  OS_InitRdyList PROC
;;;696    
;;;697        OSRdyGrp      = 0x00;                                        /* Clear the ready list                     */
000204  e59f3650          LDR      r3,|L1.2140|
000208  e3a02000          MOV      r2,#0
00020c  e5c32007          STRB     r2,[r3,#7]  ; OSRdyGrp
;;;698        prdytbl       = &OSRdyTbl[0];
000210  e283000a          ADD      r0,r3,#0xa
;;;699        for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
000214  e3a01000          MOV      r1,#0
                  |L1.536|
;;;700            *prdytbl++ = 0x00;
000218  e4c02001          STRB     r2,[r0],#1
00021c  e2811001          ADD      r1,r1,#1              ;699
000220  e3c11801          BIC      r1,r1,#0x10000        ;699
000224  e3510002          CMP      r1,#2                 ;699
000228  3afffffa          BCC      |L1.536|
;;;701        }
;;;702    
;;;703        OSPrioCur     = 0;
00022c  e5c32005          STRB     r2,[r3,#5]  ; OSPrioCur
;;;704        OSPrioHighRdy = 0;
000230  e5c32006          STRB     r2,[r3,#6]  ; OSPrioHighRdy
;;;705    
;;;706        OSTCBHighRdy  = (OS_TCB *)0;                                 
000234  e5832028          STR      r2,[r3,#0x28]  ; OSTCBHighRdy
;;;707        OSTCBCur      = (OS_TCB *)0;
000238  e5832020          STR      r2,[r3,#0x20]  ; OSTCBCur
;;;708    }
00023c  e12fff1e          BX       lr
;;;709    
                          ENDP

                  OS_InitMisc PROC
;;;657    #if OS_TIME_GET_SET_EN > 0   
;;;658        OSTime        = 0L;                                          /* Clear the 32-bit system clock            */
000240  e59f1614          LDR      r1,|L1.2140|
000244  e3a00000          MOV      r0,#0
000248  e5810030          STR      r0,[r1,#0x30]  ; OSTime
;;;659    #endif
;;;660    
;;;661        OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter      */
00024c  e5c10002          STRB     r0,[r1,#2]  ; OSIntNesting
;;;662        OSLockNesting = 0;                                           /* Clear the scheduling lock counter        */
000250  e5c10004          STRB     r0,[r1,#4]  ; OSLockNesting
;;;663    
;;;664        OSTaskCtr     = 0;                                           /* Clear the number of tasks                */
000254  e5c10009          STRB     r0,[r1,#9]  ; OSTaskCtr
;;;665    
;;;666        OSRunning     = FALSE;                                       /* Indicate that multitasking not started   */
000258  e5c10008          STRB     r0,[r1,#8]  ; OSRunning
;;;667        
;;;668        OSCtxSwCtr    = 0;                                           /* Clear the context switch counter         */
00025c  e581000c          STR      r0,[r1,#0xc]  ; OSCtxSwCtr
;;;669        OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter            */
000260  e581001c          STR      r0,[r1,#0x1c]  ; OSIdleCtr
;;;670    
;;;671    #if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
;;;672        OSIdleCtrRun  = 0L;
000264  e5810018          STR      r0,[r1,#0x18]  ; OSIdleCtrRun
;;;673        OSIdleCtrMax  = 0L;
000268  e5810014          STR      r0,[r1,#0x14]  ; OSIdleCtrMax
;;;674        OSStatRdy     = FALSE;                                       /* Statistic task is not ready              */
00026c  e5c10001          STRB     r0,[r1,#1]  ; OSStatRdy
;;;675    #endif
;;;676    }
000270  e12fff1e          BX       lr
;;;677    /*$PAGE*/
                          ENDP

                  OSInit PROC
;;;85     void  OSInit (void)
;;;86     {
000274  e92d4010          PUSH     {r4,lr}
;;;87     #if OS_VERSION >= 204
;;;88         OSInitHookBegin();                                           /* Call port specific initialization code   */
000278  ebfffffe          BL       OSInitHookBegin
;;;89     #endif
;;;90     
;;;91         OS_InitMisc();                                               /* Initialize miscellaneous variables       */
00027c  ebfffffe          BL       OS_InitMisc
;;;92     
;;;93         OS_InitRdyList();                                            /* Initialize the Ready List                */
000280  ebfffffe          BL       OS_InitRdyList
;;;94         OS_InitTCBList();                                            /* Initialize the free list of OS_TCBs      */
000284  ebfffffe          BL       OS_InitTCBList
;;;95         OS_InitEventList();                                          /* Initialize the free list of OS_EVENTs    */
000288  ebfffffe          BL       OS_InitEventList
;;;96     
;;;97     #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
;;;98         OS_FlagInit();                                               /* Initialize the event flag structures     */
00028c  ebfffffe          BL       OS_FlagInit
;;;99     #endif
;;;100    
;;;101    #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
;;;102        OS_MemInit();                                                /* Initialize the memory manager            */
000290  ebfffffe          BL       OS_MemInit
;;;103    #endif
;;;104    
;;;105    #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
;;;106        OS_QInit();                                                  /* Initialize the message queue structures  */
000294  ebfffffe          BL       OS_QInit
;;;107    #endif
;;;108    
;;;109        OS_InitTaskIdle();                                           /* Create the Idle Task                     */
000298  ebfffffe          BL       OS_InitTaskIdle
;;;110    #if OS_TASK_STAT_EN > 0
;;;111        OS_InitTaskStat();                                           /* Create the Statistic Task                */
00029c  ebfffffe          BL       OS_InitTaskStat
;;;112    #endif
;;;113    
;;;114    #if OS_VERSION >= 204
;;;115        OSInitHookEnd();                                             /* Call port specific init. code            */
0002a0  e8bd4010          POP      {r4,lr}
0002a4  eafffffe          B        OSInitHookEnd
;;;116    #endif
;;;117    }
;;;118    /*$PAGE*/
                          ENDP

                  OSIntEnter PROC
;;;145    {
;;;146        if (OSRunning == TRUE) {
0002a8  e59f15ac          LDR      r1,|L1.2140|
0002ac  e5d10008          LDRB     r0,[r1,#8]  ; OSRunning
0002b0  e3500001          CMP      r0,#1
0002b4  1a000004          BNE      |L1.716|
;;;147            if (OSIntNesting < 255) {
0002b8  e5d10002          LDRB     r0,[r1,#2]  ; OSIntNesting
0002bc  e35000ff          CMP      r0,#0xff
0002c0  2a000001          BCS      |L1.716|
;;;148                OSIntNesting++;                      /* Increment ISR nesting level                        */
0002c4  e2800001          ADD      r0,r0,#1
0002c8  e5c10002          STRB     r0,[r1,#2]  ; OSIntNesting
                  |L1.716|
;;;149            }
;;;150        }
;;;151    }
0002cc  e12fff1e          BX       lr
;;;152    /*$PAGE*/
                          ENDP

                  OSIntExit PROC
;;;172    void  OSIntExit (void)
;;;173    {
0002d0  e92d4010          PUSH     {r4,lr}
;;;174    #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
;;;175        OS_CPU_SR  cpu_sr;
;;;176    #endif
;;;177        
;;;178        
;;;179        if (OSRunning == TRUE) {
0002d4  e59f4580          LDR      r4,|L1.2140|
0002d8  e5d40008          LDRB     r0,[r4,#8]  ; OSRunning
0002dc  e3500001          CMP      r0,#1
0002e0  1a00001d          BNE      |L1.860|
;;;180            OS_ENTER_CRITICAL();
0002e4  ef000002          SVC      #0x2
;;;181            if (OSIntNesting > 0) {                            /* Prevent OSIntNesting from wrapping       */
0002e8  e5d40002          LDRB     r0,[r4,#2]  ; OSIntNesting
0002ec  e3500000          CMP      r0,#0
0002f0  0a000001          BEQ      |L1.764|
;;;182                OSIntNesting--;
0002f4  e2400001          SUB      r0,r0,#1
0002f8  e5c40002          STRB     r0,[r4,#2]  ; OSIntNesting
                  |L1.764|
;;;183            }
;;;184            if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ... */
0002fc  e5d40002          LDRB     r0,[r4,#2]  ; OSIntNesting
000300  e5d41004          LDRB     r1,[r4,#4]  ; OSLockNesting
000304  e1900001          ORRS     r0,r0,r1
000308  1a000015          BNE      |L1.868|
;;;185                OSIntExitY    = OSUnMapTbl[OSRdyGrp];          /* ... and not locked.                      */
00030c  e5d40007          LDRB     r0,[r4,#7]  ; OSRdyGrp
000310  e59f156c          LDR      r1,|L1.2180|
000314  e7d10000          LDRB     r0,[r1,r0]
000318  e5c40003          STRB     r0,[r4,#3]  ; OSIntExitY
;;;186                OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
00031c  e5d40003          LDRB     r0,[r4,#3]  ; OSIntExitY
000320  e59f2560          LDR      r2,|L1.2184|
000324  e7d22000          LDRB     r2,[r2,r0]
000328  e7d11002          LDRB     r1,[r1,r2]
00032c  e0810180          ADD      r0,r1,r0,LSL #3
000330  e20000ff          AND      r0,r0,#0xff
000334  e5c40006          STRB     r0,[r4,#6]  ; OSPrioHighRdy
;;;187                if (OSPrioHighRdy != OSPrioCur) {              /* No Ctx Sw if current task is highest rdy */
000338  e5d41005          LDRB     r1,[r4,#5]  ; OSPrioCur
00033c  e1500001          CMP      r0,r1
000340  0a000007          BEQ      |L1.868|
;;;188                    OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
000344  e59f1530          LDR      r1,|L1.2172|
000348  e7910100          LDR      r0,[r1,r0,LSL #2]
00034c  e5840028          STR      r0,[r4,#0x28]  ; OSTCBHighRdy
;;;189                    OSCtxSwCtr++;                              /* Keep track of the number of ctx switches */

⌨️ 快捷键说明

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