mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-25 22:07:15 +00:00
New port from Ralf Corsepius <corsepiu@faw.uni-ulm.de>.
This commit is contained in:
59
c/src/lib/libbsp/sh/gensh1/start/Makefile.in
Normal file
59
c/src/lib/libbsp/sh/gensh1/start/Makefile.in
Normal file
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGMS=${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=start
|
||||
S_FILES=$(S_PIECES:%=%.s)
|
||||
S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
|
||||
|
||||
SRCS=$(C_FILES) $(H_FILES) $(S_FILES)
|
||||
OBJS=$(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
# force optimization, unless start.o will not work
|
||||
# CFLAGS_PROFILE=
|
||||
# CFLAGS_DEBUG=-O3
|
||||
# CFLAGS_OPTIMIZE=-O3
|
||||
|
||||
#
|
||||
# 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 555 ${PGMS} ${PROJECT_RELEASE}/lib
|
||||
55
c/src/lib/libbsp/sh/shared/setvec.c
Normal file
55
c/src/lib/libbsp/sh/shared/setvec.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* set_vector
|
||||
*
|
||||
* This routine installs an interrupt vector on the target Board/CPU.
|
||||
* This routine is allowed to be as board dependent as necessary.
|
||||
*
|
||||
* INPUT:
|
||||
* handler - interrupt handler entry point
|
||||
* vector - vector number
|
||||
* type - 0 indicates raw hardware connect
|
||||
* 1 indicates RTEMS interrupt connect
|
||||
*
|
||||
* RETURNS:
|
||||
* address of previous interrupt handler
|
||||
*
|
||||
* Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
|
||||
* Bernd Becker (becker@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <bsp.h>
|
||||
|
||||
sh_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
)
|
||||
{
|
||||
sh_isr_entry previous_isr;
|
||||
|
||||
if ( type )
|
||||
rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr );
|
||||
else {
|
||||
_CPU_ISR_install_raw_handler( vector, handler, (proc_ptr*) &previous_isr );
|
||||
}
|
||||
|
||||
return previous_isr;
|
||||
}
|
||||
|
||||
14
c/src/lib/libcpu/sh/Makefile.in
Normal file
14
c/src/lib/libcpu/sh/Makefile.in
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/directory.cfg
|
||||
|
||||
SUB_DIRS=$(wildcard $(RTEMS_CPU_MODEL))
|
||||
14
c/src/lib/libcpu/sh/sh7032/Makefile.in
Normal file
14
c/src/lib/libcpu/sh/sh7032/Makefile.in
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/directory.cfg
|
||||
|
||||
SUB_DIRS=include clock console timer null
|
||||
60
c/src/lib/libcpu/sh/sh7032/clock/Makefile.in
Normal file
60
c/src/lib/libcpu/sh/sh7032/clock/Makefile.in
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/clock.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=ckinit
|
||||
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=$(C_FILES) $(H_FILES) $(S_FILES)
|
||||
OBJS=$(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS += $(CFLAGS_OS_V)
|
||||
|
||||
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}: ${SRCS} ${OBJS}
|
||||
${make-rel}
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by
|
||||
# libbsp/sh/BSP/wrapup/Makefile
|
||||
install: all
|
||||
289
c/src/lib/libcpu/sh/sh7032/clock/ckinit.c
Normal file
289
c/src/lib/libcpu/sh/sh7032/clock/ckinit.c
Normal file
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* This file contains the clock driver the Hitachi SH 703X
|
||||
*
|
||||
* Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
|
||||
* Bernd Becker (becker@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/score/sh_io.h>
|
||||
#include <rtems/score/sh.h>
|
||||
#include <rtems/score/cpu_isps.h>
|
||||
#include <rtems/score/iosh7030.h>
|
||||
|
||||
#define _ITU_COUNTER0_MICROSECOND (MHZ/4)
|
||||
|
||||
#ifndef CLOCKPRIO
|
||||
#define CLOCKPRIO 10
|
||||
#endif
|
||||
|
||||
#define ITU0_STARTMASK 0xfe
|
||||
#define ITU0_SYNCMASK 0xfe
|
||||
#define ITU0_MODEMASK 0xfe
|
||||
#define ITU0_TCRMASK 0x22
|
||||
#define ITU_STAT_MASK 0xf8
|
||||
#define ITU0_IRQMASK 0xfe
|
||||
#define ITU0_TIERMASK 0x01
|
||||
#define IPRC_ITU0_MASK 0xff0f
|
||||
#define ITU0_TIORVAL 0x08
|
||||
|
||||
/*
|
||||
* The interrupt vector number associated with the clock tick device
|
||||
* driver.
|
||||
*/
|
||||
|
||||
#define CLOCK_VECTOR IMIA0_ISP_V
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
static void Clock_exit( void );
|
||||
static rtems_isr Clock_isr( rtems_vector_number vector );
|
||||
|
||||
/*
|
||||
* Clock_isrs is the number of clock ISRs until the next invocation of
|
||||
* the RTEMS clock tick routine. The clock tick device driver
|
||||
* gets an interrupt once a millisecond and counts down until the
|
||||
* length of time between the user configured microseconds per tick
|
||||
* has passed.
|
||||
*/
|
||||
|
||||
rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
|
||||
static rtems_unsigned32 Clock_isrs_const; /* only calculated once */
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
unsigned8 temp;
|
||||
|
||||
/* reset the flags of the status register */
|
||||
temp = read8( ITU_TSR0) & ITU_STAT_MASK;
|
||||
write8( temp, ITU_TSR0);
|
||||
|
||||
Clock_driver_ticks++ ;
|
||||
|
||||
if( Clock_isrs == 1)
|
||||
{
|
||||
rtems_clock_tick();
|
||||
Clock_isrs = Clock_isrs_const;
|
||||
}
|
||||
else
|
||||
{
|
||||
Clock_isrs-- ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
)
|
||||
{
|
||||
unsigned8 temp8 = 0;
|
||||
|
||||
/*
|
||||
* Initialize the clock tick device driver variables
|
||||
*/
|
||||
|
||||
Clock_driver_ticks = 0;
|
||||
Clock_isrs_const = BSP_Configuration.microseconds_per_tick / 10000;
|
||||
Clock_isrs = Clock_isrs_const;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* stop Timer 0 */
|
||||
temp8 = read8( ITU_TSTR) & ITU0_STARTMASK;
|
||||
write8( temp8, ITU_TSTR);
|
||||
|
||||
/* set initial counter value to 0 */
|
||||
write16( 0, ITU_TCNT0);
|
||||
|
||||
/* Timer 0 runs independent */
|
||||
temp8 = read8( ITU_TSNC) & ITU0_SYNCMASK;
|
||||
write8( temp8, ITU_TSNC);
|
||||
|
||||
/* Timer 0 normal mode */
|
||||
temp8 = read8( ITU_TMDR) & ITU0_MODEMASK;
|
||||
write8( temp8, ITU_TMDR);
|
||||
|
||||
/* TCNT is cleared by GRA ; internal clock /4 */
|
||||
write8( ITU0_TCRMASK , ITU_TCR0);
|
||||
|
||||
/* use GRA without I/O - pins */
|
||||
write8( ITU0_TIORVAL, ITU_TIOR0);
|
||||
|
||||
/* reset flags of the status register */
|
||||
temp8 = read8( ITU_TSR0) & ITU_STAT_MASK;
|
||||
write8( temp8, ITU_TSR0);
|
||||
|
||||
/* Irq if is equal GRA */
|
||||
temp8 = read8( ITU_TIER0) | ITU0_TIERMASK;
|
||||
write8( temp8, ITU_TIER0);
|
||||
|
||||
/* set interrupt priority */
|
||||
if( sh_set_irq_priority( CLOCK_VECTOR, CLOCKPRIO ) != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED);
|
||||
|
||||
/* set counter limits */
|
||||
write16( _ITU_COUNTER0_MICROSECOND * BSP_Configuration.microseconds_per_tick,
|
||||
ITU_GRA0);
|
||||
|
||||
/* start counter */
|
||||
temp8 = read8( ITU_TSTR) |~ITU0_STARTMASK;
|
||||
write8( temp8, ITU_TSTR);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Schedule the clock cleanup routine to execute if the application exits.
|
||||
*/
|
||||
|
||||
atexit( Clock_exit );
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up before the application exits
|
||||
*/
|
||||
|
||||
void Clock_exit( void )
|
||||
{
|
||||
unsigned8 temp8 = 0;
|
||||
if ( BSP_Configuration.ticks_per_timeslice ) {
|
||||
|
||||
/* turn off the timer interrupts */
|
||||
/* set interrupt priority to 0 */
|
||||
if( sh_set_irq_priority( CLOCK_VECTOR, 0 ) != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred( RTEMS_UNSATISFIED);
|
||||
|
||||
/*
|
||||
* temp16 = read16( ITU_TIER0) & IPRC_ITU0_IRQMASK;
|
||||
* write16( temp16, ITU_TIER0);
|
||||
*/
|
||||
|
||||
/* stop counter */
|
||||
temp8 = read8( ITU_TSTR) & ITU0_STARTMASK;
|
||||
write8( temp8, ITU_TSTR);
|
||||
|
||||
/* old vector shall not be installed */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
/*
|
||||
* This is hokey, but until we get a defined interface
|
||||
* to do this, it will just be this simple...
|
||||
*/
|
||||
|
||||
if (args->command == rtems_build_name('I', 'S', 'R', ' '))
|
||||
{
|
||||
Clock_isr(CLOCK_VECTOR);
|
||||
}
|
||||
else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
|
||||
{
|
||||
rtems_interrupt_disable( isrlevel );
|
||||
(void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
|
||||
rtems_interrupt_enable( isrlevel );
|
||||
}
|
||||
}
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
60
c/src/lib/libcpu/sh/sh7032/console/Makefile.in
Normal file
60
c/src/lib/libcpu/sh/sh7032/console/Makefile.in
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/console.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=console
|
||||
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=$(C_FILES) $(H_FILES) $(S_FILES)
|
||||
OBJS=$(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (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}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by
|
||||
# libbsp/sh/BSP/wrapup/Makefile
|
||||
install: all
|
||||
152
c/src/lib/libcpu/sh/sh7032/console/console.c
Normal file
152
c/src/lib/libcpu/sh/sh7032/console/console.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* /dev/console for Hitachi SH 703X
|
||||
*
|
||||
* The SH doesn't have a designated console device. Therefore we "alias"
|
||||
* another device as /dev/console and revector all calls to /dev/console
|
||||
* to this device.
|
||||
*
|
||||
* This approach is similar to installing a sym-link from one device to
|
||||
* another device. If rtems once will support sym-links for devices files,
|
||||
* this implementation could be dropped.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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/libio.h>
|
||||
#include <iosupp.h>
|
||||
|
||||
#ifndef CPU_CONSOLE_DEVNAME
|
||||
#error Missing CPU_CONSOLE_DEVNAME
|
||||
#endif
|
||||
|
||||
static rtems_driver_name_t *low_level_device_info = NULL ;
|
||||
|
||||
/* console_initialize
|
||||
*
|
||||
* This routine initializes the console IO driver.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values:
|
||||
*/
|
||||
|
||||
rtems_device_driver console_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
rtems_device_driver status ;
|
||||
|
||||
status = rtems_io_register_name(
|
||||
"/dev/console",
|
||||
major,
|
||||
(rtems_device_minor_number) 0
|
||||
);
|
||||
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(status);
|
||||
|
||||
status = rtems_io_lookup_name( CPU_CONSOLE_DEVNAME,
|
||||
&low_level_device_info );
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(status);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open entry point
|
||||
*/
|
||||
|
||||
rtems_device_driver console_open(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_io_open( low_level_device_info->major,
|
||||
low_level_device_info->minor,
|
||||
arg );
|
||||
}
|
||||
|
||||
/*
|
||||
* Close entry point
|
||||
*/
|
||||
|
||||
rtems_device_driver console_close(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_io_close( low_level_device_info->major,
|
||||
low_level_device_info->minor,
|
||||
arg );
|
||||
}
|
||||
|
||||
/*
|
||||
* read bytes from the serial port. We only have stdin.
|
||||
*/
|
||||
|
||||
rtems_device_driver console_read(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_io_read( low_level_device_info->major,
|
||||
low_level_device_info->minor,
|
||||
arg );
|
||||
}
|
||||
|
||||
/*
|
||||
* write bytes to the serial port. Stdout and stderr are the same.
|
||||
*/
|
||||
|
||||
rtems_device_driver console_write(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_io_write( low_level_device_info->major,
|
||||
low_level_device_info->minor,
|
||||
arg );
|
||||
}
|
||||
|
||||
/*
|
||||
* IO Control entry point
|
||||
*/
|
||||
|
||||
rtems_device_driver console_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_io_control( low_level_device_info->major,
|
||||
low_level_device_info->minor,
|
||||
arg );
|
||||
}
|
||||
36
c/src/lib/libcpu/sh/sh7032/include/Makefile.in
Normal file
36
c/src/lib/libcpu/sh/sh7032/include/Makefile.in
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
H_FILES = \
|
||||
$(srcdir)/null.h \
|
||||
$(srcdir)/sh7_pfc.h \
|
||||
$(srcdir)/sh7_sci.h \
|
||||
$(srcdir)/termbits.h \
|
||||
$(srcdir)/ioqueue.h
|
||||
|
||||
SRCS=$(H_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
all: install
|
||||
|
||||
# NOTE: Unlike other CPUS, we install into a subdirectory to avoid
|
||||
# file name conflicts
|
||||
|
||||
install:
|
||||
test -d $(PROJECT_INCLUDE)/sh || $(MKDIR) $(PROJECT_INCLUDE)/sh
|
||||
$(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE)/sh
|
||||
|
||||
all: FORCEIT
|
||||
cd ../../../../libbsp/$(RTEMS_CPU)/$(RTEMS_BSP)/include; $(MAKE) all
|
||||
77
c/src/lib/libcpu/sh/sh7032/include/ioqueue.h
Normal file
77
c/src/lib/libcpu/sh/sh7032/include/ioqueue.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Defines for low level queue management
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, Ralf Corsepius, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 _io_queue_h
|
||||
#define _io_queue_h
|
||||
|
||||
#include <stdlib.h> /* size_t */
|
||||
|
||||
/*
|
||||
* NOTE: size needs to be a power of 2
|
||||
*/
|
||||
#define IO_QUEUE(type,size,name) \
|
||||
typedef struct { \
|
||||
volatile type queue[size] ; \
|
||||
volatile unsigned short tail ; \
|
||||
volatile unsigned short head ; \
|
||||
} name ;
|
||||
|
||||
#define IO_QUEUE_FULL(queue, size) \
|
||||
((queue)->tail == (((queue)->head+1) & ((size)-1)))
|
||||
|
||||
#define IO_QUEUE_EMPTY(queue) \
|
||||
(((queue)->tail) == ((queue)->head))
|
||||
|
||||
#define IO_QUEUE_INIT(queue) \
|
||||
(queue)->tail = (queue)->head = 0
|
||||
|
||||
#define IO_QUEUE_ADD(queue,size) \
|
||||
(queue)->head = (((queue)->head + 1) & ((size)-1))
|
||||
|
||||
#define IO_QUEUE_SUB(queue,size) \
|
||||
(queue)->tail = (((queue)->tail + 1) & ((size)-1))
|
||||
|
||||
#define IO_QUEUE_PUT(_queue,item) \
|
||||
{ \
|
||||
size_t i; \
|
||||
unsigned char* dest = (unsigned char*) ((_queue)->queue[(_queue)->head]); \
|
||||
unsigned char* src = (unsigned char*) (item); \
|
||||
for( i = 0; i < sizeof(item); i++) \
|
||||
{ \
|
||||
dest[i] = src[i]; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define IO_QUEUE_GET(_queue,item) \
|
||||
{\
|
||||
size_t i; \
|
||||
unsigned char *src = (unsigned char*) (_queue)->queue[(_queue)->tail]; \
|
||||
unsigned char *dest = (unsigned char*) (item); \
|
||||
for( i=0; i< sizeof(item); i++)\
|
||||
{\
|
||||
dest[i] = src[i]; \
|
||||
}\
|
||||
}
|
||||
|
||||
#endif
|
||||
72
c/src/lib/libcpu/sh/sh7032/include/null.h
Normal file
72
c/src/lib/libcpu/sh/sh7032/include/null.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* null.h
|
||||
*
|
||||
* Null device driver, derived from rtems' stub driver.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 __NULL_DRIVER_h
|
||||
#define __NULL_DRIVER_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DEVNULL_DRIVER_TABLE_ENTRY \
|
||||
{ null_initialize, null_open, null_close, null_read, \
|
||||
null_write, null_control }
|
||||
|
||||
#define NULL_SUCCESSFUL RTEMS_SUCCESSFUL
|
||||
|
||||
rtems_device_driver null_initialize(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver null_open(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver null_close(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver null_read(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver null_write(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver null_control(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
118
c/src/lib/libcpu/sh/sh7032/include/sh7_pfc.h
Normal file
118
c/src/lib/libcpu/sh/sh7032/include/sh7_pfc.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Bit values for the pin function controller of the Hitachi SH703X
|
||||
*
|
||||
* From Hitachi tutorials
|
||||
*
|
||||
* Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
|
||||
* Bernd Becker (becker@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 _sh7_pfc_h
|
||||
#define _sh7_pfc_h
|
||||
|
||||
#include <rtems/score/iosh7030.h>
|
||||
|
||||
/*
|
||||
* Port B IO Register (PBIOR)
|
||||
*/
|
||||
#define PBIOR PFC_PBIOR
|
||||
#define PB15IOR 0x8000
|
||||
#define PB14IOR 0x4000
|
||||
#define PB13IOR 0x2000
|
||||
#define PB12IOR 0x1000
|
||||
#define PB11IOR 0x0800
|
||||
#define PB10IOR 0x0400
|
||||
#define PB9IOR 0x0200
|
||||
#define PB8IOR 0x0100
|
||||
#define PB7IOR 0x0080
|
||||
#define PB6IOR 0x0040
|
||||
#define PB5IOR 0x0020
|
||||
#define PB4IOR 0x0010
|
||||
#define PB3IOR 0x0008
|
||||
#define PB2IOR 0x0004
|
||||
#define PB1IOR 0x0002
|
||||
#define PB0IOR 0x0001
|
||||
|
||||
/*
|
||||
* Port B Control Register (PBCR1)
|
||||
*/
|
||||
#define PBCR1 PFC_PBCR1
|
||||
#define PB15MD1 0x8000
|
||||
#define PB15MD0 0x4000
|
||||
#define PB14MD1 0x2000
|
||||
#define PB14MD0 0x1000
|
||||
#define PB13MD1 0x0800
|
||||
#define PB13MD0 0x0400
|
||||
#define PB12MD1 0x0200
|
||||
#define PB12MD0 0x0100
|
||||
#define PB11MD1 0x0080
|
||||
#define PB11MD0 0x0040
|
||||
#define PB10MD1 0x0020
|
||||
#define PB10MD0 0x0010
|
||||
#define PB9MD1 0x0008
|
||||
#define PB9MD0 0x0004
|
||||
#define PB8MD1 0x0002
|
||||
#define PB8MD0 0x0001
|
||||
|
||||
#define PB15MD PB15MD1|PB14MD0
|
||||
#define PB14MD PB14MD1|PB14MD0
|
||||
#define PB13MD PB13MD1|PB13MD0
|
||||
#define PB12MD PB12MD1|PB12MD0
|
||||
#define PB11MD PB11MD1|PB11MD0
|
||||
#define PB10MD PB10MD1|PB10MD0
|
||||
#define PB9MD PB9MD1|PB9MD0
|
||||
#define PB8MD PB8MD1|PB8MD0
|
||||
|
||||
#define PB_TXD1 PB11MD1
|
||||
#define PB_RXD1 PB10MD1
|
||||
#define PB_TXD0 PB9MD1
|
||||
#define PB_RXD0 PB8MD1
|
||||
|
||||
/*
|
||||
* Port B Control Register (PBCR2)
|
||||
*/
|
||||
#define PBCR2 PFC_PBCR2
|
||||
#define PB7MD1 0x8000
|
||||
#define PB7MD0 0x4000
|
||||
#define PB6MD1 0x2000
|
||||
#define PB6MD0 0x1000
|
||||
#define PB5MD1 0x0800
|
||||
#define PB5MD0 0x0400
|
||||
#define PB4MD1 0x0200
|
||||
#define PB4MD0 0x0100
|
||||
#define PB3MD1 0x0080
|
||||
#define PB3MD0 0x0040
|
||||
#define PB2MD1 0x0020
|
||||
#define PB2MD0 0x0010
|
||||
#define PB1MD1 0x0008
|
||||
#define PB1MD0 0x0004
|
||||
#define PB0MD1 0x0002
|
||||
#define PB0MD0 0x0001
|
||||
|
||||
#define PB7MD PB7MD1|PB7MD0
|
||||
#define PB6MD PB6MD1|PB6MD0
|
||||
#define PB5MD PB5MD1|PB5MD0
|
||||
#define PB4MD PB4MD1|PB4MD0
|
||||
#define PB3MD PB3MD1|PB3MD0
|
||||
#define PB2MD PB2MD1|PB2MD0
|
||||
#define PB1MD PB1MD1|PB1MD0
|
||||
#define PB0MD PB0MD1|PB0MD0
|
||||
|
||||
#endif /* _sh7_pfc_h */
|
||||
82
c/src/lib/libcpu/sh/sh7032/include/sh7_sci.h
Normal file
82
c/src/lib/libcpu/sh/sh7032/include/sh7_sci.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Bit values for the serial control registers of the Hitachi SH703X
|
||||
*
|
||||
* From Hitachi tutorials
|
||||
*
|
||||
* Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
|
||||
* Bernd Becker (becker@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 _sh7_sci_h
|
||||
#define _sh7_sci_h
|
||||
|
||||
#include <rtems/score/iosh7030.h>
|
||||
|
||||
/*
|
||||
* Serial mode register bits
|
||||
*/
|
||||
|
||||
#define SCI_SYNC_MODE 0x80
|
||||
#define SCI_SEVEN_BIT_DATA 0x40
|
||||
#define SCI_PARITY_ON 0x20
|
||||
#define SCI_ODD_PARITY 0x10
|
||||
#define SCI_STOP_BITS_2 0x08
|
||||
#define SCI_ENABLE_MULTIP 0x04
|
||||
#define SCI_PHI_64 0x03
|
||||
#define SCI_PHI_16 0x02
|
||||
#define SCI_PHI_4 0x01
|
||||
#define SCI_PHI_0 0x00
|
||||
|
||||
/*
|
||||
* Serial register offsets, relative to SCI0_SMR or SCI1_SMR
|
||||
*/
|
||||
|
||||
#define SCI_SMR 0x00
|
||||
#define SCI_BRR 0x01
|
||||
#define SCI_SCR 0x02
|
||||
#define SCI_TDR 0x03
|
||||
#define SCI_SSR 0x04
|
||||
#define SCI_RDR 0x05
|
||||
|
||||
/*
|
||||
* Serial control register bits
|
||||
*/
|
||||
#define SCI_TIE 0x80 /* Transmit interrupt enable */
|
||||
#define SCI_RIE 0x40 /* Receive interrupt enable */
|
||||
#define SCI_TE 0x20 /* Transmit enable */
|
||||
#define SCI_RE 0x10 /* Receive enable */
|
||||
#define SCI_MPIE 0x08 /* Multiprocessor interrupt enable */
|
||||
#define SCI_TEIE 0x04 /* Transmit end interrupt enable */
|
||||
#define SCI_CKE1 0x02 /* Clock enable 1 */
|
||||
#define SCI_CKE0 0x01 /* Clock enable 0 */
|
||||
|
||||
/*
|
||||
* Serial status register bits
|
||||
*/
|
||||
#define SCI_TDRE 0x80 /* Transmit data register empty */
|
||||
#define SCI_RDRF 0x40 /* Receive data register full */
|
||||
#define SCI_ORER 0x20 /* Overrun error */
|
||||
#define SCI_FER 0x10 /* Framing error */
|
||||
#define SCI_PER 0x08 /* Parity error */
|
||||
#define SCI_TEND 0x04 /* Transmit end */
|
||||
#define SCI_MPB 0x02 /* Multiprocessor bit */
|
||||
#define SCI_MPBT 0x01 /* Multiprocessor bit transfer */
|
||||
|
||||
#endif /* _sh7_sci_h */
|
||||
59
c/src/lib/libcpu/sh/sh7032/null/Makefile.in
Normal file
59
c/src/lib/libcpu/sh/sh7032/null/Makefile.in
Normal file
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/null.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=open close read write init cntrl
|
||||
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=$(DOCS) $(C_FILES) $(H_FILES)
|
||||
OBJS=$(C_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (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}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
install: all
|
||||
38
c/src/lib/libcpu/sh/sh7032/null/close.c
Normal file
38
c/src/lib/libcpu/sh/sh7032/null/close.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* null_close
|
||||
*
|
||||
* This routine is the null device driver close routine.
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* Input parameters:
|
||||
* major - device major number
|
||||
* minor - device minor number
|
||||
* pargb - pointer to close parameter block
|
||||
*
|
||||
* Output parameters:
|
||||
* rval - NULL_SUCCESSFUL
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <sh/null.h>
|
||||
|
||||
rtems_device_driver null_close(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
return NULL_SUCCESSFUL;
|
||||
}
|
||||
38
c/src/lib/libcpu/sh/sh7032/null/cntrl.c
Normal file
38
c/src/lib/libcpu/sh/sh7032/null/cntrl.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* null_control
|
||||
*
|
||||
* This routine is the null device driver control routine.
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* Input parameters:
|
||||
* major - device major number
|
||||
* minor - device minor number
|
||||
* pargp - pointer to cntrl parameter block
|
||||
*
|
||||
* Output parameters:
|
||||
* rval - NULL_SUCCESSFUL
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <sh/null.h>
|
||||
|
||||
rtems_device_driver null_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
return NULL_SUCCESSFUL;
|
||||
}
|
||||
53
c/src/lib/libcpu/sh/sh7032/null/init.c
Normal file
53
c/src/lib/libcpu/sh/sh7032/null/init.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* null_initialize
|
||||
*
|
||||
* This routine is the null device driver init routine.
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* Input parameters:
|
||||
* major - device major number
|
||||
* minor - device minor number
|
||||
* pargp - pointer to parameter block
|
||||
*
|
||||
* Output parameters:
|
||||
* rval - NULL_SUCCESSFUL
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <sh/null.h>
|
||||
|
||||
rtems_unsigned32 NULL_major;
|
||||
|
||||
rtems_device_driver null_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
rtems_device_driver status ;
|
||||
|
||||
status = rtems_io_register_name(
|
||||
"/dev/null",
|
||||
major,
|
||||
(rtems_device_minor_number) 0
|
||||
);
|
||||
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(status);
|
||||
|
||||
NULL_major = major;
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
38
c/src/lib/libcpu/sh/sh7032/null/open.c
Normal file
38
c/src/lib/libcpu/sh/sh7032/null/open.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* null_open
|
||||
*
|
||||
* This routine is the null device driver open routine.
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* Input parameters:
|
||||
* major - device major number
|
||||
* minor - device minor number
|
||||
* pargb - pointer to open parameter block
|
||||
*
|
||||
* Output parameters:
|
||||
* rval - NULL_SUCCESSFUL
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <sh/null.h>
|
||||
|
||||
rtems_device_driver null_open(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
return NULL_SUCCESSFUL;
|
||||
}
|
||||
38
c/src/lib/libcpu/sh/sh7032/null/read.c
Normal file
38
c/src/lib/libcpu/sh/sh7032/null/read.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* null_read
|
||||
*
|
||||
* This routine is the null device driver read routine.
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* Input parameters:
|
||||
* major - device major number
|
||||
* minor - device minor number
|
||||
* pargp - pointer to read parameter block
|
||||
*
|
||||
* Output parameters:
|
||||
* rval - NULL_SUCCESSFUL
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <sh/null.h>
|
||||
|
||||
rtems_device_driver null_read(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
return NULL_SUCCESSFUL;
|
||||
}
|
||||
44
c/src/lib/libcpu/sh/sh7032/null/write.c
Normal file
44
c/src/lib/libcpu/sh/sh7032/null/write.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* null_write
|
||||
*
|
||||
* This routine is the null device driver write routine.
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* Input parameters:
|
||||
* major - device major number
|
||||
* minor - device minor number
|
||||
* pargp - pointer to write parameter block
|
||||
*
|
||||
* Output parameters:
|
||||
* rval - NULL_SUCCESSFUL
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 <rtems/libio.h>
|
||||
|
||||
#include <sh/null.h>
|
||||
|
||||
rtems_device_driver null_write(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp ;
|
||||
|
||||
rw_args->bytes_moved = rw_args->count ;
|
||||
|
||||
return NULL_SUCCESSFUL;
|
||||
}
|
||||
60
c/src/lib/libcpu/sh/sh7032/timer/Makefile.in
Normal file
60
c/src/lib/libcpu/sh/sh7032/timer/Makefile.in
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/timer.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=timer
|
||||
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=$(C_FILES) $(H_FILES) $(S_FILES)
|
||||
OBJS=$(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (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}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by
|
||||
# libbsp/sh/BSP/Makefile
|
||||
install: all
|
||||
204
c/src/lib/libcpu/sh/sh7032/timer/timer.c
Normal file
204
c/src/lib/libcpu/sh/sh7032/timer/timer.c
Normal file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* timer for the Hitachi SH 703X
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
|
||||
* Bernd Becker (becker@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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/score/sh_io.h>
|
||||
#include <rtems/score/iosh7030.h>
|
||||
|
||||
/*
|
||||
* We use a Phi/4 timer
|
||||
*/
|
||||
#define SCALE (MHZ/4)
|
||||
|
||||
#define ITU1_STARTMASK 0xfd
|
||||
#define ITU1_SYNCMASK 0xfd
|
||||
#define ITU1_MODEMASK 0xfd
|
||||
#define ITU1_TCRMASK 0x02
|
||||
#define ITU1_TIORMASK 0x88
|
||||
#define ITU1_STAT_MASK 0xf8
|
||||
#define ITU1_TIERMASK 0xfc
|
||||
#define IPRC_ITU1_MASK 0xfff0
|
||||
|
||||
#ifndef ITU1_PRIO
|
||||
#define ITU1_PRIO 15
|
||||
#endif
|
||||
|
||||
#define ITU1_VECTOR 86
|
||||
|
||||
rtems_isr timerisr();
|
||||
|
||||
static rtems_unsigned32 Timer_interrupts;
|
||||
|
||||
rtems_boolean Timer_driver_Find_average_overhead;
|
||||
|
||||
void Timer_initialize( void )
|
||||
{
|
||||
rtems_unsigned8 temp8;
|
||||
rtems_unsigned16 temp16;
|
||||
rtems_unsigned32 level;
|
||||
rtems_isr* ignored;
|
||||
|
||||
/*
|
||||
* Timer has never overflowed. This may not be necessary on some
|
||||
* implemenations of timer but ....
|
||||
*/
|
||||
|
||||
Timer_interrupts /* .i */ = 0;
|
||||
_CPU_ISR_Disable( level);
|
||||
|
||||
/*
|
||||
* Somehow start the timer
|
||||
*/
|
||||
/* stop Timer 1 */
|
||||
temp8 = read8( ITU_TSTR) & ITU1_STARTMASK;
|
||||
write8( temp8, ITU_TSTR);
|
||||
|
||||
/* initialize counter 1 */
|
||||
write16( 0, ITU_TCNT1);
|
||||
|
||||
/* Timer 1 is independent of other timers */
|
||||
temp8 = read8( ITU_TSNC) & ITU1_SYNCMASK;
|
||||
write8( temp8, ITU_TSNC);
|
||||
|
||||
/* Timer 1, normal mode */
|
||||
temp8 = read8( ITU_TMDR) & ITU1_MODEMASK;
|
||||
write8( temp8, ITU_TMDR);
|
||||
|
||||
/* x0000000
|
||||
* |||||+++--- Internal Clock
|
||||
* |||++------ Count on rising edge
|
||||
* |++-------- disable TCNT clear
|
||||
* +---------- don`t care
|
||||
*/
|
||||
write8( ITU1_TCRMASK, ITU_TCR1);
|
||||
|
||||
/* gra and grb are not used */
|
||||
write8( ITU1_TIORMASK, ITU_TIOR1);
|
||||
|
||||
/* reset all status flags */
|
||||
temp8 = read8( ITU_TSR1) & ITU1_STAT_MASK;
|
||||
write8( temp8, ITU_TSR1);
|
||||
|
||||
/* enable overflow interrupt */
|
||||
write8( ITU1_TIERMASK, ITU_TIER1);
|
||||
|
||||
/* set interrupt priority */
|
||||
temp16 = read16( INTC_IPRC) & IPRC_ITU1_MASK;
|
||||
temp16 |= ITU1_PRIO;
|
||||
write16( temp16, INTC_IPRC);
|
||||
|
||||
/* initialize ISR */
|
||||
ignored = set_vector( timerisr, ITU1_VECTOR, 0);
|
||||
_CPU_ISR_Enable( level);
|
||||
|
||||
/* start timer 1 */
|
||||
temp8 = read8( ITU_TSTR) | ~ITU1_STARTMASK;
|
||||
write8( temp8, ITU_TSTR);
|
||||
}
|
||||
|
||||
/*
|
||||
* The following controls the behavior of Read_timer().
|
||||
*
|
||||
* AVG_OVERHEAD 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 1 /* It typically takes X.X microseconds */
|
||||
/* (Y countdowns) to start/stop the timer. */
|
||||
/* This value is in microseconds. */
|
||||
#define LEAST_VALID 0 /* 20 */ /* Don't trust a clicks value lower than this */
|
||||
|
||||
int Read_timer( void )
|
||||
{
|
||||
rtems_unsigned32 clicks;
|
||||
rtems_unsigned32 total ;
|
||||
/*
|
||||
* Read the timer and see how many clicks it has been since we started.
|
||||
*/
|
||||
|
||||
|
||||
clicks = read16( ITU_TCNT1); /* XXX: read some HW here */
|
||||
|
||||
/*
|
||||
* 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 = clicks + Timer_interrupts * 65536 ;
|
||||
|
||||
if ( Timer_driver_Find_average_overhead )
|
||||
return total / SCALE; /* in XXX microsecond units */
|
||||
else
|
||||
{
|
||||
if ( total < LEAST_VALID )
|
||||
return 0; /* below timer resolution */
|
||||
/*
|
||||
* Somehow convert total into microseconds
|
||||
*/
|
||||
return (total / SCALE - 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;
|
||||
}
|
||||
|
||||
/* Timer 1 is used */
|
||||
|
||||
#pragma interrupt
|
||||
void timerisr( void )
|
||||
{
|
||||
unsigned8 temp8;
|
||||
|
||||
/* reset the flags of the status register */
|
||||
temp8 = read8( ITU_TSR1) & ITU1_STAT_MASK;
|
||||
write8( temp8, ITU_TSR1);
|
||||
|
||||
Timer_interrupts += 1;
|
||||
}
|
||||
59
c/src/lib/start/sh/Makefile.in
Normal file
59
c/src/lib/start/sh/Makefile.in
Normal file
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH=@srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGMS=${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=start
|
||||
S_FILES=$(S_PIECES:%=%.s)
|
||||
S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
|
||||
|
||||
SRCS=$(C_FILES) $(H_FILES) $(S_FILES)
|
||||
OBJS=$(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
# force optimization, unless start.o will not work
|
||||
# CFLAGS_PROFILE=
|
||||
# CFLAGS_DEBUG=-O3
|
||||
# CFLAGS_OPTIMIZE=-O3
|
||||
|
||||
#
|
||||
# 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 555 ${PGMS} ${PROJECT_RELEASE}/lib
|
||||
92
c/src/lib/start/sh/start.s
Normal file
92
c/src/lib/start/sh/start.s
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
|
||||
* Bernd Becker (becker@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* 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 "asm.h"
|
||||
|
||||
BEGIN_CODE
|
||||
PUBLIC(start)
|
||||
SYM (start):
|
||||
! install the stack pointer
|
||||
mov.l stack_k,r15
|
||||
|
||||
! zero out bss
|
||||
mov.l edata_k,r0
|
||||
mov.l end_k,r1
|
||||
mov #0,r2
|
||||
start_l:
|
||||
mov.l r2,@r0
|
||||
add #4,r0
|
||||
cmp/ge r0,r1
|
||||
bt start_l
|
||||
|
||||
! copy the vector table from rom to ram
|
||||
mov.l vects_k,r7 ! vectab
|
||||
mov #0,r2 ! address of boot vector table
|
||||
mov #0,r3 | number of bytes copied
|
||||
mov.w vects_size,r6 ! size of entries in vectab
|
||||
0:
|
||||
mov.l @r2+,r1
|
||||
mov.l r1,@r7
|
||||
add #4,r7
|
||||
add #1,r3
|
||||
cmp/hi r6,r3
|
||||
bf 0b
|
||||
|
||||
mov.l vects_k,r8 ! update vbr to point to vectab
|
||||
ldc r8,vbr
|
||||
|
||||
! call the mainline
|
||||
mov.l main_k,r0
|
||||
jsr @r0
|
||||
or r0,r0
|
||||
|
||||
! call exit
|
||||
mov r0,r4
|
||||
mov.l exit_k,r0
|
||||
jsr @r0
|
||||
or r0,r0
|
||||
|
||||
END_CODE
|
||||
|
||||
.align 2
|
||||
stack_k:
|
||||
.long _stack
|
||||
edata_k:
|
||||
.long _edata
|
||||
end_k:
|
||||
.long _end
|
||||
main_k:
|
||||
.long _main
|
||||
exit_k:
|
||||
.long _exit
|
||||
|
||||
vects_k:
|
||||
.long _vectab
|
||||
vects_size:
|
||||
.word 255
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .stack,"aw"
|
||||
#else
|
||||
.section .stack
|
||||
#endif
|
||||
_stack: .long 0xdeaddead
|
||||
Reference in New Issue
Block a user