summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-04-10 16:35:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-04-10 16:35:33 +0000
commit0d6849e76a7da35135a6f50ed8520ce643519f8e (patch)
tree951098f3629cb54e035daa5a5781d3586a8dbb0a /c/src/lib/libbsp/powerpc/shared/console/polled_io.c
parent2003-04-10 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-0d6849e76a7da35135a6f50ed8520ce643519f8e.tar.bz2
2003-04-10 Till Straumann <strauman@slac.stanford.edu>
PR 379/bsps * console/polled_io.c: libcpu provides 'printk' already. Therefore, the implementation in this file was removed (still used for the bootloader, though). It now provides BSP_output_char() for libcpu's printk(). * console/uart.c, console/uart.h: BSP_output_char_via_serial() prototype changed to match the BSP_output_char_function_type. Note that the motorola BSPs use polled-io for the output_char routine, not the uart.c version. The latter can be used be other BSPs however (e.g. SVGM). * console/console.c, console/consoleIo.h, console/polled_io.c, irq/irq_init.c, openpic/openpic.c, pci/detect_raven_bridge.c: Unfortunately, the supported 'printk' format string subset of the polled-io and libcpu implementations are different - hence, a few format strings in the ppc/shared BSP were changed.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/shared/console/polled_io.c')
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/polled_io.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
index edc1f06f0a..51802e5ce8 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
@@ -43,13 +43,18 @@
extern void boot_udelay();
void * __palloc(u_long);
void pfree(void *);
-
+#else
+#include <rtems/bspIo.h>
#endif
typedef unsigned long long u64;
typedef long long s64;
typedef unsigned int u32;
+#ifndef __BOOT__
+BSP_output_char_function_type BSP_output_char = debug_putc_onlcr;
+#endif
+
#ifdef USE_KBD_SUPPORT
unsigned short plain_map[NR_KEYS] = {
0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
@@ -430,6 +435,15 @@ void debug_putc(const u_char c)
curIo->putc(c);
}
+/* const char arg to be compatible with BSP_output_char decl. */
+void
+debug_putc_onlcr(const char c)
+{
+ if ('\n'==c)
+ debug_putc('\r');
+ debug_putc(c);
+}
+
int debug_getc(void)
{
return curIo->getc();
@@ -440,8 +454,6 @@ int debug_tstc(void)
return curIo->tstc();
}
-
-
#define vidmem ((__io_ptr)(ptr_mem_map->isa_mem_base+0xb8000))
void vacuum_putc(u_char c) {
@@ -528,9 +540,7 @@ void puts(const u_char *s)
char c;
while ( ( c = *s++ ) != '\0' ) {
- debug_putc(c);
- if ( c == '\n' )
- debug_putc('\r');
+ debug_putc_onlcr((const char)c);
}
}
@@ -875,6 +885,10 @@ int select_console(ioType t) {
#define is_digit(c) ((c) >= '0' && (c) <= '9')
+/* provide this for the bootloader only; otherwise
+ * use libcpu implementation
+ */
+#if defined(__BOOT__)
static int skip_atoi(const char **s)
{
int i=0;
@@ -903,6 +917,8 @@ int printk(const char *fmt, ...) {
return i;
}
+#endif
+
/* Necessary to avoid including a library, and GCC won't do this inline. */
#define div10(num, rmd) \
do { u32 t1, t2, t3; \
@@ -942,6 +958,7 @@ do { u32 t1, t2, t3; \
#define LONG 64 /* long argument */
#define LLONG 128 /* 64 bit argument */
+#if defined(__BOOT__)
static char * number(char * str, int size, int type, u64 num)
{
char fill,sign,tmp[24];
@@ -1107,3 +1124,4 @@ int k_vsprintf(char *buf, const char *fmt, va_list args)
*str = '\0';
return str-buf;
}
+#endif