summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-09-03 13:27:51 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-09-03 13:27:51 +0000
commitff5720e5a0b1cf1dfd671d561e2868691ad80255 (patch)
tree1ba2ff7aab17ab0173e24447a4e0166c7fdca4bd /c/src/lib/libbsp/sparc/leon
parent2003-09-02 Jiri Gaisler <jiri@gaisler.com> (diff)
downloadrtems-ff5720e5a0b1cf1dfd671d561e2868691ad80255.tar.bz2
2003-09-03 Jiri Gaisler <jiri@gaisler.com>
PR 477/networking * Makefile.am, configure.ac, console/console.c, include/bsp.h, startup/setvec.c, wrapup/Makefile.am: Add network support and enable custom power down. * leon_open_eth/.cvsignore, leon_open_eth/Makefile.am, leon_open_eth/leon_open_eth.c: New files.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon')
-rw-r--r--c/src/lib/libbsp/sparc/leon/ChangeLog9
-rw-r--r--c/src/lib/libbsp/sparc/leon/Makefile.am3
-rw-r--r--c/src/lib/libbsp/sparc/leon/configure.ac5
-rw-r--r--c/src/lib/libbsp/sparc/leon/console/console.c4
-rw-r--r--c/src/lib/libbsp/sparc/leon/include/bsp.h9
-rw-r--r--c/src/lib/libbsp/sparc/leon/leon_open_eth/.cvsignore2
-rw-r--r--c/src/lib/libbsp/sparc/leon/leon_open_eth/Makefile.am35
-rw-r--r--c/src/lib/libbsp/sparc/leon/leon_open_eth/leon_open_eth.c48
-rw-r--r--c/src/lib/libbsp/sparc/leon/startup/setvec.c2
-rw-r--r--c/src/lib/libbsp/sparc/leon/wrapup/Makefile.am5
10 files changed, 118 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/sparc/leon/ChangeLog b/c/src/lib/libbsp/sparc/leon/ChangeLog
index 7ffe12b4ca..97d28c4b86 100644
--- a/c/src/lib/libbsp/sparc/leon/ChangeLog
+++ b/c/src/lib/libbsp/sparc/leon/ChangeLog
@@ -1,3 +1,12 @@
+2003-09-03 Jiri Gaisler <jiri@gaisler.com>
+
+ PR 477/networking
+ * Makefile.am, configure.ac, console/console.c, include/bsp.h,
+ startup/setvec.c, wrapup/Makefile.am: Add network support and enable
+ custom power down.
+ * leon_open_eth/.cvsignore, leon_open_eth/Makefile.am,
+ leon_open_eth/leon_open_eth.c: New files.
+
2003-08-20 Joel Sherrill <joel@OARcorp.com>
* include/bsp.h: Correct copyright statements.
diff --git a/c/src/lib/libbsp/sparc/leon/Makefile.am b/c/src/lib/libbsp/sparc/leon/Makefile.am
index 7e8155905e..08a833f08e 100644
--- a/c/src/lib/libbsp/sparc/leon/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon/Makefile.am
@@ -6,7 +6,8 @@ ACLOCAL_AMFLAGS = -I ../../../../aclocal
# wrapup is the one that actually builds and installs the library
# from the individual .rel files built in other directories
-SUBDIRS = . include start startup gnatsupp console clock timer wrapup tools
+SUBDIRS = . include start startup gnatsupp console clock timer \
+ leon_open_eth wrapup tools
include $(top_srcdir)/../../bsp.am
diff --git a/c/src/lib/libbsp/sparc/leon/configure.ac b/c/src/lib/libbsp/sparc/leon/configure.ac
index c21bc86437..dbc2f7ec0b 100644
--- a/c/src/lib/libbsp/sparc/leon/configure.ac
+++ b/c/src/lib/libbsp/sparc/leon/configure.ac
@@ -14,6 +14,10 @@ RTEMS_BSP_CONFIGURE
RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
RTEMS_CANONICALIZE_TOOLS
+RTEMS_CHECK_NETWORKING
+
+AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
+
RTEMS_CONFIG_BUILD_SUBDIRS(tools)
## bsp-specific options
@@ -36,6 +40,7 @@ RTEMS_BSPOPTS_HELP([SIMSPARC_FAST_IDLE],
AC_CONFIG_FILES([Makefile
clock/Makefile
console/Makefile
+leon_open_eth/Makefile
gnatsupp/Makefile
include/Makefile
start/Makefile
diff --git a/c/src/lib/libbsp/sparc/leon/console/console.c b/c/src/lib/libbsp/sparc/leon/console/console.c
index ea654fa396..aacc79de4c 100644
--- a/c/src/lib/libbsp/sparc/leon/console/console.c
+++ b/c/src/lib/libbsp/sparc/leon/console/console.c
@@ -334,8 +334,8 @@ rtems_device_driver console_initialize(
* Initialize Hardware
*/
- LEON_REG.UART_Control_1 = LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
- LEON_REG.UART_Control_2 = LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE |
+ LEON_REG.UART_Control_1 |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
+ LEON_REG.UART_Control_2 |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE |
LEON_REG_UART_CTRL_RI; /* rx irq default enable for remote debugger */
LEON_REG.UART_Status_1 = 0;
LEON_REG.UART_Status_2 = 0;
diff --git a/c/src/lib/libbsp/sparc/leon/include/bsp.h b/c/src/lib/libbsp/sparc/leon/include/bsp.h
index 1059164e73..703de359f7 100644
--- a/c/src/lib/libbsp/sparc/leon/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon/include/bsp.h
@@ -44,6 +44,15 @@ extern "C" {
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
#define CONFIGURE_INTERRUPT_STACK_MEMORY (16 * 1024)
+/*
+ * Network driver configuration
+ */
+
+struct rtems_bsdnet_ifconfig;
+extern int rtems_leon_open_eth_driver_attach (struct rtems_bsdnet_ifconfig *config);
+#define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1"
+#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_leon_open_eth_driver_attach
+
/*
* Define the time limits for RTEMS Test Suite test durations.
diff --git a/c/src/lib/libbsp/sparc/leon/leon_open_eth/.cvsignore b/c/src/lib/libbsp/sparc/leon/leon_open_eth/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/leon/leon_open_eth/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/sparc/leon/leon_open_eth/Makefile.am b/c/src/lib/libbsp/sparc/leon/leon_open_eth/Makefile.am
new file mode 100644
index 0000000000..db691d32c8
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/leon/leon_open_eth/Makefile.am
@@ -0,0 +1,35 @@
+##
+## Makefile.am,v 1.5 2002/12/14 08:17:45 ralf Exp
+##
+
+
+PGM = $(ARCH)/leon_open_eth.rel
+
+C_FILES = leon_open_eth.c
+C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.$(OBJEXT))
+
+OBJS = $(C_O_FILES)
+
+include $(top_srcdir)/../../../../../../automake/compile.am
+include $(top_srcdir)/../../../../../../automake/lib.am
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+AM_CPPFLAGS += -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
+
+$(PGM): $(OBJS)
+ $(make-rel)
+
+# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
+
+if HAS_NETWORKING
+all-local: $(ARCH) $(OBJS) $(PGM)
+endif
+
+.PRECIOUS: $(PGM)
+
+EXTRA_DIST = leon_open_eth.c
+
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/sparc/leon/leon_open_eth/leon_open_eth.c b/c/src/lib/libbsp/sparc/leon/leon_open_eth/leon_open_eth.c
new file mode 100644
index 0000000000..8ec61779f5
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/leon/leon_open_eth/leon_open_eth.c
@@ -0,0 +1,48 @@
+/*
+ * LEON2 Opencores Ethernet MAC Configuration Information
+ *
+ */
+
+
+#include <bsp.h>
+#include <libchip/open_eth.h>
+#if (OPEN_ETH_DEBUG & OPEN_ETH_DEBUG_PRINT_REGISTERS)
+#include <stdio.h>
+#endif
+
+/*
+ * Default sizes of transmit and receive descriptor areas
+ */
+#define RDA_COUNT 16
+#define TDA_COUNT 16
+
+/*
+ * Default location of device registers
+ */
+#define OPEN_ETH_BASE_ADDRESS 0xb0000000
+
+/*
+ * Default interrupt vector
+ */
+#define OPEN_ETH_VECTOR 0x1C
+
+open_eth_configuration_t leon_open_eth_configuration = {
+ OPEN_ETH_BASE_ADDRESS, /* base address */
+ OPEN_ETH_VECTOR, /* vector number */
+ TDA_COUNT, /* number of transmit descriptors */
+ RDA_COUNT /* number of receive descriptors */
+};
+
+int rtems_leon_open_eth_driver_attach(struct rtems_bsdnet_ifconfig *config)
+{
+
+ *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0;
+ *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0x800;
+ *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0;
+ if (rtems_open_eth_driver_attach( config, &leon_open_eth_configuration )) {
+ LEON_REG.Interrupt_Clear = (1 << (OPEN_ETH_VECTOR - 0x10));
+ LEON_REG.Interrupt_Mask |= (1 << (OPEN_ETH_VECTOR - 0x10));
+ return 1;
+ }
+ return 0;
+}
diff --git a/c/src/lib/libbsp/sparc/leon/startup/setvec.c b/c/src/lib/libbsp/sparc/leon/startup/setvec.c
index 1c23385c80..121e412af0 100644
--- a/c/src/lib/libbsp/sparc/leon/startup/setvec.c
+++ b/c/src/lib/libbsp/sparc/leon/startup/setvec.c
@@ -65,7 +65,7 @@ rtems_isr_entry set_vector( /* returns old vector */
void _CPU_Thread_Idle_body( void )
{
while (1) {
- LEON_REG.Power_Down = 0; /* value is irrelevant */
+ LEON_REG.Power_Down = LEON_REG.Power_Down; /* make sure on load follows store to power-down reg */
}
}
diff --git a/c/src/lib/libbsp/sparc/leon/wrapup/Makefile.am b/c/src/lib/libbsp/sparc/leon/wrapup/Makefile.am
index 670d8ba44e..f6262e717d 100644
--- a/c/src/lib/libbsp/sparc/leon/wrapup/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon/wrapup/Makefile.am
@@ -2,6 +2,11 @@
## $Id$
##
+# We only build the networking device driver if HAS_NETWORKING was defined
+if HAS_NETWORKING
+NETWORKING_DRIVER = leon_open_eth
+endif
+
BSP_PIECES = startup console clock timer gnatsupp $(NETWORK)
# pieces to pick up out of libcpu/sparc
CPU_PIECES = cache reg_win syscall