MVME167 BSP submitted by Charles Gauthier <Charles.Gauthier@iit.nrc.ca>.

This commit is contained in:
Joel Sherrill committed 1999-02-18 19:23:28 +00:00
1 parent 5c609ddeba
commit 5d024595a7
25 files changed
+4077

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#
# $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
# wrapup is the one that actually builds and installs the library
# from the individual .rel files built in other directories
# include subdir must be first, otherwise the header files will not
# be installed when the other files are compiled.
SUB_DIRS=include clock console fatal startup timer wrapup
File diff suppressed because it is too large. Load diff
+23
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__} -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: start.o%s} \
%{qrtems_debug: start_g.o%s}}
*link:
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start}
@@ -0,0 +1,54 @@
#
# $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=
SRCS=$(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
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,54 @@
#
# $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=
SRCS=$(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
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,54 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
VPATH = @srcdir@
RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/fatal.rel
# C source names, if any, go here -- minus the .c
C_PIECES=fatal
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
H_FILES=
SRCS=$(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
@@ -0,0 +1,127 @@
/* fatal.c
*
* User-define fatal error handler.
*
* Copyright (c) 1998, National Research Council of Canada
*
* 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 <fatal.h>
/*
* mystrcat
*
* Can't rely on libc being operational. So we provide our own strcat-like
* function.
*
* Input parameters:
* destination - string (buffer) to append to
* source - string to append to the end of destination
*
* Output parameters:
* destination - source is appended to the end
*
* Return values:
* Number of characters appended.
*/
static int mystrcat(
char *destination,
const char *source
)
{
int i;
for ( i = 0; ( *destination++ = *source++) != '\0'; i++ );
return i;
}
/*
* bsp_fatal_error_occurred
*
* Called when rtems_fatal_error_occurred() is called. Returns control to
* 167Bug. The _Internal_error_Occurred() function has already saved the
* parameters in Internal_errors_What_happened. If the function returns,
* RTEMS will halt the CPU.
*
* Make sure the CPU is
*
* Input parameters:
* the_source - what subsystem the error originated in
* is_internal - if the error was internally generated
* the_error - fatal error status code
*
* Output parameters:
* output to the 167Bug console
*
* Return values: NONE.
*/
User_extensions_routine bsp_fatal_error_occurred(
Internal_errors_Source the_source,
rtems_boolean is_internal,
rtems_unsigned32 the_error
)
{
struct {
char index; /* First byte is number of chars in strbuf */
char strbuf[254]; /* In case count is bumped up by one by 167Bug */
} my_p_str;
my_p_str.index = 0;
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"\r\nRTEMS Fatal Error Occurred:\r\n the_source = " );
switch ( the_source ) {
case INTERNAL_ERROR_CORE:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"INTERNAL_ERROR_CORE\r\n is_internal = " );
break;
case INTERNAL_ERROR_RTEMS_API:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"INTERNAL_ERROR_RTEMS_API\r\n is_internal = " );
break;
case INTERNAL_ERROR_POSIX_API:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"INTERNAL_ERROR_POSIX_API\r\n is_internal = " );
break;
default:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"UNKNOWN\r\n is_internal = " );
break;
}
if ( is_internal )
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"TRUE\r\n the_error = 0x|10,8|\r\n" );
else
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"FALSE\r\n the_error = 0x|10,8|\r\n" );
lcsr->intr_ena = 0; /* disable interrupts */
m68k_set_vbr(0xFFE00000); /* restore 167Bug vectors */
asm volatile( "movel %0, -(%%a7)
pea (%%a7)
pea (%1)
trap #15 /* trap to 167Bug (.WRITDLN) */
.short 0x25
trap #15
.short 0x63"
:: "d" (the_error), "a" (&my_p_str) );
}
+127
View File
@@ -0,0 +1,127 @@
/* fatal.c
*
* User-define fatal error handler.
*
* Copyright (c) 1998, National Research Council of Canada
*
* 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 <fatal.h>
/*
* mystrcat
*
* Can't rely on libc being operational. So we provide our own strcat-like
* function.
*
* Input parameters:
* destination - string (buffer) to append to
* source - string to append to the end of destination
*
* Output parameters:
* destination - source is appended to the end
*
* Return values:
* Number of characters appended.
*/
static int mystrcat(
char *destination,
const char *source
)
{
int i;
for ( i = 0; ( *destination++ = *source++) != '\0'; i++ );
return i;
}
/*
* bsp_fatal_error_occurred
*
* Called when rtems_fatal_error_occurred() is called. Returns control to
* 167Bug. The _Internal_error_Occurred() function has already saved the
* parameters in Internal_errors_What_happened. If the function returns,
* RTEMS will halt the CPU.
*
* Make sure the CPU is
*
* Input parameters:
* the_source - what subsystem the error originated in
* is_internal - if the error was internally generated
* the_error - fatal error status code
*
* Output parameters:
* output to the 167Bug console
*
* Return values: NONE.
*/
User_extensions_routine bsp_fatal_error_occurred(
Internal_errors_Source the_source,
rtems_boolean is_internal,
rtems_unsigned32 the_error
)
{
struct {
char index; /* First byte is number of chars in strbuf */
char strbuf[254]; /* In case count is bumped up by one by 167Bug */
} my_p_str;
my_p_str.index = 0;
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"\r\nRTEMS Fatal Error Occurred:\r\n the_source = " );
switch ( the_source ) {
case INTERNAL_ERROR_CORE:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"INTERNAL_ERROR_CORE\r\n is_internal = " );
break;
case INTERNAL_ERROR_RTEMS_API:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"INTERNAL_ERROR_RTEMS_API\r\n is_internal = " );
break;
case INTERNAL_ERROR_POSIX_API:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"INTERNAL_ERROR_POSIX_API\r\n is_internal = " );
break;
default:
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"UNKNOWN\r\n is_internal = " );
break;
}
if ( is_internal )
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"TRUE\r\n the_error = 0x|10,8|\r\n" );
else
my_p_str.index += mystrcat(
my_p_str.strbuf + my_p_str.index,
"FALSE\r\n the_error = 0x|10,8|\r\n" );
lcsr->intr_ena = 0; /* disable interrupts */
m68k_set_vbr(0xFFE00000); /* restore 167Bug vectors */
asm volatile( "movel %0, -(%%a7)
pea (%%a7)
pea (%1)
trap #15 /* trap to 167Bug (.WRITDLN) */
.short 0x25
trap #15
.short 0x63"
:: "d" (the_error), "a" (&my_p_str) );
}
@@ -0,0 +1,34 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
VPATH = @srcdir@
RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
H_FILES = $(srcdir)/bsp.h $(srcdir)/coverhd.h $(srcdir)/page_table.h \
$(srcdir)/fatal.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
CLEAN_ADDITIONS +=
CLOBBER_ADDITIONS +=
all: $(SRCS)
$(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE)
$(INSTALL) -m 444 $(EQ_FILES) $(PROJECT_INCLUDE)
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,104 @@
/* coverhd.h
*
* This include file has defines to represent the overhead associated
* with calling a particular directive from C on this target.
*
* 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 __COVERHD_h
#define __COVERHD_h
#ifdef __cplusplus
extern "C" {
#endif
#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
#define CALLING_OVERHEAD_TASK_CREATE 1
#define CALLING_OVERHEAD_TASK_IDENT 0
#define CALLING_OVERHEAD_TASK_START 1
#define CALLING_OVERHEAD_TASK_RESTART 0
#define CALLING_OVERHEAD_TASK_DELETE 0
#define CALLING_OVERHEAD_TASK_SUSPEND 0
#define CALLING_OVERHEAD_TASK_RESUME 0
#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
#define CALLING_OVERHEAD_TASK_MODE 0
#define CALLING_OVERHEAD_TASK_GET_NOTE 0
#define CALLING_OVERHEAD_TASK_SET_NOTE 0
#define CALLING_OVERHEAD_TASK_WAKE_WHEN 1
#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
#define CALLING_OVERHEAD_CLOCK_GET 1
#define CALLING_OVERHEAD_CLOCK_SET 1
#define CALLING_OVERHEAD_CLOCK_TICK 0
#define CALLING_OVERHEAD_TIMER_CREATE 0
#define CALLING_OVERHEAD_TIMER_IDENT 0
#define CALLING_OVERHEAD_TIMER_DELETE 0
#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 1
#define CALLING_OVERHEAD_TIMER_RESET 0
#define CALLING_OVERHEAD_TIMER_CANCEL 0
#define CALLING_OVERHEAD_SEMAPHORE_CREATE 1
#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
#define CALLING_OVERHEAD_EVENT_SEND 0
#define CALLING_OVERHEAD_EVENT_RECEIVE 1
#define CALLING_OVERHEAD_SIGNAL_CATCH 0
#define CALLING_OVERHEAD_SIGNAL_SEND 0
#define CALLING_OVERHEAD_PARTITION_CREATE 1
#define CALLING_OVERHEAD_PARTITION_IDENT 0
#define CALLING_OVERHEAD_PARTITION_DELETE 0
#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
#define CALLING_OVERHEAD_REGION_CREATE 1
#define CALLING_OVERHEAD_REGION_IDENT 0
#define CALLING_OVERHEAD_REGION_DELETE 0
#define CALLING_OVERHEAD_REGION_GET_SEGMENT 1
#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
#define CALLING_OVERHEAD_PORT_CREATE 1
#define CALLING_OVERHEAD_PORT_IDENT 0
#define CALLING_OVERHEAD_PORT_DELETE 0
#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 1
#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 1
#define CALLING_OVERHEAD_IO_INITIALIZE 1
#define CALLING_OVERHEAD_IO_OPEN 1
#define CALLING_OVERHEAD_IO_CLOSE 1
#define CALLING_OVERHEAD_IO_READ 1
#define CALLING_OVERHEAD_IO_WRITE 1
#define CALLING_OVERHEAD_IO_CONTROL 1
#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
#ifdef __cplusplus
}
#endif
#endif
/* end of include file */
@@ -0,0 +1,19 @@
/* fatal.h
*
* Copyright (c) 1998, National Research Council of Canada
*
* 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/score/interr.h>
#include <rtems/score/userext.h>
User_extensions_routine bsp_fatal_error_occurred(
Internal_errors_Source the_source,
rtems_boolean is_internal,
rtems_unsigned32 the_error
);
@@ -0,0 +1,46 @@
/* page_table.h
*
* This file was submitted by Eric Vaitl <vaitl@viasat.com> and
* supports page table initialization.
*
* For now, we only use the transparent translation registers. Page tables
* may be set up in the future.
*
* 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.
*
* Modifications of respective RTEMS files:
* Copyright (c) 1998, National Research Council of Canada
*
* $Id$
*/
#ifndef __PAGE_TABLE_H
#define __PAGE_TABLE_H
#include <rtems.h>
void page_table_teardown( void );
void page_table_init( rtems_configuration_table *config_table );
enum {
CACHE_WRITE_THROUGH,
CACHE_COPYBACK,
CACHE_NONE_SERIALIZED,
CACHE_NONE
};
enum {
PTM_SUCCESS,
PTM_BAD_ADDR,
PTM_BAD_SIZE,
PTM_BAD_CACHE,
PTM_NO_TABLE_SPACE
};
#endif
@@ -0,0 +1,53 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared
RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
C_PIECES=bspclean bsplibc bsppost bspstart main page_table sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
H_FILES=
SRCS=$(srcdir)/linkcmds $(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)
$(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
@@ -0,0 +1,81 @@
/* bspclean.c
*
* These routines return control to 167Bug after a normal exit from the
* application.
*
* 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.
*
* Modifications of respective RTEMS files:
* Copyright (c) 1998, National Research Council of Canada
*
* $Id$
*/
#include <rtems.h>
#include <bsp.h>
#include <page_table.h>
/*
* bsp_return_to_monitor_trap
*
* Switch the VBR back to ROM and make a .RETURN syscall to return control to
* 167 Bug. If 167Bug ever returns, restart the application.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* Return values: NONE
*/
static void bsp_return_to_monitor_trap( void )
{
extern void start( void );
register volatile void *start_addr;
page_table_teardown();
lcsr->intr_ena = 0; /* disable interrupts */
m68k_set_vbr(0xFFE00000); /* restore 167Bug vectors */
asm volatile( "trap #15 /* trap to 167Bug */
.short 0x63" ); /* return to 167Bug (.RETURN) */
/* restart program */
start_addr = start;
asm volatile( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) );
}
/*
* bsp_cleanup
*
* This code was copied from other MC680x0 MVME BSPs.
* Our guess is that someone was concerned about the CPU no longer being in
* supervisor mode when they got here. This function forces the CPU back to
* supervisor mode so the VBR may be changed. It places the address of the
* function that makes a 167Bug .RETURN syscall in the trap 13 entry in the
* exception vector, and then issues a trap 13 call. It is also possible that
* the code was copied from some other OS that does run tasks in user mode.
* In any case, it appears to be a bit of paranoia, and could lead to
* problems if 167Bug is invoked before we get to switch the VBR back to
* 167Bug because trap 13 is documented as being reserved for the internal
* use of the debugger.
*
* Prototyped in rtems/c/src/lib/libbsp/m68k/mvme167/include/bsp.h
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* Return values: DOES NOT RETURN
*/
void bsp_cleanup( void )
{
M68Kvec[ 45 ] = bsp_return_to_monitor_trap;
asm volatile( "trap #13" );
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,103 @@
/*
* This file contains directives for the GNU linker which are specific
* to the Motorola MVME167 board.
*
* 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.
*
* Modifications of respective RTEMS file:
* Copyright (c) 1998, National Research Council of Canada
*
* $Id$
*/
/* Base address and size of RAM on the MVME167 */
RAM_SIZE = 4M;
RAM_START = 0x00800000;
RAM_END = RAM_START + RAM_SIZE;
/*
* Declare some sizes.
* XXX: The assignment of ". += XyzSize;" fails in older gld's if the
* number used there is not constant. If this happens to you, edit
* the lines marked XXX below to use a constant value.
*/
HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
MEMORY
{
ram : org = 0x00800000, l = 4M
}
SECTIONS
{
.text 0x00800000 :
{
text_start = . ;
*(.text)
. = ALIGN (16);
*(.eh_fram)
. = ALIGN (16);
*(.gcc_exc)
. = ALIGN (16);
/*
* C++ constructors
*/
__CTOR_LIST__ = .;
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
__CTOR_END__ = .;
__DTOR_LIST__ = .;
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
*(.dtors)
LONG(0)
__DTOR_END__ = .;
etext = ALIGN( 0x10 ) ;
} >ram
.data ADDR( .text ) + SIZEOF( .text ):
{
data_start = . ;
*(.data)
edata = ALIGN( 0x10 ) ;
} >ram
.bss ADDR( .data ) + SIZEOF( .data ):
{
bss_start = . ;
*(.bss)
*(COMMON)
end = . ;
_end = . ;
_HeapStart = .;
__HeapStart = .;
. += HeapSize; /* XXX -- Old gld can't handle this */
_HeapEnd = .;
__HeapEnd = .;
_StackStart = .;
__StackStart = .;
. += StackSize; /* XXX -- Old gld can't handle this */
/* . += 0x10000; */ /* HeapSize for old gld */
/* . += 0x1000; */ /* StackSize for old gld */
. = ALIGN (16);
_StackEnd = .;
__StackEnd = .;
stack_init = .;
clear_end = .;
_WorkspaceBase = .;
__WorkspaceBase = .;
} >ram
}
@@ -0,0 +1,139 @@
/* page_table.c
*
* The code submitted by Eric Vaitl <vaitl@viasat.com> for the MVME162 appears
* to be for a uniprocessor implementation. The function that sets up the
* page tables, page_table_init(), is not data driven. For all processors, it
* sets up page tables to map virtual addresses from 0x20000 to 0x3FFFFF to
* physical addresses 0x20000 to 0x3FFFFF. This presumably maps a subset of
* a local 4 MB space, which is probably the amount of RAM on Eric Vailt's
* MVME162.
*
* It is possible to set up the various bus bridges in the MVME167s to create
* a flat physical address space across multiple boards, i.e., it is possible
* for each MVME167 in a multiprocessor system to access a given memory
* location using the same physical address, whether that location is in local
* or VME space. Addres translation can be set up so that each virtual address
* maps to its corresponding physical address, e.g. virtual address 0x12345678
* is mapped to physical address 0x12345678. With this mapping, the MMU is
* only used to control the caching modes for the various regions of memory.
* Mapping the virtual addresses to their corresponding physical address makes
* it unnecessary to map addresses under software control during the
* initialization of RTEMS, before address translation is turned on.
*
* With the above approach, address translation may be set up either with the
* transparent address translation registers, or with page tables. If page
* tables are used, a more efficient use of page table space can be achieved
* by sharing the page tables between processors. The entire page table tree
* can be shared, or each processor can hold a private copy of the top nodes
* which point to leaf nodes stored on individual processors.
*
* In this port, only the transparent address translation registers are used.
* We map the entire virtual range from 0x0 to 0x7FFFFFFF to the identical
* physical range 0x0 to 0x7FFFFFFF. We rely on the hardware to signal bus
* errors if we address non-existent memory within this range. Our two
* MVME167s are configured to exist at physical addresses 0x00800000 to
* 0x00BFFFFF and 0x00C00000 to 0x00FFFFFF respectively. We map the space
* from 0x0 to 0x7FFFFFFF as copyback, unless jumper J1-5 is removed, in
* which case we map as writethrough. If jumper J1-7 is removed, the data
* cache is NOT enabled. If jumper J1-6 is removed, the instruction cache
* is not enabled.
*
* Copyright (c) 1998, National Research Council of Canada
*
* $Id$
*/
#include <bsp.h>
#include <page_table.h> /* Nothing in here for us */
/*
* page_table_init
*
* Map the virtual range 0x00000000--0x7FFFFFFF to the physical range
* 0x00000000--0x7FFFFFFF. Rely on the hardware to raise exceptions when
* addressing non-existent memory. Use only the transparent translation
* registers (for now).
*
* On all processors, the local virtual address range 0xFF000000--0xFFFFFFFF
* is mapped to the physical address range 0xFF000000--0xFFFFFFFF as
* caching disabled, serialized access.
*
* Input parameters:
* config_table - ignored for now
*
* Output parameters: NONE
*
* Return values: NONE
*/
void page_table_init(
rtems_configuration_table *config_table
)
{
unsigned char j1; /* State of J1 jumpers */
register unsigned long dtt0; /* Content of dtt0 */
register unsigned long cacr; /* Content of cacr */
/*
* Logical base addr = 0x00 map starting at 0x00000000
* Logical address mask = 0x7F map up to 0x7FFFFFFF
* E = 0b1 enable address translation
* S-Field = 0b1X ignore FC2 when matching
* U1, U0 = 0b00 user page attributes not used
* CM = 0b01 cachable, writethrough
* W = 0b0 read/write access allowed
*/
dtt0 = 0x007FC020;
cacr = 0x80008000; /* Data and instruction cache on */
/* Read the J1 header */
j1 = (unsigned char)(lcsr->vector_base & 0xFF);
if ( j1 & 0x80 )
/* Jumper J1-7 if off, disable data caching */
cacr &= 0x7FFFFFFF;
if ( j1 & 0x40 )
/* Jumper J1-6 if off, disable instruction caching */
cacr &= 0xFFFF7FFF;
if ( j1 & 0x20 )
/* Jumper J1-5 is off, enable writethrough caching */
dtt0 &= 0xFFFFFF9F;
/* do it ! */
asm volatile("movec %0, %%tc /* turn off paged address translation */
movec %0, %%cacr /* disable both caches */
cinva %%bc /* clear both caches */
movec %1,%%dtt0 /* block address translation on */
movec %1,%%itt0
movec %2,%%dtt1
movec %2,%%itt1
movec %3,%%cacr" /* data cache on */
:: "d" (0), "d" (dtt0), "d" (0xFF00C040), "d" (cacr));
}
/*
* page_table_teardown
*
* Turn off paging. Turn off the cache. Flush the cache. Tear down
* the transparent translations.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* Return values: NONE
*/
void page_table_teardown( void )
{
asm volatile ("movec %0,%%tc
movec %0,%%cacr
cpusha %%bc
movec %0,%%dtt0
movec %0,%%itt0
movec %0,%%dtt1
movec %0,%%itt1"
:: "d" (0) );
}
@@ -0,0 +1,59 @@
#
# $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=timerisr
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 ../wrapup/Makefile
install: all
+153
View File
@@ -0,0 +1,153 @@
/* 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.
*
* These functions are prototyped in rtems/c/src/lib/include/timerdrv.h and
* must be implemented as part of the BSP.
*
* This port does not allow the application to select which timer on the
* MVME167 to use for the timer, nor does it allow the application to
* configure the timer. The timer uses the VMEchip2 Tick Timer #1. This timer
* is distinct from the clock, which uses Tick Timer #2 in the VMEchip2.
*
* All page references are to the MVME166/MVME167/MVME187 Single Board
* Computer Programmer's Reference Guide (MVME187PG/D2) with the April 1993
* supplements/addenda (MVME187PG/D2A1).
*
* 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.
*
* Modifications of respective RTEMS file:
* Copyright (c) 1998, National Research Council of Canada
*
* $Id$
*/
#include <rtems.h>
#include <bsp.h>
/* Periodic tick interval */
#define TICK_INTERVAL 10000UL /* T1's countdown constant (10 ms) */
#define TIMER_INT_LEVEL 6 /* T1's interrupt level */
#define TIMER_VECTOR (VBR0 * 0x10 + 0x8) /* T1 is vector $X8 (p. 2-71)*/
/* Number of interrupts since timer was re-initialized */
rtems_unsigned32 Ttimer_val;
/*
* Set to TRUE to return raw value. Normally zero. Depends on being allocated
* in the .bss section and on that section being explicitly zeroed at boot
* time.
*/
rtems_boolean Timer_driver_Find_average_overhead;
rtems_isr timerisr();
/*
* This routine initializes the Tick Timer 1 on the MVME167 board.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* NOTE: This routine may not work if the optimizer is enabled for some
* compilers. The multiple writes may be optimized away.
*
* It is important that the timer start/stop overhead be
* determined when porting or modifying this code.
*
* THE VMECHIP2 PRESCALER REGISTER IS ASSUMED TO BE SET!
* The prescaler is used by all VMEchip2 timers, including the VMEbus grant
* timeout counter, the DMAC time off timer, the DMAC timer on timer, and the
* VMEbus global timeout timer. The prescaler value is normally set by the
* boot ROM to provide a 1 MHz clock to the timers. For a 25 MHz MVME167, the
* prescaler value should be 0xE7 (page 2-63).
*/
void Timer_initialize()
{
(void) set_vector( timerisr, TIMER_VECTOR, 0 );
Ttimer_val = 0; /* clear timer ISR count */
lcsr->intr_ena &= 0xFEFFFFFF; /* disable tick timer 1 interrupt */
lcsr->intr_clear |= 0x01000000; /* clear tick timer 1 interrupt */
lcsr->intr_level[0] = /* set int level */
(lcsr->intr_level[0] & 0xFFFFFFF0) | TIMER_INT_LEVEL;
lcsr->timer_cmp_1 = TICK_INTERVAL; /* period in compare register */
lcsr->timer_cnt_1 = 0; /* clear tick timer 1 counter */
lcsr->board_ctl |= 7; /* start tick timer 1, reset-on-compare, */
/* and clear overflow counter */
lcsr->intr_ena |= 0x01000000; /* enable tick timer 1 interrupt */
lcsr->vector_base |= MASK_INT; /* unmask VMEchip2 interrupts */
}
#define AVG_OVERHEAD 3UL /* It typically takes 3.0 microseconds */
/* (3 countdowns) to start/stop the timer. */
#define LEAST_VALID 3UL /* Don't trust a value lower than this */
/*
* This routine reads the Tick Timer 1 on the MVME167 board.
*
* Input parameters: NONE
*
* Output parameters: time in microseconds
*
* 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.
*/
int Read_timer()
{
rtems_unsigned32 total;
total = (Ttimer_val * TICK_INTERVAL) + lcsr->timer_cnt_1;
if ( Timer_driver_Find_average_overhead )
return total; /* in one microsecond units */
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
return total - AVG_OVERHEAD;
}
/*
* Empty function call used in loops to measure basic cost of looping
* in Timing Test Suite.
*
* Input parameters: NONE
*
* Output parameters: time in microseconds
*/
rtems_status_code Empty_function( void )
{
return RTEMS_SUCCESSFUL;
}
/*
* This routine sets the Timer_driver_Find_average_overhead flag in this
* module.
*
* Input parameters: NONE
*
* Output parameters: time in microseconds
*/
void Set_find_average_overhead(
rtems_boolean find_flag
)
{
Timer_driver_Find_average_overhead = find_flag;
}
@@ -0,0 +1,54 @@
/* timer_isr()
*
* 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.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* 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.
*
* Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
* Copyright (c) 1998, National Research Council of Canada
*
* $Id$
*/
#include "asm.h"
BEGIN_CODE
.set INTR_CLEAR_REG, 0xfff40074 | interrupt clear register
.set T1_CNTRL_REG, 0xfff40060 | tick timer 1 control register
.set CLEAR_INT, 0x01000000 | clear tick 1 interrupt
.set CLEAR_OVF, 0x00000004 | clear tick 1 overflow counter
PUBLIC (Ttimer_val)
PUBLIC (timerisr)
SYM (timerisr):
move.l a0, -(a7) | save a0
move.l d0, -(a7) | save d0
move.w sr, -(a7) | save ccr
movea.l #INTR_CLEAR_REG, a0 | a0 = addr of intr clr reg
ori.l #CLEAR_INT, (a0) | clear tick timer 1 intr
movea.l #T1_CNTRL_REG, a0 | a0 = addr of t1 cntrl reg
move.l (a0), d0 | read overflow counter
lsr.l #4, d0 | put overflow in low order bits
andi.l #0xF, d0 | keep only overflow
add.l d0, SYM (Ttimer_val) | increment timer value
ori.l #CLEAR_OVF, (a0) | clear overflow counter
move.w (a7)+, sr | restore ccr
move.l (a7)+, d0 | restore d0
move.l (a7)+, a0 | restore a0
rte
END_CODE
END
@@ -0,0 +1,49 @@
#
# $Id$
#
@SET_MAKE@
srcdir = @srcdir@
VPATH = @srcdir@
RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
BSP_PIECES=clock console fatal startup timer
GENERIC_PIECES=
# bummer; have to use $foreach since % pattern subst rules only replace 1x
OBJS=$(foreach piece, $(BSP_PIECES), ../$(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
#
# (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
+74
View File
@@ -0,0 +1,74 @@
#
# Config file for the mvme167 BSP
#
# $Id$
#
include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=m68k
RTEMS_CPU_MODEL=m68040
# This is the actual bsp directory used during the build process.
RTEMS_BSP_FAMILY=mvme167
#
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
#
CPU_CFLAGS = -m68040
# optimize flag: typically -O, could use -O4 or -fast
# -O4 is ok for RTEMS
CFLAGS_OPTIMIZE_V=-O4 -fomit-frame-pointer
# This target does NOT support the TCP/IP stack so ignore requests
# to enable it.
HAS_NETWORKING=no
# This section makes the target dependent options file.
# NDEBUG (C library)
# if defined asserts do not generate code. This is commonly used
# as a command line option.
#
# RTEMS_TEST_NO_PAUSE (RTEMS tests)
# do not pause between screens of output in the rtems tests
#
# RTEMS_DEBUG (RTEMS)
# If defined, debug checks in RTEMS and support library code are enabled.
define make-target-options
@echo "/* #define NDEBUG 1 */ " >>$@
@echo "#define RTEMS_TEST_NO_PAUSE 1" >>$@
@echo "/* #define RTEMS_DEBUG 1 */" >>$@
endef
# Here is the rule to actually build a $(ARCH)/foo.exe
# It also builds $(ARCH)/foo.nm
# Usage ref: src/tests/sptest/sp1/Makefile
#
# We use TFTP to transfer files to the MVME167. We generate binary files
# rather than S-records. We skip the header during downloads.
# The following are definitions of make-exe which will work using ld as
# is currently required. It is expected that as of gcc 2.8, the end user
# will be able to override parts of the compilers specs and link using gcc.
ifeq ($(RTEMS_USE_GCC272),yes)
define make-exe
$(LD) $(LDFLAGS) -N -T $(LINKCMDS) -o $(basename $@).exe \
$(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS) --end-group
$(NM) -g -n $(basename $@).exe > $(basename $@).nm
$(SIZE) $(basename $@).exe
endef
else
define make-exe
$(CC) $(CFLAGS) $(CFLAGS_LD) -o $(basename $@).exe \
$(LINK_OBJS) $(LINK_LIBS)
$(NM) -g -n $(basename $@).exe > $(basename $@).nm
$(SIZE) $(basename $@).exe
endef
endif
# Miscellaneous additions go here