?? os_cpu_c.lst
字號:
147 #endif
148 }
\ 0000000A 10BD POP {R4,PC} ;; return
149 #endif
150
151 /*
152 *********************************************************************************************************
153 * IDLE TASK HOOK
154 *
155 * Description: This function is called by the idle task. This hook has been added to allow you to do
156 * such things as STOP the CPU to conserve power.
157 *
158 * Arguments : none
159 *
160 * Note(s) : 1) Interrupts are enabled during this call.
161 *********************************************************************************************************
162 */
163 #if OS_CPU_HOOKS_EN > 0u
\ In section .text, align 2, keep-with-next
164 void OSTaskIdleHook (void)
165 {
\ OSTaskIdleHook:
\ 00000000 80B5 PUSH {R7,LR}
166 #if OS_APP_HOOKS_EN > 0u
167 App_TaskIdleHook();
\ 00000002 ........ BL App_TaskIdleHook
168 #endif
169 }
\ 00000006 01BD POP {R0,PC} ;; return
170 #endif
171
172 /*
173 *********************************************************************************************************
174 * TASK RETURN HOOK
175 *
176 * Description: This function is called if a task accidentally returns. In other words, a task should
177 * either be an infinite loop or delete itself when done.
178 *
179 * Arguments : ptcb is a pointer to the task control block of the task that is returning.
180 *
181 * Note(s) : none
182 *********************************************************************************************************
183 */
184
185 #if OS_CPU_HOOKS_EN > 0u
\ In section .text, align 2, keep-with-next
186 void OSTaskReturnHook (OS_TCB *ptcb)
187 {
\ OSTaskReturnHook:
\ 00000000 10B5 PUSH {R4,LR}
\ 00000002 0400 MOVS R4,R0
188 #if OS_APP_HOOKS_EN > 0u
189 App_TaskReturnHook(ptcb);
\ 00000004 2000 MOVS R0,R4
\ 00000006 ........ BL App_TaskReturnHook
190 #else
191 (void)ptcb;
192 #endif
193 }
\ 0000000A 10BD POP {R4,PC} ;; return
194 #endif
195
196 /*
197 *********************************************************************************************************
198 * STATISTIC TASK HOOK
199 *
200 * Description: This function is called every second by uC/OS-II's statistics task. This allows your
201 * application to add functionality to the statistics task.
202 *
203 * Arguments : none
204 *********************************************************************************************************
205 */
206
207 #if OS_CPU_HOOKS_EN > 0u
\ In section .text, align 2, keep-with-next
208 void OSTaskStatHook (void)
209 {
\ OSTaskStatHook:
\ 00000000 80B5 PUSH {R7,LR}
210 #if OS_APP_HOOKS_EN > 0u
211 App_TaskStatHook();
\ 00000002 ........ BL App_TaskStatHook
212 #endif
213 }
\ 00000006 01BD POP {R0,PC} ;; return
214 #endif
215
216 /*
217 *********************************************************************************************************
218 * INITIALIZE A TASK'S STACK
219 *
220 * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
221 * stack frame of the task being created. This function is highly processor specific.
222 *
223 * Arguments : task is a pointer to the task code
224 *
225 * p_arg is a pointer to a user supplied data area that will be passed to the task
226 * when the task first executes.
227 *
228 * ptos is a pointer to the top of stack. It is assumed that 'ptos' points to
229 * a 'free' entry on the task stack. If OS_STK_GROWTH is set to 1 then
230 * 'ptos' will contain the HIGHEST valid address of the stack. Similarly, if
231 * OS_STK_GROWTH is set to 0, the 'ptos' will contains the LOWEST valid address
232 * of the stack.
233 *
234 * opt specifies options that can be used to alter the behavior of OSTaskStkInit().
235 * (see uCOS_II.H for OS_TASK_OPT_xxx).
236 *
237 * Returns : Always returns the location of the new top-of-stack once the processor registers have
238 * been placed on the stack in the proper order.
239 *
240 * Note(s) : 1) Interrupts are enabled when your task starts executing.
241 * 2) All tasks run in Thread mode, using process stack.
242 *********************************************************************************************************
243 */
244
\ In section .text, align 2, keep-with-next
245 OS_STK *OSTaskStkInit (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT16U opt)
246 {
\ OSTaskStkInit:
\ 00000000 30B4 PUSH {R4,R5}
\ 00000002 0400 MOVS R4,R0
247 OS_STK *stk;
248
249
250 (void)opt; /* 'opt' is not used, prevent warning */
251 stk = ptos; /* Load stack pointer */
\ 00000004 1000 MOVS R0,R2
252
253 /* Registers stacked as if auto-saved on exception */
254 *(stk) = (INT32U)0x01000000uL; /* xPSR */
\ 00000006 5FF08075 MOVS R5,#+16777216
\ 0000000A 0560 STR R5,[R0, #+0]
255 *(--stk) = (INT32U)task; /* Entry Point */
\ 0000000C 001F SUBS R0,R0,#+4
\ 0000000E 0460 STR R4,[R0, #+0]
256 *(--stk) = (INT32U)OS_TaskReturn; /* R14 (LR) */
\ 00000010 001F SUBS R0,R0,#+4
\ 00000012 .... LDR.N R5,??DataTable4_4
\ 00000014 0560 STR R5,[R0, #+0]
257 *(--stk) = (INT32U)0x12121212uL; /* R12 */
\ 00000016 001F SUBS R0,R0,#+4
\ 00000018 5FF01235 MOVS R5,#+303174162
\ 0000001C 0560 STR R5,[R0, #+0]
258 *(--stk) = (INT32U)0x03030303uL; /* R3 */
\ 0000001E 001F SUBS R0,R0,#+4
\ 00000020 5FF00335 MOVS R5,#+50529027
\ 00000024 0560 STR R5,[R0, #+0]
259 *(--stk) = (INT32U)0x02020202uL; /* R2 */
\ 00000026 001F SUBS R0,R0,#+4
\ 00000028 5FF00235 MOVS R5,#+33686018
\ 0000002C 0560 STR R5,[R0, #+0]
260 *(--stk) = (INT32U)0x01010101uL; /* R1 */
\ 0000002E 001F SUBS R0,R0,#+4
\ 00000030 5FF00135 MOVS R5,#+16843009
\ 00000034 0560 STR R5,[R0, #+0]
261 *(--stk) = (INT32U)p_arg; /* R0 : argument */
\ 00000036 001F SUBS R0,R0,#+4
\ 00000038 0160 STR R1,[R0, #+0]
262
263 /* Remaining registers saved on process stack */
264 *(--stk) = (INT32U)0x11111111uL; /* R11 */
\ 0000003A 001F SUBS R0,R0,#+4
\ 0000003C 5FF01135 MOVS R5,#+286331153
\ 00000040 0560 STR R5,[R0, #+0]
265 *(--stk) = (INT32U)0x10101010uL; /* R10 */
\ 00000042 001F SUBS R0,R0,#+4
\ 00000044 5FF01035 MOVS R5,#+269488144
\ 00000048 0560 STR R5,[R0, #+0]
266 *(--stk) = (INT32U)0x09090909uL; /* R9 */
\ 0000004A 001F SUBS R0,R0,#+4
\ 0000004C 5FF00935 MOVS R5,#+151587081
\ 00000050 0560 STR R5,[R0, #+0]
267 *(--stk) = (INT32U)0x08080808uL; /* R8 */
\ 00000052 001F SUBS R0,R0,#+4
\ 00000054 5FF00835 MOVS R5,#+134744072
\ 00000058 0560 STR R5,[R0, #+0]
268 *(--stk) = (INT32U)0x07070707uL; /* R7 */
\ 0000005A 001F SUBS R0,R0,#+4
\ 0000005C 5FF00735 MOVS R5,#+117901063
\ 00000060 0560 STR R5,[R0, #+0]
269 *(--stk) = (INT32U)0x06060606uL; /* R6 */
\ 00000062 001F SUBS R0,R0,#+4
\ 00000064 5FF00635 MOVS R5,#+101058054
\ 00000068 0560 STR R5,[R0, #+0]
270 *(--stk) = (INT32U)0x05050505uL; /* R5 */
\ 0000006A 001F SUBS R0,R0,#+4
\ 0000006C 5FF00535 MOVS R5,#+84215045
\ 00000070 0560 STR R5,[R0, #+0]
271 *(--stk) = (INT32U)0x04040404uL; /* R4 */
\ 00000072 001F SUBS R0,R0,#+4
\ 00000074 5FF00435 MOVS R5,#+67372036
\ 00000078 0560 STR R5,[R0, #+0]
272
273 return (stk);
\ 0000007A 30BC POP {R4,R5}
\ 0000007C 7047 BX LR ;; return
274 }
275
276 /*
277 *********************************************************************************************************
278 * TASK SWITCH HOOK
279 *
280 * Description: This function is called when a task switch is performed. This allows you to perform other
281 * operations during a context switch.
282 *
283 * Arguments : none
284 *
285 * Note(s) : 1) Interrupts are disabled during this call.
286 * 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
287 * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
288 * task being switched out (i.e. the preempted task).
289 *********************************************************************************************************
290 */
291 #if (OS_CPU_HOOKS_EN > 0u) && (OS_TASK_SW_HOOK_EN > 0u)
\ In section .text, align 2, keep-with-next
292 void OSTaskSwHook (void)
293 {
\ OSTaskSwHook:
\ 00000000 80B5 PUSH {R7,LR}
294 #if OS_APP_HOOKS_EN > 0u
295 App_TaskSwHook();
\ 00000002 ........ BL App_TaskSwHook
296 #endif
297 }
\ 00000006 01BD POP {R0,PC} ;; return
298 #endif
299
300 /*
301 *********************************************************************************************************
302 * OS_TCBInit() HOOK
303 *
304 * Description: This function is called by OS_TCBInit() after setting up most of the TCB.
305 *
306 * Arguments : ptcb is a pointer to the TCB of the task being created.
307 *
308 * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
309 *********************************************************************************************************
310 */
311 #if OS_CPU_HOOKS_EN > 0u
\ In section .text, align 2, keep-with-next
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -