📄 os_sem.txt
字号:
000300 e3100001 TST r0,#1 ;279
000304 0a000005 BEQ |L1.800| ;279
000308 e1a00004 MOV r0,r4 ;280
00030c ebfffffe BL OS_EventTO ;280
000310 ef000003 SVC 0x3 ; formerly SWI ;281
000314 e3a0000a MOV r0,#0xa ;282
000318 e5c60000 STRB r0,[r6,#0] ;282
00031c eaffffcd B |L1.600| ;283
|L1.800|
000320 e3a00000 MOV r0,#0 ;285
000324 e59f1120 LDR r1,|L1.1100| ;285
000328 e5911000 LDR r1,[r1,#0] ;285 ; OSTCBCur
00032c e581001c STR r0,[r1,#0x1c] ;285
000330 ef000003 SVC 0x3 ; formerly SWI ;286
000334 e3a00000 MOV r0,#0 ;287
000338 e5c60000 STRB r0,[r6,#0] ;287
00033c eaffffc5 B |L1.600|
ENDP
OSSemPost PROC
;;;308 INT8U OSSemPost (OS_EVENT *pevent)
;;;309 {
000340 e92d4010 PUSH {r4,lr}
000344 e1a04000 MOV r4,r0
;;;310 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;311 OS_CPU_SR cpu_sr;
;;;312 #endif
;;;313
;;;314
;;;315 #if OS_ARG_CHK_EN > 0
;;;316 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
000348 e3540000 CMP r4,#0
00034c 1a000002 BNE |L1.860|
;;;317 return (OS_ERR_PEVENT_NULL);
000350 e3a00004 MOV r0,#4
|L1.852|
000354 e8bd4010 POP {r4,lr}
;;;318 }
;;;319 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
;;;320 return (OS_ERR_EVENT_TYPE);
;;;321 }
;;;322 #endif
;;;323 OS_ENTER_CRITICAL();
;;;324 if (pevent->OSEventGrp != 0x00) { /* See if any task waiting for semaphore */
;;;325 OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM); /* Ready highest prio task waiting on event */
;;;326 OS_EXIT_CRITICAL();
;;;327 OS_Sched(); /* Find highest priority task ready to run */
;;;328 return (OS_NO_ERR);
;;;329 }
;;;330 if (pevent->OSEventCnt < 65535) { /* Make sure semaphore will not overflow */
;;;331 pevent->OSEventCnt++; /* Increment semaphore count to register event */
;;;332 OS_EXIT_CRITICAL();
;;;333 return (OS_NO_ERR);
;;;334 }
;;;335 OS_EXIT_CRITICAL(); /* Semaphore value has reached its maximum */
;;;336 return (OS_SEM_OVF);
;;;337 }
000358 e12fff1e BX lr
|L1.860|
00035c e5d40000 LDRB r0,[r4,#0] ;319
000360 e3500003 CMP r0,#3 ;319
000364 0a000001 BEQ |L1.880| ;319
000368 e3a00001 MOV r0,#1 ;320
00036c eafffff8 B |L1.852| ;320
|L1.880|
000370 ef000002 SVC 0x2 ; formerly SWI ;323
000374 e5d40001 LDRB r0,[r4,#1] ;324
000378 e3500000 CMP r0,#0 ;324
00037c 0a000007 BEQ |L1.928| ;324
000380 e3a02001 MOV r2,#1 ;325
000384 e3a01000 MOV r1,#0 ;325
000388 e1a00004 MOV r0,r4 ;325
00038c ebfffffe BL OS_EventTaskRdy ;325
000390 ef000003 SVC 0x3 ; formerly SWI ;326
000394 ebfffffe BL OS_Sched ;327
000398 e3a00000 MOV r0,#0 ;328
00039c eaffffec B |L1.852| ;328
|L1.928|
0003a0 e1d400b2 LDRH r0,[r4,#2] ;330
0003a4 e59f10a4 LDR r1,|L1.1104| ;330
0003a8 e1500001 CMP r0,r1 ;330
0003ac aa000006 BGE |L1.972| ;330
0003b0 e1d400b2 LDRH r0,[r4,#2] ;331
0003b4 e2800001 ADD r0,r0,#1 ;331
0003b8 e3c00801 BIC r0,r0,#0x10000 ;331
0003bc e1c400b2 STRH r0,[r4,#2] ;331
0003c0 ef000003 SVC 0x3 ; formerly SWI ;332
0003c4 e3a00000 MOV r0,#0 ;333
0003c8 eaffffe1 B |L1.852| ;333
|L1.972|
0003cc ef000003 SVC 0x3 ; formerly SWI ;335
0003d0 e3a00032 MOV r0,#0x32 ;336
0003d4 eaffffde B |L1.852| ;336
ENDP
OSSemQuery PROC
;;;358 INT8U OSSemQuery (OS_EVENT *pevent, OS_SEM_DATA *pdata)
;;;359 {
0003d8 e92d41f0 PUSH {r4-r8,lr}
0003dc e1a04000 MOV r4,r0
0003e0 e1a05001 MOV r5,r1
;;;360 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;361 OS_CPU_SR cpu_sr;
;;;362 #endif
;;;363 INT8U *psrc;
;;;364 INT8U *pdest;
;;;365
;;;366
;;;367 #if OS_ARG_CHK_EN > 0
;;;368 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
0003e4 e3540000 CMP r4,#0
0003e8 1a000002 BNE |L1.1016|
;;;369 return (OS_ERR_PEVENT_NULL);
0003ec e3a00004 MOV r0,#4
|L1.1008|
0003f0 e8bd41f0 POP {r4-r8,lr}
;;;370 }
;;;371 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
;;;372 return (OS_ERR_EVENT_TYPE);
;;;373 }
;;;374 #endif
;;;375 OS_ENTER_CRITICAL();
;;;376 pdata->OSEventGrp = pevent->OSEventGrp; /* Copy message mailbox wait list */
;;;377 psrc = &pevent->OSEventTbl[0];
;;;378 pdest = &pdata->OSEventTbl[0];
;;;379 #if OS_EVENT_TBL_SIZE > 0
;;;380 *pdest++ = *psrc++;
;;;381 #endif
;;;382
;;;383 #if OS_EVENT_TBL_SIZE > 1
;;;384 *pdest++ = *psrc++;
;;;385 #endif
;;;386
;;;387 #if OS_EVENT_TBL_SIZE > 2
;;;388 *pdest++ = *psrc++;
;;;389 #endif
;;;390
;;;391 #if OS_EVENT_TBL_SIZE > 3
;;;392 *pdest++ = *psrc++;
;;;393 #endif
;;;394
;;;395 #if OS_EVENT_TBL_SIZE > 4
;;;396 *pdest++ = *psrc++;
;;;397 #endif
;;;398
;;;399 #if OS_EVENT_TBL_SIZE > 5
;;;400 *pdest++ = *psrc++;
;;;401 #endif
;;;402
;;;403 #if OS_EVENT_TBL_SIZE > 6
;;;404 *pdest++ = *psrc++;
;;;405 #endif
;;;406
;;;407 #if OS_EVENT_TBL_SIZE > 7
;;;408 *pdest = *psrc;
;;;409 #endif
;;;410 pdata->OSCnt = pevent->OSEventCnt; /* Get semaphore count */
;;;411 OS_EXIT_CRITICAL();
;;;412 return (OS_NO_ERR);
;;;413 }
0003f4 e12fff1e BX lr
|L1.1016|
0003f8 e5d40000 LDRB r0,[r4,#0] ;371
0003fc e3500003 CMP r0,#3 ;371
000400 0a000001 BEQ |L1.1036| ;371
000404 e3a00001 MOV r0,#1 ;372
000408 eafffff8 B |L1.1008| ;372
|L1.1036|
00040c ef000002 SVC 0x2 ; formerly SWI ;375
000410 e5d40001 LDRB r0,[r4,#1] ;376
000414 e5c50004 STRB r0,[r5,#4] ;376
000418 e2846008 ADD r6,r4,#8 ;377
00041c e2857002 ADD r7,r5,#2 ;378
000420 e4d60001 LDRB r0,[r6],#1 ;380
000424 e4c70001 STRB r0,[r7],#1 ;380
000428 e4d60001 LDRB r0,[r6],#1 ;384
00042c e4c70001 STRB r0,[r7],#1 ;384
000430 e1d400b2 LDRH r0,[r4,#2] ;410
000434 e1c500b0 STRH r0,[r5,#0] ;410
000438 ef000003 SVC 0x3 ; formerly SWI ;411
00043c e3a00000 MOV r0,#0 ;412
000440 eaffffea B |L1.1008| ;412
|L1.1092|
000444 00000000 DCD OSIntNesting ;412
|L1.1096|
000448 00000000 DCD OSEventFreeList ;412
|L1.1100|
00044c 00000000 DCD OSTCBCur ;412
|L1.1104|
000450 0000ffff DCD 0x0000ffff ;412
ENDP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -