Example #1
0
/** Pre-handling function.
 * @param num		IRQ number.
 * @return		True if IRQ should be handled. */
static bool pic_pre_handle(unsigned num) {
	assert(num < 16);

	/* Check for spurious IRQs. */
	if(num == 7) {
		/* Read the In-Service Register, check the high bit. */
		out8(0x23, 3);
		if((in8(0x20) & 0x80) == 0) {
			kprintf(LOG_DEBUG, "pic: spurious IRQ7 (master), ignoring...\n");
			return false;
		}
	} else if(num == 15) {
		/* Read the In-Service Register, check the high bit. */
		out8(0xA3, 3);
		if((in8(0xA0) & 0x80) == 0) {
			kprintf(LOG_DEBUG, "pic: spurious IRQ15 (slave), ignoring...\n");
			return false;
		}
	}

	/* Edge-triggered interrupts must be acked before we handle. */
	if(!(pic_level_triggered & (1 << num)))
		pic_eoi(num);

	return true;
}
Example #2
0
void timer_intr(void)
{
  timer_systime_counter.low++;
  if(timer_systime_counter.low >= TIMER_SYSTIME_LOW_RESO) {
    timer_systime_counter.high++;
    timer_systime_counter.low = 0;
  }

  pic_eoi(PIC_IRQ_TIMER);	/* notify "Reception completion" to PIC */
/*
{
  static char i=0;
  int pos;
  char s[4];
  byte2hex(i,s);
  i++;
  pos = console_getpos();
  console_locatepos(77,0);
  console_puts(s);
  console_putpos(pos);
}
*/
  alarm_check();

  task_tick();
  task_dispatch();

  return;
}
Example #3
0
void cIRQ1(irq_stack_t regs)
{
  uint8_t c = ol_ps2_get_keyboard_scancode();
  kb_handle(c);
  pic_eoi(1);
  return;
}
Example #4
0
void cIRQ8(irq_stack_t regs)
{
  printf("test\n");
  outb(CMOS_SELECT, CMOS_RTC_IRQ);
  inb(CMOS_DATA);
  pic_eoi(8);
  return;
}
Example #5
0
void _inthandler26()
{
    if(fdc_reset)
        wake_up_event(WAIT_IRQ6);
    else
        fdc_reset = true;
    pic_eoi(6);
}
Example #6
0
INLINE int pic_is_spurious(unsigned irq) {
  uint16_t isr = pic_get_isr();
  if (irq == 7) return isr != 128;
  else if (irq == 15) {
    if (isr != 0x8004) {
      pic_eoi(2);
      return 0;
    } else return 1;
  } else return 0;
}
Example #7
0
void pic_isr(struct thread_state* state, unsigned ring, unsigned irq) {
  (void)state;
  (void)ring;

  unsigned pirq = irq - 32;
  if (!pic_is_spurious(pirq)) {
    if (pirq == 8) rtc_update(); // try to keep RTC latency as low as possible.
    pic_eoi(pirq);
    isr_send_signal(irq);
  }
}
Example #8
0
void pit_handler(struct interrupt_info* info) {
	pic_eoi(false);
	
	static int counter = 0;
	static int number = 0;
	++counter;
	if (counter >= PIT_TICKS) {
		++number;
		counter = 0;
		schedule(THREAD_NEW_STATE_ALIVE);
	}
}
Example #9
0
void cIRQ0(irq_stack_t regs)
{
  if (isSleeping)
  {
    if (!(sleepTime == 0)) sleepTime--;
  }
  pit_timer += 1;

  pic_eoi(0);

  return;
}
Example #10
0
void cIRQ4(irq_stack_t regs)
{
  pic_eoi(4);
  return;
}
Example #11
0
void cIRQ11(irq_stack_t regs)
{
  pic_eoi(11);
  return;
}
Example #12
0
/** Post-handling function.
 * @param num		IRQ number. */
static void pic_post_handle(unsigned num) {
	/* Level-triggered interrupts must be acked once all handlers have been
	 * run. */
	if(pic_level_triggered & (1 << num))
		pic_eoi(num);
}
Example #13
0
void cIRQ14(irq_stack_t regs)
{
  putc('a');
  pic_eoi(14);
  return;
}
Example #14
0
void cIRQ15(irq_stack_t regs)
{
  putc('b');
  pic_eoi(15);
  return;
}
Example #15
0
void cIRQ7(irq_stack_t regs)
{
  pic_eoi(7);
  return;
}
Example #16
0
void cIRQ6(irq_stack_t regs)
{
  pic_eoi(6);
  return;
}
Example #17
0
void cIRQ10(irq_stack_t regs)
{
  pic_eoi(10);
  return;
}
Example #18
0
void cIRQ3(irq_stack_t regs)
{
  pic_eoi(3);
  return;
}
Example #19
0
void cIRQ2(irq_stack_t regs)
{
  pic_eoi(2);
  return;
}
Example #20
0
void cIRQ5(irq_stack_t regs)
{
  pic_eoi(5);
  return;
}
Example #21
0
void cIRQ9(irq_stack_t regs)
{
  putc('a');
  pic_eoi(9);
  return;
}