/* Only the Model III has this as an actual interrupt */ void tty_interrupt(void) { uint8_t reg = tr1865_status; if (reg & 0x80) { reg = tr1865_rxtx; tty_inproc(2, reg); } if ((trs_flow & 8) && fullq(&ttyinq[2])) tr1865_ctrl = tr1865_ctrl_save & ~1; }
void tty_poll(void) { uint8_t x; x = peek(0x21) & 1 ; if (x) { x = peek(0x20); tty_inproc(1, x); } }
/* Called every timer tick */ void tty_pollirq(void) { unsigned char c; /* sdcc bug workaround */ while(tty1stat) { c = tty1data; tty_inproc(1, c); } while(tty2stat & 1) { c = tty2data; tty_inproc(2, c); } while(tty3stat & 1) { c = tty3data; tty_inproc(3, c); } if (tty2stat & 2) wakeup(&ttydata[2]); if (tty3stat & 2) wakeup(&ttydata[3]); }
void tty_pollirq_acia(void) { uint8_t ca; ca = ACIA_C; if (ca & 1) { tty_inproc(1, ACIA_D); } if ((ca & 2) && sleeping) { tty_outproc(1); sleeping = 0; } }
static void keydecode(void) { uint8_t c; if (keymap[7] & 64) /* shift */ c = shiftkeyboard[keybyte][keybit]; else c = keyboard[keybyte][keybit]; if (keymap[1] & 64) { /* control */ if (c > 31 && c < 127) c &= 31; } tty_inproc(1, c); }
void tty_poll(void) { uint8_t reg; /* Do the VG port */ if (ports & 0x10) { reg = vg_tr1865_wrst; if (reg & 0x01) { reg = vg_tr1865_ctrd; tty_inproc(3, reg); } if ((trs_flow & 0x10) && fullq(&ttyinq[3])) vg_tr1865_ctrd = vg_tr1865_ctrd_save & ~1; } /* Do the Model I/III port */ if (ports & 0x08) tty_interrupt(); }
static void keydecode(void) { uint8_t c; if (keybyte == 7 && keybit == 3) { capslock = 1 - capslock; return; } if (keymap[7] & 3) /* shift */ c = shiftkeyboard[keybyte][keybit]; else c = keyboard[keybyte][keybit]; /* The keyboard lacks some rather important symbols so remap them with control */ if (keymap[7] & 4) { /* control */ if (c > 31 && c < 127) c &= 31; if (keymap[7] & 3) { if (c == '(') c = '{'; if (c == ')') c = '}'; if (c == '-') c = '_'; if (c == '/') c = '``'; if (c == '<') c = '^'; } else { if (c == '(') c = '['; if (c == ')') c = ']'; if (c == '-') c = '|'; } } if (capslock && c >= 'a' && c <= 'z') c -= 'a' - 'A'; if (c) tty_inproc(1, c); }
void platform_interrupt(void) { uint8_t a = irqmap; uint8_t c; if (!(a & 4)) { /* FIXME: need to check uart itself to see wake cause */ wakeup(&ttydata[2]); /* work around sdcc bug */ c = uarta; tty_inproc(2, c); } if (!(a & 8)) { keyin[0] = kmap0; keyin[1] = kmap1; keyin[2] = kmap2; keyin[3] = kmap3; keyin[4] = kmap4; keyin[5] = kmap5; keyin[6] = kmap6; keyin[7] = kmap7; keyin[8] = kmap8; keyin[9] = kmap9; /* This resets the scan for 10mS on */ newkey = 0; keyproc(); if (keysdown < 3 && newkey) keydecode(); timer_interrupt(); } if (!(a & 16)) { /* FIXME: Power button */ ; } if (!(a & 32)) { /* FIXME: FDC interrupt */ ; } /* clear the mask */ irqmap = a; }
int pty_write(uint8_t minor, uint8_t rawflag, uint8_t flag) { uint16_t nwritten; minor += PTY_OFFSET; while (nwritten < udata.u_count) { if (udata.u_sysio) c = udata.u_base; else c = ugetc(udata.u_base); if (tty_inproc(minor, c)) { nwritten++; udata.u_count++; continue; } if (nwritten == 0 && psleep_flags(&ttyinq[minor].q_count, flag)) return -1; } return nwritten; }
static void keydecode_tc(void) { uint8_t c; if (keybyte == 1 && keybit == 5) { capslock = 1 - capslock; return; } /* TODO: ALT */ if (keymap[12] & 0x80) /* shift */ c = shift_keyboard_tc[keybyte][keybit]; else c = keyboard_tc[keybyte][keybit]; if (keymap[13] & 0x80) { /* control */ if (c > 31 && c < 127) c &= 31; } if (capslock && c >= 'a' && c <= 'z') c -= 'a' - 'A'; tty_inproc(1, c); }
/* Poll and add chars (if any) to input q */ void dw_vpoll( ){ unsigned char buf[2]; int i; /* don't waste time polling of no ports are open*/ if( ! open_ports ) return ; /* check ticks - don't poll until our delay is done */ if( --wait ) return; /* up to four transactions at a poll */ for( i=0; i<4; i++){ buf[0]=DW_SERREAD; dw_transaction( buf, 1, buf, 2 ); /* nothing waiting ? */ if( ! (buf[0] & 0x7f) ) { wait=MAX_WAIT; break; } /* VSER Channel single datum */ if( buf[0]<16 ){ int minor=dw_minor( buf[0] - 1 ); tty_inproc( minor, buf[1] ); continue; } /* VSER Channel closed? */ if( buf[0] == 16 ){ int minor=dw_minor( buf[1] ); struct dw_in *p=dw_gettab( minor ); if( p->flags & DW_FLG_OPEN ){ p->flags &= ~DW_FLG_OPEN; open_ports--; if( ttydata[minor].users ) tty_carrier_drop( minor); } continue; } /* VSER channel multiple data */ if( buf[0] < 32 ){ int i; unsigned char b[3]; int min; int minor=dw_minor( buf[0]-17 ); b[0]=DW_SERREADM; b[1]=buf[0]-17; min=mini( buf[1], qfree( minor ) ); b[2]=min; if( !min ){ wait=1; break; } dw_transaction( b,3,tbuf, min ); for( i=0; i<min; i++){ tty_inproc( minor, tbuf[i] ); } wait=1; break; } /* VWIN channel single datum */ if( buf[0] < 144 ){ int minor=dw_minor( buf[0]-48 ); tty_inproc( minor, buf[1] ); continue; } /* something we don't handle? */ kprintf("out of band data\n"); } }
void tty_poll(void) { uint16_t r; while((r = uart_poll()) != 0xFFFF) tty_inproc(1, r); }
int vt_inproc(uint8_t minor, unsigned char c) { #ifdef CONFIG_UNIKEY if (c == KEY_POUND) { tty_inproc(minor, 0xC2); return tty_inproc(minor, 0xA3); } if (c == KEY_HALF) { tty_inproc(minor, 0xC2); return tty_inproc(minor, 0xBD); } if (c == KEY_DOT) { tty_inproc(minor, 0xC2); return tty_inproc(minor, 0xB7); } if (c == KEY_EURO) { tty_inproc(minor, 0xE2); tty_inproc(minor, 0x82); return tty_inproc(minor, 0xAC); } if (c == KEY_YEN) { tty_inproc(minor, 0xC2); return tty_inproc(minor, 0xA5); } #endif if (c > 0x9F) { tty_inproc(minor, KEY_ESC); c &= 0x7F; } return tty_inproc(minor, c); }