/* * Print a string to the serial port trying not to disturb * any possible real use of the port... * * The console must be locked when we get here. */ static void serial_console_write(struct console *co, const char *s, unsigned count) { unsigned short intena = custom.intenar; custom.intena = IF_TBE; while (count--) { if (*s == '\n') amiga_serial_putc('\r'); amiga_serial_putc(*s++); } custom.intena = IF_SETCLR | (intena & IF_TBE); }
void amiga_serial_console_write(struct console *co, const char *s, unsigned int count) { #if 0 /* def CONFIG_KGDB */ /* FIXME:APUS GDB doesn't seem to like O-packages before it is properly connected with the target. */ __gdb_output_string (s, count); #else while (count--) { if (*s == '\n') amiga_serial_putc('\r'); amiga_serial_putc(*s++); } #endif }
void amiga_serial_gets(struct console *co, char *s, int len) { int ch, cnt = 0; while (1) { ch = amiga_serial_console_wait_key(co); /* Check for backspace. */ if (ch == 8 || ch == 127) { if (cnt == 0) { amiga_serial_putc('\007'); continue; } cnt--; amiga_serial_puts("\010 \010"); continue; } /* Check for enter. */ if (ch == 10 || ch == 13) break; /* See if line is too long. */ if (cnt >= len + 1) { amiga_serial_putc(7); cnt--; continue; } /* Store and echo character. */ s[cnt++] = ch; amiga_serial_putc(ch); } /* Print enter. */ amiga_serial_puts("\r\n"); s[cnt] = 0; }