Stefan Roese | 45993ea | 2006-11-29 15:42:37 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc. |
| 4 | * |
| 5 | * modified for marvell db64360 eval board by |
| 6 | * Ingo Assmus <ingo.assmus@keymile.com> |
| 7 | * |
| 8 | * modified for cpci750 board by |
| 9 | * Reinhard Arlt <reinhard.arlt@esd-electronics.com> |
| 10 | * |
| 11 | * See file CREDITS for list of people who contributed to this |
| 12 | * project. |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU General Public License as |
| 16 | * published by the Free Software Foundation; either version 2 of |
| 17 | * the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This program is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | * GNU General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU General Public License |
| 25 | * along with this program; if not, write to the Free Software |
| 26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 27 | * MA 02111-1307 USA |
| 28 | */ |
| 29 | |
| 30 | /* |
| 31 | * serial.c - serial support for esd cpci750 board |
| 32 | */ |
| 33 | |
| 34 | /* supports the MPSC */ |
| 35 | |
| 36 | #include <common.h> |
| 37 | #include <command.h> |
| 38 | #include "../../Marvell/include/memory.h" |
| 39 | #include "serial.h" |
| 40 | |
| 41 | #include "mpsc.h" |
| 42 | |
| 43 | DECLARE_GLOBAL_DATA_PTR; |
| 44 | |
| 45 | int serial_init (void) |
| 46 | { |
| 47 | mpsc_init (gd->baudrate); |
| 48 | |
| 49 | return (0); |
| 50 | } |
| 51 | |
| 52 | void serial_putc (const char c) |
| 53 | { |
| 54 | if (c == '\n') |
| 55 | mpsc_putchar ('\r'); |
| 56 | |
| 57 | mpsc_putchar (c); |
| 58 | } |
| 59 | |
| 60 | int serial_getc (void) |
| 61 | { |
| 62 | return mpsc_getchar (); |
| 63 | } |
| 64 | |
| 65 | int serial_tstc (void) |
| 66 | { |
| 67 | return mpsc_test_char (); |
| 68 | } |
| 69 | |
| 70 | void serial_setbrg (void) |
| 71 | { |
| 72 | galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | void serial_puts (const char *s) |
| 77 | { |
| 78 | while (*s) { |
| 79 | serial_putc (*s++); |
| 80 | } |
| 81 | } |
| 82 | |
Jon Loeliger | 145318c | 2007-07-09 18:38:39 -0500 | [diff] [blame] | 83 | #if defined(CONFIG_CMD_KGDB) |
Stefan Roese | 45993ea | 2006-11-29 15:42:37 +0100 | [diff] [blame] | 84 | void kgdb_serial_init (void) |
| 85 | { |
| 86 | } |
| 87 | |
| 88 | void putDebugChar (int c) |
| 89 | { |
| 90 | serial_putc (c); |
| 91 | } |
| 92 | |
| 93 | void putDebugStr (const char *str) |
| 94 | { |
| 95 | serial_puts (str); |
| 96 | } |
| 97 | |
| 98 | int getDebugChar (void) |
| 99 | { |
| 100 | return serial_getc (); |
| 101 | } |
| 102 | |
| 103 | void kgdb_interruptible (int yes) |
| 104 | { |
| 105 | return; |
| 106 | } |
Jon Loeliger | 145318c | 2007-07-09 18:38:39 -0500 | [diff] [blame] | 107 | #endif |