summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/mips
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-19 06:28:01 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 13:08:32 +0200
commitd7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc (patch)
treecaa54b4229e86a68c84ab5961af34e087dce5302 /c/src/lib/libbsp/mips
parentbsps/powerpc: Move shared btimer support (diff)
downloadrtems-d7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc.tar.bz2
bsps: Move console drivers to bsps
This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'c/src/lib/libbsp/mips')
-rw-r--r--c/src/lib/libbsp/mips/csb350/Makefile.am4
-rw-r--r--c/src/lib/libbsp/mips/csb350/console/console-io.c85
-rw-r--r--c/src/lib/libbsp/mips/hurricane/Makefile.am2
-rw-r--r--c/src/lib/libbsp/mips/hurricane/console/console.c212
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/Makefile.am4
-rw-r--r--c/src/lib/libbsp/mips/jmr3904/console/console-io.c123
-rw-r--r--c/src/lib/libbsp/mips/malta/Makefile.am4
-rw-r--r--c/src/lib/libbsp/mips/malta/console/conscfg.c158
-rw-r--r--c/src/lib/libbsp/mips/malta/console/printk_support.c54
-rw-r--r--c/src/lib/libbsp/mips/rbtx4925/Makefile.am2
-rw-r--r--c/src/lib/libbsp/mips/rbtx4925/console/console-io.c206
-rw-r--r--c/src/lib/libbsp/mips/rbtx4938/Makefile.am2
-rw-r--r--c/src/lib/libbsp/mips/rbtx4938/console/console-io.c209
-rw-r--r--c/src/lib/libbsp/mips/rbtx4938/console/yamon_api.h631
14 files changed, 9 insertions, 1687 deletions
diff --git a/c/src/lib/libbsp/mips/csb350/Makefile.am b/c/src/lib/libbsp/mips/csb350/Makefile.am
index 58d0ada987..49d28530d0 100644
--- a/c/src/lib/libbsp/mips/csb350/Makefile.am
+++ b/c/src/lib/libbsp/mips/csb350/Makefile.am
@@ -28,8 +28,8 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
# clock
librtemsbsp_a_SOURCES +=../../../../../../bsps/mips/csb350/clock/clockdrv.c
# console
-librtemsbsp_a_SOURCES += console/console-io.c
-librtemsbsp_a_SOURCES += ../../shared/console-polled.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/mips/csb350/console/console-io.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-polled.c
# timer
librtemsbsp_a_SOURCES += timer/timer.c
#isr
diff --git a/c/src/lib/libbsp/mips/csb350/console/console-io.c b/c/src/lib/libbsp/mips/csb350/console/console-io.c
deleted file mode 100644
index e1beff8460..0000000000
--- a/c/src/lib/libbsp/mips/csb350/console/console-io.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * This file contains the hardware specific portions of the TTY driver
- * for the serial ports on the csb350.
- */
-
-/*
- * COPYRIGHT (c) 1989-2000.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <bsp.h>
-#include <bsp/console-polled.h>
-#include <rtems/libio.h>
-#include <libcpu/au1x00.h>
-
-/*
- * console_initialize_hardware
- *
- * This routine initializes the console hardware.
- *
- */
-void console_initialize_hardware(void)
-{
- uart0->fifoctrl = 0xf1; /* enable fifo, max sizes */
- au_sync();
-}
-
-
-/*
- * console_outbyte_polled
- *
- * This routine transmits a character using polling.
- */
-void console_outbyte_polled(
- int port,
- char ch
-)
-{
- /* wait for the fifo to make room */
- while ((uart0->linestat & 0x20) == 0) {
- continue;
- }
-
- uart0->txdata = ch;
- au_sync();
-}
-/*
- * console_inbyte_nonblocking
- *
- * This routine polls for a character.
- */
-
-int console_inbyte_nonblocking(
- int port
-)
-{
- unsigned char c;
-
- if (uart0->linestat & 1) {
- c = (char)uart0->rxdata;
- return c;
- } else {
- return -1;
- }
-}
-
-#include <rtems/bspIo.h>
-
-static void csb250_output_char(char c)
-{
- console_outbyte_polled( 0, c );
-}
-
-static int csb250_get_char(void)
-{
- return console_inbyte_nonblocking(0);
-}
-
-BSP_output_char_function_type BSP_output_char = csb250_output_char;
-BSP_polling_getchar_function_type BSP_poll_char = csb250_get_char;
-
diff --git a/c/src/lib/libbsp/mips/hurricane/Makefile.am b/c/src/lib/libbsp/mips/hurricane/Makefile.am
index f789d0835e..b3963916a4 100644
--- a/c/src/lib/libbsp/mips/hurricane/Makefile.am
+++ b/c/src/lib/libbsp/mips/hurricane/Makefile.am
@@ -34,7 +34,7 @@ librtemsbsp_a_SOURCES += startup/usc.S
librtemsbsp_a_SOURCES +=../../../../../../bsps/mips/hurricane/clock/ckinit.c
# console
-librtemsbsp_a_SOURCES += console/console.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/mips/hurricane/console/console.c
# liblnk
librtemsbsp_a_SOURCES += ../shared/liblnk/lnklib.S
librtemsbsp_a_SOURCES += ../shared/liblnk/pmon.S
diff --git a/c/src/lib/libbsp/mips/hurricane/console/console.c b/c/src/lib/libbsp/mips/hurricane/console/console.c
deleted file mode 100644
index 219cc964c0..0000000000
--- a/c/src/lib/libbsp/mips/hurricane/console/console.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * This file contains the IDT 4650 console IO package.
- */
-
-/*
- * Author: Craig Lebakken <craigl@transition.com>
- *
- * COPYRIGHT (c) 1996 by Transition Networks Inc.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of Transition Networks not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * Transition Networks makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libbsp/no_cpu/no_bsp/console/console.c:
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <ctype.h>
-
-#include <rtems/console.h>
-#include <rtems/libio.h>
-#include <bsp.h>
-
-/* PMON entry points */
-int mon_read(int fd, char *buf, int cnt); /* stdin is fd=0 */
-int mon_write(int fd, char *buf, int cnt); /* stdout is fd=1 */
-
-/* console_initialize
- *
- * This routine initializes the console IO driver.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * Return values:
- */
-rtems_device_driver console_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg
-)
-{
- rtems_status_code status;
-
- status = rtems_io_register_name(
- "/dev/console",
- major,
- (rtems_device_minor_number) 0
- );
-
- if (status != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred(status);
-
- return RTEMS_SUCCESSFUL;
-}
-
-/* inbyte
- *
- * This routine reads a character from the SOURCE.
- */
-static char inbyte( void )
-{
- char buf[10];
-
- /*
- * If polling, wait until a character is available.
- */
- mon_read(0, buf, 1); /* stdin is fd=0, read 1 byte */
-
- return (buf[0]);
-}
-
-/* outbyte
- *
- * This routine transmits a character out the SOURCE. It may support
- * XON/XOFF flow control.
- */
-static void outbyte(
- char ch
-)
-{
- char buf[10];
- /*
- * If polling, wait for the transmitter to be ready.
- * Check for flow control requests and process.
- * Then output the character.
- */
- buf[0] = ch;
-
- mon_write( 1, buf, 1 ); /* stdout is fd=1, write 1 byte */
-}
-
-/*
- * Open entry point
- */
-
-rtems_device_driver console_open(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * Close entry point
- */
-
-rtems_device_driver console_close(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * read bytes from the serial port. We only have stdin.
- */
-rtems_device_driver console_read(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- rtems_libio_rw_args_t *rw_args;
- char *buffer;
- int maximum;
- int count = 0;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- buffer[ count ] = inbyte();
- if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
- buffer[ count++ ] = '\n';
- break;
- }
- }
-
- rw_args->bytes_moved = count;
- return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
-}
-
-/*
- * write bytes to the serial port. Stdout and stderr are the same.
- */
-rtems_device_driver console_write(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- int count;
- int maximum;
- rtems_libio_rw_args_t *rw_args;
- char *buffer;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- if ( buffer[ count ] == '\n') {
- outbyte('\r');
- }
- outbyte( buffer[ count ] );
- }
-
- rw_args->bytes_moved = maximum;
- return 0;
-}
-
-/*
- * IO Control entry point
- */
-rtems_device_driver console_control(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-#include <rtems/bspIo.h>
-
-static void hurricane_output_char(char c) { outbyte( c ); }
-
-BSP_output_char_function_type BSP_output_char = hurricane_output_char;
-BSP_polling_getchar_function_type BSP_poll_char = NULL;
-
diff --git a/c/src/lib/libbsp/mips/jmr3904/Makefile.am b/c/src/lib/libbsp/mips/jmr3904/Makefile.am
index 67b357e470..5b9516beaf 100644
--- a/c/src/lib/libbsp/mips/jmr3904/Makefile.am
+++ b/c/src/lib/libbsp/mips/jmr3904/Makefile.am
@@ -27,8 +27,8 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
# clock
librtemsbsp_a_SOURCES +=../../../../../../bsps/mips/jmr3904/clock/clockdrv.c
# console
-librtemsbsp_a_SOURCES += ../../shared/console-polled.c
-librtemsbsp_a_SOURCES += console/console-io.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-polled.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/mips/jmr3904/console/console-io.c
# timer
librtemsbsp_a_SOURCES += timer/timer.c
#isr
diff --git a/c/src/lib/libbsp/mips/jmr3904/console/console-io.c b/c/src/lib/libbsp/mips/jmr3904/console/console-io.c
deleted file mode 100644
index a7f3204d25..0000000000
--- a/c/src/lib/libbsp/mips/jmr3904/console/console-io.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * This file contains the hardware specific portions of the TTY driver
- * for the serial ports on the jmr3904.
- *
- * Logic based on the jmr3904-io.c file in newlib 1.8.2
- */
-
-/*
- * COPYRIGHT (c) 1989-2000.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <bsp.h>
-#include <bsp/console-polled.h>
-#include <rtems/libio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-/* external prototypes for monitor interface routines */
-
-#define READ_UINT8( _register_, _value_ ) \
- ((_value_) = *((volatile unsigned char *)(_register_)))
-
-#define WRITE_UINT8( _register_, _value_ ) \
- (*((volatile unsigned char *)(_register_)) = (_value_))
-
-#define READ_UINT16( _register_, _value_ ) \
- ((_value_) = *((volatile unsigned short *)(_register_)))
-
-#define WRITE_UINT16( _register_, _value_ ) \
- (*((volatile unsigned short *)(_register_)) = (_value_))
-
- /* - Board specific addresses for serial chip */
-#define DIAG_BASE 0xfffff300
-#define DIAG_SLCR (DIAG_BASE+0x00)
-#define DIAG_SLSR (DIAG_BASE+0x04)
-#define DIAG_SLDICR (DIAG_BASE+0x08)
-#define DIAG_SLDISR (DIAG_BASE+0x0C)
-#define DIAG_SFCR (DIAG_BASE+0x10)
-#define DIAG_SBRG (DIAG_BASE+0x14)
-#define DIAG_TFIFO (DIAG_BASE+0x20)
-#define DIAG_RFIFO (DIAG_BASE+0x30)
-
-#define BRG_T0 0x0000
-#define BRG_T2 0x0100
-#define BRG_T4 0x0200
-#define BRG_T5 0x0300
-
-/*
- * Eventually console-polled.c should hook to this better.
- */
-
-/*
- * console_initialize_hardware
- *
- * This routine initializes the console hardware.
- *
- */
-
-void console_initialize_hardware(void)
-{
- WRITE_UINT16 (DIAG_SLCR, 0x0020);
- WRITE_UINT16 (DIAG_SLDICR, 0x0000);
- WRITE_UINT16 (DIAG_SFCR, 0x0000);
- WRITE_UINT16 (DIAG_SBRG, BRG_T2 | 5);
-}
-
-/*
- * console_outbyte_polled
- *
- * This routine transmits a character using polling.
- */
-
-void console_outbyte_polled(
- int port,
- char ch
-)
-{
- unsigned short disr;
-
- for (;;) {
- READ_UINT16 (DIAG_SLDISR, disr);
- if (disr & 0x0002)
- break;
- }
- disr = disr & ~0x0002;
- WRITE_UINT8 (DIAG_TFIFO, (unsigned char) ch);
- WRITE_UINT16 (DIAG_SLDISR, disr);
-}
-
-/*
- * console_inbyte_nonblocking
- *
- * This routine polls for a character.
- */
-
-int console_inbyte_nonblocking(
- int port
-)
-{
- unsigned char c;
- unsigned short disr;
-
- READ_UINT16 (DIAG_SLDISR, disr);
- if (disr & 0x0001) {
- disr = disr & ~0x0001;
- READ_UINT8 (DIAG_RFIFO, c);
- WRITE_UINT16 (DIAG_SLDISR, disr);
- return (char) c;
- }
- return -1;
-}
-
-#include <rtems/bspIo.h>
-
-static void JMR3904_output_char(char c) { console_outbyte_polled( 0, c ); }
-
-BSP_output_char_function_type BSP_output_char = JMR3904_output_char;
-BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/mips/malta/Makefile.am b/c/src/lib/libbsp/mips/malta/Makefile.am
index c875d4b09c..c955b58a4a 100644
--- a/c/src/lib/libbsp/mips/malta/Makefile.am
+++ b/c/src/lib/libbsp/mips/malta/Makefile.am
@@ -41,8 +41,8 @@ librtemsbsp_a_SOURCES +=../../../../../../bsps/mips/shared/clock/mips_timer.S
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/legacy-console.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/legacy-console-control.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/legacy-console-select.c
-librtemsbsp_a_SOURCES += console/conscfg.c
-librtemsbsp_a_SOURCES += console/printk_support.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/mips/malta/console/conscfg.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/mips/malta/console/printk_support.c
# timer
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
diff --git a/c/src/lib/libbsp/mips/malta/console/conscfg.c b/c/src/lib/libbsp/mips/malta/console/conscfg.c
deleted file mode 100644
index 8d84c9321c..0000000000
--- a/c/src/lib/libbsp/mips/malta/console/conscfg.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * @file
- *
- * This file contains the libchip configuration information
- * to instantiate the libchip driver for the serial ports.
- */
-
-/*
- * COPYRIGHT (c) 1989-2012.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <unistd.h> /* write */
-
-#include <bsp.h>
-#include <libchip/serial.h>
-#include <libchip/ns16550.h>
-#include <rtems/pci.h>
-#include <bsp/irq.h>
-
-#if 1
-#define COM_CONSOLE_FUNCTIONS &ns16550_fns_polled
-#else
-#define COM_CONSOLE_FUNCTIONS &ns16550_fns
-#endif
-
-/*
- * Base IO for UART
- */
-#define COM1_BASE_IO 0x3F8
-#define COM2_BASE_IO 0x3E8
-
-// #define CLOCK_RATE 368640
-#define CLOCK_RATE (115200 * 16)
-
-#define COM_IO_BASE_ADDRESS (0xa0000000UL | 0x18000000UL)
-
-static uint8_t com_get_register(uintptr_t addr, uint8_t i);
-static void com_set_register(uintptr_t addr, uint8_t i, uint8_t val);
-static uint8_t tty2_get_register(uintptr_t addr, uint8_t i);
-static void tty2_set_register(uintptr_t addr, uint8_t i, uint8_t val);
-
-
-uint8_t com_get_register(uintptr_t addr, uint8_t i)
-{
- uint8_t val;
- volatile uint8_t *ptr;
- ptr = (volatile uint8_t *) COM_IO_BASE_ADDRESS;
- ptr += addr;
- ptr += i;
- val = *ptr;
-
- return val;
-}
-
-void com_set_register(uintptr_t addr, uint8_t i, uint8_t val)
-{
- volatile uint8_t *ptr;
-
- ptr = (volatile uint8_t *) COM_IO_BASE_ADDRESS;
- ptr += addr;
- ptr += i;
- *ptr = val;
-}
-
-uint8_t tty2_get_register(uintptr_t addr, uint8_t i)
-{
- uint8_t val;
- volatile uint8_t *ptr;
-
- ptr = (volatile uint8_t *) COM_IO_BASE_ADDRESS;
- ptr += addr;
- ptr += (i * 8);
- val = *ptr;
-
- return val;
-}
-
-void tty2_set_register(uintptr_t addr, uint8_t i, uint8_t val)
-{
- volatile uint8_t *ptr;
-
- ptr = (volatile uint8_t *) COM_IO_BASE_ADDRESS;
- ptr += addr;
- ptr += (i * 8);
- *ptr = val;
-}
-
-console_tbl Console_Configuration_Ports[] = {
- {
- "/dev/tty0", /* sDeviceName */
- SERIAL_NS16550, /* deviceType */
- COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe, assume it is there */
- NULL, /* pDeviceFlow */
- 16, /* ulMargin */
- 8, /* ulHysteresis */
- (void *) 9600, /* Baud Rate */ /* pDeviceParams */
- COM1_BASE_IO, /* ulCtrlPort1 */
- 0x00000000, /* ulCtrlPort2 */
- COM1_BASE_IO, /* ulDataPort */
- com_get_register, /* getRegister */
- com_set_register, /* setRegister */
- NULL,/* unused */ /* getData */
- NULL,/* unused */ /* setData */
- CLOCK_RATE, /* ulClock */
- MALTA_IRQ_TTY0 /* ulIntVector -- base for port */
- },
- {
- "/dev/tty1", /* sDeviceName */
- SERIAL_NS16550, /* deviceType */
- COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe, assume it is there */
- NULL, /* pDeviceFlow */
- 16, /* ulMargin */
- 8, /* ulHysteresis */
- (void *) 9600, /* Baud Rate */ /* pDeviceParams */
- COM2_BASE_IO, /* ulCtrlPort1 */
- 0x00000000, /* ulCtrlPort2 */
- COM2_BASE_IO, /* ulDataPort */
- com_get_register, /* getRegister */
- com_set_register, /* setRegister */
- NULL,/* unused */ /* getData */
- NULL,/* unused */ /* setData */
- CLOCK_RATE, /* ulClock */
- MALTA_IRQ_TTY1 /* ulIntVector -- base for port */
- },
- {
- "/dev/tty2", /* sDeviceName */
- SERIAL_NS16550, /* deviceType */
- COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe, assume it is there */
- NULL, /* pDeviceFlow */
- 16, /* ulMargin */
- 8, /* ulHysteresis */
- (void *) 9600, /* Baud Rate */ /* pDeviceParams */
- 0, /* IGNORED */ /* ulCtrlPort1 */
- 0, /* IGNORED */ /* ulCtrlPort2 */
- 0, /* IGNORED */ /* ulDataPort */
- tty2_get_register, /* getRegister */
- tty2_set_register, /* setRegister */
- NULL,/* unused */ /* getData */
- NULL,/* unused */ /* setData */
- CLOCK_RATE, /* ulClock */
- MALTA_CPU_INT2 /* ulIntVector -- base for port */
- },
-};
-
-/*
- * Define a variable that contains the number of statically configured
- * console devices.
- */
-unsigned long Console_Configuration_Count = \
- (sizeof(Console_Configuration_Ports)/sizeof(console_tbl));
diff --git a/c/src/lib/libbsp/mips/malta/console/printk_support.c b/c/src/lib/libbsp/mips/malta/console/printk_support.c
deleted file mode 100644
index e548485222..0000000000
--- a/c/src/lib/libbsp/mips/malta/console/printk_support.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @file
- *
- * This file contains a stub for the required printk support.
- */
-
-/*
- * COPYRIGHT (c) 1989-2012.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <rtems.h>
-#include <rtems/bspIo.h>
-#include <bsp.h>
-#include <libchip/serial.h>
-#include <libchip/ns16550.h>
-
-rtems_device_minor_number BSPPrintkPort = 0;
-
-void BSP_com_outch(char ch);
-int BSP_com_inch( void );
-
-/*
- * Following assume all are ns16650
- */
-void BSP_com_outch(char ch)
-{
- console_tbl *cptr;
-
- cptr = &Console_Configuration_Ports[BSPPrintkPort];
-
- return ns16550_outch_polled( cptr, ch );
-}
-
-int BSP_com_inch( void )
-{
- int result;
- console_tbl *cptr;
-
- cptr = &Console_Configuration_Ports[BSPPrintkPort];
-
- do {
- result = ns16550_inch_polled( cptr );
- } while (result == -1);
-
- return result;
-}
-
-BSP_output_char_function_type BSP_output_char = BSP_com_outch;
-BSP_polling_getchar_function_type BSP_poll_char = BSP_com_inch;
diff --git a/c/src/lib/libbsp/mips/rbtx4925/Makefile.am b/c/src/lib/libbsp/mips/rbtx4925/Makefile.am
index fbf3027670..76b2ef77d1 100644
--- a/c/src/lib/libbsp/mips/rbtx4925/Makefile.am
+++ b/c/src/lib/libbsp/mips/rbtx4925/Makefile.am
@@ -33,7 +33,7 @@ librtemsbsp_a_SOURCES += ../shared/irq/exception.S
# clock
librtemsbsp_a_SOURCES +=../../../../../../bsps/mips/rbtx4925/clock/clockdrv.c
# console
-librtemsbsp_a_SOURCES += console/console-io.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/mips/rbtx4925/console/console-io.c
# liblnk
librtemsbsp_a_SOURCES += ../shared/liblnk/lnklib.S
librtemsbsp_a_SOURCES += ../shared/liblnk/pmon.S
diff --git a/c/src/lib/libbsp/mips/rbtx4925/console/console-io.c b/c/src/lib/libbsp/mips/rbtx4925/console/console-io.c
deleted file mode 100644
index 75cca1ebbd..0000000000
--- a/c/src/lib/libbsp/mips/rbtx4925/console/console-io.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * This file contains the RBTX4925 console IO package.
- */
-
-/*
- * Author: Craig Lebakken <craigl@transition.com>
- *
- * COPYRIGHT (c) 1996 by Transition Networks Inc.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of Transition Networks not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * Transition Networks makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libbsp/no_cpu/no_bsp/console/console.c:
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <ctype.h>
-
-#include <rtems/console.h>
-#include <rtems/libio.h>
-#include <bsp.h>
-
-/* PMON entry points */
-int mon_read(int fd, char *buf, int cnt); /* stdin is fd=0 */
-int mon_write(int fd, char *buf, int cnt); /* stdout is fd=1 */
-
-/* console_initialize
- *
- * This routine initializes the console IO driver.
- */
-rtems_device_driver console_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg
-)
-{
- rtems_status_code status;
-
- status = rtems_io_register_name(
- "/dev/console",
- major,
- (rtems_device_minor_number) 0
- );
-
- if (status != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred(status);
-
- return RTEMS_SUCCESSFUL;
-}
-
-/* inbyte
- *
- * This routine reads a character from the SOURCE.
- */
-static char inbyte( void )
-{
- char buf[10];
-
- /*
- * If polling, wait until a character is available.
- */
-
- mon_read(0, buf, 1); /* stdin is fd=0, read 1 byte */
-
- return (buf[0]);
-}
-
-/* outbyte
- *
- * This routine transmits a character out the SOURCE. It may support
- * XON/XOFF flow control.
- */
-static void outbyte(
- char ch
-)
-{
- char buf[10];
-
- /*
- * If polling, wait for the transmitter to be ready.
- * Check for flow control requests and process.
- * Then output the character.
- */
- buf[0] = ch;
-
- mon_write( 1, buf, 1 ); /* stdout is fd=1, write 1 byte */
-}
-
-/*
- * Open entry point
- */
-rtems_device_driver console_open(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * Close entry point
- */
-rtems_device_driver console_close(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * read bytes from the serial port. We only have stdin.
- */
-rtems_device_driver console_read(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- rtems_libio_rw_args_t *rw_args;
- char *buffer;
- int maximum;
- int count = 0;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- buffer[ count ] = inbyte();
- if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
- buffer[ count++ ] = '\n';
- break;
- }
- }
-
- rw_args->bytes_moved = count;
- return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
-}
-
-/*
- * write bytes to the serial port. Stdout and stderr are the same.
- */
-rtems_device_driver console_write(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- int count;
- int maximum;
- rtems_libio_rw_args_t *rw_args;
- char *buffer;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- if ( buffer[ count ] == '\n') {
- outbyte('\r');
- }
- outbyte( buffer[ count ] );
- }
-
- rw_args->bytes_moved = maximum;
- return 0;
-}
-
-/*
- * IO Control entry point
- */
-rtems_device_driver console_control(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-#include <rtems/bspIo.h>
-
-static void RBTX4925_output_char(char c) { outbyte( c ); }
-
-BSP_output_char_function_type BSP_output_char = RBTX4925_output_char;
-BSP_polling_getchar_function_type BSP_poll_char = NULL;
-
diff --git a/c/src/lib/libbsp/mips/rbtx4938/Makefile.am b/c/src/lib/libbsp/mips/rbtx4938/Makefile.am
index 6061fe10df..6af4ffc71d 100644
--- a/c/src/lib/libbsp/mips/rbtx4938/Makefile.am
+++ b/c/src/lib/libbsp/mips/rbtx4938/Makefile.am
@@ -34,7 +34,7 @@ librtemsbsp_a_SOURCES += ../shared/irq/exception.S
# clock
librtemsbsp_a_SOURCES +=../../../../../../bsps/mips/rbtx4938/clock/clockdrv.c
# console
-librtemsbsp_a_SOURCES += console/console-io.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/mips/rbtx4938/console/console-io.c
# liblnk
librtemsbsp_a_SOURCES += ../shared/liblnk/lnklib.S
librtemsbsp_a_SOURCES += ../shared/liblnk/pmon.S
diff --git a/c/src/lib/libbsp/mips/rbtx4938/console/console-io.c b/c/src/lib/libbsp/mips/rbtx4938/console/console-io.c
deleted file mode 100644
index b0dbc3b365..0000000000
--- a/c/src/lib/libbsp/mips/rbtx4938/console/console-io.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * This file contains the RBTX4938 console IO package.
- */
-
-/*
- * Author: Craig Lebakken <craigl@transition.com>
- *
- * COPYRIGHT (c) 1996 by Transition Networks Inc.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of Transition Networks not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * Transition Networks makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libbsp/no_cpu/no_bsp/console/console.c:
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <ctype.h>
-
-#include <rtems/console.h>
-#include <rtems/libio.h>
-#include <bsp.h>
-
-#include "yamon_api.h"
-
-/* PMON entry points */
-int mon_read(int fd, char *buf, int cnt); /* stdin is fd=0 */
-int mon_write(int fd, char *buf, int cnt); /* stdout is fd=1 */
-
-
-/* console_initialize
- *
- * This routine initializes the console IO driver.
- */
-rtems_device_driver console_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg
-)
-{
- rtems_status_code status;
-
- status = rtems_io_register_name(
- "/dev/console",
- major,
- (rtems_device_minor_number) 0
- );
-
- if (status != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred(status);
-
- return RTEMS_SUCCESSFUL;
-}
-
-/* inbyte
- *
- * This routine reads a character from the SOURCE.
- */
-static char inbyte( void )
-{
- char buf[10];
-
- /*
- * If polling, wait until a character is available.
- */
- while (YAMON_FUNC_GETCHAR(buf) == YAMON_FALSE);
-
- return (buf[0]);
-}
-
-/* outbyte
- *
- * This routine transmits a character out the SOURCE. It may support
- * XON/XOFF flow control.
- */
-static void outbyte(
- char ch
-)
-{
- char buf[10];
-
- /*
- * If polling, wait for the transmitter to be ready.
- * Check for flow control requests and process.
- * Then output the character.
- */
- buf[0] = ch;
-
- YAMON_FUNC_PRINT_COUNT(buf,1);
-}
-
-/*
- * Open entry point
- */
-
-rtems_device_driver console_open(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * Close entry point
- */
-rtems_device_driver console_close(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * read bytes from the serial port. We only have stdin.
- */
-rtems_device_driver console_read(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- rtems_libio_rw_args_t *rw_args;
- char *buffer;
- int maximum;
- int count = 0;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- buffer[ count ] = inbyte();
- if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
- buffer[ count++ ] = '\n';
- break;
- }
- }
-
- rw_args->bytes_moved = count;
- return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
-}
-
-/*
- * write bytes to the serial port. Stdout and stderr are the same.
- */
-rtems_device_driver console_write(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- int count;
- int maximum;
- rtems_libio_rw_args_t *rw_args;
- char *buffer;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- if ( buffer[ count ] == '\n') {
- outbyte('\r');
- }
- outbyte( buffer[ count ] );
- }
-
- rw_args->bytes_moved = maximum;
- return 0;
-}
-
-/*
- * IO Control entry point
- */
-rtems_device_driver console_control(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-#include <rtems/bspIo.h>
-
-static void RBTX4938_output_char(char c) { outbyte( c ); }
-
-BSP_output_char_function_type BSP_output_char = RBTX4938_output_char;
-BSP_polling_getchar_function_type BSP_poll_char = NULL;
-
diff --git a/c/src/lib/libbsp/mips/rbtx4938/console/yamon_api.h b/c/src/lib/libbsp/mips/rbtx4938/console/yamon_api.h
deleted file mode 100644
index 529cf16a3f..0000000000
--- a/c/src/lib/libbsp/mips/rbtx4938/console/yamon_api.h
+++ /dev/null
@@ -1,631 +0,0 @@
-/************************************************************************
- *
- * yamon_api.h
- *
- * YAMON interface definitions
- *
- * ######################################################################
- *
- * mips_start_of_legal_notice
- *
- * Copyright (c) 2003 MIPS Technologies, Inc. All rights reserved.
- *
- *
- * Unpublished rights (if any) reserved under the copyright laws of the
- * United States of America and other countries.
- *
- * This code is proprietary to MIPS Technologies, Inc. ("MIPS
- * Technologies"). Any copying, reproducing, modifying or use of this code
- * (in whole or in part) that is not expressly permitted in writing by MIPS
- * Technologies or an authorized third party is strictly prohibited. At a
- * minimum, this code is protected under unfair competition and copyright
- * laws. Violations thereof may result in criminal penalties and fines.
- *
- * MIPS Technologies reserves the right to change this code to improve
- * function, design or otherwise. MIPS Technologies does not assume any
- * liability arising out of the application or use of this code, or of any
- * error or omission in such code. Any warranties, whether express,
- * statutory, implied or otherwise, including but not limited to the implied
- * warranties of merchantability or fitness for a particular purpose, are
- * excluded. Except as expressly provided in any written license agreement
- * from MIPS Technologies or an authorized third party, the furnishing of
- * this code does not give recipient any license to any intellectual
- * property rights, including any patent rights, that cover this code.
- *
- * This code shall not be exported or transferred for the purpose of
- * reexporting in violation of any U.S. or non-U.S. regulation, treaty,
- * Executive Order, law, statute, amendment or supplement thereto.
- *
- * This code constitutes one or more of the following: commercial computer
- * software, commercial computer software documentation or other commercial
- * items. If the user of this code, or any related documentation of any
- * kind, including related technical data or manuals, is an agency,
- * department, or other entity of the United States government
- * ("Government"), the use, duplication, reproduction, release,
- * modification, disclosure, or transfer of this code, or any related
- * documentation of any kind, is restricted in accordance with Federal
- * Acquisition Regulation 12.212 for civilian agencies and Defense Federal
- * Acquisition Regulation Supplement 227.7202 for military agencies. The use
- * of this code by the Government is further restricted in accordance with
- * the terms of the license agreement(s) and/or applicable contract terms
- * and conditions covering this code from MIPS Technologies or an authorized
- * third party.
- *
- *
- * mips_end_of_legal_notice
- *
- *
- ************************************************************************/
-
-#ifndef YAMON_API_H
-#define YAMON_API_H
-
-/************************************************************************
- * Include files
- ************************************************************************/
-
-
-/************************************************************************
- * Definitions
-*************************************************************************/
-
-/* Basic types */
-
-typedef unsigned int t_yamon_uint32;
-typedef unsigned short t_yamon_uint16;
-typedef unsigned char t_yamon_uint8;
-typedef signed int t_yamon_int32;
-typedef signed short t_yamon_int16;
-typedef signed char t_yamon_int8;
-
-typedef unsigned char t_yamon_bool;
-
-#define YAMON_FALSE 0
-#define YAMON_TRUE (!YAMON_FALSE)
-
-/* YAMON Environment variable */
-typedef struct
-{
- char *name;
- char *val;
-}
-t_yamon_env_var;
-
-/* Format of application function */
-typedef t_yamon_uint32
-(*t_yamon_appl_main)(
- t_yamon_uint32 argc, /* Number of tokens in argv array */
- char **argv, /* Array of tokens (first is "go") */
- t_yamon_env_var *env, /* Array of env. variables */
- t_yamon_uint32 memsize ); /* Size of memory (byte count) */
-
-
-/* ID of YAMON configuration object */
-typedef t_yamon_uint32 t_yamon_syscon_id;
-
-
-/* Number used by the exception registration functions in order to register
- * a default ISR/ESR.
- */
-#define YAMON_DEFAULT_HANDLER 0xfffffff0
-
-/* Number used by the exception registration functions in order to register
- * an EJTAG debug exception ESR.
- */
-#define YAMON_DEFAULT_EJTAG_ESR 0xfffffff1
-
-/* Registered Interrupt Service Routine (ISR) */
-typedef void (*t_yamon_isr)(void *data);
-
-/* Registered Exception Service Routine (ESR) */
-typedef void (*t_yamon_esr)(void);
-
-/* Entry point called by ESRs wishing to pass control back to YAMON */
-typedef void (*t_yamon_retfunc)(void);
-
-/* Handle used for deregistration of ISR/ESR */
-typedef void *t_yamon_ref;
-
-
-/* YAMONE Vector table address */
-#define YAMON_FUNCTION_BASE 0x9fc00500
-
-/* YAMON Vector table offsets */
-#define YAMON_FUNC_PRINT_COUNT_OFS 0x04
-#define YAMON_FUNC_EXIT_OFS 0x20
-#define YAMON_FUNC_FLUSH_CACHE_OFS 0x2C
-#define YAMON_FUNC_PRINT_OFS 0x34
-#define YAMON_FUNC_REGISTER_CPU_ISR_OFS 0x38
-#define YAMON_FUNC_DEREGISTER_CPU_ISR_OFS 0x3c
-#define YAMON_FUNC_REGISTER_IC_ISR_OFS 0x40
-#define YAMON_FUNC_DEREGISTER_IC_ISR_OFS 0x44
-#define YAMON_FUNC_REGISTER_ESR_OFS 0x48
-#define YAMON_FUNC_DEREGISTER_ESR_OFS 0x4c
-#define YAMON_FUNC_GETCHAR_OFS 0x50
-#define YAMON_FUNC_SYSCON_READ_OFS 0x54
-
-/* Macro for accessing YAMON function */
-#define YAMON_FUNC(ofs)\
- (*(t_yamon_uint32 *)(YAMON_FUNCTION_BASE + (ofs)))
-
-
-/************************************************************************
- * Public variables
- ************************************************************************/
-
-/************************************************************************
- * Public functions
- ************************************************************************/
-
-
-/************************************************************************
- *
- * t_yamon_exit
- * Description :
- * -------------
- *
- * Exit application and return to YAMON.
- *
- * Parameters :
- * ------------
- *
- * 'rc' (OUT) : Return code
- *
- * Return values :
- * ---------------
- *
- * None (never returns)
- *
- ************************************************************************/
-typedef void
-(*t_yamon_exit)(
- t_yamon_uint32 rc ); /* Return code */
-
-#define YAMON_FUNC_EXIT( rc )\
- ((t_yamon_exit)( YAMON_FUNC(YAMON_FUNC_EXIT_OFS) ))\
- ( rc )
-
-
-/************************************************************************
- *
- * t_yamon_print
- * Description :
- * -------------
- *
- * Print null-terminated string to tty0.
- *
- * Parameters :
- * ------------
- *
- * 'port' (OUT) : Ignored, always prints to tty0. Not included in macro.
- * 's' (OUT) : String to print.
- *
- * Return values :
- * ---------------
- *
- * None
- *
- ************************************************************************/
-typedef void
-(*t_yamon_print)(
- t_yamon_uint32 port, /* Output port (not used, always tty0) */
- const char *s ); /* String to output */
-
-#define YAMON_FUNC_PRINT( s )\
- ((t_yamon_print)( YAMON_FUNC(YAMON_FUNC_PRINT_OFS) ))\
- ( 0, s )
-
-
-/************************************************************************
- *
- * t_yamon_print_count
- * Description :
- * -------------
- *
- * Print specified number of characters to tty0.
- *
- * Parameters :
- * ------------
- *
- * 'port' (OUT) : Ignored, always prints to tty0. Not included in macro.
- * 's' (OUT) : Array of characters to print.
- * 'count' (OUT) : Number of characters to print.
- *
- * Return values :
- * ---------------
- *
- * None
- *
- ************************************************************************/
-typedef void
-(*t_yamon_print_count)(
- t_yamon_uint32 port, /* Output port (not used, always tty0 */
- char *s, /* String to output */
- t_yamon_uint32 count ); /* Number of characters to output */
-
-#define YAMON_FUNC_PRINT_COUNT( s, count )\
- ((t_yamon_print_count)( YAMON_FUNC(YAMON_FUNC_PRINT_COUNT_OFS) ))\
- ( 0, s, count )
-
-
-/************************************************************************
- *
- * t_yamon_getchar
- * Description :
- * -------------
- *
- * Get character from tty0 if character is available. Function
- * returns immediately if no character is available.
- *
- * Parameters :
- * ------------
- *
- * 'port' (OUT) : Ignored, always uses tty0. Not included in macro.
- * 'ch' (OUT) : Character read (if available).
- *
- * Return values :
- * ---------------
- *
- * YAMON_TRUE if character was available, else YAMON_FALSE.
- *
- ************************************************************************/
-typedef t_yamon_bool
-(*t_yamon_getchar)(
- t_yamon_uint32 port, /* Output port (not used, always tty0 */
- char *ch ); /* Character to output */
-
-#define YAMON_FUNC_GETCHAR( ch )\
- ((t_yamon_getchar)( YAMON_FUNC(YAMON_FUNC_GETCHAR_OFS) ))\
- ( 0, ch )
-
-
-/************************************************************************
- *
- * t_yamon_syscon_read
- * Description :
- * -------------
- *
- * Read the value of system configuration object given by 'id'.
- *
- * See syscon_api.h in YAMON source distribution for further details
- * on object IDs and error codes.
- *
- * Parameters :
- * ------------
- *
- * 'id' (IN) : Object id.
- * 'param' (INOUT) : Buffer for object value.
- * 'size' (IN) : Size of buffer (must match size of object).
- *
- * Return values :
- * ---------------
- *
- * 0 : Returned parameter is valid.
- * Other values indicate error.
- *
- ************************************************************************/
-typedef t_yamon_int32
-(*t_yamon_syscon_read)(
- t_yamon_syscon_id id, /* Object ID */
- void *param, /* Buffer for object value */
- t_yamon_uint32 size); /* Buffer size (bytes) */
-
-#define YAMON_FUNC_SYSCON_READ( id, param, size )\
- ((t_yamon_syscon_read)( YAMON_FUNC(YAMON_FUNC_SYSCON_READ_OFS) ))\
- ( id, param, size )
-
-
-/************************************************************************
- *
- * t_yamon_flush_cache
- * Description :
- * -------------
- *
- * Flush I-or D-cache
- *
- * Function performs "writeback and invalidate" operations on D-cache
- * lines and "invalidate" operations on I-cache lines.
- *
- * Parameters :
- * ------------
- *
- * 'type' (IN) : Cache to be flushed.
- *
- * Return values :
- * ---------------
- *
- * None
- *
- ************************************************************************/
-typedef void
-(*t_yamon_flush_cache)(
-#define YAMON_FLUSH_ICACHE 0
-#define YAMON_FLUSH_DCACHE 1
- t_yamon_uint32 type ); /* I- or D-cache indication */
-
-#define YAMON_FUNC_FLUSH_CACHE( type )\
- ((t_yamon_flush_cache)( YAMON_FUNC(YAMON_FUNC_FLUSH_CACHE_OFS) ))\
- ( type )
-
-
-/************************************************************************
- *
- * t_yamon_register_esr
- * Description :
- * -------------
- *
- * Registers an exception handler, also known as an "Exception Service
- * Routine" (ESR) for the specified exception.
- *
- * Two special exception IDs are defined :
- * YAMON_DEFAULT_HANDLER used for a default ESR.
- * YAMON_DEFAULT_EJTAG_ESR used for EJTAG exceptions.
- *
- * The default ESR is called if no other ESR is registered
- * for an exception. If no default ESR is registered, a static
- * (i.e. not registered) "super default" function is invoked.
- * This function prints out the registers and halts.
- *
- * Deregistration of an ESR may be be done by calling this function
- * with 'esr' set to NULL.
- * An ESR can also be deregistered using the 'yamon_deregister_esr'
- * function.
- *
- * An ESR may be registered even if a previously registered
- * ESR has not been deregistered. In this case the previously
- * registered ESR is lost.
- *
- * The ESR will get called with registers in the state they were
- * when the exception occurred. This includes all CP0 registers and
- * CPU registers $0..$31, except for k0,k1 ($26,$27).
- *
- * In case an ESR does not want to handle the exception, it may
- * call the return function passed in the 'retfunc' parameter.
- *
- * Case 1 : 'retfunc' called by ESR registered for the
- * INTERRUPT exception.
- *
- * We assume an application has registered this ESR and wants
- * YAMON to process the (remaining) interrupts.
- *
- * Case 2 : 'retfunc' called by an ESR registered for a specific
- * exception (not INTERRUPT).
- *
- * Default handling will be done.
- *
- * Case 3 : 'retfunc' is called by the ESR registered as default ESR.
- *
- * The exception will be handled as though no ESR is registered
- * (i.e. the "super default" function is called).
- *
- * Parameters :
- * ------------
- *
- * 'exception' (IN) : Exception code
- * or YAMON_DEFAULT_HANDLER for a default ESR
- * or YAMON_DEFAULT_EJTAG_ESR for ejtag exceptions.
- * 'esr' (IN) : Function pointer for ESR.
- * 'ref' (OUT) : Handle used for deregistration of ESR.
- * 'retfunc' (OUT) : Pointer to function pointer for the return
- * function described above.
- *
- * Return values :
- * ---------------
- *
- * 0 : Registration went well.
- * Other values indicate error.
- *
- ************************************************************************/
-typedef t_yamon_int32
-(*t_yamon_register_esr)(
- t_yamon_uint32 exception, /* Exception identification */
- t_yamon_esr esr, /* ESR to be registered */
- t_yamon_ref *ref, /* Handle for deregistration */
- t_yamon_retfunc *retfunc ); /* Return function */
-
-#define YAMON_FUNC_REGISTER_ESR( exc, esr, ref, retfunc )\
- ((t_yamon_register_esr)( YAMON_FUNC(YAMON_FUNC_REGISTER_ESR_OFS) ))\
- ( exc, esr, ref, retfunc )
-
-
-/************************************************************************
- *
- * t_yamon_deregister_esr
- * Description :
- * -------------
- *
- * Deregisters ESR..
- *
- * Parameters :
- * ------------
- *
- * 'ref' (IN) : Handle obtained when calling 'yamon_register_esr'.
- *
- * Return values :
- * ---------------
- *
- * 0 : Deregistration went well.
- * Other values indicate error.
- *
- ************************************************************************/
-typedef t_yamon_int32
-(*t_yamon_deregister_esr)(
- t_yamon_ref ref ); /* Handle for deregistration */
-
-#define YAMON_FUNC_DEREGISTER_ESR( ref )\
- ((t_yamon_deregister_esr)( YAMON_FUNC(YAMON_FUNC_DEREGISTER_ESR_OFS) ))\
- ( ref )
-
-
-/************************************************************************
- *
- * t_yamon_register_cpu_isr
- * Description :
- * -------------
- *
- * Registers an Interrupt Service Routine (ISR) for the specified
- * CPU interrupt.
- * The highest service priority is attached to HW-INT5, which is
- * connected to the CPU-built-in CP0-timer. SW_INT0 gets the lowest
- * service priority. During registration, the interrupt mask field
- * in the CPU CP0-status register is updated to enable interrupts
- * from the specified interrupt source.
- *
- * A special ID is defined :
- * YAMON_DEFAULT_HANDLER used for a default ISR.
- *
- * The default ISR is called if no other ISR is registered
- * for a CPU interrupt.
- *
- * Deregistration of the default ISR may be done by calling
- * this function with 'isr' set to NULL.
- * Also, a new default ISR may be registered even if a
- * previously registered ISR has not been deregistered.
- * ISRs for specific CPU interrupts must be deregistered using
- * 'yamon_deregister_cpu_isr'.
- *
- * Parameters :
- * ------------
- *
- * 'cpu_int' (IN) : CPU interrupt (0..7)
- * or YAMON_DEFAULT_HANDLER for a default ISR.
- * 'isr' (IN) : Function pointer for ISR.
- * 'data' (IN) : Data pointer (may be NULL). Will be passed to
- * ISR when called.
- * 'ref' (OUT) : Handle used for deregistration of ISR.
- *
- * Return values :
- * ---------------
- *
- * 0 : Registration went well.
- * Other values indicate error.
- *
- ************************************************************************/
-typedef t_yamon_int32
-(*t_yamon_register_cpu_isr)(
- t_yamon_uint32 cpu_int, /* CPU interrupt (0..7) */
- t_yamon_isr isr, /* ISR to be registered */
- void *data, /* Data reference to be registered */
- t_yamon_ref *ref ); /* Handle for deregistration */
-
-#define YAMON_FUNC_REGISTER_CPU_ISR( cpu_int, isr, data, ref )\
- ((t_yamon_register_cpu_isr)( YAMON_FUNC(YAMON_FUNC_REGISTER_CPU_ISR_OFS) ))\
- ( cpu_int, isr, data, ref )
-
-
-/************************************************************************
- *
- * t_yamon_deregister_cpu_isr
- * Description :
- * -------------
- *
- * Deregisters ISR for CPU interrupt.
- *
- * Parameters :
- * ------------
- *
- * 'ref' (IN) : Handle obtained when calling 'yamon_register_cpu_isr'.
- *
- * Return values :
- * ---------------
- *
- * 0 : Deregistration went well.
- * Other values indicate error
- *
- ************************************************************************/
-typedef t_yamon_int32
-(*t_yamon_deregister_cpu_isr)(
- t_yamon_ref ref ); /* Handle for deregistration */
-
-#define YAMON_FUNC_DEREGISTER_CPU_ISR( ref )\
- ((t_yamon_deregister_cpu_isr)( YAMON_FUNC(YAMON_FUNC_DEREGISTER_CPU_ISR_OFS) ))\
- ( ref )
-
-
-/************************************************************************
- *
- * t_yamon_register_ic_isr
- * Description :
- * -------------
- *
- * Registers an Interrupt Service Routine (ISR) for the specified
- * source in the interrupt controller.
- *
- * A special ID is defined :
- * YAMON_DEFAULT_HANDLER used for a default ISR.
- *
- * The default ISR is called if no other ISR is registered
- * for an interrupt.
- *
- * Deregistration of the default ISR may be done by calling
- * this function with 'isr' set to NULL.
- * Also, a new default ISR may be registered even if a
- * previously registered ISR has not been deregistered.
- * ISRs for specific interrupts must be deregistered using
- * 'yamon_deregister_ic_isr'.
- *
- * Parameters :
- * ------------
- *
- * 'ic_line' (IN) : Interrupt source line in Int. Controller
- * or YAMON_DEFAULT_HANDLER for a default ISR.
- * 'isr', (IN) : Function pointer for user defined ISR.
- * 'data' (IN) : Data pointer (may be NULL). Will be passed to
- * ISR when called.
- * 'ref', (OUT) : Handle used for deregistration of ISR.
- *
- * Return values :
- * ---------------
- *
- * 0 : Registration went well.
- * Other values indicate error.
- *
- ************************************************************************/
-typedef t_yamon_int32
-(*t_yamon_register_ic_isr)(
- t_yamon_uint32 ic_line, /* Interrupt controller line */
- t_yamon_isr isr, /* ISR to be registered */
- void *data, /* Data reference to be registered */
- t_yamon_ref *ref ); /* Handle for deregistration */
-
-#define YAMON_FUNC_REGISTER_IC_ISR( ic_line, isr, data, ref )\
- ((t_yamon_register_ic_isr)( YAMON_FUNC(YAMON_FUNC_REGISTER_IC_ISR_OFS) ))\
- ( ic_line, isr, data, ref )
-
-
-/************************************************************************
- *
- * t_yamon_deregister_ic_isr
- * Description :
- * -------------
- *
- * Deregisters ISR for source in interrupt controller.
- *
- * Parameters :
- * ------------
- *
- * 'ref' (IN) : Handle obtained when calling 'yamon_register_ic_isr'.
- *
- * Return values :
- * ---------------
- *
- * 0 : Deregistration went well.
- * Other values indicate error
- *
- ************************************************************************/
-typedef t_yamon_int32
-(*t_yamon_deregister_ic_isr)(
- t_yamon_ref ref ); /* Handle for deregistration */
-
-#define YAMON_FUNC_DEREGISTER_IC_ISR( ref )\
- ((t_yamon_deregister_ic_isr)( YAMON_FUNC(YAMON_FUNC_DEREGISTER_IC_ISR_OFS) ))\
- ( ref )
-
-
-#endif /* #ifndef YAMON_API_H */
-
-
-
-
-
-