patch-1.3.53 linux/arch/ppc/kernel/raw_printf.c
Next file: linux/arch/ppc/kernel/setup.c
Previous file: linux/arch/ppc/kernel/process.c
Back to the patch index
Back to the overall index
- Lines: 306
- Date:
Sat Dec 30 15:48:22 1995
- Orig file:
v1.3.52/linux/arch/ppc/kernel/raw_printf.c
- Orig date:
Mon Nov 27 12:48:26 1995
diff -u --recursive --new-file v1.3.52/linux/arch/ppc/kernel/raw_printf.c linux/arch/ppc/kernel/raw_printf.c
@@ -3,9 +3,65 @@
#include <stdarg.h>
extern void cnputc(char c);
-
+char cngetc(void);
+int cntstc(void);
+void _cnpause(void);
+void cnpause(void);
+void video_on(void);
+int CRT_init(void);
+int kbd(int noblock);
+int scankbd(void);
static char *_sprintk_ptr;
+void kbdreset(void);
+int CRT_test(void);
+int CRT_putc(int , unsigned char );
+/*int CRT_putc(int port, u_char c)*/
+int CRT_getc(void);
+int _vprintk( int (*putc)(), const char *fmt0, va_list ap);
+static _cvt(unsigned long val, char *buf, long radix, char *digits);
+static void cursor(void);
+static void initscreen(void );
+
+/*
+ * COM1 NS16550 support
+ */
+
+struct NS16550
+ {
+ unsigned char rbr; /* 0 */
+ unsigned char ier; /* 1 */
+ unsigned char fcr; /* 2 */
+ unsigned char lcr; /* 3 */
+ unsigned char mcr; /* 4 */
+ unsigned char lsr; /* 5 */
+ unsigned char msr; /* 6 */
+ unsigned char scr; /* 7 */
+ };
+#define thr rbr
+#define iir fcr
+#define dll rbr
+#define dlm ier
+
+#define LSR_DR 0x01 /* Data ready */
+#define LSR_OE 0x02 /* Overrun */
+#define LSR_PE 0x04 /* Parity error */
+#define LSR_FE 0x08 /* Framing error */
+#define LSR_BI 0x10 /* Break */
+#define LSR_THRE 0x20 /* Xmit holding register empty */
+#define LSR_TEMT 0x40 /* Xmitter empty */
+#define LSR_ERR 0x80 /* Error */
+
+#define COM1 0x800003F8
+#define COM2 0x800002F8
+
+typedef struct NS16550 *NS16550_t;
+
+const NS16550_t COM_PORTS[] = { COM1,COM2};
+
+volatile struct NS16550 *NS16550_init(int chan);
+void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c);
+unsigned char NS16550_getc(volatile struct NS16550 *com_port);
static _sputc(char c)
{
*_sprintk_ptr++ = c;
@@ -46,11 +102,7 @@
#define is_digit(c) ((c >= '0') && (c <= '9'))
-int
-_vprintk(putc, fmt0, ap)
- int (*putc)();
- const char *fmt0;
- va_list ap;
+int _vprintk( int (*putc)(), const char *fmt0, va_list ap)
{
char c, sign, *cp;
int left_prec, right_prec, zero_fill, length, pad, pad_on_right;
@@ -210,7 +262,6 @@
/*
* Console I/O interface
*/
-
typedef const (*proc)();
typedef int dev_t;
@@ -225,24 +276,24 @@
static int line_num = 0;
#define MAX_LINES 24
-char
-cngetc()
+char cngetc(void)
{
int s = _disable_interrupts();
char c = '\0';
if (port == CRT_PORT)
{
- c = CRT_getc(port);
+/* c = CRT_getc(port);*/
+ c = CRT_getc();
} else
if (port)
{
- c = NS16550_getc(port);
+ c = NS16550_getc((struct NS16550 *)port);
}
_enable_interrupts(s);
return (c);
}
-cntstc()
+int cntstc(void)
{
return (0);
}
@@ -268,7 +319,7 @@
port = CRT_PORT;
} else
{
- port = NS16550_init(0);
+ port =(int) NS16550_init(0);
}
init = TRUE;
}
@@ -278,7 +329,7 @@
} else
if (port)
{
- NS16550_putc(port, c);
+ NS16550_putc((struct NS16550 *)port, c);
}
if (c == '\n')
{
@@ -294,7 +345,7 @@
}
}
-_cnpause()
+void _cnpause(void)
{
int c;
int s = _disable_interrupts();
@@ -323,7 +374,7 @@
_enable_interrupts(s);
}
-cnpause()
+void cnpause(void)
{
int c;
int s = _disable_interrupts();
@@ -333,45 +384,7 @@
_enable_interrupts(s);
}
-/*
- * COM1 NS16550 support
- */
-
-struct NS16550
- {
- unsigned char rbr; /* 0 */
- unsigned char ier; /* 1 */
- unsigned char fcr; /* 2 */
- unsigned char lcr; /* 3 */
- unsigned char mcr; /* 4 */
- unsigned char lsr; /* 5 */
- unsigned char msr; /* 6 */
- unsigned char scr; /* 7 */
- };
-
-#define thr rbr
-#define iir fcr
-#define dll rbr
-#define dlm ier
-
-#define LSR_DR 0x01 /* Data ready */
-#define LSR_OE 0x02 /* Overrun */
-#define LSR_PE 0x04 /* Parity error */
-#define LSR_FE 0x08 /* Framing error */
-#define LSR_BI 0x10 /* Break */
-#define LSR_THRE 0x20 /* Xmit holding register empty */
-#define LSR_TEMT 0x40 /* Xmitter empty */
-#define LSR_ERR 0x80 /* Error */
-
-#define COM1 0x800003F8
-#define COM2 0x800002F8
-
-typedef struct NS16550 *NS16550_t;
-
-const NS16550_t COM_PORTS[] = { COM1, COM2};
-
-volatile struct NS16550 *
-NS16550_init(int chan)
+volatile struct NS16550 *NS16550_init(int chan)
{
volatile struct NS16550 *com_port;
volatile unsigned char xx;
@@ -393,13 +406,14 @@
}
-NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
+void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
{
volatile int i;
while ((com_port->lsr & LSR_THRE) == 0) ;
com_port->thr = c;
}
+
unsigned char NS16550_getc(volatile struct NS16550 *com_port)
{
while ((com_port->lsr & LSR_DR) == 0) ;
@@ -481,8 +495,7 @@
/*
* cursor() sets an offset (0-1999) into the 80x25 text area
*/
-static void
-cursor()
+static void cursor(void)
{
int pos = screen.cp - Crtat;
@@ -495,8 +508,7 @@
}
}
-static void
-initscreen()
+static void initscreen(void )
{
struct screen *d = &screen;
@@ -533,8 +545,7 @@
* "ca" is the color/attributes value (left-shifted by 8)
* or 0 if the current regular color for that screen is to be used.
*/
-void
-CRT_putc(int port, u_char c)
+int CRT_putc(int port, unsigned char c)
{
struct screen *d = &screen;
u_short *base;
@@ -779,13 +790,13 @@
cursor();
}
-video_on()
+void video_on(void)
{ /* Enable video */
outb(0x3C4, 0x01);
outb(0x3C5, inb(0x3C5)&~20);
}
-CRT_init()
+int CRT_init(void)
{
unsigned long *PCI_base = (unsigned long *)0x80808010; /* Magic */
struct screen *d = &screen;
@@ -964,9 +975,7 @@
_x__, 0x4E, 0x51, 0x4A, _x__, 0x49, 0x46, 0x54, /* 0x78-0x7F */
};
-int
-kbd(noblock)
- int noblock;
+int kbd(int noblock)
{
unsigned char dt, brk, act;
int first = 1;
@@ -1041,11 +1050,12 @@
goto loop;
}
-scankbd() {
+int scankbd(void)
+{
return (kbd(1) != -1);
}
-kbdreset()
+void kbdreset(void)
{
unsigned char c;
@@ -1066,14 +1076,14 @@
;
}
-CRT_getc()
+int CRT_getc(void)
{
int c;
while ((c = kbd(0)) == 0) ;
return(c);
}
-CRT_test()
+int CRT_test(void)
{
return ((inb(KBSTATP) & KBINRDY) != 0);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this