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.
This commit is contained in:
Joel Sherrill
2003-04-10 16:35:33 +00:00
parent 48cdb95aa2
commit 0d6849e76a
9 changed files with 49 additions and 15 deletions

View File

@@ -1,3 +1,21 @@
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.
2003-04-10 Joel Sherrill <joel@OARcorp.com>
PR 383/bsps

View File

@@ -34,7 +34,6 @@ extern int close(int fd);
#include <rtems/libio.h>
#include <termios.h>
#include <bsp/uart.h>
#include <bsp/consoleIo.h>
#include <rtems/bspIo.h> /* printk */
/* Definitions for BSPConsolePort */
@@ -120,7 +119,7 @@ console_initialize(rtems_device_major_number major,
status = rtems_io_register_name ((nm=ttyS[minor].name), major, minor);
if ( RTEMS_SUCCESSFUL==status && BSPConsolePort == minor)
{
printk("Registering /dev/console as minor %i (==%s)\n",
printk("Registering /dev/console as minor %d (==%s)\n",
minor,
ttyS[minor].name);
/* also register an alias */

View File

@@ -33,6 +33,7 @@ extern board_memory_map *ptr_mem_map;
extern int select_console(ioType t);
/* extern int printk(const char *, ...) __attribute__((format(printf, 1, 2))); */
extern void debug_putc(const unsigned char c);
extern void debug_putc_onlcr(const char c);
extern int debug_getc(void);
extern int debug_tstc(void);
int kbdreset(void);

View File

@@ -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

View File

@@ -411,7 +411,7 @@ BSP_uart_polled_write(int uart, int val)
}
void
BSP_output_char_via_serial(int val)
BSP_output_char_via_serial(const char val)
{
BSP_uart_polled_write(BSPConsolePort, val);
if (val == '\n') BSP_uart_polled_write(BSPConsolePort,'\r');

View File

@@ -35,7 +35,7 @@ int BSP_uart_get_break_cb(int uart, rtems_libio_ioctl_args_t *arg);
int BSP_uart_set_break_cb(int uart, rtems_libio_ioctl_args_t *arg);
extern unsigned BSP_poll_char_via_serial(void);
extern void BSP_output_char_via_serial(int val);
extern void BSP_output_char_via_serial(const char val);
extern int BSPConsolePort;
extern int BSPBaseBaud;

View File

@@ -18,7 +18,6 @@
* $Id$
*/
#include <bsp/consoleIo.h>
#include <libcpu/io.h>
#include <libcpu/spr.h>
#include <bsp/pci.h>

View File

@@ -23,7 +23,6 @@
#include <rtems/bspIo.h>
#include <bsp/openpic.h>
#include <bsp/pci.h>
#include <bsp/consoleIo.h>
#include <libcpu/io.h>
#include <libcpu/byteorder.h>
#include <bsp.h>
@@ -69,7 +68,7 @@ static unsigned int NumSources;
printk("openpic.c:%d: illegal priority %d\n", __LINE__, pri);
#define check_arg_irq(irq) \
if (irq < 0 || irq >= NumSources) \
printk("openpic.c:%d: illegal irq %d from %p,[%p],[[%p]]\n", \
printk("openpic.c:%d: illegal irq %d from 0x%08x,[0x%08x],[[0x%08x]]\n", \
__LINE__, irq, __builtin_return_address(0), \
__builtin_return_address(1), __builtin_return_address(2) \
);
@@ -222,7 +221,7 @@ void openpic_init(int main_pic, unsigned char *polarities, unsigned char *senses
break;
}
}
printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n", version,
printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at 0x%08x\n", version,
NumProcessors, NumSources, OpenPIC);
printk("OpenPIC Vendor %d (%s), Device %d (%s), Stepping %d\n", vendorid,

View File

@@ -102,7 +102,7 @@ void detect_host_bridge()
printk("Raven MPIC is accessed via memory Space Access at address : %x\n", tmp);
#endif
OpenPIC=(volatile struct OpenPIC *) (tmp + PREP_ISA_MEM_BASE);
printk("OpenPIC found at %p.\n",
printk("OpenPIC found at %x.\n",
OpenPIC);
}
}