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); }
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); }
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); }
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); }
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; }
void handle_irq_8(){ time ++; outb(RTC_SELECT_PORT, RTC_REG_C); inb(RTC_DATA_PORT); PIC_sendEOI(0x08); }