📄 os_sem.txt
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 903] for uVision
; commandline ArmCC [--debug -c --asm --interleave -oos_sem.o --depend=os_sem.d --device=DARMP --apcs=interwork -I. -I..\BSP -I..\..\..\..\..\uCOS-II\Ports\ARM\Generic\RVMDK -I..\..\..\..\..\uCOS-II\Source -I..\..\..\..\..\uC-CPU -I..\..\..\..\..\uC-CPU\ARM\RVMDK -I..\..\..\..\..\uC-LIB -I..\..\..\..\..\uCOSView\Source -I..\..\..\..\..\uCOSView\Ports\ARM7\LPC2468\IAR -Id:\Keil\ARM\INC\Philips ..\..\..\..\..\uCOS-II\Source\os_sem.c]
ARM
AREA ||.text||, CODE, READONLY, ALIGN=2
OSSemAccept PROC
;;;49 INT16U OSSemAccept (OS_EVENT *pevent)
;;;50 {
000000 e92d4070 PUSH {r4-r6,lr}
000004 e1a04000 MOV r4,r0
;;;51 INT16U cnt;
;;;52 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;53 OS_CPU_SR cpu_sr = 0;
000008 e3a06000 MOV r6,#0
;;;54 #endif
;;;55
;;;56
;;;57
;;;58 #if OS_ARG_CHK_EN > 0
;;;59 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
00000c e3540000 CMP r4,#0
000010 1a000002 BNE |L1.32|
;;;60 return (0);
000014 e3a00000 MOV r0,#0
|L1.24|
000018 e8bd4070 POP {r4-r6,lr}
;;;61 }
;;;62 #endif
;;;63 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
;;;64 return (0);
;;;65 }
;;;66 OS_ENTER_CRITICAL();
;;;67 cnt = pevent->OSEventCnt;
;;;68 if (cnt > 0) { /* See if resource is available */
;;;69 pevent->OSEventCnt--; /* Yes, decrement semaphore and notify caller */
;;;70 }
;;;71 OS_EXIT_CRITICAL();
;;;72 return (cnt); /* Return semaphore count */
;;;73 }
00001c e12fff1e BX lr
|L1.32|
000020 e5d40000 LDRB r0,[r4,#0]
000024 e3500003 CMP r0,#3
000028 0a000001 BEQ |L1.52|
00002c e3a00000 MOV r0,#0
000030 eafffff8 B |L1.24|
|L1.52|
000034 ebfffffe BL OS_CPU_SR_Save
000038 e1a06000 MOV r6,r0
00003c e1d450b8 LDRH r5,[r4,#8]
000040 e3550000 CMP r5,#0
000044 da000002 BLE |L1.84|
000048 e1d400b8 LDRH r0,[r4,#8]
00004c e2400001 SUB r0,r0,#1
000050 e1c400b8 STRH r0,[r4,#8]
|L1.84|
000054 e1a00006 MOV r0,r6
000058 ebfffffe BL OS_CPU_SR_Restore
00005c e1a00005 MOV r0,r5
000060 eaffffec B |L1.24|
ENDP
OSSemCreate PROC
;;;94 OS_EVENT *OSSemCreate (INT16U cnt)
;;;95 {
000064 e92d4070 PUSH {r4-r6,lr}
000068 e1a04000 MOV r4,r0
;;;96 OS_EVENT *pevent;
;;;97 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;98 OS_CPU_SR cpu_sr = 0;
00006c e3a06000 MOV r6,#0
;;;99 #endif
;;;100
;;;101
;;;102
;;;103 if (OSIntNesting > 0) { /* See if called from ISR ... */
000070 e59f06e4 LDR r0,|L1.1884|
000074 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
000078 e3500000 CMP r0,#0
00007c da000002 BLE |L1.140|
;;;104 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
000080 e3a00000 MOV r0,#0
|L1.132|
000084 e8bd4070 POP {r4-r6,lr}
;;;105 }
;;;106 OS_ENTER_CRITICAL();
;;;107 pevent = OSEventFreeList; /* Get next free event control block */
;;;108 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
;;;109 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
;;;110 }
;;;111 OS_EXIT_CRITICAL();
;;;112 if (pevent != (OS_EVENT *)0) { /* Get an event control block */
;;;113 pevent->OSEventType = OS_EVENT_TYPE_SEM;
;;;114 pevent->OSEventCnt = cnt; /* Set semaphore value */
;;;115 pevent->OSEventPtr = (void *)0; /* Unlink from ECB free list */
;;;116 #if OS_EVENT_NAME_SIZE > 1
;;;117 pevent->OSEventName[0] = '?'; /* Unknown name */
;;;118 pevent->OSEventName[1] = OS_ASCII_NUL;
;;;119 #endif
;;;120 OS_EventWaitListInit(pevent); /* Initialize to 'nobody waiting' on sem. */
;;;121 }
;;;122 return (pevent);
;;;123 }
000088 e12fff1e BX lr
|L1.140|
00008c ebfffffe BL OS_CPU_SR_Save
000090 e1a06000 MOV r6,r0
000094 e59f06c4 LDR r0,|L1.1888|
000098 e5905000 LDR r5,[r0,#0] ; OSEventFreeList
00009c e5900000 LDR r0,[r0,#0] ; OSEventFreeList
0000a0 e3500000 CMP r0,#0
0000a4 0a000004 BEQ |L1.188|
0000a8 e59f06b0 LDR r0,|L1.1888|
0000ac e5900000 LDR r0,[r0,#0] ; OSEventFreeList
0000b0 e5900004 LDR r0,[r0,#4]
0000b4 e59f16a4 LDR r1,|L1.1888|
0000b8 e5810000 STR r0,[r1,#0] ; OSEventFreeList
|L1.188|
0000bc e1a00006 MOV r0,r6
0000c0 ebfffffe BL OS_CPU_SR_Restore
0000c4 e3550000 CMP r5,#0
0000c8 0a00000a BEQ |L1.248|
0000cc e3a00003 MOV r0,#3
0000d0 e5c50000 STRB r0,[r5,#0]
0000d4 e1c540b8 STRH r4,[r5,#8]
0000d8 e3a00000 MOV r0,#0
0000dc e5850004 STR r0,[r5,#4]
0000e0 e3a0003f MOV r0,#0x3f
0000e4 e5c5000f STRB r0,[r5,#0xf]
0000e8 e3a00000 MOV r0,#0
0000ec e5c50010 STRB r0,[r5,#0x10]
0000f0 e1a00005 MOV r0,r5
0000f4 ebfffffe BL OS_EventWaitListInit
|L1.248|
0000f8 e1a00005 MOV r0,r5
0000fc eaffffe0 B |L1.132|
ENDP
OSSemDel PROC
;;;164 OS_EVENT *OSSemDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
;;;165 {
000100 e92d47f0 PUSH {r4-r10,lr}
000104 e1a04000 MOV r4,r0
000108 e1a05001 MOV r5,r1
00010c e1a06002 MOV r6,r2
;;;166 BOOLEAN tasks_waiting;
;;;167 OS_EVENT *pevent_return;
;;;168 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;169 OS_CPU_SR cpu_sr = 0;
000110 e3a09000 MOV r9,#0
;;;170 #endif
;;;171
;;;172
;;;173
;;;174 #if OS_ARG_CHK_EN > 0
;;;175 if (err == (INT8U *)0) { /* Validate 'err' */
000114 e3560000 CMP r6,#0
000118 1a000002 BNE |L1.296|
;;;176 return (pevent);
00011c e1a00004 MOV r0,r4
|L1.288|
000120 e8bd47f0 POP {r4-r10,lr}
;;;177 }
;;;178 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
;;;179 *err = OS_ERR_PEVENT_NULL;
;;;180 return (pevent);
;;;181 }
;;;182 #endif
;;;183 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
;;;184 *err = OS_ERR_EVENT_TYPE;
;;;185 return (pevent);
;;;186 }
;;;187 if (OSIntNesting > 0) { /* See if called from ISR ... */
;;;188 *err = OS_ERR_DEL_ISR; /* ... can't DELETE from an ISR */
;;;189 return (pevent);
;;;190 }
;;;191 OS_ENTER_CRITICAL();
;;;192 if (pevent->OSEventGrp != 0) { /* See if any tasks waiting on semaphore */
;;;193 tasks_waiting = OS_TRUE; /* Yes */
;;;194 } else {
;;;195 tasks_waiting = OS_FALSE; /* No */
;;;196 }
;;;197 switch (opt) {
;;;198 case OS_DEL_NO_PEND: /* Delete semaphore only if no task waiting */
;;;199 if (tasks_waiting == OS_FALSE) {
;;;200 #if OS_EVENT_NAME_SIZE > 1
;;;201 pevent->OSEventName[0] = '?'; /* Unknown name */
;;;202 pevent->OSEventName[1] = OS_ASCII_NUL;
;;;203 #endif
;;;204 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
;;;205 pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free list */
;;;206 pevent->OSEventCnt = 0;
;;;207 OSEventFreeList = pevent; /* Get next free event control block */
;;;208 OS_EXIT_CRITICAL();
;;;209 *err = OS_ERR_NONE;
;;;210 pevent_return = (OS_EVENT *)0; /* Semaphore has been deleted */
;;;211 } else {
;;;212 OS_EXIT_CRITICAL();
;;;213 *err = OS_ERR_TASK_WAITING;
;;;214 pevent_return = pevent;
;;;215 }
;;;216 break;
;;;217
;;;218 case OS_DEL_ALWAYS: /* Always delete the semaphore */
;;;219 while (pevent->OSEventGrp != 0) { /* Ready ALL tasks waiting for semaphore */
;;;220 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_OK);
;;;221 }
;;;222 #if OS_EVENT_NAME_SIZE > 1
;;;223 pevent->OSEventName[0] = '?'; /* Unknown name */
;;;224 pevent->OSEventName[1] = OS_ASCII_NUL;
;;;225 #endif
;;;226 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
;;;227 pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free list */
;;;228 pevent->OSEventCnt = 0;
;;;229 OSEventFreeList = pevent; /* Get next free event control block */
;;;230 OS_EXIT_CRITICAL();
;;;231 if (tasks_waiting == OS_TRUE) { /* Reschedule only if task(s) were waiting */
;;;232 OS_Sched(); /* Find highest priority task ready to run */
;;;233 }
;;;234 *err = OS_ERR_NONE;
;;;235 pevent_return = (OS_EVENT *)0; /* Semaphore has been deleted */
;;;236 break;
;;;237
;;;238 default:
;;;239 OS_EXIT_CRITICAL();
;;;240 *err = OS_ERR_INVALID_OPT;
;;;241 pevent_return = pevent;
;;;242 break;
;;;243 }
;;;244 return (pevent_return);
;;;245 }
000124 e12fff1e BX lr
|L1.296|
000128 e3540000 CMP r4,#0
00012c 1a000003 BNE |L1.320|
000130 e3a00004 MOV r0,#4
000134 e5c60000 STRB r0,[r6,#0]
000138 e1a00004 MOV r0,r4
00013c eafffff7 B |L1.288|
|L1.320|
000140 e5d40000 LDRB r0,[r4,#0]
000144 e3500003 CMP r0,#3
000148 0a000003 BEQ |L1.348|
00014c e3a00001 MOV r0,#1
000150 e5c60000 STRB r0,[r6,#0]
000154 e1a00004 MOV r0,r4
000158 eafffff0 B |L1.288|
|L1.348|
00015c e59f05f8 LDR r0,|L1.1884|
000160 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
000164 e3500000 CMP r0,#0
000168 da000003 BLE |L1.380|
00016c e3a0000f MOV r0,#0xf
000170 e5c60000 STRB r0,[r6,#0]
000174 e1a00004 MOV r0,r4
000178 eaffffe8 B |L1.288|
|L1.380|
00017c ebfffffe BL OS_CPU_SR_Save
000180 e1a09000 MOV r9,r0
000184 e5d4000a LDRB r0,[r4,#0xa]
000188 e3500000 CMP r0,#0
00018c 0a000001 BEQ |L1.408|
000190 e3a07001 MOV r7,#1
000194 ea000000 B |L1.412|
|L1.408|
000198 e3a07000 MOV r7,#0
|L1.412|
00019c e3550000 CMP r5,#0
0001a0 0a000002 BEQ |L1.432|
0001a4 e3550001 CMP r5,#1
0001a8 1a00003a BNE |L1.664|
0001ac ea00001a B |L1.540|
|L1.432|
0001b0 e1a00000 MOV r0,r0
0001b4 e3570000 CMP r7,#0
0001b8 1a000011 BNE |L1.516|
0001bc e3a0003f MOV r0,#0x3f
0001c0 e5c4000f STRB r0,[r4,#0xf]
0001c4 e3a00000 MOV r0,#0
0001c8 e5c40010 STRB r0,[r4,#0x10]
0001cc e5c40000 STRB r0,[r4,#0]
0001d0 e59f0588 LDR r0,|L1.1888|
0001d4 e5900000 LDR r0,[r0,#0] ; OSEventFreeList
0001d8 e5840004 STR r0,[r4,#4]
0001dc e3a00000 MOV r0,#0
0001e0 e1c400b8 STRH r0,[r4,#8]
0001e4 e59f0574 LDR r0,|L1.1888|
0001e8 e5804000 STR r4,[r0,#0] ; OSEventFreeList
0001ec e1a00009 MOV r0,r9
0001f0 ebfffffe BL OS_CPU_SR_Restore
0001f4 e3a00000 MOV r0,#0
0001f8 e5c60000 STRB r0,[r6,#0]
0001fc e3a08000 MOV r8,#0
000200 ea000004 B |L1.536|
|L1.516|
000204 e1a00009 MOV r0,r9
000208 ebfffffe BL OS_CPU_SR_Restore
00020c e3a00049 MOV r0,#0x49
000210 e5c60000 STRB r0,[r6,#0]
000214 e1a08004 MOV r8,r4
|L1.536|
000218 ea000025 B |L1.692|
|L1.540|
00021c e1a00000 MOV r0,r0
000220 ea000004 B |L1.568|
|L1.548|
000224 e3a03000 MOV r3,#0
000228 e3a02001 MOV r2,#1
00022c e1a01003 MOV r1,r3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -