3 * Peter De Schrijver (p2@mind.be), Mind Linux Solutions, NV.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include <asm/u-boot.h>
24 #include <asm/processor.h>
30 DECLARE_GLOBAL_DATA_PTR;
32 const NS16550_t COM_PORTS[] =
33 { (NS16550_t) CONFIG_SYS_NS16550_COM1, (NS16550_t) CONFIG_SYS_NS16550_COM2 };
35 #undef CONFIG_SYS_DUART_CHAN
36 #define CONFIG_SYS_DUART_CHAN gComPort
37 static int gComPort = 0;
39 int serial_init (void)
41 int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
43 (void) NS16550_init (COM_PORTS[0], clock_divisor);
49 void serial_putc (const char c)
52 NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
55 NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
58 int serial_getc (void)
60 return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
63 int serial_tstc (void)
65 return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
68 void serial_setbrg (void)
70 int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
72 #ifdef CONFIG_SYS_INIT_CHAN1
73 NS16550_reinit (COM_PORTS[0], clock_divisor);
75 #ifdef CONFIG_SYS_INIT_CHAN2
76 NS16550_reinit (COM_PORTS[1], clock_divisor);
80 void serial_puts (const char *s)
87 #if defined(CONFIG_CMD_KGDB)
88 void kgdb_serial_init (void)
92 void putDebugChar (int c)
97 void putDebugStr (const char *str)
102 int getDebugChar (void)
104 return serial_getc ();
107 void kgdb_interruptible (int yes)