int kbdtest(void) { int i; printf("keyboard test\n"); printf("check keyboard..."); if(kbd_initialize()) { printf("failed\n"); } else { printf("ok\n"); printf("test kbd leds\n"); printf("num Lock off"); for(i=0;i<3;i++) { printf("\b\b\b on"); pckbd_leds(2); delay1(1000); pckbd_leds(0); printf("\b\b\boff"); delay1(1000); } printf("\ncaps Lock off"); for(i=0;i<3;i++) { printf("\b\b\b on"); pckbd_leds(4); delay1(1000); pckbd_leds(0); printf("\b\b\boff"); delay1(1000); } printf("\nscroll Lock off"); for(i=0;i<3;i++) { printf("\b\b\b on"); pckbd_leds(1); delay1(1000); pckbd_leds(0); printf("\b\b\boff"); delay1(1000); } printf("\n"); printf("press key test,wait 10s to quit\n"); while(1) { kbd_test=1; kbd_test_hit=0; delay1(10000); if(!kbd_test_hit){ kbd_test=0; break; } } } return 0; }
/****************************************************************** * Init ******************************************************************/ int isa_kbd_init(void) { char* result; result=kbd_initialize(); if(result==NULL) { PRINTF("AT Keyboard initialized\n"); irq_install_handler(25, (interrupt_handler_t *)handle_isa_int, NULL); isa_irq_install_handler(KBD_INTERRUPT, (interrupt_handler_t *)kbd_interrupt, NULL); return (1); } else { printf("%s\n",result); return (-1); } }
int kbd_init_hw(void) { char* result; kbd_request_region(); result=kbd_initialize(); if (result==NULL) { PRINTF("AT Keyboard initialized\n"); kbd_request_irq(kbd_interrupt); return (1); } else { printf("%s\n",result); return (-1); } }