2002-11-13 Jay Monkman <jtm@smoothsmoothie.com>

* New BSP.
	* .cvsignore, ChangeLog, Makefile.am, bsp_specs, configure.ac, README,
	times, clock/.cvsignore, clock/Makefile.am, clock/clockdrv.c,
	console/.cvsignore, console/Makefile.am, console/uart.c,
	include/.cvsignore, include/Makefile.am, include/bsp.h,
	include/ep7312.h, irq/.cvsignore, irq/Makefile.am, irq/bsp_irq_asm.S,
	irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, network/Makefile.am,
	network/network.c, start/.cvsignore, start/Makefile.am,
	start/start.S, startup/.cvsignore, startup/Makefile.am,
	startup/bspstart.c, startup/exit.c, startup/linkcmds,
	timer/.cvsignore, timer/Makefile.am, timer/timer.c,
	wrapup/.cvsignore, wrapup/Makefile.am: New file.
This commit is contained in:
Joel Sherrill
2002-11-13 17:55:09 +00:00
parent 87b721f5ed
commit 3d6669ccf7
38 changed files with 2821 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,15 @@
2002-11-13 Jay Monkman <jtm@smoothsmoothie.com>
* New BSP.
* .cvsignore, ChangeLog, Makefile.am, bsp_specs, configure.ac, README,
times, clock/.cvsignore, clock/Makefile.am, clock/clockdrv.c,
console/.cvsignore, console/Makefile.am, console/uart.c,
include/.cvsignore, include/Makefile.am, include/bsp.h,
include/ep7312.h, irq/.cvsignore, irq/Makefile.am, irq/bsp_irq_asm.S,
irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, network/Makefile.am,
network/network.c, start/.cvsignore, start/Makefile.am,
start/start.S, startup/.cvsignore, startup/Makefile.am,
startup/bspstart.c, startup/exit.c, startup/linkcmds,
timer/.cvsignore, timer/Makefile.am, timer/timer.c,
wrapup/.cvsignore, wrapup/Makefile.am: New file.

View File

@@ -0,0 +1,16 @@
##
## $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 clock console irq startup timer start network wrapup
include $(top_srcdir)/../../bsp.am
EXTRA_DIST = bsp_specs
include $(top_srcdir)/../../../../../../automake/subdirs.am
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,5 @@
#
# $Id$
#
This board is from Cogent.

View File

@@ -0,0 +1,23 @@
%rename cpp old_cpp
%rename lib old_lib
%rename endfile old_endfile
%rename startfile old_startfile
%rename link old_link
*cpp:
%(old_cpp) %{qrtems: -D__embedded__ -DUSE_ENHANCED_INTR_API} -Asystem(embedded)
*lib:
%{!qrtems: %(old_lib)} %{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)} %{qrtems: \
%{!qrtems_debug: start.o%s crtbegin.o%s} \
%{qrtems_debug: start_g.o%s crtbegin.o%s}}
*link:
%{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -N -e _start}

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,31 @@
##
## $Id$
##
PGM = $(ARCH)/clock.rel
C_FILES = clockdrv.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
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

View File

@@ -0,0 +1,78 @@
/*
* Cirrus EP7312 Clock driver
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#include <rtems.h>
#include <ep7312.h>
#include <bsp.h>
#include <irq.h>
rtems_isr clock_isr(rtems_vector_number vector);
rtems_isr Clock_isr(rtems_vector_number vector);
static void clock_isr_on(const rtems_irq_connect_data *unused);
static void clock_isr_off(const rtems_irq_connect_data *unused);
static int clock_isr_is_on(const rtems_irq_connect_data *irq);
rtems_irq_connect_data clock_isr_data = {BSP_TC1OI,
(rtems_irq_hdl)Clock_isr,
clock_isr_on,
clock_isr_off,
clock_isr_is_on,
3,
0 };
#define CLOCK_VECTOR 0
#define Clock_driver_support_at_tick() \
do { \
*EP7312_TC1EOI = 0xffffffff; \
} while(0)
#define Clock_driver_support_install_isr( _new, _old ) \
do { \
BSP_install_rtems_irq_handler(&clock_isr_data); \
} while(0)
/*
* Set up the clock hardware
*/
#define Clock_driver_support_initialize_hardware() \
do { \
*EP7312_SYSCON1 |= EP7312_SYSCON1_TC1_PRESCALE; \
*EP7312_TC1D =(BSP_Configuration.microseconds_per_tick * 2000)/1000000; \
*EP7312_TC1EOI = 0xFFFFFFFF; \
} while (0)
#define Clock_driver_support_shutdown_hardware() \
do { \
BSP_remove_rtems_irq_handler(&clock_isr_data); \
} while (0)
static void clock_isr_on(const rtems_irq_connect_data *unused)
{
return;
}
static void clock_isr_off(const rtems_irq_connect_data *unused)
{
return;
}
static int clock_isr_is_on(const rtems_irq_connect_data *irq)
{
return 1;
}
#include "../../../shared/clockdrv_shell.c"

View File

@@ -0,0 +1,31 @@
## Process this file with autoconf to produce a configure script.
##
## $Id$
AC_PREREQ(2.52)
AC_INIT([rtems-c-src-lib-libbsp-arm-edb7312],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com])
AC_CONFIG_SRCDIR([bsp_specs])
RTEMS_TOP(../../../../../..)
AC_CONFIG_AUX_DIR(../../../../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define foreign 1.6])
RTEMS_BSP_CONFIGURE
RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
RTEMS_CANONICALIZE_TOOLS
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
clock/Makefile
console/Makefile
include/Makefile
irq/Makefile
start/Makefile
startup/Makefile
timer/Makefile
network/Makefile
wrapup/Makefile])
AC_OUTPUT

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,35 @@
##
## $Id$
##
VPATH = @srcdir@:@srcdir@/../../shared/io:@srcdir@/../../../shared
PGM = $(ARCH)/console.rel
C_FILES = uart.c console.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/compile.am
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
AM_CPPFLAGS += -I $(srcdir)/../irq
$(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 = uart.c console.c
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,162 @@
/*
* Cirrus EP7312 Console Driver
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#include <bsp.h> /* Must be before libio.h */
#include <rtems/libio.h>
#include <termios.h>
#include <rtems/bspIo.h>
#include <ep7312.h>
#include <libchip/serial.h>
#include <libchip/sersupp.h>
#define NUM_DEVS 1
int uart_poll_read(int minor);
static int uart_first_open(int major, int minor, void *arg);
static int uart_last_close(int major, int minor, void *arg);
static int uart_read(int minor);
static int uart_write(int minor, const char *buf, int len);
static void uart_init(int minor);
static void uart_write_polled(int minor, char c);
static int uart_set_attributes(int minor, const struct termios *t);
unsigned long Console_Port_Count = NUM_DEVS;
console_data Console_Port_Data[NUM_DEVS];
rtems_device_minor_number Console_Port_Minor = 0;
console_fns uart_fns =
{
libchip_serial_default_probe,
uart_first_open,
uart_last_close,
uart_read,
uart_write,
uart_init,
uart_write_polled,
uart_set_attributes,
FALSE
};
console_tbl Console_Port_Tbl[] = {
{
"/dev/com0", /* sDeviceName */
SERIAL_CUSTOM, /* deviceType */
&uart_fns, /* pDeviceFns */
NULL, /* deviceProbe */
NULL, /* pDeviceFlow */
16, /* ulMargin */
8, /* ulHysteresis */
NULL, /* pDeviceParams */
(unsigned32)EP7312_UARTCR1, /* ulCtrlPort1 */
(unsigned32)EP7312_SYSFLG1, /* ulCtrlPort2 */
(unsigned32)EP7312_UARTDR1, /* ulDataPort */
0, /* getRegister */
0, /* setRegister */
0, /* getData */
0, /* setData */
0, /* ulClock */
0 /* ulIntVector */
}};
static int uart_first_open(int major, int minor, void *arg) {return 0;}
static int uart_last_close(int major, int minor, void *arg) {return 0;}
static int uart_read(int minor)
{
return uart_poll_read(minor);
}
static void uart_write_polled(int minor, char c)
{
uart_write(minor, &c, 1);
}
static int uart_set_attributes(int minor, const struct termios *t)
{
return 0;
}
int uart_poll_read(int minor)
{
volatile unsigned32 *data_reg;
volatile unsigned32 *ctrl_reg1;
volatile unsigned32 *ctrl_reg2;
char c;
int err;
data_reg = (unsigned32*)Console_Port_Tbl[minor].ulDataPort;
ctrl_reg1 = (unsigned32*)Console_Port_Tbl[minor].ulCtrlPort1;
ctrl_reg2 = (unsigned32*)Console_Port_Tbl[minor].ulCtrlPort2;
if ((*ctrl_reg2 & EP7312_UART_URXFE1) != 0) {
return -1;
}
err = *data_reg;
c = err & 0xff;
err &= (EP7312_UART_FRMERR | EP7312_UART_PARERR | EP7312_UART_OVERR);
return c;
}
static void _BSP_null_char( char c ) {uart_write_polled(0, c);}
BSP_output_char_function_type BSP_output_char = _BSP_null_char;
static int uart_write(int minor, const char *buf, int len)
{
volatile unsigned32 *data_reg;
volatile unsigned32 *ctrl_reg1;
volatile unsigned32 *ctrl_reg2;
int i;
char c;
data_reg = (unsigned32*)Console_Port_Tbl[minor].ulDataPort;
ctrl_reg1 = (unsigned32*)Console_Port_Tbl[minor].ulCtrlPort1;
ctrl_reg2 = (unsigned32*)Console_Port_Tbl[minor].ulCtrlPort2;
for (i = 0; i < len; i++) {
/* Wait for fifo to have room */
while ((*ctrl_reg2 & EP7312_UART_UTXFF1) != 0) {
continue;
}
c = (char) buf[i];
*data_reg = c;
}
return 1;
}
static void uart_init(int minor)
{
volatile unsigned32 *data_reg;
volatile unsigned32 *ctrl_reg1;
volatile unsigned32 *ctrl_reg2;
data_reg = (unsigned32*)Console_Port_Tbl[minor].ulDataPort;
ctrl_reg1 = (unsigned32*)Console_Port_Tbl[minor].ulCtrlPort1;
ctrl_reg2 = (unsigned32*)Console_Port_Tbl[minor].ulCtrlPort2;
/* *ctrl_reg = (BSP_UART_DATA8 |
BSP_UART_STOP1 |
BSP_UART_PARITY_NONE |
EP7312_UART_FIFOEN |
BSP_UART_BAUD_9600);
*/
*ctrl_reg1 = (EP7312_UART_WRDLEN8 |
EP7312_UART_FIFOEN |
0x17); /* 9600 baud */
}

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,24 @@
##
## $Id$
##
include_HEADERS = bsp.h coverhd.h bspopts.h ep7312.h
coverhd.h: $(top_srcdir)/../../shared/include/coverhd.h
cp $< $@
CLEANFILES = coverhd.h
$(PROJECT_INCLUDE):
$(mkinstalldirs) $@
$(PROJECT_INCLUDE)/%.h: %.h
$(INSTALL_DATA) $< $@
TMPINSTALL_FILES = $(PROJECT_INCLUDE) \
$(include_HEADERS:%=$(PROJECT_INCLUDE)/%)
all-local: $(TMPINSTALL_FILES)
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,69 @@
/*
* Cirrus EP7312 BSP header file
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#ifndef __BSP_H__
#define __BSP_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <bspopts.h>
#include <rtems.h>
#include <iosupp.h>
#include <console.h>
#include <clockdrv.h>
/*
* Define the interrupt mechanism for Time Test 27
*
* NOTE: Following are not defined and are board independent
*
*/
struct rtems_bsdnet_ifconfig *config;
int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config,
int attaching);
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
#define CONFIGURE_INTERRUPT_STACK_MEMORY (16 * 1024)
extern rtems_configuration_table BSP_Configuration;
#define MUST_WAIT_FOR_INTERRUPT 0
#define Install_tm27_vector( handler )
#define Cause_tm27_intr()
#define Clear_tm27_intr()
#define Lower_tm27_intr()
/*
* Network driver configuration
*/
#define RTEMS_BSP_NETWORK_DRIVER_NAME "eth0"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH cs8900_driver_attach
#ifdef __cplusplus
}
#endif
#endif /* __BSP_H__ */

View File

@@ -0,0 +1,156 @@
/*
* Cirrus EP7312 register declarations
*
* Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* Notes: The PLL registers (pll_ro and pll_wo) are either read only
* or write only. The data sheet says not to write the read
* only one or read the write only one. I'm not sure what will
* happen if you do.
*
* $Id$
*/
#ifndef __EP7312_H__
#define __EP7312_H__
#define EP7312_REG_BASE 0x80000000
#define EP7312_PADR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0000))
#define EP7312_PBDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0001))
#define EP7312_PDDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0003))
#define EP7312_PADDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0040))
#define EP7312_PBDDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0041))
#define EP7312_PDDDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0043))
#define EP7312_PEDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0080))
#define EP7312_PEDDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x00C0))
#define EP7312_SYSCON1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0100))
#define EP7312_SYSFLG1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0140))
#define EP7312_MEMCFG1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0180))
#define EP7312_MEMCFG2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x01C0))
#define EP7312_INTSR1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0240))
#define EP7312_INTMR1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0280))
#define EP7312_LCDCON ((volatile unsigned32 *)(EP7312_REG_BASE + 0x02C0))
#define EP7312_TC1D ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0300))
#define EP7312_TC2D ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0340))
#define EP7312_RTCDR ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0380))
#define EP7312_RTCMR ((volatile unsigned32 *)(EP7312_REG_BASE + 0x03C0))
#define EP7312_PMPCON ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0400))
#define EP7312_CODR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x0440))
#define EP7312_UARTDR1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0480))
#define EP7312_UARTCR1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x04C0))
#define EP7312_SYNCIO ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0500))
#define EP7312_PALLSW ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0540))
#define EP7312_PALMSW ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0580))
#define EP7312_STFCLR ((volatile unsigned32 *)(EP7312_REG_BASE + 0x05C0))
#define EP7312_BLEOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0600))
#define EP7312_MCEOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0640))
#define EP7312_TEOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0680))
#define EP7312_TC1EOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x06C0))
#define EP7312_TC2EOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0700))
#define EP7312_RTCEOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0740))
#define EP7312_UMSEOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0780))
#define EP7312_COEOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x07C0))
#define EP7312_HALT ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0800))
#define EP7312_STDBY ((volatile unsigned32 *)(EP7312_REG_BASE + 0x0840))
#define EP7312_FBADDR ((volatile unsigned8 *)(EP7312_REG_BASE + 0x1000))
#define EP7312_SYSCON2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1100))
#define EP7312_SYSFLG2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1140))
#define EP7312_INTSR2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1240))
#define EP7312_INTMR2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1280))
#define EP7312_UARTDR2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1480))
#define EP7312_UARTCR2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x14C0))
#define EP7312_SS2DR ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1500))
#define EP7312_SRXEOF ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1600))
#define EP7312_SS2POP ((volatile unsigned32 *)(EP7312_REG_BASE + 0x16C0))
#define EP7312_KBDEOI ((volatile unsigned32 *)(EP7312_REG_BASE + 0x1700))
#define EP7312_DAIR ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2000))
#define EP7312_DAIDR0 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2040))
#define EP7312_DAIDR1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2080))
#define EP7312_DAIDR2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x20C0))
#define EP7312_DAISR ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2100))
#define EP7312_SYSCON3 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2200))
#define EP7312_INTSR3 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2240))
#define EP7312_INTMR3 ((volatile unsigned8 *)(EP7312_REG_BASE + 0x2280))
#define EP7312_LEDFLSH ((volatile unsigned8 *)(EP7312_REG_BASE + 0x22C0))
#define EP7312_SDCONF ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2300))
#define EP7312_SDRFPR ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2340))
#define EP7312_UNIQID ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2440))
#define EP7312_DAI64Fs ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2600))
#define EP7312_PLLW ((volatile unsigned8 *)(EP7312_REG_BASE + 0x2610))
#define EP7312_PLLR ((volatile unsigned8 *)(EP7312_REG_BASE + 0xA5A8))
#define EP7312_RANDID0 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2700))
#define EP7312_RANDID1 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2704))
#define EP7312_RANDID2 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x2708))
#define EP7312_RANDID3 ((volatile unsigned32 *)(EP7312_REG_BASE + 0x270C))
/* serial port bits */
/* BITS in UBRLCR1 */
#define EP7312_UART_WRDLEN5 0x00000000
#define EP7312_UART_WRDLEN6 0x00020000
#define EP7312_UART_WRDLEN7 0x00040000
#define EP7312_UART_WRDLEN8 0x00060000
#define EP7312_UART_FIFOEN 0x00010000
#define EP7312_UART_XSTOP 0x00008000
#define EP7312_UART_EVENPRT 0x00004000
#define EP7312_UART_PRTEN 0x00002000
#define EP7312_UART_BREAK 0x00001000
/* BITS in INTSR1 */
#define EP7312_UART_UTXINT1 0x00002000
#define EP7312_UART_URXINT1 0x00001000
/* BITS in UARTTDR1 */
#define EP7312_UART_FRMERR 0x00000100
#define EP7312_UART_PARERR 0x00000200
#define EP7312_UART_OVERR 0x00000400
/* BITS in system status flag register 1 */
#define EP7312_UART_UBUSY1 0x00000800
#define EP7312_UART_URXFE1 0x00400000
#define EP7312_UART_UTXFF1 0x00800000
/* system configuration bits */
/* BITS in SYSCON1 */
#define EP7312_SYSCON1_UART1EN 0x00000100
#define EP7312_SYSCON1_TC1_PRESCALE 0x00000010
#define EP7312_SYSCON1_TC1_512KHZ 0x00000020
#define EP7312_SYSCON1_TC2_PRESCALE 0x00000040
#define EP7312_SYSCON1_TC2_512KHZ 0x00000080
/* INTR1 (Interrupt 1) mask/status register bits */
#define EP7312_INTR1_EXTFIQ 0x00000001
#define EP7312_INTR1_BLINT 0x00000002
#define EP7312_INTR1_WEINT 0x00000004
#define EP7312_INTR1_MCINT 0x00000008
#define EP7312_INTR1_CSINT 0x00000010
#define EP7312_INTR1_EINT1 0x00000020
#define EP7312_INTR1_EINT2 0x00000040
#define EP7312_INTR1_EINT3 0x00000080
#define EP7312_INTR1_TC1OI 0x00000100
#define EP7312_INTR1_TC2OI 0x00000200
#define EP7312_INTR1_RTCMI 0x00000400
#define EP7312_INTR1_TINT 0x00000800
#define EP7312_INTR1_URXINT1 0x00001000
#define EP7312_INTR1_UTXINT1 0x00002000
#define EP7312_INTR1_UMSINT 0x00004000
#define EP7312_INTR1_SSEOTI 0x00008000
/* INTR2 (Interrupt 2) mask/status register bits */
#define EP7312_INTR2_KBDINT 0x00000001
#define EP7312_INTR2_SS2RX 0x00000002
#define EP7312_INTR2_SS2TX 0x00000004
#define EP7312_INTR2_URXINT2 0x00001000
#define EP7312_INTR2_UTXINT2 0x00002000
/* INTR3 (Interrupt 3) mask/status register bits */
#define EP7312_INTR2_DAIINT 0x00000001
#endif /* __EP7312_H__ */

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,48 @@
##
## $Id$
##
VPATH = @srcdir@:@srcdir@/../../shared/irq
PGM = $(ARCH)/irq.rel
C_FILES = irq.c bsp_irq_init.c irq_init.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
S_FILES = bsp_irq_asm.S irq_asm.S
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
include_HEADERS = irq.h
OBJS = $(C_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/compile.am
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
AM_CPPFLAGS += -I$(srcdir)
$(PROJECT_INCLUDE):
$(mkinstalldirs) $@
$(PROJECT_INCLUDE)/%.h: %.h
$(INSTALL_DATA) $< $@
PREINSTALL_FILES = $(PROJECT_INCLUDE) $(include_HEADERS:%=$(PROJECT_INCLUDE)/%)
$(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 = bsp_irq_asm.S bsp_irq_init.c irq.c
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,329 @@
/*
* Cirrus EP7312 Intererrupt handler
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#define __asm__
#include "irq.h"
#define VECTOR_TABLE 0x40
/*
* Function to obtain, execute an IT handler and acknowledge the IT
*/
.globl ExecuteITHandler
ExecuteITHandler :
/*
* Look at interrupt status register to determine source.
* From source, determine offset into expanded vector table
* and load handler address into r0.
*/
ldr r1, =0x80000000 /* close to interrupt status/mask registers 1 */
ldr r2, =0x80001000 /* close to interrupt status/mask registers 2 */
ldr r3, =0x80002000 /* close to interrupt status/mask registers 3 */
stmdb sp!,{r4, r5, r6}
/*
* INTSR3
*/
check_dai:
ldr r4, [r3, #0x240]
ldr r5, [r3, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
tst r6, #0x0001
beq check_extfiq
ldr r0, =(VECTOR_TABLE + (4 * 21)) /* load the vector number */
b get_handler
/*
* INTSR1
*/
check_extfiq:
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
tst r6, #0x0001
beq check_bl
ldr r0, =(VECTOR_TABLE + (4 * 0)) /* load the vector number */
b get_handler
check_bl:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0002
beq check_we
ldr r0, =(VECTOR_TABLE + (4 * 1)) /* load the vector number */
b get_handler
check_we:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0004
beq check_mc
ldr r0, =(VECTOR_TABLE + (4 * 2)) /* load the vector number */
b get_handler
check_mc:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0008
beq check_cs
ldr r0, =(VECTOR_TABLE + (4 * 3)) /* load the vector number */
b get_handler
check_cs:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0010
beq check_e1
ldr r0, =(VECTOR_TABLE + (4 * 4)) /* load the vector number */
b get_handler
check_e1:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0020
beq check_e2
ldr r0, =(VECTOR_TABLE + (4 * 5)) /* load the vector number */
b get_handler
check_e2:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0040
beq check_e3
ldr r0, =(VECTOR_TABLE + (4 * 6)) /* load the vector number */
b get_handler
check_e3:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0080
beq check_tc1
ldr r0, =(VECTOR_TABLE + (4 * 7)) /* load the vector number */
b get_handler
check_tc1:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0100
beq check_tc2
ldr r0, =(VECTOR_TABLE + (4 * 8)) /* load the vector number */
b get_handler
check_tc2:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0200
beq check_rtc
ldr r0, =(VECTOR_TABLE + (4 * 9)) /* load the vector number */
b get_handler
check_rtc:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0400
beq check_tick
ldr r0, =(VECTOR_TABLE + (4 * 10)) /* load the vector number */
b get_handler
check_tick:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0800
beq check_utx1
ldr r0, =(VECTOR_TABLE + (4 * 11)) /* load the vector number */
b get_handler
check_utx1:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x1000
beq check_urx1
ldr r0, =(VECTOR_TABLE + (4 * 12)) /* load the vector number */
b get_handler
check_urx1:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x2000
beq check_ums
ldr r0, =(VECTOR_TABLE + (4 * 13)) /* load the vector number */
b get_handler
check_ums:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x4000
beq check_sse
ldr r0, =(VECTOR_TABLE + (4 * 14)) /* load the vector number */
b get_handler
check_sse:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r1, #0x240]
ldr r5, [r1, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x8000
beq check_kbd
ldr r0, =(VECTOR_TABLE + (4 * 15)) /* load the vector number */
b get_handler
/*
* INTSR2
*/
check_kbd:
ldr r4, [r2, #0x240]
ldr r5, [r2, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
tst r6, #0x0001
beq check_ss2rx
ldr r0, =(VECTOR_TABLE + (4 * 16)) /* load the vector number */
b get_handler
check_ss2rx:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r2, #0x240]
ldr r5, [r2, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0002
beq check_ss2tx
ldr r0, =(VECTOR_TABLE + (4 * 17)) /* load the vector number */
b get_handler
check_ss2tx:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r2, #0x240]
ldr r5, [r2, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x0004
beq check_utx2
ldr r0, =(VECTOR_TABLE + (4 * 18)) /* load the vector number */
b get_handler
check_utx2:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r2, #0x240]
ldr r5, [r2, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x1000
beq check_urx2
ldr r0, =(VECTOR_TABLE + (4 * 19)) /* load the vector number */
b get_handler
check_urx2:
#if 0
MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
ldr r4, [r2, #0x240]
ldr r5, [r2, #0x280]
and r6, r4, r5 /* only look at interrupts which are enabled */
#endif
tst r6, #0x2000
beq IRQ_NoInterrupt
ldr r0, =(VECTOR_TABLE + (4 * 20)) /* load the vector number */
b get_handler
get_handler:
ldmia sp!,{r4, r5, r6}
ldr r0, [r0] /* extract the IT handler @ */
/*
* re-enable interrupts at processor level as the current
* interrupt source is now masked via VEGA logic
*/
/*
mrs r1, cpsr
and r1, r1, #0xFFFFFF3F
msr cpsr, r1
*/
stmdb sp!,{lr}
ldr lr, =IRQ_return /* prepare the return from handler */
mov pc, r0 /* EXECUTE INT HANDLER */
IRQ_return:
ldmia sp!,{lr}
IRQ_NoInterrupt:
/* return to the "main" interrupt handler */
mov pc, lr

View File

@@ -0,0 +1,117 @@
/*
* Cirrus EP7312 Intererrupt handler
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#include <irq.h>
#include <bsp.h>
#include <ep7312.h>
extern void default_int_handler();
void BSP_rtems_irq_mngt_init()
{
long int_stat;
/* mask all interrupts */
*EP7312_INTMR1 = 0x0;
*EP7312_INTMR2 = 0x0;
*EP7312_INTMR3 = 0x0;
/* clear all pending interrupt status' */
int_stat = *EP7312_INTSR1;
if(int_stat & EP7312_INTR1_EXTFIQ)
{
}
if(int_stat & EP7312_INTR1_BLINT)
{
*EP7312_BLEOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_WEINT)
{
*EP7312_TEOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_MCINT)
{
}
if(int_stat & EP7312_INTR1_CSINT)
{
*EP7312_COEOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_EINT1)
{
}
if(int_stat & EP7312_INTR1_EINT2)
{
}
if(int_stat & EP7312_INTR1_EINT3)
{
}
if(int_stat & EP7312_INTR1_TC1OI)
{
*EP7312_TC1EOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_TC2OI)
{
*EP7312_TC2EOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_RTCMI)
{
*EP7312_RTCEOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_TINT)
{
*EP7312_TEOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_URXINT1)
{
}
if(int_stat & EP7312_INTR1_UTXINT1)
{
}
if(int_stat & EP7312_INTR1_UMSINT)
{
*EP7312_UMSEOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR1_SSEOTI)
{
*EP7312_SYNCIO;
}
int_stat = *EP7312_INTSR1;
int_stat = *EP7312_INTSR2;
if(int_stat & EP7312_INTR2_KBDINT)
{
*EP7312_KBDEOI = 0xFFFFFFFF;
}
if(int_stat & EP7312_INTR2_SS2RX)
{
}
if(int_stat & EP7312_INTR2_SS2TX)
{
}
if(int_stat & EP7312_INTR2_URXINT2)
{
}
if(int_stat & EP7312_INTR2_UTXINT2)
{
}
int_stat = *EP7312_INTSR2;
int_stat = *EP7312_INTSR3;
if(int_stat & EP7312_INTR2_DAIINT)
{
}
int_stat = *EP7312_INTSR3;
}

View File

@@ -0,0 +1,155 @@
/*
* Cirrus EP7312 Intererrupt handler
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#include <bsp.h>
#include <irq.h>
#include <rtems/score/thread.h>
#include <rtems/score/apiext.h>
#include <ep7312.h>
/*
* This function check that the value given for the irq line
* is valid.
*/
static int isValidInterrupt(int irq)
{
if ( (irq < 0) || (irq > BSP_MAX_INT))
return 0;
return 1;
}
/*
* -------------------- RTEMS Single Irq Handler Mngt Routines ----------------
*/
int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
{
rtems_irq_hdl *HdlTable;
rtems_interrupt_level level;
if (!isValidInterrupt(irq->name)) {
return 0;
}
/*
* Check if default handler is actually connected. If not issue an error.
*/
HdlTable = (rtems_irq_hdl *) VECTOR_TABLE;
if (*(HdlTable + irq->name) != default_int_handler) {
return 0;
}
_CPU_ISR_Disable(level);
/*
* store the new handler
*/
*(HdlTable + irq->name) = irq->hdl;
/*
* unmask interrupt
*/
if(irq->name >= BSP_EXTFIQ && irq->name <= BSP_SSEOTI)
{
/* interrupt managed by INTMR1 and INTSR1 */
*EP7312_INTMR1 |= (1 << irq->name);
}
else if(irq->name >= BSP_KBDINT && irq->name <= BSP_SS2TX)
{
/* interrupt managed by INTMR2 and INTSR2 */
*EP7312_INTMR2 |= (1 << (irq->name - 16));
}
else if(irq->name >= BSP_UTXINT2 && irq->name <= BSP_URXINT2)
{
/* interrupt managed by INTMR2 and INTSR2 */
*EP7312_INTMR2 |= (1 << (irq->name - 7));
}
else if(irq->name == BSP_DAIINT)
{
/* interrupt managed by INTMR3 and INTSR3 */
*EP7312_INTMR3 |= (1 << (irq->name - 21));
}
/*
* Enable interrupt on device
*/
if(irq->on)
{
irq->on(irq);
}
_CPU_ISR_Enable(level);
return 1;
}
int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq)
{
rtems_irq_hdl *HdlTable;
rtems_interrupt_level level;
if (!isValidInterrupt(irq->name)) {
return 0;
}
/*
* Check if the handler is actually connected. If not issue an error.
*/
HdlTable = (rtems_irq_hdl *) VECTOR_TABLE;
if (*(HdlTable + irq->name) != irq->hdl) {
return 0;
}
_CPU_ISR_Disable(level);
/*
* mask interrupt
*/
if(irq->name >= BSP_EXTFIQ && irq->name <= BSP_SSEOTI)
{
/* interrupt managed by INTMR1 and INTSR1 */
*EP7312_INTMR1 &= ~(1 << irq->name);
}
else if(irq->name >= BSP_KBDINT && irq->name <= BSP_SS2TX)
{
/* interrupt managed by INTMR2 and INTSR2 */
*EP7312_INTMR2 &= ~(1 << (irq->name - 16));
}
else if(irq->name >= BSP_UTXINT2 && irq->name <= BSP_URXINT2)
{
/* interrupt managed by INTMR2 and INTSR2 */
*EP7312_INTMR2 &= ~(1 << (irq->name - 7));
}
else if(irq->name == BSP_DAIINT)
{
/* interrupt managed by INTMR3 and INTSR3 */
*EP7312_INTMR3 &= ~(1 << (irq->name - 21));
}
/*
* Disable interrupt on device
*/
if(irq->off)
irq->off(irq);
/*
* restore the default irq value
*/
*(HdlTable + irq->name) = default_int_handler;
_CPU_ISR_Enable(level);
return 1;
}

View File

@@ -0,0 +1,195 @@
/*
* Cirrus EP7312 Intererrupt handler
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#ifndef __IRQ_H__
#define __IRQ_H__
#ifdef __cplusplus
extern "C" {
#endif
/* define that can be useful (the values are just examples) */
#define VECTOR_TABLE 0x40
#ifndef __asm__
/*
* Include some preprocessor value also used by assember code
*/
#include <rtems.h>
extern void default_int_handler();
/*-------------------------------------------------------------------------+
| Constants
+--------------------------------------------------------------------------*/
/* enum of the possible interrupt sources */
typedef enum {
/* int interrupt status/mask register 1 */
BSP_EXTFIQ = 0,
BSP_BLINT,
BSP_WEINT,
BSP_MCINT,
BSP_CSINT,
BSP_EINT1,
BSP_EINT2,
BSP_EINT3,
BSP_TC1OI,
BSP_TC2OI,
BSP_RTCMI,
BSP_TINT,
BSP_UTXINT1,
BSP_URXINT1,
BSP_UMSINT,
BSP_SSEOTI,
/* int interrupt status/mask register 2 */
BSP_KBDINT,
BSP_SS2RX,
BSP_SS2TX,
BSP_UTXINT2,
BSP_URXINT2,
/* int interrupt status/mask register 3 */
BSP_DAIINT,
BSP_MAX_INT,
} rtems_irq_symbolic_name;
/*
* Type definition for RTEMS managed interrupts
*/
typedef unsigned char rtems_irq_level;
typedef unsigned char rtems_irq_trigger;
struct __rtems_irq_connect_data__; /* forward declaratiuon */
typedef void (*rtems_irq_hdl) (void);
typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*);
typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*);
typedef int (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*);
typedef struct __rtems_irq_connect_data__ {
/*
* IRQ line
*/
rtems_irq_symbolic_name name;
/*
* handler. See comment on handler properties below in function prototype.
*/
rtems_irq_hdl hdl;
/*
* function for enabling interrupts at device level (ONLY!).
* The BSP code will automatically enable it at i8259s level.
* RATIONALE : anyway such code has to exist in current driver code.
* It is usually called immediately AFTER connecting the interrupt handler.
* RTEMS may well need such a function when restoring normal interrupt
* processing after a debug session.
*
*/
rtems_irq_enable on;
/*
* function for disabling interrupts at device level (ONLY!).
* The code will disable it at i8259s level. RATIONALE : anyway
* such code has to exist for clean shutdown. It is usually called
* BEFORE disconnecting the interrupt. RTEMS may well need such
* a function when disabling normal interrupt processing for
* a debug session. May well be a NOP function.
*/
rtems_irq_disable off;
/*
* function enabling to know what interrupt may currently occur
* if someone manipulates the i8259s interrupt mask without care...
*/
rtems_irq_is_enabled isOn;
/*
* priority level at the vplus level
*/
rtems_irq_level irqLevel;
/*
* Trigger way : Rising or falling edge or High or low level
*/
rtems_irq_trigger irqTrigger;
} rtems_irq_connect_data;
/*-------------------------------------------------------------------------+
| Function Prototypes.
+--------------------------------------------------------------------------*/
/*
* ------------------- RTEMS Single Irq Handler Mngt Routines ----------------
*/
/*
* function to initialize the interrupt for a specific BSP
*/
void BSP_rtems_irq_mngt_init();
/*
* function to connect a particular irq handler. This hanlder will NOT be called
* directly as the result of the corresponding interrupt. Instead, a RTEMS
* irq prologue will be called that will :
*
* 1) save the C scratch registers,
* 2) switch to a interrupt stack if the interrupt is not nested,
* 3) store the current i8259s' interrupt masks
* 4) modify them to disable the current interrupt at 8259 level (and may
* be others depending on software priorities)
* 5) aknowledge the i8259s',
* 6) demask the processor,
* 7) call the application handler
*
* As a result the hdl function provided
*
* a) can perfectly be written is C,
* b) may also well directly call the part of the RTEMS API that can be used
* from interrupt level,
* c) It only responsible for handling the jobs that need to be done at
* the device level including (aknowledging/re-enabling the interrupt at device,
* level, getting the data,...)
*
* When returning from the function, the following will be performed by
* the RTEMS irq epilogue :
*
* 1) masks the interrupts again,
* 2) restore the original i8259s' interrupt masks
* 3) switch back on the orinal stack if needed,
* 4) perform rescheduling when necessary,
* 5) restore the C scratch registers...
* 6) restore initial execution flow
*
*/
int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*);
/*
* function to get the current RTEMS irq handler for ptr->name. It enables to
* define hanlder chain...
*/
int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr);
/*
* function to get disconnect the RTEMS irq handler for ptr->name.
* This function checks that the value given is the current one for safety reason.
* The user can use the previous function to get it.
*/
int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*);
#endif /* __asm__ */
#ifdef __cplusplus
}
#endif
#endif /* __IRQ_H__ */

View File

@@ -0,0 +1,43 @@
##
## $Id$
##
PGM = $(ARCH)/network.rel
C_FILES = network.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
include_HEADERS =
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
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__
$(PROJECT_INCLUDE):
$(mkinstalldirs) $@
$(PROJECT_INCLUDE)/%.h: %.h
$(INSTALL_DATA) $< $@
PREINSTALL_FILES = $(PROJECT_INCLUDE) \
$(include_HEADERS:%=$(PROJECT_INCLUDE)/%)
$(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 = network.c
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,125 @@
#include <rtems.h>
#include <sys/mbuf.h>
#include <irq.h>
#include <libchip/cs8900.h>
#define CS8900_BASE 0x20000300
unsigned int bsp_cs8900_io_base = 0;
unsigned int bsp_cs8900_memory_base = 0;
cs8900_device *g_cs;
rtems_irq_hdl cs8900_isr(rtems_vector_number v);
rtems_irq_connect_data cs8900_isr_data = {BSP_EINT3,
(rtems_irq_hdl)cs8900_isr,
NULL,
NULL,
NULL,
0,
0 };
char g_enetbuf[1520];
rtems_irq_hdl cs8900_isr(rtems_vector_number v)
{
cs8900_interrupt(v, g_cs);
}
/* cs8900_io_set_reg - set one of the I/O addressed registers */
void cs8900_io_set_reg (int dev, unsigned short reg, unsigned short data)
{
/* works the same for all values of dev */
/*
printf("cs8900_io_set_reg: reg: %#6x, val %#6x\n",
CS8900_BASE + reg,
data);
*/
*(unsigned short *)(CS8900_BASE + reg) = data;
}
/* cs8900_io_get_reg - reads one of the I/O addressed registers */
unsigned short cs8900_io_get_reg (int dev, unsigned short reg)
{
unsigned short val;
/* works the same for all values of dev */
val = *(unsigned short *)(CS8900_BASE + reg);
/*
printf("cs8900_io_get_reg: reg: %#6x, val %#6x\n", reg, val);
*/
return val;
}
/* cs8900_mem_set_reg - sets one of the registers mapped through
* PacketPage
*/
void cs8900_mem_set_reg (int dev, unsigned long reg, unsigned short data)
{
/* works the same for all values of dev */
cs8900_io_set_reg(dev, CS8900_IO_PACKET_PAGE_PTR, reg);
cs8900_io_set_reg(dev, CS8900_IO_PP_DATA_PORT0, data);
}
/* cs8900_mem_get_reg - reads one of the registers mapped through
* PacketPage
*/
unsigned short cs8900_mem_get_reg (int dev, unsigned long reg)
{
/* works the same for all values of dev */
cs8900_io_set_reg(dev, CS8900_IO_PACKET_PAGE_PTR, reg);
return cs8900_io_get_reg(dev, CS8900_IO_PP_DATA_PORT0);
}
void cs8900_get_mac_addr (int dev, unsigned char *mac_address)
{
mac_address[0] = 0x08;
mac_address[1] = 0x00;
mac_address[2] = 0x3e;
mac_address[3] = 0x21;
mac_address[4] = 0xc7;
mac_address[5] = 0xf7;
}
void cs8900_attach_interrupt (int dev, cs8900_device *cs)
{
g_cs = cs;
BSP_install_rtems_irq_handler(&cs8900_isr_data);
}
void cs8900_detach_interrupt (int dev)
{
BSP_remove_rtems_irq_handler(&cs8900_isr_data);
}
unsigned short cs8900_get_data_block (int dev, unsigned char *data)
{
int len;
int i;
len = cs8900_mem_get_reg(dev, CS8900_PP_RxLength);
for (i = 0; i < ((len + 1) / 2); i++) {
((short *)data)[i] = cs8900_io_get_reg(dev,
CS8900_IO_RX_TX_DATA_PORT0);
}
return len;
}
void cs8900_tx_load (int dev, struct mbuf *m)
{
int len;
short *data;
int i;
len = 0;
do {
memcpy(&g_enetbuf[len], mtod(m, const void *), m->m_len);
len += m->m_len;
m = m->m_next;
} while (m != 0);
data = (unsigned short *) &g_enetbuf[0];
for (i = 0; i < ((len + 1) / 2); i++) {
cs8900_io_set_reg(dev,
CS8900_IO_RX_TX_DATA_PORT0,
data[i]);
}
}

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,33 @@
##
## $Id$
##
PGMS = $(ARCH)/start.o
S_FILES = start.S
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.$(OBJEXT))
OBJS = $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/compile.am
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
bsplib_DATA = $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT)
$(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

View File

@@ -0,0 +1,170 @@
/*
* Cirrus EP7312 Startup code
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
/* Some standard definitions...*/
.equ Mode_USR, 0x10
.equ Mode_FIQ, 0x11
.equ Mode_IRQ, 0x12
.equ Mode_SVC, 0x13
.equ Mode_ABT, 0x17
.equ Mode_ABORT, 0x17
.equ Mode_UNDEF, 0x1B
.equ Mode_SYS, 0x1F /*only available on ARM Arch. v4*/
.equ I_Bit, 0x80
.equ F_Bit, 0x40
.text
.globl _start
_start:
/* store the sp */
mov r12, sp
/*
* Here is the code to initialize the low-level BSP environment
* (Chip Select, PLL, ....?)
/* zero the bss */
LDR r1, =_bss_end_ /* get end of ZI region */
LDR r0, =_bss_start_ /* load base address of ZI region */
zi_init:
MOV r2, #0
CMP r0, r1 /* loop whilst r0 < r1 */
STRLOT r2, [r0], #4
BLO zi_init
/* Load basic ARM7 interrupt table */
VectorInit:
MOV R0, #0
ADR R1, Vector_Init_Block
LDMIA R1!, {R2, r3} /* Copy the Vectors (8 words) */
STMIA R0!, {r2, r3}
LDMIA R1!, {R2, r3} /* Copy the Vectors (8 words) */
STMIA R0!, {r2, r3}
LDMIA R1!, {R2, r3} /* Copy the Vectors (8 words) */
STMIA R0!, {r2, r3}
LDMIA R1!, {R2, r3} /* Copy the Vectors (8 words) */
STMIA R0!, {r2, r3}
LDMIA R1!, {R2, r3} /* Copy the .long'ed addresses (8 words) */
STMIA R0!, {r2, r3}
LDMIA R1!, {R2, r3} /* Copy the .long'ed addresses (8 words) */
STMIA R0!, {r2, r3}
LDMIA R1!, {R2, r3} /* Copy the .long'ed addresses (8 words) */
STMIA R0!, {r2, r3}
LDMIA R1!, {R2, r3} /* Copy the .long'ed addresses (8 words) */
STMIA R0!, {r2, r3}
B init2
/*******************************************************
standard exception vectors table
*** Must be located at address 0
********************************************************/
Vector_Init_Block:
LDR PC, Reset_Addr
LDR PC, Undefined_Addr
LDR PC, SWI_Addr
LDR PC, Prefetch_Addr
LDR PC, Abort_Addr
NOP
LDR PC, IRQ_Addr
LDR PC, FIQ_Addr
.globl Reset_Addr
Reset_Addr: .long _start
Undefined_Addr: .long Undefined_Handler
SWI_Addr: .long SWI_Handler
Prefetch_Addr: .long Prefetch_Handler
Abort_Addr: .long Abort_Handler
.long 0
IRQ_Addr: .long IRQ_Handler
FIQ_Addr: .long FIQ_Handler
/* The following handlers do not do anything useful */
.globl Undefined_Handler
Undefined_Handler:
B Undefined_Handler
.globl SWI_Handler
SWI_Handler:
B SWI_Handler
.globl Prefetch_Handler
Prefetch_Handler:
B Prefetch_Handler
.globl Abort_Handler
Abort_Handler:
B Abort_Handler
.globl IRQ_Handler
IRQ_Handler:
B IRQ_Handler
.globl FIQ_Handler
FIQ_Handler:
B FIQ_Handler
init2 :
/* --- Initialise stack pointer registers
/* Enter IRQ mode and set up the IRQ stack pointer */
MOV r0, #Mode_IRQ | I_Bit | F_Bit /* No interrupts */
MSR cpsr, r0
ldr r1, =_irq_stack_size
LDR sp, =_irq_stack
add sp, sp, r1
sub sp, sp, #0x64
/* Enter FIQ mode and set up the FIQ stack pointer */
MOV r0, #Mode_FIQ | I_Bit | F_Bit /* No interrupts */
MSR cpsr, r0
ldr r1, =_fiq_stack_size
LDR sp, =_fiq_stack
add sp, sp, r1
sub sp, sp, #0x64
/* Enter ABT mode and set up the ABT stack pointer */
MOV r0, #Mode_ABT | I_Bit | F_Bit /* No interrupts */
MSR cpsr, r0
ldr r1, =_abt_stack_size
LDR sp, =_abt_stack
add sp, sp, r1
sub sp, sp, #0x64
/* Set up the SVC stack pointer last and stay in SVC mode */
MOV r0, #Mode_SVC | I_Bit | F_Bit /* No interrupts */
MSR cpsr, r0
ldr r1, =_svc_stack_size
LDR sp, =_svc_stack
add sp, sp, r1
sub sp, sp, #0x64
/* save the original registers */
stmdb sp!, {r4-r12, lr}
/* --- Now we enter the C code */
bl boot_card
ldmia sp!, {r4-r12, lr}
mov sp, r12
mov pc, lr

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,38 @@
##
VPATH = @srcdir@:@srcdir@/../../../shared
PGM = $(ARCH)/startup.rel
C_FILES = bsplibc.c bsppost.c bspstart.c exit.c bootcard.c main.c sbrk.c \
gnatinstallhandler.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/compile.am
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(OBJS)
$(make-rel)
bsplib_DATA = linkcmds
$(PROJECT_RELEASE)/lib/linkcmds: linkcmds
$(INSTALL_DATA) $< $@
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/linkcmds
all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES)
.PRECIOUS: $(PGM)
EXTRA_DIST = bspstart.c exit.c linkcmds
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,186 @@
/*
* Cirrus EP7312 Startup code
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#include <bsp.h>
#include <rtems/libcsupport.h>
#include <rtems/libio.h>
#include <ep7312.h>
#include <uart.h>
/*************************************************************/
/* Macros */
/*************************************************************/
/*************************************************************/
/* Data Structures */
/*************************************************************/
/*************************************************************/
/* Global Variables */
/*************************************************************/
extern void *_flash_size;
extern void *_flash_base;
extern void *_sdram_size;
extern void *_sdram_base;
extern void *_bss_free_start;
unsigned long free_mem_start;
unsigned long free_mem_end;
/* The original BSP configuration table from the application and our copy of it
with some changes. */
extern rtems_configuration_table Configuration;
rtems_configuration_table BSP_Configuration;
rtems_cpu_table Cpu_table; /* CPU configuration table. */
char *rtems_progname; /* Program name - from main(). */
/*************************************************************/
/* Function prototypes */
/*************************************************************/
extern void rtems_irq_mngt_init(void);
void bsp_libc_init( void *, unsigned32, int );
void bsp_postdriver_hook(void);
/**************************************************************************/
/* */
/* NAME: bps_pretasking_hook - Function to setup system before startup */
/* */
/* DESCRIPTION: */
/* This function is called before drivers are initialized and used */
/* to setup libc and BSP extensions. It configures non cacheable */
/* SDRAM, SRAM, AIM, and ADM regions and sets up the CPU's memory */
/* protection unit. */
/* */
/* GLOBALS USED: */
/* free_mem_start */
/* free_mem_end */
/* */
/* RESTRICTIONS/LIMITATIONS: */
/* Since this function is setting up libc, it cannot use and libc */
/* functions. */
/* */
/**************************************************************************/
void bsp_pretasking_hook(void)
{
unsigned32 heap_start;
unsigned32 heap_size;
/*
* Set up the heap. It uses all free SDRAM except that reserved
* for non-cached uses.
*/
heap_start = free_mem_start;
/* heap_size = (free_mem_end - heap_start - MEM_NOCACHE_SIZE); */
heap_size = 0x200000;
bsp_libc_init((void *)heap_start, heap_size, 0);
#ifdef RTEMS_DEBUG
rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
#endif /* RTEMS_DEBUG */
} /* bsp_pretasking_hook */
/**************************************************************************/
/* */
/* NAME: bsp_start_default - BSP initialization function */
/* */
/* DESCRIPTION: */
/* This function is called before RTEMS is initialized and used */
/* adjust the kernel's configuration. */
/* */
/* This function also configures the CPU's memory protection unit. */
/* */
/* GLOBALS USED: */
/* CPU_table */
/* BSP_Configuration */
/* free_mem_start */
/* free_mem_end */
/* free_mem_nocache_start */
/* _bss_free_start */
/* mpu_region_tbl */
/* */
/* */
/* */
/* */
/* RESTRICTIONS/LIMITATIONS: */
/* Since RTEMS is not configured, no RTEMS functions can be called. */
/* */
/**************************************************************************/
void bsp_start_default( void )
{
/* disable interrupts */
*EP7312_INTMR1 = 0;
*EP7312_INTMR2 = 0;
Cpu_table.pretasking_hook = bsp_pretasking_hook;
Cpu_table.postdriver_hook = bsp_postdriver_hook;
Cpu_table.do_zero_of_workspace = TRUE;
/* Place RTEMS workspace at beginning of free memory. */
BSP_Configuration.work_space_start = (void *)&_bss_free_start;
free_mem_start = ((unsigned32)&_bss_free_start +
BSP_Configuration.work_space_size);
free_mem_end = ((unsigned32)&_sdram_base + (unsigned32)&_sdram_size);
/*
* Init rtems exceptions management
*/
rtems_exception_init_mngt();
/*
* Init rtems interrupt management
*/
rtems_irq_mngt_init();
/*
* The following information is very useful when debugging.
*/
#if 0
printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
printk( "microseconds_per_tick = 0x%x\n",
BSP_Configuration.microseconds_per_tick );
printk( "ticks_per_timeslice = 0x%x\n",
BSP_Configuration.ticks_per_timeslice );
printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
printk( "number_of_device_drivers = 0x%x\n",
BSP_Configuration.number_of_device_drivers );
printk( "Device_driver_table = 0x%x\n",
BSP_Configuration.Device_driver_table );
/* printk( "_stack_size = 0x%x\n", _stack_size );*/
printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
#endif
} /* bsp_start */
/*
* By making this a weak alias for bsp_start_default, a brave soul
* can override the actual bsp_start routine used.
*/
void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));

View File

@@ -0,0 +1,40 @@
/*
* Cirrus EP7312 BSP Shutdown code
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
#include <stdio.h>
#include <bsp.h>
#include <rtems/bspIo.h>
#include <rtems/libio.h>
int uart_poll_read(int);
void rtemsReboot (void)
{
asm volatile ("b _start");
}
void bsp_cleanup(void)
{
static char line[]="\nEXECUTIVE SHUTDOWN! Any key to reboot...";
/*
* AT this point, the console driver is disconnected => we must
* use polled output/input. This is exactly what printk
* does.
*/
printk("\n");
printk(line);
while (uart_poll_read(0) < 0) continue;
/* rtemsReboot(); */
}

View File

@@ -0,0 +1,225 @@
/*
* Cirrus EP7312 linker script
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
*
* $Id$
*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
"elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
/* SEARCH_DIR(/usr/local/rtems-arm-dev-tools/arm-rtems/lib); */
MEMORY {
sdram : ORIGIN = 0x00000000, LENGTH = 16M
regs : ORIGIN = 0x80000000, LENGTH = 1M
}
/*
* Declare some sizes.
*/
_sdram_base = DEFINED(_sdram_base) ? _sdram_base : 0x00000000;
_sdram_size = DEFINED(_sdram_size) ? _sdram_size : 16M;
_irq_stack_size = DEFINED(_irq_stack_size) ? _irq_stack_size : 0x1000;
_fiq_stack_size = DEFINED(_fiq_stack_size) ? _fiq_stack_size : 0x400;
_abt_stack_size = DEFINED(_abt_stack_size) ? _abt_stack_size : 0;
_svc_stack_size = DEFINED(_svc_stack_size) ? _svc_stack_size : 0x1000;
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
.base :
{
_sram_base = .;
arm_exception_table = .;
arm_reset_vect = .; /* 0x00 */
. += 4;
arm_undef_vect = .; /* 0x04 */
. += 4;
arm_swi_vect = .; /* 0x08 */
. += 4;
arm_iabrt_vect = .; /* 0x0c */
. += 4;
arm_dabrt_vect = .; /* 0x10 */
. += 4;
/* no vector here */
. += 4;
arm_irq_vect = .; /* 0x18 */
. += 4;
arm_fiq_vect = .; /* 0x1c */
. += 4;
/* FIXME: */
fiq_vect_table = .; /* this and irq_vector_table should be swapped */
. += (32 * 4);
irq_vector_table = .;
. += (32 * 4);
} > sdram
.init :
{
KEEP (*(.init))
} > sdram /*=0*/
.text :
{
_text_start = .;
CREATE_OBJECT_SYMBOLS
*(.text)
*(.text.*)
*(.glue_7)
*(.glue_7t)
/* I think these come from the ld docs: */
___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__ = .;
_etext = .;
PROVIDE (etext = .);
} > sdram
.fini :
{
KEEP (*(.fini))
} > sdram /*=0*/
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
*(.jcr)
SORT(CONSTRUCTORS)
_edata = .;
} > sdram
.eh_frame : { *(.eh_frame) } > RAM
.data1 : { *(.data1) } > RAM
.eh_frame : { *(.eh_frame) } > RAM
.gcc_except_table : { *(.gcc_except_table) } > RAM
.rodata :
{
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r*)
} > sdram
.bss :
{
_bss_start_ = .;
_clear_start = .;
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(64);
_clear_end = .;
. = ALIGN (256);
_abt_stack = .;
. += _abt_stack_size;
. = ALIGN (256);
_irq_stack = .;
. += _irq_stack_size;
. = ALIGN (256);
_fiq_stack = .;
. += _fiq_stack_size;
. = ALIGN (256);
_svc_stack = .;
. += _svc_stack_size;
_bss_end_ = .;
_end = .;
__end = .;
. = ALIGN (1024);
_bss_free_start = .;
} > sdram
/*
.regs :
{
ep7312_regs_base = .;
ep7312_regs = .;
. += 8192;
} > regs
*/
/* Debugging stuff follows? */
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/*.stack 0x80000 : { _stack = .; *(.stack) }*/
/* These must appear regardless of . */
}

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,33 @@
##
## $Id$
##
VPATH = @srcdir@:@srcdir@/../../../shared
PGM = $(ARCH)/timer.rel
C_FILES = timer.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
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

View File

@@ -0,0 +1,93 @@
/*
* Cirrus EP7312 Timer driver
*
* Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
* http://www.OARcorp.com/rtems/license.html.
*
* Notes:
* This file manages the benchmark timer used by the RTEMS Timing Test
* Suite. Each measured time period is demarcated by calls to
* Timer_initialize() and Read_timer(). Read_timer() usually returns
* the number of microseconds since Timer_initialize() exitted.
*
* It is important that the timer start/stop overhead be determined
* when porting or modifying this code.
*
* $Id$
*/
#include <rtems.h>
#include <bsp.h>
#include <ep7312.h>
rtems_unsigned16 tstart;
rtems_boolean Timer_driver_Find_average_overhead;
void Timer_initialize( void )
{
*EP7312_SYSCON1 |= EP7312_SYSCON1_TC2_512KHZ;
*EP7312_TC2D = 0xffff;
}
/*
* The following controls the behavior of Read_timer().
*
* AVG_OVEREHAD is the overhead for starting and stopping the timer. It
* is usually deducted from the number returned.
*
* LEAST_VALID is the lowest number this routine should trust. Numbers
* below this are "noise" and zero is returned.
*/
#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
/* (Y countdowns) to start/stop the timer. */
/* This value is in microseconds. */
#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
int Read_timer( void )
{
rtems_unsigned16 t;
rtems_unsigned32 total;
t = *EP7312_TC2D;
/*
* Total is calculated by taking into account the number of timer overflow
* interrupts since the timer was initialized and clicks since the last
* interrupts.
*/
total = (unsigned32)0x0000ffff - t; /* result is 1/512000 = ~2 uS */
total = (total * 1953) / 1000; /* convert to uS */
if ( Timer_driver_Find_average_overhead == 1 )
return total; /* in XXX microsecond units */
else {
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
/*
* Somehow convert total into microseconds
*/
return (total - AVG_OVERHEAD);
}
}
/*
* Empty function call used in loops to measure basic cost of looping
* in Timing Test Suite.
*/
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;
}

View File

@@ -0,0 +1,189 @@
#
# Timing Test Suite Results for the EDB7312 BSP
#
#
#
Board: Cogent EDB7312
CPU: Cirrus EP7312
Clock Speed: 74MHz
Memory Configuration: SDRAM, 16 bit bus
Cache: Data and Instruction cache enabled
Wait States:
Times Reported in: microseconds
Timer Source: Timer 2, 512KHz timer rate
# DESCRIPTION A B
== ================================================================= ==== ====
1 rtems_semaphore_create 35
rtems_semaphore_delete 29
rtems_semaphore_obtain: available 3
rtems_semaphore_obtain: not available -- NO_WAIT 3
rtems_semaphore_release: no waiting tasks 6
2 rtems_semaphore_obtain: not available -- caller blocks 34
3 rtems_semaphore_release: task readied -- preempts caller 27
4 rtems_task_restart: blocked task -- preempts caller 95
rtems_task_restart: ready task -- preempts caller 99
rtems_semaphore_release: task readied -- returns to caller 12
rtems_task_create 47
rtems_task_start 25
rtems_task_restart: suspended task -- returns to caller 25
rtems_task_delete: suspended task 48
rtems_task_restart: ready task -- returns to caller 26
rtems_task_restart: blocked task -- returns to caller 33
rtems_task_delete: blocked task 51
5 rtems_task_suspend: calling task 25
rtems_task_resume: task readied -- preempts caller 23
6 rtems_task_restart: calling task 19
rtems_task_suspend: returns to caller 8
rtems_task_resume: task readied -- returns to caller 9
rtems_task_delete: ready task 58
7 rtems_task_restart: suspended task -- preempts caller 47
8 rtems_task_set_priority: obtain current priority 4
rtems_task_set_priority: returns to caller 9
rtems_task_mode: obtain current mode 2
rtems_task_mode: no reschedule 2
rtems_task_mode: reschedule -- returns to caller 15
rtems_task_mode: reschedule -- preempts caller 52
rtems_task_set_note 4
rtems_task_get_note 4
rtems_clock_set 14
rtems_clock_get 1
9 rtems_message_queue_create 97
rtems_message_queue_send: no waiting tasks 10
rtems_message_queue_urgent: no waiting tasks 10
rtems_message_queue_receive: available 11
rtems_message_queue_flush: no messages flushed 2
rtems_message_queue_flush: messages flushed 6
rtems_message_queue_delete 52
10 rtems_message_queue_receive: not available -- NO_WAIT 6
rtems_message_queue_receive: not available -- caller blocks 36
11 rtems_message_queue_send: task readied -- preempts caller 34
12 rtems_message_queue_send: task readied -- returns to caller 17
13 rtems_message_queue_urgent: task readied -- preempts caller 34
14 rtems_message_queue_urgent: task readied -- returns to caller 17
15 rtems_event_receive: obtain current events 1
rtems_event_receive: not available -- NO_WAIT 4
rtems_event_receive: not available -- caller blocks 28
rtems_event_send: no task readied 4
rtems_event_receive: available 15
rtems_event_send: task readied -- returns to caller 15
16 rtems_event_send: task readied -- preempts caller 29
17 rtems_task_set_priority: preempts caller 36
18 rtems_task_delete: calling task 81
19 rtems_signal_catch 5
rtems_signal_send: returns to caller 29
rtems_signal_send: signal to self 50
exit ASR overhead: returns to calling task 29
exit ASR overhead: returns to preempting task 33
20 rtems_partition_create 44
rtems_region_create 70
rtems_partition_get_buffer: available 23
rtems_partition_get_buffer: not available 3
rtems_partition_return_buffer 21
rtems_partition_delete 15
rtems_region_get_segment: available 25
rtems_region_get_segment: not available -- NO_WAIT 58
rtems_region_return_segment: no waiting tasks 25
rtems_region_get_segment: not available -- caller blocks 115
rtems_region_return_segment: task readied -- preempts caller 132
rtems_region_return_segment: task readied -- returns to caller 70
rtems_region_delete 41
rtems_io_initialize 1
rtems_io_open 0
rtems_io_close 0
rtems_io_read 0
rtems_io_write 0
rtems_io_control 0
21 rtems_task_ident 34
rtems_message_queue_ident 33
rtems_semaphore_ident 38
rtems_partition_ident 33
rtems_region_ident 36
rtems_port_ident 33
rtems_timer_ident 33
rtems_rate_monotonic_ident 34
22 rtems_message_queue_broadcast: task readied -- returns to caller 48
rtems_message_queue_broadcast: no waiting tasks 8
rtems_message_queue_broadcast: task readied -- preempts caller 60
23 rtems_timer_create 6
rtems_timer_fire_after: inactive 11
rtems_timer_fire_after: active 11
rtems_timer_cancel: active 6
rtems_timer_cancel: inactive 5
rtems_timer_reset: inactive 9
rtems_timer_reset: active 10
rtems_timer_fire_when: inactive 12
rtems_timer_fire_when: active 13
rtems_timer_delete: active 8
rtems_timer_delete: inactive 7
rtems_task_wake_when 38
24 rtems_task_wake_after: yield -- returns to caller 2
rtems_task_wake_after: yields -- preempts caller 20
25 rtems_clock_tick 17
26 _ISR_Disable 0
_ISR_Flash 0
_ISR_Enable 0
_Thread_Disable_dispatch 0
_Thread_Enable_dispatch 3
_Thread_Set_state 11
_Thread_Disptach (NO FP) 25
context switch: no floating point contexts 15
context switch: self 0
context switch: to another task 0
fp context switch: restore 1st FP task - NA
fp context switch: save idle, restore initialized - NA
fp context switch: save idle, restore idle - NA
fp context switch: save initialized, restore initialized - NA
_Thread_Resume 13
_Thread_Unblock 11
_Thread_Ready 5
_Thread_Get 2
_Semaphore_Get 1
_Thread_Get: invalid id 1
27 interrupt entry overhead: returns to interrupted task 0
interrupt exit overhead: returns to interrupted task 0
interrupt entry overhead: returns to nested interrupt 0
interrupt exit overhead: returns to nested interrupt 0
28 rtems_port_create 23
rtems_port_external_to_internal 3
rtems_port_internal_to_external 3
rtems_port_delete 21
29 rtems_rate_monotonic_create 21
rtems_rate_monotonic_period: initiate period -- returns to caller 41
rtems_rate_monotonic_period: obtain status 11
rtems_rate_monotonic_cancel 23
rtems_rate_monotonic_delete: inactive 25
rtems_rate_monotonic_delete: active 21
rtems_rate_monotonic_period: conclude periods -- caller blocks 23

View File

@@ -0,0 +1,14 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
mkinstalldirs

View File

@@ -0,0 +1,31 @@
##
## $Id$
##
BSP_FILES = clock console startup irq timer network start
# bummer; have to use $foreach since % pattern subst rules only replace 1x
OBJS = $(foreach piece, $(BSP_FILES), $(wildcard ../$(piece)/$(ARCH)/*.$(OBJEXT))) \
$(wildcard ../../../../libcpu/$(RTEMS_CPU)/shared/*/$(ARCH)/*.$(OBJEXT)) \
$(wildcard ../../../../libcpu/$(RTEMS_CPU)/$(RTEMS_CPU_MODEL)/*/$(ARCH)/*.$(OBJEXT))
LIB = $(ARCH)/libbsp.a
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/compile.am
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(LIB): ${OBJS}
$(make-library)
$(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a: $(LIB)
$(INSTALL_DATA) $< $@
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a
all-local: ${ARCH} $(TMPINSTALL_FILES)
include $(top_srcdir)/../../../../../../automake/local.am