Exemplo n.º 1
0
void 
interrupt_handler20(int* esp)
{
  timer_t* timer;
  char ts = 0;

  io_out8(PIC0_OCW2, 0x60); /* send sign to PIC from IRQ-00 */
  ++g_timerctl.count;
  if (g_timerctl.next > g_timerctl.count)
    return;   /* not the next timeout timer, break */

  timer = g_timerctl.timer0;
  for ( ; ; ) {
    /* timers are all using, donot need to check flags */
    if (timer->timeout > g_timerctl.count)
      break;

    /* timeout */
    timer->flags = TIMER_FLAGS_ALLOC;
    if (timer != g_mttimer)
      fifo_put(timer->fifo, timer->data);
    else 
      ts = 1; /* g_mttimer timeout */
    timer = timer->next;
  }

  g_timerctl.timer0 = timer;
  g_timerctl.next   = timer->timeout;

  /* task switch */
  if (0 != ts) 
    mt_taskswitch();
}
Exemplo n.º 2
0
void inthandler20(int *esp)
{
	struct TIMER *timer;
	char ts = 0;
	io_out8(PIC0_OCW2, 0x60);	
	timerctl.count++;
	if (timerctl.next > timerctl.count) {
		return;
	}
	timer = timerctl.t0; 
	for (;;) {
		
		if (timer->timeout > timerctl.count) {
			break;
		}
		
		timer->flags = TIMER_FLAGS_ALLOC;
		if (timer != mt_timer) {
			fifo32_put(timer->fifo, timer->data);
		} else {
			ts = 1; 
		}
		timer = timer->next;
	}
	timerctl.t0 = timer;
	timerctl.next = timer->timeout;
	if (ts != 0) {
		mt_taskswitch();
	}
	return;
}
Exemplo n.º 3
0
void inthandler20(int *esp)
{
	struct TIMER *timer;
	char ts = 0;
	io_out8(PIC0_OCW2, 0x60); /* 把IRQ-00接收信号结束的信息通知给PIC */
	timerctl.count++;
	if (timerctl.next > timerctl.count) {
		return;
	}
	timer = timerctl.t0; /* 首先把最前面的地址赋给timer */
	for (;;) {
	/* 因为timers的定时器都处于运行状态,所以不确认flags */
		if (timer->timeout > timerctl.count) {
			break;
		}
		/* 超时 */
		timer->flags = TIMER_FLAGS_ALLOC;
		if (timer != mt_timer) {
			fifo32_put(timer->fifo, timer->data);
		} else {
			ts = 1; /* mt_timer超时*/
		}
		timer = timer->next; /* 将下一个定时器的地址赋给timer*/
	}
	timerctl.t0 = timer;
	timerctl.next = timer->timeout;
	if (ts != 0) {
		mt_taskswitch();
	}
	return;
}