From ff5720e5a0b1cf1dfd671d561e2868691ad80255 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 3 Sep 2003 13:27:51 +0000 Subject: 2003-09-03 Jiri Gaisler 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. --- .../lib/libbsp/sparc/leon/leon_open_eth/.cvsignore | 2 + .../libbsp/sparc/leon/leon_open_eth/Makefile.am | 35 ++++++++++++++++ .../sparc/leon/leon_open_eth/leon_open_eth.c | 48 ++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 c/src/lib/libbsp/sparc/leon/leon_open_eth/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon/leon_open_eth/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon/leon_open_eth/leon_open_eth.c (limited to 'c/src/lib/libbsp/sparc/leon/leon_open_eth') 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 +#include +#if (OPEN_ETH_DEBUG & OPEN_ETH_DEBUG_PRINT_REGISTERS) +#include +#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; +} -- cgit v1.2.3