Ejemplo n.º 1
0
Archivo: irq.c Proyecto: naegi/apropOS
void irq_handler(struct regs* r){
    printf("irq %d handled", r->call_code);
    if(r->call_code < 15 && handler[r->call_code])
    {
        handler[r->call_code](r);
    }
    PIC_sendEOI(r->call_code);

}
Ejemplo n.º 2
0
void interrupt_handler_timer(void){
	//static int p=0;
	//	print_timer("Time");
 timer_handler();
//printk("shashank_timer=%d",p);
//	p++;
//timer_interrupt_1();
	PIC_sendEOI(0x20);
}
Ejemplo n.º 3
0
void interrupt_handler_keyboard(void){
	static int shift = 0;
	uint8_t scancode;
	uint8_t code;
	scancode = inb(0x60);
	switch(scancode)
	{
		case KBD_RIGHTSHIFT:
		case KBD_LEFTSHIFT :
			shift = 1;
			break;
		case KBD_RIGHTSHIFT_RELEASE:
		case KBD_LEFTSHIFT_RELEASE :
			shift = 0;
			break;
		default:
			break;
	}
	code=scancode_to_char(scancode,shift);
	if(code != 0)
	{
		printy("key pressed=%c     ",code);
		keycode=code;
		//attaching scanf
			if(start_buffer==1)
			{	
					
				if(clean_buffer==1)
				{	int i=0;
					count=0;
					for(i=0;i<512;i++)
					{
						buffer[i]='\0';
						return_buffer[i]='\0';
					}
					clean_buffer=0;
				}
				if(code!='\n')
				{
					return_buffer[count]=code;
					buffer[count++]=code;
					//countb=count;
					flag=1;
							
				}
				
				//printy("%c",code);	
				if(code=='\n')
				{
					buffer_complete=1;	
				}
				
			}

	}
	PIC_sendEOI(0x20);
}
Ejemplo n.º 4
0
void do_kb_interupt()
{
	char data;
	PIC_sendEOI(1);
	//outb(0x61, 0x20);
	data = inb(KB_DATA);

	fifo_put(kbFIFO, offset + data);
	//draw_char(0xe0000000, 1024, 15, 0,0, data);
}
Ejemplo n.º 5
0
void isr_handler(registers_t* regs)
{

  if(exception_depth++ >= 3){
    printf("Exception depth exceeded 3");
    while(1);
  }
  
  if((regs->int_no < 32) && (isFatal(regs->int_no))){

    terminal_bluescreen();
    char* name = interrupt_name(regs->int_no);

    printf("\t\t\t\t\t\tSOMETHING JUST WENT VERY WRONG\n\nI'd like to");
    printf(" interject for a moment.  What you're referring to as:\n\n\t");
    printf("Interrupt %d\n\nIs in fact, a fatal exception, ", (int) regs->int_no);
    printf("or as I've recently taken to  calling it:\n\n");
    printf("\t%s with error code %p\n", name, (void *) regs->err_code);
    
    //Halt the machine
    while(1);
    
  }

  if(regs->int_no >= 32){
    //Handle our IRQs
    //interrupt numbers 0-31 are reserved by intel, so subtract 32
    //to get the isa irq code.  32 is an arbitary number decided in the
    //PIC initialization code
    int isa_irq = (regs->int_no - 32);
    
    switch(isa_irq){
    case 0:
      //Programmable interval timer interrupt
      break;
    case 1:
      //Keyboard interrupt
      handle_keyboard_interrupt();
      break;
    }
    
    PIC_sendEOI(regs->int_no);
  }else{
    //It is an exception we can (and should) handle
    switch(regs->int_no){
    case 14:
      handle_page_fault(regs->err_code);
      break;
    }
  }

  exception_depth = 0;
  return;
}
Ejemplo n.º 6
0
Archivo: rtc.c Proyecto: Jpsita/os1
void handle_irq_8(){
	time ++;
	outb(RTC_SELECT_PORT, RTC_REG_C);
	inb(RTC_DATA_PORT);
	PIC_sendEOI(0x08);
}