📄 os_sem.txt
字号:
|L1.356|
000164 e3a03000 MOV r3,#0 ;220
000168 e3a02001 MOV r2,#1 ;220
00016c e1a01003 MOV r1,r3 ;220
000170 e1a00004 MOV r0,r4 ;220
000174 ebfffffe BL OS_EventTaskRdy
|L1.376|
000178 e5d4000a LDRB r0,[r4,#0xa] ;219
00017c e3500000 CMP r0,#0 ;219
000180 1afffff7 BNE |L1.356|
000184 e5c4800f STRB r8,[r4,#0xf] ;223
000188 e5c4a010 STRB r10,[r4,#0x10] ;224
00018c e5c4a000 STRB r10,[r4,#0] ;226
000190 e5990000 LDR r0,[r9,#0] ;227 ; OSEventFreeList
000194 e5840004 STR r0,[r4,#4] ;227
000198 e1c4a0b8 STRH r10,[r4,#8] ;228
00019c e1a00007 MOV r0,r7 ;230
0001a0 e5894000 STR r4,[r9,#0] ;230 ; OSEventFreeList
0001a4 ebfffffe BL OS_CPU_SR_Restore
0001a8 e3560001 CMP r6,#1 ;231
0001ac 0bfffffe BLEQ OS_Sched
|L1.432|
0001b0 e3a00000 MOV r0,#0 ;235
0001b4 e5c5a000 STRB r10,[r5,#0] ;234
0001b8 eaffffe7 B |L1.348|
|L1.444|
0001bc e1a00007 MOV r0,r7 ;239
0001c0 ebfffffe BL OS_CPU_SR_Restore
0001c4 e3a00007 MOV r0,#7 ;240
0001c8 eaffffe1 B |L1.340|
;;;246 #endif
ENDP
OSSemPend PROC
;;;281 void OSSemPend (OS_EVENT *pevent, INT16U timeout, INT8U *perr)
;;;282 {
0001cc e92d47f0 PUSH {r4-r10,lr}
0001d0 e1a06000 MOV r6,r0
;;;283 INT8U pend_stat;
;;;284 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;285 OS_CPU_SR cpu_sr = 0;
;;;286 #endif
;;;287
;;;288
;;;289
;;;290 #if OS_ARG_CHK_EN > 0
;;;291 if (perr == (INT8U *)0) { /* Validate 'perr' */
;;;292 return;
;;;293 }
;;;294 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
;;;295 *perr = OS_ERR_PEVENT_NULL;
;;;296 return;
;;;297 }
;;;298 #endif
;;;299 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
0001d4 e5d00000 LDRB r0,[r0,#0]
0001d8 e1a09001 MOV r9,r1 ;282
0001dc e1a04002 MOV r4,r2 ;282
0001e0 e3500003 CMP r0,#3
;;;300 *perr = OS_ERR_EVENT_TYPE;
0001e4 13a00001 MOVNE r0,#1
;;;301 return;
0001e8 1a00002b BNE |L1.668|
;;;302 }
;;;303 if (OSIntNesting > 0) { /* See if called from ISR ... */
0001ec e59f02dc LDR r0,|L1.1232|
0001f0 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
0001f4 e3500000 CMP r0,#0
;;;304 *perr = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR */
0001f8 13a00002 MOVNE r0,#2
;;;305 return;
0001fc 1a000026 BNE |L1.668|
;;;306 }
;;;307 if (OSLockNesting > 0) { /* See if called with scheduler locked ... */
000200 e59f02d0 LDR r0,|L1.1240|
000204 e5d00000 LDRB r0,[r0,#0] ; OSLockNesting
000208 e3500000 CMP r0,#0
;;;308 *perr = OS_ERR_PEND_LOCKED; /* ... can't PEND when locked */
00020c 13a0000d MOVNE r0,#0xd
;;;309 return;
000210 1a000021 BNE |L1.668|
;;;310 }
;;;311 OS_ENTER_CRITICAL();
000214 ebfffffe BL OS_CPU_SR_Save
000218 e1a05000 MOV r5,r0
;;;312 if (pevent->OSEventCnt > 0) { /* If sem. is positive, resource available ... */
00021c e1d600b8 LDRH r0,[r6,#8]
000220 e3a07000 MOV r7,#0
000224 e3500000 CMP r0,#0
;;;313 pevent->OSEventCnt--; /* ... decrement semaphore only if positive. */
000228 12400001 SUBNE r0,r0,#1
00022c 11c600b8 STRHNE r0,[r6,#8]
;;;314 OS_EXIT_CRITICAL();
000230 11a00005 MOVNE r0,r5
;;;315 *perr = OS_ERR_NONE;
;;;316 return;
000234 1a00001d BNE |L1.688|
;;;317 }
;;;318 /* Otherwise, must wait until event occurs */
;;;319 OSTCBCur->OSTCBStat |= OS_STAT_SEM; /* Resource not available, pend on semaphore */
000238 e59f829c LDR r8,|L1.1244|
00023c e5981000 LDR r1,[r8,#0] ; OSTCBCur
000240 e5d1002c LDRB r0,[r1,#0x2c]
000244 e3800001 ORR r0,r0,#1
000248 e5c1002c STRB r0,[r1,#0x2c]
;;;320 OSTCBCur->OSTCBStatPend = OS_STAT_PEND_OK;
00024c e5c1702d STRB r7,[r1,#0x2d]
;;;321 OSTCBCur->OSTCBDly = timeout; /* Store pend timeout in TCB */
;;;322 OS_EventTaskWait(pevent); /* Suspend task until event or timeout occurs */
000250 e1a00006 MOV r0,r6
000254 e1c192ba STRH r9,[r1,#0x2a] ;321
000258 ebfffffe BL OS_EventTaskWait
;;;323 OS_EXIT_CRITICAL();
00025c e1a00005 MOV r0,r5
000260 ebfffffe BL OS_CPU_SR_Restore
;;;324 OS_Sched(); /* Find next highest priority task ready */
000264 ebfffffe BL OS_Sched
;;;325 OS_ENTER_CRITICAL();
000268 ebfffffe BL OS_CPU_SR_Save
;;;326 if (OSTCBCur->OSTCBStatPend != OS_STAT_PEND_OK) { /* See if we timed-out or aborted */
00026c e5981000 LDR r1,[r8,#0] ; OSTCBCur
000270 e1a09000 MOV r9,r0 ;325
000274 e5d1502d LDRB r5,[r1,#0x2d]
000278 e3550000 CMP r5,#0
00027c 0a000009 BEQ |L1.680|
;;;327 pend_stat = OSTCBCur->OSTCBStatPend;
;;;328 OS_EventTOAbort(pevent);
000280 e1a00006 MOV r0,r6
000284 ebfffffe BL OS_EventTOAbort
;;;329 OS_EXIT_CRITICAL();
000288 e1a00009 MOV r0,r9
00028c ebfffffe BL OS_CPU_SR_Restore
;;;330 switch (pend_stat) {
000290 e3550002 CMP r5,#2
;;;331 case OS_STAT_PEND_TO:
;;;332 default:
;;;333 *perr = OS_ERR_TIMEOUT; /* Indicate that didn't get event within TO */
;;;334 break;
;;;335
;;;336 case OS_STAT_PEND_ABORT:
;;;337 *perr = OS_ERR_PEND_ABORT; /* Indicate that we aborted */
000294 03a0000e MOVEQ r0,#0xe
000298 13a0000a MOVNE r0,#0xa ;333
|L1.668|
00029c e5c40000 STRB r0,[r4,#0]
|L1.672|
;;;338 break;
;;;339 }
;;;340 return;
;;;341 }
;;;342 OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;
;;;343 OS_EXIT_CRITICAL();
;;;344 *perr = OS_ERR_NONE;
;;;345 }
0002a0 e8bd47f0 POP {r4-r10,lr}
0002a4 e12fff1e BX lr
|L1.680|
0002a8 e1a00009 MOV r0,r9 ;343
0002ac e581701c STR r7,[r1,#0x1c] ;343
|L1.688|
0002b0 ebfffffe BL OS_CPU_SR_Restore
0002b4 e5c47000 STRB r7,[r4,#0] ;344
0002b8 eafffff8 B |L1.672|
;;;346
ENDP
OSSemPendAbort PROC
;;;382 INT8U OSSemPendAbort (OS_EVENT *pevent, INT8U opt, INT8U *perr)
;;;383 {
0002bc e92d41f0 PUSH {r4-r8,lr}
0002c0 e1a08001 MOV r8,r1
;;;384 INT8U nbr_tasks;
;;;385 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;386 OS_CPU_SR cpu_sr = 0;
;;;387 #endif
;;;388
;;;389
;;;390
;;;391 #if OS_ARG_CHK_EN > 0
;;;392 if (perr == (INT8U *)0) { /* Validate 'perr' */
;;;393 return (0);
;;;394 }
;;;395 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
;;;396 *perr = OS_ERR_PEVENT_NULL;
;;;397 return (0);
;;;398 }
;;;399 #endif
;;;400 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
0002c4 e5d01000 LDRB r1,[r0,#0]
0002c8 e1a05000 MOV r5,r0 ;383
0002cc e1a06002 MOV r6,r2 ;383
0002d0 e3510003 CMP r1,#3
0002d4 e3a00001 MOV r0,#1
0002d8 0a000003 BEQ |L1.748|
|L1.732|
;;;401 *perr = OS_ERR_EVENT_TYPE;
0002dc e5c60000 STRB r0,[r6,#0]
;;;402 return (0);
0002e0 e3a00000 MOV r0,#0
|L1.740|
0002e4 e8bd41f0 POP {r4-r8,lr}
;;;403 }
;;;404 OS_ENTER_CRITICAL();
;;;405 if (pevent->OSEventGrp != 0) { /* See if any task waiting on semaphore? */
;;;406 nbr_tasks = 0;
;;;407 switch (opt) {
;;;408 case OS_PEND_OPT_BROADCAST: /* Do we need to abort ALL waiting tasks? */
;;;409 while (pevent->OSEventGrp != 0) { /* Yes, ready ALL tasks waiting on semaphore */
;;;410 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_ABORT);
;;;411 nbr_tasks++;
;;;412 }
;;;413 break;
;;;414
;;;415 case OS_PEND_OPT_NONE: /* No, ready HPT waiting on semaphore */
;;;416 default:
;;;417 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_ABORT);
;;;418 nbr_tasks++;
;;;419 break;
;;;420 }
;;;421 OS_EXIT_CRITICAL();
;;;422 OS_Sched(); /* Find HPT ready to run */
;;;423 *perr = OS_ERR_PEND_ABORT;
;;;424 return (nbr_tasks);
;;;425 }
;;;426 OS_EXIT_CRITICAL();
;;;427 *perr = OS_ERR_NONE;
;;;428 return (0); /* No tasks waiting on semaphore */
;;;429 }
0002e8 e12fff1e BX lr
|L1.748|
0002ec ebfffffe BL OS_CPU_SR_Save
0002f0 e1a07000 MOV r7,r0 ;404
0002f4 e5d5000a LDRB r0,[r5,#0xa] ;405
0002f8 e3500000 CMP r0,#0 ;405
0002fc 0a00001a BEQ |L1.876|
000300 e3580001 CMP r8,#1 ;407
000304 e3a04000 MOV r4,#0 ;406
000308 1a00000a BNE |L1.824|
|L1.780|
00030c e3a03002 MOV r3,#2 ;410
000310 e3a02001 MOV r2,#1 ;410
000314 e3a01000 MOV r1,#0 ;410
000318 e1a00005 MOV r0,r5 ;410
00031c ebfffffe BL OS_EventTaskRdy
000320 e5d5100a LDRB r1,[r5,#0xa] ;409
000324 e2840001 ADD r0,r4,#1 ;411
000328 e20040ff AND r4,r0,#0xff ;411
00032c e3510000 CMP r1,#0 ;409
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -