?? os_cpu_c.lst
字號:
229 1 PUSH PSW
230 1 MOV PSW,#00H
231 1 PUSH AR0
232 1 PUSH AR1
233 1 PUSH AR2
234 1 PUSH AR3
235 1 PUSH AR4
236 1 PUSH AR5
237 1 PUSH AR6
238 1 PUSH AR7
239 1
C51 COMPILER V7.06 OS_CPU_C 07/29/2003 20:45:08 PAGE 5
240 1 POP AR7
241 1 POP AR6
242 1 POP AR5
243 1 POP AR4
244 1 POP AR3
245 1 POP AR2
246 1 POP AR1
247 1 POP AR0
248 1 POP PSW
249 1 POP DPL
250 1 POP DPH
251 1 POP B
252 1 POP ACC
253 1
254 1 */
255 1 stk = (OS_STK *)ptos; //
256 1
257 1 #endif
258 1 return ((OS_STK *)stk);
259 1 }
260
261 /*$PAGE*/
262 /*
263 *********************************************************************************************************
264 * INITIALIZE A TASK'S STACK FOR FLOATING POINT EMULATION
265 *
266 * Description: This function MUST be called BEFORE calling either OSTaskCreate() or OSTaskCreateExt() in
267 * order to initialize the task's stack to allow the task to use the Borland floating-point
268 * emulation. The returned pointer MUST be used in the task creation call.
269 *
270 * Ex.: OS_STK TaskStk[1000];
271 *
272 *
273 * void main (void)
274 * {
275 * OS_STK *ptos;
276 * OS_STK *pbos;
277 * INT32U size;
278 *
279 *
280 * OSInit();
281 * .
282 * .
283 * ptos = &TaskStk[999];
284 * pbos = &TaskStk[0];
285 * psize = 1000;
286 * OSTaskStkInit_FPE_x86(&ptos, &pbos, &size);
287 * OSTaskCreate(Task, (void *)0, ptos, 10);
288 * .
289 * .
290 * OSStart();
291 * }
292 *
293 * Arguments : pptos is the pointer to the task's top-of-stack pointer which would be passed to
294 * OSTaskCreate() or OSTaskCreateExt().
295 *
296 * ppbos is the pointer to the new bottom of stack pointer which would be passed to
297 * OSTaskCreateExt().
298 *
299 * psize is a pointer to the size of the stack (in number of stack elements). You
300 * MUST allocate sufficient stack space to leave at least 384 bytes for the
301 * floating-point emulation.
C51 COMPILER V7.06 OS_CPU_C 07/29/2003 20:45:08 PAGE 6
302 *
303 * Returns : The new size of the stack once memory is allocated to the floating-point emulation.
304 *
305 * Note(s) : 1) _SS is a Borland 'pseudo-register' and returns the contents of the Stack Segment (SS)
306 * 2) The pointer to the top-of-stack (pptos) will be modified so that it points to the new
307 * top-of-stack.
308 * 3) The pointer to the bottom-of-stack (ppbos) will be modified so that it points to the new
309 * bottom-of-stack.
310 * 4) The new size of the stack is adjusted to reflect the fact that memory was reserved on
311 * the stack for the floating-point emulation.
312 *********************************************************************************************************
313 */
314
315 /*$PAGE*/
316 #if 0//#Lin
void OSTaskStkInit_FPE_x86 (OS_STK **pptos, OS_STK **ppbos, INT32U *psize) reentrant //using 0
{
INT32U lin_tos; /* 'Linear' version of top-of-stack address */
INT32U lin_bos; /* 'Linear' version of bottom-of-stack address */
INT16U seg;
INT16U off;
INT32U bytes;
#if 0//#Lin
seg = FP_SEG(*pptos); /* Decompose top-of-stack pointer into seg:off */
off = FP_OFF(*pptos);
#endif
lin_tos = ((INT32U)seg << 4) + (INT32U)off; /* Convert seg:off to linear address */
bytes = *psize * sizeof(OS_STK); /* Determine how many bytes for the stack */
lin_bos = (lin_tos - bytes + 15) & 0xFFFFFFF0L; /* Ensure paragraph alignment for BOS */
seg = (INT16U)(lin_bos >> 4); /* Get new 'normalized' segment */
#if 0//#Lin
*ppbos = (OS_STK *)MK_FP(seg, 0x0000); /* Create 'normalized' BOS pointer */
memcpy(*ppbos, MK_FP(_SS, 0), 384u); /* Copy FP emulation memory to task's stack */
#endif
bytes = bytes - 16; /* Loose 16 bytes because of alignment */
#if 0//#Lin
*pptos = (OS_STK *)MK_FP(seg, (INT16U)bytes); /* Determine new top-of-stack */
*ppbos = (OS_STK *)MK_FP(seg, 384u); /* Determine new bottom-of-stack */
#endif
bytes = bytes - 384u;
*psize = bytes / sizeof(OS_STK); /* Determine new stack size */
}
#endif
348
349 /*$PAGE*/
350 /*
351 *********************************************************************************************************
352 * TASK SWITCH HOOK
353 *
354 * Description: This function is called when a task switch is performed. This allows you to perform other
355 * operations during a context switch.
356 *
357 * Arguments : none
358 *
359 * Note(s) : 1) Interrupts are disabled during this call.
360 * 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
361 * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
362 * task being switched out (i.e. the preempted task).
363 *********************************************************************************************************
C51 COMPILER V7.06 OS_CPU_C 07/29/2003 20:45:08 PAGE 7
364 */
365 #if (OS_CPU_HOOKS_EN > 0) && (OS_TASK_SW_HOOK_EN > 0)
366 void OSTaskSwHook (void) reentrant //using 0
367 {
368 1 }
369 #endif
370
371 /*
372 *********************************************************************************************************
373 * OS_TCBInit() HOOK
374 *
375 * Description: This function is called by OS_TCBInit() after setting up most of the TCB.
376 *
377 * Arguments : ptcb is a pointer to the TCB of the task being created.
378 *
379 * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
380 *********************************************************************************************************
381 */
382 #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
383 void OSTCBInitHook (OS_TCB *ptcb) reentrant //using 0
384 {
385 1 ptcb = ptcb; /* Prevent Compiler warning */
386 1 }
387 #endif
388
389
390 /*
391 *********************************************************************************************************
392 * TICK HOOK
393 *
394 * Description: This function is called every tick.
395 *
396 * Arguments : none
397 *
398 * Note(s) : 1) Interrupts may or may not be ENABLED during this call.
399 *********************************************************************************************************
400 */
401 #if (OS_CPU_HOOKS_EN > 0) && (OS_TIME_TICK_HOOK_EN > 0)
402 void OSTimeTickHook (void) reentrant //using 0
403 {
404 1 }
405 #endif
406
407 //=======================================================================================================
408 //For interrupt SW
409 //=======================================================================================================
410 //#Lin@20030715#add for interrupt en/disable
411
412
413 OS_CPU_SR OSCPUSaveSR (void) // //using 1// reentrant
414 {
415 1 OS_CPU_SR cpu_sr;
416 1 EA = 0;
417 1 cpu_sr = PSW;
418 1 return (cpu_sr);
419 1 }
420
421 void OSCPURestoreSR (OS_CPU_SR cpu_sr) // //using 1// reentrant
422 {
423 1 PSW = cpu_sr;
424 1 EA = 1;
425 1 }
C51 COMPILER V7.06 OS_CPU_C 07/29/2003 20:45:08 PAGE 8
426
427 //
428 //=======================================================================================================
429
430 //=======================================================================================================
431 //Init Timer
432 //=======================================================================================================
433
434 //#Lin@20030715
435
436 void UserInitTimerZero(void) reentrant //using 0
437 {
438 1 TMOD = TMOD & 0xF0;
439 1 TMOD = TMOD | 0x01; //16 bit
440 1
441 1 TH0 = 0x70; //Tick=50
442 1 TL0 = 0x00; //
443 1
444 1 TR0 = 1;
445 1 ET0 = 0; //disable T0 interrupt
446 1 }
447 //
448 //=======================================================================================================
449
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 717 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 1 ----
PDATA SIZE = ---- ----
DATA SIZE = 1 ----
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 + -