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

📄 os_mutex.txt

📁 uc/os在lpc2100系列的KEIL模板 uc/os在lpc2100系列的real view模板 uc/os在lpc210X系列的real view模板
💻 TXT
📖 第 1 页 / 共 4 页
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 934] for uVision
; commandline ArmCC [--debug -c --asm --interleave -o.\rvmdk\os_mutex.o --depend=.\rvmdk\os_mutex.d --device=DARMP --apcs=interwork -O1 -I. -I..\BSP -I..\..\..\..\uCOS-II\Ports\ARM\Generic\RealView -I..\..\..\..\uCOS-II\Source -I..\..\..\..\uC-CPU -I..\..\..\..\uC-CPU\ARM\RealView -I..\..\..\..\uC-LIB -I..\..\..\..\uC-TCPIP\IF -I..\..\..\..\uC-TCPIP\IF\Ether -I..\..\..\..\uC-TCPIP\NIC\ETHER\LPC2378 -I..\..\..\..\uC-TCPIP\NIC\ETHER\PHY -I..\..\..\..\uC-TCPIP\NIC\ETHER\PHY\DP83848 -I..\..\..\..\uC-TCPIP\OS\uCOS-II -I..\..\..\..\uC-TCPIP\Source -I..\..\..\..\uC-LCD\Source -I..\..\..\..\uC-Probe\Target\Communication\Generic\Source -I..\..\..\..\uC-Probe\Target\Communication\Generic\RS-232\Source -I..\..\..\..\uC-Probe\Target\Communication\Generic\TCPIP\Source -I..\..\..\..\uC-Probe\Target\Plugins\uCOS-II -Ie:\Keil_ARM\ARM\INC\Philips -D__IN_CHIP --omf_browse=.\rvmdk\os_mutex.crf ..\Source\OS_MUTEX.C]
                          ARM

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

                  OSMutexAccept PROC
;;;59     INT8U  OSMutexAccept (OS_EVENT *pevent, INT8U *err)
;;;60     {
000000  e92d4070          PUSH     {r4-r6,lr}
000004  e1a04000          MOV      r4,r0
000008  e1a05001          MOV      r5,r1
;;;61     #if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
;;;62         OS_CPU_SR  cpu_sr;
;;;63     #endif    
;;;64         
;;;65         
;;;66         if (OSIntNesting > 0) {                            /* Make sure it's not called from an ISR        */
00000c  e59f06d0          LDR      r0,|L1.1764|
000010  e5d00000          LDRB     r0,[r0,#0]  ; OSIntNesting
000014  e3500000          CMP      r0,#0
000018  0a000004          BEQ      |L1.48|
;;;67             *err = OS_ERR_PEND_ISR;
00001c  e3a00002          MOV      r0,#2
000020  e5c50000          STRB     r0,[r5,#0]
;;;68             return (0);
000024  e3a00000          MOV      r0,#0
                  |L1.40|
000028  e8bd4070          POP      {r4-r6,lr}
;;;69         }
;;;70     #if OS_ARG_CHK_EN > 0
;;;71         if (pevent == (OS_EVENT *)0) {                     /* Validate 'pevent'                            */
;;;72             *err = OS_ERR_PEVENT_NULL;
;;;73             return (0);
;;;74         }
;;;75         if (pevent->OSEventType != OS_EVENT_TYPE_MUTEX) {  /* Validate event block type                    */
;;;76             *err = OS_ERR_EVENT_TYPE;
;;;77             return (0);
;;;78         }
;;;79     #endif                                                     
;;;80         OS_ENTER_CRITICAL();							   /* Get value (0 or 1) of Mutex                  */
;;;81         if ((pevent->OSEventCnt & OS_MUTEX_KEEP_LOWER_8) == OS_MUTEX_AVAILABLE) {     
;;;82             pevent->OSEventCnt &= OS_MUTEX_KEEP_UPPER_8;   /*      Mask off LSByte (Acquire Mutex)         */
;;;83             pevent->OSEventCnt |= OSTCBCur->OSTCBPrio;     /*      Save current task priority in LSByte    */
;;;84             pevent->OSEventPtr  = (void *)OSTCBCur;        /*      Link TCB of task owning Mutex           */
;;;85             OS_EXIT_CRITICAL();
;;;86             *err = OS_NO_ERR;
;;;87             return (1);
;;;88         }
;;;89         OS_EXIT_CRITICAL();
;;;90         *err = OS_NO_ERR;
;;;91         return (0);
;;;92     }
00002c  e12fff1e          BX       lr
                  |L1.48|
000030  e3540000          CMP      r4,#0                 ;71
000034  1a000003          BNE      |L1.72|
000038  e3a00004          MOV      r0,#4                 ;72
00003c  e5c50000          STRB     r0,[r5,#0]            ;72
000040  e3a00000          MOV      r0,#0                 ;73
000044  eafffff7          B        |L1.40|
                  |L1.72|
000048  e5d40000          LDRB     r0,[r4,#0]            ;75
00004c  e3500004          CMP      r0,#4                 ;75
000050  0a000003          BEQ      |L1.100|
000054  e3a00001          MOV      r0,#1                 ;76
000058  e5c50000          STRB     r0,[r5,#0]            ;76
00005c  e3a00000          MOV      r0,#0                 ;77
000060  eafffff0          B        |L1.40|
                  |L1.100|
000064  ef000002          SVC      #0x2                  ;80
000068  e1d400b2          LDRH     r0,[r4,#2]            ;81
00006c  e3a06000          MOV      r6,#0                 ;81
000070  e1e01000          MVN      r1,r0                 ;81
000074  e31100ff          TST      r1,#0xff              ;81
000078  1a00000c          BNE      |L1.176|
00007c  e2000cff          AND      r0,r0,#0xff00         ;82
000080  e1c400b2          STRH     r0,[r4,#2]            ;82
000084  e59f165c          LDR      r1,|L1.1768|
000088  e5912000          LDR      r2,[r1,#0]            ;83  ; OSTCBCur
00008c  e5d2202d          LDRB     r2,[r2,#0x2d]         ;83
000090  e1800002          ORR      r0,r0,r2              ;83
000094  e1c400b2          STRH     r0,[r4,#2]            ;83
000098  e5910000          LDR      r0,[r1,#0]            ;84  ; OSTCBCur
00009c  e5840004          STR      r0,[r4,#4]            ;84
0000a0  ef000003          SVC      #0x3                  ;85
0000a4  e5c56000          STRB     r6,[r5,#0]            ;86
0000a8  e3a00001          MOV      r0,#1                 ;87
0000ac  eaffffdd          B        |L1.40|
                  |L1.176|
0000b0  ef000003          SVC      #0x3                  ;89
0000b4  e5c56000          STRB     r6,[r5,#0]            ;90
0000b8  e3a00000          MOV      r0,#0                 ;91
0000bc  eaffffd9          B        |L1.40|
;;;93     #endif                                                     
                          ENDP

                  OSMutexCreate PROC
;;;129    OS_EVENT  *OSMutexCreate (INT8U prio, INT8U *err)
;;;130    {
0000c0  e92d41f0          PUSH     {r4-r8,lr}
0000c4  e1a05000          MOV      r5,r0
0000c8  e1a06001          MOV      r6,r1
;;;131    #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
;;;132        OS_CPU_SR  cpu_sr;
;;;133    #endif    
;;;134        OS_EVENT  *pevent;
;;;135    
;;;136    
;;;137        if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
0000cc  e59f0610          LDR      r0,|L1.1764|
0000d0  e5d00000          LDRB     r0,[r0,#0]  ; OSIntNesting
0000d4  e3500000          CMP      r0,#0
0000d8  0a000004          BEQ      |L1.240|
;;;138            *err = OS_ERR_CREATE_ISR;                          /* ... can't CREATE mutex from an ISR       */
0000dc  e3a0008d          MOV      r0,#0x8d
0000e0  e5c60000          STRB     r0,[r6,#0]
;;;139            return ((OS_EVENT *)0);
0000e4  e3a00000          MOV      r0,#0
                  |L1.232|
0000e8  e8bd41f0          POP      {r4-r8,lr}
;;;140        }
;;;141    #if OS_ARG_CHK_EN > 0
;;;142        if (prio >= OS_LOWEST_PRIO) {                          /* Validate PIP                             */
;;;143            *err = OS_PRIO_INVALID;
;;;144            return ((OS_EVENT *)0);
;;;145        }
;;;146    #endif
;;;147        OS_ENTER_CRITICAL();
;;;148        if (OSTCBPrioTbl[prio] != (OS_TCB *)0) {               /* Mutex priority must not already exist    */
;;;149            OS_EXIT_CRITICAL();                                /* Task already exist at priority ...       */
;;;150            *err = OS_PRIO_EXIST;                              /* ... inheritance priority                 */
;;;151            return ((OS_EVENT *)0);                            
;;;152        }
;;;153        OSTCBPrioTbl[prio] = (OS_TCB *)1;                      /* Reserve the table entry                  */
;;;154        pevent             = OSEventFreeList;                  /* Get next free event control block        */
;;;155        if (pevent == (OS_EVENT *)0) {                         /* See if an ECB was available              */
;;;156            OSTCBPrioTbl[prio] = (OS_TCB *)0;                  /* No, Release the table entry              */
;;;157            OS_EXIT_CRITICAL();
;;;158            *err               = OS_ERR_PEVENT_NULL;           /* No more event control blocks             */
;;;159            return (pevent);
;;;160        }
;;;161        OSEventFreeList     = (OS_EVENT *)OSEventFreeList->OSEventPtr;   /* Adjust the free list           */
;;;162        OS_EXIT_CRITICAL();
;;;163        pevent->OSEventType = OS_EVENT_TYPE_MUTEX;
;;;164        pevent->OSEventCnt  = (prio << 8) | OS_MUTEX_AVAILABLE;/* Resource is available                    */
;;;165        pevent->OSEventPtr  = (void *)0;                       /* No task owning the mutex                 */
;;;166        OS_EventWaitListInit(pevent);
;;;167        *err                = OS_NO_ERR;
;;;168        return (pevent);
;;;169    }
0000ec  e12fff1e          BX       lr
                  |L1.240|
0000f0  e355000c          CMP      r5,#0xc               ;142
0000f4  3a000003          BCC      |L1.264|
0000f8  e3a0002a          MOV      r0,#0x2a              ;143
0000fc  e5c60000          STRB     r0,[r6,#0]            ;143
000100  e3a00000          MOV      r0,#0                 ;144
000104  eafffff7          B        |L1.232|
                  |L1.264|
000108  ef000002          SVC      #0x2                  ;147
00010c  e59f05d8          LDR      r0,|L1.1772|
000110  e7901105          LDR      r1,[r0,r5,LSL #2]     ;148
000114  e3510000          CMP      r1,#0                 ;148
000118  0a000004          BEQ      |L1.304|
00011c  ef000003          SVC      #0x3                  ;149
000120  e3a00028          MOV      r0,#0x28              ;150
000124  e5c60000          STRB     r0,[r6,#0]            ;150
000128  e3a00000          MOV      r0,#0                 ;151
00012c  eaffffed          B        |L1.232|
                  |L1.304|
000130  e3a01001          MOV      r1,#1                 ;153
000134  e7801105          STR      r1,[r0,r5,LSL #2]     ;153
000138  e59f15b0          LDR      r1,|L1.1776|
00013c  e5914000          LDR      r4,[r1,#0]            ;154  ; OSEventFreeList
000140  e3a08000          MOV      r8,#0                 ;154
000144  e3540000          CMP      r4,#0                 ;155
000148  e3a07004          MOV      r7,#4                 ;154
00014c  1a000004          BNE      |L1.356|
000150  e7808105          STR      r8,[r0,r5,LSL #2]     ;156
000154  ef000003          SVC      #0x3                  ;157
000158  e5c67000          STRB     r7,[r6,#0]            ;158
00015c  e1a00008          MOV      r0,r8                 ;159
000160  eaffffe0          B        |L1.232|
                  |L1.356|
000164  e5940004          LDR      r0,[r4,#4]            ;161
000168  e5810000          STR      r0,[r1,#0]            ;161  ; OSEventFreeList
00016c  ef000003          SVC      #0x3                  ;162
000170  e5c47000          STRB     r7,[r4,#0]            ;163
000174  e3a000ff          MOV      r0,#0xff              ;164
000178  e1800405          ORR      r0,r0,r5,LSL #8       ;164
00017c  e1c400b2          STRH     r0,[r4,#2]            ;164
000180  e5848004          STR      r8,[r4,#4]            ;165
000184  e1a00004          MOV      r0,r4                 ;166
000188  ebfffffe          BL       OS_EventWaitListInit
00018c  e5c68000          STRB     r8,[r6,#0]            ;167
000190  e1a00004          MOV      r0,r4                 ;168
000194  eaffffd3          B        |L1.232|
;;;170    
                          ENDP

                  OSMutexDel PROC
;;;206    OS_EVENT  *OSMutexDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
;;;207    {
000198  e92d47f0          PUSH     {r4-r10,lr}
00019c  e1a04000          MOV      r4,r0
0001a0  e1a0a001          MOV      r10,r1
0001a4  e1a05002          MOV      r5,r2
;;;208    #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
;;;209        OS_CPU_SR  cpu_sr;
;;;210    #endif    
;;;211        BOOLEAN    tasks_waiting;
;;;212        INT8U      pip;
;;;213    
;;;214    
;;;215        if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
0001a8  e59f0534          LDR      r0,|L1.1764|
0001ac  e5d00000          LDRB     r0,[r0,#0]  ; OSIntNesting
0001b0  e3500000          CMP      r0,#0

⌨️ 快捷键说明

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