/* Optimized version used inline. Assumes that the uart is not * null. */ static BSP430_CORE_INLINE int emit_char2_ni (int c, hBSP430halSERIAL uart) { #if configBSP430_CONSOLE_USE_ONLCR - 0 if ('\n' == c) { UART_TRANSMIT(uart, '\r'); } #endif /* configBSP430_CONSOLE_USE_ONLCR */ return UART_TRANSMIT(uart, c); }
static void uart_tty_outwakeup(struct tty *tp) { struct uart_softc *sc; sc = tty_softc(tp); if (sc == NULL || sc->sc_leaving) return; if (sc->sc_txbusy) return; /* * Respect RTS/CTS (output) flow control if enabled and not already * handled by hardware. */ if ((tp->t_termios.c_cflag & CCTS_OFLOW) && !sc->sc_hwoflow && !(sc->sc_hwsig & SER_CTS)) return; sc->sc_txdatasz = ttydisc_getc(tp, sc->sc_txbuf, sc->sc_txfifosz); if (sc->sc_txdatasz != 0) UART_TRANSMIT(sc); }
static int sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data) { struct sunkbd_softc *sc; int error; sc = (struct sunkbd_softc *)kbd; error = 0; switch (cmd) { case KDGKBMODE: *(int *)data = sc->sc_mode; break; case KDSKBMODE: switch (*(int *)data) { case K_XLATE: if (sc->sc_mode != K_XLATE) { /* make lock key state and LED state match */ sc->sc_state &= ~LOCK_MASK; sc->sc_state |= KBD_LED_VAL(kbd); } /* FALLTHROUGH */ case K_RAW: case K_CODE: if (sc->sc_mode != *(int *)data) { sunkbd_clear_state(kbd); sc->sc_mode = *(int *)data; } break; default: error = EINVAL; break; } break; case KDGETLED: *(int *)data = KBD_LED_VAL(kbd); break; case KDSETLED: if (*(int *)data & ~LOCK_MASK) { error = EINVAL; break; } if (sc->sc_uart == NULL) break; sc->sc_uart->sc_txdatasz = 2; sc->sc_uart->sc_txbuf[0] = SKBD_CMD_SETLED; sc->sc_uart->sc_txbuf[1] = 0; if (*(int *)data & CLKED) sc->sc_uart->sc_txbuf[1] |= SKBD_LED_CAPSLOCK; if (*(int *)data & NLKED) sc->sc_uart->sc_txbuf[1] |= SKBD_LED_NUMLOCK; if (*(int *)data & SLKED) sc->sc_uart->sc_txbuf[1] |= SKBD_LED_SCROLLLOCK; UART_TRANSMIT(sc->sc_uart); KBD_LED_VAL(kbd) = *(int *)data; break; case KDGKBSTATE: *(int *)data = sc->sc_state & LOCK_MASK; break; case KDSKBSTATE: if (*(int *)data & ~LOCK_MASK) { error = EINVAL; break; } sc->sc_state &= ~LOCK_MASK; sc->sc_state |= *(int *)data; break; case KDSETREPEAT: case KDSETRAD: break; case PIO_KEYMAP: case PIO_KEYMAPENT: case PIO_DEADKEYMAP: default: return (genkbd_commonioctl(kbd, cmd, data)); } return (error); }