⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtx_config.txt

📁 使用STR710的SPI接口访问外部EEPROM的例子程序.使用KEIL UV3编译.使用了MDK3.05操作系统.
💻 TXT
📖 第 1 页 / 共 3 页
字号:
;;;347    #endif
;;;348    } /* end of os_init_mem */
000122  bc10              POP      {r4}
000124  bc08              POP      {r3}
000126  4718              BX       r3
                          ENDP

                  os_alloc_TCB PROC
;;;351    
;;;352    P_TCB os_alloc_TCB () {
000128  b510              PUSH     {r4,lr}
;;;353       return (_alloc_box (m_tcb));
00012a  4871              LDR      r0,|L1.752|
00012c  df01              SVC      0x1  ; formerly SWI
;;;354    } /* end of os_alloc_TCB */
00012e  bc10              POP      {r4}
000130  bc08              POP      {r3}
000132  4718              BX       r3
                          ENDP

                  os_free_TCB PROC
;;;357    
;;;358    void os_free_TCB (P_TCB p_TCB) {
000134  b510              PUSH     {r4,lr}
000136  0004              MOVS     r4,r0
;;;359       /* Free allocated memory resources for the task "p_TCB" */
;;;360       _free_box (m_stk, p_TCB->stack);
000138  4870              LDR      r0,|L1.764|
00013a  6aa1              LDR      r1,[r4,#0x28]
00013c  df02              SVC      0x2  ; formerly SWI
;;;361       _free_box (m_tcb, p_TCB);
00013e  0021              MOVS     r1,r4
000140  486b              LDR      r0,|L1.752|
000142  df02              SVC      0x2  ; formerly SWI
;;;362    #if (OS_STKCHECK == 1)
;;;363       if (os_runtask == p_TCB) {
000144  485f              LDR      r0,|L1.708|
000146  6800              LDR      r0,[r0,#0]  ; os_runtask
000148  42a0              CMP      r0,r4
00014a  d103              BNE      |L1.340|
;;;364          /* os_tsk_delete_self() called. */
;;;365          os_del_flag = __TRUE;
00014c  2001              MOVS     r0,#1
00014e  495e              LDR      r1,|L1.712|
000150  310c              ADDS     r1,r1,#0xc
000152  7008              STRB     r0,[r1,#0]  ; os_del_flag
;;;366       }
;;;367    #endif
;;;368    } /* end of os_free_TCB */
                  |L1.340|
000154  bc10              POP      {r4}
000156  bc08              POP      {r3}
000158  4718              BX       r3
                          ENDP

                  os_free_TMR PROC
;;;386    #else
;;;387       timer = timer;
00015a  46c0              MOV      r8,r8
;;;388    #endif
;;;389    } /* end of os_free_TMR */
00015c  4770              BX       lr
                          ENDP

                  os_init_context PROC
;;;393    void os_init_context (P_TCB p_TCB, U8 priority,
;;;394                          FUNCP task_body, U8 full_context) {
00015e  b5ff              PUSH     {r0-r7,lr}
000160  b081              SUB      sp,sp,#4
000162  0004              MOVS     r4,r0
000164  0015              MOVS     r5,r2
000166  001e              MOVS     r6,r3
;;;395       /* Prepare TCB and saved context for a first time start of a task         */
;;;396       /* "p_TCB" points to TCB to be initialised. "priority" indicates desired  */
;;;397       /* execution priority. "task_body" is the start address of the task.      */
;;;398       /* "full_context" identifies context type.                                */
;;;399       U32 *stk,i;
;;;400    
;;;401       /* Initialize general part of TCB */
;;;402       p_TCB->cb_type = TCB;
000168  2000              MOVS     r0,#0
00016a  7020              STRB     r0,[r4,#0]
;;;403       p_TCB->state   = READY;
00016c  2001              MOVS     r0,#1
00016e  7060              STRB     r0,[r4,#1]
;;;404       p_TCB->prio    = priority;
000170  9802              LDR      r0,[sp,#8]
000172  70a0              STRB     r0,[r4,#2]
;;;405       p_TCB->p_lnk   = NULL;
000174  2000              MOVS     r0,#0
000176  6060              STR      r0,[r4,#4]
;;;406       p_TCB->p_rlnk  = NULL;
000178  60a0              STR      r0,[r4,#8]
;;;407       p_TCB->p_dlnk  = NULL;
00017a  60e0              STR      r0,[r4,#0xc]
;;;408       p_TCB->p_blnk  = NULL;
00017c  6120              STR      r0,[r4,#0x10]
;;;409       p_TCB->delta_time    = 0;
00017e  82a0              STRH     r0,[r4,#0x14]
;;;410       p_TCB->interval_time = 0;
000180  82e0              STRH     r0,[r4,#0x16]
;;;411       p_TCB->events  = 0;
000182  8320              STRH     r0,[r4,#0x18]
;;;412       p_TCB->waits   = 0;
000184  8360              STRH     r0,[r4,#0x1a]
;;;413    
;;;414       /* Initialize ARM specific part of TCB */
;;;415       p_TCB->full_ctx = full_context;
000186  2021              MOVS     r0,#0x21
000188  5506              STRB     r6,[r0,r4]
;;;416    
;;;417       /* Prepare a complete interrupt frame for first task start */
;;;418       if (p_TCB->priv_stack != 0) {
00018a  8c60              LDRH     r0,[r4,#0x22]
00018c  2800              CMP      r0,#0
00018e  d005              BEQ      |L1.412|
;;;419          /* User has provided a memory space for the stack. */
;;;420          stk = &p_TCB->stack[p_TCB->priv_stack>>2];
000190  8c61              LDRH     r1,[r4,#0x22]
000192  1089              ASRS     r1,r1,#2
000194  0089              LSLS     r1,r1,#2
000196  6aa0              LDR      r0,[r4,#0x28]
000198  1847              ADDS     r7,r0,r1
00019a  e006              B        |L1.426|
;;;421       }
;;;422       else {
;;;423          /* Allocate the memory space for the stack. */
;;;424          p_TCB->stack = _alloc_box (m_stk);
                  |L1.412|
00019c  4857              LDR      r0,|L1.764|
00019e  df01              SVC      0x1  ; formerly SWI
0001a0  62a0              STR      r0,[r4,#0x28]
;;;425          /* Write to the top of stack. */
;;;426          stk = &p_TCB->stack[OS_STKSIZE];
0001a2  214b              MOVS     r1,#0x4b
0001a4  0189              LSLS     r1,r1,#6
0001a6  6aa0              LDR      r0,[r4,#0x28]
0001a8  1847              ADDS     r7,r0,r1
;;;427       }
;;;428    
;;;429       /* Initial PC and default CPSR */
;;;430       *--stk = (U32)task_body;
                  |L1.426|
0001aa  1f38              SUBS     r0,r7,#4
0001ac  0007              MOVS     r7,r0
0001ae  6005              STR      r5,[r0,#0]
;;;431       i      = INITIAL_CPSR;
0001b0  4853              LDR      r0,|L1.768|
0001b2  9000              STR      r0,[sp,#0]
;;;432    
;;;433       /* If a task in THUMB mode, set T-bit. */
;;;434       if ((U32)task_body & 1) {
0001b4  07e8              LSLS     r0,r5,#31
0001b6  0fc0              LSRS     r0,r0,#31
0001b8  d003              BEQ      |L1.450|
;;;435          i |= 0x00000020;
0001ba  2120              MOVS     r1,#0x20
0001bc  9800              LDR      r0,[sp,#0]
0001be  4308              ORRS     r0,r0,r1
0001c0  9000              STR      r0,[sp,#0]
;;;436       }
;;;437       *--stk = i;
                  |L1.450|
0001c2  1f39              SUBS     r1,r7,#4
0001c4  000f              MOVS     r7,r1
0001c6  9800              LDR      r0,[sp,#0]
0001c8  6008              STR      r0,[r1,#0]
;;;438    
;;;439       /* Write initial registers. */
;;;440       for (i = full_context ? 13 : 8; i; i--) {
0001ca  2e00              CMP      r6,#0
0001cc  d001              BEQ      |L1.466|
0001ce  200d              MOVS     r0,#0xd
0001d0  e000              B        |L1.468|
                  |L1.466|
0001d2  2008              MOVS     r0,#8
                  |L1.468|
0001d4  9000              STR      r0,[sp,#0]
0001d6  e006              B        |L1.486|
;;;441          *--stk = 0;
                  |L1.472|
0001d8  2000              MOVS     r0,#0
0001da  1f39              SUBS     r1,r7,#4
0001dc  000f              MOVS     r7,r1
0001de  6008              STR      r0,[r1,#0]
0001e0  9800              LDR      r0,[sp,#0]            ;440
0001e2  1e40              SUBS     r0,r0,#1              ;440
0001e4  9000              STR      r0,[sp,#0]            ;440
                  |L1.486|
0001e6  9800              LDR      r0,[sp,#0]            ;440
0001e8  2800              CMP      r0,#0                 ;440
0001ea  d1f5              BNE      |L1.472|              ;440
;;;442       }
;;;443    
;;;444       /* For "full_context" assign a void pointer to R0. */
;;;445       if (full_context) {
0001ec  2e00              CMP      r6,#0
0001ee  d003              BEQ      |L1.504|
;;;446          *--stk = (U32)p_TCB->p_msg;
0001f0  1f39              SUBS     r1,r7,#4
0001f2  000f              MOVS     r7,r1
0001f4  69e0              LDR      r0,[r4,#0x1c]
0001f6  6008              STR      r0,[r1,#0]
;;;447       }
;;;448    
;;;449       /* Initial Task stack pointer. */
;;;450       p_TCB->tsk_stack = (U32)stk;
                  |L1.504|
0001f8  6267              STR      r7,[r4,#0x24]
;;;451    
;;;452       /* Task entry point. */
;;;453       p_TCB->ptask = task_body;
0001fa  62e5              STR      r5,[r4,#0x2c]
;;;454    
;;;455    #if (OS_STKCHECK == 1)
;;;456       /* Set a magic word for checking of stack overflow. */
;;;457       p_TCB->stack[0] = MAGIC_WORD;
0001fc  4841              LDR      r0,|L1.772|
0001fe  6aa1              LDR      r1,[r4,#0x28]
000200  6008              STR      r0,[r1,#0]
;;;458    #endif
;;;459    } /* end of os_init_context */
000202  b005              ADD      sp,sp,#0x14
000204  bcf0              POP      {r4-r7}
000206  bc08              POP      {r3}
000208  4718              BX       r3
                          ENDP

                  __SWI_0 PROC
;;;464    void __swi(0) os_switch_tasks (P_TCB p_new);
;;;465    void __SWI_0                  (P_TCB p_new) {
00020a  b510              PUSH     {r4,lr}
00020c  0004              MOVS     r4,r0
;;;466       /* Switch to next task (identified by "p_new"). Saving old and restoring */
;;;467       /* new context is written in assembly (module: Swi_RTX.s)                */
;;;468    
;;;469    #if (OS_STKCHECK == 1)
;;;470       if (tstclrb (&os_del_flag) == __FALSE) {
00020e  482e              LDR      r0,|L1.712|
000210  300c              ADDS     r0,r0,#0xc
000212  f7ff fffe         BL       tstclrb
000216  2800              CMP      r0,#0
000218  d110              BNE      |L1.572|
;;;471          /* Do not check if task has deleted itself. */
;;;472          if ((os_runtask->tsk_stack < (U32)os_runtask->stack) ||
00021a  482a              LDR      r0,|L1.708|
00021c  6800              LDR      r0,[r0,#0]  ; os_runtask
00021e  6a40              LDR      r0,[r0,#0x24]
000220  4928              LDR      r1,|L1.708|
000222  6809              LDR      r1,[r1,#0]  ; os_runtask
000224  6a89              LDR      r1,[r1,#0x28]
000226  4288              CMP      r0,r1
000228  d306              BCC      |L1.568|
;;;473              (os_runtask->stack[0] != MAGIC_WORD )) {
00022a  4826              LDR      r0,|L1.708|
00022c  6800              LDR      r0,[r0,#0]  ; os_runtask
00022e  6a80              LDR      r0,[r0,#0x28]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -