📄 scheduler.lst
字号:
203 {
204 1 }
205
206
207 #if 0 // End of file used only by Chejudo to simplify change from old scheduler
#include "lib_mcu\timer\timer_drv.h" /* timer definition */
extern data Byte gl_cpt_tick; /* general tick counter */
extern data Byte gl_kbd_tick; /* keypad tick counter */
extern data Byte gl_mem_tick; /* memory tick counter */
#if (SCH_TIMER == SCH_TIMER0)
/****************************************************************************
* NAME: sch_time_init
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Scheduler time base (timer 0) initialization
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* mode 16-bit Timer, Time counter
* T0_PRIO to be defined in config.h
* TIM_LOW & TIM_HIGH defined in scheduler.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void sch_time_init (void)
{
T0_init(T0_NOT_GATED, T0_TIMER, T0_MODE_1);
T0_set_low(TIM_LOW);
T0_set_high(TIM_HIGH);
t0_set_prio(T0_PRIO); /* set-up priority */
C51 COMPILER V7.06 SCHEDULER 01/29/2008 10:59:25 PAGE 5
T0_enable_int(); /* enable interrupt */
T0_start(); /* start time base */
}
/****************************************************************************
* NAME: sch_timer_int
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Timer 0 interrupt function
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* IRQ_T0 defined in extsnd1.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
******************************************************************************/
Interrupt (sch_timer_int(void), IRQ_T0)
{
// T0_stop(); /* stop timer */
T0_set_low(TIM_LOW); /* reload timer */
T0_set_high(TIM_HIGH);
// T0_start(); /* restart timer */
#if (SCH_TYPE != SCH_FREE)
sch_tick_flag = TRUE;
#endif
/* increment task tick counters */
gl_cpt_tick++; /* general timer */
gl_kbd_tick++; /* keyboard timer */
gl_mem_tick++; /* memory timer */
}
#elif (SCH_TIMER == SCH_TIMER1)
/****************************************************************************
* NAME: sch_time_init
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Scheduler time base (timer 1) initialization
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* mode 16-bit Timer, Time counter
* T1_PRIO to be defined in config.h
* TIM_LOW & TIM_HIGH defined in scheduler.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void sch_time_init (void)
{
T1_init(T1_NOT_GATED, T1_TIMER, T1_MODE_1);
T1_set_low(TIM_LOW);
C51 COMPILER V7.06 SCHEDULER 01/29/2008 10:59:25 PAGE 6
T1_set_high(TIM_HIGH);
t1_set_prio(T1_PRIO); /* set-up priority */
T1_enable_int(); /* enable interrupt */
T1_start(); /* start time base */
}
/****************************************************************************
* NAME: sch_timer_int
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Timer 1 interrupt function
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* IRQ_T1 defined in extsnd1.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Interrupt (sch_timer_int(void), IRQ_T1)
{
// T1_stop(); /* stop timer */
T1_set_low(TIM_LOW); /* reload timer */
T1_set_high(TIM_HIGH);
// T1_start(); /* restart timer */
#if (SCH_TYPE != SCH_FREE)
sch_tick_flag = TRUE;
#endif
gl_cpt_tick++;
}
#elif (SCH_TIMER == SCH_TIMER2)
/****************************************************************************
* NAME: sch_time_init
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Scheduler time base (timer 2) initialization
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* mode 16-bit auto-reload
* T2_PRIO to be defined in config.h
* TIM_LOW & TIM_HIGH defined in scheduler.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void sch_time_init (void)
{
T2_init(T2_AUTO_RELOAD, T2_TIMER, T2_NOT_GATED);
T2_set_low(TIM_LOW);
C51 COMPILER V7.06 SCHEDULER 01/29/2008 10:59:25 PAGE 7
T2_set_high(TIM_HIGH);
t2_set_prio(T2_PRIO); /* set-up priority */
T2_enable_int(); /* enable interrupt */
T2_start(); /* start time base */
}
/****************************************************************************
* NAME: sch_timer_int
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Timer 2 interrupt function
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* IRQ_T2 defined in extsnd1.h
*----------------------------------------------------------------------------
* REQUIREMENTS:
******************************************************************************/
Interrupt (sch_timer_int(void), IRQ_T2)
{
T2_clr_ovf; /* ack interrupt */
#if (SCH_TYPE != SCH_FREE)
sch_tick_flag = TRUE;
#endif
gl_cpt_tick++;
}
#endif
#endif
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 24 ----
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 + -