summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/mvme162
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/m68k/mvme162')
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/README124
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c91
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/console/console.c193
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/include/bsp.h225
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/include/coverhd.h104
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c53
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c171
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/linkcmds50
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/timer/timer.c91
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/timer/timerisr.s46
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/tools/sload.c542
11 files changed, 0 insertions, 1690 deletions
diff --git a/c/src/lib/libbsp/m68k/mvme162/README b/c/src/lib/libbsp/m68k/mvme162/README
deleted file mode 100644
index cdb1f28348..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/README
+++ /dev/null
@@ -1,124 +0,0 @@
---
--- EISCAT Scientific Association. M.Savitski
---
--- This material is a part of the MVME162 Board Support Package
--- for the RTEMS executive. Its licensing policies are those of the
--- RTEMS distribution.
---
--- Updated by Joel Sherrill (jsherril@redstone.army.mil) after
--- inclusion in the standard release.
---
--- $Id$
---
-
-This is a README file for the MVME162 port of RTEMS.
-
-Disclaimer
-----------
-This is my first attempt at porting RTEMS. The resulting code obviously
-contains bugs (know and unknown) and limitations. I assume no
-responsibility for quality and support of the software in question.
-
-Now on more optimistic note:
-
-I have run most of the standard RTEMS sptests, and neither of them
-failed. My present (short) experience of developing RTEMS applications
-is essentially positive and suggestive of a long-term commitment. In
-any case I am ready to answer questions regarding the port and intend
-to follow the future RTEMS versions. I will do my best to provide
-whatever support I can afford time-wise.
-
-Installation
-------------
-Nothing unique to the MVME162. It has been incorporated into the
-standard release.
-
-Port Description
-----------------
-The port was done using already existing ports to the M68020 boards,
-DMV152 and MVME136.
-
-The host system was SUN/Solaris 2.3, and the cross-development
-environment consisted of Free Software Foundation (FSF)'s GNU C
-compiler (version 2.6), GNU Assembler (version 2.3) and GNU binary
-utilities binutils version 2.5.2, built with m68k as a target. The
-recent/latest versions of other GNU programs (flex, make, etc) were
-also used at the build stage.
-
-In all subdirectories of the RTEMS distribution tree, the directories
-mvme136 were duplicated as mvme162.
-
-Essential modifications are detailed below:
-
-- the MVME162-specific hardware registers were described in bsp.h
-
-- timer and clock routines were made to use the MVME162's Tick Timers 1
-and 2, respectively
-
-- shared memory support was replaced by stubs for the time being
-
-- console IO was lifted entirely from the DMV152 support code, thanks
-to the fact that Z8530 SCC used in DMV152 is upwards compatible with
-the Z85230 SCC of the MVME162. (Only the memory mapping of the SCC
-registers had to be changed.)
-
-- symbols in several *.s files were prepended with underscores to
-comply with the xgcc configuration used (it prepends underscores to all
-symbols defined in c code)
-
-- linkcmds file was modified to place the linked code into the memory
-configured for the board in use
-
-- bspstart.c was modified as follows:
-
- monitors_vector_table = (m68k_isr *)0xFFE00000;
-
-was made to point to the power-up location of MVME162 interrupt vector
-table.
-
-- The shutdown is a temporary solution. To exit cleanly, it has to disable
-all enabled interrupts and restore the board to its power-up status.
-Presently this is not done satisfactorily, as a result, the board needs
-a hardware reset from the external VMEbus master or from the front
-panel to ensure correct operation for subsequent downloads.
-
-Host System
------------
-The VMEbus master used to externally control and download the MVME162
-is a FORCE CPU-2CE board running Solaris 2.3. A simple program to load
-s-records and start/reset the MVME162 was written. The code is in the
-file tools/sload.c
-
-This code depends on the external VMEbus master's vme driver and is
-provided as an example, without the Makefile. The bulk of the program
-which parses the s-records is courtesy of Kym Newbery,
-(8918927y@lux.levels.unisa.edu.au).
-
-In general, apart from x-gcc, the tools most often used while building
-RTEMS for MVME162 were: find, grep, diff, and, of course
-
-MVME162 Embedded Controller Programmer's Reference Guide,
-Motorola, MVME162PG/D1.
-
-Thanks
-------
-- to On-Line Applications Research Corporation (OAR) for developing
-RTEMS and making it available on a Technology Transfer basis;
-- to Joel Sherril, the leader of the RTEMS development group for
-stimulating and helpful discussions;
-- to Kym Newbery (8918927y@lux.levels.unisa.edu.au) for his s-record
-parser;
-- to Gerd Truschinski (gt@first.gmd.de) for creating and running the
-crossgcc mailing list
-- to FSF and Cygnus Support for great free software;
-
-
-+----------------------------------+-------------------------------+
-| Dr. Mikhail (Misha) Savitski | Voice : +46-980-79162 |
-| Software Systems Engineer | Fax : +46-980-79161 |
-| EISCAT Svalbard Radar Project | E-mail: mms@eiscathq.irf.se |
-| EISCAT Scientific Association |----------- /\_/\ -----------|
-| Box 812 S-98128 Kiruna, Sweden | EIS { o o } CAT |
-+----------------------------------+-------oQQQ--(>I<)--QQQo-------+
-
-
diff --git a/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c b/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c
deleted file mode 100644
index 95e35e5f66..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Clock_init()
- *
- * This routine initializes the Tick Timer 2 on the MVME162 board.
- * The tick frequency is 1 millisecond.
- *
- * Input parameters: NONE
- *
- * Output parameters: 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.
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-#include <stdlib.h>
-
-#include <rtems.h>
-#include <bsp.h>
-#include <clockdrv.h>
-
-#define MS_COUNT 1000 /* T2's countdown constant (1 ms) */
-#define CLOCK_INT_LEVEL 6 /* T2's interrupt level */
-
-rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
-volatile rtems_unsigned32 Clock_driver_ticks;
- /* ticks since initialization */
-rtems_isr_entry Old_ticker;
-
-rtems_device_driver Clock_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *pargp,
- rtems_id tid,
- rtems_unsigned32 *rval
-)
-{
- Install_clock( Clock_isr );
-}
-
-void ReInstall_clock( clock_isr )
-rtems_isr_entry clock_isr;
-{
- rtems_unsigned32 isrlevel;
-
- rtems_interrupt_disable( isrlevel );
- (void) set_vector( clock_isr, (VECTOR_BASE >> 28) * 0x10 + 0x9, 1 );
- rtems_interrupt_enable( isrlevel );
-}
-
-void Install_clock( clock_isr )
-rtems_isr_entry clock_isr;
-{
-
- Clock_driver_ticks = 0;
- Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
-
- if ( BSP_Configuration.ticks_per_timeslice ) {
- Old_ticker = (rtems_isr_entry)
- set_vector( clock_isr, (VECTOR_BASE >> 28) * 0x10 + 0x9, 1 );
-
- lcsr->vector_base = 0x67800000; /* set vb, enable interrupts */
- lcsr->to_ctl = 0xE7; /* prescaler to 1 MHz (see Appendix A1) */
- lcsr->timer_cmp_2 = MS_COUNT;
- lcsr->timer_cnt_2 = 0; /* clear counter */
- lcsr->board_ctl |= 0x700; /* increment, reset-on-compare, clear-ovfl-cnt */
-
- lcsr->intr_level[0] |= CLOCK_INT_LEVEL * 0x10; /* set int level */
- lcsr->intr_ena |= 0x02000000; /* enable tick timer 2 interrupt */
-
- atexit( Clock_exit );
- }
-
-}
-
-void Clock_exit( void )
-{
-/* Dummy for now. See other m68k BSP's for code examples */
-}
diff --git a/c/src/lib/libbsp/m68k/mvme162/console/console.c b/c/src/lib/libbsp/m68k/mvme162/console/console.c
deleted file mode 100644
index 7e8f5132f9..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/console/console.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * This file contains the MVME162 console IO package.
- *
- * 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.
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-#define M162_INIT
-
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
-
-/* 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_id self,
- rtems_unsigned32 *status
-)
-{
- *status = RTEMS_SUCCESSFUL;
-}
-
-
-/* is_character_ready
- *
- * This routine returns TRUE if a character is available.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * Return values:
- */
-
-rtems_boolean is_character_ready(
- char *ch
-)
-{
- rtems_unsigned8 rr_0;
-
- Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
- if ( !(rr_0 & RR_0_RX_DATA_AVAILABLE) )
- return( FALSE );
-
- Z8x30_READ_DATA( CONSOLE_DATA, *ch );
-
- return(TRUE);
-}
-
-/* inbyte
- *
- * This routine reads a character from the SCC.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * Return values:
- * character read from SCC
- */
-
-char inbyte( void )
-{
- rtems_unsigned8 rr_0;
- char ch;
-
- while ( 1 ) {
- Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
- if ( (rr_0 & RR_0_RX_DATA_AVAILABLE) != 0 )
- break;
- }
-
- Z8x30_READ_DATA( CONSOLE_DATA, ch );
- return ch;
-}
-
-
-/* outbyte
- *
- * This routine transmits a character out the SCC. It supports
- * XON/XOFF flow control.
- *
- * Input parameters:
- * ch - character to be transmitted
- *
- * Output parameters: NONE
- */
-
-void outbyte(
- char ch
-)
-{
- rtems_unsigned8 rr_0;
- char flow_control;
-
- while ( 1 ) {
- Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
- if ( (rr_0 & RR_0_TX_BUFFER_EMPTY) != 0 )
- break;
- }
-
- while ( 1 ) {
- Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
- if ( (rr_0 & RR_0_RX_DATA_AVAILABLE) == 0 )
- break;
-
- Z8x30_READ_DATA( CONSOLE_DATA, flow_control );
-
- if ( flow_control == XOFF )
- do {
- do {
- Z8x30_READ_CONTROL( CONSOLE_CONTROL, RR_0, rr_0 );
- } while ( (rr_0 & RR_0_RX_DATA_AVAILABLE) == 0 );
- Z8x30_READ_DATA( CONSOLE_DATA, flow_control );
- } while ( flow_control != XON );
- }
-
- Z8x30_WRITE_DATA( CONSOLE_DATA, ch );
-}
-
-/*
- * __read -- read bytes from the serial port. Ignore fd, since
- * we only have stdin.
- */
-
-int __read(
- int fd,
- char *buf,
- int nbytes
-)
-{
- int i = 0;
-
- for (i = 0; i < nbytes; i++) {
- *(buf + i) = inbyte();
- if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
- (*(buf + i++)) = '\n';
- (*(buf + i)) = 0;
- break;
- }
- }
- return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- * stdout and stderr are the same. Since we have no filesystem,
- * open will only return an error.
- */
-
-int __write(
- int fd,
- char *buf,
- int nbytes
-)
-{
- int i;
-
- for (i = 0; i < nbytes; i++) {
- if (*(buf + i) == '\n') {
- outbyte ('\r');
- }
- outbyte (*(buf + i));
- }
- return (nbytes);
-}
diff --git a/c/src/lib/libbsp/m68k/mvme162/include/bsp.h b/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
deleted file mode 100644
index 0b3a7d76d8..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/* bsp.h
- *
- * This include file contains all MVME162 board IO definitions.
- *
- * 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.
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-#ifndef __MVME162_h
-#define __MVME162_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <rtems.h>
-#include <iosupp.h>
-#include <z8530.h>
-
-/*
-// Following defines must reflect the setup of the particular MVME162
-//-----------------------------------
-*/
-#define GROUP_BASE_ADDRESS 0x0000F200
-#define BOARD_BASE_ADDRESS 0x00000000
-/* Base for local interrupters' vectors (with enable bit set) */
-#define VECTOR_BASE 0x67800000
-/* RAM limits */
-#define RAM_START 0x00100000
-#define RAM_END 0x00200000
-/*
-//-----------------------------------
-*/
-static volatile struct lcsr {
- unsigned long slave_adr[2];
- unsigned long slave_trn[2];
- unsigned long slave_ctl;
- unsigned long mastr_adr[4];
- unsigned long mastr_trn;
- unsigned long mastr_att;
- unsigned long mastr_ctl;
- unsigned long dma_ctl_1;
- unsigned long dma_ctl_2;
- unsigned long dma_loc_cnt;
- unsigned long dma_vme_cnt;
- unsigned long dma_byte_cnt;
- unsigned long dma_adr_cnt;
- unsigned long dma_status;
- unsigned long to_ctl;
- unsigned long timer_cmp_1;
- unsigned long timer_cnt_1;
- unsigned long timer_cmp_2;
- unsigned long timer_cnt_2;
- unsigned long board_ctl;
- unsigned long prescaler_cnt;
- unsigned long intr_stat;
- unsigned long intr_ena;
- unsigned long intr_soft_set;
- unsigned long intr_clear;
- unsigned long intr_level[4];
- unsigned long vector_base;
-} *lcsr = (void *) 0xFFF40000;
-
-#define USE_CHANNEL_A 1 /* 1 = use channel A for console */
-#define USE_CHANNEL_B 0 /* 1 = use channel B for console */
-
-/* Constants */
-
-#if (USE_CHANNEL_A == 1)
- #define CONSOLE_CONTROL 0xFFF45005
- #define CONSOLE_DATA 0xFFF45007
-#elif (USE_CHANNEL_B == 1)
- #define CONSOLE_CONTROL 0xFFF45001
- #define CONSOLE_DATA 0xFFF45003
-#endif
-
-/*
-// The following registers are located in the VMEbus short
-// IO space and respond to address modifier codes $29 and $2D.
-// On FORCE SPARC CPU use address gcsr_vme and device /dev/vme16d32.
-*/
-static volatile struct gcsr {
- unsigned char chip_revision;
- unsigned char chip_id;
- unsigned char lmsig;
- unsigned char board_scr;
- unsigned short gpr[6];
-} *gcsr_vme = (void *) (GROUP_BASE_ADDRESS + BOARD_BASE_ADDRESS),
- *gcsr = (void *) 0xFFF40100;
-
-static volatile unsigned short *ipio[6] = { (unsigned short *) 0xFFF58000,
- (unsigned short *) 0xFFF58100,
- (unsigned short *) 0xFFF58200,
- (unsigned short *) 0xFFF58300,
- (unsigned short *) 0xFFF58400,
- (unsigned short *) 0xFFF58500
- };
-
-static volatile unsigned short *ipid[6] = { (unsigned short *) 0xFFF58080,
- (unsigned short *) 0xFFF58180,
- (unsigned short *) 0xFFF58280,
- (unsigned short *) 0xFFF58380,
- (unsigned short *) 0xFFF58080,
- (unsigned short *) 0xFFF58280
- };
-
-static volatile struct ipic_space {
- struct sing {
- unsigned short io_space[64];
- unsigned short id_space[32];
- unsigned short id_reptd[32];
- } single[4];
- struct twin {
- unsigned short io_space[128];
- unsigned short io_reptd[128];
- } twin[2];
-} *ipic_space = (void *) 0xFFF58000;
-
-static volatile struct ipic_csr {
- unsigned char chip_id;
- unsigned char chip_rev;
- unsigned char res[2];
- unsigned short a_31_16_base;
- unsigned short b_31_16_base;
- unsigned short c_31_16_base;
- unsigned short d_31_16_base;
- unsigned char a_23_16_size;
- unsigned char b_23_16_size;
- unsigned char c_23_16_size;
- unsigned char d_23_16_size;
- unsigned short a_intr_cnt;
- unsigned short b_intr_cnt;
- unsigned short c_intr_cnt;
- unsigned short d_intr_cnt;
-} *ipic_csr = (void *) 0xFFFBC000;
-
-/*
- * Define the time limits for RTEMS Test Suite test durations.
- * Long test and short test duration limits are provided. These
- * values are in seconds and need to be converted to ticks for the
- * application.
- *
- */
-
-#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
-#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
-
-/*
- * Define the interrupt mechanism for Time Test 27
- *
- * NOTE: Not implemented
- */
-
-#define MUST_WAIT_FOR_INTERRUPT 0
-
-#define Install_tm27_vector( handler )
-
-#define Cause_tm27_intr()
-
-#define Clear_tm27_intr()
-
-#define Lower_tm27_intr()
-
-/*
- * Simple spin delay in microsecond units for device drivers.
- * This is very dependent on the clock speed of the target.
- */
-
-#define delay( microseconds ) \
- { register rtems_unsigned32 _delay=(microseconds); \
- register rtems_unsigned32 _tmp=123; \
- asm volatile( "0: \
- nbcd %0 ; \
- nbcd %0 ; \
- dbf %1,0b" \
- : "=d" (_tmp), "=d" (_delay) \
- : "0" (_tmp), "1" (_delay) ); \
- }
-
-/* Constants */
-
-#ifdef 1626_INIT
-#undef EXTERN
-#define EXTERN
-#else
-#undef EXTERN
-#define EXTERN extern
-#endif
-
-/* miscellaneous stuff assumed to exist */
-
-extern rtems_configuration_table BSP_Configuration;
-
-extern m68k_isr M68Kvec[]; /* vector table address */
-
-/* functions */
-
-void bsp_cleanup( void );
-
-m68k_isr set_vector(
- rtems_isr_entry handler,
- rtems_vector_number vector,
- int type
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/mvme162/include/coverhd.h b/c/src/lib/libbsp/m68k/mvme162/include/coverhd.h
deleted file mode 100644
index 0033a50502..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/include/coverhd.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* coverhd.h
- *
- * This include file has defines to represent the overhead associated
- * with calling a particular directive from C on this target.
- *
- * COPYRIGHT (c) 1989, 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$
- */
-
-#ifndef __COVERHD_h
-#define __COVERHD_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 2
-#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 1
-#define CALLING_OVERHEAD_TASK_CREATE 3
-#define CALLING_OVERHEAD_TASK_IDENT 2
-#define CALLING_OVERHEAD_TASK_START 2
-#define CALLING_OVERHEAD_TASK_RESTART 2
-#define CALLING_OVERHEAD_TASK_DELETE 1
-#define CALLING_OVERHEAD_TASK_SUSPEND 1
-#define CALLING_OVERHEAD_TASK_RESUME 2
-#define CALLING_OVERHEAD_TASK_SET_PRIORITY 2
-#define CALLING_OVERHEAD_TASK_MODE 2
-#define CALLING_OVERHEAD_TASK_GET_NOTE 2
-#define CALLING_OVERHEAD_TASK_SET_NOTE 2
-#define CALLING_OVERHEAD_TASK_WAKE_WHEN 4
-#define CALLING_OVERHEAD_TASK_WAKE_AFTER 1
-#define CALLING_OVERHEAD_INTERRUPT_CATCH 2
-#define CALLING_OVERHEAD_CLOCK_GET 4
-#define CALLING_OVERHEAD_CLOCK_SET 4
-#define CALLING_OVERHEAD_CLOCK_TICK 1
-
-#define CALLING_OVERHEAD_TIMER_CREATE 2
-#define CALLING_OVERHEAD_TIMER_IDENT 1
-#define CALLING_OVERHEAD_TIMER_DELETE 2
-#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 2
-#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 5
-#define CALLING_OVERHEAD_TIMER_RESET 1
-#define CALLING_OVERHEAD_TIMER_CANCEL 1
-#define CALLING_OVERHEAD_SEMAPHORE_CREATE 2
-#define CALLING_OVERHEAD_SEMAPHORE_IDENT 1
-#define CALLING_OVERHEAD_SEMAPHORE_DELETE 2
-#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 2
-#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 1
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 2
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 2
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 1
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 2
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 2
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 2
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 2
-#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 2
-
-#define CALLING_OVERHEAD_EVENT_SEND 2
-#define CALLING_OVERHEAD_EVENT_RECEIVE 2
-#define CALLING_OVERHEAD_SIGNAL_CATCH 2
-#define CALLING_OVERHEAD_SIGNAL_SEND 2
-#define CALLING_OVERHEAD_PARTITION_CREATE 3
-#define CALLING_OVERHEAD_PARTITION_IDENT 2
-#define CALLING_OVERHEAD_PARTITION_DELETE 2
-#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 2
-#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 2
-#define CALLING_OVERHEAD_REGION_CREATE 3
-#define CALLING_OVERHEAD_REGION_IDENT 2
-#define CALLING_OVERHEAD_REGION_DELETE 1
-#define CALLING_OVERHEAD_REGION_GET_SEGMENT 3
-#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 2
-#define CALLING_OVERHEAD_PORT_CREATE 3
-#define CALLING_OVERHEAD_PORT_IDENT 2
-#define CALLING_OVERHEAD_PORT_DELETE 2
-#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 2
-#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 2
-
-#define CALLING_OVERHEAD_IO_INITIALIZE 3
-#define CALLING_OVERHEAD_IO_OPEN 2
-#define CALLING_OVERHEAD_IO_CLOSE 2
-#define CALLING_OVERHEAD_IO_READ 2
-#define CALLING_OVERHEAD_IO_WRITE 2
-#define CALLING_OVERHEAD_IO_CONTROL 2
-#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 1
-#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 2
-#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 2
-#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 1
-#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 1
-#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 2
-#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 1
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
deleted file mode 100644
index 215a53cc46..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This routine returns control to 162Bug.
- *
- * 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.
- *
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-#include <rtems.h>
-#include <bsp.h>
-#include <z8036.h>
-
-void bsp_return_to_monitor_trap()
-{
- extern void start( void );
-
- lcsr->intr_ena = 0; /* disable interrupts */
- m68k_set_vbr(0xFFE00000); /* restore 162Bug vectors */
- asm volatile( "trap #15" ); /* trap to 162Bug */
- asm volatile( ".short 0x63" ); /* return to 162Bug (.RETURN) */
- /* restart program */
- /*
- * This does not work on the 162....
- */
-#if 0
- { register volatile void *start_addr;
-
- start_addr = start;
-
- asm volatile ( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) );
- }
-#endif
-}
-
-void bsp_cleanup( void )
-{
- M68Kvec[ 45 ] = bsp_return_to_monitor_trap; /* install handler */
- asm volatile( "trap #13" ); /* insures SUPV mode */
-}
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
deleted file mode 100644
index fb137f7ebc..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* 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.
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-#include <rtems.h>
-#include <bsp.h>
-#include <libcsupport.h>
-#include <z8036.h>
-
-/*
- * 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;
-
-/* Initialize whatever libc we are using
- * called from postdriver hook
- */
-
-void bsp_libc_init()
-{
- extern int end;
- rtems_unsigned32 heap_start;
-
- heap_start = (rtems_unsigned32) &end;
- if (heap_start & (CPU_ALIGNMENT-1))
- heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
-
- RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
-
- /*
- * 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 */
-
- /*
- * Initialize the stack bounds checker
- */
-
-#ifdef STACK_CHECKER_ON
- Stack_check_Initialize();
-#endif
-}
-
-int bsp_start(
- int argc,
- char **argv,
- char **environp
-)
-{
- m68k_isr *monitors_vector_table;
- int index;
-
- /*
- * 162Bug Vectors are at 0xFFE00000
- */
-
- monitors_vector_table = (m68k_isr *)0xFFE00000;
-
- m68k_set_vbr( monitors_vector_table );
-
- for ( index=2 ; index<=255 ; index++ )
- M68Kvec[ index ] = monitors_vector_table[ 32 ];
-
- M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */
- M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
- M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
- M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */
-
- m68k_set_vbr( &M68Kvec );
-
- /*
- * You may wish to make VME access round-robin here, currently
- * we leave it as it is.
- */
-
- lcsr->vector_base = VECTOR_BASE; /* set the vector base register */
-
- m68k_enable_caching();
-
- /*
- * we only use a hook to get the C library initialized.
- */
-
- Cpu_table.pretasking_hook = NULL;
-
- Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */
-
- Cpu_table.postdriver_hook = NULL; /* Call our main() for constructors */
-
- Cpu_table.idle_task = NULL; /* do not override system IDLE task */
-
- Cpu_table.do_zero_of_workspace = TRUE;
-
- Cpu_table.interrupt_vector_table = (m68k_isr *) &M68Kvec;
-
- Cpu_table.interrupt_stack_size = 4096;
-
- Cpu_table.extra_system_initialization_stack = 0;
-
- /*
- * Copy the table
- */
-
- BSP_Configuration = Configuration;
-
- /*
- * Add 1 region for the RTEMS Malloc
- */
-
- BSP_Configuration.maximum_regions++;
-
- /*
- * Add 1 extension for newlib libc
- */
-
-#ifdef RTEMS_NEWLIB
- BSP_Configuration.maximum_extensions++;
-#endif
-
- /*
- * Add another extension if using the stack checker
- */
-
-#ifdef STACK_CHECKER_ON
- BSP_Configuration.maximum_extensions++;
-#endif
-
- BSP_Configuration.work_space_start = (void *)
- (RAM_END - BSP_Configuration.work_space_size);
-
- rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
- /* does not return */
-
- bsp_cleanup();
-
- return 0;
-}
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds
deleted file mode 100644
index 21a844ca88..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file contains directives for the GNU linker which are specific
- * to the Motorola MVME162 board.
- *
- * 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.
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-MEMORY
- {
- ram : org = 0x100000, l = 1M
- }
-
-SECTIONS
-{
- .text 0x100000 :
- {
- text_start = . ;
- *(.text)
- etext = ALIGN( 0x10 ) ;
- }
- .data ADDR( .text ) + SIZEOF( .text ):
- {
- data_start = . ;
- *(.data)
- edata = ALIGN( 0x10 ) ;
- }
- .bss ADDR( .data ) + SIZEOF( .data ):
- {
- bss_start = . ;
- *(.bss)
- *(COMMON)
- end = . ;
- _end = . ;
- }
-}
diff --git a/c/src/lib/libbsp/m68k/mvme162/timer/timer.c b/c/src/lib/libbsp/m68k/mvme162/timer/timer.c
deleted file mode 100644
index c000fadd28..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/timer/timer.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Timer_init()
- *
- * This routine initializes the Tick Timer 1 on the MVME162 board.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * NOTE: This routine will not work if the optimizer is enabled
- * for some compilers. The multiple writes
- * may be optimized away.
- *
- * It is important that the timer start/stop overhead be
- * determined when porting or modifying this code.
- *
- * 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.
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-
-#include <rtems.h>
-#include <bsp.h>
-
-/* Periodic tick interval */
-#define TICK_INTERVAL 0x10000
-#define TIMER_INT_LEVEL 6
-
-int Ttimer_val;
-rtems_boolean Timer_driver_Find_average_overhead;
-
-rtems_isr timerisr();
-
-void Timer_initialize()
-{
- (void) set_vector( timerisr, (VECTOR_BASE >> 28) * 0x10 + 0x8, 0 );
-
- Ttimer_val = 0; /* clear timer ISR count */
- lcsr->vector_base = 0x67800000; /* set vb, enable interrupts */
- lcsr->to_ctl = 0xE7; /* prescaler to 1 MHz (see Appendix A1) */
- lcsr->timer_cmp_1 = TICK_INTERVAL;
- lcsr->timer_cnt_1 = 0; /* clear counter */
- lcsr->board_ctl |= 7; /* increment, reset-on-compare, clear-ovfl-cnt */
-
- lcsr->intr_level[0] |= TIMER_INT_LEVEL; /* set int level */
- lcsr->intr_ena |= 0x01000000; /* enable tick timer 1 interrupt */
-}
-
-#define AVG_OVERHEAD 6 /* It typically takes 3.0 microseconds */
- /* (6 countdowns) to start/stop the timer. */
-#define LEAST_VALID 10 /* Don't trust a value lower than this */
-
-int Read_timer()
-{
- unsigned long total;
-
- total = (Ttimer_val * TICK_INTERVAL) + lcsr->timer_cnt_1;
-
- if ( Timer_driver_Find_average_overhead == 1 )
- return total; /* in one-half microsecond units */
-
- if ( total < LEAST_VALID )
- return 0; /* below timer resolution */
-
- return (total-AVG_OVERHEAD); /* in musec units */
-}
-
-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/libbsp/m68k/mvme162/timer/timerisr.s b/c/src/lib/libbsp/m68k/mvme162/timer/timerisr.s
deleted file mode 100644
index af31e4276b..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/timer/timerisr.s
+++ /dev/null
@@ -1,46 +0,0 @@
-/* timer_isr()
- *
- * This routine provides the ISR for the Z8036 timer on the MVME136
- * board. The timer is set up to generate an interrupt at maximum
- * intervals.
- *
- * Input parameters: NONE
- *
- * Output parameters: 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.
- *
- * Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
- * EISCAT Scientific Association. M.Savitski
- *
- * This material is a part of the MVME162 Board Support Package
- * for the RTEMS executive. Its licensing policies are those of the
- * RTEMS above.
- *
- * $Id$
- */
-
-#include "asm.h"
-
-BEGIN_CODE
-
-.set INTR_CLEAR_REG, 0xfff40074 | interrupt clear register
-.set RELOAD, 0x01000000 | clear tick 1 interrupt
-
- PUBLIC (timerisr)
-SYM (timerisr):
- move.l a0, -(a7) | save a0
- movea.l #INTR_CLEAR_REG, a0 | a0 = addr of cmd status reg
- ori.l #RELOAD, (a0) | reload countdown
- addq.l #1, SYM (Ttimer_val) | increment timer value
- move.l (a7)+, a0 | restore a0
- rte
-
-END_CODE
-END
diff --git a/c/src/lib/libbsp/m68k/mvme162/tools/sload.c b/c/src/lib/libbsp/m68k/mvme162/tools/sload.c
deleted file mode 100644
index 8ce44d7a4b..0000000000
--- a/c/src/lib/libbsp/m68k/mvme162/tools/sload.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- *
- * Copyright (c) 1994 by EISCAT Scientific Association.
- * All Rights Reserved.
- * M.Savitski
- *
- * S-record code - courtesy of Kym Newbery
- * 8918927y@lux.levels.unisa.edu.au
- *
- * Loading S-records into the VMEbus memory.
- *
- * Loads an executable in s-record format into the MVME dual-ported
- * memory and directs the MVME CPU to start execution.
- * VMEbus access is done via the FORCE CPU-2CE vmeplus driver in
- * read/write mode for loading and in mmap mode for accessing MVME registers.
- * See mvme162.h for #define's dependent on the MVME162 setup.
- *
- * $Id$
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/resource.h>
-#include <unistd.h>
-#include <sys/vme.h>
-#include <sys/mman.h>
-
-#include "../include/bsp.h"
-
-#define FALSE 0
-#define TRUE 1
-
-#define DATA19 0
-#define DATA28 1
-#define DATA37 3
-#define HEADER 4
-#define TERMINATOR 5
-#define NONE 6
-
-unsigned int ahdtoi(unsigned char digit);
-int issrec(char *str);
-int validrec(char *str);
-void hdr2str(char *sstr, char *pstr);
-unsigned long getaddr(char *str);
-unsigned int datasize(char *str);
-void usage (void);
-int MVMEControl(u_long entry, int reset, int go);
-
-unsigned int ahdtoi(unsigned char digit)
-/* converts a hexadecimal char to an integer
- *
- * entry : digit = character to convert
- * : 0..15 = result
- * : -1 = char is not a digit
- */
-{
-/* check digit */
- if (!isxdigit(digit))
- return(-1);
-
- switch (toupper(digit)) {
- case 'A' : return(0xA);
- case 'B' : return(0xB);
- case 'C' : return(0xC);
- case 'D' : return(0xD);
- case 'E' : return(0xE);
- case 'F' : return(0xF);
- default : return(digit - 0x30);
- }
-}
-
-int issrec(char *str)
-/* attempts to identify the type of Srecord string passed
- *
- * entry : str = pointer to null terminated string
- * returns : 0,1,2,3,5,7,8,9 for S0..S9 except S6 & S4
- * : -1 = invalid header or header not found
- * : -2 = invalid header number
- */
-{
-/* Check first character for S */
- if ((isupper(str[0]) && (str[0] == 'S')) ||
- (islower(str[0]) && (str[0] == 's')))
- {
- /* check for valid header number */
- switch (str[1]) {
- case '0' : return 0; /* header record */
- case '1' : return 1; /* data record, 2byte addr */
- case '2' : return 2; /* " " , 3byte addr */
- case '3' : return 3; /* " " , 4byte addr */
- case '5' : return 5; /* number of S1,S2,S3 blocks */
- case '7' : return 7; /* S3 terminator */
- case '8' : return 8; /* S2 terminator */
- case '9' : return 9; /* S1 terminator */
- default : return -2; /* all others are invalid */
- }
- }
- return(-1);
-}
-
-int validrec(char *str)
-/* Tests for a valid srecord. tests checksum & for nondigit characters
- * doesn't rely on any other srecord routines.
- *
- * entry : str = pointer to null terminated string
- * returns : -1 = srecord contains invalid characters
- * : -2 = srecord checksum is invalid
- * : -3 = srecord record length is invalid
- * : 0 = srecord is valid
- */
-{
- int cn = 1, rlen=0;
- int mchksum=0, rchksum=0;
-
-/* first check if there are any non-digit characters except S */
- while (str[cn]!=0)
- if (!isxdigit(str[cn++]))
- return(-1);
-
-/* test number of data bytes */
- rlen = ahdtoi(str[2])* 0x10 + ahdtoi(str[3]);
- if (((strlen(str)-4)/2U) != rlen) return(-3);
-
-/* get checksum from string */
- rchksum = ahdtoi(str[rlen*2+2])*0x10 + ahdtoi(str[rlen*2+3]);
- /* string chksum */
-
-/* now calculate my own checksum */
- for (cn=2; cn <= rlen*2; )
- mchksum += ahdtoi(str[cn++])*0x10 + ahdtoi(str[cn++]);
- mchksum = ~mchksum & 0xFF;
- if (mchksum != rchksum) return(-2); /* return -2 in not equal */
-
-/* return OK if we didn't fail any of these tests */
- return(0);
-}
-
-void hdr2str(char *sstr, char *pstr)
-/* converts header record (S0) string into a plain string
- *
- * entry : sstr = pointer to S0 string record
- * exit : pstr = pointer to string long enough to hold string
- * (caller must allocate enough space for string)
- */
-{
- int rlen, cn, pn=0;
-
- rlen = ahdtoi(sstr[2])*0x10 + ahdtoi(sstr[3]);
- for (cn=8; cn <= rlen*2; )
- pstr[pn++] = ahdtoi(sstr[cn++])*0x10 + ahdtoi(sstr[cn++]);
- pstr[pn]=0;
-}
-
-unsigned long getaddr(char *str)
-/* returns the address of the srecord in str. assumes record is valid.
- *
- * entry : str = pointer to srecord string
- * exit : address of data, word or long.
- */
-{
- unsigned long addr=0;
-
- switch (issrec(str)) {
- case 0 :
- case 1 :
- case 5 :
- case 9 :
- addr = ahdtoi(str[4])*0x1000 + ahdtoi(str[5])*0x100
- + ahdtoi(str[6])*0x10 + ahdtoi(str[7]);
- return(addr);
- case 2 :
- case 8 :
- addr = ahdtoi(str[4])*0x100000 + ahdtoi(str[5])*0x10000
- + ahdtoi(str[6])*0x1000 + ahdtoi(str[7])*0x100
- + ahdtoi(str[8])*0x10 + ahdtoi(str[9]);
- return(addr);
- case 3 :
- case 7 :
- addr = ahdtoi(str[4])*0x10000000 + ahdtoi(str[5])*0x1000000
- + ahdtoi(str[6])*0x100000 + ahdtoi(str[7])*0x10000
- + ahdtoi(str[8])*0x1000 + ahdtoi(str[9])*0x100
- + ahdtoi(str[10])*0x10 + ahdtoi(str[11]);
- return(addr);
- default : return(-1);
- }
-}
-
-unsigned int datasize(char *str)
-/*
- * returns the number of data bytes in the srecord. assumes record is valid.
- *
- * entry : str = pointer to srecord string
- * exit : number of bytes of data in the data field.
- */
-{
- unsigned int size=0;
-
- switch (issrec(str)) {
- case 0 :
- case 1 :
- case 5 :
- case 7 :
- case 8 :
- case 9 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]);
- return(size-3);
- case 2 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]);
- return(size-4);
- case 3 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]);
- return(size-5);
- default : return(-1);
- }
-}
-
-void usage (void)
-/*
- * prints correct usage on stdout
- */
-{
- printf("\nUSAGE : sload [-v][-g][-r] [file]\n");
- printf(" file is an s-record file\n");
- printf(" -v for verbose summary of s-records loaded\n");
- printf(" -g to start execution\n");
- printf(" -r to reset MVME162\n\n");
-}
-
-int MVMEControl(u_long entry, int reset, int go)
-/* Controls MVME-162 from other VME master:
- * if entry != 0, loads it as start address
- * if go != 0, starts program execution from entry
- * if reset != 0, resets mvme162's local bus
- * Depends upon #define'ed GROUP_BASE_ADDRESS and BOARD_BASE_ADDRESS
- * which in turn are set by the 162-BUG's ENV command.
- */
-{
- int vme;
- char vmedev[32] = "/dev/vme16d32"; /* d32 is important !!! */
- u_long pagesize;
- struct gcsr *gcsr_map;
-
- pagesize = sysconf(_SC_PAGESIZE); /* mmap likes to be page-aligned */
-
- if ((vme = open(vmedev, O_RDWR)) == -1) {
- perror("open");
- fprintf(stderr, "Cannot open vme as %s to access GCSR\n", vmedev);
- return 1;
- }
-
-/* "MAP_SHARED" is important here */
- gcsr_map = (struct gcsr *)
- mmap(0, 0x1000, PROT_WRITE|PROT_READ, MAP_SHARED,
- vme, (u_long)gcsr_vme / pagesize * pagesize);
- if (gcsr_map == (struct gcsr *) - 1) {
- perror("mmap");
- fprintf(stderr, "Cannot mmap() to remote bus address 0x%08X\n",
- (u_long)gcsr_vme / pagesize * pagesize);
- return 1;
- }
-
-/*
- * use GCSR to start execution in MVME162
- * adjust pointer to compensate for page alignement
- */
- gcsr_map = (struct gcsr *)((u_long)gcsr_map +
- (u_long)gcsr_vme % pagesize);
-
- if (reset) { /* reset the local bus... */
- gcsr_map->board_scr |= 0x80;
- }
- if (entry) { /* ...load start address... */
- gcsr_map->gpr[0] = entry >> 16U;
- gcsr_map->gpr[1] = entry & 0x0000FFFF;
- }
- if (go) { /* ... and kick it in the ass! */
- gcsr_map->lmsig = 0x1;
- }
-}
-
-/*=================================================================== */
-main(int argc, char *argv[])
-{
- char inpstr[256];
- u_char image[256];
- char hdrstr[64];
- int i, j, k, result, size, line=0, lastrec=0;
- long addr, tsize=0, naddr=0, blksize=0, blknum=1;
- FILE *in;
- char infile[256] = "";
- char vmedev[32] = "/dev/vme32d32"; /* Assume "/dev/vme32d32" */
- int vme, verbose = 0, go = 0, reset = 0, havefile = 0;
-
-/* Parse the command line */
-
- --argc;
-
- while (argv++, argc--) {
- if (**argv != '-') {
- strcpy(infile, *argv);
- havefile = 1;
- } else if (!strcmp(*argv, "-v")) {
- verbose = 1;
- } else if (!strcmp(*argv, "-g")) {
- go = 1;
- } else if (!strcmp(*argv, "-r")) {
- reset = 1;
-/* } else if (!strcmp(*argv, "-vme32")) { */
-/* strcpy(vmedev, "/dev/vme32d32"); */
-/* } else if (!strcmp(*argv, "-vme24")) { */
-/* strcpy(vmedev, "/dev/vme24d32"); */
-/* } else if (!strcmp(*argv, "-vme16")) { */
-/* strcpy(vmedev, "/dev/vme16d32"); */
- } else if (!strcmp(*argv, "-")) {
- usage();
- exit(0);
- } else {
- usage();
- exit(0);
- }
- }
-
- if (!havefile) {
- if (!reset && !go) {
- usage();
- }
- else {
- MVMEControl(0, reset, go);
- }
- exit(0);
- }
-
- if ((in = fopen(infile, "r")) == NULL) {
- perror("open");
- fprintf(stderr, "Cannot open input file %s\n", infile);
- exit(1);
- }
-
- if ((vme = open(vmedev, O_RDWR)) == -1) {
- fprintf(stderr, "Cannot open vme as %s\n", vmedev);
- }
-
- while (fscanf(in, "%s", &inpstr) != EOF) {
- line++;
- if (validrec(inpstr) == 0) {
- switch (issrec(inpstr)) {
- case 0 :
- hdr2str(inpstr, hdrstr);
- if (verbose) printf("HEADER string = `%s'\n", hdrstr);
- lastrec=HEADER;
- break;
- case 1 :
- addr = getaddr(inpstr);
- size = datasize(inpstr);
- if (blksize == 0) {
- blksize+=size;
- naddr=addr+size;
- if (verbose) printf("DATA\tS19\t$%04lX", addr);
- lastrec=DATA19;
- }
- else if ((blksize!=0) && (addr==naddr)) {
- blksize+=size;
- naddr=addr+size;
- }
- else {
- if (verbose) printf("\t$%04lX\t%lu", naddr-1, blksize);
- if (verbose) printf("\t%d\n", blknum);
- blknum+=1;
- naddr=addr+size;
- blksize=size;
- if (verbose) printf("DATA\tS19\t$%04lX", addr);
- lastrec=DATA19;
- }
- tsize += size;
- if (vme == -1) break;
- for (i = 0, j = 8, k = size; k-- > 0; i += 1, j += 2) {
- image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]);
- }
- if (lseek(vme, addr, SEEK_SET) == -1) {
- fprintf(stderr, "lseek() to vme address %08X failed\n", addr);
- }
- else {
- if (write(vme, (u_char *)image, size) != size) {
- fprintf(stderr, "Write to vme address %08X failed\n", addr);
- }
- }
- break;
- case 2 :
- addr = getaddr(inpstr);
- size = datasize(inpstr);
- if (blksize == 0) {
- blksize+=size;
- naddr=addr+size;
- if (verbose) printf("DATA\tS28\t$%06lX",addr);
- lastrec=DATA28;
- }
- else if ((blksize!=0) && (addr==naddr)) {
- blksize+=size;
- naddr=addr+size;
- }
- else {
- if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);
- if (verbose) printf("\t%d\n",blknum);
- blknum+=1;
- naddr=addr+size;
- blksize=size;
- if (verbose) printf("DATA\tS28\t$%06lX",addr);
- lastrec=DATA28;
- }
- tsize += size;
- if (vme == -1) break;
- for (i = 0, j = 10, k = size; k-- > 0; i += 1, j += 2) {
- image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]);
- }
- if (lseek(vme, addr, SEEK_SET) == -1) {
- fprintf(stderr, "lseek() to vme address %08X failed\n", addr);
- }
- else {
- if (write(vme, (u_char *)image, size) != size) {
- fprintf(stderr, "Write to vme address %08X failed\n", addr);
- }
- }
- break;
- case 3 :
- addr = getaddr(inpstr);
- size = datasize(inpstr);
- if (blksize == 0) {
- blksize+=size;
- naddr=addr+size;
- if (verbose) printf("DATA\tS37\t$%08lX",addr);
- lastrec=DATA37;
- }
- else if ((blksize!=0) && (addr==naddr)) {
- blksize+=size;
- naddr=addr+size;
- }
- else {
- if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);
- if (verbose) printf("\t%d\n",blknum);
- blknum+=1;
- naddr=addr+size;
- blksize=size;
- if (verbose) printf("DATA\tS37\t$%08lX",addr);
- lastrec=DATA37;
- }
- tsize += size;
- if (vme == -1) break;
- for (i = 0, j = 12, k = size; k-- > 0; i += 1, j += 2) {
- image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]);
- }
- if (lseek(vme, addr, SEEK_SET) == -1) {
- fprintf(stderr, "lseek() to vme address %08X failed\n", addr);
- }
- else {
- if (write(vme, (u_char *)image, size) != size) {
- fprintf(stderr, "Write to vme address %08X failed\n", addr);
- }
- }
- break;
- case 7 :
- if (lastrec==DATA19){
- if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA28){
- if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA37){
- if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);
- }
- if (verbose) printf("\t%d\n",blknum);
- addr = getaddr(inpstr);
- if (verbose) printf("TERM\tS37");
- printf("\nExecution address = $%08lX\n", addr);
- lastrec=TERMINATOR;
- break;
- case 8 :
- if (lastrec==DATA19){
- if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA28){
- if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA37){
- if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);
- }
- if (verbose) printf("\t%d\n",blknum);
- addr = getaddr(inpstr);
- if (verbose) printf("TERM\tS28");
- printf("\nExecution address = $%06lX\n", addr);
- lastrec=TERMINATOR;
- break;
- case 9 :
- if (lastrec==DATA19){
- if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA28){
- if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA37){
- if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);
- }
- if (verbose) printf("\t%d\n",blknum);
- addr = getaddr(inpstr);
- if (verbose) printf("TERM\tS19");
- printf("\nExecution address = $%04lX\n", addr);
- lastrec=TERMINATOR;
- break;
- }
- }
- else {
- printf("\nError on line %d. ",line);
- switch (validrec(inpstr)) {
- case -1 : {printf("SRecord contains invalid characters.\n"); break; }
- case -2 : {printf("SRecord checksum is invalid.\n"); break;}
- case -3 : {printf("SRecord length is invalid.\n"); break;}
- }
- exit(1);
- }
- }
-
- if ((lastrec==DATA19) || (lastrec==DATA28) || (lastrec==DATA37)) {
- if (lastrec==DATA19){
- if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA28){
- if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);
- }
- if (lastrec==DATA37){
- if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);
- }
- if (verbose) printf("\t%d\n",blknum);
- printf("ERROR: terminator record not found.\n");
- }
- else {
- for (i = 0x000FFFF; i-- > 0;) ; /* mystique delay... */
- MVMEControl(addr, reset, go);
- }
- if (verbose) printf("total data size = %lu bytes\n", tsize);
-}