From 96284fd815ec8ef4bc87844257a82ce0a26ae267 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 19 Aug 1999 21:47:51 +0000 Subject: Support for MPC505 from Sergei Organov . His patch was against 3.6.0 so was painful to merge. It should be OK but there is no guarantee and there are no BSPs in the tree to exercise it. --- c/src/lib/libcpu/powerpc/mpc505/Makefile.in | 25 +++++++ c/src/lib/libcpu/powerpc/mpc505/timer/Makefile.in | 71 ++++++++++++++++++++ c/src/lib/libcpu/powerpc/mpc505/timer/timer.c | 70 +++++++++++++++++++ .../lib/libcpu/powerpc/mpc505/vectors/Makefile.in | 70 +++++++++++++++++++ c/src/lib/libcpu/powerpc/mpc505/vectors/vectors.S | 78 ++++++++++++++++++++++ 5 files changed, 314 insertions(+) create mode 100644 c/src/lib/libcpu/powerpc/mpc505/Makefile.in create mode 100644 c/src/lib/libcpu/powerpc/mpc505/timer/Makefile.in create mode 100644 c/src/lib/libcpu/powerpc/mpc505/timer/timer.c create mode 100644 c/src/lib/libcpu/powerpc/mpc505/vectors/Makefile.in create mode 100644 c/src/lib/libcpu/powerpc/mpc505/vectors/vectors.S (limited to 'c') diff --git a/c/src/lib/libcpu/powerpc/mpc505/Makefile.in b/c/src/lib/libcpu/powerpc/mpc505/Makefile.in new file mode 100644 index 0000000000..bcf59d47c9 --- /dev/null +++ b/c/src/lib/libcpu/powerpc/mpc505/Makefile.in @@ -0,0 +1,25 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = ../../.. +subdir = libcpu/powerpc/mpc505 + +RTEMS_ROOT = @RTEMS_ROOT@ +PROJECT_ROOT = @PROJECT_ROOT@ + +VPATH = @srcdir@ + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(RTEMS_ROOT)/make/directory.cfg + +INSTALL_CHANGE = @INSTALL_CHANGE@ + +SUB_DIRS=vectors timer wrapup + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/c/src/lib/libcpu/powerpc/mpc505/timer/Makefile.in b/c/src/lib/libcpu/powerpc/mpc505/timer/Makefile.in new file mode 100644 index 0000000000..76e6803d46 --- /dev/null +++ b/c/src/lib/libcpu/powerpc/mpc505/timer/Makefile.in @@ -0,0 +1,71 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = ../../../.. +subdir = libcpu/powerpc/mpc505/timer + +RTEMS_ROOT = @RTEMS_ROOT@ +PROJECT_ROOT = @PROJECT_ROOT@ + +VPATH = @srcdir@ + +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) $(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 += $(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/hppa/BSP/wrapup/Makefile +install: all + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/c/src/lib/libcpu/powerpc/mpc505/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc505/timer/timer.c new file mode 100644 index 0000000000..c0c23efa51 --- /dev/null +++ b/c/src/lib/libcpu/powerpc/mpc505/timer/timer.c @@ -0,0 +1,70 @@ +/* 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 + */ + +#include "rtems.h" + +rtems_boolean Timer_driver_Find_average_overhead; + +static unsigned int volatile lastInitValue; + +void Timer_initialize( void ) +{ + asm volatile( " mftb %0": "=r" (lastInitValue) ); +} + +/* + * The following controls the behavior of Read_timer(). + * + * AVG_OVEREHAD is the overhead for starting and stopping the timer. It + * is usually deducted from the number returned. + * + * LEAST_VALID is the lowest number this routine should trust. Numbers + * below this are "noise" and zero is returned. + */ + +#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */ + /* (Y countdowns) to start/stop the timer. */ + /* This value is in microseconds. */ +#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ + +int Read_timer( void ) +{ + rtems_unsigned32 value; + asm volatile ( " mftb %0": "=r" (value) ); + return value - lastInitValue; +} + +/* + * 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; +} diff --git a/c/src/lib/libcpu/powerpc/mpc505/vectors/Makefile.in b/c/src/lib/libcpu/powerpc/mpc505/vectors/Makefile.in new file mode 100644 index 0000000000..dc49a30e99 --- /dev/null +++ b/c/src/lib/libcpu/powerpc/mpc505/vectors/Makefile.in @@ -0,0 +1,70 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = ../../../.. +subdir = libcpu/powerpc/mpc505/vectors + +RTEMS_ROOT = @RTEMS_ROOT@ +PROJECT_ROOT = @PROJECT_ROOT@ + +VPATH = @srcdir@ + +PGM = ${ARCH}/vectors.rel + +# 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 = vectors align_h +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 += + +${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 + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/c/src/lib/libcpu/powerpc/mpc505/vectors/vectors.S b/c/src/lib/libcpu/powerpc/mpc505/vectors/vectors.S new file mode 100644 index 0000000000..be3bd6ffe5 --- /dev/null +++ b/c/src/lib/libcpu/powerpc/mpc505/vectors/vectors.S @@ -0,0 +1,78 @@ +/* vectors.s 1.1 - 95/12/04 + * + * This file contains the assembly code for the PowerPC 505 + * interrupt veneers for RTEMS. + * + * Author: Sergei Organov + * + * COPYRIGHT (c) 1998 by JPS. + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of i-cubed limited not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * i-cubed limited makes no representations about the suitability + * of this software for any purpose. + * + */ + +#include "asm.h" +#include "ppc_offs.h" + + /* Vector offsets */ + .set reset, 0x0100 # PPC_IRQ_RESET + .set machine_check, 0x0200 # PPC_IRQ_MCHECK + .set dsi, 0x0300 # PPC_IRQ_PROTECT + .set isi, 0x0400 # PPC_IRQ_ISI + .set external_interrupt, 0x0500 # PPC_IRQ_EXTERNAL + .set alignment, 0x0600 # PPC_IRQ_ALIGN + .set program, 0x0700 # PPC_IRQ_PROGRAM + .set fp_unavailable, 0x0800 # PPC_IRQ_NOFP + .set decrementer, 0x0900 # PPC_IRQ_DEC + .set system_call, 0x0C00 # PPC_IRQ_SCALL + .set trace, 0x0D00 # PPC_IRQ_TRACE + .set fp_assist, 0x0E00 # PPC_IRQ_FPASSIST + .set software_emulation, 0x1000 # PPC_IRQ_SOFTEMU + .set data_bp, 0x1C00 # PPC_IRQ_DATA_BP + .set istruction_bp, 0x1D00 # PPC_IRQ_INST_BP + .set m_extern_bp, 0x1E00 # PPC_IRQ_MEXT_BP + .set nm_extern_bp, 0x1F00 # PPC_IRQ_NMEXT_BP + +#if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) +#define ABI_ADD 20*4 +#else +#define ABI_ADD 0 +#endif + +#define ISR_HANDLER(vector, irq) \ + .org vector; \ + stwu r1, -(ABI_ADD + IP_END)(r1); \ + stw r0, IP_0(r1); \ + li r0, irq; \ + b PROC (_ISR_Handler); + + /* Go to the right section */ + .section .vect,"ax",@progbits + .globl __vect +__vect: + ISR_HANDLER(reset, PPC_IRQ_RESET) + ISR_HANDLER(machine_check, PPC_IRQ_MCHECK) + ISR_HANDLER(dsi, PPC_IRQ_PROTECT) + ISR_HANDLER(isi, PPC_IRQ_ISI) + ISR_HANDLER(external_interrupt, PPC_IRQ_EXTERNAL) + ISR_HANDLER(alignment, PPC_IRQ_ALIGN) + ISR_HANDLER(program, PPC_IRQ_PROGRAM) + ISR_HANDLER(fp_unavailable, PPC_IRQ_NOFP) + ISR_HANDLER(decrementer, PPC_IRQ_DEC) + ISR_HANDLER(system_call, PPC_IRQ_SCALL) + ISR_HANDLER(trace, PPC_IRQ_TRACE) + ISR_HANDLER(fp_assist, PPC_IRQ_FPASSIST) + ISR_HANDLER(software_emulation, PPC_IRQ_SOFTEMU) + ISR_HANDLER(data_bp, PPC_IRQ_DATA_BP) + ISR_HANDLER(istruction_bp, PPC_IRQ_INST_BP) + ISR_HANDLER(m_extern_bp, PPC_IRQ_MEXT_BP) + ISR_HANDLER(nm_extern_bp, PPC_IRQ_NMEXT_BP) -- cgit v1.2.3