diff options
Diffstat (limited to 'c/src/lib/libcpu/sh')
24 files changed, 0 insertions, 2505 deletions
diff --git a/c/src/lib/libcpu/sh/Makefile.in b/c/src/lib/libcpu/sh/Makefile.in deleted file mode 100644 index dfb438cc3b..0000000000 --- a/c/src/lib/libcpu/sh/Makefile.in +++ /dev/null @@ -1,14 +0,0 @@ -# -# $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)) diff --git a/c/src/lib/libcpu/sh/sh7032/Makefile.in b/c/src/lib/libcpu/sh/sh7032/Makefile.in deleted file mode 100644 index 9118ca3fca..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/Makefile.in +++ /dev/null @@ -1,14 +0,0 @@ -# -# $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 diff --git a/c/src/lib/libcpu/sh/sh7032/clock/Makefile.in b/c/src/lib/libcpu/sh/sh7032/clock/Makefile.in deleted file mode 100644 index d7946d5a8f..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/clock/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# $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 diff --git a/c/src/lib/libcpu/sh/sh7032/clock/ckinit.c b/c/src/lib/libcpu/sh/sh7032/clock/ckinit.c deleted file mode 100644 index 885cdbd752..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/clock/ckinit.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * 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 ) { - rtems_interrupt_catch( Clock_isr, CLOCK_VECTOR, &Old_ticker ); - /* - * 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_isr_entry ignored ; - rtems_interrupt_disable( isrlevel ); - rtems_interrupt_catch( args->buffer, CLOCK_VECTOR, &ignored ); - - rtems_interrupt_enable( isrlevel ); - } - } - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/lib/libcpu/sh/sh7032/console/Makefile.in b/c/src/lib/libcpu/sh/sh7032/console/Makefile.in deleted file mode 100644 index 4a57271abb..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/console/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# $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 diff --git a/c/src/lib/libcpu/sh/sh7032/console/console.c b/c/src/lib/libcpu/sh/sh7032/console/console.c deleted file mode 100644 index db308cbb55..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/console/console.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * /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 ); -} diff --git a/c/src/lib/libcpu/sh/sh7032/include/Makefile.in b/c/src/lib/libcpu/sh/sh7032/include/Makefile.in deleted file mode 100644 index 1a0b064c05..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/include/Makefile.in +++ /dev/null @@ -1,28 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH=@srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -H_FILES = $(wildcard $(srcdir)/*.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 diff --git a/c/src/lib/libcpu/sh/sh7032/include/ioqueue.h b/c/src/lib/libcpu/sh/sh7032/include/ioqueue.h deleted file mode 100644 index 55020acfad..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/include/ioqueue.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 diff --git a/c/src/lib/libcpu/sh/sh7032/include/null.h b/c/src/lib/libcpu/sh/sh7032/include/null.h deleted file mode 100644 index 9ce4886c14..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/include/null.h +++ /dev/null @@ -1,72 +0,0 @@ -/* 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 */ diff --git a/c/src/lib/libcpu/sh/sh7032/include/sci.h b/c/src/lib/libcpu/sh/sh7032/include/sci.h deleted file mode 100644 index 1b1633a488..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/include/sci.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Driver for the sh1 703x on-chip serial devices (sci) - * - * 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 _sh_sci_h -#define _sh_sci_h - -#ifdef __cplusplus -extern"C" { -#endif - -/* - * Devices are set to 9600 bps, 8 databits, 1 stopbit, no - * parity and asynchronous mode by default. - * - * NOTE: - * The onboard serial devices of the SH do not support hardware - * handshake. - */ - -#define DEVSCI_DRIVER_TABLE_ENTRY \ - { sh_sci_initialize, sh_sci_open, sh_sci_close, sh_sci_read, \ - sh_sci_write, sh_sci_control } - -extern rtems_device_driver sh_sci_initialize( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -extern rtems_device_driver sh_sci_open( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -extern rtems_device_driver sh_sci_close( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -extern rtems_device_driver sh_sci_read( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -extern rtems_device_driver sh_sci_write( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -extern rtems_device_driver sh_sci_control( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -/* Internal error codes */ -#define SH_TTY_NO_ERROR 0x2000 -#define SH_TTY_FRAME_ERR 0x2001 -#define SH_TTY_PARITY_ERR 0x2002 -#define SH_TTY_OVERRUN_ERR 0x2003 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libcpu/sh/sh7032/include/sh7_pfc.h b/c/src/lib/libcpu/sh/sh7032/include/sh7_pfc.h deleted file mode 100644 index ba6580c5fd..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/include/sh7_pfc.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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 */ diff --git a/c/src/lib/libcpu/sh/sh7032/include/sh7_sci.h b/c/src/lib/libcpu/sh/sh7032/include/sh7_sci.h deleted file mode 100644 index cb2cc03893..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/include/sh7_sci.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 */ diff --git a/c/src/lib/libcpu/sh/sh7032/null/Makefile.in b/c/src/lib/libcpu/sh/sh7032/null/Makefile.in deleted file mode 100644 index 71127550a9..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/null/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $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 diff --git a/c/src/lib/libcpu/sh/sh7032/null/close.c b/c/src/lib/libcpu/sh/sh7032/null/close.c deleted file mode 100644 index cb5ac8cd65..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/null/close.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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; -} diff --git a/c/src/lib/libcpu/sh/sh7032/null/cntrl.c b/c/src/lib/libcpu/sh/sh7032/null/cntrl.c deleted file mode 100644 index cafc714279..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/null/cntrl.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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; -} diff --git a/c/src/lib/libcpu/sh/sh7032/null/init.c b/c/src/lib/libcpu/sh/sh7032/null/init.c deleted file mode 100644 index dcc1800f6b..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/null/init.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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; -} diff --git a/c/src/lib/libcpu/sh/sh7032/null/open.c b/c/src/lib/libcpu/sh/sh7032/null/open.c deleted file mode 100644 index 352f4b981e..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/null/open.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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; -} diff --git a/c/src/lib/libcpu/sh/sh7032/null/read.c b/c/src/lib/libcpu/sh/sh7032/null/read.c deleted file mode 100644 index 895ba0c7f4..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/null/read.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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; -} diff --git a/c/src/lib/libcpu/sh/sh7032/null/write.c b/c/src/lib/libcpu/sh/sh7032/null/write.c deleted file mode 100644 index d9c4da434b..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/null/write.c +++ /dev/null @@ -1,44 +0,0 @@ -/* 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; -} diff --git a/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c b/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c deleted file mode 100644 index 42764f6eb1..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * This file contains the basic algorithms for all assembly code used - * in an specific CPU port of RTEMS. These algorithms must be implemented - * in assembly language - * - * NOTE: This port uses a C file with inline assembler instructions - * - * 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$ - * - * 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. - * - */ - -/* - * This is supposed to be an assembly file. This means that system.h - * and cpu.h should not be included in a "real" cpu_asm file. An - * implementation in assembly should include "cpu_asm.h" - */ - -#include <rtems/system.h> -#include <rtems/score/cpu.h> -#include <rtems/score/isr.h> -#include <rtems/score/thread.h> -#include <rtems/score/cpu_isps.h> -#include <rtems/score/sh_io.h> -#include <rtems/score/sh.h> -#include <rtems/score/iosh7030.h> - -/* from cpu_isps.c */ -extern proc_ptr _Hardware_isr_Table[]; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - unsigned long *_old_stack_ptr; -#endif - -register unsigned long *stack_ptr asm("r15"); - -/* - * sh_set_irq_priority - * - * this function sets the interrupt level of the specified interrupt - * - * parameters: - * - irq : interrupt number - * - prio: priority to set for this interrupt number - * - * returns: 0 if ok - * -1 on error - */ - -unsigned int sh_set_irq_priority( - unsigned int irq, - unsigned int prio ) -{ - unsigned32 shiftcount; - unsigned32 prioreg; - unsigned16 temp16; - unsigned32 level; - - /* - * first check for valid interrupt - */ - if(( irq > 113) || (_Hardware_isr_Table[irq] == _dummy_isp)) - return -1; - /* - * check for valid irq priority - */ - if( prio > 15 ) - return -1; - - /* - * look up appropriate interrupt priority register - */ - if( irq > 71) - { - irq = irq - 72; - shiftcount = 12 - ((irq & ~0x03) % 16); - - switch( irq / 16) - { - case 0: { prioreg = INTC_IPRC; break;} - case 1: { prioreg = INTC_IPRD; break;} - case 2: { prioreg = INTC_IPRE; break;} - default: return -1; - } - } - else - { - shiftcount = 12 - 4 * ( irq % 4); - if( irq > 67) - prioreg = INTC_IPRB; - else - prioreg = INTC_IPRA; - } - - /* - * Set the interrupt priority register - */ - _CPU_ISR_Disable( level ); - - temp16 = read16( prioreg); - temp16 &= ~( 15 << shiftcount); - temp16 |= prio << shiftcount; - write16( temp16, prioreg); - - _CPU_ISR_Enable( level ); - - return 0; -} - -/* - * _CPU_Context_save_fp_context - * - * This routine is responsible for saving the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_save_fp( - void **fp_context_ptr -) -{ -} - -/* - * _CPU_Context_restore_fp_context - * - * This routine is responsible for restoring the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_restore_fp( - void **fp_context_ptr -) -{ -} - -/* _CPU_Context_switch - * - * This routine performs a normal non-FP context switch. - */ - -/* within __CPU_Context_switch: - * _CPU_Context_switch - * _CPU_Context_restore - * - * This routine is generally used only to restart self in an - * efficient manner. It may simply be a label in _CPU_Context_switch. - * - * NOTE: It should be safe not to store r4, r5 - * - * NOTE: It is doubtful if r0 is really needed to be stored - * - * NOTE: gbr is added, but should not be necessary, as it is - * only used globally in this port. - */ - -/* - * FIXME: This is an ugly hack, but we wanted to avoid recalculating - * the offset each time Context_Control is changed - */ -void __CPU_Context_switch( - Context_Control *run, /* r4 */ - Context_Control *heir /* r5 */ -) -{ - -asm volatile(" - .global __CPU_Context_switch -__CPU_Context_switch: - - add %0,r4 - - stc.l sr,@-r4 - stc.l gbr,@-r4 - mov.l r0,@-r4 - mov.l r1,@-r4 - mov.l r2,@-r4 - mov.l r3,@-r4 - - mov.l r6,@-r4 - mov.l r7,@-r4 - mov.l r8,@-r4 - mov.l r9,@-r4 - mov.l r10,@-r4 - mov.l r11,@-r4 - mov.l r12,@-r4 - mov.l r13,@-r4 - mov.l r14,@-r4 - sts.l pr,@-r4 - sts.l mach,@-r4 - sts.l macl,@-r4 - mov.l r15,@-r4 - - mov r5, r4" - :: "I" (sizeof(Context_Control)) - ); - - asm volatile(" - .global __CPU_Context_restore -__CPU_Context_restore: - mov.l @r4+,r15 - lds.l @r4+,macl - lds.l @r4+,mach - lds.l @r4+,pr - mov.l @r4+,r14 - mov.l @r4+,r13 - mov.l @r4+,r12 - mov.l @r4+,r11 - mov.l @r4+,r10 - mov.l @r4+,r9 - mov.l @r4+,r8 - mov.l @r4+,r7 - mov.l @r4+,r6 - - mov.l @r4+,r3 - mov.l @r4+,r2 - mov.l @r4+,r1 - mov.l @r4+,r0 - ldc.l @r4+,gbr - ldc.l @r4+,sr - - rts - nop" ); -} - -/* - * This routine provides the RTEMS interrupt management. - */ - -void __ISR_Handler( unsigned32 vector) -{ - register unsigned32 level; - - _CPU_ISR_Disable( level ); - - _Thread_Dispatch_disable_level++; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - if( _ISR_Nest_level == 0 ) - { - /* Install irq stack */ - _old_stack_ptr = stack_ptr; - stack_ptr = _CPU_Interrupt_stack_high; - } - -#endif - - _ISR_Nest_level++; - - _CPU_ISR_Enable( level ); - - /* call isp */ - if( _ISR_Vector_table[ vector]) - (*_ISR_Vector_table[ vector ])( vector ); - - _CPU_ISR_Disable( level ); - - _ISR_Nest_level--; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - - if( _ISR_Nest_level == 0 ) - /* restore old stack pointer */ - stack_ptr = _old_stack_ptr; -#endif - - _Thread_Dispatch_disable_level--; - - _CPU_ISR_Enable( level ); - - if ( _Thread_Dispatch_disable_level == 0 ) - { - if(( _Context_Switch_necessary) || (! _ISR_Signals_to_thread_executing)) - { - _ISR_Signals_to_thread_executing = FALSE; - _Thread_Dispatch(); - } - } -} diff --git a/c/src/lib/libcpu/sh/sh7032/score/ispsh7032.c b/c/src/lib/libcpu/sh/sh7032/score/ispsh7032.c deleted file mode 100644 index 3ef3c32465..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/score/ispsh7032.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * This file contains the isp frames for the user interrupts. - * From these procedures __ISR_Handler is called with the vector number - * as argument. - * - * __ISR_Handler is kept in a separate file (cpu_asm.c), because a bug in - * some releases of gcc doesn't properly handle #pragma interrupt, if a - * file contains both isrs and normal functions. - * - * 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/system.h> -#include <rtems/score/shtypes.h> -#include <rtems/score/cpu_isps.h> - -/* - * This is a exception vector table - * - * It has the same structure like the actual vector table (vectab) - */ -proc_ptr _Hardware_isr_Table[256]={ -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, -_nmi_isp, _usb_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, -/* trapa 0 -31 */ -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -/* irq 64 ... */ -_irq0_isp, _irq1_isp, _irq2_isp, _irq3_isp, -_irq4_isp, _irq5_isp, _irq6_isp, _irq7_isp, -_dma0_isp, _dummy_isp, _dma1_isp, _dummy_isp, -_dma2_isp, _dummy_isp, _dma3_isp, _dummy_isp, -_imia0_isp, _imib0_isp, _ovi0_isp, _dummy_isp, -_imia1_isp, _imib1_isp, _ovi1_isp, _dummy_isp, -_imia2_isp, _imib2_isp, _ovi2_isp, _dummy_isp, -_imia3_isp, _imib3_isp, _ovi3_isp, _dummy_isp, -_imia4_isp, _imib4_isp, _ovi4_isp, _dummy_isp, -_eri0_isp, _rxi0_isp, _txi0_isp, _tei0_isp, -_eri1_isp, _rxi1_isp, _txi1_isp, _tei1_isp, -_prt_isp, _adu_isp, _dummy_isp, _dummy_isp, -_wdt_isp, -/* 113 */ _dref_isp -}; - -#define Str(a)#a - -/* - * Some versions of gcc and all version of egcs at least until egcs-1.1b - * are not able to handle #pragma interrupt correctly if more than 1 isr is - * contained in a file and when optimizing. - * We try to work around this problem by using the macro below. - */ -#define isp( name, number, func)\ -asm (".global _"Str(name)"\n\t" \ - "_"Str(name)": \n\t" \ - " mov.l r0,@-r15 \n\t" \ - " mov.l r1,@-r15 \n\t" \ - " mov.l r2,@-r15 \n\t" \ - " mov.l r3,@-r15 \n\t" \ - " mov.l r4,@-r15 \n\t" \ - " mov.l r5,@-r15 \n\t" \ - " mov.l r6,@-r15 \n\t" \ - " mov.l r7,@-r15 \n\t" \ - " mov.l r14,@-r15 \n\t" \ - " sts.l pr,@-r15 \n\t" \ - " sts.l mach,@-r15 \n\t" \ - " sts.l macl,@-r15 \n\t" \ - " mov r15,r14 \n\t" \ - " mov.l "Str(name)"_k, r1\n\t" \ - " jsr @r1 \n\t" \ - " mov #"Str(number)", r4\n\t" \ - " mov r14,r15 \n\t" \ - " lds.l @r15+,macl \n\t" \ - " lds.l @r15+,mach \n\t" \ - " lds.l @r15+,pr \n\t" \ - " mov.l @r15+,r14 \n\t" \ - " mov.l @r15+,r7 \n\t" \ - " mov.l @r15+,r6 \n\t" \ - " mov.l @r15+,r5 \n\t" \ - " mov.l @r15+,r4 \n\t" \ - " mov.l @r15+,r3 \n\t" \ - " mov.l @r15+,r2 \n\t" \ - " mov.l @r15+,r1 \n\t" \ - " mov.l @r15+,r0 \n\t" \ - " rte \n\t" \ - " nop \n\t" \ - " .align 2 \n\t" \ - #name"_k: \n\t" \ - ".long "Str(func)); - -/************************************************ - * Dummy interrupt service procedure for - * interrupts being not allowed --> Trap 34 - ************************************************/ -asm(" .section .text -.global __dummy_isp -__dummy_isp: - mov.l r14,@-r15 - mov r15, r14 - trapa #34 - mov.l @r15+,r14 - rte - nop"); - -/***************************** - * Non maskable interrupt - *****************************/ -isp( _nmi_isp, NMI_ISP_V, ___ISR_Handler); - -/***************************** - * User break controller - *****************************/ -isp( _usb_isp, USB_ISP_V, ___ISR_Handler); - -/***************************** - * External interrupts 0-7 - *****************************/ -isp( _irq0_isp, IRQ0_ISP_V, ___ISR_Handler); -isp( _irq1_isp, IRQ1_ISP_V, ___ISR_Handler); -isp( _irq2_isp, IRQ2_ISP_V, ___ISR_Handler); -isp( _irq3_isp, IRQ3_ISP_V, ___ISR_Handler); -isp( _irq4_isp, IRQ4_ISP_V, ___ISR_Handler); -isp( _irq5_isp, IRQ5_ISP_V, ___ISR_Handler); -isp( _irq6_isp, IRQ6_ISP_V, ___ISR_Handler); -isp( _irq7_isp, IRQ7_ISP_V, ___ISR_Handler); - -/***************************** - * DMA - controller - *****************************/ -isp( _dma0_isp, DMA0_ISP_V, ___ISR_Handler); -isp( _dma1_isp, DMA1_ISP_V, ___ISR_Handler); -isp( _dma2_isp, DMA2_ISP_V, ___ISR_Handler); -isp( _dma3_isp, DMA3_ISP_V, ___ISR_Handler); - - -/***************************** - * Interrupt timer unit - *****************************/ - -/***************************** - * Timer 0 - *****************************/ -isp( _imia0_isp, IMIA0_ISP_V, ___ISR_Handler); -isp( _imib0_isp, IMIB0_ISP_V, ___ISR_Handler); -isp( _ovi0_isp, OVI0_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 1 - *****************************/ -isp( _imia1_isp, IMIA1_ISP_V, ___ISR_Handler); -isp( _imib1_isp, IMIB1_ISP_V, ___ISR_Handler); -isp( _ovi1_isp, OVI1_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 2 - *****************************/ -isp( _imia2_isp, IMIA2_ISP_V, ___ISR_Handler); -isp( _imib2_isp, IMIB2_ISP_V, ___ISR_Handler); -isp( _ovi2_isp, OVI2_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 3 - *****************************/ -isp( _imia3_isp, IMIA3_ISP_V, ___ISR_Handler); -isp( _imib3_isp, IMIB3_ISP_V, ___ISR_Handler); -isp( _ovi3_isp, OVI3_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 4 - *****************************/ -isp( _imia4_isp, IMIA4_ISP_V, ___ISR_Handler); -isp( _imib4_isp, IMIB4_ISP_V, ___ISR_Handler); -isp( _ovi4_isp, OVI4_ISP_V, ___ISR_Handler); - - -/***************************** - * Serial interfaces - *****************************/ - -/***************************** - * Serial interface 0 - *****************************/ -isp( _eri0_isp, ERI0_ISP_V, ___ISR_Handler); -isp( _rxi0_isp, RXI0_ISP_V, ___ISR_Handler); -isp( _txi0_isp, TXI0_ISP_V, ___ISR_Handler); -isp( _tei0_isp, TEI0_ISP_V, ___ISR_Handler); - -/***************************** - * Serial interface 1 - *****************************/ -isp( _eri1_isp, ERI1_ISP_V, ___ISR_Handler); -isp( _rxi1_isp, RXI1_ISP_V, ___ISR_Handler); -isp( _txi1_isp, TXI1_ISP_V, ___ISR_Handler); -isp( _tei1_isp, TEI1_ISP_V, ___ISR_Handler); - - -/***************************** - * Parity control unit of - * the bus state controller - *****************************/ -isp( _prt_isp, PRT_ISP_V, ___ISR_Handler); - - -/****************************** - * Analog digital converter - * ADC - ******************************/ -isp( _adu_isp, ADU_ISP_V, ___ISR_Handler); - - -/****************************** - * Watchdog timer - ******************************/ -isp( _wdt_isp, WDT_ISP_V, ___ISR_Handler); - - -/****************************** - * DRAM refresh control unit - * of bus state controller - ******************************/ -isp( _dref_isp, DREF_ISP_V, ___ISR_Handler); diff --git a/c/src/lib/libcpu/sh/sh7032/timer/Makefile.in b/c/src/lib/libcpu/sh/sh7032/timer/Makefile.in deleted file mode 100644 index 8fb56cf938..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/timer/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# $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 diff --git a/c/src/lib/libcpu/sh/sh7032/timer/timer.c b/c/src/lib/libcpu/sh/sh7032/timer/timer.c deleted file mode 100644 index ddf8bfc06b..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/timer/timer.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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 */ - _CPU_ISR_install_raw_handler( ITU1_VECTOR, timerisr, &ignored ); - _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; -} diff --git a/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c b/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c deleted file mode 100644 index 42764f6eb1..0000000000 --- a/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * This file contains the basic algorithms for all assembly code used - * in an specific CPU port of RTEMS. These algorithms must be implemented - * in assembly language - * - * NOTE: This port uses a C file with inline assembler instructions - * - * 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$ - * - * 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. - * - */ - -/* - * This is supposed to be an assembly file. This means that system.h - * and cpu.h should not be included in a "real" cpu_asm file. An - * implementation in assembly should include "cpu_asm.h" - */ - -#include <rtems/system.h> -#include <rtems/score/cpu.h> -#include <rtems/score/isr.h> -#include <rtems/score/thread.h> -#include <rtems/score/cpu_isps.h> -#include <rtems/score/sh_io.h> -#include <rtems/score/sh.h> -#include <rtems/score/iosh7030.h> - -/* from cpu_isps.c */ -extern proc_ptr _Hardware_isr_Table[]; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - unsigned long *_old_stack_ptr; -#endif - -register unsigned long *stack_ptr asm("r15"); - -/* - * sh_set_irq_priority - * - * this function sets the interrupt level of the specified interrupt - * - * parameters: - * - irq : interrupt number - * - prio: priority to set for this interrupt number - * - * returns: 0 if ok - * -1 on error - */ - -unsigned int sh_set_irq_priority( - unsigned int irq, - unsigned int prio ) -{ - unsigned32 shiftcount; - unsigned32 prioreg; - unsigned16 temp16; - unsigned32 level; - - /* - * first check for valid interrupt - */ - if(( irq > 113) || (_Hardware_isr_Table[irq] == _dummy_isp)) - return -1; - /* - * check for valid irq priority - */ - if( prio > 15 ) - return -1; - - /* - * look up appropriate interrupt priority register - */ - if( irq > 71) - { - irq = irq - 72; - shiftcount = 12 - ((irq & ~0x03) % 16); - - switch( irq / 16) - { - case 0: { prioreg = INTC_IPRC; break;} - case 1: { prioreg = INTC_IPRD; break;} - case 2: { prioreg = INTC_IPRE; break;} - default: return -1; - } - } - else - { - shiftcount = 12 - 4 * ( irq % 4); - if( irq > 67) - prioreg = INTC_IPRB; - else - prioreg = INTC_IPRA; - } - - /* - * Set the interrupt priority register - */ - _CPU_ISR_Disable( level ); - - temp16 = read16( prioreg); - temp16 &= ~( 15 << shiftcount); - temp16 |= prio << shiftcount; - write16( temp16, prioreg); - - _CPU_ISR_Enable( level ); - - return 0; -} - -/* - * _CPU_Context_save_fp_context - * - * This routine is responsible for saving the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_save_fp( - void **fp_context_ptr -) -{ -} - -/* - * _CPU_Context_restore_fp_context - * - * This routine is responsible for restoring the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_restore_fp( - void **fp_context_ptr -) -{ -} - -/* _CPU_Context_switch - * - * This routine performs a normal non-FP context switch. - */ - -/* within __CPU_Context_switch: - * _CPU_Context_switch - * _CPU_Context_restore - * - * This routine is generally used only to restart self in an - * efficient manner. It may simply be a label in _CPU_Context_switch. - * - * NOTE: It should be safe not to store r4, r5 - * - * NOTE: It is doubtful if r0 is really needed to be stored - * - * NOTE: gbr is added, but should not be necessary, as it is - * only used globally in this port. - */ - -/* - * FIXME: This is an ugly hack, but we wanted to avoid recalculating - * the offset each time Context_Control is changed - */ -void __CPU_Context_switch( - Context_Control *run, /* r4 */ - Context_Control *heir /* r5 */ -) -{ - -asm volatile(" - .global __CPU_Context_switch -__CPU_Context_switch: - - add %0,r4 - - stc.l sr,@-r4 - stc.l gbr,@-r4 - mov.l r0,@-r4 - mov.l r1,@-r4 - mov.l r2,@-r4 - mov.l r3,@-r4 - - mov.l r6,@-r4 - mov.l r7,@-r4 - mov.l r8,@-r4 - mov.l r9,@-r4 - mov.l r10,@-r4 - mov.l r11,@-r4 - mov.l r12,@-r4 - mov.l r13,@-r4 - mov.l r14,@-r4 - sts.l pr,@-r4 - sts.l mach,@-r4 - sts.l macl,@-r4 - mov.l r15,@-r4 - - mov r5, r4" - :: "I" (sizeof(Context_Control)) - ); - - asm volatile(" - .global __CPU_Context_restore -__CPU_Context_restore: - mov.l @r4+,r15 - lds.l @r4+,macl - lds.l @r4+,mach - lds.l @r4+,pr - mov.l @r4+,r14 - mov.l @r4+,r13 - mov.l @r4+,r12 - mov.l @r4+,r11 - mov.l @r4+,r10 - mov.l @r4+,r9 - mov.l @r4+,r8 - mov.l @r4+,r7 - mov.l @r4+,r6 - - mov.l @r4+,r3 - mov.l @r4+,r2 - mov.l @r4+,r1 - mov.l @r4+,r0 - ldc.l @r4+,gbr - ldc.l @r4+,sr - - rts - nop" ); -} - -/* - * This routine provides the RTEMS interrupt management. - */ - -void __ISR_Handler( unsigned32 vector) -{ - register unsigned32 level; - - _CPU_ISR_Disable( level ); - - _Thread_Dispatch_disable_level++; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - if( _ISR_Nest_level == 0 ) - { - /* Install irq stack */ - _old_stack_ptr = stack_ptr; - stack_ptr = _CPU_Interrupt_stack_high; - } - -#endif - - _ISR_Nest_level++; - - _CPU_ISR_Enable( level ); - - /* call isp */ - if( _ISR_Vector_table[ vector]) - (*_ISR_Vector_table[ vector ])( vector ); - - _CPU_ISR_Disable( level ); - - _ISR_Nest_level--; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - - if( _ISR_Nest_level == 0 ) - /* restore old stack pointer */ - stack_ptr = _old_stack_ptr; -#endif - - _Thread_Dispatch_disable_level--; - - _CPU_ISR_Enable( level ); - - if ( _Thread_Dispatch_disable_level == 0 ) - { - if(( _Context_Switch_necessary) || (! _ISR_Signals_to_thread_executing)) - { - _ISR_Signals_to_thread_executing = FALSE; - _Thread_Dispatch(); - } - } -} |