From d2a30c77f5380d56266a018bf0d75f01fd86a955 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 5 Oct 2005 19:25:45 +0000 Subject: 2005-10-05 Jiri Gaisler Edvin Catovic Konrad Eisele PR 827/bsps * .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac, times, clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, console/.cvsignore, console/Makefile.am, console/console.c, console/consolereserveresources.c, console/debugputs.c, gnatsupp/.cvsignore, gnatsupp/Makefile.am, gnatsupp/gnatsupp.c, include/.cvsignore, include/Makefile.am, include/bsp.h, include/coverhd.h, include/leon.h, leon_open_eth/.cvsignore, leon_open_eth/Makefile.am, leon_open_eth/leon_open_eth.c, leon_smc91111/.cvsignore, leon_smc91111/Makefile.am, leon_smc91111/leon_smc91111.c, start/.cvsignore, start/Makefile.am, startup/.cvsignore, startup/Makefile.am, startup/linkcmds, startup/setvec.c, startup/spurious.c, timer/.cvsignore, timer/Makefile.am, timer/timer.c, tools/.cvsignore, tools/ChangeLog, tools/Makefile.am, tools/configure.ac, tools/runtest.in, wrapup/.cvsignore, wrapup/Makefile.am: New files. --- c/src/lib/libbsp/sparc/leon2/.cvsignore | 14 + c/src/lib/libbsp/sparc/leon2/ChangeLog | 21 + c/src/lib/libbsp/sparc/leon2/Makefile.am | 17 + c/src/lib/libbsp/sparc/leon2/README | 80 ++++ c/src/lib/libbsp/sparc/leon2/bsp_specs | 22 + c/src/lib/libbsp/sparc/leon2/clock/.cvsignore | 2 + c/src/lib/libbsp/sparc/leon2/clock/Makefile.am | 31 ++ c/src/lib/libbsp/sparc/leon2/clock/ckinit.c | 249 ++++++++++++ c/src/lib/libbsp/sparc/leon2/configure.ac | 51 +++ c/src/lib/libbsp/sparc/leon2/console/.cvsignore | 2 + c/src/lib/libbsp/sparc/leon2/console/Makefile.am | 31 ++ c/src/lib/libbsp/sparc/leon2/console/console.c | 450 +++++++++++++++++++++ .../sparc/leon2/console/consolereserveresources.c | 21 + c/src/lib/libbsp/sparc/leon2/console/debugputs.c | 109 +++++ c/src/lib/libbsp/sparc/leon2/gnatsupp/.cvsignore | 2 + c/src/lib/libbsp/sparc/leon2/gnatsupp/Makefile.am | 31 ++ c/src/lib/libbsp/sparc/leon2/gnatsupp/gnatsupp.c | 20 + c/src/lib/libbsp/sparc/leon2/include/.cvsignore | 6 + c/src/lib/libbsp/sparc/leon2/include/Makefile.am | 18 + c/src/lib/libbsp/sparc/leon2/include/bsp.h | 198 +++++++++ c/src/lib/libbsp/sparc/leon2/include/coverhd.h | 110 +++++ c/src/lib/libbsp/sparc/leon2/include/leon.h | 380 +++++++++++++++++ .../libbsp/sparc/leon2/leon_open_eth/.cvsignore | 2 + .../libbsp/sparc/leon2/leon_open_eth/Makefile.am | 35 ++ .../sparc/leon2/leon_open_eth/leon_open_eth.c | 54 +++ .../libbsp/sparc/leon2/leon_smc91111/.cvsignore | 2 + .../libbsp/sparc/leon2/leon_smc91111/Makefile.am | 35 ++ .../sparc/leon2/leon_smc91111/leon_smc91111.c | 66 +++ c/src/lib/libbsp/sparc/leon2/start/.cvsignore | 2 + c/src/lib/libbsp/sparc/leon2/start/Makefile.am | 34 ++ c/src/lib/libbsp/sparc/leon2/startup/.cvsignore | 2 + c/src/lib/libbsp/sparc/leon2/startup/Makefile.am | 45 +++ c/src/lib/libbsp/sparc/leon2/startup/linkcmds | 184 +++++++++ c/src/lib/libbsp/sparc/leon2/startup/setvec.c | 71 ++++ c/src/lib/libbsp/sparc/leon2/startup/spurious.c | 177 ++++++++ c/src/lib/libbsp/sparc/leon2/timer/.cvsignore | 2 + c/src/lib/libbsp/sparc/leon2/timer/Makefile.am | 31 ++ c/src/lib/libbsp/sparc/leon2/timer/timer.c | 83 ++++ c/src/lib/libbsp/sparc/leon2/times | 193 +++++++++ c/src/lib/libbsp/sparc/leon2/tools/.cvsignore | 15 + c/src/lib/libbsp/sparc/leon2/tools/ChangeLog | 52 +++ c/src/lib/libbsp/sparc/leon2/tools/Makefile.am | 22 + c/src/lib/libbsp/sparc/leon2/tools/configure.ac | 25 ++ c/src/lib/libbsp/sparc/leon2/tools/runtest.in | 312 ++++++++++++++ c/src/lib/libbsp/sparc/leon2/wrapup/.cvsignore | 2 + c/src/lib/libbsp/sparc/leon2/wrapup/Makefile.am | 31 ++ 46 files changed, 3342 insertions(+) create mode 100644 c/src/lib/libbsp/sparc/leon2/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/ChangeLog create mode 100644 c/src/lib/libbsp/sparc/leon2/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/README create mode 100644 c/src/lib/libbsp/sparc/leon2/bsp_specs create mode 100644 c/src/lib/libbsp/sparc/leon2/clock/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/clock/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/clock/ckinit.c create mode 100644 c/src/lib/libbsp/sparc/leon2/configure.ac create mode 100644 c/src/lib/libbsp/sparc/leon2/console/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/console/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/console/console.c create mode 100644 c/src/lib/libbsp/sparc/leon2/console/consolereserveresources.c create mode 100644 c/src/lib/libbsp/sparc/leon2/console/debugputs.c create mode 100644 c/src/lib/libbsp/sparc/leon2/gnatsupp/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/gnatsupp/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/gnatsupp/gnatsupp.c create mode 100644 c/src/lib/libbsp/sparc/leon2/include/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/include/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/include/bsp.h create mode 100644 c/src/lib/libbsp/sparc/leon2/include/coverhd.h create mode 100644 c/src/lib/libbsp/sparc/leon2/include/leon.h create mode 100644 c/src/lib/libbsp/sparc/leon2/leon_open_eth/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/leon_open_eth/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c create mode 100644 c/src/lib/libbsp/sparc/leon2/leon_smc91111/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/leon_smc91111/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c create mode 100644 c/src/lib/libbsp/sparc/leon2/start/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/start/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/startup/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/startup/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/startup/linkcmds create mode 100644 c/src/lib/libbsp/sparc/leon2/startup/setvec.c create mode 100644 c/src/lib/libbsp/sparc/leon2/startup/spurious.c create mode 100644 c/src/lib/libbsp/sparc/leon2/timer/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/timer/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/timer/timer.c create mode 100644 c/src/lib/libbsp/sparc/leon2/times create mode 100644 c/src/lib/libbsp/sparc/leon2/tools/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/tools/ChangeLog create mode 100644 c/src/lib/libbsp/sparc/leon2/tools/Makefile.am create mode 100644 c/src/lib/libbsp/sparc/leon2/tools/configure.ac create mode 100644 c/src/lib/libbsp/sparc/leon2/tools/runtest.in create mode 100644 c/src/lib/libbsp/sparc/leon2/wrapup/.cvsignore create mode 100644 c/src/lib/libbsp/sparc/leon2/wrapup/Makefile.am diff --git a/c/src/lib/libbsp/sparc/leon2/.cvsignore b/c/src/lib/libbsp/sparc/leon2/.cvsignore new file mode 100644 index 0000000000..bfdfd995be --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/.cvsignore @@ -0,0 +1,14 @@ +aclocal.m4 +autom4te*.cache +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +Makefile +Makefile.in +missing +mkinstalldirs diff --git a/c/src/lib/libbsp/sparc/leon2/ChangeLog b/c/src/lib/libbsp/sparc/leon2/ChangeLog new file mode 100644 index 0000000000..11edfe952a --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/ChangeLog @@ -0,0 +1,21 @@ +2005-10-05 Jiri Gaisler + Edvin Catovic + Konrad Eisele + + PR 827/bsps + * .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac, + times, clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, + console/.cvsignore, console/Makefile.am, console/console.c, + console/consolereserveresources.c, console/debugputs.c, + gnatsupp/.cvsignore, gnatsupp/Makefile.am, gnatsupp/gnatsupp.c, + include/.cvsignore, include/Makefile.am, include/bsp.h, + include/coverhd.h, include/leon.h, leon_open_eth/.cvsignore, + leon_open_eth/Makefile.am, leon_open_eth/leon_open_eth.c, + leon_smc91111/.cvsignore, leon_smc91111/Makefile.am, + leon_smc91111/leon_smc91111.c, start/.cvsignore, start/Makefile.am, + startup/.cvsignore, startup/Makefile.am, startup/linkcmds, + startup/setvec.c, startup/spurious.c, timer/.cvsignore, + timer/Makefile.am, timer/timer.c, tools/.cvsignore, tools/ChangeLog, + tools/Makefile.am, tools/configure.ac, tools/runtest.in, + wrapup/.cvsignore, wrapup/Makefile.am: New files. + diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am new file mode 100644 index 0000000000..02a94bb610 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am @@ -0,0 +1,17 @@ +## +## $Id$ +## + +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 \ + leon_open_eth leon_smc91111 wrapup tools + +include $(top_srcdir)/../../bsp.am + +EXTRA_DIST = bsp_specs times + +include $(top_srcdir)/../../../../../../automake/subdirs.am +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/README b/c/src/lib/libbsp/sparc/leon2/README new file mode 100644 index 0000000000..93f19bb383 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/README @@ -0,0 +1,80 @@ +# +# Description of SIS as related to this BSP +# +# $Id$ +# + +BSP NAME: sis +BOARD: any based on the European Space Agency's ERC32 +BUS: N/A +CPU FAMILY: sparc +CPU: ERC32 (SPARC V7 + on-CPU peripherals) + based on Cypress 601/602 +COPROCESSORS: on-chip 602 compatible FPU +MODE: 32 bit mode + +DEBUG MONITOR: none + +PERIPHERALS +=========== +TIMERS: + NAME: General Purpose Timer + RESOLUTION: 50 nanoseconds - 12.8 microseconds + NAME: Real Time Clock Timer + RESOLUTION: 50 nanoseconds - 3.2768 milliseconds + NAME: Watchdog Timer + RESOLUTION: XXX +SERIAL PORTS: 2 using on-chip UART +REAL-TIME CLOCK: none +DMA: on-chip +VIDEO: none +SCSI: none +NETWORKING: none + +DRIVER INFORMATION +================== +CLOCK DRIVER: ERC32 internal Real Time Clock Timer +IOSUPP DRIVER: N/A +SHMSUPP: N/A +TIMER DRIVER: ERC32 internal General Purpose Timer +CONSOLE DRIVER: ERC32 internal UART + +STDIO +===== +PORT: Channel A +ELECTRICAL: na since using simulator +BAUD: na +BITS PER CHARACTER: na +PARITY: na +STOP BITS: na + +Notes +===== + +ERC32 BSP only supports single processor operations. + +A nice feature of this BSP is that the RAM and PROM size are set in the +linkcmds file and the startup code programs the Memory Configuration +Register based on those sizes. + +The Watchdog Timer is disabled. + +This code was developed and tested entirely using the SPARC Instruction +Simulator (SIS) for the ERC32. All tests were known to run correctly +against sis v1.7. + + +Memory Map +========== + +0x00000000 - 0x00000000 + _PROM_SIZE code and initialized data +0x01f80000 on chip peripherals +0x00000000 - 0x02000000 + _RAM_SIZE destination for initialized data + BSS (i.e. unitialized data) + C Heap (i.e. malloc area) + RTEMS Workspace + +The C heap is assigned all memory between the end of the BSS and the +RTEMS Workspace. The size of the RTEMS Workspace is based on that +specified in the application's configuration table. + diff --git a/c/src/lib/libbsp/sparc/leon2/bsp_specs b/c/src/lib/libbsp/sparc/leon2/bsp_specs new file mode 100644 index 0000000000..6fa79c0a98 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/bsp_specs @@ -0,0 +1,22 @@ +%rename lib old_lib +%rename endfile old_endfile +%rename startfile old_startfile +%rename link old_link + +*endfile: +crtend.o%s crtn.o%s + +*lib: +%{!qrtems: %(old_lib)} %{!nostdlib: %{qrtems: --start-group \ +%{!qrtems_debug: -lrtemsbsp -lrtemscpu} %{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g} \ +-lc -lgcc --end-group \ +%{!qnolinkcmds: -T linkcmds%s}}} + +*startfile: +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \ +%{!qrtems_debug: start.o%s crti.o%s crtbegin.o%s} \ +%{qrtems_debug: start_g.o%s crti.o%s crtbegin.o%s}}} + +*link: +%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start} + diff --git a/c/src/lib/libbsp/sparc/leon2/clock/.cvsignore b/c/src/lib/libbsp/sparc/leon2/clock/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/clock/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/clock/Makefile.am b/c/src/lib/libbsp/sparc/leon2/clock/Makefile.am new file mode 100644 index 0000000000..43dbc6aadc --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/clock/Makefile.am @@ -0,0 +1,31 @@ +## +## $Id$ +## + + +PGM = $(ARCH)/clock.rel + +C_FILES = ckinit.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 += +# + +$(PGM): $(OBJS) + $(make-rel) + +# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile + +all-local: $(ARCH) $(OBJS) $(PGM) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = ckinit.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/clock/ckinit.c b/c/src/lib/libbsp/sparc/leon2/clock/ckinit.c new file mode 100644 index 0000000000..3ff92a7dba --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/clock/ckinit.c @@ -0,0 +1,249 @@ +/* + * Clock Tick Device Driver + * + * This routine initializes LEON timer 1 which used for the clock tick. + * + * The tick frequency is directly programmed to the configured number of + * microseconds per tick. + * + * COPYRIGHT (c) 1989-1998. + * 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. + * + * Ported to LEON implementation of the SPARC by On-Line Applications + * Research Corporation (OAR) under contract to the European Space + * Agency (ESA). + * + * LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995. + * European Space Agency. + * + * $Id$ + */ + +#include + +#include +#include + +/* + * The Real Time Clock Counter Timer uses this trap type. + */ + +#define CLOCK_VECTOR LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER1 ) + +/* + * Clock ticks since initialization + */ + +volatile rtems_unsigned32 Clock_driver_ticks; + +/* + * This is the value programmed into the count down timer. It + * is artificially lowered when SIMSPARC_FAST_IDLE is defined to + * cut down how long we spend in the idle task while executing on + * the simulator. + */ + +extern rtems_unsigned32 CPU_SPARC_CLICKS_PER_TICK; + +rtems_isr_entry Old_ticker; + +void Clock_exit( void ); + +/* + * These are set by clock driver during its init + */ + +rtems_device_major_number rtems_clock_major = ~0; +rtems_device_minor_number rtems_clock_minor; + +/* + * Clock_isr + * + * This is the clock tick interrupt handler. + * + * Input parameters: + * vector - vector number + * + * Output parameters: NONE + * + * Return values: NONE + * + */ + +rtems_isr Clock_isr( + rtems_vector_number vector +) +{ + /* + * If we are in "fast idle" mode, then the value for clicks per tick + * is lowered to decrease the amount of time spent executing the idle + * task while using the SPARC Instruction Simulator. + */ + +#if SIMSPARC_FAST_IDLE + LEON_REG.Real_Time_Clock_Counter = CPU_SPARC_CLICKS_PER_TICK; + LEON_REG_Set_Real_Time_Clock_Timer_Control( + LEON_REG_TIMER_COUNTER_ENABLE_COUNTING | + LEON_REG_TIMER_COUNTER_LOAD_COUNTER + ); +#endif + + /* + * The driver has seen another tick. + */ + + Clock_driver_ticks += 1; + + /* + * Real Time Clock counter/timer is set to automatically reload. + */ + + rtems_clock_tick(); +} + +/* + * Install_clock + * + * This routine actually performs the hardware initialization for the clock. + * + * Input parameters: + * clock_isr - clock interrupt service routine entry point + * + * Output parameters: NONE + * + * Return values: NONE + * + */ + +void Install_clock( + rtems_isr_entry clock_isr +) +{ + Clock_driver_ticks = 0; + + if ( BSP_Configuration.ticks_per_timeslice ) { + Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); + + LEON_REG.Timer_Reload_1 = CPU_SPARC_CLICKS_PER_TICK - 1; + + LEON_REG.Timer_Control_1 = ( + LEON_REG_TIMER_COUNTER_ENABLE_COUNTING | + LEON_REG_TIMER_COUNTER_RELOAD_AT_ZERO | + LEON_REG_TIMER_COUNTER_LOAD_COUNTER + ); + + atexit( Clock_exit ); + } + +} + +/* + * Clock_exit + * + * This routine allows the clock driver to exit by masking the interrupt and + * disabling the clock's counter. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * Return values: NONE + * + */ + +void Clock_exit( void ) +{ + if ( BSP_Configuration.ticks_per_timeslice ) { + LEON_Mask_interrupt( LEON_INTERRUPT_TIMER1 ); + + LEON_REG.Timer_Control_1 = 0; + + /* do not restore old vector */ + } +} + +/* + * Clock_initialize + * + * This routine initializes the clock driver. + * + * Input parameters: + * major - clock device major number + * minor - clock device minor number + * parg - pointer to optional device driver arguments + * + * Output parameters: NONE + * + * Return values: + * rtems_device_driver status code + */ + +rtems_device_driver Clock_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + Install_clock( Clock_isr ); + + /* + * make major/minor avail to others such as shared memory driver + */ + + rtems_clock_major = major; + rtems_clock_minor = minor; + + return RTEMS_SUCCESSFUL; +} + +/* + * Clock_control + * + * This routine is the clock device driver control entry point. + * + * Input parameters: + * major - clock device major number + * minor - clock device minor number + * parg - pointer to optional device driver arguments + * + * Output parameters: NONE + * + * Return values: + * rtems_device_driver status code + */ + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +) +{ + rtems_unsigned32 isrlevel; + rtems_libio_ioctl_args_t *args = pargp; + + if (args == 0) + goto done; + + /* + * This is hokey, but until we get a defined interface + * to do this, it will just be this simple... + */ + + if (args->command == rtems_build_name('I', 'S', 'R', ' ')) + { + Clock_isr(CLOCK_VECTOR); + } + else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) + { + rtems_interrupt_disable( isrlevel ); + (void) set_vector( args->buffer, CLOCK_VECTOR, 1 ); + rtems_interrupt_enable( isrlevel ); + } + +done: + return RTEMS_SUCCESSFUL; +} diff --git a/c/src/lib/libbsp/sparc/leon2/configure.ac b/c/src/lib/libbsp/sparc/leon2/configure.ac new file mode 100644 index 0000000000..5a44149138 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/configure.ac @@ -0,0 +1,51 @@ +## Process this file with autoconf to produce a configure script. +## +## $Id$ + +AC_PREREQ(2.57) +AC_INIT([rtems-c-src-lib-libbsp-sparc-leon],[_RTEMS_VERSION],[rtems-bugs@rtems.com]) +AC_CONFIG_SRCDIR([bsp_specs]) +RTEMS_TOP(../../../../../..) + +RTEMS_CANONICAL_TARGET_CPU +AM_INIT_AUTOMAKE([no-define foreign 1.7.2]) +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 +RTEMS_BSPOPTS_SET([CONSOLE_USE_INTERRUPTS],[*],[0]) +RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS], +[The erc32 console driver can operate in either polled or interrupt mode. +Under the simulator (especially when FAST_UART is defined), polled seems to operate +better. It is common for a task to print a line (like the end of test message) and +then exit. In this case, the program returns control to the simulator command line +before the program has even queued the output to the uart. Thus sis has no chance +of getting the data out.]) + +RTEMS_BSPOPTS_SET([SIMSPARC_FAST_IDLE],[*],[]) +RTEMS_BSPOPTS_HELP([SIMSPARC_FAST_IDLE], +[If defined, speed up the clock ticks while the idle task is running so + time spent in the idle task is minimized. This significantly reduces + the wall time required to execute the RTEMS test suites.]) + +# Explicitly list all Makefiles here +AC_CONFIG_FILES([Makefile +clock/Makefile +console/Makefile +leon_open_eth/Makefile +leon_smc91111/Makefile +gnatsupp/Makefile +include/Makefile +start/Makefile +startup/Makefile +timer/Makefile +wrapup/Makefile]) +AC_OUTPUT diff --git a/c/src/lib/libbsp/sparc/leon2/console/.cvsignore b/c/src/lib/libbsp/sparc/leon2/console/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/console/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/console/Makefile.am b/c/src/lib/libbsp/sparc/leon2/console/Makefile.am new file mode 100644 index 0000000000..0d5e07e99e --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/console/Makefile.am @@ -0,0 +1,31 @@ +## +## $Id$ +## + + +PGM = $(ARCH)/console.rel + +C_FILES = console.c consolereserveresources.c debugputs.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 += +# + +$(PGM): $(OBJS) + $(make-rel) + +# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile + +all-local: $(ARCH) $(OBJS) $(PGM) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = console.c consolereserveresources.c debugputs.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/console/console.c b/c/src/lib/libbsp/sparc/leon2/console/console.c new file mode 100644 index 0000000000..e426deee71 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/console/console.c @@ -0,0 +1,450 @@ +/* + * This file contains the TTY driver for the serial ports on the LEON. + * + * This driver uses the termios pseudo driver. + * + * COPYRIGHT (c) 1989-1998. + * 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. + * + * $Id$ + */ + +#include +#include +#include +#include +#include + +/* + * Should we use a polled or interrupt drived console? + * + * NOTE: This is defined in the custom/leon.cfg file. + * + * WARNING: In sis 1.6, it did not appear that the UART interrupts + * worked in a desirable fashion. Immediately upon writing + * a character into the TX buffer, an interrupt was generated. + * This did not allow enough time for the program to put more + * characters in the buffer. So every character resulted in + * "priming" the transmitter. This effectively results in + * in a polled console with a useless interrupt per character + * on output. It is reasonable to assume that input does not + * share this problem although it was not investigated. + * + */ + +/* + * console_outbyte_polled + * + * This routine transmits a character using polling. + */ + +void console_outbyte_polled( + int port, + char ch +); + +/* body is in debugputs.c */ + +/* + * console_inbyte_nonblocking + * + * This routine polls for a character. + */ + +int console_inbyte_nonblocking( int port ); + +/* body is in debugputs.c */ + +/* + * Interrupt driven console IO + */ + +#if (CONSOLE_USE_INTERRUPTS) + +/* + * Buffers between task and ISRs + */ + +#include + +Ring_buffer_t TX_Buffer[ 2 ]; +boolean Is_TX_active[ 2 ]; + +void *console_termios_data[ 2 ]; + +/* + * console_isr_a + * + * This routine is the console interrupt handler for Channel 1. + * + * Input parameters: + * vector - vector number + * + * Output parameters: NONE + * + * Return values: NONE + */ + +rtems_isr console_isr_a( + rtems_vector_number vector +) +{ + char ch; + int UStat; + + if ( (UStat = LEON_REG.UART_Status_1) & LEON_REG_UART_STATUS_DR ) { + if (UStat & LEON_REG_UART_STATUS_ERR) { + LEON_REG.UART_Status_1 = LEON_REG_UART_STATUS_CLR; + } + ch = LEON_REG.UART_Channel_1; + + rtems_termios_enqueue_raw_characters( console_termios_data[ 0 ], &ch, 1 ); + } + + if ( LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE ) { + if ( !Ring_buffer_Is_empty( &TX_Buffer[ 0 ] ) ) { + Ring_buffer_Remove_character( &TX_Buffer[ 0 ], ch ); + LEON_REG.UART_Channel_1 = (unsigned32) ch; + } else + Is_TX_active[ 0 ] = FALSE; + } + + LEON_Clear_interrupt( LEON_INTERRUPT_UART_1_RX_TX ); +} + +/* + * console_isr_b + * + * This routine is the console interrupt handler for Channel 2. + * + * Input parameters: + * vector - vector number + * + * Output parameters: NONE + * + * Return values: NONE + */ + +rtems_isr console_isr_b( + rtems_vector_number vector +) +{ + char ch; + int UStat; + + if ( (UStat = LEON_REG.UART_Status_2) & LEON_REG_UART_STATUS_DR ) { + if (UStat & LEON_REG_UART_STATUS_ERR) { + LEON_REG.UART_Status_2 = LEON_REG_UART_STATUS_CLR; + } + ch = LEON_REG.UART_Channel_2; + rtems_termios_enqueue_raw_characters( console_termios_data[ 1 ], &ch, 1 ); + + } + + if ( LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE ) { + if ( !Ring_buffer_Is_empty( &TX_Buffer[ 1 ] ) ) { + Ring_buffer_Remove_character( &TX_Buffer[ 1 ], ch ); + LEON_REG.UART_Channel_2 = (unsigned32) ch; + } else + Is_TX_active[ 1 ] = FALSE; + } + + LEON_Clear_interrupt( LEON_INTERRUPT_UART_2_RX_TX ); +} + +/* + * console_exit + * + * This routine allows the console to exit by masking its associated interrupt + * vectors. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * Return values: NONE + */ + +void console_exit() +{ + rtems_unsigned32 port; + rtems_unsigned32 ch; + + /* + * Although the interrupts for the UART are unmasked, the PIL is set to + * disable all external interrupts. So we might as well do this first. + */ + + LEON_Mask_interrupt( LEON_INTERRUPT_UART_1_RX_TX ); + LEON_Mask_interrupt( LEON_INTERRUPT_UART_2_RX_TX ); + + for ( port=0 ; port <= 1 ; port++ ) { + while ( !Ring_buffer_Is_empty( &TX_Buffer[ port ] ) ) { + Ring_buffer_Remove_character( &TX_Buffer[ port ], ch ); + console_outbyte_polled( port, ch ); + } + } + + /* + * Now wait for all the data to actually get out ... the send register + * should be empty. + */ + + while ( (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE) != + LEON_REG_UART_STATUS_THE ); + + while ( (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE) != + LEON_REG_UART_STATUS_THE ); + + LEON_REG.UART_Control_1 = 0; + LEON_REG.UART_Control_2 = 0; + LEON_REG.UART_Status_1 = 0; + LEON_REG.UART_Status_2 = 0; + + +} + +#define CONSOLE_UART_1_TRAP LEON_TRAP_TYPE( LEON_INTERRUPT_UART_1_RX_TX ) +#define CONSOLE_UART_2_TRAP LEON_TRAP_TYPE( LEON_INTERRUPT_UART_2_RX_TX ) + +/* + * console_initialize_interrupts + * + * This routine initializes the console's receive and transmit + * ring buffers and loads the appropriate vectors to handle the interrupts. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * Return values: NONE + */ + +#ifdef RDB_BREAK_IN + extern unsigned32 trap_table[]; +#endif + +void console_initialize_interrupts( void ) +{ + Ring_buffer_Initialize( &TX_Buffer[ 0 ] ); + Ring_buffer_Initialize( &TX_Buffer[ 1 ] ); + + Is_TX_active[ 0 ] = FALSE; + Is_TX_active[ 1 ] = FALSE; + + atexit( console_exit ); + + LEON_REG.UART_Control_1 |= LEON_REG_UART_CTRL_RI | LEON_REG_UART_CTRL_TI; + LEON_REG.UART_Control_2 |= LEON_REG_UART_CTRL_RI | LEON_REG_UART_CTRL_TI; + + set_vector( console_isr_a, CONSOLE_UART_1_TRAP, 1 ); +#ifdef RDB_BREAK_IN + if (trap_table[0x150/4] == 0x91d02000) +#endif + set_vector( console_isr_b, CONSOLE_UART_2_TRAP, 1 ); +} + +/* + * console_outbyte_interrupt + * + * This routine transmits a character out. + * + * Input parameters: + * port - port to transmit character to + * ch - character to be transmitted + * + * Output parameters: NONE + * + * Return values: NONE + */ + +void console_outbyte_interrupt( + int port, + char ch +) +{ + /* + * If this is the first character then we need to prime the pump + */ + + if ( Is_TX_active[ port ] == FALSE ) { + Is_TX_active[ port ] = TRUE; + console_outbyte_polled( port, ch ); + return; + } + + while ( Ring_buffer_Is_full( &TX_Buffer[ port ] ) ); + + Ring_buffer_Add_character( &TX_Buffer[ port ], ch ); +} + +#endif /* CONSOLE_USE_INTERRUPTS */ + +/* + * Console Termios Support Entry Points + * + */ + +int console_write_support (int minor, const char *buf, int len) +{ + int nwrite = 0; + + while (nwrite < len) { +#if (CONSOLE_USE_INTERRUPTS) + console_outbyte_interrupt( minor, *buf++ ); +#else + console_outbyte_polled( minor, *buf++ ); +#endif + nwrite++; + } + return nwrite; +} + +/* + * Console Device Driver Entry Points + * + */ + +rtems_device_driver console_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg +) +{ + rtems_status_code status; + + rtems_termios_initialize(); + + /* + * Register Device Names + */ + + status = rtems_io_register_name( "/dev/console", major, 0 ); + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + status = rtems_io_register_name( "/dev/console_b", major, 1 ); + if (status != RTEMS_SUCCESSFUL) + rtems_fatal_error_occurred(status); + + /* + * 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_CTRL_RI; /* rx irq default enable for remote debugger */ + LEON_REG.UART_Status_1 = 0; + LEON_REG.UART_Status_2 = 0; +#if (CONSOLE_USE_INTERRUPTS) + console_initialize_interrupts(); +#endif + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver console_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + rtems_status_code sc; +#if (CONSOLE_USE_INTERRUPTS) + rtems_libio_open_close_args_t *args = arg; + static const rtems_termios_callbacks intrCallbacks = { + NULL, /* firstOpen */ + NULL, /* lastClose */ + NULL, /* pollRead */ + console_write_support, /* write */ + NULL, /* setAttributes */ + NULL, /* stopRemoteTx */ + NULL, /* startRemoteTx */ + 0 /* outputUsesInterrupts */ + }; +#else + static const rtems_termios_callbacks pollCallbacks = { + NULL, /* firstOpen */ + NULL, /* lastClose */ + console_inbyte_nonblocking, /* pollRead */ + console_write_support, /* write */ + NULL, /* setAttributes */ + NULL, /* stopRemoteTx */ + NULL, /* startRemoteTx */ + 0 /* outputUsesInterrupts */ + }; +#endif + + assert( minor <= 1 ); + if ( minor > 2 ) + return RTEMS_INVALID_NUMBER; + +#if (CONSOLE_USE_INTERRUPTS) + sc = rtems_termios_open (major, minor, arg, &intrCallbacks); + + console_termios_data[ minor ] = args->iop->data1; +#else + sc = rtems_termios_open (major, minor, arg, &pollCallbacks); +#endif + + return RTEMS_SUCCESSFUL; +} + +rtems_device_driver console_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return rtems_termios_close (arg); +} + +rtems_device_driver console_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return rtems_termios_read (arg); +} + +rtems_device_driver console_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return rtems_termios_write (arg); +} + +rtems_device_driver console_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void * arg +) +{ + return rtems_termios_ioctl (arg); +} + +/* putchar/getchar for printk */ + +static void bsp_out_char (char c) +{ + console_outbyte_polled(0, c); +} + +BSP_output_char_function_type BSP_output_char = bsp_out_char; + +static char bsp_in_char(void) +{ + int tmp; + + while ((tmp = console_inbyte_nonblocking(0)) < 0); + return (char) tmp; +} + +BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char; diff --git a/c/src/lib/libbsp/sparc/leon2/console/consolereserveresources.c b/c/src/lib/libbsp/sparc/leon2/console/consolereserveresources.c new file mode 100644 index 0000000000..7e5b155bfc --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/console/consolereserveresources.c @@ -0,0 +1,21 @@ +/* + * This file contains the TTY driver for the serial ports on the LEON. + * + * This driver uses the termios pseudo driver. + * + * 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.com/license/LICENSE. + * + * $Id$ + */ + +#include +#include +#include +#include + +int console_reserve_resources_removed; diff --git a/c/src/lib/libbsp/sparc/leon2/console/debugputs.c b/c/src/lib/libbsp/sparc/leon2/console/debugputs.c new file mode 100644 index 0000000000..46eb310e0b --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/console/debugputs.c @@ -0,0 +1,109 @@ +/* + * This file contains the TTY driver for the serial ports on the LEON. + * + * This driver uses the termios pseudo driver. + * + * 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.com/license/LICENSE. + * + * $Id$ + */ + +#include +#include +#include +#include + +/* + * console_outbyte_polled + * + * This routine transmits a character using polling. + */ + +void console_outbyte_polled( + int port, + unsigned char ch +) +{ + if ( port == 0 ) { + while ( (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE) == 0 ); + LEON_REG.UART_Channel_1 = (unsigned int) ch; + return; + } + + while ( (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE) == 0 ); + LEON_REG.UART_Channel_2 = (unsigned int) ch; +} + +/* + * console_inbyte_nonblocking + * + * This routine polls for a character. + */ + +int console_inbyte_nonblocking( int port ) +{ + + switch (port) { + + case 0: + if (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_ERR) { + LEON_REG.UART_Status_1 = ~LEON_REG_UART_STATUS_ERR; + } + + if ((LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_DR) == 0) + return -1; + return (int) LEON_REG.UART_Channel_1; + return 1; + + case 1: + if (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_ERR) { + LEON_REG.UART_Status_2 = ~LEON_REG_UART_STATUS_ERR; + } + + if ((LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_DR) == 0) + return -1; + return (int) LEON_REG.UART_Channel_2; + + default: + assert( 0 ); + } + + return -1; +} + +/* + * DEBUG_puts + * + * This should be safe in the event of an error. It attempts to insure + * that no TX empty interrupts occur while it is doing polled IO. Then + * it restores the state of that external interrupt. + * + * Input parameters: + * string - pointer to debug output string + * + * Output parameters: NONE + * + * Return values: NONE + */ + +void DEBUG_puts( + char *string +) +{ + char *s; + unsigned32 old_level; + + LEON_Disable_interrupt( LEON_INTERRUPT_UART_1_RX_TX, old_level ); + LEON_REG.UART_Control_1 = LEON_REG_UART_CTRL_TE; + for ( s = string ; *s ; s++ ) + console_outbyte_polled( 0, *s ); + + console_outbyte_polled( 0, '\r' ); + console_outbyte_polled( 0, '\n' ); + LEON_Restore_interrupt( LEON_INTERRUPT_UART_1_RX_TX, old_level ); +} diff --git a/c/src/lib/libbsp/sparc/leon2/gnatsupp/.cvsignore b/c/src/lib/libbsp/sparc/leon2/gnatsupp/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/gnatsupp/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/gnatsupp/Makefile.am b/c/src/lib/libbsp/sparc/leon2/gnatsupp/Makefile.am new file mode 100644 index 0000000000..a877e1d466 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/gnatsupp/Makefile.am @@ -0,0 +1,31 @@ +## +## $Id$ +## + + +VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared + +PGM = $(ARCH)/gnatsupp.rel + +C_FILES = gnatsupp.c gnatcommon.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 += +# + +$(PGM): $(OBJS) + $(make-rel) + +all-local: $(ARCH) $(OBJS) $(PGM) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = gnatsupp.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/gnatsupp/gnatsupp.c b/c/src/lib/libbsp/sparc/leon2/gnatsupp/gnatsupp.c new file mode 100644 index 0000000000..3836278226 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/gnatsupp/gnatsupp.c @@ -0,0 +1,20 @@ +/* + * + * Support for gnat/rtems interrupts and exception handling. + * Jiri Gaisler, ESA/ESTEC, 17-02-1999. + * + * $Id$ + */ + +void __gnat_install_handler_common (int t1, int t2); + +/* + * Avoid trap 0x18 which is used by the clock tick, and + * 0x12 (UART B interrupt) which is used by the stub. + */ + +void +__gnat_install_handler () +{ + __gnat_install_handler_common (0x18, 0x12); +} diff --git a/c/src/lib/libbsp/sparc/leon2/include/.cvsignore b/c/src/lib/libbsp/sparc/leon2/include/.cvsignore new file mode 100644 index 0000000000..b0be3c54e6 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/include/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +bspopts.h +bspopts.h.in +stamp-h +stamp-h.in diff --git a/c/src/lib/libbsp/sparc/leon2/include/Makefile.am b/c/src/lib/libbsp/sparc/leon2/include/Makefile.am new file mode 100644 index 0000000000..7bc6a8b8a1 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/include/Makefile.am @@ -0,0 +1,18 @@ +## +## $Id$ +## + + +include_HEADERS = bsp.h coverhd.h leon.h bspopts.h + +$(PROJECT_INCLUDE): + $(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/%.h: %.h + $(INSTALL_DATA) $< $@ + +PREINSTALL_FILES = $(PROJECT_INCLUDE) $(include_HEADERS:%=$(PROJECT_INCLUDE)/%) + +all-local: $(PREINSTALL_FILES) + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/include/bsp.h b/c/src/lib/libbsp/sparc/leon2/include/bsp.h new file mode 100644 index 0000000000..8ca8e95ad4 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/include/bsp.h @@ -0,0 +1,198 @@ +/* bsp.h + * + * This include file contains all SPARC simulator definitions. + * + * COPYRIGHT (c) 1989-1998. + * 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. + * + * Ported to ERC32 implementation of the SPARC by On-Line Applications + * Research Corporation (OAR) under contract to the European Space + * Agency (ESA). + * + * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. + * European Space Agency. + * + * $Id$ + */ + +#ifndef __SIS_h +#define __SIS_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include +#include +#include + +#include +#include + +/* + * confdefs.h overrides for this BSP: + * - two termios serial ports + * - Interrupt stack space is not minimum if defined. + */ + +#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); +extern int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config); +#define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1" +#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH rtems_leon_open_eth_driver_attach +#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 rtems_smc91111_driver_attach_leon2 + +/* + * Define the time limits for RTEMS Test Suite test durations. + * Long test and short test duration limits are provided. These + * values are in seconds and need to be converted to ticks for the + * application. + * + */ + +#define MAX_LONG_TEST_DURATION 3 /* 3 seconds */ +#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ + +/* + * Define the interrupt mechanism for Time Test 27 + * + * NOTE: Since the interrupt code for the SPARC supports both synchronous + * and asynchronous trap handlers, support for testing with both + * is included. + */ + +#define SIS_USE_SYNCHRONOUS_TRAP 0 + +/* + * The synchronous trap is an arbitrarily chosen software trap. + */ + +#if (SIS_USE_SYNCHRONOUS_TRAP == 1) + +#define TEST_VECTOR SPARC_SYNCHRONOUS_TRAP( 0x90 ) + +#define MUST_WAIT_FOR_INTERRUPT 1 + +#define Install_tm27_vector( handler ) \ + set_vector( (handler), TEST_VECTOR, 1 ); + +#define Cause_tm27_intr() \ + asm volatile( "ta 0x10; nop " ); + +#define Clear_tm27_intr() + +#define Lower_tm27_intr() + +/* + * The asynchronous trap is an arbitrarily chosen ERC32 interrupt source. + */ + +#else /* use a regular asynchronous trap */ + +#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1 +#define TEST_VECTOR LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE ) +#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1 +#define TEST_VECTOR2 LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE2 ) +#define MUST_WAIT_FOR_INTERRUPT 1 + +#define Install_tm27_vector( handler ) \ + set_vector( (handler), TEST_VECTOR, 1 ); \ + set_vector( (handler), TEST_VECTOR2, 1 ); + +#define Cause_tm27_intr() \ + do { \ + LEON_Force_interrupt( TEST_INTERRUPT_SOURCE+(Interrupt_nest>>1)); \ + nop(); \ + nop(); \ + nop(); \ + } while (0) + +#define Clear_tm27_intr() \ + LEON_Clear_interrupt( TEST_INTERRUPT_SOURCE ) + +#define Lower_tm27_intr() + +#endif + +/* + * Simple spin delay in microsecond units for device drivers. + * This is very dependent on the clock speed of the target. + */ + +extern void Clock_delay(rtems_unsigned32 microseconds); + +#define delay( microseconds ) Clock_delay(microseconds) + +/* Constants */ + +/* + * Information placed in the linkcmds file. + */ + +extern int RAM_START; +extern int RAM_END; +extern int RAM_SIZE; + +extern int PROM_START; +extern int PROM_END; +extern int PROM_SIZE; + +extern int CLOCK_SPEED; + +extern int end; /* last address in the program */ + +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + + +/* miscellaneous stuff assumed to exist */ + +void bsp_cleanup( void ); + +void bsp_start( void ); + +rtems_isr_entry set_vector( /* returns old vector */ + rtems_isr_entry handler, /* isr routine */ + rtems_vector_number vector, /* vector number */ + int type /* RTEMS or RAW intr */ +); + +void DEBUG_puts( char *string ); + +void BSP_fatal_return( void ); + +void bsp_spurious_initialize( void ); + +extern rtems_configuration_table BSP_Configuration; /* owned by BSP */ + +extern rtems_cpu_table Cpu_table; /* owned by BSP */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/lib/libbsp/sparc/leon2/include/coverhd.h b/c/src/lib/libbsp/sparc/leon2/include/coverhd.h new file mode 100644 index 0000000000..eea7cc91ca --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/include/coverhd.h @@ -0,0 +1,110 @@ +/* coverhd.h + * + * This include file has defines to represent the overhead associated + * with calling a particular directive from C for this target. + * + * 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.com/license/LICENSE. + * + * Ported to ERC32 implementation of the SPARC by On-Line Applications + * Research Corporation (OAR) under contract to the European Space + * Agency (ESA). + * + * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. + * European Space Agency. + * + * $Id$ + */ + +#ifndef __COVERHD_h +#define __COVERHD_h + +#ifdef __cplusplus +extern "C" { +#endif + +#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0 +#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0 +#define CALLING_OVERHEAD_TASK_CREATE 0 +#define CALLING_OVERHEAD_TASK_IDENT 0 +#define CALLING_OVERHEAD_TASK_START 0 +#define CALLING_OVERHEAD_TASK_RESTART 0 +#define CALLING_OVERHEAD_TASK_DELETE 0 +#define CALLING_OVERHEAD_TASK_SUSPEND 0 +#define CALLING_OVERHEAD_TASK_RESUME 0 +#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0 +#define CALLING_OVERHEAD_TASK_MODE 0 +#define CALLING_OVERHEAD_TASK_GET_NOTE 0 +#define CALLING_OVERHEAD_TASK_SET_NOTE 0 +#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0 +#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0 +#define CALLING_OVERHEAD_INTERRUPT_CATCH 0 +#define CALLING_OVERHEAD_CLOCK_GET 0 +#define CALLING_OVERHEAD_CLOCK_SET 0 +#define CALLING_OVERHEAD_CLOCK_TICK 0 + +#define CALLING_OVERHEAD_TIMER_CREATE 0 +#define CALLING_OVERHEAD_TIMER_IDENT 0 +#define CALLING_OVERHEAD_TIMER_DELETE 0 +#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0 +#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0 +#define CALLING_OVERHEAD_TIMER_RESET 0 +#define CALLING_OVERHEAD_TIMER_CANCEL 0 +#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0 +#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0 +#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0 +#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0 +#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0 + +#define CALLING_OVERHEAD_EVENT_SEND 0 +#define CALLING_OVERHEAD_EVENT_RECEIVE 0 +#define CALLING_OVERHEAD_SIGNAL_CATCH 0 +#define CALLING_OVERHEAD_SIGNAL_SEND 0 +#define CALLING_OVERHEAD_PARTITION_CREATE 0 +#define CALLING_OVERHEAD_PARTITION_IDENT 0 +#define CALLING_OVERHEAD_PARTITION_DELETE 0 +#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0 +#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0 +#define CALLING_OVERHEAD_REGION_CREATE 0 +#define CALLING_OVERHEAD_REGION_IDENT 0 +#define CALLING_OVERHEAD_REGION_DELETE 0 +#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0 +#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0 +#define CALLING_OVERHEAD_PORT_CREATE 0 +#define CALLING_OVERHEAD_PORT_IDENT 0 +#define CALLING_OVERHEAD_PORT_DELETE 0 +#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0 +#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0 + +#define CALLING_OVERHEAD_IO_INITIALIZE 0 +#define CALLING_OVERHEAD_IO_OPEN 0 +#define CALLING_OVERHEAD_IO_CLOSE 0 +#define CALLING_OVERHEAD_IO_READ 0 +#define CALLING_OVERHEAD_IO_WRITE 0 +#define CALLING_OVERHEAD_IO_CONTROL 0 +#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0 +#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0 +#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0 +#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0 +#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0 +#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0 +#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0 + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/lib/libbsp/sparc/leon2/include/leon.h b/c/src/lib/libbsp/sparc/leon2/include/leon.h new file mode 100644 index 0000000000..a25b7ea07e --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/include/leon.h @@ -0,0 +1,380 @@ +/* erc32.h + * + * This include file contains information pertaining to the LEON-1. + * The LEON-1 is a custom SPARC V7 implementation. + * This CPU has a number of on-board peripherals and + * was developed by the European Space Agency to target space applications. + * + * NOTE: Other than where absolutely required, this version currently + * supports only the peripherals and bits used by the basic board + * support package. This includes at least significant pieces of + * the following items: + * + * + UART Channels A and B + * + Real Time Clock + * + Memory Control Register + * + Interrupt Control + * + * COPYRIGHT (c) 1989-1998. + * 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. + * + * Ported to LEON implementation of the SPARC by On-Line Applications + * Research Corporation (OAR) under contract to the European Space + * Agency (ESA). + * + * LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995. + * European Space Agency. + * + * $Id$ + */ + +#ifndef _INCLUDE_LEON_h +#define _INCLUDE_LEON_h + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Interrupt Sources + * + * The interrupt source numbers directly map to the trap type and to + * the bits used in the Interrupt Clear, Interrupt Force, Interrupt Mask, + * and the Interrupt Pending Registers. + */ + +#define LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR 1 +#define LEON_INTERRUPT_UART_2_RX_TX 2 +#define LEON_INTERRUPT_UART_1_RX_TX 3 +#define LEON_INTERRUPT_EXTERNAL_0 4 +#define LEON_INTERRUPT_EXTERNAL_1 5 +#define LEON_INTERRUPT_EXTERNAL_2 6 +#define LEON_INTERRUPT_EXTERNAL_3 7 +#define LEON_INTERRUPT_TIMER1 8 +#define LEON_INTERRUPT_TIMER2 9 +#define LEON_INTERRUPT_EMPTY1 10 +#define LEON_INTERRUPT_EMPTY2 11 +#define LEON_INTERRUPT_EMPTY3 12 +#define LEON_INTERRUPT_EMPTY4 13 +#define LEON_INTERRUPT_EMPTY5 14 +#define LEON_INTERRUPT_EMPTY6 15 + +#ifndef ASM + +/* + * Trap Types for on-chip peripherals + * + * Source: Table 8 - Interrupt Trap Type and Default Priority Assignments + * + * NOTE: The priority level for each source corresponds to the least + * significant nibble of the trap type. + */ + +#define LEON_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10) + +#define LEON_TRAP_SOURCE( _trap ) ((_trap) - 0x10) + +#define LEON_INT_TRAP( _trap ) \ + ( (_trap) >= LEON_TRAP_TYPE( LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR ) && \ + (_trap) <= LEON_TRAP_TYPE( LEON_INTERRUPT_EMPTY6 ) ) + +/* + * 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. + */ + +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; + +#endif + +/* + * The following constants are intended to be used ONLY in assembly + * language files. + * + * NOTE: The intended style of usage is to load the address of LEON REGS + * into a register and then use these as displacements from + * that register. + */ + +#ifdef ASM + +#define LEON_REG_MEMCFG1_OFFSET 0x00 +#define LEON_REG_MEMCFG2_OFFSET 0x04 +#define LEON_REG_EDACCTRL_OFFSET 0x08 +#define LEON_REG_FAILADDR_OFFSET 0x0C +#define LEON_REG_MEMSTATUS_OFFSET 0x10 +#define LEON_REG_CACHECTRL_OFFSET 0x14 +#define LEON_REG_POWERDOWN_OFFSET 0x18 +#define LEON_REG_WRITEPROT1_OFFSET 0x1C +#define LEON_REG_WRITEPROT2_OFFSET 0x20 +#define LEON_REG_LEONCONF_OFFSET 0x24 +#define LEON_REG_UNIMPLEMENTED_2_OFFSET 0x28 +#define LEON_REG_UNIMPLEMENTED_3_OFFSET 0x2C +#define LEON_REG_UNIMPLEMENTED_4_OFFSET 0x30 +#define LEON_REG_UNIMPLEMENTED_5_OFFSET 0x34 +#define LEON_REG_UNIMPLEMENTED_6_OFFSET 0x38 +#define LEON_REG_UNIMPLEMENTED_7_OFFSET 0x3C +#define LEON_REG_TIMERCNT1_OFFSET 0x40 +#define LEON_REG_TIMERLOAD1_OFFSET 0x44 +#define LEON_REG_TIMERCTRL1_OFFSET 0x48 +#define LEON_REG_WDOG_OFFSET 0x4C +#define LEON_REG_TIMERCNT2_OFFSET 0x50 +#define LEON_REG_TIMERLOAD2_OFFSET 0x54 +#define LEON_REG_TIMERCTRL2_OFFSET 0x58 +#define LEON_REG_UNIMPLEMENTED_8_OFFSET 0x5C +#define LEON_REG_SCALERCNT_OFFSET 0x60 +#define LEON_REG_SCALER_LOAD_OFFSET 0x64 +#define LEON_REG_UNIMPLEMENTED_9_OFFSET 0x68 +#define LEON_REG_UNIMPLEMENTED_10_OFFSET 0x6C +#define LEON_REG_UARTDATA1_OFFSET 0x70 +#define LEON_REG_UARTSTATUS1_OFFSET 0x74 +#define LEON_REG_UARTCTRL1_OFFSET 0x78 +#define LEON_REG_UARTSCALER1_OFFSET 0x7C +#define LEON_REG_UARTDATA2_OFFSET 0x80 +#define LEON_REG_UARTSTATUS2_OFFSET 0x84 +#define LEON_REG_UARTCTRL2_OFFSET 0x88 +#define LEON_REG_UARTSCALER2_OFFSET 0x8C +#define LEON_REG_IRQMASK_OFFSET 0x90 +#define LEON_REG_IRQPEND_OFFSET 0x94 +#define LEON_REG_IRQFORCE_OFFSET 0x98 +#define LEON_REG_IRQCLEAR_OFFSET 0x9C +#define LEON_REG_PIODATA_OFFSET 0xA0 +#define LEON_REG_PIODIR_OFFSET 0xA4 +#define LEON_REG_PIOIRQ_OFFSET 0xA8 +#define LEON_REG_SIM_RAM_SIZE_OFFSET 0xF4 +#define LEON_REG_SIM_ROM_SIZE_OFFSET 0xF8 + +#endif + +/* + * The following defines the bits in Memory Configuration Register 1. + */ + +#define LEON_MEMORY_CONFIGURATION_PROM_SIZE_MASK 0x0003C000 + +/* + * The following defines the bits in Memory Configuration Register 1. + */ + +#define LEON_MEMORY_CONFIGURATION_RAM_SIZE_MASK 0x00001E00 + + +/* + * The following defines the bits in the Timer Control Register. + */ + +#define LEON_REG_TIMER_CONTROL_EN 0x00000001 /* 1 = enable counting */ + /* 0 = hold scalar and counter */ +#define LEON_REG_TIMER_CONTROL_RL 0x00000002 /* 1 = reload at 0 */ + /* 0 = stop at 0 */ +#define LEON_REG_TIMER_CONTROL_LD 0x00000004 /* 1 = load counter */ + /* 0 = no function */ + +/* + * The following defines the bits in the UART Control Registers. + * + */ + +#define LEON_REG_UART_CONTROL_RTD 0x000000FF /* RX/TX data */ + +/* + * The following defines the bits in the LEON UART Status Registers. + */ + +#define LEON_REG_UART_STATUS_CLR 0x00000000 /* Clear all status bits */ +#define LEON_REG_UART_STATUS_DR 0x00000001 /* Data Ready */ +#define LEON_REG_UART_STATUS_TSE 0x00000002 /* TX Send Register Empty */ +#define LEON_REG_UART_STATUS_THE 0x00000004 /* TX Hold Register Empty */ +#define LEON_REG_UART_STATUS_BR 0x00000008 /* Break Error */ +#define LEON_REG_UART_STATUS_OE 0x00000010 /* RX Overrun Error */ +#define LEON_REG_UART_STATUS_PE 0x00000020 /* RX Parity Error */ +#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. + */ + +#define LEON_REG_UART_CTRL_RE 0x00000001 /* Receiver enable */ +#define LEON_REG_UART_CTRL_TE 0x00000002 /* Transmitter enable */ +#define LEON_REG_UART_CTRL_RI 0x00000004 /* Receiver interrupt enable */ +#define LEON_REG_UART_CTRL_TI 0x00000008 /* Transmitter interrupt enable */ +#define LEON_REG_UART_CTRL_PS 0x00000010 /* Parity select */ +#define LEON_REG_UART_CTRL_PE 0x00000020 /* Parity enable */ +#define LEON_REG_UART_CTRL_FL 0x00000040 /* Flow control enable */ +#define LEON_REG_UART_CTRL_LB 0x00000080 /* Loop Back enable */ + +#ifndef ASM + +/* + * This is used to manipulate the on-chip registers. + * + * The following symbol must be defined in the linkcmds file and point + * to the correct location. + */ + +extern LEON_Register_Map LEON_REG; + +/* + * Macros to manipulate the Interrupt Clear, Interrupt Force, Interrupt Mask, + * and the Interrupt Pending Registers. + * + * NOTE: For operations which are not atomic, this code disables interrupts + * to guarantee there are no intervening accesses to the same register. + * The operations which read the register, modify the value and then + * store the result back are vulnerable. + */ + +#define LEON_Clear_interrupt( _source ) \ + do { \ + LEON_REG.Interrupt_Clear = (1 << (_source)); \ + } while (0) + +#define LEON_Force_interrupt( _source ) \ + do { \ + LEON_REG.Interrupt_Force = (1 << (_source)); \ + } while (0) + +#define LEON_Is_interrupt_pending( _source ) \ + (LEON_REG.Interrupt_Pending & (1 << (_source))) + +#define LEON_Is_interrupt_masked( _source ) \ + (LEON_REG.Interrupt_Masked & (1 << (_source))) + +#define LEON_Mask_interrupt( _source ) \ + do { \ + unsigned32 _level; \ + \ + _level = sparc_disable_interrupts(); \ + LEON_REG.Interrupt_Mask &= ~(1 << (_source)); \ + sparc_enable_interrupts( _level ); \ + } while (0) + +#define LEON_Unmask_interrupt( _source ) \ + do { \ + unsigned32 _level; \ + \ + _level = sparc_disable_interrupts(); \ + LEON_REG.Interrupt_Mask |= (1 << (_source)); \ + sparc_enable_interrupts( _level ); \ + } while (0) + +#define LEON_Disable_interrupt( _source, _previous ) \ + do { \ + unsigned32 _level; \ + unsigned32 _mask = 1 << (_source); \ + \ + _level = sparc_disable_interrupts(); \ + (_previous) = LEON_REG.Interrupt_Mask; \ + LEON_REG.Interrupt_Mask = _previous & ~_mask; \ + sparc_enable_interrupts( _level ); \ + (_previous) &= _mask; \ + } while (0) + +#define LEON_Restore_interrupt( _source, _previous ) \ + do { \ + unsigned32 _level; \ + unsigned32 _mask = 1 << (_source); \ + \ + _level = sparc_disable_interrupts(); \ + LEON_REG.Interrupt_Mask = \ + (LEON_REG.Interrupt_Mask & ~_mask) | (_previous); \ + sparc_enable_interrupts( _level ); \ + } while (0) + +/* + * Each timer control register is organized as follows: + * + * D0 - Enable + * 1 = enable counting + * 0 = hold scaler and counter + * + * D1 - Counter Reload + * 1 = reload counter at zero and restart + * 0 = stop counter at zero + * + * D2 - Counter Load + * 1 = load counter with preset value + * 0 = no function + * + */ + +#define LEON_REG_TIMER_COUNTER_RELOAD_AT_ZERO 0x00000002 +#define LEON_REG_TIMER_COUNTER_STOP_AT_ZERO 0x00000000 + +#define LEON_REG_TIMER_COUNTER_LOAD_COUNTER 0x00000004 + +#define LEON_REG_TIMER_COUNTER_ENABLE_COUNTING 0x00000001 +#define LEON_REG_TIMER_COUNTER_DISABLE_COUNTING 0x00000000 + +#define LEON_REG_TIMER_COUNTER_RELOAD_MASK 0x00000002 +#define LEON_REG_TIMER_COUNTER_ENABLE_MASK 0x00000001 + +#define LEON_REG_TIMER_COUNTER_DEFINED_MASK 0x00000003 +#define LEON_REG_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000003 + +#endif /* !ASM */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_INCLUDE_LEON_h */ +/* end of include file */ + diff --git a/c/src/lib/libbsp/sparc/leon2/leon_open_eth/.cvsignore b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/leon_open_eth/Makefile.am b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/Makefile.am new file mode 100644 index 0000000000..df9a43361d --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/Makefile.am @@ -0,0 +1,35 @@ +## +## $Id$ +## + + +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/leon2/leon_open_eth/leon_open_eth.c b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c new file mode 100644 index 0000000000..ea89310d74 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c @@ -0,0 +1,54 @@ +/* + * LEON2 Opencores Ethernet MAC Configuration Information + * + * $Id$ + */ + + +#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 */ + 0 /* 100 MHz operation */ +}; + +int rtems_leon_open_eth_driver_attach(struct rtems_bsdnet_ifconfig *config) +{ + + /* clear control register and reset NIC */ + *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0; + *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0x800; + *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0; + + /* enable 100 MHz operation only if cpu frequency >= 50 MHz */ + if (LEON_REG.Scaler_Reload >= 49) leon_open_eth_configuration.en100MHz = 1; + + 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 0; +} diff --git a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/.cvsignore b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/Makefile.am b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/Makefile.am new file mode 100644 index 0000000000..d51345a28b --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/Makefile.am @@ -0,0 +1,35 @@ +## +## $Id$ +## + + +PGM = $(ARCH)/leon_smc91111.rel + +C_FILES = leon_smc91111.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_smc91111.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c new file mode 100644 index 0000000000..6862b194cb --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c @@ -0,0 +1,66 @@ +/* + * $Id$ + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + + +#define SMC91111_BASE_ADDR (void*)0x20000300 +#define SMC91111_BASE_IRQ LEON_TRAP_TYPE(4) +#define SMC91111_BASE_PIO 4 + +scmv91111_configuration_t leon_scmv91111_configuration = { + SMC91111_BASE_ADDR, /* base address */ + SMC91111_BASE_IRQ, /* vector number */ + SMC91111_BASE_PIO, /* PIO */ + 10, /* 10b */ + 1, /* fulldx */ + 1 /* autoneg */ +}; + +int _rtems_smc91111_driver_attach( + struct rtems_bsdnet_ifconfig *config, + scmv91111_configuration_t *scm_config +); + +/* + * Attach an SMC91111 driver to the system + */ +int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config) +{ + + if (LEON_REG.Scaler_Reload >= 49) + leon_scmv91111_configuration.ctl_rspeed = 100; + + /* activate io area */ + DEBUG_puts("Activating Leon2 io port\n"); + /*configure pio */ + *((volatile unsigned int *)0x80000000) |= 0x10f80000; + *((volatile unsigned int *)0x800000A8) |= + (0xe0 | leon_scmv91111_configuration.vector) + << (8 * (leon_scmv91111_configuration.pio - 4)); + + return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration); + +}; + diff --git a/c/src/lib/libbsp/sparc/leon2/start/.cvsignore b/c/src/lib/libbsp/sparc/leon2/start/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/start/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/start/Makefile.am b/c/src/lib/libbsp/sparc/leon2/start/Makefile.am new file mode 100644 index 0000000000..4b1c8a1c00 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/start/Makefile.am @@ -0,0 +1,34 @@ +## +## $Id$ +## + +VPATH = @srcdir@:@srcdir@/../../shared + +S_FILES = start.S +S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.$(OBJEXT)) + +OBJS = $(S_O_FILES) + +include $(top_srcdir)/../../../../../../automake/compile.am +include $(top_srcdir)/../../../../../../automake/lib.am + +# +# (OPTIONAL) Add local stuff here using += +# + +install-data-local: $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT) + @$(mkinstalldirs) $(DESTDIR)$(bsplibdir) + $(INSTALL_DATA) $< $(DESTDIR)$(bsplibdir) + +$(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT): $(ARCH)/start.$(OBJEXT) + $(INSTALL_DATA) $< $@ + +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT) + +all-local: $(ARCH) $(OBJS) $(ARCH)/start.$(OBJEXT) $(TMPINSTALL_FILES) + +.PRECIOUS: $(ARCH)/start.$(OBJEXT) + +EXTRA_DIST = start.S + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/startup/.cvsignore b/c/src/lib/libbsp/sparc/leon2/startup/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/startup/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/startup/Makefile.am b/c/src/lib/libbsp/sparc/leon2/startup/Makefile.am new file mode 100644 index 0000000000..131b748a79 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/startup/Makefile.am @@ -0,0 +1,45 @@ +## +## $Id$ +## + + +VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared + +PGM = $(ARCH)/startup.rel + +C_FILES = bspclean.c bsplibc.c bsppost.c bspstart.c main.c bootcard.c sbrk.c \ + setvec.c spurious.c +C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.$(OBJEXT)) + +S_FILES = +S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.$(OBJEXT)) + +OBJS = $(C_O_FILES) $(S_O_FILES) + +include $(top_srcdir)/../../../../../../automake/compile.am +include $(top_srcdir)/../../../../../../automake/lib.am + +# +# (OPTIONAL) Add local stuff here using += +# + +# USE_INIT_FINI tells main.c what C++ help we need. +AM_CPPFLAGS += -DUSE_INIT_FINI + +$(PGM): $(OBJS) + $(make-rel) + +bsplib_DATA = linkcmds + +$(PROJECT_RELEASE)/lib/linkcmds: linkcmds + $(INSTALL_DATA) $< $@ + +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/linkcmds + +all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = linkcmds setvec.c spurious.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/startup/linkcmds b/c/src/lib/libbsp/sparc/leon2/startup/linkcmds new file mode 100644 index 0000000000..4e4f06f2a6 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/startup/linkcmds @@ -0,0 +1,184 @@ +/* linkcmds + * + * $Id$ + */ + +OUTPUT_ARCH(sparc) +__DYNAMIC = 0; + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _endtext | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + + +/* + * User modifiable values: + * + * _CLOCK_SPEED in Mhz (used to program the counter/timers) + * + * _PROM_SIZE size of PROM (permissible values are 128K, 256K, + * 512K, 1M, 2M, 4M, 8M and 16M) + * _RAM_SIZE size of RAM (permissible values are 256K, 512K, + * 1M, 2M, 4M, 8M, 16M, and 32M) + * + */ + +/* Default values, can be overridden */ + +_PROM_SIZE = 2M; +_RAM_SIZE = 4M; + +_RAM_START = 0x40000000; +_RAM_END = _RAM_START + _RAM_SIZE; + +_PROM_START = 0x00000000; +_PROM_END = _PROM_START + _PROM_SIZE; + +/* + * Alternate names without leading _. + */ + +PROM_START = _PROM_START; +PROM_SIZE = _PROM_SIZE; +PROM_END = _PROM_END; + +RAM_START = _RAM_START; +RAM_SIZE = _RAM_SIZE; +RAM_END = _RAM_END; + +/* + * Base address of the on-CPU peripherals + */ + +_LEON_REG = 0x80000000; +LEON_REG = 0x80000000; + +/* these are the maximum values */ + +MEMORY +{ + rom : ORIGIN = 0x00000000, LENGTH = 256M + ram : ORIGIN = 0x40000000, LENGTH = 1024M +} + +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + CREATE_OBJECT_SYMBOLS + text_start = .; + _text_start = .; + *(.text) + . = ALIGN (16); + + /* + * Special FreeBSD sysctl sections. + */ + . = ALIGN (16); + __start_set_sysctl_set = .; + *(set_sysctl_*); + __stop_set_sysctl_set = ABSOLUTE(.); + *(set_domain_*); + *(set_pseudo_*); + + *(.eh_frame) + . = ALIGN (16); + + *(.gnu.linkonce.t*) + + /* + * C++ constructors + */ + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + + _rodata_start = . ; + *(.rodata*) + *(.gnu.linkonce.r*) + _erodata = ALIGN( 0x10 ) ; + + etext = ALIGN(0x10); + _etext = .; + *(.init) + *(.fini) + *(.lit) + *(.shdata) + . = ALIGN (16); + _endtext = .; + } > ram + .data : + { + data_start = .; + _data_start = .; + _sdata = . ; + *(.data) + *(.gnu.linkonce.d*) + *(.gcc_except_table) + . = ALIGN(0x10); + edata = .; + _edata = .; + } > ram + .dynamic : { *(.dynamic) } >ram + .jcr : { *(.jcr) } >ram + .got : { *(.got) } >ram + .plt : { *(.plt) } >ram + .hash : { *(.hash) } >ram + .dynrel : { *(.dynrel) } >ram + .dynsym : { *(.dynsym) } >ram + .dynstr : { *(.dynstr) } >ram + .hash : { *(.hash) } >ram + .shbss : + { + *(.shbss) + } > ram + .bss : + { + __bss_start = ALIGN(0x8); + _bss_start = .; + bss_start = .; + *(.bss) + *(COMMON) + end = .; + _end = ALIGN(0x8); + __end = ALIGN(0x8); + } > ram + .stab . (NOLOAD) : + { + [ .stab ] + } + .stabstr . (NOLOAD) : + { + [ .stabstr ] + } +} diff --git a/c/src/lib/libbsp/sparc/leon2/startup/setvec.c b/c/src/lib/libbsp/sparc/leon2/startup/setvec.c new file mode 100644 index 0000000000..e0887026ac --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/startup/setvec.c @@ -0,0 +1,71 @@ +/* set_vector + * + * This routine installs an interrupt vector on the SPARC simulator. + * + * INPUT PARAMETERS: + * handler - interrupt handler entry point + * vector - vector number + * type - 0 indicates raw hardware connect + * 1 indicates RTEMS interrupt connect + * + * OUTPUT PARAMETERS: NONE + * + * RETURNS: + * address of previous interrupt handler + * + * COPYRIGHT (c) 1989-1998. + * 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. + * + * Ported to LEON implementation of the SPARC by On-Line Applications + * Research Corporation (OAR) under contract to the European Space + * Agency (ESA). + * + * LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995. + * European Space Agency. + * + * $Id$ + */ + +#include + +rtems_isr_entry set_vector( /* returns old vector */ + rtems_isr_entry handler, /* isr routine */ + rtems_vector_number vector, /* vector number */ + int type /* RTEMS or RAW intr */ +) +{ + rtems_isr_entry previous_isr; + unsigned32 real_trap; + unsigned32 source; + + if ( type ) + rtems_interrupt_catch( handler, vector, &previous_isr ); + else + _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr ); + + real_trap = SPARC_REAL_TRAP_NUMBER( vector ); + + if ( LEON_INT_TRAP( real_trap ) ) { + + source = LEON_TRAP_SOURCE( real_trap ); + + LEON_Clear_interrupt( source ); + LEON_Unmask_interrupt( source ); + } + + return previous_isr; +} + +/* LEON specific power-down function */ + +void _CPU_Thread_Idle_body( void ) +{ + while (1) { + 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/leon2/startup/spurious.c b/c/src/lib/libbsp/sparc/leon2/startup/spurious.c new file mode 100644 index 0000000000..8dc9a6f407 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/startup/spurious.c @@ -0,0 +1,177 @@ +/* + * LEON Spurious Trap Handler + * + * This is just enough of a trap handler to let us know what + * the likely source of the trap was. + * + * Developed as part of the port of RTEMS to the LEON implementation + * of the SPARC by On-Line Applications Research Corporation (OAR) + * under contract to the European Space Agency (ESA). + * + * COPYRIGHT (c) 1995. European Space Agency. + * + * This terms of the RTEMS license apply to this file. + * + * $Id$ + */ + +#include + +#include + +static const char digits[16] = "0123456789abcdef"; + +/* Simple integer-to-string conversion */ + +void itos(unsigned32 u, char *s) +{ + int i; + + for (i=0; i<8; i++) { + s[i] = digits[(u >> (28 - (i*4))) & 0x0f]; + } +} + +/* + * bsp_spurious_handler + * + * Print a message on the debug console and then die + */ + +rtems_isr bsp_spurious_handler( + rtems_vector_number trap, + CPU_Interrupt_frame *isf +) +{ + char line[ 80 ]; + rtems_unsigned32 real_trap; + + real_trap = SPARC_REAL_TRAP_NUMBER(trap); + + strcpy(line, "Unexpected trap (0x ) at address 0x "); + line[ 19 ] = digits[ real_trap >> 4 ]; + line[ 20 ] = digits[ real_trap & 0xf ]; + itos(isf->tpc, &line[36]); + DEBUG_puts( line ); + + switch (real_trap) { + + /* + * First the ones defined by the basic architecture + */ + + case 0x00: + DEBUG_puts( "reset" ); + break; + case 0x01: + DEBUG_puts( "instruction access exception" ); + break; + case 0x02: + DEBUG_puts( "illegal instruction" ); + break; + case 0x03: + DEBUG_puts( "privileged instruction" ); + break; + case 0x04: + DEBUG_puts( "fp disabled" ); + break; + case 0x07: + DEBUG_puts( "memory address not aligned" ); + break; + case 0x08: + DEBUG_puts( "fp exception" ); + break; + case 0x09: + strcpy(line, "data access exception at 0x " ); + itos(LEON_REG.Failed_Address, &line[27]); + DEBUG_puts( line ); + break; + case 0x0A: + DEBUG_puts( "tag overflow" ); + break; + + /* + * Then the ones defined by the LEON in particular + */ + + case LEON_TRAP_TYPE( LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR ): + DEBUG_puts( "LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_UART_2_RX_TX ): + DEBUG_puts( "LEON_INTERRUPT_UART_2_RX_TX" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_UART_1_RX_TX ): + DEBUG_puts( "LEON_INTERRUPT_UART_1_RX_TX" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_0 ): + DEBUG_puts( "LEON_INTERRUPT_EXTERNAL_0" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_1 ): + DEBUG_puts( "LEON_INTERRUPT_EXTERNAL_1" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_2 ): + DEBUG_puts( "LEON_INTERRUPT_EXTERNAL_2" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_3 ): + DEBUG_puts( "LEON_INTERRUPT_EXTERNAL_3" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER1 ): + DEBUG_puts( "LEON_INTERRUPT_TIMER1" ); + break; + case LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER2 ): + DEBUG_puts( "LEON_INTERRUPT_TIMER2" ); + break; + + default: + break; + } + + /* + * What else can we do but stop ... + */ + + asm volatile( "mov 1, %g1; ta 0x0" ); +} + +/* + * bsp_spurious_initialize + * + * Install the spurious handler for most traps. Note that set_vector() + * will unmask the corresponding asynchronous interrupt, so the initial + * interrupt mask is restored after the handlers are installed. + */ + +void bsp_spurious_initialize() +{ + rtems_unsigned32 trap; + unsigned32 level; + unsigned32 mask; + + level = sparc_disable_interrupts(); + mask = LEON_REG.Interrupt_Mask; + + for ( trap=0 ; trap<256 ; trap++ ) { + + /* + * Skip window overflow, underflow, and flush as well as software + * trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f + * which cannot happen and where some of the space is used to pass + * paramaters to the program. + */ + + if (( trap == 5 || trap == 6 ) || + (( trap >= 0x11 ) && ( trap <= 0x1f )) || + (( trap >= 0x70 ) && ( trap <= 0x83 ))) + continue; + + set_vector( + (rtems_isr_entry) bsp_spurious_handler, + SPARC_SYNCHRONOUS_TRAP( trap ), + 1 + ); + } + + LEON_REG.Interrupt_Mask = mask; + sparc_enable_interrupts(level); + +} diff --git a/c/src/lib/libbsp/sparc/leon2/timer/.cvsignore b/c/src/lib/libbsp/sparc/leon2/timer/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/timer/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/timer/Makefile.am b/c/src/lib/libbsp/sparc/leon2/timer/Makefile.am new file mode 100644 index 0000000000..0e51a50a0a --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/timer/Makefile.am @@ -0,0 +1,31 @@ +## +## $Id$ +## + + +PGM = $(ARCH)/timer.rel + +C_FILES = timer.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 += +# + +$(PGM): $(OBJS) + $(make-rel) + +# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile + +all-local: $(ARCH) $(OBJS) $(PGM) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = timer.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sparc/leon2/timer/timer.c b/c/src/lib/libbsp/sparc/leon2/timer/timer.c new file mode 100644 index 0000000000..0aae14362d --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/timer/timer.c @@ -0,0 +1,83 @@ +/* timer.c + * + * This file implements a benchmark timer using timer 2. + * + * COPYRIGHT (c) 1989-1998. + * 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. + * + * Ported to LEON implementation of the SPARC by On-Line Applications + * Research Corporation (OAR) under contract to the European Space + * Agency (ESA). + * + * LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995. + * European Space Agency. + * + * $Id$ + */ + + +#include + +rtems_boolean Timer_driver_Find_average_overhead; + +rtems_boolean Timer_driver_Is_initialized = FALSE; + +void Timer_initialize() +{ + /* + * Timer runs long and accurate enough not to require an interrupt. + */ + + if ( Timer_driver_Is_initialized == FALSE ) { + + /* approximately 1 us per countdown */ + LEON_REG.Timer_Counter_2 = 0xffffff; + LEON_REG.Timer_Reload_2 = 0xffffff; + + } else { + Timer_driver_Is_initialized = TRUE; + } + + LEON_REG.Timer_Control_2 = ( + LEON_REG_TIMER_COUNTER_ENABLE_COUNTING | + LEON_REG_TIMER_COUNTER_LOAD_COUNTER + ); + +} + +#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */ + /* to start/stop the timer. */ +#define LEAST_VALID 2 /* Don't trust a value lower than this */ + +int Read_timer() +{ + rtems_unsigned32 total; + + total = LEON_REG.Timer_Counter_2; + + total = 0xffffff - total; + + if ( Timer_driver_Find_average_overhead == 1 ) + return total; /* in one microsecond units */ + + if ( total < LEAST_VALID ) + return 0; /* below timer resolution */ + + return total - AVG_OVERHEAD; +} + +rtems_status_code Empty_function( void ) +{ + return RTEMS_SUCCESSFUL; +} + +void Set_find_average_overhead( + rtems_boolean find_flag +) +{ + Timer_driver_Find_average_overhead = find_flag; +} diff --git a/c/src/lib/libbsp/sparc/leon2/times b/c/src/lib/libbsp/sparc/leon2/times new file mode 100644 index 0000000000..1b04728a25 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/times @@ -0,0 +1,193 @@ +# +# Timing Test Suite Results for the SPARC Instruction Simulator BSP +# +# NOTE: The ERC32 is derived from the Cypress 601/602 chip set. +# +# $Id$ +# + +Board: SPARC Instruction Simulator v1.8 +CPU: include coprocessor if applicable +Clock Speed: 15 Mhz +Memory Configuration: +Wait States: 0 + +Times Reported in: microseconds +Timer Source: on-CPU General Purpose Count Down Timer + +Column A: 3.5.1 pre-release +Column B: unused + +# DESCRIPTION A B +== ================================================================= ==== ==== + 1 rtems_semaphore_create 20 + rtems_semaphore_delete 21 + rtems_semaphore_obtain: available 15 + rtems_semaphore_obtain: not available -- NO_WAIT 15 + rtems_semaphore_release: no waiting tasks 16 + + 2 rtems_semaphore_obtain: not available -- caller blocks 62 + + 3 rtems_semaphore_release: task readied -- preempts caller 55 + + 4 rtems_task_restart: blocked task -- preempts caller 77 + rtems_task_restart: ready task -- preempts caller 70 + rtems_semaphore_release: task readied -- returns to caller 25 + rtems_task_create 57 + rtems_task_start 31 + rtems_task_restart: suspended task -- returns to caller 36 + rtems_task_delete: suspended task 47 + rtems_task_restart: ready task -- returns to caller 37 + rtems_task_restart: blocked task -- returns to caller 46 + rtems_task_delete: blocked task 50 + + 5 rtems_task_suspend: calling task 51 + rtems_task_resume: task readied -- preempts caller 49 + + 6 rtems_task_restart: calling task 59 + rtems_task_suspend: returns to caller 18 + rtems_task_resume: task readied -- returns to caller 19 + rtems_task_delete: ready task 50 + + 7 rtems_task_restart: suspended task -- preempts caller 70 + + 8 rtems_task_set_priority: obtain current priority 12 + rtems_task_set_priority: returns to caller 27 + rtems_task_mode: obtain current mode 5 + rtems_task_mode: no reschedule 5 + rtems_task_mode: reschedule -- returns to caller 8 + rtems_task_mode: reschedule -- preempts caller 39 + rtems_task_set_note 13 + rtems_task_get_note 13 + rtems_clock_set 33 + rtems_clock_get 3 + + 9 rtems_message_queue_create 110 + rtems_message_queue_send: no waiting tasks 37 + rtems_message_queue_urgent: no waiting tasks 37 + rtems_message_queue_receive: available 31 + rtems_message_queue_flush: no messages flushed 12 + rtems_message_queue_flush: messages flushed 16 + rtems_message_queue_delete 26 + +10 rtems_message_queue_receive: not available -- NO_WAIT 15 + rtems_message_queue_receive: not available -- caller blocks 62 + +11 rtems_message_queue_send: task readied -- preempts caller 72 + +12 rtems_message_queue_send: task readied -- returns to caller 39 + +13 rtems_message_queue_urgent: task readied -- preempts caller 72 + +14 rtems_message_queue_urgent: task readied -- returns to caller 39 + +15 rtems_event_receive: obtain current events 1 + rtems_event_receive: not available -- NO_WAIT 12 + rtems_event_receive: not available -- caller blocks 56 + rtems_event_send: no task readied 12 + rtems_event_receive: available 12 + rtems_event_send: task readied -- returns to caller 24 + +16 rtems_event_send: task readied -- preempts caller 55 + +17 rtems_task_set_priority: preempts caller 62 + +18 rtems_task_delete: calling task 83 + +19 rtems_signal_catch 9 + rtems_signal_send: returns to caller 15 + rtems_signal_send: signal to self 18 + exit ASR overhead: returns to calling task 22 + exit ASR overhead: returns to preempting task 49 + +20 rtems_partition_create 35 + rtems_region_create 23 + rtems_partition_get_buffer: available 15 + rtems_partition_get_buffer: not available 13 + rtems_partition_return_buffer 18 + rtems_partition_delete 16 + rtems_region_get_segment: available 22 + rtems_region_get_segment: not available -- NO_WAIT 21 + rtems_region_return_segment: no waiting tasks 19 + rtems_region_get_segment: not available -- caller blocks 64 + rtems_region_return_segment: task readied -- preempts caller 74 + rtems_region_return_segment: task readied -- returns to caller 44 + rtems_region_delete 16 + rtems_io_initialize 2 + rtems_io_open 1 + rtems_io_close 1 + rtems_io_read 1 + rtems_io_write 1 + rtems_io_control 1 + +21 rtems_task_ident 149 + rtems_message_queue_ident 145 + rtems_semaphore_ident 156 + rtems_partition_ident 145 + rtems_region_ident 148 + rtems_port_ident 145 + rtems_timer_ident 145 + rtems_rate_monotonic_ident 145 + +22 rtems_message_queue_broadcast: task readied -- returns to caller 42 + rtems_message_queue_broadcast: no waiting tasks 17 + rtems_message_queue_broadcast: task readied -- preempts caller 78 + +23 rtems_timer_create 14 + rtems_timer_fire_after: inactive 22 + rtems_timer_fire_after: active 24 + rtems_timer_cancel: active 15 + rtems_timer_cancel: inactive 13 + rtems_timer_reset: inactive 21 + rtems_timer_reset: active 23 + rtems_timer_fire_when: inactive 34 + rtems_timer_fire_when: active 34 + rtems_timer_delete: active 19 + rtems_timer_delete: inactive 17 + rtems_task_wake_when 69 + +24 rtems_task_wake_after: yield -- returns to caller 9 + rtems_task_wake_after: yields -- preempts caller 45 + +25 rtems_clock_tick 4 + +26 _ISR_Disable 0 + _ISR_Flash 1 + _ISR_Enable 1 + _Thread_Disable_dispatch 0 + _Thread_Enable_dispatch 7 + _Thread_Set_state 11 + _Thread_Disptach (NO FP) 31 + context switch: no floating point contexts 21 + context switch: self 10 + context switch: to another task 10 + context switch: restore 1st FP task 25 + fp context switch: save idle, restore idle 31 + fp context switch: save idle, restore initialized 19 + fp context switch: save initialized, restore initialized 20 + _Thread_Resume 7 + _Thread_Unblock 7 + _Thread_Ready 9 + _Thread_Get 4 + _Semaphore_Get 2 + _Thread_Get: invalid id 0 + +27 interrupt entry overhead: returns to interrupted task 6 + interrupt exit overhead: returns to interrupted task 6 + interrupt entry overhead: returns to nested interrupt 6 + interrupt exit overhead: returns to nested interrupt 5 + interrupt entry overhead: returns to preempting task 7 + interrupt exit overhead: returns to preempting task 36 + +28 rtems_port_create 16 + rtems_port_external_to_internal 11 + rtems_port_internal_to_external 11 + rtems_port_delete 16 + +29 rtems_rate_monotonic_create 15 + rtems_rate_monotonic_period: initiate period -- returns to caller 21 + rtems_rate_monotonic_period: obtain status 13 + rtems_rate_monotonic_cancel 16 + rtems_rate_monotonic_delete: inactive 18 + rtems_rate_monotonic_delete: active 20 + rtems_rate_monotonic_period: conclude periods -- caller blocks 53 diff --git a/c/src/lib/libbsp/sparc/leon2/tools/.cvsignore b/c/src/lib/libbsp/sparc/leon2/tools/.cvsignore new file mode 100644 index 0000000000..43dd2ee260 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/tools/.cvsignore @@ -0,0 +1,15 @@ +aclocal.m4 +autom4te*.cache +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +Makefile +Makefile.in +missing +mkinstalldirs +runtest diff --git a/c/src/lib/libbsp/sparc/leon2/tools/ChangeLog b/c/src/lib/libbsp/sparc/leon2/tools/ChangeLog new file mode 100644 index 0000000000..073ba2ce55 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/tools/ChangeLog @@ -0,0 +1,52 @@ +2003-08-14 Joel Sherrill + + * runtest.in: Add fileio to list of interactive tests. + +2003-08-11 Ralf Corsepius + + * configure.ac: Use rtems-bugs@rtems.com as bug report email address. + +2003-03-06 Ralf Corsepius + + * configure.ac: Remove AC_CONFIG_AUX_DIR. + +2003-02-11 Ralf Corsepius + + * configure.ac: AM_INIT_AUTOMAKE([1.7.2]). + +2003-02-11 Ralf Corsepius + + * configure.ac: AC_PREREQ(2.57). + +2002-10-21 Ralf Corsepius + + * .cvsignore: Reformat. + Add autom4te*cache. + Remove autom4te.cache. + +2002-07-26 Ralf Corsepius + + * Makefile.am: Add transform and bsptools_bindir hacks. + * configure.ac: Add RTEMS_ENV_RTEMSBSP. + +2002-03-27 Ralf Corsepius + + * configure.ac: + AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS). + AM_INIT_AUTOMAKE([no-define foreign 1.6]). + * Makefile.am: Remove AUTOMAKE_OPTIONS. + +2001-10-11 Ralf Corsepius + + * .cvsignore: Add autom4te.cache for autoconf > 2.52. + * configure.in: Remove. + * configure.ac: New file, generated from configure.in by autoupdate. + +2001-09-27 Ralf Corsepius + + * Makefile.am: Use 'TMPINSTALL_FILES ='. + +2001-09-14 Joel Sherrill + + * ChangeLog: New file. + diff --git a/c/src/lib/libbsp/sparc/leon2/tools/Makefile.am b/c/src/lib/libbsp/sparc/leon2/tools/Makefile.am new file mode 100644 index 0000000000..54b520f8d5 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/tools/Makefile.am @@ -0,0 +1,22 @@ +## +## $Id$ +## + +ACLOCAL_AMFLAGS = -I ../../../../../../../aclocal + +transform = +bsptools_bindir = ${exec_prefix}/@RTEMS_BSP@/tests +bsptools_bin_SCRIPTS = runtest + +TMPINSTALL_FILES = $(PROJECT_ROOT)/leon/tests \ + $(PROJECT_ROOT)/leon/tests/runtest + +$(PROJECT_ROOT)/leon/tests: + $(mkinstalldirs) $@ + +$(PROJECT_ROOT)/leon/tests/runtest: runtest + $(INSTALL_SCRIPT) $< $@ + +all-local: $(TMPINSTALL_FILES) + +include $(top_srcdir)/../../../../../../../automake/host.am diff --git a/c/src/lib/libbsp/sparc/leon2/tools/configure.ac b/c/src/lib/libbsp/sparc/leon2/tools/configure.ac new file mode 100644 index 0000000000..887c68ec5c --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/tools/configure.ac @@ -0,0 +1,25 @@ +## Process this file with autoconf to produce a configure script. +## +## $Id$ + +AC_PREREQ(2.57) +AC_INIT([rtems-c-src-lib-libbsp-sparc-leon-tools],[_RTEMS_VERSION],[rtems-bugs@rtems.com]) +AC_CONFIG_SRCDIR([runtest.in]) +RTEMS_TOP(../../../../../../..) + +RTEMS_CANONICAL_TARGET_CPU + +AM_INIT_AUTOMAKE([no-define foreign 1.7.2]) +AM_MAINTAINER_MODE + +RTEMS_ENV_RTEMSBSP + +RTEMS_PATH_KSH + +RTEMS_PROJECT_ROOT +RTEMS_TOOLPATHS + +# Explicitly list all Makefiles here +AC_CONFIG_FILES([Makefile +runtest]) +AC_OUTPUT diff --git a/c/src/lib/libbsp/sparc/leon2/tools/runtest.in b/c/src/lib/libbsp/sparc/leon2/tools/runtest.in new file mode 100644 index 0000000000..7a8e3ac3c0 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/tools/runtest.in @@ -0,0 +1,312 @@ +#!@KSH@ -p +# +# $Id$ +# +# Run rtems tests on the hppa simulator +# This program generates a simulator script to run each test +# Typically the test is then run, although it can be generated +# and left as a file using -s +# + +# progname=`basename $0` +progname=${0##*/} # fast basename hack for ksh, bash + +USAGE=\ +"usage: $progname [ -opts ] test [ test ... ] + -o options -- specify options to be passed to simulator + -v -- verbose + -s -- generate script file (as 'test'.ss) and exit + -l logdir -- specify log directory (default is 'logdir') + + Specify test as 'test' or 'test.exe'. + All multiprocessing tests *must* be specified simply as 'mp01', etc. +" + +# export everything +set -a + +# log an error to stderr +prerr() +{ + echo "$*" >&2 +} + +fatal() { + [ "$1" ] && prerr $* + prerr "$USAGE" + exit 1 +} + +warn() { + [ "$1" ] && prerr $* +} + +# print args, 1 per line +ml_echo() +{ + for l + do + echo "$l" + done +} + +# run at normal and signalled exit +test_exit() +{ + exit_code=$1 + + rm -f ${statfile}* ${scriptfile}* ${logfile}.tmp* + [ "$sim_pid" ] && kill -9 $sim_pid + + exit $exit_code +} + +# +# process the options +# +# defaults for getopt vars +# +# max_run_time is defaulted to 5 minutes +# + +verbose="" +extra_options="" +script_and_exit="" +stdio_setup="yes" +run_to_completion="yes" +logdir=log +update_on_tick="no" +max_run_time=$((5 * 60)) +using_print_buffer="yes" + +while getopts vhr12o:c:sl:t OPT +do + case "$OPT" in + v) + verbose="yes";; + s) + script_and_exit="yes" + run_to_completion="no" + stdio_setup="no";; + l) + logdir="$OPTARG";; + o) + extra_options="$OPTARG";; + *) + fatal;; + esac +done + +let $((shiftcount = $OPTIND - 1)) +shift $shiftcount + +args=$* + +# +# Run the tests +# + +tests="$args" +if [ ! "$tests" ] +then + set -- `echo *.exe` + tests="$*" +fi + +[ -d $logdir ] || + mkdir $logdir || fatal "could not create log directory ($logdir)" + +cpus=1 + +# where the tmp files go +statfile=/tmp/stats$$ +scriptfile=/tmp/script$$ + +trap "test_exit" 1 2 3 13 14 15 + +for tfile in $tests +do + + tname=`basename $tfile .exe` + TEST_TYPE="single" + + case $tname in + monitor* | termios* | fileio*) + if [ $run_to_completion = "yes" ] + then + warn "Skipping $tname; it is interactive" + continue + fi + ;; + *-node2*) + fatal "MP tests not supported" + warn "Skipping $tname; 'runtest' runs both nodes when for *-node1" + continue;; + *-node1*) + warn "Running both nodes associated with $tname" + variant=`echo $tname | sed 's/.*-node[12]//' | sed 's/\.exe//'` + tname=`echo $tname | sed 's/-node.*//'` + TEST_TYPE="mp" + ;; + minimum*|stackchk*|spfatal*|termio*) + warn "Skipping $tname; it locks up or takes a VERY long time to run" + continue + ;; + esac + + # Change the title bar to indicate which test we are running + # The simulator screen doesn't provide any indication + + logfile=$logdir/$tname + infofile=$logfile.info + + rm -f ${statfile}* ${scriptfile}* ${logfile}.tmp* + + date=`date` + echo "Starting $tname at $date" + + # Generate a script file to get the work done. + # The script file must do the following: + # + # load the program (programs if MP test) + # arrange for capture of output + # run the program + # produce statistics + + { + case $TEST_TYPE in + "mp") + fatal "MP tests not supported" + ;; + + # All other tests (single-processor) + *) + echo "load $tfile" + echo "go 0x02000000" + echo "" + echo "perf" + echo "quit" + ;; + esac + + } > ${scriptfile} + + if [ "$script_and_exit" = "yes" ] + then + mv ${scriptfile} $tname.ss + warn "script left in $tname.ss" + test_exit 0 + fi + + # Spin off the simulator in the background + sparc-rtems-sis $extra_options -c ${scriptfile} >${logfile}.tmp & + sim_pid=$! + + # Make sure it won't run forever... + { + time_run=0 + while [ $time_run -lt $max_run_time ] + do + # sleep 10s at a time waiting for job to finish or timer to expire + # if job has exited, then we exit, too. + sleep 10 + if kill -0 $sim_pid 2>/dev/null + then + time_run=$((time_run + 10)) + else + exit 0 + fi + done + + kill -2 $sim_pid 2>/dev/null + { sleep 5; kill -9 $sim_pid 2>/dev/null; } & + } & + + wait $sim_pid + status=$? + if [ $status -ne 0 ] + then + ran_too_long="yes" + else + ran_too_long="no" + fi + + sim_pid="" + + # fix up the printf output from the test + case $TEST_TYPE in + mp) + fatal "MP not supported" + ;; + *) + output_it=1 + sed -e '1,9d' \ + -e 's/ //' -e '/^$/d' < ${logfile}.tmp | + while read line + do + if [ $output_it -eq 1 ] ; then + if [ "$line" = "sis> perf" ] ; then + output_it=0 + elif [ "$line" = "sis> quit" ] ; then + output_it=0 + elif [ "$line" = "sis>" ] ; then + output_it=0 + else + echo "$line" + fi + fi + done > ${logfile}_1 + ;; + esac + + # Create the info files + for cpu in $cpus + do + { + echo "$date" + echo "Test run on: `uname -n` ( `uname -a` )" + + output_it=0 + sed -e 's/ //' < ${logfile}.tmp | + while read line + do + if [ $output_it -eq 1 ] ; then + if [ "$line" = "sis> quit" ] ; then + output_it=0 + else + echo "$line" + fi + else + if [ "$line" = "sis> perf" ] ; then + output_it=1 + fi + fi + done + + + if [ "$ran_too_long" = "yes" ] + then + echo "Test did NOT finish normally; killed after $max_run_time seconds" + fi + + echo + date; + } > ${infofile}_$cpu + done + + rm -f ${logfile}.tmp* + + if [ "$cpus" = "1" ] + then + mv ${infofile}_1 ${infofile} + mv ${logfile}_1 ${logfile} + fi + +done + +test_exit 0 + +# Local Variables: *** +# mode:ksh *** +# End: *** + diff --git a/c/src/lib/libbsp/sparc/leon2/wrapup/.cvsignore b/c/src/lib/libbsp/sparc/leon2/wrapup/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/wrapup/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/sparc/leon2/wrapup/Makefile.am b/c/src/lib/libbsp/sparc/leon2/wrapup/Makefile.am new file mode 100644 index 0000000000..515a76e7cc --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon2/wrapup/Makefile.am @@ -0,0 +1,31 @@ +## +## $Id$ +## + +# We only build the networking device driver if HAS_NETWORKING was defined +if HAS_NETWORKING +NETWORKING_DRIVER = leon_open_eth leon_smc91111 +endif + +BSP_PIECES = startup amba console clock timer gnatsupp $(NETWORKING_DRIVER) +# pieces to pick up out of libcpu/sparc +CPU_PIECES = cache reg_win syscall + +# bummer; have to use $foreach since % pattern subst rules only replace 1x +OBJS = $(foreach piece, $(BSP_PIECES), $(wildcard ../$(piece)/$(ARCH)/*.$(OBJEXT))) \ + $(foreach piece, $(CPU_PIECES), ../../../../libcpu/$(RTEMS_CPU)/$(piece)/$(ARCH)/*.$(OBJEXT)) +LIB = $(ARCH)/libbsp.a + +include $(top_srcdir)/../../../../../../automake/compile.am +include $(top_srcdir)/../../../../../../automake/lib.am + +# +# (OPTIONAL) Add local stuff here using += +# + +$(LIB): $(OBJS) + $(make-library) + +all-local: $(ARCH) $(LIB) + +include $(top_srcdir)/../../../../../../automake/local.am -- cgit v1.2.3