PageRenderTime 25ms CodeModel.GetById 15ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/ppc/syslib/mv64x60_dbg.c

https://bitbucket.org/evzijst/gittest
C | 123 lines | 79 code | 25 blank | 19 comment | 8 complexity | ed632a3806f255d13126593371fe5d08 MD5 | raw file
  1/*
  2 * arch/ppc/syslib/mv64x60_dbg.c
  3 *
  4 * KGDB and progress routines for the Marvell/Galileo MV64x60 (Discovery).
  5 *
  6 * Author: Mark A. Greer <mgreer@mvista.com>
  7 *
  8 * 2003 (c) MontaVista Software, Inc.  This file is licensed under
  9 * the terms of the GNU General Public License version 2.  This program
 10 * is licensed "as is" without any warranty of any kind, whether express
 11 * or implied.
 12 */
 13
 14/*
 15 *****************************************************************************
 16 *
 17 *	Low-level MPSC/UART I/O routines
 18 *
 19 *****************************************************************************
 20 */
 21
 22
 23#include <linux/config.h>
 24#include <linux/irq.h>
 25#include <asm/delay.h>
 26#include <asm/mv64x60.h>
 27
 28
 29#if defined(CONFIG_SERIAL_TEXT_DEBUG)
 30
 31#define	MPSC_CHR_1	0x000c
 32#define	MPSC_CHR_2	0x0010
 33
 34static struct mv64x60_handle	mv64x60_dbg_bh;
 35
 36void
 37mv64x60_progress_init(u32 base)
 38{
 39	mv64x60_dbg_bh.v_base = base;
 40	return;
 41}
 42
 43static void
 44mv64x60_polled_putc(int chan, char c)
 45{
 46	u32	offset;
 47
 48	if (chan == 0)
 49		offset = 0x8000;
 50	else
 51		offset = 0x9000;
 52
 53	mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_1, (u32)c);
 54	mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_2, 0x200);
 55	udelay(2000);
 56}
 57
 58void
 59mv64x60_mpsc_progress(char *s, unsigned short hex)
 60{
 61	volatile char	c;
 62
 63	mv64x60_polled_putc(0, '\r');
 64
 65	while ((c = *s++) != 0)
 66		mv64x60_polled_putc(0, c);
 67
 68	mv64x60_polled_putc(0, '\n');
 69	mv64x60_polled_putc(0, '\r');
 70
 71	return;
 72}
 73#endif	/* CONFIG_SERIAL_TEXT_DEBUG */
 74
 75
 76#if defined(CONFIG_KGDB)
 77
 78#if defined(CONFIG_KGDB_TTYS0)
 79#define KGDB_PORT 0
 80#elif defined(CONFIG_KGDB_TTYS1)
 81#define KGDB_PORT 1
 82#else
 83#error "Invalid kgdb_tty port"
 84#endif
 85
 86void
 87putDebugChar(unsigned char c)
 88{
 89	mv64x60_polled_putc(KGDB_PORT, (char)c);
 90}
 91
 92int
 93getDebugChar(void)
 94{
 95	unsigned char	c;
 96
 97	while (!mv64x60_polled_getc(KGDB_PORT, &c));
 98	return (int)c;
 99}
100
101void
102putDebugString(char* str)
103{
104	while (*str != '\0') {
105		putDebugChar(*str);
106		str++;
107	}
108	putDebugChar('\r');
109	return;
110}
111
112void
113kgdb_interruptible(int enable)
114{
115}
116
117void
118kgdb_map_scc(void)
119{
120	if (ppc_md.early_serial_map)
121		ppc_md.early_serial_map();
122}
123#endif	/* CONFIG_KGDB */