void kbd_Irq1Handler(struct InterruptInfo *r){ stopints(); uint8_t tmp; tmp=kbd_GetScanCode(); if(tmp>=0x80){ //tmp=kbd_GetScanCode(); tmp^=0x80; kbd_DoUnshifts(tmp); }else{ if(kbd_DoShifts(tmp)==0){ //if not a shift-type key if ((kbd_shifts.caps^kbd_shifts.shift)==1) { kd_putc_xy(kbdus_caps[tmp],11,12); kbd_PutBuffer(tmp,kbdus_caps[tmp]); }else{ kd_putc_xy(kbdus[tmp],10,12); kbd_PutBuffer(tmp,kbdus[tmp]); } } startints(); } }
//this function sends characters to the keyboard buffer //from a string of characters void sendtokeyb(const char *s,queue_t *q) { int i; stopints(); for (i=0;s[i];i++) { inq(q,s[i]); }; startints(); };
int kbd_PutBuffer(uint16_t scan,uint8_t asci){ stopints(); if(current_key>=KBD_BUFFER_SIZE){ return -1; } keys[current_key].scancode=scan; keys[current_key].asci=asci; current_key++; startints(); return 0; }
kbd_key kbd_PopBuffer(){ kbd_key k; while(current_key==0){ hlt(); //fill in busy code here } stopints(); current_key--; k.scancode=keys[current_key].scancode; k.asci=keys[current_key].asci; startints(); return k; }