0
void NS16550_putc(NS16550_t com_port, char c)
{
while ((serial_in(&com_port->lsr) & UART_LSR_THRE) == 0);
//write to the THR
serial_out(c, &com_port->thr);
if (c == '\n')
//why do we require to call this watch dog reset
WATCHDOG_RESET();
}
char NS16550_getc(NS16550_t com_port)
{
while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) {
#ifdef CONFIG_USB_TTY
extern void usbtty_poll(void);
usbtty_poll();
#endif
//why do we require to call this watch dog reset
WATCHDOG_RESET();
}
//return the rbr value
return serial_in(&com_port->rbr);
}
但while循環中的每次條件滿足設備將被重置? – rohit 2013-02-27 05:00:06