📄 os_cpu_c.lst
字号:
139 * stack frame of the task being created. This function is highly processor specific.
140 *
141 * Arguments : task is a pointer to the task code
142 *
143 * pdata is a pointer to a user supplied data area that will be passed to the task
144 * when the task first executes.
145 *
146 * ptos is a pointer to the top of stack. It is assumed that 'ptos' points to
147 * a 'free' entry on the task stack. If OS_STK_GROWTH is set to 1 then
148 * 'ptos' will contain the HIGHEST valid address of the stack. Similarly, if
149 * OS_STK_GROWTH is set to 0, the 'ptos' will contains the LOWEST valid address
150 * of the stack.
151 *
152 * opt specifies options that can be used to alter the behavior of OSTaskStkInit().
153 * (see uCOS_II.H for OS_TASK_OPT_???).
154 *
155 * Returns : Always returns the location of the new top-of-stack' once the processor registers have
156 * been placed on the stack in the proper order.
157 *
158 * Note(s) : Interrupts are enabled when your task starts executing. You can change this by setting the
159 * PSW to 0x0002 instead. In this case, interrupts would be disabled upon task startup. The
160 * application code would be responsible for enabling interrupts at the beginning of the task
161 * code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable
162 * interrupts. Failure to do this will make your system crash!
163 *********************************************************************************************************
164 */
165
166 OS_STK *OSTaskStkInit (void (*task)(void *pd) KCREENTRANT, void *pdata, OS_STK *ptos, INT16U opt) KCREENT
-RANT
167 {
168 1 INT8U * stk;
169 1
170 1 opt = opt; /* 'opt' is not used, prevent warning */
171 1 stk = (INT8U *) ptos; /* Load stack pointer */
172 1
173 1 /*
174 1 stk -= sizeof(void *);
175 1 *(void**)stk = pdata;
176 1 */
177 1
178 1 *--stk = 0x01;
C51 COMPILER V8.08 OS_CPU_C 04/08/2008 09:22:25 PAGE 4
179 1 *--stk = ((INT16U)pdata >> 8);
180 1 *--stk = ((INT16U)pdata & 0xFF);
181 1
182 1 *--stk = 7;
183 1 *--stk = 6;
184 1 *--stk = 5;
185 1 *--stk = 4;
186 1 /*
187 1 *--stk = 3;
188 1 *--stk = 2;
189 1 *--stk = 1;
190 1 */
191 1 /*
192 1 stk -= sizeof(void *);
193 1 *(void**)stk = pdata;
194 1 */
195 1 *--stk = 0x01;
196 1 *--stk = ((INT16U)pdata >> 8);
197 1 *--stk = ((INT16U)pdata & 0xFF);
198 1
199 1 *--stk = 0;
200 1 *--stk = PSW;
201 1 *--stk = 'L';
202 1 *--stk = 'H';
203 1 *--stk = 'B';
204 1 *--stk = 'A';
205 1 *--stk = ((INT16U)task >> 8);
206 1 *--stk = ((INT16U)task & 0x00FF);
207 1
208 1 *--stk = 15;
209 1
210 1 return ((void *)stk);
211 1 }
212
213 /*$PAGE*/
214 /*
215 *********************************************************************************************************
216 * TASK SWITCH HOOK
217 *
218 * Description: This function is called when a task switch is performed. This allows you to perform other
219 * operations during a context switch.
220 *
221 * Arguments : none
222 *
223 * Note(s) : 1) Interrupts are disabled during this call.
224 * 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
225 * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
226 * task being switched out (i.e. the preempted task).
227 *********************************************************************************************************
228 */
229 #if OS_CPU_HOOKS_EN > 0
230 void OSTaskSwHook (void) KCREENTRANT
231 {
232 1 }
233 #endif
234
235 /*
236 *********************************************************************************************************
237 * OSTCBInit() HOOK
238 *
239 * Description: This function is called by OS_TCBInit() after setting up most of the TCB.
240 *
C51 COMPILER V8.08 OS_CPU_C 04/08/2008 09:22:25 PAGE 5
241 * Arguments : ptcb is a pointer to the TCB of the task being created.
242 *
243 * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
244 *********************************************************************************************************
245 */
246 #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
247 void OSTCBInitHook (OS_TCB *ptcb) KCREENTRANT
248 {
249 1 ptcb = ptcb; /* Prevent Compiler warning */
250 1 }
251 #endif
252
253
254 /*
255 *********************************************************************************************************
256 * TICK HOOK
257 *
258 * Description: This function is called every tick.
259 *
260 * Arguments : none
261 *
262 * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
263 *********************************************************************************************************
264 */
265 #if OS_CPU_HOOKS_EN > 0
266 void OSTimeTickHook (void) KCREENTRANT
267 {
268 1 }
269 #endif
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 748 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -