📄 artx_config.txt
字号:
000104 2208 MOVS r2,#8
000106 2118 MOVS r1,#0x18
000108 4881 LDR r0,|L1.784|
00010a f7ff fffe BL _init_box
;;;352 #endif
;;;353 } /* end of os_init_mem */
00010e bc10 POP {r4}
000110 bc08 POP {r3}
000112 4718 BX r3
ENDP
os_alloc_TCB PROC
;;;356
;;;357 P_TCB os_alloc_TCB () {
000114 b510 PUSH {r4,lr}
;;;358 return (_alloc_box (m_tcb));
000116 487c LDR r0,|L1.776|
000118 df06 SVC 0x6 ; formerly SWI
00011a bc10 POP {r4}
00011c bc08 POP {r3}
;;;359 } /* end of os_alloc_TCB */
00011e 4718 BX r3
ENDP
os_free_TCB PROC
;;;362
;;;363 void os_free_TCB (P_TCB p_TCB) {
000120 b510 PUSH {r4,lr}
000122 0004 MOVS r4,r0
;;;364 /* Free allocated memory resources for the task "p_TCB" */
;;;365 _free_box (m_stk, p_TCB->stack);
000124 4879 LDR r0,|L1.780|
000126 6aa1 LDR r1,[r4,#0x28]
000128 df07 SVC 0x7 ; formerly SWI
;;;366 _free_box (m_tcb, p_TCB);
00012a 0021 MOVS r1,r4
00012c 4876 LDR r0,|L1.776|
00012e df07 SVC 0x7 ; formerly SWI
;;;367 #if (OS_STKCHECK == 1)
;;;368 if (os_runtask == p_TCB) {
000130 486a LDR r0,|L1.732|
000132 6800 LDR r0,[r0,#0] ; os_runtask
000134 42a0 CMP r0,r4
000136 d103 BNE |L1.320|
;;;369 /* os_tsk_delete_self() called. */
;;;370 os_del_flag = __TRUE;
000138 2001 MOVS r0,#1
00013a 4969 LDR r1,|L1.736|
00013c 310c ADDS r1,r1,#0xc
00013e 7008 STRB r0,[r1,#0] ; os_del_flag
;;;371 }
;;;372 #endif
;;;373 } /* end of os_free_TCB */
|L1.320|
000140 bc10 POP {r4}
000142 bc08 POP {r3}
000144 4718 BX r3
ENDP
os_alloc_TMR PROC
;;;376
;;;377 P_TMR os_alloc_TMR () {
000146 b510 PUSH {r4,lr}
;;;378 #if (OS_TIMERCNT != 0)
;;;379 return (_alloc_box (m_tmr));
000148 4871 LDR r0,|L1.784|
00014a df06 SVC 0x6 ; formerly SWI
00014c bc10 POP {r4}
00014e bc08 POP {r3}
;;;380 #else
;;;381 return (NULL);
;;;382 #endif
;;;383 } /* end of os_alloc_TMR */
000150 4718 BX r3
ENDP
os_free_TMR PROC
;;;386
;;;387 void os_free_TMR (P_TMR timer) {
000152 b510 PUSH {r4,lr}
000154 0004 MOVS r4,r0
;;;388 /* Free allocated memory resources for user timer 'timer' */
;;;389 #if (OS_TIMERCNT != 0)
;;;390 _free_box (m_tmr, timer);
000156 0021 MOVS r1,r4
000158 486d LDR r0,|L1.784|
00015a df07 SVC 0x7 ; formerly SWI
;;;391 #else
;;;392 timer = timer;
;;;393 #endif
;;;394 } /* end of os_free_TMR */
00015c bc10 POP {r4}
00015e bc08 POP {r3}
000160 4718 BX r3
ENDP
os_init_context PROC
;;;398 void os_init_context (P_TCB p_TCB, U8 priority,
;;;399 FUNCP task_body, U8 full_context) {
000162 b5ff PUSH {r0-r7,lr}
000164 b081 SUB sp,sp,#4
000166 0014 MOVS r4,r2
000168 001d MOVS r5,r3
;;;400 /* Prepare TCB and saved context for a first time start of a task */
;;;401 /* "p_TCB" points to TCB to be initialised. "priority" indicates desired */
;;;402 /* execution priority. "task_body" is the start address of the task. */
;;;403 /* "full_context" identifies context type. */
;;;404 U32 *stk,i;
;;;405
;;;406 /* Initialize general part of TCB */
;;;407 p_TCB->cb_type = TCB;
00016a 2000 MOVS r0,#0
00016c 9901 LDR r1,[sp,#4]
00016e 7008 STRB r0,[r1,#0]
;;;408 p_TCB->state = READY;
000170 2001 MOVS r0,#1
000172 9901 LDR r1,[sp,#4]
000174 7048 STRB r0,[r1,#1]
;;;409 p_TCB->prio = priority;
000176 9802 LDR r0,[sp,#8]
000178 9901 LDR r1,[sp,#4]
00017a 7088 STRB r0,[r1,#2]
;;;410 p_TCB->p_lnk = NULL;
00017c 2000 MOVS r0,#0
00017e 9901 LDR r1,[sp,#4]
000180 6048 STR r0,[r1,#4]
;;;411 p_TCB->p_rlnk = NULL;
000182 9901 LDR r1,[sp,#4]
000184 6088 STR r0,[r1,#8]
;;;412 p_TCB->p_dlnk = NULL;
000186 9901 LDR r1,[sp,#4]
000188 60c8 STR r0,[r1,#0xc]
;;;413 p_TCB->p_blnk = NULL;
00018a 9901 LDR r1,[sp,#4]
00018c 6108 STR r0,[r1,#0x10]
;;;414 p_TCB->delta_time = 0;
00018e 9901 LDR r1,[sp,#4]
000190 8288 STRH r0,[r1,#0x14]
;;;415 p_TCB->interval_time = 0;
000192 9901 LDR r1,[sp,#4]
000194 82c8 STRH r0,[r1,#0x16]
;;;416 p_TCB->events = 0;
000196 9901 LDR r1,[sp,#4]
000198 8308 STRH r0,[r1,#0x18]
;;;417 p_TCB->waits = 0;
00019a 9901 LDR r1,[sp,#4]
00019c 8348 STRH r0,[r1,#0x1a]
;;;418
;;;419 /* Initialize ARM specific part of TCB */
;;;420 p_TCB->full_ctx = full_context;
00019e 9801 LDR r0,[sp,#4]
0001a0 3020 ADDS r0,r0,#0x20
0001a2 7045 STRB r5,[r0,#1]
;;;421
;;;422 /* Prepare a complete interrupt frame for first task start */
;;;423 if (p_TCB->priv_stack != 0) {
0001a4 9801 LDR r0,[sp,#4]
0001a6 8c40 LDRH r0,[r0,#0x22]
0001a8 2800 CMP r0,#0
0001aa d007 BEQ |L1.444|
;;;424 /* User has provided a memory space for the stack. */
;;;425 stk = &p_TCB->stack[p_TCB->priv_stack>>2];
0001ac 9801 LDR r0,[sp,#4]
0001ae 6a80 LDR r0,[r0,#0x28]
0001b0 9901 LDR r1,[sp,#4]
0001b2 8c49 LDRH r1,[r1,#0x22]
0001b4 1089 ASRS r1,r1,#2
0001b6 0089 LSLS r1,r1,#2
0001b8 1846 ADDS r6,r0,r1
0001ba e007 B |L1.460|
;;;426 }
;;;427 else {
;;;428 /* Allocate the memory space for the stack. */
;;;429 p_TCB->stack = _alloc_box (m_stk);
|L1.444|
0001bc 4853 LDR r0,|L1.780|
0001be df06 SVC 0x6 ; formerly SWI
0001c0 9901 LDR r1,[sp,#4]
0001c2 6288 STR r0,[r1,#0x28]
;;;430 /* Write to the top of stack. */
;;;431 stk = &p_TCB->stack[OS_STKSIZE];
0001c4 9801 LDR r0,[sp,#4]
0001c6 6a80 LDR r0,[r0,#0x28]
0001c8 0006 MOVS r6,r0
0001ca 36c8 ADDS r6,r6,#0xc8
;;;432 }
;;;433
;;;434 /* Initial PC and default CPSR */
;;;435 *--stk = (U32)task_body;
|L1.460|
0001cc 1f30 SUBS r0,r6,#4
0001ce 0006 MOVS r6,r0
0001d0 6004 STR r4,[r0,#0]
;;;436 i = INITIAL_CPSR;
0001d2 4f50 LDR r7,|L1.788|
;;;437
;;;438 /* If a task in THUMB mode, set T-bit. */
;;;439 if ((U32)task_body & 1) {
0001d4 07e0 LSLS r0,r4,#31
0001d6 0fc0 LSRS r0,r0,#31
0001d8 d001 BEQ |L1.478|
;;;440 i |= 0x00000020;
0001da 2020 MOVS r0,#0x20
0001dc 4307 ORRS r7,r7,r0
;;;441 }
;;;442 *--stk = i;
|L1.478|
0001de 1f30 SUBS r0,r6,#4
0001e0 0006 MOVS r6,r0
0001e2 6007 STR r7,[r0,#0]
;;;443
;;;444 /* Write initial registers. */
;;;445 for (i = full_context ? 13 : 4; i; i--) {
0001e4 2d00 CMP r5,#0
0001e6 d001 BEQ |L1.492|
0001e8 200d MOVS r0,#0xd
0001ea e000 B |L1.494|
|L1.492|
0001ec 2004 MOVS r0,#4
|L1.494|
0001ee 0007 MOVS r7,r0
0001f0 e004 B |L1.508|
;;;446 *--stk = 0;
|L1.498|
0001f2 2100 MOVS r1,#0
0001f4 1f30 SUBS r0,r6,#4
0001f6 0006 MOVS r6,r0
0001f8 6001 STR r1,[r0,#0]
0001fa 1e7f SUBS r7,r7,#1 ;445
|L1.508|
0001fc 2f00 CMP r7,#0 ;445
0001fe d1f8 BNE |L1.498| ;445
;;;447 }
;;;448
;;;449 /* For "full_context" assign a void pointer to R0. */
;;;450 if (full_context) {
000200 2d00 CMP r5,#0
000202 d004 BEQ |L1.526|
;;;451 *--stk = (U32)p_TCB->p_msg;
000204 9801 LDR r0,[sp,#4]
000206 69c1 LDR r1,[r0,#0x1c]
000208 1f30 SUBS r0,r6,#4
00020a 0006 MOVS r6,r0
00020c 6001 STR r1,[r0,#0]
;;;452 }
;;;453
;;;454 /* Initial Task stack pointer. */
;;;455 p_TCB->tsk_stack = (U32)stk;
|L1.526|
00020e 9801 LDR r0,[sp,#4]
000210 6246 STR r6,[r0,#0x24]
;;;456
;;;457 /* Task entry point. */
;;;458 p_TCB->ptask = task_body;
000212 9801 LDR r0,[sp,#4]
000214 62c4 STR r4,[r0,#0x2c]
;;;459 #if (OS_STKCHECK == 1)
;;;460 /* Set a magic word for checking of stack overflow. */
;;;461 p_TCB->stack[0] = MAGIC_WORD;
000216 4840 LDR r0,|L1.792|
000218 9901 LDR r1,[sp,#4]
00021a 6a89 LDR r1,[r1,#0x28]
00021c 6008 STR r0,[r1,#0]
;;;462 #endif
;;;463 } /* end of os_init_context */
00021e b005 ADD sp,sp,#0x14
000220 bcf0 POP {r4-r7}
000222 bc08 POP {r3}
000224 4718 BX r3
ENDP
__SWI_0 PROC
;;;468 void __swi(0) os_switch_tasks (P_TCB p_new);
;;;469 void __SWI_0 (P_TCB p_new) {
000226 b510 PUSH {r4,lr}
000228 0004 MOVS r4,r0
;;;470 /* Switch to next task (identified by "p_new"). Saving old and restoring */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -