|
|
1.1 ! root 1: #include <jerq.h> ! 2: #include <queue.h> ! 3: #include <kbd.h> ! 4: #include <setup.h> ! 5: ! 6: int kbdrepeat; ! 7: int rptcount; ! 8: int kbdstatus; ! 9: ! 10: kbdchar(){ ! 11: return qgetc(&KBDQUEUE); ! 12: } ! 13: kbdinit() ! 14: { ! 15: /* init the keyboard */ ! 16: DUART->b_cmnd=RESET_RECV|DIS_TX|DIS_RX; ! 17: DUART->b_cmnd=RESET_TRANS; ! 18: DUART->b_cmnd=RESET_ERR; ! 19: DUART->b_cmnd=RESET_MR; ! 20: DUART->mr1_2b=CHAR_ERR|NO_PAR|CBITS8; ! 21: DUART->mr1_2b=NRML_MOD|ONEP000SB; ! 22: DUART->b_sr_csr=BD300BPS; ! 23: DUART->b_cmnd=RESET_MR|ENB_TX|ENB_RX; ! 24: DUART->scc_ropbc=0x08; /* set output pins for kbd tx port*/ ! 25: #ifdef ftang ! 26: /* turn chirps on/off depending on BRAM */ ! 27: if(VALKEYTONE) ! 28: kbdstatus=0; /* no chirp */ ! 29: else ! 30: kbdstatus=TTY_CHIRP; /* chirp, chirp */ ! 31: DUART->b_data=kbdstatus|0x02; /* request status */ ! 32: #endif ! 33: } ! 34: auto2(){ ! 35: register unsigned s, c; ! 36: s=DUART->b_sr_csr; ! 37: c=DUART->b_data; ! 38: if(s&(FRM_ERR|OVR_RUN)) ! 39: return; ! 40: #ifdef ftang ! 41: if(s&PAR_ERR){ /* control word: caps lock or repeat */ ! 42: checkbram(); ! 43: VALCAPS=(c&0x04)? 0 : 1; /* set the caps lock flag */ ! 44: setbram(); ! 45: if(c&0x10) /* turn repeat off */ ! 46: kbdrepeat=rptcount=0; ! 47: else /* the next character is to be repeated */ ! 48: kbdrepeat=RPTON; ! 49: /* ! 50: * Don't actually set the repeat bit until the character ! 51: * after the control code ! 52: */ ! 53: }else{ /* ordinary character */ ! 54: rptcount=0; /* new char so restart repeat timer */ ! 55: if(c&0x80) ! 56: c=defkeymap[c&0x7f]; ! 57: qputc(&KBDQUEUE, (int)c); ! 58: if((kbdrepeat&RPTMASK) == RPTON){ ! 59: kbdrepeat=RPTHAVECHR|RPTON; ! 60: kbdrepeat|=c; ! 61: } ! 62: } ! 63: #else ! 64: qputc(&KBDQUEUE, (int)c); ! 65: } ! 66: kbdrpt(){ ! 67: #ifdef ftang ! 68: qputc(&KBDQUEUE, kbdrepeat&0xff); ! 69: #endif ! 70: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.