summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2012-03-30 08:41:15 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2012-03-30 08:41:15 -0500
commit0b095f767353aa0e77c31e9791ffbe0b843337bd (patch)
tree392daa368770a81eba273a77998ac1affc84fc92 /c/src/lib/libbsp
parentAddress Conflicts: (diff)
parentResolve link problems with psim irq-server (diff)
downloadrtems-0b095f767353aa0e77c31e9791ffbe0b843337bd.tar.bz2
Resolve link problems with psim irq-server
Add IRQ support components needed by new BSD code.
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/i386/pc386/Makefile.am122
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/exar17d15x.c224
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/exar17d15x.h54
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/rtd316.c108
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/rtd316.h56
-rw-r--r--c/src/lib/libbsp/i386/pc386/preinstall.am8
-rw-r--r--c/src/lib/libbsp/powerpc/psim/Makefile.am5
-rw-r--r--c/src/lib/libbsp/powerpc/psim/irq/irq_init.c31
-rw-r--r--c/src/lib/libbsp/powerpc/psim/preinstall.am4
-rw-r--r--c/src/lib/libbsp/powerpc/psim/startup/linkcmds3
-rw-r--r--c/src/lib/libbsp/sparc/leon3/clock/ckinit.c8
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/leon.h64
12 files changed, 578 insertions, 109 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am b/c/src/lib/libbsp/i386/pc386/Makefile.am
index 73bc199dc1..580e3b2f1e 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -25,10 +25,13 @@ noinst_PROGRAMS =
SUBDIRS = . tools
-include_bsp_HEADERS = ../../i386/shared/irq/irq.h \
- ../../i386/shared/irq/irq_asm.h ../../i386/shared/comm/tty_drv.h \
- ../../shared/include/irq-generic.h \
- ../../shared/include/irq-info.h
+include_bsp_HEADERS = ../../i386/shared/irq/irq.h
+include_bsp_HEADERS += ../../i386/shared/irq/irq_asm.h
+include_bsp_HEADERS += ../../i386/shared/comm/tty_drv.h
+include_bsp_HEADERS += ../../shared/include/irq-generic.h
+include_bsp_HEADERS += ../../shared/include/irq-info.h
+include_bsp_HEADERS += console/rtd316.h
+include_bsp_HEADERS += console/exar17d15x.h
if HAS_SMP
include_bsp_HEADERS += ../../i386/shared/irq/apic.h
@@ -63,30 +66,49 @@ noinst_LIBRARIES += libbsp.a
libbsp_a_SOURCES =
# clock
-libbsp_a_SOURCES += clock/ckinit.c clock/todcfg.c ../../shared/tod.c
+libbsp_a_SOURCES += clock/ckinit.c
+libbsp_a_SOURCES += clock/todcfg.c
+libbsp_a_SOURCES += ../../shared/tod.c
libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
include_rtemsdir = $(includedir)/rtems
-include_rtems_HEADERS = console/keyboard.h console/kd.h console/ps2_drv.h \
- ../../shared/console_private.h console/vgacons.h
+include_rtems_HEADERS = console/keyboard.h
+include_rtems_HEADERS += console/kd.h
+include_rtems_HEADERS += console/ps2_drv.h
+include_rtems_HEADERS += ../../shared/console_private.h
+include_rtems_HEADERS += console/vgacons.h
include_HEADERS += ../../i386/shared/comm/i386_io.h
# console
-libbsp_a_SOURCES += console/inch.c console/outch.c \
- console/defkeymap.c console/fb_vga.c console/keyboard.c \
- console/pc_keyb.c console/ps2_mouse.c \
- console/vgainit.c console/vt.c console/videoAsm.S \
- console/kbd_parser.c console/serial_mouse_config.c \
- ../../i386/shared/comm/uart.c ../../i386/shared/comm/tty_drv.c \
- ../../shared/console.c console/console_select.c \
- ../../shared/console_read.c ../../shared/console_write.c \
- console/console_control.c console/conscfg.c console/printk_support.c \
- console/vgacons.c
+libbsp_a_SOURCES += console/inch.c
+libbsp_a_SOURCES += console/outch.c
+libbsp_a_SOURCES += console/defkeymap.c
+libbsp_a_SOURCES += console/fb_vga.c
+libbsp_a_SOURCES += console/keyboard.c
+libbsp_a_SOURCES += console/pc_keyb.c
+libbsp_a_SOURCES += console/ps2_mouse.c
+libbsp_a_SOURCES += console/vgainit.c
+libbsp_a_SOURCES += console/vt.c
+libbsp_a_SOURCES += console/videoAsm.S
+libbsp_a_SOURCES += console/kbd_parser.c
+libbsp_a_SOURCES += console/serial_mouse_config.c
+libbsp_a_SOURCES += ../../i386/shared/comm/uart.c
+libbsp_a_SOURCES += ../../i386/shared/comm/tty_drv.c
+libbsp_a_SOURCES += ../../shared/console.c
+libbsp_a_SOURCES += console/console_select.c
+libbsp_a_SOURCES += ../../shared/console_read.c
+libbsp_a_SOURCES += ../../shared/console_write.c
+libbsp_a_SOURCES += console/console_control.c
+libbsp_a_SOURCES += console/conscfg.c
+libbsp_a_SOURCES += console/printk_support.c
+libbsp_a_SOURCES += console/vgacons.c
+libbsp_a_SOURCES += console/exar17d15x.c
+libbsp_a_SOURCES += console/rtd316.c
# gdb
-libbsp_a_SOURCES += ../../i386/shared/comm/i386-stub.c \
- ../../i386/shared/comm/i386-stub-glue.c \
- ../../i386/shared/comm/gdb_glue.c
+libbsp_a_SOURCES += ../../i386/shared/comm/i386-stub.c
+libbsp_a_SOURCES += ../../i386/shared/comm/i386-stub-glue.c
+libbsp_a_SOURCES += ../../i386/shared/comm/gdb_glue.c
# gnat
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
@@ -98,19 +120,29 @@ libbsp_a_SOURCES += ../../i386/shared/pci/pcibios.c \
include_HEADERS += ../../i386/shared/comm/uart.h
# startup
-libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
- ../../shared/bsppredriverhook.c startup/bspgetworkarea.c \
- ../../shared/bsppretaskinghook.c startup/bspstart.c startup/bspcmdline.c \
- ../../shared/bspclean.c startup/bspreset.c ../../i386/shared/irq/idt.c \
- ../../i386/shared/irq/irq.c ../../i386/shared/irq/irq_init.c \
- ../../shared/bootcard.c ../../shared/bspinit.c ../../shared/sbrk.c \
- startup/ldsegs.S ../../i386/shared/irq/irq_asm.S \
- ../../shared/src/irq-default-handler.c \
- ../../shared/src/irq-generic.c \
- ../../shared/src/irq-legacy.c \
- ../../shared/src/irq-info.c \
- ../../shared/src/irq-shell.c \
- ../../shared/src/irq-server.c
+libbsp_a_SOURCES += ../../shared/bsplibc.c
+libbsp_a_SOURCES += ../../shared/bsppost.c
+libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
+libbsp_a_SOURCES += startup/bspgetworkarea.c
+libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
+libbsp_a_SOURCES += startup/bspstart.c
+libbsp_a_SOURCES += startup/bspcmdline.c
+libbsp_a_SOURCES += ../../shared/bspclean.c
+libbsp_a_SOURCES += startup/bspreset.c
+libbsp_a_SOURCES += ../../i386/shared/irq/idt.c
+libbsp_a_SOURCES += ../../i386/shared/irq/irq.c
+libbsp_a_SOURCES += ../../i386/shared/irq/irq_init.c
+libbsp_a_SOURCES += ../../shared/bootcard.c
+libbsp_a_SOURCES += ../../shared/bspinit.c
+libbsp_a_SOURCES += ../../shared/sbrk.c
+libbsp_a_SOURCES += startup/ldsegs.S
+libbsp_a_SOURCES += ../../i386/shared/irq/irq_asm.S
+libbsp_a_SOURCES += ../../shared/src/irq-default-handler.c
+libbsp_a_SOURCES += ../../shared/src/irq-generic.c
+libbsp_a_SOURCES += ../../shared/src/irq-legacy.c
+libbsp_a_SOURCES += ../../shared/src/irq-info.c
+libbsp_a_SOURCES += ../../shared/src/irq-shell.c
+libbsp_a_SOURCES += ../../shared/src/irq-server.c
# timer
libbsp_a_SOURCES += timer/timer.c timer/timerisr.S
@@ -149,7 +181,8 @@ include_HEADERS += include/wd80x3.h
wd8003_CPPFLAGS = -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
noinst_PROGRAMS += wd8003.rel
-wd8003_rel_SOURCES = wd8003/wd8003.c include/wd80x3.h
+wd8003_rel_SOURCES = wd8003/wd8003.c
+wd8003_rel_SOURCES += include/wd80x3.h
wd8003_rel_CPPFLAGS = $(AM_CPPFLAGS) $(wd8003_CPPFLAGS)
wd8003_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
@@ -157,14 +190,17 @@ endif
if HAS_NETWORKING
3c509_CPPFLAGS = -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
noinst_PROGRAMS += 3c509.rel
-3c509_rel_SOURCES = 3c509/3c509.c 3c509/3c509.h 3c509/elink.c 3c509/elink.h
+3c509_rel_SOURCES = 3c509/3c509.c
+3c509_rel_SOURCES += 3c509/3c509.h
+3c509_rel_SOURCES += 3c509/elink.c
+3c509_rel_SOURCES += 3c509/elink.h
3c509_rel_CPPFLAGS = $(AM_CPPFLAGS) $(3c509_CPPFLAGS)
3c509_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
-libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel \
- ../../../libcpu/@RTEMS_CPU@/page.rel \
- ../../../libcpu/@RTEMS_CPU@/score.rel
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel
+libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/page.rel
+libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/score.rel
if HAS_SMP
libbsp_a_LIBADD += appstart.$(OBJEXT)
@@ -173,10 +209,16 @@ endif
# We only build the Network library if HAS_NETWORKING was defined
# dec21140 is supported via libchip
if HAS_NETWORKING
-libbsp_a_LIBADD += ne2000.rel wd8003.rel 3c509.rel
+libbsp_a_LIBADD += ne2000.rel
+libbsp_a_LIBADD += wd8003.rel
+libbsp_a_LIBADD += 3c509.rel
endif
-EXTRA_DIST += HOWTO README.dec21140 STATUS times_i486dx times_p5
+EXTRA_DIST += HOWTO
+EXTRA_DIST += README.dec21140
+EXTRA_DIST += STATUS
+EXTRA_DIST += times_i486dx
+EXTRA_DIST += times_p5
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/i386/pc386/console/exar17d15x.c b/c/src/lib/libbsp/i386/pc386/console/exar17d15x.c
new file mode 100644
index 0000000000..95ba3c13d0
--- /dev/null
+++ b/c/src/lib/libbsp/i386/pc386/console/exar17d15x.c
@@ -0,0 +1,224 @@
+/**
+ * @file
+ *
+ * @brief Driver for Exar XR17D15x Multiport UARTs
+ *
+ * This driver supports 2, 4 or 8 port Exar parts which are NS16550
+ * compatible.
+ */
+
+/*
+ * 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.com/license/LICENSE.
+ */
+
+#include <bsp.h>
+#include <termios.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <rtems/termiostypes.h>
+#include <libchip/serial.h>
+#include <libchip/ns16550.h>
+#include <rtems/bspIo.h>
+#include <rtems/pci.h>
+#include <bsp/exar17d15x.h>
+#include "../../../shared/console_private.h"
+
+#define MAX_BOARDS 4
+
+/*
+ * This is the rate for the clock internal to the parts.
+ */
+#define EXAR_CLOCK_RATE (921600*16)
+
+/*
+ * Supported PCI Ids
+ */
+#define PCI_VENDOR_ID_EXAR 0x13A8
+#define PCI_VENDOR_ID_EXAR_XR17D158 0x0158
+#define PCI_VENDOR_ID_EXAR_XR17D154 0x0154
+#define PCI_VENDOR_ID_EXAR_XR17D152 0x0152
+
+/*
+ * Structure to manage each instance found.
+ */
+typedef struct {
+ uint16_t vendor;
+ uint16_t device;
+ uint8_t ports;
+} exar_parts_t;
+
+static exar_parts_t Supported[] = {
+ { PCI_VENDOR_ID_EXAR, PCI_VENDOR_ID_EXAR_XR17D158, 8 },
+ { PCI_VENDOR_ID_EXAR, PCI_VENDOR_ID_EXAR_XR17D154, 4 },
+ { PCI_VENDOR_ID_EXAR, PCI_VENDOR_ID_EXAR_XR17D152, 2 },
+ { 0, 0, 0 }
+};
+
+/*
+ * Information saved from PCI scan
+ */
+typedef struct {
+ bool found;
+ uint32_t base;
+ uint8_t irq;
+ uint8_t bus;
+ uint8_t slot;
+ uint8_t ports;
+} exar17d15x_conf_t;
+
+/*
+ * Register Access Routines
+ */
+static uint8_t xr17d15x_get_register(uint32_t addr, uint8_t i)
+{
+ uint8_t val = 0;
+ volatile uint8_t *reg = (volatile uint8_t *)(addr + i);
+
+ val = *reg;
+ // printk( "RD %p -> 0x%02x\n", reg, val );
+ return val;
+}
+
+static void xr17d15x_set_register(uint32_t addr, uint8_t i, uint8_t val)
+{
+ volatile uint8_t *reg = (volatile uint8_t *)(addr + i);
+
+ // printk( "WR %p <- 0x%02x\n", reg, val );
+ *reg = val;
+}
+
+rtems_device_driver exar17d15x_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor_arg,
+ void *arg
+)
+{
+ // int pbus, pdev, pfun;
+ exar17d15x_conf_t conf[MAX_BOARDS];
+ int boards = 0;
+ int b = 0;
+ int p;
+ console_tbl *ports;
+ console_tbl *port_p;
+ int pbus;
+ int pdev;
+ int pfun;
+ int status;
+ int instance;
+ int i;
+ int total_ports = 0;
+
+ for ( b=0 ; b<MAX_BOARDS ; b++ ) {
+ conf[b].found = false;
+ }
+
+ /*
+ * Scan for Serial port boards
+ *
+ * NOTE: There appear to be Exar parts with 2 and 4 ports which would
+ * be easy to support. Just change the hard-coded 8 ports per
+ * board to variable and adjust.
+ *
+ * NOTE: There are likely other board vendors which could be supported
+ * by this.
+ */
+ for ( instance=0 ; instance < MAX_BOARDS ; instance++ ) {
+
+ for ( i=0 ; Supported[i].ports != 0 ; i++ ) {
+ status = pci_find_device(
+ Supported[i].vendor,
+ Supported[i].device,
+ instance,
+ &pbus,
+ &pdev,
+ &pfun
+ );
+ if ( status == PCIB_ERR_SUCCESS ) {
+ boards++;
+ conf[instance].found = true;
+ conf[instance].ports = Supported[i].ports;
+ total_ports += conf[instance].ports;
+ break;
+ }
+ }
+
+ if ( status != PCIB_ERR_SUCCESS )
+ continue;
+
+ pci_read_config_byte(
+ pbus,
+ pdev,
+ pfun,
+ PCI_INTERRUPT_LINE,
+ &conf[instance].irq
+ );
+ pci_read_config_dword(
+ pbus,
+ pdev,
+ pfun,
+ PCI_BASE_ADDRESS_0,
+ &conf[instance].base
+ );
+ printk(
+ "Found Exar 17D15x %d at 0x%08x IRQ %d with %d ports\n",
+ instance,
+ conf[instance].base,
+ conf[instance].irq,
+ conf[instance].ports
+ );
+ }
+
+ /*
+ * Now allocate array of device structures and fill them in
+ */
+ ports = calloc( total_ports, sizeof( console_tbl ) );
+ port_p = ports;
+ for ( b=0 ; b<MAX_BOARDS ; b++ ) {
+ if ( conf[b].found == false )
+ continue;
+ for ( p=0 ; p<conf[b].ports ; p++ ) {
+ char name[32];
+
+ sprintf( name, "/dev/exar17d15x_%d_%d", b, p );
+ //printk("Found %s\n", name );
+ port_p->sDeviceName = strdup( name );
+ port_p->deviceType = SERIAL_NS16550;
+ #if 1
+ port_p->pDeviceFns = &ns16550_fns_polled;
+ #else
+ port_p->pDeviceFns = &ns16550_fns;
+ #endif
+
+ port_p->deviceProbe = NULL;
+ port_p->pDeviceFlow = NULL;
+ port_p->ulMargin = 16;
+ port_p->ulHysteresis = 8;
+ port_p->pDeviceParams = (void *) 9600;
+ port_p->ulCtrlPort1 = conf[b].base + (p * 0x0200);
+ port_p->ulCtrlPort2 = 0; /* NA */
+ port_p->ulDataPort = 0; /* NA */
+ port_p->getRegister = xr17d15x_get_register;
+ port_p->setRegister = xr17d15x_set_register;
+ port_p->getData = NULL; /* NA */
+ port_p->setData = NULL; /* NA */
+ port_p->ulClock = EXAR_CLOCK_RATE;
+ port_p->ulIntVector = conf[b].irq;
+
+ port_p++;
+ } /* end ports */
+ } /* end boards */
+
+ /*
+ * Register the devices
+ */
+ if ( boards )
+ console_register_devices( ports, total_ports );
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/i386/pc386/console/exar17d15x.h b/c/src/lib/libbsp/i386/pc386/console/exar17d15x.h
new file mode 100644
index 0000000000..40922e9c3b
--- /dev/null
+++ b/c/src/lib/libbsp/i386/pc386/console/exar17d15x.h
@@ -0,0 +1,54 @@
+/**
+ * @file bsp/exar17d15x.h
+ *
+ * This file provides the interface to the Exar Multiport
+ * PCI UART controller.
+ */
+
+/*
+ * 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.com/license/LICENSE.
+ */
+
+#ifndef _BSP_EXAR17D15X__h
+#define _BSP_EXAR17D15X__h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This macro defines the standard device driver table entry for
+ * a console device driver.
+ */
+#define EXAR17D15X_DRIVER_TABLE_ENTRY \
+ { exar17d15x_initialize, NULL, NULL, NULL, NULL, NULL }
+
+/**
+ * @brief Exar 17D15x Initialization Entry Point
+ *
+ * This method initializes the Exar XR17D15x device driver.
+ *
+ * @param[in] major is the device driver major number
+ * @param[in] minor is the device driver minor number
+ * @param[in] arg is the parameters to this call
+ *
+ * @return This method returns RTEMS_SUCCESSFUL when
+ * the device driver is successfully initialized.
+ */
+rtems_device_driver exar17d15x_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/i386/pc386/console/rtd316.c b/c/src/lib/libbsp/i386/pc386/console/rtd316.c
new file mode 100644
index 0000000000..4abffb7aa1
--- /dev/null
+++ b/c/src/lib/libbsp/i386/pc386/console/rtd316.c
@@ -0,0 +1,108 @@
+/**
+ * @file
+ *
+ * @brief Driver for RTD316 ISA SCC Board
+ *
+ * The RTD316 has a single Z85C30.
+ */
+
+/*
+ * 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.com/license/LICENSE.
+ */
+
+#include <bsp.h>
+#include <termios.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <rtems/termiostypes.h>
+#include <libchip/serial.h>
+#include <libchip/z85c30.h>
+#include <rtems/bspIo.h>
+#include <bsp/rtd316.h>
+#include <rtems/score/i386.h>
+
+#define RTD_CLOCK_RATE (460800 * 32)
+
+uint8_t rtd316_com_get_register(uint32_t addr, uint8_t reg)
+{
+ register uint8_t val = 0;
+
+ outport_byte( addr, reg );
+ /* It appears the no delay is needed between the accesses. */
+ inport_byte( addr, val );
+
+ return val;
+}
+
+void rtd316_com_set_register(uint32_t addr,uint8_t reg, uint8_t val)
+{
+ outport_byte( addr, reg );
+ /* It appears the no delay is needed between the accesses. */
+ outport_byte( addr, val );
+}
+
+rtems_device_driver rtd316_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor_arg,
+ void *arg
+)
+{
+ int p;
+ console_tbl *ports;
+ console_tbl *port_p;
+
+ /*
+ * Now allocate array of device structures and fill them in
+ */
+ ports = calloc( 2, sizeof( console_tbl ) );
+ port_p = ports;
+
+ for ( p=0 ; p<2 ; p++ ) {
+ char name[32];
+ sprintf( name, "/dev/rtd316_1_%d", p );
+ printk("Found %s\n", name );
+ port_p->sDeviceName = strdup( name );
+ port_p->deviceType = SERIAL_Z85C30;
+ #if 0
+ port_p->pDeviceFns = &z85c30_fns_polled;
+ #else
+ port_p->pDeviceFns = &z85c30_fns;
+ #endif
+
+ port_p->deviceProbe = NULL;
+ port_p->pDeviceFlow = NULL;
+ port_p->ulMargin = 16;
+ port_p->ulHysteresis = 8;
+ port_p->pDeviceParams = (void *) 9600;
+ port_p->getRegister = rtd316_com_get_register;
+ port_p->setRegister = rtd316_com_set_register;
+ port_p->getData = NULL;
+ port_p->setData = NULL;
+ port_p->ulClock = RTD_CLOCK_RATE;
+ port_p->ulIntVector = 9;
+
+ if ( p==0 ) {
+ port_p->ulDataPort = 0;
+ port_p->ulCtrlPort1 = 0x340;
+ port_p->ulCtrlPort2 = 0x341;
+ } else {
+ port_p->ulDataPort = 1;
+ port_p->ulCtrlPort1 = 0x342;
+ port_p->ulCtrlPort2 = 0x343;
+ }
+ port_p++;
+ } /* end ports */
+
+ /*
+ * Register the devices
+ */
+ console_register_devices( ports, 2 );
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/i386/pc386/console/rtd316.h b/c/src/lib/libbsp/i386/pc386/console/rtd316.h
new file mode 100644
index 0000000000..a88d001ce5
--- /dev/null
+++ b/c/src/lib/libbsp/i386/pc386/console/rtd316.h
@@ -0,0 +1,56 @@
+/**
+ * @file bsp/rtd316.h
+ *
+ * @brief RTD316 Driver Interface Definition
+ *
+ * This file provides the interface to the RTD316 Dual
+ * serial port utility module.
+ */
+
+/*
+ * 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.com/license/LICENSE.
+ */
+
+#ifndef _BSP_RTD_316_h
+#define _BSP_RTD_316_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This macro defines the standard device driver table entry for
+ * a console device driver.
+ */
+#define RTD316_DRIVER_TABLE_ENTRY \
+ { rtd316_initialize, NULL, NULL, NULL, NULL, NULL }
+
+/**
+ * @brief RTD316 Initialization Entry Point
+ *
+ * This method initializes the RTD316 device driver.
+ *
+ * @param[in] major is the device driver major number
+ * @param[in] minor is the device driver minor number
+ * @param[in] arg is the parameters to this call
+ *
+ * @return This method returns RTEMS_SUCCESSFUL when
+ * the device driver is successfully initialized.
+ */
+rtems_device_driver rtd316_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/i386/pc386/preinstall.am b/c/src/lib/libbsp/i386/pc386/preinstall.am
index 9a2cbc0ffc..5b592f48eb 100644
--- a/c/src/lib/libbsp/i386/pc386/preinstall.am
+++ b/c/src/lib/libbsp/i386/pc386/preinstall.am
@@ -73,6 +73,14 @@ $(PROJECT_INCLUDE)/bsp/irq-info.h: ../../shared/include/irq-info.h $(PROJECT_INC
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-info.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-info.h
+$(PROJECT_INCLUDE)/bsp/rtd316.h: console/rtd316.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/rtd316.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/rtd316.h
+
+$(PROJECT_INCLUDE)/bsp/exar17d15x.h: console/exar17d15x.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/exar17d15x.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/exar17d15x.h
+
if HAS_SMP
$(PROJECT_INCLUDE)/bsp/apic.h: ../../i386/shared/irq/apic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/apic.h
diff --git a/c/src/lib/libbsp/powerpc/psim/Makefile.am b/c/src/lib/libbsp/powerpc/psim/Makefile.am
index c33eecbe6a..c02edb90a8 100644
--- a/c/src/lib/libbsp/powerpc/psim/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/psim/Makefile.am
@@ -50,8 +50,9 @@ libbsp_a_SOURCES += console/console-io.c console/consupp.S
# irq
include_bsp_HEADERS = irq/irq.h ../shared/openpic/openpic.h \
../../shared/include/irq-generic.h
-libbsp_a_SOURCES += irq/irq_init.c ../shared/irq/openpic_i8259_irq.c ../shared/openpic/openpic.c \
- ../../shared/src/irq-server.c
+libbsp_a_SOURCES += irq/irq_init.c ../shared/irq/openpic_i8259_irq.c \
+ ../shared/openpic/openpic.c ../../shared/src/irq-server.c \
+ ../../shared/src/irq-generic.c ../../shared/src/irq-default-handler.c
EXTRA_DIST = vectors/README
# vectors
diff --git a/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c b/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c
index 91f18f1dfe..9068a7248c 100644
--- a/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c
+++ b/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c
@@ -89,3 +89,34 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
printk("RTEMS IRQ management is now operationnal\n");
#endif
}
+
+int psim_exception_handler( BSP_Exception_frame *frame, unsigned exception_number)
+{
+ BSP_panic("Unexpected interrupt occured");
+ return 0;
+}
+
+/*
+ * functions to enable/disable a source at the ipic
+ */
+rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
+{
+ /* FIXME: do something */
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
+{
+ /* FIXME: do something */
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+ /* Install exception handler */
+ if (ppc_exc_set_handler( ASM_EXT_VECTOR, psim_exception_handler)) {
+ return RTEMS_IO_ERROR;
+ }
+
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/powerpc/psim/preinstall.am b/c/src/lib/libbsp/powerpc/psim/preinstall.am
index 92de148f02..c046ab6463 100644
--- a/c/src/lib/libbsp/powerpc/psim/preinstall.am
+++ b/c/src/lib/libbsp/powerpc/psim/preinstall.am
@@ -81,6 +81,10 @@ $(PROJECT_INCLUDE)/bsp/openpic.h: ../shared/openpic/openpic.h $(PROJECT_INCLUDE)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/openpic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/openpic.h
+$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
+
$(PROJECT_INCLUDE)/bsp/irq_supp.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/irq_supp.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq_supp.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq_supp.h
diff --git a/c/src/lib/libbsp/powerpc/psim/startup/linkcmds b/c/src/lib/libbsp/powerpc/psim/startup/linkcmds
index 9676b08c97..f313375440 100644
--- a/c/src/lib/libbsp/powerpc/psim/startup/linkcmds
+++ b/c/src/lib/libbsp/powerpc/psim/startup/linkcmds
@@ -87,6 +87,9 @@ SECTIONS
_bsd__start_set_sysctl_set = .;
*(_bsd_set_sysctl_set);
_bsd__stop_set_sysctl_set = .;
+ _bsd__start_set_sysinit_set = .;
+ *(_bsd_set_sysinit_*);
+ _bsd__stop_set_sysinit_set = .;
bsp_section_rodata_end = .;
} > RAM
diff --git a/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c b/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
index 86a968fea8..0d0d231739 100644
--- a/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
+++ b/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
@@ -54,7 +54,7 @@ static int clkirq;
} \
} while(0)
#else
- #define Adjust_clkirq_for_node()
+ #define Adjust_clkirq_for_node() do { clkirq += LEON3_CLOCK_INDEX; } while(0)
#endif
#define Clock_driver_support_find_timer() \
@@ -67,7 +67,7 @@ static int clkirq;
if ( cnt > 0 ){ \
/* Found APB GPTIMER Timer */ \
LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *) dev.start; \
- clkirq = (LEON3_Timer_Regs->status & 0xfc) >> 3; \
+ clkirq = (LEON3_Timer_Regs->status & 0xf8) >> 3; \
\
Adjust_clkirq_for_node(); \
} \
@@ -102,10 +102,10 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(void)
if ( !LEON3_Timer_Regs )
return 0;
- clicks = LEON3_Timer_Regs->timer[0].value;
+ clicks = LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].value;
if ( LEON_Is_interrupt_pending( clkirq ) ) {
- clicks = LEON3_Timer_Regs->timer[0].value;
+ clicks = LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].value;
usecs = (2*rtems_configuration_get_microseconds_per_tick() - clicks);
} else {
usecs = (rtems_configuration_get_microseconds_per_tick() - clicks);
diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h
index cd50629176..fd208b083a 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/leon.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h
@@ -46,67 +46,6 @@ extern "C" {
( (_trap) >= 0x11 && \
(_trap) <= 0x1F )
-/*
- * Structure for LEON memory mapped registers.
- *
- * Source: Section 6.1 - On-chip registers
- *
- * NOTE: There is only one of these structures per CPU, its base address
- * is 0x80000000, and the variable LEON_REG is placed there by the
- * linkcmds file.
- */
-
-/* Leon uses dynamic register mapping using amba configuration records,
- * LEON_Register_Map is obsolete
- */
-/*
- typedef struct {
- volatile unsigned int Memory_Config_1;
- volatile unsigned int Memory_Config_2;
- volatile unsigned int Edac_Control;
- volatile unsigned int Failed_Address;
- volatile unsigned int Memory_Status;
- volatile unsigned int Cache_Control;
- volatile unsigned int Power_Down;
- volatile unsigned int Write_Protection_1;
- volatile unsigned int Write_Protection_2;
- volatile unsigned int Leon_Configuration;
- volatile unsigned int dummy2;
- volatile unsigned int dummy3;
- volatile unsigned int dummy4;
- volatile unsigned int dummy5;
- volatile unsigned int dummy6;
- volatile unsigned int dummy7;
- volatile unsigned int Timer_Counter_1;
- volatile unsigned int Timer_Reload_1;
- volatile unsigned int Timer_Control_1;
- volatile unsigned int Watchdog;
- volatile unsigned int Timer_Counter_2;
- volatile unsigned int Timer_Reload_2;
- volatile unsigned int Timer_Control_2;
- volatile unsigned int dummy8;
- volatile unsigned int Scaler_Counter;
- volatile unsigned int Scaler_Reload;
- volatile unsigned int dummy9;
- volatile unsigned int dummy10;
- volatile unsigned int UART_Channel_1;
- volatile unsigned int UART_Status_1;
- volatile unsigned int UART_Control_1;
- volatile unsigned int UART_Scaler_1;
- volatile unsigned int UART_Channel_2;
- volatile unsigned int UART_Status_2;
- volatile unsigned int UART_Control_2;
- volatile unsigned int UART_Scaler_2;
- volatile unsigned int Interrupt_Mask;
- volatile unsigned int Interrupt_Pending;
- volatile unsigned int Interrupt_Force;
- volatile unsigned int Interrupt_Clear;
- volatile unsigned int PIO_Data;
- volatile unsigned int PIO_Direction;
- volatile unsigned int PIO_Interrupt;
-} LEON_Register_Map;
-*/
-
typedef struct {
volatile unsigned int data;
volatile unsigned int status;
@@ -193,7 +132,6 @@ typedef struct {
#define LEON_REG_UART_STATUS_FE 0x00000040 /* RX Framing Error */
#define LEON_REG_UART_STATUS_ERR 0x00000078 /* Error Mask */
-
/*
* The following defines the bits in the LEON UART Status Registers.
*/
@@ -211,6 +149,7 @@ extern volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs; /* LEON3 Interrupt
extern volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs; /* LEON3 GP Timer */
extern volatile LEON3_UART_Regs_Map *LEON3_Console_Uart[LEON3_APBUARTS];
+/* LEON3 CPU Index of boot CPU */
extern int LEON3_Cpu_Index;
/* Macros used for manipulating bits in LEON3 GP Timer Control Register */
@@ -256,7 +195,6 @@ extern int LEON3_Cpu_Index;
(LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] & (1 << (_source))); \
} while (0)
-
#define LEON_Mask_interrupt( _source ) \
do { \
uint32_t _level; \