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

📄 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 页
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 919] for uVision
; commandline ArmCC [--debug -c --asm --interleave -o.\rvmdk\os_task.o --depend=.\rvmdk\os_task.d --device=DARMP --apcs=interwork -I. -I..\BSP -I..\..\..\..\..\uCOS-II\Ports\ARM\Generic\RealView -I..\..\..\..\..\uCOS-II\Source -I..\..\..\..\..\uCOSView\Source -I..\..\..\..\..\uCOSView\Ports\ARM7\LPC2000\IAR -I..\..\..\..\..\uC-CPU -I..\..\..\..\..\uC-CPU\ARM\RealView -I..\..\..\..\..\uC-LIB -I..\..\..\..\..\uC-Probe\Target\Plugins\uCOS-II -IC:\Keil\ARM\INC\Philips --omf_browse=.\rvmdk\os_task.crf ..\..\..\..\..\uCOS-II\Source\os_task.c]
                          ARM

                          AREA ||.text||, CODE, READONLY, ALIGN=2

                  OSTaskChangePrio PROC
;;;51     INT8U  OSTaskChangePrio (INT8U oldprio, INT8U newprio)
;;;52     {
000000  e92d47f0          PUSH     {r4-r10,lr}
000004  e1a05000          MOV      r5,r0
000008  e1a04001          MOV      r4,r1
;;;53     #if OS_EVENT_EN
;;;54         OS_EVENT    *pevent;
;;;55     #endif
;;;56         OS_TCB      *ptcb;
;;;57         INT8U        x;
;;;58         INT8U        y;
;;;59     #if OS_LOWEST_PRIO <= 63
;;;60         INT8U        bitx;
;;;61         INT8U        bity;
;;;62     #else
;;;63         INT16U       bitx;
;;;64         INT16U       bity;
;;;65     #endif
;;;66         INT8U        y_old;
;;;67     #if OS_CRITICAL_METHOD == 3
;;;68         OS_CPU_SR    cpu_sr = 0;                                    /* Storage for CPU status register     */
;;;69     #endif
;;;70     
;;;71     
;;;72     
;;;73     #if OS_ARG_CHK_EN > 0
;;;74         if (oldprio >= OS_LOWEST_PRIO) {
;;;75             if (oldprio != OS_PRIO_SELF) {
;;;76                 return (OS_ERR_PRIO_INVALID);
;;;77             }
;;;78         }
;;;79         if (newprio >= OS_LOWEST_PRIO) {
;;;80             return (OS_ERR_PRIO_INVALID);
;;;81         }
;;;82     #endif
;;;83         OS_ENTER_CRITICAL();
00000c  ebfffffe          BL       OS_CPU_SR_Save
;;;84         if (OSTCBPrioTbl[newprio] != (OS_TCB *)0) {                 /* New priority must not already exist */
000010  e59f293c          LDR      r2,|L1.2388|
000014  e7921104          LDR      r1,[r2,r4,LSL #2]
000018  e3510000          CMP      r1,#0
00001c  0a000003          BEQ      |L1.48|
;;;85             OS_EXIT_CRITICAL();
000020  ebfffffe          BL       OS_CPU_SR_Restore
;;;86             return (OS_ERR_PRIO_EXIST);
000024  e3a00028          MOV      r0,#0x28
                  |L1.40|
000028  e8bd47f0          POP      {r4-r10,lr}
;;;87         }
;;;88         if (oldprio == OS_PRIO_SELF) {                              /* See if changing self                */
;;;89             oldprio = OSTCBCur->OSTCBPrio;                          /* Yes, get priority                   */
;;;90         }
;;;91         ptcb = OSTCBPrioTbl[oldprio];
;;;92         if (ptcb == (OS_TCB *)0) {                                  /* Does task to change exist?          */
;;;93             OS_EXIT_CRITICAL();                                     /* No, can't change its priority!      */
;;;94             return (OS_ERR_PRIO);
;;;95         }
;;;96         if (ptcb == OS_TCB_RESERVED) {                              /* Is task assigned to Mutex           */
;;;97             OS_EXIT_CRITICAL();                                     /* No, can't change its priority!      */
;;;98             return (OS_ERR_TASK_NOT_EXIST);
;;;99         }
;;;100    #if OS_LOWEST_PRIO <= 63
;;;101        y                     = (INT8U)(newprio >> 3);              /* Yes, compute new TCB fields         */
;;;102        x                     = (INT8U)(newprio & 0x07);
;;;103        bity                  = (INT8U)(1 << y);
;;;104        bitx                  = (INT8U)(1 << x);
;;;105    #else
;;;106        y                     = (INT8U)((newprio >> 4) & 0x0F);
;;;107        x                     = (INT8U)( newprio & 0x0F);
;;;108        bity                  = (INT16U)(1 << y);
;;;109        bitx                  = (INT16U)(1 << x);
;;;110    #endif
;;;111    
;;;112        OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                        /* Remove TCB from old priority        */
;;;113        OSTCBPrioTbl[newprio] = ptcb;                               /* Place pointer to TCB @ new priority */
;;;114        y_old                 = ptcb->OSTCBY;
;;;115        if ((OSRdyTbl[y_old] & ptcb->OSTCBBitX) != 0) {             /* If task is ready make it not        */
;;;116            OSRdyTbl[y_old] &= ~ptcb->OSTCBBitX;
;;;117            if (OSRdyTbl[y_old] == 0) {
;;;118                OSRdyGrp &= ~ptcb->OSTCBBitY;
;;;119            }
;;;120            OSRdyGrp    |= bity;                                    /* Make new priority ready to run      */
;;;121            OSRdyTbl[y] |= bitx;
;;;122        }
;;;123    #if OS_EVENT_EN
;;;124        pevent = ptcb->OSTCBEventPtr;
;;;125        if (pevent != (OS_EVENT *)0) {                              /* ... remove from event wait list     */
;;;126            pevent->OSEventTbl[y_old] &= ~ptcb->OSTCBBitX;
;;;127            if (pevent->OSEventTbl[y_old] == 0) {
;;;128                pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
;;;129            }
;;;130            pevent->OSEventGrp    |= bity;                          /* Add new priority to wait list       */
;;;131            pevent->OSEventTbl[y] |= bitx;
;;;132        }
;;;133    #endif
;;;134        ptcb->OSTCBPrio = newprio;                                  /* Set new task priority               */
;;;135        ptcb->OSTCBY    = y;
;;;136        ptcb->OSTCBX    = x;
;;;137        ptcb->OSTCBBitY = bity;
;;;138        ptcb->OSTCBBitX = bitx;
;;;139        OS_EXIT_CRITICAL();
;;;140        if (OSRunning == OS_TRUE) {
;;;141            OS_Sched();                                             /* Find new highest priority task      */
;;;142        }
;;;143        return (OS_ERR_NONE);
;;;144    }
00002c  e12fff1e          BX       lr
                  |L1.48|
000030  e35500ff          CMP      r5,#0xff              ;88
000034  059f191c          LDREQ    r1,|L1.2392|
000038  05911000          LDREQ    r1,[r1,#0]            ;89  ; OSTCBCur
00003c  05d1502e          LDRBEQ   r5,[r1,#0x2e]         ;89
000040  e7921105          LDR      r1,[r2,r5,LSL #2]     ;91
000044  e3510000          CMP      r1,#0                 ;92
000048  1a000002          BNE      |L1.88|
00004c  ebfffffe          BL       OS_CPU_SR_Restore
000050  e3a00029          MOV      r0,#0x29              ;94
000054  eafffff3          B        |L1.40|
                  |L1.88|
000058  e3510001          CMP      r1,#1                 ;96
00005c  1a000002          BNE      |L1.108|
000060  ebfffffe          BL       OS_CPU_SR_Restore
000064  e3a00043          MOV      r0,#0x43              ;98
000068  eaffffee          B        |L1.40|
                  |L1.108|
00006c  e1a031a4          LSR      r3,r4,#3              ;101
000070  e3a0c001          MOV      r12,#1                ;103
000074  e1a0e31c          LSL      lr,r12,r3             ;103
000078  e2047007          AND      r7,r4,#7              ;102
00007c  e1a0c71c          LSL      r12,r12,r7            ;104
000080  e20e60ff          AND      r6,lr,#0xff           ;103
000084  e20ce0ff          AND      lr,r12,#0xff          ;104
000088  e3a0c000          MOV      r12,#0                ;112
00008c  e782c105          STR      r12,[r2,r5,LSL #2]    ;112
000090  e7821104          STR      r1,[r2,r4,LSL #2]     ;113
000094  e5d1c030          LDRB     r12,[r1,#0x30]        ;114
000098  e59f88bc          LDR      r8,|L1.2396|
00009c  e5d12031          LDRB     r2,[r1,#0x31]         ;115
0000a0  e7d8500c          LDRB     r5,[r8,r12]           ;115
0000a4  e1150002          TST      r5,r2                 ;115
0000a8  0a00000e          BEQ      |L1.232|
0000ac  e1c52002          BIC      r2,r5,r2              ;116
0000b0  e7c8200c          STRB     r2,[r8,r12]           ;116
0000b4  e7d8500c          LDRB     r5,[r8,r12]           ;117
0000b8  e59f28a0          LDR      r2,|L1.2400|
0000bc  e3550000          CMP      r5,#0                 ;117
0000c0  05d15032          LDRBEQ   r5,[r1,#0x32]         ;118
0000c4  05d29000          LDRBEQ   r9,[r2,#0]            ;118  ; OSRdyGrp
0000c8  01c95005          BICEQ    r5,r9,r5              ;118
0000cc  05c25000          STRBEQ   r5,[r2,#0]            ;118  ; OSRdyGrp
0000d0  e5d25000          LDRB     r5,[r2,#0]            ;120  ; OSRdyGrp
0000d4  e1855006          ORR      r5,r5,r6              ;120
0000d8  e5c25000          STRB     r5,[r2,#0]            ;120  ; OSRdyGrp
0000dc  e7d82003          LDRB     r2,[r8,r3]            ;121
0000e0  e182200e          ORR      r2,r2,lr              ;121
0000e4  e7c82003          STRB     r2,[r8,r3]            ;121
                  |L1.232|
0000e8  e591201c          LDR      r2,[r1,#0x1c]         ;124
0000ec  e3520000          CMP      r2,#0                 ;125
0000f0  0a000010          BEQ      |L1.312|
0000f4  e08cc002          ADD      r12,r12,r2            ;126
0000f8  e5dc500b          LDRB     r5,[r12,#0xb]         ;126
0000fc  e5d18031          LDRB     r8,[r1,#0x31]         ;126
000100  e1c55008          BIC      r5,r5,r8              ;126
000104  e31500ff          TST      r5,#0xff              ;127
000108  e5cc500b          STRB     r5,[r12,#0xb]         ;126
00010c  05d2c00a          LDRBEQ   r12,[r2,#0xa]         ;128
000110  05d15032          LDRBEQ   r5,[r1,#0x32]         ;128
000114  01ccc005          BICEQ    r12,r12,r5            ;128
000118  05c2c00a          STRBEQ   r12,[r2,#0xa]         ;128
00011c  e5d2c00a          LDRB     r12,[r2,#0xa]         ;130
000120  e18cc006          ORR      r12,r12,r6            ;130
000124  e5c2c00a          STRB     r12,[r2,#0xa]         ;130
000128  e0822003          ADD      r2,r2,r3              ;131
00012c  e5d2c00b          LDRB     r12,[r2,#0xb]         ;131
000130  e18cc00e          ORR      r12,r12,lr            ;131
000134  e5c2c00b          STRB     r12,[r2,#0xb]         ;131
                  |L1.312|
000138  e5c1402e          STRB     r4,[r1,#0x2e]         ;134
00013c  e5c13030          STRB     r3,[r1,#0x30]         ;135
000140  e5c1702f          STRB     r7,[r1,#0x2f]         ;136
000144  e5c16032          STRB     r6,[r1,#0x32]         ;137
000148  e5c1e031          STRB     lr,[r1,#0x31]         ;138
00014c  ebfffffe          BL       OS_CPU_SR_Restore
000150  e59f080c          LDR      r0,|L1.2404|
000154  e5d00000          LDRB     r0,[r0,#0]            ;140  ; OSRunning
000158  e3500001          CMP      r0,#1                 ;140
00015c  0bfffffe          BLEQ     OS_Sched
000160  e3a00000          MOV      r0,#0                 ;143
000164  eaffffaf          B        |L1.40|
;;;145    #endif
                          ENDP

                  OSTaskCreate PROC
;;;188    INT8U  OSTaskCreate (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT8U prio)
;;;189    {
000168  e92d43fe          PUSH     {r1-r9,lr}
00016c  e1a05000          MOV      r5,r0
000170  e1a07001          MOV      r7,r1
000174  e1a08002          MOV      r8,r2
000178  e1a04003          MOV      r4,r3
;;;190        OS_STK    *psp;
;;;191        INT8U      err;
;;;192    #if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
;;;193        OS_CPU_SR  cpu_sr = 0;
;;;194    #endif
;;;195    
;;;196    
;;;197    
;;;198    #if OS_ARG_CHK_EN > 0
;;;199        if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
;;;200            return (OS_ERR_PRIO_INVALID);
;;;201        }
;;;202    #endif
;;;203        OS_ENTER_CRITICAL();
00017c  ebfffffe          BL       OS_CPU_SR_Save
;;;204        if (OSIntNesting > 0) {                  /* Make sure we don't create the task from within an ISR  */
000180  e59f17e0          LDR      r1,|L1.2408|
000184  e5d11000          LDRB     r1,[r1,#0]  ; OSIntNesting
000188  e3510000          CMP      r1,#0
00018c  0a000003          BEQ      |L1.416|
;;;205            OS_EXIT_CRITICAL();
000190  ebfffffe          BL       OS_CPU_SR_Restore
;;;206            return (OS_ERR_TASK_CREATE_ISR);
000194  e3a0003c          MOV      r0,#0x3c
                  |L1.408|
000198  e8bd43fe          POP      {r1-r9,lr}
;;;207        }
;;;208        if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
;;;209            OSTCBPrioTbl[prio] = OS_TCB_RESERVED;/* Reserve the priority to prevent others from doing ...  */
;;;210                                                 /* ... the same thing until task is created.              */
;;;211            OS_EXIT_CRITICAL();
;;;212            psp = OSTaskStkInit(task, p_arg, ptos, 0);              /* Initialize the task's stack         */
;;;213            err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
;;;214            if (err == OS_ERR_NONE) {
;;;215                if (OSRunning == OS_TRUE) {      /* Find highest priority task if multitasking has started */
;;;216                    OS_Sched();
;;;217                }
;;;218            } else {
;;;219                OS_ENTER_CRITICAL();
;;;220                OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
;;;221                OS_EXIT_CRITICAL();
;;;222            }
;;;223            return (err);
;;;224        }
;;;225        OS_EXIT_CRITICAL();

⌨️ 快捷键说明

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