📄 os_mutex.txt
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 919] for uVision
; commandline ArmCC [--debug -c --asm --interleave -o.\rvmdk\os_mutex.o --depend=.\rvmdk\os_mutex.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_mutex.crf ..\..\..\..\..\uCOS-II\Source\os_mutex.c]
ARM
AREA ||.text||, CODE, READONLY, ALIGN=2
OSMutexAccept PROC
;;;84 BOOLEAN OSMutexAccept (OS_EVENT *pevent, INT8U *perr)
;;;85 {
000000 e92d4070 PUSH {r4-r6,lr}
000004 e1a04000 MOV r4,r0
;;;86 INT8U pip; /* Priority Inheritance Priority (PIP) */
;;;87 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;88 OS_CPU_SR cpu_sr = 0;
;;;89 #endif
;;;90
;;;91
;;;92
;;;93 #if OS_ARG_CHK_EN > 0
;;;94 if (perr == (INT8U *)0) { /* Validate 'perr' */
;;;95 return (OS_FALSE);
;;;96 }
;;;97 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
;;;98 *perr = OS_ERR_PEVENT_NULL;
;;;99 return (OS_FALSE);
;;;100 }
;;;101 #endif
;;;102 if (pevent->OSEventType != OS_EVENT_TYPE_MUTEX) { /* Validate event block type */
000008 e5d00000 LDRB r0,[r0,#0]
00000c e1a05001 MOV r5,r1 ;85
000010 e3500004 CMP r0,#4
;;;103 *perr = OS_ERR_EVENT_TYPE;
000014 13a00001 MOVNE r0,#1
;;;104 return (OS_FALSE);
000018 1a000004 BNE |L1.48|
;;;105 }
;;;106 if (OSIntNesting > 0) { /* Make sure it's not called from an ISR */
00001c e59f0720 LDR r0,|L1.1860|
000020 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
000024 e3500000 CMP r0,#0
000028 0a000002 BEQ |L1.56|
;;;107 *perr = OS_ERR_PEND_ISR;
00002c e3a00002 MOV r0,#2
|L1.48|
000030 e5c50000 STRB r0,[r5,#0] ;103
000034 ea00001c B |L1.172|
|L1.56|
;;;108 return (OS_FALSE);
;;;109 }
;;;110 OS_ENTER_CRITICAL(); /* Get value (0 or 1) of Mutex */
000038 ebfffffe BL OS_CPU_SR_Save
;;;111 pip = (INT8U)(pevent->OSEventCnt >> 8); /* Get PIP from mutex */
00003c e1d410b8 LDRH r1,[r4,#8]
;;;112 if ((pevent->OSEventCnt & OS_MUTEX_KEEP_LOWER_8) == OS_MUTEX_AVAILABLE) {
000040 e3a06000 MOV r6,#0
000044 e1e02001 MVN r2,r1
000048 e31200ff TST r2,#0xff
00004c e1a03421 LSR r3,r1,#8 ;111
000050 1a000013 BNE |L1.164|
;;;113 pevent->OSEventCnt &= OS_MUTEX_KEEP_UPPER_8; /* Mask off LSByte (Acquire Mutex) */
000054 e2012cff AND r2,r1,#0xff00
;;;114 pevent->OSEventCnt |= OSTCBCur->OSTCBPrio; /* Save current task priority in LSByte */
000058 e59f16e8 LDR r1,|L1.1864|
00005c e1c420b8 STRH r2,[r4,#8] ;113
000060 e5911000 LDR r1,[r1,#0] ; OSTCBCur
000064 e5d1c02e LDRB r12,[r1,#0x2e]
000068 e182200c ORR r2,r2,r12
00006c e1c420b8 STRH r2,[r4,#8]
;;;115 pevent->OSEventPtr = (void *)OSTCBCur; /* Link TCB of task owning Mutex */
000070 e5841004 STR r1,[r4,#4]
;;;116 if (OSTCBCur->OSTCBPrio <= pip) { /* PIP 'must' have a SMALLER prio ... */
000074 e5d1102e LDRB r1,[r1,#0x2e]
000078 e1510003 CMP r1,r3
00007c 8a000003 BHI |L1.144|
;;;117 OS_EXIT_CRITICAL(); /* ... than current task! */
000080 ebfffffe BL OS_CPU_SR_Restore
;;;118 *perr = OS_ERR_PIP_LOWER;
000084 e3a00078 MOV r0,#0x78
000088 e5c50000 STRB r0,[r5,#0]
00008c ea000001 B |L1.152|
|L1.144|
;;;119 } else {
;;;120 OS_EXIT_CRITICAL();
000090 ebfffffe BL OS_CPU_SR_Restore
;;;121 *perr = OS_ERR_NONE;
000094 e5c56000 STRB r6,[r5,#0]
|L1.152|
;;;122 }
;;;123 return (OS_TRUE);
000098 e3a00001 MOV r0,#1
|L1.156|
00009c e8bd4070 POP {r4-r6,lr}
;;;124 }
;;;125 OS_EXIT_CRITICAL();
;;;126 *perr = OS_ERR_NONE;
;;;127 return (OS_FALSE);
;;;128 }
0000a0 e12fff1e BX lr
|L1.164|
0000a4 ebfffffe BL OS_CPU_SR_Restore
0000a8 e5c56000 STRB r6,[r5,#0] ;126
|L1.172|
0000ac e3a00000 MOV r0,#0 ;127
0000b0 eafffff9 B |L1.156|
;;;129 #endif
ENDP
OSMutexCreate PROC
;;;166 OS_EVENT *OSMutexCreate (INT8U prio, INT8U *perr)
;;;167 {
0000b4 e92d41f0 PUSH {r4-r8,lr}
0000b8 e1a05000 MOV r5,r0
;;;168 OS_EVENT *pevent;
;;;169 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;170 OS_CPU_SR cpu_sr = 0;
;;;171 #endif
;;;172
;;;173
;;;174
;;;175 #if OS_ARG_CHK_EN > 0
;;;176 if (perr == (INT8U *)0) { /* Validate 'perr' */
;;;177 return ((OS_EVENT *)0);
;;;178 }
;;;179 if (prio >= OS_LOWEST_PRIO) { /* Validate PIP */
;;;180 *perr = OS_ERR_PRIO_INVALID;
;;;181 return ((OS_EVENT *)0);
;;;182 }
;;;183 #endif
;;;184 if (OSIntNesting > 0) { /* See if called from ISR ... */
0000bc e59f0680 LDR r0,|L1.1860|
0000c0 e1a06001 MOV r6,r1 ;167
0000c4 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
0000c8 e3500000 CMP r0,#0
;;;185 *perr = OS_ERR_CREATE_ISR; /* ... can't CREATE mutex from an ISR */
0000cc 13a00010 MOVNE r0,#0x10
;;;186 return ((OS_EVENT *)0);
0000d0 1a000006 BNE |L1.240|
;;;187 }
;;;188 OS_ENTER_CRITICAL();
0000d4 ebfffffe BL OS_CPU_SR_Save
;;;189 if (OSTCBPrioTbl[prio] != (OS_TCB *)0) { /* Mutex priority must not already exist */
0000d8 e59f166c LDR r1,|L1.1868|
0000dc e7912105 LDR r2,[r1,r5,LSL #2]
0000e0 e3520000 CMP r2,#0
0000e4 0a000005 BEQ |L1.256|
;;;190 OS_EXIT_CRITICAL(); /* Task already exist at priority ... */
0000e8 ebfffffe BL OS_CPU_SR_Restore
;;;191 *perr = OS_ERR_PRIO_EXIST; /* ... inheritance priority */
0000ec e3a00028 MOV r0,#0x28
|L1.240|
0000f0 e5c60000 STRB r0,[r6,#0]
;;;192 return ((OS_EVENT *)0);
0000f4 e3a00000 MOV r0,#0
|L1.248|
0000f8 e8bd41f0 POP {r4-r8,lr}
;;;193 }
;;;194 OSTCBPrioTbl[prio] = OS_TCB_RESERVED; /* Reserve the table entry */
;;;195 pevent = OSEventFreeList; /* Get next free event control block */
;;;196 if (pevent == (OS_EVENT *)0) { /* See if an ECB was available */
;;;197 OSTCBPrioTbl[prio] = (OS_TCB *)0; /* No, Release the table entry */
;;;198 OS_EXIT_CRITICAL();
;;;199 *perr = OS_ERR_PEVENT_NULL; /* No more event control blocks */
;;;200 return (pevent);
;;;201 }
;;;202 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr; /* Adjust the free list */
;;;203 OS_EXIT_CRITICAL();
;;;204 pevent->OSEventType = OS_EVENT_TYPE_MUTEX;
;;;205 pevent->OSEventCnt = (INT16U)((INT16U)prio << 8) | OS_MUTEX_AVAILABLE; /* Resource is avail. */
;;;206 pevent->OSEventPtr = (void *)0; /* No task owning the mutex */
;;;207 #if OS_EVENT_NAME_SIZE > 1
;;;208 pevent->OSEventName[0] = '?';
;;;209 pevent->OSEventName[1] = OS_ASCII_NUL;
;;;210 #endif
;;;211 OS_EventWaitListInit(pevent);
;;;212 *perr = OS_ERR_NONE;
;;;213 return (pevent);
;;;214 }
0000fc e12fff1e BX lr
|L1.256|
000100 e3a02001 MOV r2,#1 ;194
000104 e7812105 STR r2,[r1,r5,LSL #2] ;194
000108 e59f2640 LDR r2,|L1.1872|
00010c e3a07000 MOV r7,#0 ;195
000110 e5924000 LDR r4,[r2,#0] ;195 ; OSEventFreeList
000114 e3a08004 MOV r8,#4 ;195
000118 e3540000 CMP r4,#0 ;196
00011c 1a000004 BNE |L1.308|
000120 e7817105 STR r7,[r1,r5,LSL #2] ;197
000124 ebfffffe BL OS_CPU_SR_Restore
000128 e1a00007 MOV r0,r7 ;200
00012c e5c68000 STRB r8,[r6,#0] ;199
000130 eafffff0 B |L1.248|
|L1.308|
000134 e5941004 LDR r1,[r4,#4] ;202
000138 e5821000 STR r1,[r2,#0] ;202 ; OSEventFreeList
00013c ebfffffe BL OS_CPU_SR_Restore
000140 e3a000ff MOV r0,#0xff ;205
000144 e1800405 ORR r0,r0,r5,LSL #8 ;205
000148 e5c48000 STRB r8,[r4,#0] ;204
00014c e1c400b8 STRH r0,[r4,#8] ;205
000150 e3a0003f MOV r0,#0x3f ;208
000154 e5847004 STR r7,[r4,#4] ;208
000158 e5c4000f STRB r0,[r4,#0xf] ;208
00015c e1a00004 MOV r0,r4 ;211
000160 e5c47010 STRB r7,[r4,#0x10] ;209
000164 ebfffffe BL OS_EventWaitListInit
000168 e1a00004 MOV r0,r4 ;213
00016c e5c67000 STRB r7,[r6,#0] ;212
000170 eaffffe0 B |L1.248|
;;;215
ENDP
OSMutex_RdyAtPrio PROC
;;;683 static void OSMutex_RdyAtPrio (OS_TCB *ptcb, INT8U prio)
;;;684 {
000174 e92d4030 PUSH {r4,r5,lr}
;;;685 INT8U y;
;;;686
;;;687
;;;688 y = ptcb->OSTCBY; /* Remove owner from ready list at 'pip' */
000178 e5d02030 LDRB r2,[r0,#0x30]
;;;689 OSRdyTbl[y] &= ~ptcb->OSTCBBitX;
00017c e59fe5d0 LDR lr,|L1.1876|
000180 e5d0c031 LDRB r12,[r0,#0x31]
000184 e7de3002 LDRB r3,[lr,r2]
;;;690 if (OSRdyTbl[y] == 0) {
000188 e59f45c8 LDR r4,|L1.1880|
;;;691 OSRdyGrp &= ~ptcb->OSTCBBitY;
;;;692 }
;;;693 ptcb->OSTCBPrio = prio;
;;;694 #if OS_LOWEST_PRIO <= 63
;;;695 ptcb->OSTCBY = (INT8U)((prio >> (INT8U)3) & (INT8U)0x07);
;;;696 ptcb->OSTCBX = (INT8U) (prio & (INT8U)0x07);
;;;697 ptcb->OSTCBBitY = (INT8U)(1 << ptcb->OSTCBY);
00018c e3a05001 MOV r5,#1
000190 e1c3300c BIC r3,r3,r12 ;689
000194 e7ce3002 STRB r3,[lr,r2] ;689
000198 e7de2002 LDRB r2,[lr,r2] ;690
00019c e201c007 AND r12,r1,#7 ;696
0001a0 e3520000 CMP r2,#0 ;690
0001a4 05d02032 LDRBEQ r2,[r0,#0x32] ;691
0001a8 05d43000 LDRBEQ r3,[r4,#0] ;691 ; OSRdyGrp
0001ac 01c32002 BICEQ r2,r3,r2 ;691
0001b0 05c42000 STRBEQ r2,[r4,#0] ;691 ; OSRdyGrp
0001b4 e1a02d01 LSL r2,r1,#26 ;695
0001b8 e1a02ea2 LSR r2,r2,#29 ;695
0001bc e5c0102e STRB r1,[r0,#0x2e] ;693
0001c0 e5c02030 STRB r2,[r0,#0x30] ;695
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -