48 lines
761 B
C
48 lines
761 B
C
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/spinlock.h>
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/tc3162/tc3162.h>
|
|
|
|
static char ppbuf[1024];
|
|
|
|
void prom_putchar(char data)
|
|
{
|
|
while (!(LSR_INDICATOR & LSR_THRE))
|
|
;
|
|
VPchar(CR_UART_THR) = data;
|
|
}
|
|
|
|
char prom_getchar(void)
|
|
{
|
|
while (!(LSR_INDICATOR & LSR_RECEIVED_DATA_READY))
|
|
;
|
|
return VPchar(CR_UART_RBR);
|
|
}
|
|
|
|
static void uart_write_buf(const char *buf, unsigned int n)
|
|
{
|
|
char ch;
|
|
|
|
while (n != 0) {
|
|
--n;
|
|
if ((ch = *buf++) == '\n')
|
|
prom_putchar('\r');
|
|
prom_putchar(ch);
|
|
}
|
|
}
|
|
|
|
void prom_printf(const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
int i;
|
|
|
|
va_start(args, fmt);
|
|
i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args);
|
|
va_end(args);
|
|
|
|
uart_write_buf(ppbuf, i);
|
|
}
|
|
EXPORT_SYMBOL(prom_printf);
|