summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/a29k/portsw/startup
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-09-18 21:13:10 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-09-18 21:13:10 +0000
commit0836603ae84d389f3d5e09c92ea83d06ec88cd23 (patch)
tree42774f9013f8a96e7cf67b9aecb66346c41ff114 /c/src/lib/libbsp/a29k/portsw/startup
parentadded cast (diff)
downloadrtems-0836603ae84d389f3d5e09c92ea83d06ec88cd23.tar.bz2
new files submitted by Craig Lebakken (lebakken@minn.net) and Derrick Ostertag
(ostertag@transition.com)
Diffstat (limited to 'c/src/lib/libbsp/a29k/portsw/startup')
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/bspclean.c30
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/bspstart.c293
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/iface.c96
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/main.c39
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/ramlink11
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/romlink146
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/setvec.c49
7 files changed, 664 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/bspclean.c b/c/src/lib/libbsp/a29k/portsw/startup/bspclean.c
new file mode 100644
index 0000000000..fbd3db563e
--- /dev/null
+++ b/c/src/lib/libbsp/a29k/portsw/startup/bspclean.c
@@ -0,0 +1,30 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and usually returns
+ * control to a monitor.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+#ifndef lint
+static char _sccsid[] = "@(#)bspclean.c 04/08/96 1.1\n";
+#endif
+
+void bsp_cleanup( void )
+{
+}
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c b/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c
new file mode 100644
index 0000000000..1553203875
--- /dev/null
+++ b/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c
@@ -0,0 +1,293 @@
+/* bsp_start()
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
+
+#ifndef lint
+static char _sccsid[] = "@(#)bspstart.c 09/11/96 1.15\n";
+#endif
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/* Initialize whatever libc we are using
+ * called from postdriver hook
+ */
+
+#define HEAP_BLOCK_SIZE (16 * 1024)
+
+rtems_unsigned32 heap_size = 0;
+rtems_unsigned32 heap_start;
+
+void bsp_libc_init()
+{
+ heap_size = 2 * 1024 * 1024; /* allocate a maximum of 2 megabytes for the heap */
+
+ /* allocate all remaining memory to the heap */
+ do {
+ heap_size -= HEAP_BLOCK_SIZE;
+ heap_start = _sysalloc( heap_size );
+ } while ( !heap_start );
+
+ if (!heap_start)
+ rtems_fatal_error_occurred( heap_size );
+
+ if (heap_start & (CPU_ALIGNMENT-1))
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+
+ /*
+ * The last parameter to RTEMS_Malloc_Initialize is the "chunk"
+ * size which a multiple of will be requested on each sbrk()
+ * call by malloc(). A value of 0 indicates that sbrk() should
+ * not be called to extend the heap.
+ */
+
+ RTEMS_Malloc_Initialize((void *) heap_start, heap_size, 0);
+
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
+ /*
+ * Set up for the libc handling.
+ */
+
+ if (BSP_Configuration.ticks_per_timeslice > 0)
+ libc_init(1); /* reentrant if possible */
+ else
+ libc_init(0); /* non-reentrant */
+
+}
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void
+bsp_pretasking_hook(void)
+{
+ bsp_libc_init();
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Initialize the stack bounds checker
+ * We can either turn it on here or from the app.
+ */
+
+ Stack_check_Initialize();
+#endif
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+}
+
+
+/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+
+ printf("allocated %d heap size, %d work space size\n",
+ heap_size, BSP_Configuration.work_space_size);
+ printf(" work space start 0x%x\n",(unsigned int)BSP_Configuration.work_space_start);
+}
+
+
+int bsp_start(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ /* set the PIA0 register wait states */
+ *(volatile unsigned32 *)0x80000020 = 0x04080000;
+
+ /*
+ * Allocate the memory for the RTEMS Work Space. This can come from
+ * a variety of places: hard coded address, malloc'ed from outside
+ * RTEMS world (e.g. simulator or primitive memory manager), or (as
+ * typically done by stock BSPs) by subtracting the required amount
+ * of work space from the last physical address on the CPU board.
+ */
+
+ /*
+ * Copy the Configuration Table .. so we can change it
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * Add 1 region for the RTEMS Malloc
+ */
+
+ BSP_Configuration.RTEMS_api_configuration->maximum_regions++;
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Add 1 extension for newlib libc
+ */
+
+#ifdef RTEMS_NEWLIB
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+#ifdef STACK_CHECKER_ON
+ /*
+ * Add 1 extension for stack checker
+ */
+
+ BSP_Configuration.maximum_extensions++;
+#endif
+
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
+
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+ /*
+ * Need to "allocate" the memory for the RTEMS Workspace and
+ * tell the RTEMS configuration where it is. This memory is
+ * not malloc'ed. It is just "pulled from the air".
+ */
+
+ BSP_Configuration.work_space_start = _sysalloc( BSP_Configuration.work_space_size + 512 );
+ if (!BSP_Configuration.work_space_start)
+ rtems_fatal_error_occurred( BSP_Configuration.work_space_size );
+
+ BSP_Configuration.work_space_start = (void *) ((unsigned int)((char *)BSP_Configuration.work_space_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1));
+
+ /*
+ * initialize the CPU table for this BSP
+ */
+
+ /*
+ * we do not use the pretasking_hook
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+
+ Cpu_table.predriver_hook = NULL;
+
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.idle_task = NULL; /* do not override system IDLE task */
+
+ Cpu_table.do_zero_of_workspace = TRUE;
+
+ Cpu_table.interrupt_stack_size = 4096;
+
+ Cpu_table.extra_system_initialization_stack = 0;
+
+ /*
+ * Don't forget the other CPU Table entries.
+ */
+
+ _settrap( 109,&a29k_enable_sup);
+ _settrap( 110,&a29k_disable_sup);
+ _settrap( 111,&a29k_enable_all_sup);
+ _settrap( 112,&a29k_disable_all_sup);
+ _settrap( 106,&a29k_context_switch_sup);
+ _settrap( 107,&a29k_context_restore_sup);
+ _settrap( 108,&a29k_context_save_sup);
+ _settrap( 105,&a29k_sigdfl_sup);
+
+ /*
+ * Start RTEMS
+ */
+
+ rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+
+ bsp_cleanup();
+
+ return 0;
+}
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/iface.c b/c/src/lib/libbsp/a29k/portsw/startup/iface.c
new file mode 100644
index 0000000000..06f49f60bf
--- /dev/null
+++ b/c/src/lib/libbsp/a29k/portsw/startup/iface.c
@@ -0,0 +1,96 @@
+/*
+ * glue.c -- all the code to make GCC and the libraries run on
+ * a target board running RTEMS. These should work with
+ * any target which conforms to the RTEMS BSP.
+ *
+ * $Id$
+ */
+
+#ifndef lint
+static char _sccsid[] = "@(#)iface.c 04/12/96 1.1\n";
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+int
+read(int fd,
+ char *buf,
+ int nbytes)
+{
+ return __read(fd, buf, nbytes);
+}
+
+int
+write(int fd,
+ char *buf,
+ int nbytes)
+{
+ return __write(fd, buf, nbytes);
+}
+
+int
+open(char *buf,
+ int flags,
+ int mode)
+{
+ return __open(buf, flags, mode);
+}
+
+int
+close(int fd)
+{
+ return __close(fd);
+}
+
+/*
+ * isatty -- returns 1 if connected to a terminal device,
+ * returns 0 if not.
+ */
+int
+isatty(int fd)
+{
+ return __isatty(fd);
+}
+
+/*
+ * lseek -- move read/write pointer. Since a serial port
+ * is non-seekable, we return an error.
+ */
+off_t
+lseek(int fd,
+ off_t offset,
+ int whence)
+{
+ return __lseek(fd, offset, whence);
+}
+
+/*
+ * fstat -- get status of a file. Since we have no file
+ * system, we just return an error.
+ */
+int
+fstat(int fd,
+ struct stat *buf)
+{
+ return __fstat(fd, buf);
+}
+
+int
+getpid()
+{
+ return __getpid();
+}
+
+/*
+ * kill -- go out via exit...
+ */
+int
+kill(int pid,
+ int sig)
+{
+ return __kill(pid, sig);
+}
+
+
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/main.c b/c/src/lib/libbsp/a29k/portsw/startup/main.c
new file mode 100644
index 0000000000..c6583852f4
--- /dev/null
+++ b/c/src/lib/libbsp/a29k/portsw/startup/main.c
@@ -0,0 +1,39 @@
+/* main()
+ *
+ * This is the entry point for the application. It calls
+ * the bsp_start routine to the actual dirty work.
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+#ifndef lint
+static char _sccsid[] = "@(#)main.c 06/30/96 1.2\n";
+#endif
+
+int main(
+ int argc,
+ char **argv,
+ char **environp
+)
+{
+ bsp_start( argc, argv, environp );
+
+ /*
+ * May be able to return to the "crt/start.s" code but also
+ * may not be able to. Do something here which is board dependent.
+ */
+
+ _exit(0);
+ rtems_fatal_error_occurred( 0 );
+}
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/ramlink b/c/src/lib/libbsp/a29k/portsw/startup/ramlink
new file mode 100644
index 0000000000..8f48e3b395
--- /dev/null
+++ b/c/src/lib/libbsp/a29k/portsw/startup/ramlink
@@ -0,0 +1,11 @@
+;@(#)ez030.cmd 1.1 93/04/06 20:00:10, Copyright 1993 AMD.
+;Linker command file header for EZ-030 evaluation board.
+;Usage: ld29 -c .../29k/lib/ez030.cmd -o ...
+; -or-
+; hc29 -cmdez030.cmd ...
+;
+; $Id$
+;
+ALIGN .text=8192
+ALIGN .data=8192
+ORDER .text=0x40005000,!text,!data,!lit,!bss
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/romlink b/c/src/lib/libbsp/a29k/portsw/startup/romlink
new file mode 100644
index 0000000000..043b2ed32c
--- /dev/null
+++ b/c/src/lib/libbsp/a29k/portsw/startup/romlink
@@ -0,0 +1,146 @@
+;
+; $Id$
+;
+;#{
+;# SCCS INFORMATION:
+;# SID = @(#)sa29200.lnk 4.1; DLU=95/09/14-11:05:57
+;# Q = @(#) Copyright (C) 1995 Advanced Micro Devices, Inc.
+;# Module Type = @(#) OSBOOT/DBG_CORE absolute liker file (AMD-EPD-29K, AMIR)
+;# SCCS Path = %P\%
+;# SCCS File = %F\%
+;# FileName = sa29200.lnk
+;# SCCS ID = 4.1
+;# Date Update = 14 Sep 1995, (DLU=95/09/14-11:05:57)
+;# Date Extract = 12 Oct 1995, (DLE=95/10/12-16:27:31)
+;#}
+; @(#)sa29200.lnk 3.6 94/08/22 11:58:54, Srini, AMD.
+; This is the linker command file used to bind the inrementally linked
+; osboot.o module to a memory map. This also defines some link-time constants
+; used in the code. These constants are genral for all 29K family members.
+; You only need to customize, if necessary, the definitions that affect
+; your target processor, and leave the rest alone.
+; The default values in this file are for binding osboot.o for use with
+; SA29200 stand-alone board with the -29200/-29205 option.
+;
+; Order the code segments according to the memory map structure.
+; The defaul OSBOOT has only .text and .bss sections. You need to ORDER
+; other sections of your applications that are not included below.
+; We use separate ORDER statements below to distinguish the two memory
+; regions used. The text section is bound to ROM memory region, and the
+; data region to RAM memory space.
+; MAKE SURE to order the BSS section at the very end. This is because the
+; BSS section size could get adjusted after linking with raminit.o (produced
+; by romcoff utility) or other initialization routines. This change in size
+; could affect the offsets used by the program to refer to the remaining data
+; sections that follow BSS.
+ALIGN ProcInit=16
+ORDER Reset=0x0
+ORDER ProcInit,OsbText,.text,!text
+ORDER .lit,!lit
+ORDER vectable=0x40000000
+ORDER msg_data=0x40000400
+ORDER .data,!data
+ORDER OsbBss,dbg_030,dbg_bss,cfg_bss,.bss,!bss
+ORDER HeapBase
+ORDER .comment
+; For Stand-Alone application out of ROM use the ORDER statements below:
+; For Stand-Alone application out of RAM use the ORDER statement below:
+;ORDER Reset=0x40010000,ProcInit,OsbText,.text,!text,.lit,!lit,.data,!data,msg_data,dbg_dat,.bss,!bss,HeapBase,.comment
+;
+; definitions of link time constants used in code.
+;
+; Definition of the initial value of CPS register.
+; The value below is for an Am29200 processor. It sets TU, SM,DI, DA,IM fields
+; bits in the register. You may modify it to suit your target environment.
+; Like, changing the IM field for instance. IM is 0x11 by default enabling
+; all INTR[0-3] lines.
+;public _init_CPS=0x87F
+public _init_CPS=0x20813
+;public _init_CPS=0x2081F
+;public _init_CPS=0x081F
+; Define the memory map in general values. The code - except for simulators -
+; configures the external RAM at run-time and updates the DMemSize value.
+; DMemStart and DMemSize are the most important values below. DMemStart is
+; used to initialize the vector base address register (VAB). And DMemSize
+; is used to find the highest addressable data memory to place the register
+; and memory stacks. Remember, DMemSize is configured at run-time for hardware
+; targets and updated.
+public VectorBaseAddress=0x40000000
+public IMemStart=0x0000000
+public IMemSize=0xfffff
+public DMemStart=0x40000000
+#public DMemStart=0x100000
+public DMemSize=0xfffff
+#public DMemSize=0x17ffff
+#public DMemSize=0x3fffffff
+public RMemStart=0x0
+public RMemSize=0xfffff
+public EnableDRAMSizing=1
+;
+; For the 29K Microcontrollers, you need to define the ROM Control register
+; value (RMCT_VALUE), the ROM Configuration register value (RMCF_VALUE), and
+; the DRAM Control register value (DRCT_VALUE) based on DMemSize specified
+; above. This could be overwritten in software targets such as the simulator.
+; ROM and RAM Control registers. ROM COnfiguration. (not valid for Am2900X,
+; Am29050, and Am2903X processors)
+; The DRAM REFRATE value (in DRCT) must be specified here. To disable
+; DRAM refreshing (on a system with no DRAM), set REFRATE field in DRCT
+; to zero. Otherwise, set it to the desired frequency. The default is 0xFF
+; The default values in this file are for Am2920X processors.
+;public RMCT_VALUE=0x03030303
+;public DRCT_VALUE=0x888800FF
+;public RMCF_VALUE=0x00f8f8f8
+;
+public RMCT_VALUE=0x4a424300
+public DRCT_VALUE=0xccc000f0
+public RMCF_VALUE=0x011121ff
+;
+;
+; Execute trap handlers from ROM? If your trap handlers are in ROM space,
+; then set _TRAPINROM to TWO (0x2). It is used to modify the tarp vector
+; address installed to set the R bit when fetched. If the trap handlers in
+; ROM or if there is no ROM-space (no RE bit in CPS), set _TRAPINROM to ZERO.
+; The default in this file is for SA29200 board and _TRAPINROM is set to ZERO.
+public _TRAPINROM=0
+;
+; Define the processor clock frequencies. These values are used by the HIF
+; kernel to provide some HIF services.
+public TicksPerMillisecond=16000
+public ClockFrequency=16000000
+;
+; There are some C functions which are not leaf functions. However, they are
+; no expected to spill or fill registers. We ensure that by setting up a
+; pseudo register stack before calling those functions. The code generated
+; for those functions however do have the prologue and epilogue which refer
+; to the symbols V_SPILL and V_FILL. The linker does not know about these
+; symbols. So we define it here so that it does not complain.
+; If you use the hc29 compiler driver to link the objects it will warn that
+; the definitions here are already internally defined. You
+; can use hc29 with -nocrt0 option to do the linking for linear memory spaces.
+; public V_SPILL=64
+; public V_FILL=65
+;
+; Set the UART debug/monitor port serial communications baud rate.
+;
+public UCLK=32000000
+; INITBAUD defines the cold start baud rate. This is the baud rate
+; the monitor would use when powered up. This can be overridden by
+; defining BAUDRATE on the assembler/compiler command line.
+public INITBAUD=9600
+;
+; Is there a SCC 8530 on the target?
+; If there is an 8530 SC on target, define the symbols below appropriately.
+; The routines in scc8530.s use these values to access the registers of
+; SCC and program it. The default values are for EZ030 target.
+; Baudrate can be specified on the command-line to override the default
+; baud rate defined in scc8530.s.
+; scc channel A control
+;public SCC8530_CHA_CONTROL=0xC0000007
+; scc channel B control
+;public SCC8530_CHB_CONTROL=0xC0000003
+; scc channel A data
+;public SCC8530_CHA_DATA=0xC000000F
+; scc channel B data
+;public SCC8530_CHB_DATA=0xC000000B
+; scc baud clock generator
+;public SCC8530_BAUD_CLK_ENBL=3
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/setvec.c b/c/src/lib/libbsp/a29k/portsw/startup/setvec.c
new file mode 100644
index 0000000000..6adbc4e72a
--- /dev/null
+++ b/c/src/lib/libbsp/a29k/portsw/startup/setvec.c
@@ -0,0 +1,49 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on the target Board/CPU.
+ * This routine is allowed to be as board dependent as necessary.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+#ifndef lint
+static char _sccsid[] = "@(#)setvec.c 06/30/96 1.2\n";
+#endif
+
+no_cpu_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ no_cpu_isr_entry previous_isr;
+
+ if ( type )
+ rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr );
+ else {
+ /* XXX: install non-RTEMS ISR as "raw" interupt */
+ _settrap( vector, handler );
+ }
+ return previous_isr;
+}
+