📄 os_task.lst
字号:
\ 00000092 .... LDR R3,??DataTable10 ;; OSRdyGrp
\ 00000094 .... LDR R4,??DataTable10 ;; OSRdyGrp
\ 00000096 2478 LDRB R4,[R4, #+0]
\ 00000098 3126 MOVS R6,#+49
\ 0000009A 8E5D LDRB R6,[R1, R6]
\ 0000009C B443 BICS R4,R4,R6
\ 0000009E 1C70 STRB R4,[R3, #+0]
92 }
93 OSRdyGrp |= bity; /* Make new priority ready to run */
\ ??OSTaskChangePrio_8:
\ 000000A0 .... LDR R3,??DataTable10 ;; OSRdyGrp
\ 000000A2 .... LDR R4,??DataTable10 ;; OSRdyGrp
\ 000000A4 2478 LDRB R4,[R4, #+0]
\ 000000A6 009E LDR R6,[SP, #+0]
\ 000000A8 2643 ORRS R6,R6,R4
\ 000000AA 1E70 STRB R6,[R3, #+0]
94 OSRdyTbl[y] |= bitx;
\ 000000AC .... LDR R4,??DataTable11 ;; OSRdyTbl
\ 000000AE BE5C LDRB R6,[R7, R2]
\ 000000B0 019F LDR R7,[SP, #+4]
\ 000000B2 3743 ORRS R7,R7,R6
\ 000000B4 A754 STRB R7,[R4, R2]
\ 000000B6 1DE0 B ??OSTaskChangePrio_9
95 #if OS_EVENT_EN > 0
96 } else { /* Task was not ready ... */
97 pevent = ptcb->OSTCBEventPtr;
\ ??OSTaskChangePrio_7:
\ 000000B8 CC69 LDR R4,[R1, #+28]
98 if (pevent != (OS_EVENT *)0) { /* ... remove from event wait list */
\ 000000BA 002C CMP R4,#+0
\ 000000BC 1AD0 BEQ ??OSTaskChangePrio_9
99 pevent->OSEventTbl[y_old] &= ~ptcb->OSTCBBitX;
\ 000000BE E618 ADDS R6,R4,R3
\ 000000C0 B446 MOV R12,R6
\ 000000C2 377A LDRB R7,[R6, #+8]
\ 000000C4 3026 MOVS R6,#+48
\ 000000C6 8E5D LDRB R6,[R1, R6]
\ 000000C8 B743 BICS R7,R7,R6
\ 000000CA 6646 MOV R6,R12
\ 000000CC 3772 STRB R7,[R6, #+8]
100 if (pevent->OSEventTbl[y_old] == 0) {
\ 000000CE E318 ADDS R3,R4,R3
\ 000000D0 1B7A LDRB R3,[R3, #+8]
\ 000000D2 002B CMP R3,#+0
\ 000000D4 04D1 BNE ??OSTaskChangePrio_10
101 pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
\ 000000D6 6378 LDRB R3,[R4, #+1]
\ 000000D8 3126 MOVS R6,#+49
\ 000000DA 8E5D LDRB R6,[R1, R6]
\ 000000DC B343 BICS R3,R3,R6
\ 000000DE 6370 STRB R3,[R4, #+1]
102 }
103 pevent->OSEventGrp |= bity; /* Add new priority to wait list */
\ ??OSTaskChangePrio_10:
\ 000000E0 6378 LDRB R3,[R4, #+1]
\ 000000E2 009E LDR R6,[SP, #+0]
\ 000000E4 1E43 ORRS R6,R6,R3
\ 000000E6 6670 STRB R6,[R4, #+1]
104 pevent->OSEventTbl[y] |= bitx;
\ 000000E8 A318 ADDS R3,R4,R2
\ 000000EA A418 ADDS R4,R4,R2
\ 000000EC 247A LDRB R4,[R4, #+8]
\ 000000EE 019E LDR R6,[SP, #+4]
\ 000000F0 2643 ORRS R6,R6,R4
\ 000000F2 1E72 STRB R6,[R3, #+8]
105 }
106 #endif
107 }
108 ptcb->OSTCBPrio = newprio; /* Set new task priority */
\ ??OSTaskChangePrio_9:
\ 000000F4 2D23 MOVS R3,#+45
\ 000000F6 CD54 STRB R5,[R1, R3]
109 ptcb->OSTCBY = y;
\ 000000F8 2F23 MOVS R3,#+47
\ 000000FA CA54 STRB R2,[R1, R3]
110 ptcb->OSTCBX = x;
\ 000000FC 2E22 MOVS R2,#+46
\ 000000FE 029B LDR R3,[SP, #+8]
\ 00000100 8B54 STRB R3,[R1, R2]
111 ptcb->OSTCBBitY = bity;
\ 00000102 3122 MOVS R2,#+49
\ 00000104 009B LDR R3,[SP, #+0]
\ 00000106 8B54 STRB R3,[R1, R2]
112 ptcb->OSTCBBitX = bitx;
\ 00000108 3031 ADDS R1,R1,#+48
\ 0000010A 019A LDR R2,[SP, #+4]
\ 0000010C 0A70 STRB R2,[R1, #+0]
113 OS_EXIT_CRITICAL();
\ 0000010E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
114 OS_Sched(); /* Run highest priority task ready */
\ 00000112 ........ _BLF OS_Sched,??OS_Sched??rT
115 return (OS_NO_ERR);
\ 00000116 0020 MOVS R0,#+0
\ ??OSTaskChangePrio_2:
\ 00000118 03B0 ADD SP,SP,#+12
\ 0000011A F0BC POP {R4-R7}
\ 0000011C 02BC POP {R1}
\ 0000011E 0847 BX R1 ;; return
\ ??OSTaskChangePrio_6:
\ 00000120 ........ DC32 OSMapTbl
116 }
117 #endif
118
119 /*
120 *********************************************************************************************************
121 * CREATE A TASK
122 *
123 * Description: This function is used to have uC/OS-II manage the execution of a task. Tasks can either
124 * be created prior to the start of multitasking or by a running task. A task cannot be
125 * created by an ISR.
126 *
127 * Arguments : task is a pointer to the task's code
128 *
129 * p_arg is a pointer to an optional data area which can be used to pass parameters to
130 * the task when the task first executes. Where the task is concerned it thinks
131 * it was invoked and passed the argument 'p_arg' as follows:
132 *
133 * void Task (void *p_arg)
134 * {
135 * for (;;) {
136 * Task code;
137 * }
138 * }
139 *
140 * ptos is a pointer to the task's top of stack. If the configuration constant
141 * OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
142 * memory to low memory). 'pstk' will thus point to the highest (valid) memory
143 * location of the stack. If OS_STK_GROWTH is set to 0, 'pstk' will point to the
144 * lowest memory location of the stack and the stack will grow with increasing
145 * memory locations.
146 *
147 * prio is the task's priority. A unique priority MUST be assigned to each task and the
148 * lower the number, the higher the priority.
149 *
150 * Returns : OS_NO_ERR if the function was successful.
151 * OS_PRIO_EXIT if the task priority already exist
152 * (each task MUST have a unique priority).
153 * OS_PRIO_INVALID if the priority you specify is higher that the maximum allowed
154 * (i.e. >= OS_LOWEST_PRIO)
155 *********************************************************************************************************
156 */
157
158 #if OS_TASK_CREATE_EN > 0
\ In segment CODE, align 4, keep-with-next
159 INT8U OSTaskCreate (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT8U prio)
160 {
\ OSTaskCreate:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
\ 00000006 1600 MOVS R6,R2
\ 00000008 1F00 MOVS R7,R3
161 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
162 OS_CPU_SR cpu_sr;
163 #endif
164 OS_STK *psp;
165 INT8U err;
166
167
168 #if OS_ARG_CHK_EN > 0
169 if (prio > OS_LOWEST_PRIO) { /* Make sure priority is within allowable range */
\ 0000000A 402F CMP R7,#+64
\ 0000000C 01D3 BCC ??OSTaskCreate_0
170 return (OS_PRIO_INVALID);
\ 0000000E 2A20 MOVS R0,#+42
\ 00000010 3CE0 B ??OSTaskCreate_1
171 }
172 #endif
173 OS_ENTER_CRITICAL();
\ ??OSTaskCreate_0:
\ 00000012 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
174 if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority */
\ 00000016 B900 LSLS R1,R7,#+2
\ 00000018 .... LDR R2,??DataTable23 ;; OSTCBPrioTbl
\ 0000001A 5158 LDR R1,[R2, R1]
\ 0000001C 0029 CMP R1,#+0
\ 0000001E 32D1 BNE ??OSTaskCreate_2
175 OSTCBPrioTbl[prio] = (OS_TCB *)1; /* Reserve the priority to prevent others from doing ... */
\ 00000020 BB00 LSLS R3,R7,#+2
\ 00000022 .... LDR R1,??DataTable23 ;; OSTCBPrioTbl
\ 00000024 0122 MOVS R2,#+1
\ 00000026 CA50 STR R2,[R1, R3]
176 /* ... the same thing until task is created. */
177 OS_EXIT_CRITICAL();
\ 00000028 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
178 psp = (OS_STK *)OSTaskStkInit(task, p_arg, ptos, 0); /* Initialize the task's stack */
\ 0000002C 0023 MOVS R3,#+0
\ 0000002E 3200 MOVS R2,R6
\ 00000030 2900 MOVS R1,R5
\ 00000032 2000 MOVS R0,R4
\ 00000034 ........ _BLF OSTaskStkInit,??OSTaskStkInit??rT
\ 00000038 0400 MOVS R4,R0
179 err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
\ 0000003A 0022 MOVS R2,#+0
\ 0000003C 0021 MOVS R1,#+0
\ 0000003E 0800 MOVS R0,R1
\ 00000040 07B4 PUSH {R0-R2}
\ 00000042 0300 MOVS R3,R0
\ 00000044 2100 MOVS R1,R4
\ 00000046 3800 MOVS R0,R7
\ 00000048 ........ _BLF OS_TCBInit,??OS_TCBInit??rT
\ 0000004C 0400 MOVS R4,R0
180 if (err == OS_NO_ERR) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -