📄 os_cpu_c.lst
字号:
171 装入堆栈指针ptos到stk
172
173 stk--> 入栈:task底\高 (高内存)
174 入 || 入栈:ACC
175 栈 || 入栈:B
176 顺 || 入栈:DPH //暂时忽略第二指针
177 序 || 入栈:DPL
178 | \/ | 入栈:PSW
C51 COMPILER V7.06 OS_CPU_C 04/04/2006 15:07:23 PAGE 4
179 | | 入栈:R7-R4
180 |______| 入栈:os_pdata(R3,R2,R1)用寄存器传递os_pdata
181 入栈:R0 (底内存)
182
183 // 入栈:DPS?? //双数据指针选择寄存器??
184 // 入栈:PC
185 自己应该参照编译器定义入栈/出栈顺序,写出来备以后查阅
186 */
187 OS_STK *OSTaskStkInit (void (*task)(void *pd)LG_REENTRANT, void *os_pdata, OS_STK *ptos, INT16U opt) LG_R
-EENTRANT
188 {
189 1 //INT16U *stk;
190 1 OS_STK *stk;
191 1
192 1 opt = opt; /* 'opt' is not used, prevent warning */
193 1 stk = (OS_STK *)ptos; /* Load stack pointer */
194 1 //装入堆栈指针ptos到stk
195 1
196 1 *stk = 0; //入栈:R0
197 1 stk -= sizeof(void *);
198 1 *(void **)stk = (void *)os_pdata; //用寄存器传递os_pdata
199 1 *--stk = 4; //入栈:R4-R7
200 1 *--stk = 5;
201 1 *--stk = 6;
202 1 *--stk = 7;
203 1
204 1 *--stk = PSW; //入栈:PSW
205 1 *--stk = 'L'; //入栈:DPL
206 1 *--stk = 'H'; //入栈:DPH //暂时忽略第二指针
207 1 *--stk = 'B'; //入栈:B
208 1 *--stk = 'A'; //入栈:ACC
209 1
210 1 *--stk = ((INT16U)task & 0xff00) >> 8; //保存任务地址
211 1 *--stk = (INT16U)task & 0x00ff;
212 1
213 1 *--stk = 15; //入栈个数
214 1 //END
215 1 return ((OS_STK *)stk);
216 1 }
217
218 /*$PAGE*/
219 /*
220 *********************************************************************************************************
221 * INITIALIZE A TASK'S STACK FOR FLOATING POINT EMULATION
222 *
223 *********************************************************************************************************
224 */
225
226 /*$PAGE*/
227 //void OSTaskStkInit_FPE_x86 (OS_STK **pptos, OS_STK **ppbos, INT32U *psize)
228 //{
229 //}
230
231 /*$PAGE*/
232 /*
233 *********************************************************************************************************
234 * TASK SWITCH HOOK
235 *
236 * Description: This function is called when a task switch is performed. This allows you to perform other
237 * operations during a context switch.
238 *
239 * Arguments : none
C51 COMPILER V7.06 OS_CPU_C 04/04/2006 15:07:23 PAGE 5
240 *
241 * Note(s) : 1) Interrupts are disabled during this call.
242 * 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
243 * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
244 * task being switched out (i.e. the preempted task).
245 *********************************************************************************************************
246 */
247 #if OS_CPU_HOOKS_EN > 0
248 void OSTaskSwHook (void) LG_REENTRANT
249 {
250 1 }
251 #endif
252
253 /*
254 *********************************************************************************************************
255 * OSTCBInit() HOOK
256 *
257 * Description: This function is called by OS_TCBInit() after setting up most of the TCB.
258 *
259 * Arguments : ptcb is a pointer to the TCB of the task being created.
260 *
261 * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
262 *********************************************************************************************************
263 */
264 #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
265 void OSTCBInitHook (OS_TCB *ptcb) LG_REENTRANT
266 {
267 1 ptcb = ptcb; /* Prevent Compiler warning */
268 1 }
269 #endif
270
271
272 /*
273 *********************************************************************************************************
274 * TICK HOOK
275 *
276 * Description: This function is called every tick.
277 *
278 * Arguments : none
279 *
280 * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
281 *********************************************************************************************************
282 */
283 #if OS_CPU_HOOKS_EN > 0
284 void OSTimeTickHook (void) LG_REENTRANT
285 {
286 1 }
287 #endif
288
289
290 /*
291 *********************************************************************************************************
292 * 中断服务程序外挂
293 * NOTE : 注意:所有中断外挂都在临界区之外,用户可以自行控制进/退临界区
294 *********************************************************************************************************
295 */
296 #if OS_ISR_T1_EN > 0
void OSISR_T1HOOK (void) LG_REENTRANT
{
/* 请在这里输入中断服务程序 */
C51 COMPILER V7.06 OS_CPU_C 04/04/2006 15:07:23 PAGE 6
}
#endif
304
305 #if OS_ISR_INT0_EN > 0
void OSISR_INT0HOOK (void) LG_REENTRANT
{
/* 请在这里输入中断服务程序 */
}
#endif
313
314 #if OS_ISR_INT1_EN > 0
void OSISR_INT1HOOK (void) LG_REENTRANT
{
/* 请在这里输入中断服务程序 */
}
#endif
322
323 #if OS_ISR_S0_EN > 0
324 void OSISR_S0HOOK (void) LG_REENTRANT
325 {
326 1
327 1 /* 请在这里输入中断服务程序 */
328 1
329 1
330 1
331 1 }
332 #endif
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 614 ----
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 + -