int up_putc(int ch) { uint8_t state; /* Keep interrupts disabled so that we do not interfere with normal * driver operation */ state = z8_disableuartirq(&CONSOLE_DEV); /* Check for LF */ if (ch == '\n') { /* Add CR before LF */ z8_consoleput('\r'); } /* Output the character */ z8_consoleput((uint8_t)ch); /* It is important to restore the TX interrupt while the send is pending. * otherwise, TRDE interrupts can be lost since they do not pend after the * TRDE false->true transition. */ z8_restoreuartirq(&CONSOLE_DEV, state); return ch; }
void up_serialinit(void) { /* Disable all UART interrupts */ (void)z8_disableuartirq(&TTYS0_DEV); (void)z8_disableuartirq(&TTYS1_DEV); /* Initialize the console for early use */ CONSOLE_DEV.isconsole = true; z8_setup(&CONSOLE_DEV); /* Reigster console and tty devices */ (void)uart_register("/dev/console", &CONSOLE_DEV); (void)uart_register("/dev/ttyS0", &TTYS0_DEV); (void)uart_register("/dev/ttyS1", &TTYS1_DEV); }
static void z8_shutdown(FAR struct uart_dev_s *dev) { struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv; (void)z8_disableuartirq(dev); }
static void z8_shutdown(FAR struct uart_dev_s *dev) { (void)z8_disableuartirq(dev); }