void nc100_tty_init(void) { /* Reset the 8251 */ mod_control(0x00, 0x08); nap(); mod_control(0x08, 0x00); nap(); uartb = SER_INIT; nap(); uartb = SER_RXTX; nap(); uarta; uarta; }
/* Select a drive and ensure the motor is on. */ static void fd_select(int minor) { (void)minor; mod_control(0x00, 0x20); /* motor on (active low) */ nudge_timer(); }
/* (called from interrupt context) */ void devfd_spindown(void) { if (spindown_timer && timer_expired(spindown_timer)) { mod_control(0x20, 0x00); /* motor off (active low) */ spindown_timer = 0; } }
int nc100_tty_open(uint8_t minor, uint16_t flag) { int err; if (!minor) minor = udata.u_ptab->p_tty; err = tty_open(minor, flag); if (err) return err; if (minor == 2) { mod_control(0, 0x10); /* turn on the line driver */ nap(); mod_control(0x06, 0x01); /* 9600 baud */ #ifdef CONFIG_NC200 irqen = 0x1C; #else irqen = 0x0B; /* Allow serial interrupts */ #endif } return (0); }
int nc100_tty_close(uint8_t minor) { tty_close(minor); if (minor == 2) { #ifdef CONFIG_NC200 irqen = 0x18; #else irqen = 0x08; /* mask serial interrupts */ #endif mod_control(0x10, 0); /* turn off the line driver */ } return (0); }
/* Called to set baud rate etc */ void tty_setup(uint8_t minor) { uint16_t b; if (minor == 1) return; b = ttydata[2].c_cflag & CBAUD; if (b < B150) b = B150; if (b > B19200) b = B19200; /* 0 = B150 .. 7 = B19200 in the same spacing and order as termios, how convenient */ mod_control(b - B150, 0x7); }