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

📄 os_task.txt

📁 ucos2 is a file system for embedded applications which can be used on any media, for which you can p
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;226        return (OS_ERR_PRIO_EXIST);
;;;227    }
00019c  e12fff1e          BX       lr
                  |L1.416|
0001a0  e59f67ac          LDR      r6,|L1.2388|
0001a4  e7961104          LDR      r1,[r6,r4,LSL #2]     ;208
0001a8  e3510000          CMP      r1,#0                 ;208
0001ac  1a00001c          BNE      |L1.548|
0001b0  e3a01001          MOV      r1,#1                 ;209
0001b4  e7861104          STR      r1,[r6,r4,LSL #2]     ;209
0001b8  ebfffffe          BL       OS_CPU_SR_Restore
0001bc  e3a03000          MOV      r3,#0                 ;212
0001c0  e1a02008          MOV      r2,r8                 ;212
0001c4  e1a01007          MOV      r1,r7                 ;212
0001c8  e1a00005          MOV      r0,r5                 ;212
0001cc  ebfffffe          BL       OSTaskStkInit
0001d0  e3a03000          MOV      r3,#0                 ;213
0001d4  e1a01000          MOV      r1,r0                 ;213
0001d8  e1a02003          MOV      r2,r3                 ;213
0001dc  e1a00004          MOV      r0,r4                 ;213
0001e0  e58d3000          STR      r3,[sp,#0]            ;213
0001e4  e58d3004          STR      r3,[sp,#4]            ;213
0001e8  e58d3008          STR      r3,[sp,#8]            ;213
0001ec  ebfffffe          BL       OS_TCBInit
0001f0  e1b05000          MOVS     r5,r0                 ;213
0001f4  1a000004          BNE      |L1.524|
0001f8  e59f0764          LDR      r0,|L1.2404|
0001fc  e5d00000          LDRB     r0,[r0,#0]            ;215  ; OSRunning
000200  e3500001          CMP      r0,#1                 ;215
000204  0bfffffe          BLEQ     OS_Sched
000208  ea000003          B        |L1.540|
                  |L1.524|
00020c  ebfffffe          BL       OS_CPU_SR_Save
000210  e3a01000          MOV      r1,#0                 ;220
000214  e7861104          STR      r1,[r6,r4,LSL #2]     ;220
000218  ebfffffe          BL       OS_CPU_SR_Restore
                  |L1.540|
00021c  e1a00005          MOV      r0,r5                 ;223
000220  eaffffdc          B        |L1.408|
                  |L1.548|
000224  ebfffffe          BL       OS_CPU_SR_Restore
000228  e3a00028          MOV      r0,#0x28              ;226
00022c  eaffffd9          B        |L1.408|
;;;228    #endif
                          ENDP

                  OS_TaskStkClr PROC
000230  e3120001          TST      r2,#1                 ;0
000234  13120002          TSTNE    r2,#2                 ;0
000238  012fff1e          BXEQ     lr                    ;0
00023c  e3a02000          MOV      r2,#0                 ;0
                  |L1.576|
000240  e3510000          CMP      r1,#0                 ;0
000244  12411001          SUBNE    r1,r1,#1              ;0
000248  14802004          STRNE    r2,[r0],#4            ;0
00024c  1afffffb          BNE      |L1.576|
000250  e12fff1e          BX       lr                    ;0
                          ENDP

                  OSTaskCreateExt PROC
;;;309                            INT16U   opt)
;;;310    {
000254  e92d4ffe          PUSH     {r1-r11,lr}
000258  e28db030          ADD      r11,sp,#0x30
00025c  e89b0e00          LDM      r11,{r9-r11}
000260  e1a06000          MOV      r6,r0
000264  e1a07001          MOV      r7,r1
000268  e1a08002          MOV      r8,r2
00026c  e1a04003          MOV      r4,r3
;;;311        OS_STK    *psp;
;;;312        INT8U      err;
;;;313    #if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
;;;314        OS_CPU_SR  cpu_sr = 0;
;;;315    #endif
;;;316    
;;;317    
;;;318    
;;;319    #if OS_ARG_CHK_EN > 0
;;;320        if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
;;;321            return (OS_ERR_PRIO_INVALID);
;;;322        }
;;;323    #endif
;;;324        OS_ENTER_CRITICAL();
000270  ebfffffe          BL       OS_CPU_SR_Save
;;;325        if (OSIntNesting > 0) {                  /* Make sure we don't create the task from within an ISR  */
000274  e59f16ec          LDR      r1,|L1.2408|
000278  e5d11000          LDRB     r1,[r1,#0]  ; OSIntNesting
00027c  e3510000          CMP      r1,#0
000280  0a000003          BEQ      |L1.660|
;;;326            OS_EXIT_CRITICAL();
000284  ebfffffe          BL       OS_CPU_SR_Restore
;;;327            return (OS_ERR_TASK_CREATE_ISR);
000288  e3a0003c          MOV      r0,#0x3c
                  |L1.652|
00028c  e8bd4ffe          POP      {r1-r11,lr}
;;;328        }
;;;329        if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
;;;330            OSTCBPrioTbl[prio] = OS_TCB_RESERVED;/* Reserve the priority to prevent others from doing ...  */
;;;331                                                 /* ... the same thing until task is created.              */
;;;332            OS_EXIT_CRITICAL();
;;;333    
;;;334    #if OS_TASK_STAT_STK_CHK_EN > 0
;;;335            OS_TaskStkClr(pbos, stk_size, opt);                    /* Clear the task stack (if needed)     */
;;;336    #endif        
;;;337    
;;;338            psp = OSTaskStkInit(task, p_arg, ptos, opt);           /* Initialize the task's stack          */
;;;339            err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
;;;340            if (err == OS_ERR_NONE) {
;;;341                if (OSRunning == OS_TRUE) {                        /* Find HPT if multitasking has started */
;;;342                    OS_Sched();
;;;343                }
;;;344            } else {
;;;345                OS_ENTER_CRITICAL();
;;;346                OSTCBPrioTbl[prio] = (OS_TCB *)0;                  /* Make this priority avail. to others  */
;;;347                OS_EXIT_CRITICAL();
;;;348            }
;;;349            return (err);
;;;350        }
;;;351        OS_EXIT_CRITICAL();
;;;352        return (OS_ERR_PRIO_EXIST);
;;;353    }
000290  e12fff1e          BX       lr
                  |L1.660|
000294  e59f56b8          LDR      r5,|L1.2388|
000298  e7951104          LDR      r1,[r5,r4,LSL #2]     ;329
00029c  e3510000          CMP      r1,#0                 ;329
0002a0  1a000021          BNE      |L1.812|
0002a4  e3a01001          MOV      r1,#1                 ;330
0002a8  e7851104          STR      r1,[r5,r4,LSL #2]     ;330
0002ac  ebfffffe          BL       OS_CPU_SR_Restore
0002b0  e59d2040          LDR      r2,[sp,#0x40]         ;335
0002b4  e1a0100b          MOV      r1,r11                ;335
0002b8  e1a0000a          MOV      r0,r10                ;335
0002bc  ebfffffe          BL       OS_TaskStkClr
0002c0  e59d3040          LDR      r3,[sp,#0x40]         ;338
0002c4  e1a02008          MOV      r2,r8                 ;338
0002c8  e1a01007          MOV      r1,r7                 ;338
0002cc  e1a00006          MOV      r0,r6                 ;338
0002d0  ebfffffe          BL       OSTaskStkInit
0002d4  e28d303c          ADD      r3,sp,#0x3c           ;339
0002d8  e893000c          LDM      r3,{r2,r3}            ;339
0002dc  e98d000c          STMIB    sp,{r2,r3}            ;339
0002e0  e1a01000          MOV      r1,r0                 ;339
0002e4  e1a03009          MOV      r3,r9                 ;339
0002e8  e1a0200a          MOV      r2,r10                ;339
0002ec  e1a00004          MOV      r0,r4                 ;339
0002f0  e58db000          STR      r11,[sp,#0]           ;339
0002f4  ebfffffe          BL       OS_TCBInit
0002f8  e1b06000          MOVS     r6,r0                 ;339
0002fc  1a000004          BNE      |L1.788|
000300  e59f065c          LDR      r0,|L1.2404|
000304  e5d00000          LDRB     r0,[r0,#0]            ;341  ; OSRunning
000308  e3500001          CMP      r0,#1                 ;341
00030c  0bfffffe          BLEQ     OS_Sched
000310  ea000003          B        |L1.804|
                  |L1.788|
000314  ebfffffe          BL       OS_CPU_SR_Save
000318  e3a01000          MOV      r1,#0                 ;346
00031c  e7851104          STR      r1,[r5,r4,LSL #2]     ;346
000320  ebfffffe          BL       OS_CPU_SR_Restore
                  |L1.804|
000324  e1a00006          MOV      r0,r6                 ;349
000328  eaffffd7          B        |L1.652|
                  |L1.812|
00032c  ebfffffe          BL       OS_CPU_SR_Restore
000330  e3a00028          MOV      r0,#0x28              ;352
000334  eaffffd4          B        |L1.652|
;;;354    #endif
                          ENDP

                  OSTaskDel PROC
;;;393    INT8U  OSTaskDel (INT8U prio)
;;;394    {
000338  e92d47f0          PUSH     {r4-r10,lr}
00033c  e1a05000          MOV      r5,r0
;;;395    #if OS_EVENT_EN
;;;396        OS_EVENT     *pevent;
;;;397    #endif
;;;398    #if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
;;;399        OS_FLAG_NODE *pnode;
;;;400    #endif
;;;401        OS_TCB       *ptcb;
;;;402        INT8U         y;
;;;403    #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
;;;404        OS_CPU_SR     cpu_sr = 0;
;;;405    #endif
;;;406    
;;;407    
;;;408    
;;;409        if (OSIntNesting > 0) {                                     /* See if trying to delete from ISR    */
000340  e59f0620          LDR      r0,|L1.2408|
000344  e5d00000          LDRB     r0,[r0,#0]  ; OSIntNesting
000348  e3500000          CMP      r0,#0
;;;410            return (OS_ERR_TASK_DEL_ISR);
00034c  13a00040          MOVNE    r0,#0x40
000350  1a00000f          BNE      |L1.916|
;;;411        }
;;;412        if (prio == OS_TASK_IDLE_PRIO) {                            /* Not allowed to delete idle task     */
000354  e355001f          CMP      r5,#0x1f
;;;413            return (OS_ERR_TASK_DEL_IDLE);
000358  03a0003e          MOVEQ    r0,#0x3e
00035c  0a00000c          BEQ      |L1.916|
;;;414        }
;;;415    #if OS_ARG_CHK_EN > 0
;;;416        if (prio >= OS_LOWEST_PRIO) {                               /* Task priority valid ?               */
;;;417            if (prio != OS_PRIO_SELF) {
;;;418                return (OS_ERR_PRIO_INVALID);
;;;419            }
;;;420        }
;;;421    #endif
;;;422    
;;;423        OS_ENTER_CRITICAL();
000360  ebfffffe          BL       OS_CPU_SR_Save
;;;424        if (prio == OS_PRIO_SELF) {                                 /* See if requesting to delete self    */
000364  e35500ff          CMP      r5,#0xff
000368  e1a06000          MOV      r6,r0                 ;423
;;;425            prio = OSTCBCur->OSTCBPrio;                             /* Set priority to delete to current   */
00036c  059f05e4          LDREQ    r0,|L1.2392|
;;;426        }
;;;427        ptcb = OSTCBPrioTbl[prio];
000370  e59f75dc          LDR      r7,|L1.2388|
000374  05900000          LDREQ    r0,[r0,#0]            ;425  ; OSTCBCur
000378  05d0502e          LDRBEQ   r5,[r0,#0x2e]         ;425
00037c  e7974105          LDR      r4,[r7,r5,LSL #2]
;;;428        if (ptcb == (OS_TCB *)0) {                                  /* Task to delete must exist           */
000380  e3540000          CMP      r4,#0
000384  1a000004          BNE      |L1.924|
;;;429            OS_EXIT_CRITICAL();
000388  e1a00006          MOV      r0,r6
00038c  ebfffffe          BL       OS_CPU_SR_Restore
;;;430            return (OS_ERR_TASK_NOT_EXIST);
000390  e3a00043          MOV      r0,#0x43
                  |L1.916|
000394  e8bd47f0          POP      {r4-r10,lr}
;;;431        }
;;;432        if (ptcb == OS_TCB_RESERVED) {                              /* Must not be assigned to Mutex       */
;;;433            OS_EXIT_CRITICAL();
;;;434            return (OS_ERR_TASK_DEL);
;;;435        }
;;;436        y            =  ptcb->OSTCBY;
;;;437        OSRdyTbl[y] &= ~ptcb->OSTCBBitX;
;;;438        if (OSRdyTbl[y] == 0) {                                     /* Make task not ready                 */
;;;439            OSRdyGrp &= ~ptcb->OSTCBBitY;
;;;440        }
;;;441        
;;;442    #if OS_EVENT_EN
;;;443        pevent = ptcb->OSTCBEventPtr;
;;;444        if (pevent != (OS_EVENT *)0) {                              /* If task is waiting on event         */
;;;445            pevent->OSEventTbl[y] &= ~ptcb->OSTCBBitX;
;;;446            if (pevent->OSEventTbl[y] == 0) {                       /* ... remove task from ...            */
;;;447                pevent->OSEventGrp &= ~ptcb->OSTCBBitY;             /* ... event ctrl block                */
;;;448            }
;;;449        }

⌨️ 快捷键说明

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