Patch rtems-rc-20000118-0.diff from Ralf Corsepius <corsepiu@faw.uni-ulm.de>

that converts the a29k to automake.

    This patch contains
    * An initial merger of the libcpu/a29k stuff you sent yesterday. AFAIS,
      most code inside them seems to be empty stubs. One file even contains a
      function called mips_*** which might indicate that this part might
      contain mips code or the code the initial porter used as template for
      porting. Unfortunately, I don't know anything about the a29k so I can't
      comment on the details.
    * A dummy bsp_specs to libbsp/29k/portsw
    * An update to the automake files related to the a29k.

    Note:
    * This patch is completely untested, because I don't have a toolchain
      for it.
    * The files in libcpu/a29k include bsp.h => The libbsp vs. libcpu-issue
      hits again.
This commit is contained in:
Joel Sherrill
2000-01-26 14:20:08 +00:00
parent 5eac93c7cc
commit 21677c0e66
22 changed files with 823 additions and 331 deletions

View File

@@ -0,0 +1,23 @@
# This is an untested dummy
%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__} -Asystem(embedded)
*lib:
%{!qrtems: %(old_lib)} \
%{qrtems: --start-group %{!qrtems_debug: -lrtemsall } %{qrtems_debug: -lrtemsall_g} \
-lc -lgcc --end-group \
%{!qnolinkcmds: -T linkcmds%s}}
*startfile:
%{!qrtems: %(old_startfile)} \
%{qrtems: %{qrtems_debug: crt0_g.o%s} %{!qrtems_debug: crt0.o%s}}
*link:
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e _start}

View File

@@ -0,0 +1,38 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
PGM = $(ARCH)/console.rel
C_FILES = console.c serial.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
H_FILES = concntl.h
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(OBJS)
$(make-rel)
$(PROJECT_INCLUDE)/concntl.h: concntl.h
$(INSTALL_DATA) $< $@
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
TMPINSTALL_FILES += $(PROJECT_INCLUDE) $(PROJECT_INCLUDE)/concntl.h
all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES)
.PRECIOUS: $(PGM)
EXTRA_DIST = concntl.h console.c serial.c serial.h
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -1,76 +0,0 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
subdir = console
RTEMS_ROOT = @RTEMS_ROOT@
PROJECT_ROOT = @PROJECT_ROOT@
VPATH = @srcdir@
PGM = ${ARCH}/console.rel
# C source names, if any, go here -- minus the .c
C_PIECES = console serial
C_FILES = $(C_PIECES:%=%.c)
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
H_FILES = $(srcdir)/concntl.h
# Assembly source names, if any, go here -- minus the .S
S_PIECES =
S_FILES = $(S_PIECES:%=%.S)
S_O_FILES = $(S_FILES:%.S=${ARCH}/%.o)
SRCS = $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
OBJS = $(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
INSTALL_CHANGE = @INSTALL_CHANGE@
mkinstalldirs = $(SHELL) $(top_srcdir)/@RTEMS_TOPdir@/mkinstalldirs
INSTALLDIRS = $(PROJECT_INCLUDE)
$(INSTALLDIRS):
@$(mkinstalldirs) $(INSTALLDIRS)
#
# (OPTIONAL) Add local stuff here using +=
#
DEFINES +=
CPPFLAGS +=
CFLAGS +=
LD_PATHS +=
LD_LIBS +=
LDFLAGS +=
#
# Add your list of files to delete here. The config files
# already know how to delete some stuff, so you may want
# to just run 'make clean' first to see what gets missed.
# 'make clobber' already includes 'make clean'
#
CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
$(PGM): ${OBJS}
$(make-rel)
all: ${ARCH} $(SRCS) $(PGM)
@$(INSTALL_CHANGE) -m 644 $(H_FILES) $(PROJECT_INCLUDE)
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@@ -0,0 +1,25 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
H_FILES = bsp.h ../../../shared/include/coverhd.h
$(PROJECT_INCLUDE):
@$(mkinstalldirs) $@
$(PROJECT_INCLUDE)/bsp.h: bsp.h
$(INSTALL_DATA) $< $@
$(PROJECT_INCLUDE)/coverhd.h: ../../../shared/include/coverhd.h
$(INSTALL_DATA) $< $@
TMPINSTALL_FILES += $(PROJECT_INCLUDE) $(PROJECT_INCLUDE)/bsp.h \
$(PROJECT_INCLUDE)/coverhd.h
all-local: $(TMPINSTALL_FILES)
EXTRA_DIST = bsp.h
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -1,50 +0,0 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
subdir = include
RTEMS_ROOT = @RTEMS_ROOT@
PROJECT_ROOT = @PROJECT_ROOT@
VPATH = @srcdir@
H_FILES = $(srcdir)/bsp.h $(srcdir)/../../../shared/include/coverhd.h
#
# Equate files are for including from assembly preprocessed by
# gm4 or gasp. No examples are provided except for those for
# other CPUs. The best way to generate them would be to
# provide a program which generates the constants used based
# on the C equivalents.
#
EQ_FILES =
SRCS = $(H_FILES) $(EQ_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
INSTALL_CHANGE = @INSTALL_CHANGE@
mkinstalldirs = $(SHELL) $(top_srcdir)/@RTEMS_TOPdir@/mkinstalldirs
INSTALLDIRS = $(PROJECT_INCLUDE)
$(INSTALLDIRS):
@$(mkinstalldirs) $(INSTALLDIRS)
CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
all: $(SRCS)
@$(INSTALL_CHANGE) -m 644 $(H_FILES) $(PROJECT_INCLUDE)
@$(INSTALL_CHANGE) -m 644 $(EQ_FILES) $(PROJECT_INCLUDE)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@@ -30,6 +30,6 @@ endif
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
EXTRA_DIST = $(C_FILES)
EXTRA_DIST = addrconv.c getcfg.c lock.c mpisr.c
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,32 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
PGM = $(ARCH)/start.o
S_FILES = crt0.S register.S
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
OBJS = $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o: $(PGM)
$(INSTALL_DATA) $< $@
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES)
.PRECIOUS: $(PGM)
EXTRA_DIST = amd.ah crt0.S pswmacro.ah register.S register.ah
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -1,65 +0,0 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
subdir = start
RTEMS_ROOT = @RTEMS_ROOT@
PROJECT_ROOT = @PROJECT_ROOT@
VPATH = @srcdir@
PGM = ${ARCH}/start.o
# C source names, if any, go here -- minus the .c
C_PIECES =
C_FILES = $(C_PIECES:%=%.c)
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
H_FILES =
# Assembly source names, if any, go here -- minus the .S
S_PIECES = crt0 register
S_FILES = $(S_PIECES:%=%.S)
S_O_FILES = $(S_FILES:%.S=${ARCH}/%.o)
SRCS = $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
OBJS = $(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
INSTALL_CHANGE = @INSTALL_CHANGE@
#
# (OPTIONAL) Add local stuff here using +=
#
DEFINES +=
CPPFLAGS +=
CFLAGS +=
LD_PATHS +=
LD_LIBS +=
LDFLAGS +=
#
# Add your list of files to delete here. The config files
# already know how to delete some stuff, so you may want
# to just run 'make clean' first to see what gets missed.
# 'make clobber' already includes 'make clean'
#
CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
all: ${ARCH} $(SRCS) $(OBJS) $(PGM)
$(INSTALL_VARIANT) -m 755 ${PGM} $(PROJECT_RELEASE)/lib
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@@ -0,0 +1,43 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
VPATH = @srcdir@:@srcdir@/../../../shared
PGM = $(ARCH)/startup.rel
C_FILES = bspclean.c bsplibc.c bsppost.c bspstart.c bootcard.c main.c sbrk.c \
setvec.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/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(OBJS)
$(make-rel)
$(PROJECT_RELEASE)/lib/ramlink: ramlink
$(INSTALL_DATA) $< $@
$(PROJECT_RELEASE)/lib/romlink: romlink
$(INSTALL_DATA) $< $@
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/ramlink \
$(PROJECT_RELEASE)/lib/romlink
all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES)
.PRECIOUS: $(PGM)
EXTRA_DIST = bspclean.c bspstart.c main.c ramlink romlink setvec.c
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -1,77 +0,0 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
subdir = startup
RTEMS_ROOT = @RTEMS_ROOT@
PROJECT_ROOT = @PROJECT_ROOT@
VPATH = @srcdir@:@srcdir@/../../../shared
PGM = ${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
C_PIECES = bspclean bsplibc bsppost bspstart bootcard main sbrk setvec \
gnatinstallhandler
C_FILES = $(C_PIECES:%=%.c)
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
H_FILES =
# Assembly source names, if any, go here -- minus the .S
S_PIECES =
S_FILES = $(S_PIECES:%=%.S)
S_O_FILES = $(S_FILES:%.S=${ARCH}/%.o)
SRCS = ramlink romlink $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
OBJS = $(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/leaf.cfg
INSTALL_CHANGE = @INSTALL_CHANGE@
mkinstalldirs = $(SHELL) $(top_srcdir)/@RTEMS_TOPdir@/mkinstalldirs
INSTALLDIRS = $(PROJECT_RELEASE)/lib
$(INSTALLDIRS):
@$(mkinstalldirs) $(INSTALLDIRS)
#
# (OPTIONAL) Add local stuff here using +=
#
DEFINES +=
CPPFLAGS +=
CFLAGS +=
LD_PATHS +=
LD_LIBS +=
LDFLAGS +=
#
# Add your list of files to delete here. The config files
# already know how to delete some stuff, so you may want
# to just run 'make clean' first to see what gets missed.
# 'make clobber' already includes 'make clean'
#
CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
$(PGM): ${OBJS}
$(make-rel)
all: ${ARCH} $(SRCS) $(PGM)
$(INSTALL_CHANGE) ramlink romlink $(PROJECT_RELEASE)/lib
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@@ -0,0 +1,38 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
if HAS_MP
MP_BSP_O_FILES = shmsupp
endif
BSP_FILES = startup console iic ethernet flash nvram $(MP_BSP_O_FILES)
CPU_FILES = clock timer
# bummer; have to use $foreach since % pattern subst rules only replace 1x
OBJS = $(foreach piece, $(BSP_FILES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \
$(foreach piece, $(CPU_FILES), ../../../../libcpu/$(RTEMS_CPU)/$(piece)/$(ARCH)/$(piece).rel)
LIB = $(ARCH)/libbsp.a
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
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) $(OBJS) $(LIB) $(TMPINSTALL_FILES)
.PRECIOUS: $(LIB)
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -1,62 +0,0 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
subdir = wrapup
RTEMS_ROOT = @RTEMS_ROOT@
PROJECT_ROOT = @PROJECT_ROOT@
VPATH = @srcdir@
BSP_PIECES = startup console iic ethernet flash nvram
CPU_PIECES = clock timer
GENERIC_PIECES =
# bummer; have to use $foreach since % pattern subst rules only replace 1x
OBJS = $(foreach piece, $(BSP_PIECES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \
$(foreach piece, $(CPU_PIECES), \
../../../../libcpu/$(RTEMS_CPU)/$(piece)/$(ARCH)/$(piece).rel) $(foreach \
piece, $(GENERIC_PIECES), ../../../$(piece)/$(ARCH)/$(piece).rel)
LIB = $(ARCH)/libbsp.a
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(RTEMS_ROOT)/make/lib.cfg
INSTALL_CHANGE = @INSTALL_CHANGE@
#
# (OPTIONAL) Add local stuff here using +=
#
DEFINES +=
CPPFLAGS +=
CFLAGS +=
LD_PATHS +=
LD_LIBS +=
LDFLAGS +=
#
# Add your list of files to delete here. The config files
# already know how to delete some stuff, so you may want
# to just run 'make clean' first to see what gets missed.
# 'make clobber' already includes 'make clean'
#
CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
$(LIB): ${OBJS}
$(make-library)
all: ${ARCH} $(SRCS) $(LIB)
$(INSTALL_VARIANT) -m 644 $(LIB) $(PROJECT_RELEASE)/lib
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@@ -0,0 +1,11 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
SUBDIRS = clock timer
include $(top_srcdir)/../../../../../automake/subdirs.am
include $(top_srcdir)/../../../../../automake/local.am

View File

@@ -0,0 +1,35 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
PGM=$(ARCH)/clock.rel
C_FILES = ckinit.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
H_FILES = clock.h
S_FILES = clock.S
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
OBJS = $(C_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(SRCS) $(OBJS)
$(make-rel)
all-local: $(ARCH) $(OBJS) $(PGM)
.PRECIOUS: $(PGM)
EXTRA_DIST = Makefile ckinit.c clock.S clock.h
include $(top_srcdir)/../../../../../automake/local.am

View File

@@ -0,0 +1,212 @@
/* ckinit.c
*
* This file provides a template for the clock device driver initialization.
*
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
* On-Line Applications Research Corporation (OAR).
* All rights assigned to U.S. Government, 1994.
*
* This material may be reproduced by or for the U.S. Government pursuant
* to the copyright license under the clause at DFARS 252.227-7013. This
* notice must appear in all copies of this file and its derivatives.
*
* ckinit.c,v 1.5 1995/10/30 21:53:23 joel Exp
*/
#ifndef lint
static char _sccsid[] = "@(#)ckinit.c 03/15/96 1.1\n";
#endif
#include <stdlib.h>
#include <rtems.h>
#include <rtems/libio.h>
#include <bsp.h>
#include "clock.h"
#define CLOCKS_PER_MICROSECOND ( CPU_CLOCK_RATE_MHZ ) /* equivalent to CPU clock speed in MHz */
void Clock_exit( void );
rtems_isr Clock_isr( rtems_vector_number vector );
/*
* The interrupt vector number associated with the clock tick device
* driver.
*/
#define CLOCK_VECTOR 14
/*
* Clock_driver_ticks is a monotonically increasing counter of the
* number of clock ticks since the driver was initialized.
*/
volatile rtems_unsigned32 Clock_driver_ticks;
/*
* These are set by clock driver during its init
*/
rtems_device_major_number rtems_clock_major = ~0;
rtems_device_minor_number rtems_clock_minor;
/*
* The previous ISR on this clock tick interrupt vector.
*/
rtems_isr_entry Old_ticker;
void Clock_exit( void );
static unsigned32 a29k_timer_rate = 0;
/*
* Isr Handler
*/
rtems_isr Clock_isr(
rtems_vector_number vector
)
{
/*
* bump the number of clock driver ticks since initialization
*
* determine if it is time to announce the passing of tick as configured
* to RTEMS through the rtems_clock_tick directive
*
* perform any timer dependent tasks
*/
a29k_clear_timer();
Clock_driver_ticks += 1;
rtems_clock_tick();
}
/* User callback shell (set from Clock_Control) */
static void (*user_callback)(void);
rtems_isr User_Clock_isr(
rtems_vector_number vector
)
{
/* refresh the internal CPU timer */
a29k_clear_timer();
if (user_callback)
user_callback();
}
/*
* Install_clock
*
* Install a clock tick handler and reprograms the chip. This
* is used to initially establish the clock tick.
*/
void Install_clock(
rtems_isr_entry clock_isr
)
{
/*
* Initialize the clock tick device driver variables
*/
Clock_driver_ticks = 0;
/*
* If ticks_per_timeslice is configured as non-zero, then the user
* wants a clock tick.
*/
if ( BSP_Configuration.ticks_per_timeslice ) {
Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
/*
* Hardware specific initialize goes here
*/
a29k_timer_rate = BSP_Configuration.microseconds_per_tick * CLOCKS_PER_MICROSECOND;
a29k_init_timer( a29k_timer_rate );
}
/*
* Schedule the clock cleanup routine to execute if the application exits.
*/
atexit( Clock_exit );
}
/*
* Clean up before the application exits
*/
void Clock_exit( void )
{
if ( BSP_Configuration.ticks_per_timeslice ) {
/* a29k: turn off the timer interrupts */
a29k_disable_timer();
}
}
/*
* Clock_initialize
*
* Device driver entry point for clock tick driver initialization.
*/
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;
}
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 );
user_callback = (void (*)(void))args->buffer;
(void) set_vector( User_Clock_isr, CLOCK_VECTOR, 1 );
rtems_interrupt_enable( isrlevel );
}
done:
return RTEMS_SUCCESSFUL;
}

View File

@@ -0,0 +1,116 @@
;
; .include "register.ah"
.include "amd.ah"
.include "pswmacro.ah"
.text
; .equ IN,0x2000000
.reg CLOCK,gr78
.reg SECS,gr79
.equ CPUCLK,16
.equ RATE,100
.reg it0,gr64
.reg it1,gr65
.reg v0,gr96
timer_clear_sup:
const it0,IN
consth it0,IN
mfsr it1,tmr
andn it1,it1,it0
mtsr tmr,it1
const it0,RATE
cplt it0,CLOCK,it0
jmpf it0,carry
add CLOCK,CLOCK,1
iret
carry:
const CLOCK,0
add SECS,SECS,1
iret
.equ TICKS,(CPUCLK*1000000/RATE)
; .equ IE,0x1000000
timer_init_sup:
const it0,TICKS
consth it0,TICKS
mtsr tmc,it0
const it0,(IE|TICKS)
consth it0,(IE|TICKS)
mtsr tmr,it0
const SECS,0
const CLOCK,0
iret
timer_get_sup:
add gr96,SECS,0
iret
timer_disable_sup:
mfsr it0,ops
const it1,TD
consth it1,TD
andn it0,it1,it0
mtsr ops,it0
iret
.global _a29k_init_timer
_a29k_init_timer:
push msp,lr0
const lr2,INIT_TIMER
consth lr2,INIT_TIMER
const lr3,timer_init_sup
consth lr3,timer_init_sup
const v0,__settrap
consth v0,__settrap
calli lr0,v0
nop
const lr2,CLEAR_TIMER
consth lr2,CLEAR_TIMER
const lr3,timer_clear_sup
consth lr3,timer_clear_sup
const v0,__settrap
consth v0,__settrap
calli lr0,v0
nop
const lr2,DISABLE_TIMER
consth lr2,DISABLE_TIMER
const lr3,timer_disable_sup
consth lr3,timer_disable_sup
const v0,__settrap
consth v0,__settrap
calli lr0,v0
nop
const lr2,GET_TIMER
consth lr2,GET_TIMER
const lr3,timer_get_sup
consth lr3,timer_get_sup
const v0,__settrap
consth v0,__settrap
calli lr0,v0
nop
asneq INIT_TIMER,gr1,gr1
pop lr0,msp
jmpi lr0
nop
.global _a29k_clear_timer
_a29k_clear_timer:
; asneq CLEAR_TIMER,gr1,gr1
jmpi lr0
nop
.global _a29k_disable_timer
_a29k_disable_timer:
asneq DISABLE_TIMER,gr1,gr1
jmpi lr0
nop
.global _a29k_get_timer
_a29k_get_timer:
asneq GET_TIMER,gr1,gr1
jmpi lr0
nop

View File

@@ -0,0 +1,5 @@
/* @(#)clock.h 03/15/96 1.1 */
extern void a29k_init_timer( unsigned32 timer_clock_interval );
extern void a29k_disable_timer(void);
extern void a29k_clear_timer(void);

View File

@@ -0,0 +1,35 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl $Id$
AC_PREREQ(2.13)
AC_INIT(clock)
RTEMS_TOP(../../../../..)
AC_CONFIG_AUX_DIR(../../../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE(rtems-c-src-lib-libcpu-a29k,$RTEMS_VERSION,no)
AM_MAINTAINER_MODE
RTEMS_ENABLE_LIBCDIR
RTEMS_ENABLE_BARE
RTEMS_ENV_RTEMSBSP
RTEMS_CHECK_CPU
RTEMS_CANONICAL_HOST
RTEMS_PROJECT_ROOT
dnl check target cc
RTEMS_PROG_CC_FOR_TARGET
RTEMS_CANONICALIZE_TOOLS
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
RTEMS_CHECK_BSP_CACHE(RTEMS_BSP)
AC_OUTPUT(
Makefile
clock/Makefile
timer/Makefile)

View File

@@ -0,0 +1,36 @@
##
## Makefile,v 1.2 1995/05/31 16:56:37 joel Exp
##
## @(#)Makefile 03/26/96 1.2
AUTOMAKE_OPTIONS = foreign 1.4
PGM=$(ARCH)/timer.rel
# NOTE: timerisr is normally an assembly file!!!
C_FILES = timer.c timerisr.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
S_FILES = gettime.S
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
OBJS = $(C_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(SRCS) $(OBJS)
$(make-rel)
all-local: $(ARCH) $(OBJS) $(PGM)
.PRECIOUS: $(PGM)
EXTRA_DIST = Makefile gettime.S timer.c timerisr.c
include $(top_srcdir)/../../../../../automake/local.am

View File

@@ -0,0 +1,13 @@
/* @(#)gettime.S 03/26/96 1.1 */
#include "iregdef.h"
#include "idtcpu.h"
#include "idtmon.h"
FRAME(mips_read_timer,sp,0,ra)
.set noreorder
mfc0 v0,C0_COUNT
nop
j ra
.set reorder
ENDFRAME(mips_read_timer)

View File

@@ -0,0 +1,119 @@
/* timer.c
*
* 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.
*
* NOTE: It is important that the timer start/stop overhead be
* determined when porting or modifying this code.
*
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
* On-Line Applications Research Corporation (OAR).
* All rights assigned to U.S. Government, 1994.
*
* This material may be reproduced by or for the U.S. Government pursuant
* to the copyright license under the clause at DFARS 252.227-7013. This
* notice must appear in all copies of this file and its derivatives.
*
* timer.c,v 1.2 1995/05/31 16:56:39 joel Exp
*/
#ifndef lint
static char _sccsid[] = "@(#)timer.c 05/07/96 1.4\n";
#endif
#include <rtems.h>
#include <bsp.h>
#define CLOCKS_PER_MICROSECOND ( CPU_CLOCK_RATE_MHZ )
#define TIMER_MAX_VALUE 0xffffffff
extern unsigned32 mips_read_timer( void );
static rtems_boolean Timer_driver_Find_average_overhead;
static unsigned32 Timer_initial_value = 0;
void Timer_initialize( void )
{
/*
Timer_initial_value = mips_read_timer();
*/
/*
* Somehow start the timer
*/
/* Timer on 4650 is always running */
}
/*
* 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 8 /* It typically takes X.X microseconds */
/* (Y countdowns) to start/stop the timer. */
/* This value is in cycles. */
#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
int Read_timer( void )
{
unsigned64 clicks;
unsigned32 total;
/*
* Read the timer and see how many clicks it has been since we started.
*/
clicks = mips_read_timer(); /* XXX: read some HW here */
if (clicks < Timer_initial_value)
{
clicks += TIMER_MAX_VALUE;
}
clicks -= Timer_initial_value;
/*
* Total is calculated by taking into account the number of timer overflow
* interrupts since the timer was initialized and clicks since the last
* interrupts.
*/
#if 0 /* leave total in number of cycles */
total = clicks / CLOCKS_PER_MICROSECOND;
#else
total = clicks;
#endif
if ( Timer_driver_Find_average_overhead == 1 )
return total; /* in # cycles units */
else {
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
/*
* leave total in cycles
*/
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,41 @@
/* timerisr.s
*
* If required this ISR is used to bump a count of interval "overflow"
* interrupts which have occurred since the timer was started. The
* number of overflows is taken into account in the Read_timer()
* routine if necessary.
*
* To reduce overhead this is best to be the "rawest" hardware interupt
* handler you can write. This should be the only interrupt which can
* occur during the measured time period.
*
* NOTE: This file is USUALLY in assembly and is LEAN AND MEAN.
* Any code in this isr is pure overhead which can perturb
* the accuracy of the Timing Test Suite.
*
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
* On-Line Applications Research Corporation (OAR).
* All rights assigned to U.S. Government, 1994.
*
* This material may be reproduced by or for the U.S. Government pursuant
* to the copyright license under the clause at DFARS 252.227-7013. This
* notice must appear in all copies of this file and its derivatives.
*
* timerisr.c,v 1.2 1995/05/31 16:56:40 joel Exp
*/
#ifndef lint
static char _sccsid[] = "@(#)timerisr.c 03/15/96 1.1\n";
#endif
#include <rtems.h>
extern rtems_unsigned32 _Timer_interrupts;
void timerisr( void )
{
/*
* _Timer_interrupts += TIMER_BETWEEN_OVERFLOWS (usually in microseconds)
* return from interrupt
*/
}