PageRenderTime 36ms CodeModel.GetById 24ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/m68k/sun3/prom/printf.c

https://bitbucket.org/evzijst/gittest
C | 61 lines | 41 code | 12 blank | 8 comment | 4 complexity | db6211cea359e32344b80281d96e743d MD5 | raw file
 1/* $Id: printf.c,v 1.5 1996/04/04 16:31:07 tridge Exp $
 2 * printf.c:  Internal prom library printf facility.
 3 *
 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
 5 */
 6
 7/* This routine is internal to the prom library, no one else should know
 8 * about or use it!  It's simple and smelly anyway....
 9 */
10
11#include <linux/config.h>
12#include <linux/kernel.h>
13
14#include <asm/openprom.h>
15#include <asm/oplib.h>
16
17#ifdef CONFIG_KGDB
18extern int kgdb_initialized;
19#endif
20
21static char ppbuf[1024];
22
23void
24prom_printf(char *fmt, ...)
25{
26	va_list args;
27	char ch, *bptr;
28	int i;
29
30	va_start(args, fmt);
31
32#ifdef CONFIG_KGDB
33	ppbuf[0] = 'O';
34	i = vsprintf(ppbuf + 1, fmt, args) + 1;
35#else
36	i = vsprintf(ppbuf, fmt, args);
37#endif
38
39	bptr = ppbuf;
40
41#ifdef CONFIG_AP1000
42        ap_write(1,bptr,strlen(bptr));
43#else
44
45#ifdef CONFIG_KGDB
46	if (kgdb_initialized) {
47		printk("kgdb_initialized = %d\n", kgdb_initialized);
48		putpacket(bptr, 1);
49	} else
50#else
51	while((ch = *(bptr++)) != 0) {
52		if(ch == '\n')
53			prom_putchar('\r');
54
55		prom_putchar(ch);
56	}
57#endif
58#endif
59	va_end(args);
60	return;
61}