コード例 #1
0
ファイル: timer.c プロジェクト: Skarsnik/sd2snes
/* Systick interrupt handler */
void SysTick_Handler(void) {
  ticks++;
  static int warmup = 0;
  static uint16_t sdch_state = 0;
  static uint16_t reset_state = 0;
  sdch_state = (sdch_state << 1) | SDCARD_DETECT | 0xe000;
  if(warmup > WARMUP_TICKS && ((sdch_state == 0xf000) || (sdch_state == 0xefff))) {
    sd_changed = 1;
  }
  reset_state = (reset_state << 1) | get_snes_reset() | 0xe000;
  if((reset_state == 0xf000) || (reset_state == 0xefff)) {
    reset_pressed = (reset_state == 0xf000);
    reset_changed = 1;
  }
  led_error();
  sdn_changed();
  SysTick_Hook();
  if(warmup <= WARMUP_TICKS) warmup++;
}
コード例 #2
0
ファイル: systick.c プロジェクト: Maldus512/frosted
void sys_tick_handler(void)
{
    uint32_t next_timer = 0;
    volatile uint32_t reload = systick_get_reload();
    uint32_t this_timeslice;
    SysTick_Hook();
    jiffies+= clock_interval;
    _n_int++;
    next_timer = ktimers_check();

#ifdef CONFIG_LOWPOWER
    if (next_timer < 0 || next_timer > 1000){
        next_timer = 1000; /* Wake up every second if timer is too long, or if no timers */
    }

    /* Checking deep sleep */
    if (next_timer >= 1000 && scheduler_can_sleep()) {
        systick_interrupt_disable();
        cputimer_start(next_timer);
        return;
    }
#ifdef CONFIG_TICKLESS
    this_timeslice = task_timeslice();
    if (_sched_active && (this_timeslice == 0) && (!task_running())) {
        schedule();
    } else {
        systick_interrupt_disable();
        cputimer_start(this_timeslice);
    }
    return;
#endif
#endif

    if (_sched_active && ((task_timeslice() == 0) || (!task_running()))) {
        schedule();
        (void)next_timer;
    }
}