3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #ifdef CFG_NS16550_SERIAL
33 #if CONFIG_CONS_INDEX == 1
34 static NS16550_t console = (NS16550_t) CFG_NS16550_COM1;
35 #elif CONFIG_CONS_INDEX == 2
36 static NS16550_t console = (NS16550_t) CFG_NS16550_COM2;
37 #elif CONFIG_CONS_INDEX == 3
38 static NS16550_t console = (NS16550_t) CFG_NS16550_COM3;
39 #elif CONFIG_CONS_INDEX == 4
40 static NS16550_t console = (NS16550_t) CFG_NS16550_COM4;
42 #error no valid console defined
45 int serial_init (void)
47 DECLARE_GLOBAL_DATA_PTR;
49 int clock_divisor = (CFG_NS16550_CLK + gd->baudrate * 8 )
50 / (gd->baudrate * 16);
56 NS16550_init(console, clock_divisor);
62 serial_putc(const char c)
65 NS16550_putc(console, '\r');
67 NS16550_putc(console, c);
71 serial_puts (const char *s)
82 return NS16550_getc(console);
88 return NS16550_tstc(console);
94 DECLARE_GLOBAL_DATA_PTR;
96 int clock_divisor = CFG_NS16550_CLK / 16 / gd->baudrate;
98 NS16550_reinit(console, clock_divisor);