static inline int sci_handle_breaks(struct uart_port *port) { int copied = 0; unsigned short status = sci_in(port, SCxSR); struct tty_struct *tty = port->info->tty; struct sci_port *s = &sci_ports[port->line]; if (!s->break_flag && status & SCxSR_BRK(port)) { #if defined(CONFIG_CPU_SH3) /* Debounce break */ s->break_flag = 1; #endif /* Notify of BREAK */ if (tty_insert_flip_char(tty, 0, TTY_BREAK)) copied++; pr_debug("sci: BREAK detected\n"); } #if defined(SCIF_ORER) /* XXX: Handle SCIF overrun error */ if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { sci_out(port, SCLSR, 0); if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) { copied++; pr_debug("sci: overrun error\n"); } } #endif if (copied) tty_flip_buffer_push(tty); return copied; }
/* Is the SCI ready, ie is there a char waiting? */ static int kgdb_is_char_ready(struct sci_port *port) { unsigned short status = sci_in(port, SCxSR); if (status & (SCxSR_ERRORS(port) | SCxSR_BRK(port))) kgdb_handle_error(port); return (status & SCxSR_RDxF(port)); }
/* Breakpoint if there's a break sent on the serial port */ static void kgdb_break_interrupt(int irq, void *ptr, struct pt_regs *regs) { struct sci_port *port = ptr; unsigned short status = sci_in(port, SCxSR); if (status & SCxSR_BRK(port)) { /* Break into the debugger if a break is detected */ BREAKPOINT(); /* Clear */ sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port)); } }