EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: trying to add 64M offboard memory to system pool
From: [email protected] (Kevin Tsubota)
To: [email protected]
Date: Tue, 23 Dec 1997 16:08:26 -1000
----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 35



Configuration:

frc40 16M cpu
micro memory MM6260AD 64M memory card
vxWorks 5.1.1 and vxWorks 5.3.1

We have a frc40 16M CPU card running vxWorks and needed more memory so
we purchased a 64M memory card from micro memory.  I've been able
to read and write practically all 64M on the card, both as longs and
doubles.  However when I attempt to do a vxWorks ld command from the
target shell I always get an error.  I've had this error in vxWorks
5.1.1 and I've just upgraded to vxWorks 5.3.1 with the same results.

I've tried it in the windsh and it loads but I get other errors.  
I would prefer to run it from the target shell as the startup script.

I've been fighting this for some time now with help from vxWorks but
I'm still at square one.

Has anyone else done anything similiar? 

I've attached the output from vxWorks 5.3.1 target shell as well as my configAll.h and sysLib.c files.
 
I'm using bfill to set the parity bit and memAddToPool and want to freely use 
the offboard memory without specifically addressing it.

Thank You.

Kevin Tsubota
W.M. Keck Observatory
(808)885-778
[email protected]

----------
X-Sun-Data-Type: h-file
X-Sun-Data-Description: h-file
X-Sun-Data-Name: configAll.h
X-Sun-Content-Lines: 885
X-Sun-Charset: us-ascii

/* configAll.h - default configuration header */

/* Copyright 1984-1996 Wind River Systems, Inc. */

/*
modification history
--------------------
06u.04feb96,ms   added WDB support for NetROM 500 series.
06t,03dec96,dbt  removed #ifdef INCLUDE_ANSI_ALL and #ifdef INCLUDE_MIB2_ALL 
		 (moved in usrDepend.c).
06s,15nov96,jag  changed string associated with MIB2_SYS_DESCR (SPR# 7476)
06r,04oct96,elp  added INCLUDE_SYM_TBL_SYNC (SPR# 6775).
06q,09aug96,dbt  Moved the ifdef INCLUDE_POSIX_ALL to usrDepend.c (SPR #5524).
06p,29jul96,ms   reworked the fix for SPR #5603.
06o,24jul96,ism  hand-merged SIMSOLARIS.
06n,19jul96,dbt  Moved the ifdef INCLUDE_CONFIGURATION_5_2 
		 to usrDepend.c (SPR #5603).
06m,11jul96,jmb  Eliminated alternative WDB macros names.  SPR #5707
06l,21jun96,jmb  long modhist -- deleted entries prior to 1994.  SPR #6528
06k,20jun96,tpr  added PowerPC 860 support.
06j,18jun96,dbt  removed line INCLUDE_ADA (spr 6645)
06i,10jun96,tam  changed STACK_RESIDENT to RAM_DST_ADRS for PPC
06j,16oct96.rjc  deleted snmp memory partition defines
06j,12aug96.rjc  changes for snmpdMemoryAlloc changes
06i,22apr96,kkk	 fixed typo on CPU_FAMILY for PPC (SPR# 6385)
06h,04apr96,rjc  Modifications for snmp v1 agent for 5.3
06g,07mar96,dat  WDB comm config can be specified on make command line
06f,05mar96,tpr  Added RESERVED for PowerPC.
06e,04dec95,vin  increased EVT_STACK_SIZE to 7000.
06d,06sep95,jag  deleted unnecessary STREAMS defines.
06c,01aug95,dzb  renamed STREAMS macros.  Added STREAMS_PROTO_INIT_RTN macro.
06b,28jul95,jag  Changed INCLUDE_STREAMS_LOG to INCLUDE_STREAMS_STRACE and
		 INCLUDE_STREAMS_STERR. Changed STREAMS_LOG_CONFIG_DIR to
		 STREAMS_STRERR_OUTPUT_DIR and STREAMS_STRACE_OUTPUT_DIR
06a,26jul95,dzb  adjusted default socket macro for STREAMS.
05z,25jul95,dzb  added INCLUDE_BSD_SOCKET and DEFAULT_XXX_SOCKET.
05y,18jul95,dzb  added PPP_CONNECT_DELAY.
05x,11jul95,dzb  modified INCLUDE_PPP inclusion.
05w,26jun95,dzb  removed PPP_OPT_USEHOSTNAME option.
05v,22jun95,sgv  Added STREAMS support
05u,21jun95,dzb  Added INCLUDE_PPP_CRYPT for unbundled crypt() support.
05t,20jun95,dzb  added PPP support.
06e,23sep95,tpr  changed VM_PAGE_SIZE for PPC family.
06d,19jun95,caf  additional PPC support.
06e,11oct95,ms   made 5.2 configuration easier to recreate (SPR #5134).
06d,10oct95,dat	 backward compatible BSP_VERSION and BSP_REV
06c,28sep95,dat	 new #define INCLUDE_WDB_ANNOUNCE
06b,21sep95,ms	 switched some WDB macros between here and usrWdb.c
06a,27jun95,ms	 renamed WDB_COMM_XXX macros
05z,21jun95,ms	 added INCLUDE_WDB_TTY_TEST and INCLUDE_WDB_EXIT_NOTIFY
05y,21jun95,tpr  added #define INCLUDE_WDB_MEM.
05x,13jun95,srh  Updated C++ support triggers.
05w,07jun95,ms	 WDB_STACK_SIZE is now CPU dependant.
05v,07jun95,p_m  added INCLUDE_FORMATTED_IO. suppressed spy from default
                 configuration.
05u,01jun95,ms	 all WDB macros start with WDB_ (usrWdb.c modhist has details).
05t,22may95,ms   added WDB agent support.
          + p_m  suppressed shell, symbol table and debug support from default
		 configuration.
05s,29mar95,kdl  added INCLUDE_GCC_FP.
05r,28mar95,kkk  added scalability MACROS, changed edata and end to arrays 
		 (SPR #3917), added misc constants SM_PKTS_SIZE and 
		 SM_CPUS_MAX (SPR #4130), added misc constant CONSOLE_BAUD_RATE
05q,24mar95,tpr  added #define USER_B_CACHE_ENABLE (SPR #4168). 
05p,14mar95,caf  restored mips resident rom support (SPR #3856).
05o,18jan95,tmk  Added MC68060 case for HW_FP
06c,25may95,yao  changed to use _end for FREE_MEM_ADRS for PowerPC.
06b,12jan95,caf  added PPC floating point support.
06a,09jan95,yao  added PPC support.
05n,10dec94,kdl  Moved INCLUDE_POSIX_ALL to unincluded (SPR 3822).
05m,10dec94,caf  undid mod 05a, use _sdata for resident roms (SPR #3856).
05l,09dec94,jag  Added INCLUDE_MIB2_AT.
05k,17nov94,kdl  Added INCLUDE_NFS_SERVER (excluded); removed TRON references.
05j,13nov94,dzb  Moved INCLUDE_PING to excluded.
05i,11nov94,dzb  Added ZBUF_SOCK, TCP_DEBUG, and PING defines.
05h,11nov94,jag  cleanup of SNMP and MIB defines.
05g,04nov94,kdl	 initial merge cleanup.
05b,16jun94,caf  defined INCLUDE_ELF for MIPS, updated copyright notice.
04x,20jul94,ms   changed INCLUDE_HPPA_OUT to INCLUDE_SOM_COFF
05d,11apr94,jag  Removed conditions for definition of  NFS_GROUP and NFS_USER
		 ID for SNMP demo support.
05c,18feb94,elh  (SNMP VERSION) moved INCLUDE_POSIX_ALL to false section.
		 Added support for the mib2 library.
05f,25may94,kdl	 (POSIX VERSION) removed erroneous NFS def's.
05e,23mar94,smb	 (POSIX VERSION) removed PASSIVE_MODE
05d,15mar94,smb	 renamed tEvtTask parameters.
05c,15feb94,smb	 added define of WV_MODE
05b,12jan94,kdl	 (POSIX VERSION) turned off instrumentation, added 
		 INCLUDE_POSIX_ALL; added INCLUDE_POSIX_SIGNALS; changed
		 INCLUDE_POSIX_MEM_MAN to INCLUDE_POSIX_MEM; added
		 NUM_SIGNAL_QUEUES.
*/

/*
DESCRIPTION
This header contains the parameters that define the default
configuration for VxWorks.
*/

#ifndef	INCconfigAllh
#define	INCconfigAllh

#include "smLib.h"
#include "vme.h"
#include "iv.h"

/******************************************************************************/
/*                                                                            */
/*                      INCLUDED SOFTWARE FACILITIES                          */
/*                                                                            */
/******************************************************************************/




#define INCLUDE_BOOTP		/* bootp */
#define INCLUDE_BSD_SOCKET	/* include the BSD socket library */
#define INCLUDE_CACHE_SUPPORT	/* include cache support package */
#define INCLUDE_CONSTANT_RDY_Q	/* constant insert time ready queue */
#define INCLUDE_ENV_VARS	/* unix compatable environment variables */
#define INCLUDE_EXC_HANDLING	/* include basic exception handling */
#define INCLUDE_EXC_TASK	/* miscelaneous support task */
#define INCLUDE_FLOATING_POINT	/* floating point I/O */
#define INCLUDE_FORMATTED_IO	/* formatted I/O */
#define INCLUDE_FTP_SERVER	/* ftp server */
#define INCLUDE_GCC_FP		/* gcc floating point support libraries */
#define INCLUDE_IO_SYSTEM	/* include I/O system */
#define INCLUDE_LOGGING		/* logTask logging facility */
#define INCLUDE_MEM_MGR_FULL	/* full featured memory manager */
#define INCLUDE_MSG_Q		/* include message queues */
#define INCLUDE_NETWORK         /* network subsystem code */
#define INCLUDE_NET_INIT        /* network subsystem initialization */
#define INCLUDE_NET_SHOW        /* network info and status facilities */
#define INCLUDE_PROXY_CLIENT	/* proxy arp client (Slave Board) */
#define INCLUDE_PIPES		/* pipe driver */
#define INCLUDE_SELECT		/* select() facility */
#define INCLUDE_SEM_BINARY	/* include binary semaphores */
#define INCLUDE_SEM_MUTEX	/* include mutex semaphores */
#define INCLUDE_SEM_COUNTING	/* include counting semaphores */
#define INCLUDE_SIGNALS		/* software signal library */
#define INCLUDE_STDIO		/* standard I/O */
#define INCLUDE_TASK_HOOKS	/* include kernel callouts */
#define INCLUDE_TASK_VARS	/* task variable package */
#define INCLUDE_TFTP_CLIENT	/* tftp client */
#define INCLUDE_TIMEX		/* timexLib for exec timing */
#define INCLUDE_TTY_DEV		/* attach serial drivers */
#define INCLUDE_WATCHDOGS	/* include watchdogs */
#define INCLUDE_WDB		/* WDB debug agent */
#define INCLUDE_ANSI_ALL        /* includes complete ANSI C library functions */
#define INCLUDE_ANSI_ASSERT	/* ANSI-C assert library functionality */
#define INCLUDE_ANSI_CTYPE	/* ANSI-C ctype library functionality */
#define INCLUDE_ANSI_LOCALE	/* ANSI-C locale library functionality */
#define INCLUDE_ANSI_MATH	/* ANSI-C math library functionality */
#define INCLUDE_ANSI_STDIO	/* ANSI-C stdio library functionality */
#define INCLUDE_ANSI_STDLIB	/* ANSI-C stdlib library functionality */
#define INCLUDE_ANSI_STRING	/* ANSI-C string library functionality */
#define INCLUDE_ANSI_TIME	/* ANSI-C time library functionality */

/******************************************************************************/
/*                                                                            */
/*                           KECK CUSTOMIZATION                               */
/*                                                                            */
/******************************************************************************/

/* EPICS requires both the symbol table, loader, and shell within VxWorks */
#define INCLUDE_CONFIGURATION_5_2 /* pre-tornado tools */

/* allow NFS facilities */
#define INCLUDE_NFS             /* nfs package */
#define INCLUDE_NFS_SERVER      /* nfs server */
#define INCLUDE_NFS_MOUNT_ALL	/* automatically mount all NFS file systems */
#define INCLUDE_RDB             /* remote debugging package */
#define INCLUDE_RPC		/* rpc package */

/* allow target shell interaction (ie. console port) */
#define INCLUDE_SHELL           /* interactive c-expression interpreter */
#define INCLUDE_SYM_TBL         /* symbol table package */
#define INCLUDE_SYM_TBL_SYNC	/* synchronize host and target symbol tables */
#define INCLUDE_NET_SYM_TBL     /* load symbol table from network */
#define INCLUDE_STAT_SYM_TBL    /* create user-readable error status */
#define INCLUDE_LOADER          /* object module loading */
#define INCLUDE_UNLOADER        /* object module unloading */

/* allow execution of startup script on boot */
#define INCLUDE_STARTUP_SCRIPT  /* execute start-up script */

/* allow remote access to target shell */
#define INCLUDE_RLOGIN          /* remote login */
#define INCLUDE_TELNET          /* telnet-style remote login */

/* misc routines */
#define INCLUDE_SECURITY	/* shell security for network access */
#define INCLUDE_SHOW_ROUTINES   /* show routines for system facilities*/
#define INCLUDE_SPY             /* spyLib for task monitoring */

/* CPU-SPECIFIC INCLUDED SOFTWARE FACILITIES */

/* include support for possibly existing floating point coprocessor */

#if	(CPU==MC68020 || CPU==MC68040 || CPU==MC68060 || CPU==CPU32)
#define INCLUDE_MC68881         /* MC68881/2 (68040) floating pt coprocessor */
#define INCLUDE_HW_FP		/* potential hardware fp support */
#endif	/* CPU==MC68020 || CPU==MC68040 || CPU==MC68060 || CPU==CPU32 */

#if	(CPU_FAMILY == SPARC) && defined(INCLUDE_FLOATING_POINT)
#define INCLUDE_SPARC_FPU       /* SPARC Floating-Point Unit */
#define INCLUDE_HW_FP		/* potential hardware fp support */
#endif	/* CPU_FAMILY == SPARC */

#if	(CPU_FAMILY==MIPS)
#define INCLUDE_R3010           /* R3010 float point co-processor */
#define INCLUDE_HW_FP		/* potential hardware fp support */
#endif	/* CPU_FAMILY==MIPS */

#if	((CPU_FAMILY==PPC) && (CPU!=PPC403) && (CPU!=PPC860))
#define INCLUDE_PPC_FPU         /* PowerPC floating point unit */
#define INCLUDE_HW_FP           /* potential hardware fp support */
#endif	/* (CPU_FAMILY==PPC) && (CPU!=PPC403) */

#if	(CPU==I960KB)
#define INCLUDE_HW_FP		/* potential hardware fp support */
#endif  /* I960KB */

#if     (CPU_FAMILY==I80X86)
#define INCLUDE_I80387          /* I80387 float point co-processor */
#define INCLUDE_HW_FP           /* potential hardware fp support */
#endif  /* CPU_FAMILY==I80X86 */


/* define appropriate object module format for a given architecture */

#if	((CPU_FAMILY==MIPS) || (CPU_FAMILY==PPC) || (CPU_FAMILY==SIMSPARCSOLARIS))
#define INCLUDE_ELF             /* ELF object modules */
#else
#if	((CPU_FAMILY==I960) || (CPU_FAMILY==AM29XXX))
#define INCLUDE_COFF            /* COFF object modules */
#else
#if	(CPU_FAMILY==SIMHPPA)
#define	INCLUDE_SOM_COFF
#else	/* default */
#define INCLUDE_AOUT            /* a.out object modules */
#endif
#endif
#endif

/* INCLUDED HARDWARE SUPPORT */

#if CPU_FAMILY==MIPS
#define INCLUDE_EGL             /* include Interphase Ethernet interface */
#else
#define INCLUDE_EX		/* include Excelan Ethernet interface */
#endif	/* CPU_FAMILY==MIPS */

#define INCLUDE_ENP		/* include CMC Ethernet interface*/
#define INCLUDE_SM_NET		/* include backplane net interface */
#define INCLUDE_SM_SEQ_ADDR     /* shared memory network auto address setup */

/******************************************************************************/
/*                                                                            */
/*                          EXCLUDED FACILITIES                               */
/*                                                                            */
/******************************************************************************/

#if FALSE

#define INCLUDE_CPLUS		/* include C++ support */
#define INCLUDE_CPLUS_MIN	/* include minimal C++ support */
#define INCLUDE_CPLUS_IOSTREAMS	/* include iostreams classes */
#define INCLUDE_CPLUS_VXW	/* include VxWorks wrapper classes */
#define INCLUDE_CPLUS_TOOLS	/* include Tools class library */
#define INCLUDE_CPLUS_HEAP	/* include Heap class library */
#define INCLUDE_CPLUS_BOOCH	/* include Booch Components library */
#define INCLUDE_DEBUG           /* pre-tornado debugging */
#define INCLUDE_DEMO		/* include simple demo instead of shell */
#define INCLUDE_DOSFS           /* dosFs file system */
#define INCLUDE_INSTRUMENTATION /* windView instrumentation */
#define INCLUDE_MIB2_ALL        /* All of MIB 2 */
#define INCLUDE_MIB2_SYSTEM	/* the system group */
#define INCLUDE_MIB2_TCP        /* the TCP group */
#define INCLUDE_MIB2_ICMP	/* the ICMP group */
#define INCLUDE_MIB2_UDP        /* the UDP group */
#define INCLUDE_MIB2_IF		/* the interfaces group */
#define INCLUDE_MIB2_AT         /* the AT group */
#define INCLUDE_MIB2_IP		/* the IP group */

/* INCLUDE_MMU_BASIC is defined by many bsp's in config.h. If INCLUDE_MMU_FULL
 * is defined in configAll.h and INCLUDE_MMU_BASIC is defined in config.h,
 * then INCLUDE_MMU_FULL will take precedence. 
 */

#define INCLUDE_MMU_BASIC 	/* bundled mmu support */
#define INCLUDE_MMU_FULL	/* unbundled mmu support */


#define INCLUDE_PING		/* ping() utility */
#define INCLUDE_POSIX_AIO       /* POSIX async I/O support */
#define INCLUDE_POSIX_AIO_SYSDRV/* POSIX async I/O system driver */
#define INCLUDE_POSIX_ALL       /* include all available POSIX functions */
#define INCLUDE_POSIX_FTRUNC	/* POSIX ftruncate routine */
#define INCLUDE_POSIX_MEM	/* POSIX memory locking */
#define INCLUDE_POSIX_MQ        /* POSIX message queue support */
#define INCLUDE_POSIX_SCHED	/* POSIX scheduling */
#define INCLUDE_POSIX_SEM 	/* POSIX semaphores */
#define INCLUDE_POSIX_SIGNALS 	/* POSIX queued signals */
#define INCLUDE_POSIX_TIMERS 	/* POSIX timers */
#define INCLUDE_PPP		/* include Point-to-Point Procotol */
#define INCLUDE_PROTECT_TEXT	/* text segment write protection (unbundled) */
#define INCLUDE_PROTECT_VEC_TABLE /* vector table write protection (unbundled)*/
#define INCLUDE_PROXY_DEFAULT_ADDR /* Use ethernet addr to generate bp addrs */
#define INCLUDE_PROXY_SERVER	/* proxy arp server (Master Board) */
#define INCLUDE_RAMDRV          /* ram disk driver */
#define INCLUDE_RAWFS           /* rawFs file system */
#define INCLUDE_RT11FS		/* rt11Fs file system */
#define INCLUDE_SLIP		/* include serial line interface */
#define INCLUDE_SM_OBJ          /* shared memory objects (unbundled) */
#define INCLUDE_SNMPD 	        /* SNMP Agent */
#define INCLUDE_STANDALONE_SYM_TBL /* compiled-in symbol table */
#define INCLUDE_SW_FP		/* software floating point emulation */
#define	INCLUDE_TCP_DEBUG	/* TCP debug facility */
#define INCLUDE_TFTP_SERVER	/* tftp server */
#define INCLUDE_WINDVIEW	/* WindView command server */
#define	INCLUDE_ZBUF_SOCK	/* zbuf socket interface */

#define INCLUDE_LN		/* include AMD LANCE interface */
#define INCLUDE_LNSGI		/* include AMD LANCE interface for SGI VIP10 */
#define INCLUDE_MED		/* include Matrix network interface*/
#define INCLUDE_NIC		/* include National NIC interface */

#define INCLUDE_ANSI_5_0	/* include only version 5.0 ANSI support */
#define INCLUDE_BP_5_0		/* version 5.0 backplane driver */
#define INCLUDE_DELETE_5_0	/* define delete() function as in VxWorks 5.0 */

#define INCLUDE_STREAMS_ALL	   /* Complete Streams subsystem */
#define INCLUDE_STREAMS		   /* CORE Streams (stream head) */
#define INCLUDE_STREAMS_SOCKET	   /* Streams Socket layer and socket library */
#define INCLUDE_STREAMS_TLI	   /* Streams TLI layer and TLI library */
#define INCLUDE_STREAMS_AUTOPUSH   /* SVR4 autopush mechanism */
#define INCLUDE_STREAMS_DLPI	   /* Streams DLPI to mbuf compatible driver */
#define INCLUDE_STREAMS_DEBUG      /* Streams Debugging facility */
#define INCLUDE_STREAMS_STRACE	   /* Streams trace utility */
#define INCLUDE_STREAMS_STRERR	   /* Streams error log utility */

#define DEFAULT_STREAMS_SOCKET	   /* default to Streams socket for AF_INET */

#endif	/* FALSE */

/******************************************************************************/
/*                                                                            */
/*                  KERNEL SOFTWARE CONFIGURATION                             */
/*                                                                            */
/******************************************************************************/

#define USER_I_CACHE_MODE	CACHE_WRITETHROUGH  /* default mode */
#define USER_D_CACHE_MODE	CACHE_WRITETHROUGH  /* default mode */
#define USER_I_CACHE_ENABLE		    	    /* undef to leave disabled*/
#define USER_D_CACHE_ENABLE			    /* undef to leave disabled*/
#define USER_B_CACHE_ENABLE			    /* undef to leave disabled*/
#define USER_I_MMU_ENABLE			    /* undef to leave disabled*/
#define USER_D_MMU_ENABLE			    /* undef to leave disabled*/

#define SYM_TBL_HASH_SIZE_LOG2	8	/* 256 entry hash table symbol table */
#define STAT_TBL_HASH_SIZE_LOG2	6	/* 64 entry hash table for status */
#define MQ_HASH_SIZE		0	/* POSIX message queue hash table size 
					 * 0 = default */
#define NUM_SIGNAL_QUEUES	16	/* POSIX queued signal count */

#define FREE_RAM_ADRS		(end)	/* start right after bss of VxWorks */


/* I/O system parameters */

#define NUM_DRIVERS		20	/* max 20 drivers in drvTable */
#define NUM_FILES		50	/* max 50 files open simultaneously */
#define NUM_DOSFS_FILES		20	/* max 20 dosFs files open */
#define NUM_RAWFS_FILES		5	/* max 5  rawFs files open */
#define NUM_RT11FS_FILES	5	/* max 5  rt11Fs files open */
#define MAX_LOG_MSGS		50      /* max 50 log msgs */

#define	NUM_TTY			2	/* number of tty channels */
#define	CONSOLE_TTY		0	/* console channel */

#define CONSOLE_BAUD_RATE	9600	/* console baud rate */

#ifdef	INCLUDE_SLIP
#define	SLIP_TTY		1	/* serial line IP channel */
#endif	/* INCLUDE_SLIP */

#define MAX_LIO_CALLS		0	/* max outstanding lio calls 0=default */
#define MAX_AIO_SYS_TASKS	0	/* max aio system tasks, 0 = default */
#define AIO_TASK_PRIORITY	0	/* aio system tasks prior, 0 = default */
#define AIO_TASK_STACK_SIZE	0	/* aio tasks stack size, 0 = default */


/* kernel and system task parameters by architecture */

#if	CPU_FAMILY==MC680X0
#define INT_LOCK_LEVEL  	0x7	/* 68k interrupt disable mask */
#define ROOT_STACK_SIZE		10000	/* size of root's stack, in bytes */
#define SHELL_STACK_SIZE	10000	/* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	0x1000	/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE		1000	/* size of ISR stack, in bytes */
#define TRAP_DEBUG		2	/* trap 2 - breakpoint trap */
#define VEC_BASE_ADRS           ((char *) LOCAL_MEM_LOCAL_ADRS)
#endif	/* CPU_FAMILY==MC680X0 */

#if	CPU_FAMILY==SPARC
#define INT_LOCK_LEVEL  	15	/* SPARC interrupt disable level */
#define ROOT_STACK_SIZE		10000	/* size of root's stack, in bytes */
#define SHELL_STACK_SIZE	50000	/* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	0x2000	/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE		10000	/* size of ISR stack, in bytes */
#define VEC_BASE                (LOCAL_MEM_LOCAL_ADRS + 0x1000)
#define VEC_BASE_ADRS           ((char *) VEC_BASE)
#endif	/* CPU_FAMILY==SPARC */

#if     CPU_FAMILY==SIMSPARCSUNOS  || CPU_FAMILY==SIMHPPA || CPU_FAMILY==SIMSPARCSOLARIS
#define INT_LOCK_LEVEL          0x1     /* interrupt disable mask */
#define ROOT_STACK_SIZE         20000   /* size of root's stack, in bytes */
#define SHELL_STACK_SIZE        50000   /* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	0x2000	/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE          50000   /* size of ISR stack, in bytes */
#define VEC_BASE_ADRS           0       /* dummy */
#endif  /* CPU_FAMILY==SIMSPARCSUNOS  || CPU_FAMILY==SIMHPPA || CPU_FAMILY==SIMSPARCSOLARIS */

#if	CPU_FAMILY==I960
#define INT_LOCK_LEVEL  	0x1f	/* i960 interrupt disable mask */
#define ROOT_STACK_SIZE		20000	/* size of root's stack, in bytes */
#define SHELL_STACK_SIZE	40000	/* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	0x2000	/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE		1000	/* size of ISR stack, in bytes */
#define TRAP_DEBUG		0	/* n/a for the 80960 */
#define VEC_BASE_ADRS           NONE	/* base register not reconfigurable */
#endif	/* CPU_FAMILY==I960 */

#if	CPU_FAMILY==MIPS
#define INT_LOCK_LEVEL          0x1     /* R3K interrupt disable mask */
#define ROOT_STACK_SIZE         (20000) /* size of root's stack, in bytes */
#define SHELL_STACK_SIZE        (20000) /* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	(0x2000)/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE          (5000)  /* size of ISR stack, in bytes */
#define VEC_BASE_ADRS           ((char *) 0x0)  /* meaningless in R3k land */
#define VME_VECTORED            FALSE   /* use vectored VME interrupts */
#define TRAP_DEBUG              0       /* trap 0 - breakpoint trap */
#endif	/* CPU_FAMILY==MIPS */

#if	CPU_FAMILY==PPC
#define INT_LOCK_LEVEL          0x0     /* not used */
#define ROOT_STACK_SIZE         (20000) /* size of root's stack, in bytes */
#define SHELL_STACK_SIZE        (20000) /* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	0x2000	/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE          (5000)  /* size of ISR stack, in bytes */
#define VEC_BASE_ADRS           ((char *) 0x0)
#endif	/* CPU_FAMILY==PPC */

#if     CPU_FAMILY==I80X86
#define INT_LOCK_LEVEL          0x0     /* 80x86 interrupt disable mask */
#define ROOT_STACK_SIZE         10000   /* size of root's stack, in bytes */
#define SHELL_STACK_SIZE        10000   /* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	0x1000	/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE          1000    /* size of ISR stack, in bytes */
#define TRAP_DEBUG              0       /* not used */
#define VEC_BASE_ADRS           ((char *) LOCAL_MEM_LOCAL_ADRS)
#endif  /* CPU_FAMILY==I80X86 */

#if	CPU_FAMILY==AM29XXX
#define INT_LOCK_LEVEL  	0x0001	/* 29k all interrupts disable mask */
#define ROOT_STACK_SIZE		10000	/* size of root's stack, in bytes */
#define SHELL_STACK_SIZE	40000	/* size of shell's stack, in bytes */
#define WDB_STACK_SIZE	 	0x2000	/* size of WDB agents stack, in bytes */
#define ISR_STACK_SIZE		10000	/* size of ISR stack, in bytes */
#define TRAP_DEBUG		15	/* trap 2 - breakpoint trap */
#define VEC_BASE_ADRS           ((char *) LOCAL_MEM_LOCAL_ADRS)
#endif	/* CPU_FAMILY==AM29XXX */

/* WDB debug agent configuration */

#ifdef  INCLUDE_WDB

/* optional agent facilities */

#define INCLUDE_WDB_BANNER		/* print banner after agent starts */
#define INCLUDE_WDB_VIO			/* virtual I/O support */
#define	INCLUDE_WDB_TTY_TEST		/* test serial line communcation */

/* core agent facilities - do not remove */

#define INCLUDE_WDB_CTXT		/* context control */
#define INCLUDE_WDB_FUNC_CALL		/* spawn function as separate task */
#define INCLUDE_WDB_DIRECT_CALL		/* call function in agents context */
#define INCLUDE_WDB_EVENTS		/* host async event notification */
#define INCLUDE_WDB_GOPHER		/* gopher info gathering */
#define INCLUDE_WDB_BP			/* breakpoint support */
#define INCLUDE_WDB_EXC_NOTIFY		/* notify host of exceptions */
#define INCLUDE_WDB_EXIT_NOTIFY		/* notify the host of task exit */
#define INCLUDE_WDB_MEM			/* optional memory services */
#define INCLUDE_WDB_REG			/* get/set hardware registers */

/* agent mode */

#define WDB_MODE        WDB_MODE_DUAL	/* WDB_MODE_[DUAL|TASK|EXTERN] */

/* agent communication paths */

#define WDB_COMM_NETWORK 	0	/* vxWorks network	- task mode */
#define WDB_COMM_SERIAL		1	/* raw serial		- bimodal   */
#define WDB_COMM_TYCODRV_5_2	2	/* older serial driver	- task mode */
#define WDB_COMM_ULIP		3	/* vxSim packet device	- bimodal   */
#define WDB_COMM_NETROM		4	/* netrom packet device	- bimodal   */
#define WDB_COMM_CUSTOM		5	/* custom packet device	- bimodal   */

/* communication path configuration */

#ifndef WDB_COMM_TYPE
#define WDB_COMM_TYPE WDB_COMM_NETWORK	/* default path is the network */
#endif

#ifndef WDB_TTY_CHANNEL
#define WDB_TTY_CHANNEL		1	/* default Sio SERIAL channel */
#endif

#ifndef WDB_TTY_DEV_NAME
#define WDB_TTY_DEV_NAME    "/tyCo/1"	/* default TYCODRV_5_2 device name */
#endif

#ifndef WDB_TTY_BAUD
#define WDB_TTY_BAUD		9600	/* default baud rate */
#endif

#ifndef WDB_ULIP_DEV
#define WDB_ULIP_DEV    "/dev/ulip14"	/* default ULIP packet device */
#endif

#define	WDB_NETROM_TYPE		400	/* default is old 400 series */
#define	WDB_NETROM_WIDTH	1	/* width of a ROM word. This macro
					 * is not used for the 500 series. */
#define WDB_NETROM_INDEX	0	/* index into word of pod zero */
#define	WDB_NETROM_NUM_ACCESS	1	/* of pod zero per byte read */
#define	WDB_NETROM_ROMSIZE	ROM_SIZE /* size of a single ROM. If your
					 * board has N ROMs, this definition
					 * must be divided by N to be right */
#define WDB_NETROM_POLL_DELAY	2	/* # clock ticks to poll for input */

/* miscelaneous agent constants */

#define WDB_MTU         	1500	/* max RPC message size */
#define WDB_POOL_SIZE 		((sysMemTop() - FREE_RAM_ADRS)/16) /* memory pool for host tools */
#define WDB_SPAWN_STACK_SIZE	0x5000	/* default stack size of spawned task */

#endif  /* INCLUDE_WDB */

/* WindView event task and buffer parameters */

#define EVT_STACK_SIZE		7000
#define WV_EVT_STACK		EVT_STACK_SIZE
#define EVT_PRIORITY		0
#define WV_EVT_PRIORITY		EVT_PRIORITY
#define EVTBUFFER_SIZE		20000
#define EVTBUFFER_ADDRESS	(char *)NULL

/* WindView command server task parameters */

#define WV_SERVER_STACK		10000
#define WV_SERVER_PRIORITY	100

/* WindView event task */


/* WindView event collection mode 
 *
 * The WindView collection mode can be one of the following,
 *	CONTINUOUS_MODE		- continuous collection and display of events 
 *	POST_MORTEM_MODE	- collection of events only
 */

#define WV_MODE			CONTINUOUS_MODE

/******************************************************************************/
/*                                                                            */
/*                   "GENERIC" BOARD CONFIGURATION                            */
/*                                                                            */
/******************************************************************************/

/* device controller I/O addresses when included */

#define IO_ADRS_EI      ((char *) 0x000fff00)   /* 32A,32D i82596CA Ethernet */
#define IO_ADRS_EX	((char *) 0x00ff0000)	/* 24A,32D Excelan Ethernet */
#define IO_ADRS_ENP	((char *) 0x00de0000)	/* 24A,32D CMC Ethernet */
#define IO_ADRS_EGL	((char *) 0x00004000)	/* 16A,16D Interphase Enet */

#define IO_AM_EX	VME_AM_STD_SUP_DATA	/* Excelan address modifier */
#define IO_AM_EX_MASTER	VME_AM_STD_SUP_DATA	/* Excellan AM for DMA access */
#define IO_AM_ENP	VME_AM_STD_SUP_DATA	/* CMC address modifier */

/* device controller interrupt vectors when included */

#define INT_VEC_ENP		192	/* CMC Ethernet controller*/
#define INT_VEC_EX		193	/* Excelan Ethernet controller*/
#define INT_VEC_EGL		200	/* Interphase Ethernet controller*/

/* device controller interrupt levels when included */

#define INT_LVL_EGL		5	/* Interphase Ethernet controller */
#define INT_LVL_EX		2	/* Excelan Ethernet controller */
#define INT_LVL_ENP		3	/* CMC Ethernet controller */


/******************************************************************************/
/*                                                                            */
/*                   "MISCELLANEOUS" CONSTANTS                                */
/*                                                                            */
/******************************************************************************/

/* shared memory objects parameters (unbundled) */

#define SM_OBJ_MAX_TASK		40	/* max # of tasks using smObj */
#define SM_OBJ_MAX_SEM		60	/* max # of shared semaphores */
#define SM_OBJ_MAX_MSG_Q	10	/* max # of shared message queues */
#define SM_OBJ_MAX_MEM_PART	4	/* max # of shared memory partitions */
#define SM_OBJ_MAX_NAME		100	/* max # of shared objects names */
#define SM_OBJ_MAX_TRIES	100	/* max # of tries to obtain lock */

/* shared memory network parameters  - defaults to values DEFAULT_PKTS_SIZE
 * and DEFAULT_CPUS_MAX in smPktLib.h respectively
 */

#define SM_PKTS_SIZE            0       /* shared memory packet size */
#define SM_CPUS_MAX             0       /* max # of cpus for shared network */

/* low memory layout */

#if     (CPU_FAMILY == I80X86)
#define GDT_BASE_OFFSET         0x800
#define SM_ANCHOR_OFFSET        0x1100
#define BOOT_LINE_OFFSET        0x1200
#define EXC_MSG_OFFSET          0x1300
#elif   (CPU_FAMILY == PPC)
#define SM_ANCHOR_OFFSET        0x4100
#define BOOT_LINE_OFFSET        0x4200
#define EXC_MSG_OFFSET          0x4300
#else
#define SM_ANCHOR_OFFSET        0x600
#define BOOT_LINE_OFFSET        0x700
#define EXC_MSG_OFFSET          0x800
#endif  /* (CPU_FAMILY == I80X86) */

/* The backplane driver onboard anchor at the following address */

#define SM_ANCHOR_ADRS	((char *) (LOCAL_MEM_LOCAL_ADRS+SM_ANCHOR_OFFSET))


/* The bootroms put the boot line at the following address */

#define BOOT_LINE_ADRS	((char *) (LOCAL_MEM_LOCAL_ADRS+BOOT_LINE_OFFSET))
#define	BOOT_LINE_SIZE	255	/* use 255 bytes for bootline */

/* The boot line is stored in non-volatile RAM at the following offset */

#define	NV_BOOT_OFFSET	0	/* store the boot line at start of NVRAM */


/* Messages from exceptions during exceptions go at the following address */

#define EXC_MSG_ADRS	((char *) (LOCAL_MEM_LOCAL_ADRS+EXC_MSG_OFFSET))


/* Backplane H/W support */

#define	SM_TAS_TYPE	SM_TAS_HARD	/* hardware supports test-and-set */


/* Resident ROMs constants */

#if     (CPU_FAMILY==I960)
#define STACK_SAVE      512     	/* maximum stack used to preserve */
#else	/* sparc or others */
#if	((CPU_FAMILY==SPARC) || (CPU_FAMILY==PPC))
#define	STACK_SAVE	0x1000
#else	/* all other architecutes */
#define STACK_SAVE      0x40    	/* maximum stack used to preserve */
#endif					/* mips cpp no elif */
#endif

#if     (CPU_FAMILY==SPARC)
#define RESERVED        0x2000		/* vector table base plus table size */
#else	/* 68000 or others */
#if	(CPU==MC68000)
#define RESERVED	0x400		/* avoid zeroing MC68302 vector table */
#else	
#if	(CPU_FAMILY == PPC)
#define RESERVED	0x4400		/* avoid zeroing EXC_MSG */
#else	/* all other architectures */
#define RESERVED        0
#endif
#endif					/* mips cpp no elif */
#endif

#if     ((CPU_FAMILY == MIPS) || (CPU_FAMILY == PPC))
#define	STACK_RESIDENT	RAM_DST_ADRS
#else
#define	STACK_RESIDENT	_sdata
#endif

#if	(_STACK_DIR == _STACK_GROWS_DOWN)

#ifdef	ROM_RESIDENT
#define STACK_ADRS	STACK_RESIDENT
#else
#define STACK_ADRS	_romInit
#endif	/* ROM_RESIDENT */

#else	/* _STACK_DIR == _STACK_GROWS_UP */

#ifdef	ROM_RESIDENT
#define STACK_ADRS	(STACK_RESIDENT-STACK_SAVE)
#else
#define STACK_ADRS	(_romInit-STACK_SAVE)
#endif	/*  ROM_RESIDENT */

#endif	/* _STACK_DIR == _STACK_GROWS_UP */


/* Default Boot Parameters */

#define HOST_NAME_DEFAULT	"bootHost"	/* host name */
#define TARGET_NAME_DEFAULT	"vxTarget"	/* target name (tn) */
#define HOST_USER_DEFAULT	"target"	/* user (u) */
#define HOST_PASSWORD_DEFAULT	""		/* password */
#define SCRIPT_DEFAULT		""	 	/* startup script (s) */
#define OTHER_DEFAULT		"" 		/* other (o) */

/* Default NFS parameters - constants may be changed here, variables
 * may be changed in usrConfig.c at the point where NFS is included.
 */

#define NFS_USER_ID		2001		/* dummy nfs user id */
#define NFS_GROUP_ID		100		/* dummy nfs user group id */


/* Login security initial user name and password.
 * Use vxencrypt on host to find encrypted password.
 * Default password provided here is "password".
 */

#ifdef	INCLUDE_SECURITY
#define LOGIN_USER_NAME		"target"
#define LOGIN_PASSWORD		"bReb99RRed"	/* "password" */
#endif	/* INCLUDE_SECURITY */


/* install environment variable task create/delete hooks */

#ifdef  INCLUDE_ENV_VARS
#define	ENV_VAR_USE_HOOKS	TRUE
#endif	/* INCLUDE_ENV_VARS */

/*
 * default page size for MMU is 8k.
 * 68040 will also work with 4k page size
 * powerPC is only 8k
 */

#if	(CPU_FAMILY == PPC)
#define VM_PAGE_SIZE		4096
#else 	/* (CPU_FAMILY != PPC) */
#define VM_PAGE_SIZE		8192
#endif	/* (CPU_FAMILY != PPC) */

/* STREAMS Configuration Parameters */

/* the following define the STREAMS default configuration parameters */
 
#define STREAMS_MEM_MAX		102400	/* max STREAMS memory usage */
#define STREAMS_MEM_PART_ADDR	0x0	/* mem partition address, NULL=alloc */
#define STREAMS_MEM_PART_SIZE	0x0	/* mem partition size, NULL=max */
#define STREAMS_PUSH_MAX	9	/* max pushable modules */
#define STREAMS_MSGSZ_MAX	4096	/* max data message size */
#define STREAMS_CTLSZ_MAX	1024	/* max control message size */

#define	STREAMS_PROTO_INIT_RTN	NULL	/* streams protocol init routine */
 
/* The "/tmp" directory for storing log files will work only if the
 * communication protocol between the host and target is "ftp" or "rsh" .
 * If "nfs" is being used then the directory has to be set to the 
 * directory exported by the host system.
 */

#define STREAMS_STRERR_OUTPUT_DIR  "/tmp"   /* Directory for strerr utility */
#define STREAMS_STRACE_OUTPUT_DIR  "/tmp"   /* Directory for strace file */

/* SNMP configuration parameters */
/* MIB-2 Variable defaults - see RFC 1213 for complete description */
 
#define MIB2_SYS_DESCR                  "VxWorks SNMPv1/v2c Agent"
#define MIB2_SYS_CONTACT                "Wind River Systems"
#define MIB2_SYS_LOCATION               "Planet Earth"

/* MIB2_SYS__OBJID_LEN is the number of elements in the object id
 * MIB_2_SYS_OBJID is the object id.  The default is "0.0" which
 * has the length of 2
 */
 
#define MIB2_SYS_OBJID_LEN              2
#define MIB2_SYS_OBJID                  { 0, 0 }

#define SNMP_TRACE_LEVEL            0    /* Must be >= 0 and <= 3 with higher */
                                         /* values giving more info and 0     */
                                         /* giving no info                    */ 




#define PPP_TTY				1	/* default PPP serial channel */
#define PPP_OPTIONS_STRUCT			/* use PPP options macros */
#define	PPP_OPTIONS_FILE		NULL	/* use PPP options file */
#define	PPP_CONNECT_DELAY		15	/* delay to establish link */

#undef	INCLUDE_PPP_CRYPT			/* include PPP crypt support */

/* PPP options flags - set to 1 to turn on option */

#define	PPP_OPT_NO_ALL			0	/* Don't allow any options */
#define	PPP_OPT_PASSIVE_MODE		0	/* Set passive mode */
#define	PPP_OPT_SILENT_MODE		0	/* Set silent mode */
#define	PPP_OPT_DEFAULTROUTE		0	/* Add default route */
#define	PPP_OPT_PROXYARP		0	/* Add proxy ARP entry */
#define	PPP_OPT_IPCP_ACCEPT_LOCAL	0	/* Acpt peer's IP addr for us */
#define	PPP_OPT_IPCP_ACCEPT_REMOTE	0	/* Acpt peer's IP addr for it */
#define	PPP_OPT_NO_IP			0	/* Disable IP addr negot. */
#define	PPP_OPT_NO_ACC			0	/* Disable addr/control compr */
#define	PPP_OPT_NO_PC			0	/* Disable proto field compr */
#define	PPP_OPT_NO_VJ			0	/* Disable VJ compression */
#define	PPP_OPT_NO_VJCCOMP		0	/* Disable VJ conct-ID compr */
#define	PPP_OPT_NO_ASYNCMAP		0	/* Disable async map negot. */
#define	PPP_OPT_NO_MN			0	/* Disable magic num negot. */
#define	PPP_OPT_NO_MRU			0	/* Disable MRU negotiation */
#define	PPP_OPT_NO_PAP			0	/* Don't allow PAP auth */
#define	PPP_OPT_NO_CHAP			0	/* Don't allow CHAP auth */
#define	PPP_OPT_REQUIRE_PAP		0	/* Require PAP auth */
#define	PPP_OPT_REQUIRE_CHAP		0	/* Require CHAP auth */
#define	PPP_OPT_LOGIN			0	/* Use login dbase for PAP */
#define	PPP_OPT_DEBUG			0	/* Enable daemon debug mode */
#define	PPP_OPT_DRIVER_DEBUG		0	/* Enable driver debug mode */

/* PPP options strings - set to desired string to turn on option */

#define	PPP_STR_ASYNCMAP		NULL	/* desired async map */
#define	PPP_STR_ESCAPE_CHARS		NULL	/* chars to escape on xmits */
#define	PPP_STR_VJ_MAX_SLOTS		NULL	/* max VJ compr header slots */
#define	PPP_STR_NETMASK			NULL	/* netmask value */
#define	PPP_STR_MRU			NULL	/* MRU value for negotiation */
#define	PPP_STR_MTU			NULL	/* MTU value for negotiation */
#define	PPP_STR_LCP_ECHO_FAILURE	NULL	/* max LCP echo failures */
#define	PPP_STR_LCP_ECHO_INTERVAL	NULL	/* time for LCP echo requests */
#define	PPP_STR_LCP_RESTART		NULL	/* timeout for LCP */
#define	PPP_STR_LCP_MAX_TERMINATE	NULL	/* max LCP term-reqs */
#define	PPP_STR_LCP_MAX_CONFIGURE	NULL	/* max LCP conf-reqs */
#define	PPP_STR_LCP_MAX_FAILURE		NULL	/* max conf-naks for LCP */
#define	PPP_STR_IPCP_RESTART		NULL	/* timeout for IPCP */
#define	PPP_STR_IPCP_MAX_TERMINATE	NULL	/* max IPCP term-reqs */
#define	PPP_STR_IPCP_MAX_CONFIGURE	NULL	/* max IPCP conf-reqs */
#define	PPP_STR_IPCP_MAX_FAILURE	NULL	/* max # conf-naks for IPCP */
#define	PPP_STR_LOCAL_AUTH_NAME		NULL	/* local name for auth */
#define	PPP_STR_REMOTE_AUTH_NAME	NULL	/* remote name for auth */
#define	PPP_STR_PAP_FILE		NULL	/* PAP secrets file */
#define	PPP_STR_PAP_USER_NAME		NULL	/* username for PAP peer auth */
#define	PPP_STR_PAP_PASSWD		NULL	/* password for PAP peer auth */
#define	PPP_STR_PAP_RESTART		NULL	/* timeout for PAP */
#define	PPP_STR_PAP_MAX_AUTHREQ		NULL	/* max PAP auth-reqs */
#define	PPP_STR_CHAP_FILE		NULL	/* CHAP secrets file */
#define	PPP_STR_CHAP_RESTART		NULL	/* timeout for CHAP */
#define	PPP_STR_CHAP_INTERVAL		NULL	/* CHAP rechallenge interval */
#define	PPP_STR_CHAP_MAX_CHALLENGE	NULL	/* max CHAP challenges */

/* for backward compatibility with old 1.0 BSPs */

#ifndef BSP_VERSION
#   define BSP_VERSION	"1.0"	/* old 1.0 style BSP */
#   define BSP_VER_1_0	TRUE
#endif

#ifndef BSP_REV
#   define BSP_REV	"/0"	/* old 1.0 style BSP */
#endif

#endif	/* INCconfigAllh */
----------
X-Sun-Data-Type: c-file
X-Sun-Data-Description: c-file
X-Sun-Data-Name: sysLib.c
X-Sun-Content-Lines: 952
X-Sun-Charset: us-ascii

/* sysLib.c - Force SYS68K/CPU-40, -41 system-dependent library */

/* Copyright 1984-1996 Wind River Systems, Inc. */
#include "copyright_wrs.h"

/*
modification history
--------------------
02g,04mar97,db   added sysPhysMemTop(). added LOCAL_MEM_AUTOSIZE. removed 
		 NOMANUAL from header of sysHwInit2().(SPR #7947)
02f,16dec96,dat  fixed SPR 3219, FGA_CTL7 not set correctly.
02e,16dec96,myz  fixed SPR#: 3797
02d,10oct96,dat  merge from Windview102 (added m68230Timer.c timestamp driver)
02c,21jun96,wlf  doc: cleanup.
02b,14nov95,myz  connect serial interrupt handler in sysHwInit2
02a,29sep95,dat  new BSP revision id
01z,14apr95,myz  moved serial configuration to sysSerial.c.
01y,17oct94,rhp  delete blank line in this comment block (SPR 3713).
01x,12feb93,caf  use LANCE address macro in sysPhysMemDesc (SPR 1928).
01w,02feb93,dzb  tweak to sysBusToLocalAdrs() (SPR 1764).  updated copyright.
01v,31oct92,caf  MMU now maps 16MB as cached space for RAM.
01u,22oct92,caf  changed sysPhysMemDesc[] to use LOCAL_MEM_SIZE.
		 modified sysToMonitor() accommodate 5.0.x boot ROMs (SPR 1688).
		 fixed initialization of DUSCC chips (SPR 1689).
		 changed sysMemTop() to use FRC40_MEM_SIZE macro.
01t,20oct92,caf  reworked EAGLE module interface. initialized *FGA_ICRLOCAL7.
		 made VMEbus accesses CACHEABLE_NOT (SPR 1686).
01s,29sep92,caf  removed relative path.
01r,24sep92,gae  doc tweak.
01q,16sep92,gae  pared down DESCRIPTION.
01p,11sep92,caf  added sysPhysMemDesc, disabled MMU in sysToMonitor().
01o,03sep92,caf  extracted last two bytes of Ethernet address from NVRAM.
01n,02sep92,caf  changed nvRamLib.c to nvRam.c.
01m,11aug92,ccc	 added SCSI support.
01l,16jul92,caf  added support for Eagle-01c and Eagle-02 modules.
01k,14jul92,caf  moved VMEbus interrupt and mailbox routines to fga002Vme.c.
		 ANSIfied.
01j,09jul92,caf  added support for rev 2 hardware (search for REV2).
		 moved sysNvRamSet() and sysNvRamGet() to nvRamLib.c.
		 moved sys[Aux]Clk routines to m68562Timer.c.
		 created sysHwInit2() to connect additional interrupts.
01i,26may92,rrr  the tree shuffle
01h,07jan92,jdi  documentation cleanup.
            shl  ANSI cleanup.
01g,04oct91,rrr  passed through the ANSIfication filter
		  -changed VOID to void
		  -changed copyright notice
01f,15sep91,jpb  removed exBusAdrsSpace.  The AM is passed as arg to exattach.
01e,20Aug91,jpb  Fixed spelling errors.
01d,18Aug91,jcf  rewrote sysMemTop().
01c,18aug91,jdi  documentation cleanup.
01b,25jul91,jpb  fixed auxiliary clock, non slot 1 shared
		 memory access, and documentation
01a,07jun91,jpb  adaptation for 68040 support and validation according to
		  WRS coding conventions, original from Mike McCrary (Force).
*/

/*
DESCRIPTION
This library provides board-specific routines.  The chip drivers included are:

    m68562Sio.c - Motorola MC68562 DUSCC tty driver 
    nvRam.c - non-volatile RAM library
    m68562Timer.c - MC68562 DUSCC timer library
    fga002Vme.c - Force Computers FGA-002 gate array VMEbus library
    fga002Dma.c - Force Computers FGA-002 DMA library
    frcEagle01.c - Force Eagle-01c module library
    frcEagle02.c - Force Eagle-02 module library

INCLUDE FILES: sysLib.h

SEE ALSO:
.pG "Configuration"
*/

/* includes */

#include "vxWorks.h"
#include "vme.h"
#include "ioLib.h"
#include "sysLib.h"
#include "tyLib.h"
#include "config.h"
#include "vxLib.h"
#include "intLib.h"
#include "string.h"
#include "private/vmLibP.h"
#include "drv/multi/m68562.h"

/* defines */

#define DUSCC_BASE_ADRS FRC40_DUSCC1_BASE_ADRS  /* for m68562Timer.c */

/* globals */

PHYS_MEM_DESC sysPhysMemDesc [] =
    {
    /* adrs and length parameters must be page-aligned (multiples of 0x2000) */

    /* ram */
    {
    (void *) LOCAL_MEM_LOCAL_ADRS,
    (void *) LOCAL_MEM_LOCAL_ADRS,
    0x1000000,				/* 16MB (adjust if necessary) */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE
    },

    /* some a32 vme */
    {
    (void *) 0x1000000,
    (void *) 0x1000000,
    0x8000000,                          /* 128MB */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT
    },

    /* message broadcast area */
    {
    (void *) 0xfa000000,
    (void *) 0xfa000000,
    0x1000000,				/* 16MB */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT
    },

    /* a16 and a24 vme */
    {
    (void *) 0xfb000000,
    (void *) 0xfb000000,
    0x2000000,				/* 32MB */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT
    },

#ifdef	LN_POOL_ADRS
    /* LANCE Ethernet */
    {
    (void *) LN_POOL_ADRS,
    (void *) LN_POOL_ADRS,
    0x82000,				/* 520KB */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT
    },
#endif	/* LN_POOL_ADRS */

#ifdef FRC40_E002_FLASH_BASE_ADRS
    /* eagle-2 flash eprom */
    {
    (void *) FRC40_E002_FLASH_BASE_ADRS,
    (void *) FRC40_E002_FLASH_BASE_ADRS,
    0x20000,                            /* 128K bytes, adjust if necessary */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE_NOT      | VM_STATE_CACHEABLE_NOT
    },
#endif

    /* system EPROM */
    {
    (void *) ROM_BASE_ADRS,
    (void *) ROM_BASE_ADRS,
    ROM_SIZE,
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE_NOT  | VM_STATE_CACHEABLE_NOT
    },

    /* local I/O, SRAM */
    {
    (void *) 0xff800000,
    (void *) 0xff800000,
    0x600000,				/* 6MB */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE      | VM_STATE_CACHEABLE_NOT
    },

    /* boot EPROM */
    {
    (void *) 0xffe00000,
    (void *) 0xffe00000,
    0x100000,				/* 1MB */
    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
    VM_STATE_VALID      | VM_STATE_WRITABLE_NOT  | VM_STATE_CACHEABLE_NOT
    }
    };

int sysPhysMemDescNumEnt = NELEMENTS (sysPhysMemDesc);

int sysBus = BUS;      /* system bus type (VME_BUS, etc) */
int sysCpu = CPU;      /* system cpu type (MC680x0) */
char *sysBootLine = BOOT_LINE_ADRS;	/* address of boot line */
char *sysExcMsg = EXC_MSG_ADRS;	/* catastrophic message area */
int sysProcNum;	       /* processor number of this cpu */
int sysFlags;	       /* boot flags */
char sysBootHost[BOOT_FIELD_LEN];	/* name of host from which we booted */
char sysBootFile[BOOT_FIELD_LEN];	/* name of file from which we booted */

/*
 * The Force CPU-40 has the licensed inet number of 00.80.42.c0.xx.xx.
 *
 * The last two bytes are initialized in sysHwInit2().
 */

unsigned char lnEnetAddr[6] = {0x00, 0x80, 0x42, 0xc0, 0x00, 0x00};


#include "mem/nvRam.c"
#include "timer/m68230Timer.c"	/* for timestamp driver only */
#include "timer/m68562Timer.c"
#include "vme/fga002Vme.c"
#include "sysSerial.c"

#ifdef	 EAGLE_C_FILE
#include EAGLE_C_FILE
#endif	 /* EAGLE_C_FILE */

#undef  DUSCC_BASE_ADRS

/*******************************************************************************
*
* sysModel - return the model name of the CPU board
*
* This routine returns the model name of the CPU board.
*
* RETURNS: A pointer to the string "Force SYS68K/CPU-40".
*/

char *sysModel (void)
    {
    return ("Force SYS68K/CPU-40");
    }

/*******************************************************************************
*
* sysBspRev - return the BSP version and revision number
*
* This routine returns a pointer to a BSP version and revision number, for
* example, 1.1/0. BSP_REV is concatenated to BSP_VERSION and returned.
*
* RETURNS: A pointer to the BSP version/revision string.
*/

char * sysBspRev (void)
    {
    return (BSP_VERSION BSP_REV);
    }

/*******************************************************************************
*
* sysAbortInt - handle NMI from ABORT switch on front panel
*
* RETURNS: N/A
*/

LOCAL void sysAbortInt (void)
    {
    *FGA_ISABORT = 0x0; /* acknowledge interrupt */

    sysToMonitor (BOOT_WARM_NO_AUTOBOOT);
    }

/*******************************************************************************
*
* sysHwInit - initialize the system hardware
*
* This routine initializes various features of the Force SYS68K/CPU-40,
* -41 boards.  It is called from usrInit() in usrConfig.c.
*
* This routine initializes and turns off the timers, and sets up the FGA-002
* VMEbus interface chip.
*
* NOTE: This routine should not be called directly by the user application.
*
* RETURNS: N/A
*/

void sysHwInit (void)
    {
    char zero = 0;     /* used to force compilers to use move instead of clr */

#ifdef	 EAGLE_C_FILE
    sysEagleInit ();	/* initialization specific to Eagle module */
#endif	 /* EAGLE_C_FILE */

    /* Initialize PIT1 ports */

    /* Timer */

    *PIT_TCR (FRC40_PIT1_BASE_ADRS) = TIMER_CTL_7;	/* disable timer */
    *PIT_TVIR (FRC40_PIT1_BASE_ADRS) = INT_VEC_PIT1;

    /*
     * Port General
     * Unidirectional, 8 bit mode, H34 disabled, H12 enabled, low assert
     */

    *PIT_PGCR (FRC40_PIT1_BASE_ADRS) = zero;

    /* PC4/DMAREQ is PC4, no DMA, PC5/PIRQ is PIRQ, PC6/PIACK is PC6 */

    *PIT_PIVR (FRC40_PIT1_BASE_ADRS) = INT_VEC_PIT1;
    *PIT_PSRR (FRC40_PIT1_BASE_ADRS) = PIRQ;

    /*
     * Port A - Rotary Switches
     * Bit I/O - Pin Definable single buffered
     * output, non-latched input
     */

    *PIT_PACR (FRC40_PIT1_BASE_ADRS) = PORT_SUBMODE_3;
    *PIT_PADDR (FRC40_PIT1_BASE_ADRS) = zero;	/* all inputs */

    /*
     * Port B - A31-A24 Control for slave access
     * Bit I/O - Pin definable
     * single buffered output, non-latched input
     */

    *PIT_PBCR (FRC40_PIT1_BASE_ADRS) = PORT_SUBMODE_3;	/* submode 1X */
    *PIT_PBDR (FRC40_PIT1_BASE_ADRS) = zero;	/* A31..A24 */
    *PIT_PBDDR (FRC40_PIT1_BASE_ADRS) = 0xff;	/* all outputs */

    /*
     * Port C - Snoop Control
     * PC0,PC1,PC6,PC7 output, others input
     */

    *PIT_PCDR (FRC40_PIT1_BASE_ADRS) = zero;	/* Snooping does not work */
    *PIT_PCDDR (FRC40_PIT1_BASE_ADRS) = 0xd3;   /* Changed for REV2 */


    /* Initialize PIT2 ports */


    /* Timer */

    *PIT_TCR (FRC40_PIT2_BASE_ADRS) = TIMER_CTL_7;	/* disable timer */
    *PIT_TVIR (FRC40_PIT2_BASE_ADRS) = INT_VEC_PIT2;

    /*
     * Port General
     * Mode 0, (Unidirectional 8 bit Mode), H34 && H12 disabled.
     */

    *PIT_PGCR (FRC40_PIT2_BASE_ADRS) = zero;

    /* PC4/DMAREQ = PC4, PC5/PIRQ = PC5, PC6/PIACK = PC6 */

    *PIT_PIVR (FRC40_PIT2_BASE_ADRS) = INT_VEC_PIT2;
    *PIT_PSRR (FRC40_PIT2_BASE_ADRS) = PIRQ;

    /*
     * Port A - I/O Port via B12
     * Bit I/O - Pin Definable single buffered
     * output, non-latched input
     */

    *PIT_PACR (FRC40_PIT2_BASE_ADRS) = PORT_SUBMODE_3;	/* submode 1x */
    *PIT_PADDR (FRC40_PIT2_BASE_ADRS) = zero;	/* all I/O */

    /*
     * Port B - Memory size, board ID.
     * Bit I/O - Pin Definable single
     * buffered output, non-latched input
     */

    *PIT_PBCR (FRC40_PIT2_BASE_ADRS) = PORT_SUBMODE_3;	/* submode 1X */
    *PIT_PBDDR (FRC40_PIT2_BASE_ADRS) = zero;	/* all input */

    /*
     * Port C - RAM Characteristics: type, burst, parity, enable A24 slave.
     * PC2 - RAMtype, PC4-Burst Capable, PC6-Parity Capable, PC0-1-Unused,
     * PC3-5-Int, PC7 Enable A24 Access
     */

    *PIT_PCDR (FRC40_PIT2_BASE_ADRS) = zero;	/* A24 not enabled */
    *PIT_PCDDR (FRC40_PIT2_BASE_ADRS) = 0x80;   /* Input 1,2,4,6 */
                                                /* Changed for REV2 */

    /* Initialize the M68562 serial devices */

    sysSerialHwInit();

    /* Initialize the FGA-002 */

    /* set FGA to allow DUSCC chips to provide vector */

    *FGA_LOCALIACK = FGA_LOCALIACK_EXT_500NS | (FGA_LOCALIACK_EXT_500NS << 2);

    /* enable RMW cycles */

    *FGA_CTL15 |= FGA_CTL15_SHAREDRMW;

    *FGA_CTL16 &= ~0x80;    /* Must have unaligned off to get RMW to work! */
			    /* Changed for REV2 */

    *FGA_CTL1 &= ~FGA_CTL1_SCON;	/* FGA arbitration off */

    /* disable dual porting of memory.  It is enabled in sysProcNumSet() */

    *FGA_ENAMCODE = zero;

    /* dual port from the beginning of RAM */

    *FGA_MAINUM = zero;	       /* local base = 0x0 */
    *FGA_MAINUU = zero;	       /* (start of RAM)   */

    /* set VME dual port base address */

    *FGA_VMEPAGE = (LOCAL_MEM_BUS_ADRS & 0xf0000000) >> 28;	/* A31-A28 */
    *FGA_BOTTOMPAGEU = (LOCAL_MEM_BUS_ADRS & 0x0ff00000) >> 20;	/* A27-A20 */
    *FGA_BOTTOMPAGEL = (LOCAL_MEM_BUS_ADRS & 0x000ff000) >> 12;	/* A19-A12 */

    /* set VME dual port top access location */

    *FGA_TOPPAGEU = ((ULONG) (LOCAL_MEM_BUS_ADRS - 1 +
	             sysPhysMemTop ()) & 0x0ff00000) >> 20;	/* A27-A20 */
    *FGA_TOPPAGEL = ((ULONG) (LOCAL_MEM_BUS_ADRS - 1 +
	             sysPhysMemTop ()) & 0x000ff000) >> 12;

    /* set mailbox accesses to be either user or supervisor */

    *FGA_CTL5 |= FGA_CTL5_VME_A16_BOTH;

    /* initialize vector register */

    *FGA_CTL3 = INT_VEC_FGA >> 4;

    /* initialize interrupt control registers */

    *FGA_ICRMBOX0 = INT_LVL_MBOX;
    *FGA_ICRMBOX1 = INT_LVL_MBOX;
    *FGA_ICRMBOX2 = INT_LVL_MBOX;
    *FGA_ICRMBOX3 = INT_LVL_MBOX;
    *FGA_ICRMBOX4 = INT_LVL_MBOX;
    *FGA_ICRMBOX5 = INT_LVL_MBOX;
    *FGA_ICRMBOX6 = INT_LVL_MBOX;
    *FGA_ICRMBOX7 = INT_LVL_MBOX;

    *FGA_ICRTIM0 = INT_LVL_FGA_TIMER;

    *FGA_ICRFMB0REF = INT_LVL_MBOX;
    *FGA_ICRFMB1REF = INT_LVL_MBOX;
    *FGA_ICRFMB0MES = INT_LVL_MBOX;
    *FGA_ICRFMB1MES = INT_LVL_MBOX;
    *FGA_ICRDMANORM = INT_LVL_DMA;
    *FGA_ICRDMAERR = INT_LVL_DMA;

    *FGA_ICRPARITY = INT_LVL_PARITY;

    *FGA_ICRVME1 = 1;	       /* one to one makes sense */
    *FGA_ICRVME2 = 2;
    *FGA_ICRVME3 = 3;
    *FGA_ICRVME4 = 4;
    *FGA_ICRVME5 = 5;
    *FGA_ICRVME6 = 6;
    *FGA_ICRVME7 = 7;

    /* extended interrupt control registers */

    *FGA_ICRABORT = INT_LVL_ABORT | FGA_ICR_EDGE | FGA_ICR_AUTOCLEAR;
    *FGA_ICRACFAIL = INT_LVL_ACFAIL | FGA_ICR_AUTOCLEAR;
    *FGA_ICRSYSFAIL = INT_LVL_SYSFAIL | FGA_ICR_AUTOCLEAR;

    *FGA_ICRLOCAL0 = INT_LVL_RTC | FGA_ICR_AUTOCLEAR;
    *FGA_ICRLOCAL2 = INT_LVL_PIT1 | FGA_ICR_AUTOCLEAR;
    *FGA_ICRLOCAL3 = INT_LVL_PIT2 | FGA_ICR_AUTOCLEAR;
    *FGA_ICRLOCAL4 = INT_LVL_DUSCC1 | FGA_ICR_AUTOCLEAR; /* actually external */
    *FGA_ICRLOCAL5 = INT_LVL_DUSCC2 | FGA_ICR_AUTOCLEAR; /* actually external */

#ifndef	EAGLE_C_FILE
    *FGA_ICRLOCAL1 = NULL;	/* no EAGLE module installed */
    *FGA_ICRLOCAL6 = NULL;	/* no EAGLE module installed */
    *FGA_ICRLOCAL7 = NULL;	/* no EAGLE module installed */
#endif	/* EAGLE_C_FILE */

    /* setup VMEbus arbitration registers */

    /*
     * On this board (CPU-40) the arbitration cannot be controlled via
     * software.  That is, the enable/disable capability is by hardware
     * jumper only.  The CPU-40 utilizes an device that contains a 4 level
     * arbiter; therefore the FGA arbiter is disabled.  The arbitration
     * method used is still under software control.  Bus request level, is
     * under either hardware or software control, as decided by software when
     * the arbiter is initialized.  Currently, it is set up to allow the user
     * to set jumper B19 in order to set the bus request level.
     */

    /*
     * It is still required to set up the FGA for the VMEbus release cycles,
     * as those are independent from arbitration.
     */

    /* Set up release cycles */

    *FGA_CTL7 = (*FGA_CTL7 & ~0x7) | FGA_CTL7_RAT_64US;	        /* RAT */
    *FGA_CTL7 &= ~FGA_CTL7_NO_RELEASE_ON_BCLR;	/* RBCLR */

    /* This should still work with FGA arbitration disabled. */

    *FGA_CTL8 |= FGA_CTL8_FAIR_ARB;	/* FAIR */

    /* Set up the arbiter */

    *FRC40_ARB = 0x0;	       /* Priority, request level via jumper */

    /* disable FMB channels 1 and 0; slot code set in sysProcNumSet */

    *FGA_CTL5 = FGA_CTL5_VME_A16_BOTH;

    /* enable a few choice interrupts */

    *FGA_ICRLOCAL2 |= FGA_ICR_ENABLE;	/* PIT1 */
    *FGA_ICRLOCAL4 |= FGA_ICR_ENABLE;	/* DUSCC1 */
    *FGA_ICRLOCAL5 |= FGA_ICR_ENABLE;	/* DUSCC2 */

    /* The RTC, FDC, SCSI, LANCE are not initialized here but in the drivers */
    }

/*******************************************************************************
*
* sysHwInit2 - additional system configuration and initialization
*
* This routine connects system interrupts and does any additional
* configuration necessary.
*
* RETURNS: N/A
*/

void sysHwInit2 (void)
    {
    /* connect sys clock and aux clock interrupts */

    (void) intConnect (INUM_TO_IVEC (INT_VEC_CLOCK), sysClkInt, NULL);
    (void) intConnect (INUM_TO_IVEC (INT_VEC_AUX_CLOCK), sysAuxClkInt, NULL);

    /* connect serial device interrupts */

    sysSerialHwInit2 (); 

    /* connect and enable the ABORT switch interrupt */

    if (intConnect (INUM_TO_IVEC (INT_VEC_ABORT), sysAbortInt, 0) != ERROR)
	*FGA_ICRABORT |= FGA_ICR_ENABLE;

    /* connect the mailbox interrupt */

    (void) intConnect (INUM_TO_IVEC (INT_VEC_MBOX), sysMailboxInt, 0);

    /* extract the last two bytes of Ethernet address out of non-volatile RAM */

#ifdef FRC40_E002_FLASH_BASE_ADRS
    /*
    ** the ethernet address for CPU 40 Eagle-02 version is stored in the
    ** EAGLE-02 Flash Eprom at address 0xfe8000ac, according to Force company.
    */
#undef NV_ENET_ADRS
#define NV_ENET_ADRS ((char *)FRC40_E002_FLASH_BASE_ADRS + 0xac)
#endif

    lnEnetAddr [4] = (UCHAR) NV_ENET_ADRS [0];
    lnEnetAddr [5] = (UCHAR) NV_ENET_ADRS [1];
    }

/*******************************************************************************
*
* sysPhysMemTop - get the address of the top of memory
*
* This routine finds the size of memory.
*
* When LOCAL_MEM_AUTOSIZE is defined, the memory size is determined at run
* time by probing memory.  If LOCAL_MEM_AUTOSIZE is not defined, then the
* memory size is taken from the macro LOCAL_MEM_SIZE.
*
* NOTE
* The Parallel Interface/Timer (PIT) port B has 3 input bits containing the
* encoded memory size.
*
* RETURNS: The address of the top of memory.
*/

char *sysPhysMemTop (void)
    {
    static char	* memTop = NULL;

    if (memTop == NULL)
	{
#ifdef	LOCAL_MEM_AUTOSIZE
	memTop = (char *) (FRC40_MEM_SIZE);
	
#else
	memTop = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE);
#endif
	}
    return memTop;
    }

/*******************************************************************************
*
* sysMemTop - get the address of the top of logical memory
*
* This routine returns the address of the first unusable byte of memory.
* VxWorks will not use any memory at or above this address.
*
* The user can reserve local memory from the board by declaring the
* macro USER_RESERVED_MEM with the amount of memory to reserve. This
* routine will return a pointer to the first byte of the reserved memory
* area.
*
* RETURNS: The address of the top of usable memory.
*/

char *sysMemTop (void)
    {
    static char * memTop = NULL;

    if (memTop == NULL)
	{
	memTop = sysPhysMemTop () - USER_RESERVED_MEM;
	}

    return memTop;
    }

/*******************************************************************************
*
* sysToMonitor - transfer control to the ROM monitor
*
* This routine transfers control to the ROM monitor.  Normally, it is called
* only by reboot()--which services ^X--and by bus errors at interrupt level.
* However, in some circumstances, the user may wish to introduce a
* <startType> to enable special boot ROM facilities.
*
* RETURNS: Does not return.
*/

STATUS sysToMonitor
    (
    int startType  /* parameter passed to ROM to tell it how to boot */
    )
    {
    FUNCPTR pRom = (FUNCPTR) (ROM_TEXT_ADRS + 8);

    /* disable the MMU */

    VM_ENABLE (FALSE);

    /* disable system clock to allow reboot with 5.0.x boot ROMs (SPR 1688) */

    sysClkDisable ();

    (*pRom) (startType);

    return (OK);	       /* in case we ever continue from ROM monitor */
    }

/*******************************************************************************
*
* sysLocalToBusAdrs - convert a local address to a bus address
*
* This routine gets the VMEbus address that accesses a specified local
* memory address.
*
* RETURNS: OK, or ERROR if the address space is unknown or not mapped.
*
* SEE ALSO: sysBusToLocalAdrs()
*/

STATUS sysLocalToBusAdrs
    (
    int adrsSpace,      /* bus address space in which busAdrs resides */
    char *localAdrs,    /* local address to convert                   */
    char **pBusAdrs     /* where to return bus address                */
    )
    {
    if ((int) localAdrs < LOCAL_MEM_LOCAL_ADRS || localAdrs >= sysPhysMemTop ())
        {
	/* this is off-board memory - just return local address */

	*pBusAdrs = localAdrs;
	return (OK);
        }

    /*
     * this is on-board memory - map to bus address space;
     * the following memory mapping is established in sysProcNumSet():
     * - only processor 0 has memory on bus,
     * - the memory is placed in EXT space at
     *   address LOCAL_MEM_BUS_ADRS.
     */

    switch (adrsSpace)
	{
	case VME_AM_SUP_SHORT_IO:
	case VME_AM_USR_SHORT_IO:
	    return (ERROR); /* no A16 access to RAM */

	case VME_AM_STD_SUP_PGM:
	case VME_AM_STD_SUP_DATA:
	case VME_AM_STD_USR_PGM:
	case VME_AM_STD_USR_DATA:
	    return (ERROR); /* no A24 access to RAM */

	case VME_AM_EXT_SUP_PGM:
	case VME_AM_EXT_SUP_DATA:
	case VME_AM_EXT_USR_PGM:
	case VME_AM_EXT_USR_DATA:
	    *pBusAdrs = localAdrs + LOCAL_MEM_BUS_ADRS;
	    return (OK);

	default:
	    return (ERROR);
	}
    }

/*******************************************************************************
*
* sysBusToLocalAdrs - convert a bus address to a local address
*
* This routine gets the local address that accesses a specified VMEbus
* memory address.
*
* RETURNS: OK, or ERROR if the address is unknown or the mapping is
* not possible.
*
* SEE ALSO: sysLocalToBusAdrs()
*/

STATUS sysBusToLocalAdrs
    (
    int adrsSpace,      /* bus address space in which busAdrs resides */
    char *busAdrs,      /* bus address to convert                     */
    char **pLocalAdrs   /* where to return local address              */
    )
    {
    switch (adrsSpace)
        {
	case VME_AM_SUP_SHORT_IO:
	case VME_AM_USR_SHORT_IO:
	    *pLocalAdrs = (char *) (0xfcff0000 |
		                    (0x0000ffff & (unsigned int) busAdrs));
	    return (OK);

	case VME_AM_STD_SUP_ASCENDING:
	case VME_AM_STD_SUP_PGM:
	case VME_AM_STD_SUP_DATA:
	case VME_AM_STD_USR_ASCENDING:
	case VME_AM_STD_USR_PGM:
	case VME_AM_STD_USR_DATA:
            busAdrs = (char *) ((unsigned int) busAdrs & 0x00ffffff);

	    if ((unsigned int) busAdrs > (unsigned int) 0x00feffff)
		return (ERROR);
	    *pLocalAdrs = (char *) (0xfc000000 | (unsigned int) busAdrs);
	    return (OK);

	case VME_AM_EXT_SUP_ASCENDING:
	case VME_AM_EXT_SUP_PGM:
	case VME_AM_EXT_SUP_DATA:
	case VME_AM_EXT_USR_ASCENDING:
	case VME_AM_EXT_USR_PGM:
	case VME_AM_EXT_USR_DATA:
	    if ((UINT) busAdrs < (UINT) sysPhysMemTop () ||
		(UINT) busAdrs > (UINT) 0xf9ffffff)
	        {
		return (ERROR);
	        }
	    *pLocalAdrs = busAdrs;
	    return (OK);

	default:
	    return (ERROR);
        }
    }

/*******************************************************************************
*
* sysProcNumGet - get the processor number
*
* This routine returns the processor number for the CPU board, which is
* set with sysProcNumSet().
*
* RETURNS: The processor number for the CPU board.
*
* SEE ALSO: sysProcNumSet()
*/

int sysProcNumGet (void)
    {
    return (sysProcNum);
    }

/*******************************************************************************
*
* sysProcNumSet - set the processor number
*
* This routine sets the processor number for the CPU board.  Processor numbers
* should be unique on a single backplane.
*
* RETURNS: N/A
*
* SEE ALSO: sysProcNumGet()
*/

void sysProcNumSet
    (
    int procNum
    )
    {
    sysProcNum = procNum;

    /*
     * Shared RAM is made open to dual-port VME access only if this is
     * the system controller (processor 0).  This can be overridden here
     * to make the memory accessible for other processor numbers, but
     * make sure that the addressing scheme used causes no address
     * conflicts on VME.  It has been tested in this configuration also.
     */

    if (procNum == 0)
        {
	/*
	 * SYSCON slot 1 capabilities (bus arbitration) is
	 * selected with a hardware jumper.
	 */

	/* dual-port memory for extended (A32) access only */


        /* set VME dual port base address */

        *FGA_VMEPAGE = (LOCAL_MEM_BUS_ADRS & 0xf0000000) >> 28;    /* A31-A28 */
        *FGA_BOTTOMPAGEU = (LOCAL_MEM_BUS_ADRS & 0x0ff00000) >> 20;/* A27-A20 */
        *FGA_BOTTOMPAGEL = (LOCAL_MEM_BUS_ADRS & 0x000ff000) >> 12;/* A19-A12 */

        /* set VME dual port top access location */

        *FGA_TOPPAGEU = ((ULONG) (LOCAL_MEM_BUS_ADRS - 1 +
                         sysPhysMemTop ()) & 0x0ff00000) >> 20; /* A27-A20 */
        *FGA_TOPPAGEL = ((ULONG) (LOCAL_MEM_BUS_ADRS - 1 +
                         sysPhysMemTop ()) & 0x000ff000) >> 12;

	*FGA_ENAMCODE = FGA_ENAMCODE_EXTUSRDAT_RW | FGA_ENAMCODE_EXTSUPDAT_RW;

	/*
	 * standard (A24) access could also be enabled through the
	 * PI/T2 port C bit 7 (=1), which uses the PI/T1 port B as
	 * bits 24-31 of 32 bit address.  See User's Manual.
	 */
        }

    /* set VME short address space base for FGA-002; each proc w/ unique adrs */

    *FGA_MYVMEPAGE = (FRC40_FGA_VME_ADRS >> 8);

    /* set FMB slot code */

    *FGA_FMBCTL &= ~FGA_FMBCTL_SLOT_MASK;

				/* LOCAL_MEM_BUS_ADRS == 16M * (procNum+1) */
    *FGA_FMBCTL |= (procNum & FGA_FMBCTL_SLOT_MASK);
    }
/*******************************************************************************
*
* sysBusTas - test and set a location across the bus
*
* This routine performs a 680\f2x\f10 test-and-set instruction across the 
* backplane.
*
* RETURNS: TRUE if the value had not been set but is now, or FALSE if the
* value was set already.
*
* SEE ALSO: vxTas()
*/

BOOL sysBusTas
    (
    char *adrs          /* address to be tested and set */
    )
    {
    return (vxTas (adrs));
    }


/* miscellaneous support routines */

/*******************************************************************************
*
* sysSysfailConnect - connect a routine to the SYSFAIL signal
*
* This routine connects a specified routine to the CPU board's SYSFAIL signal.
*
* RETURNS: OK, or ERROR if the routine cannot be connected to the SYSFAIL
* signal.
*
* SEE ALSO: intConnect()
*/

STATUS sysSysfailConnect
    (
    VOIDFUNCPTR routine,  /* routine to be connected to SYSFAIL signal */
    int         arg       /* argument with which to call routine       */
    )
    {
    if (intConnect (INUM_TO_IVEC (INT_VEC_SYSFAIL),  routine, arg) == ERROR)
	return (ERROR);

    *FGA_ICRSYSFAIL |= FGA_ICR_ENABLE;

    return (OK);
    }

/*******************************************************************************
*
* sysAcfailConnect - connect a routine to the ACFAIL signal
*
* This routine connects a specified routine to the CPU board's ACFAIL signal.
*
* RETURNS: OK, or ERROR if the routine cannot be connected to the ACFAIL
* signal.
*
* SEE ALSO: intConnect()
*/

STATUS sysAcfailConnect
    (
    VOIDFUNCPTR routine,  /* routine to be connected to ACFAIL signal */
    int         arg       /* argument with which to call routine      */
    )
    {
    if (intConnect (INUM_TO_IVEC (INT_VEC_ACFAIL), routine, arg) == ERROR)
	return (ERROR);

    *FGA_ICRACFAIL |= FGA_ICR_ENABLE;

    return (OK);
    }

/*******************************************************************************
*
* sysFrontPanelSwitches - read the front panel switches of the CPU
*
* This routine returns the values of the CPU's front panel switches.
*
* RETURNS: The combined value of the two 4-bit rotary switches.
*/

int sysFrontPanelSwitches (void)

    {
    return (*PIT_PAAR (FRC40_PIT1_BASE_ADRS));
    }
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: vxexplo.log
X-Sun-Content-Lines: 352
X-Sun-Charset: us-ascii




Press any key to stop auto-boot...
 1
auto-booting...


boot device          : ln
processor number     : 0 
host name            : host
file name            : /usr/local/vw/wind/target/config/frc40/vxWorks
inet on ethernet (e) : 128.171.96.84:ffffff00
host inet (h)        : 128.171.96.162
user (u)             : target
ftp password (pw)    : xxxxxxxx
flags (f)            : 0x28 
target name (tn)     : cpu4
startup script (s)   : nfs.hq

Attaching network interface ln0... done.
Attaching network interface lo0... done.
Loading... 523072 + 52976 + 35584
Starting at 0x1000...

Attaching network interface ln0... done.
Attaching network interface lo0... done.
Mounting NFS file systems from host host for target cpu4:
...done
Loading symbol table from host:/usr/local/vw/wind/target/config/frc40/vxWorks.sym ...done
 

 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
      ]]]]]]]]]]]  ]]]]     ]]]]]]]]]]       ]]              ]]]]         (R)
 ]     ]]]]]]]]]  ]]]]]]     ]]]]]]]]       ]]               ]]]]            
 ]]     ]]]]]]]  ]]]]]]]]     ]]]]]] ]     ]]                ]]]]            
 ]]]     ]]]]] ]    ]]]  ]     ]]]] ]]]   ]]]]]]]]]  ]]]] ]] ]]]]  ]]   ]]]]]
 ]]]]     ]]]  ]]    ]  ]]]     ]] ]]]]] ]]]]]]   ]] ]]]]]]] ]]]] ]]   ]]]]  
 ]]]]]     ]  ]]]]     ]]]]]      ]]]]]]]] ]]]]   ]] ]]]]    ]]]]]]]    ]]]] 
 ]]]]]]      ]]]]]     ]]]]]]    ]  ]]]]]  ]]]]   ]] ]]]]    ]]]]]]]]    ]]]]
 ]]]]]]]    ]]]]]  ]    ]]]]]]  ]    ]]]   ]]]]   ]] ]]]]    ]]]] ]]]]    ]]]]
 ]]]]]]]]  ]]]]]  ]]]    ]]]]]]]      ]     ]]]]]]]  ]]]]    ]]]]  ]]]] ]]]]]
 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]       Development System
 ]]]]]]]]]]]]]]]]]]]]]]]]]]]]
 ]]]]]]]]]]]]]]]]]]]]]]]]]]]       VxWorks version 5.3.1
 ]]]]]]]]]]]]]]]]]]]]]]]]]]       KERNEL: WIND version 2.5
 ]]]]]]]]]]]]]]]]]]]]]]]]]       Copyright Wind River Systems, Inc., 1984-1997

                               CPU: Force SYS68K/CPU-40.  Processor #0.
                              Memory Size: 0x1000000.  BSP version 1.1/1.
                             WDB: Ready.

Executing startup script nfs.hq ...
#
# $Id: nfs.hq,v 1.8 1997/07/24 20:56:43 ktsubota Exp $
#
# script to nfs mount individual disks onto VxWorks when booted
#
routeAdd "128.171.136.0","128.171.96.1"
value = 0 = 0x0
routeAdd "128.171.95.0", "128.171.96.1"
value = 0 = 0x0
hostAdd "kahala","128.171.96.178"
value = 0 = 0x0
hostAdd "hana","128.171.96.176"
value = 0 = 0x0
hostAdd "kapua","128.171.96.152"
value = 0 = 0x0
hostAdd "polihua","128.171.96.180"
value = 0 = 0x0
hostAdd "papahaku","128.171.96.181"
value = 0 = 0x0
#

hostAdd "kamehame","128.171.96.159"
value = 0 = 0x0
#
nfsMount "kamehame","/kamehame","/home/kamehame"
value = 0 = 0x0
#
nfsMount "kahala","/kahala","/home/kahala"
value = 0 = 0x0
nfsMount "hana","/hana/wlupton","/home/wlupton"
value = 0 = 0x0
nfsMount "kapua","/kapua/hlewis","/home/hlewis"
value = 0 = 0x0
nfsMount "polihua","/polihua","/home/polihua"
value = 0 = 0x0
nfsMount "papahaku","/sunos/local/kroot","/kroot"
value = 0 = 0x0
nfsMount "papahaku","/sunos/local/epics","/usr/local/epics"
value = 0 = 0x0
#
hostShow
hostname         inet address       aliases
--------         ------------       -------
cpu4             128.171.96.84     
localhost        127.0.0.1         
host             128.171.96.162    
kahala           128.171.96.178    
hana             128.171.96.176    
kapua            128.171.96.152    
polihua          128.171.96.180    
papahaku         128.171.96.181    
kamehame         128.171.96.159    
value = 0 = 0x0
nfsDevShow
device name          file system                                       
-----------          -----------                                       
/home/kamehame       kamehame:/kamehame                                
/home/kahala         kahala:/kahala                                    
/home/wlupton        hana:/hana/wlupton                                
/home/hlewis         kapua:/kapua/hlewis                               
/home/polihua        polihua:/polihua                                  
/kroot               papahaku:/sunos/local/kroot                       
/usr/local/epics     papahaku:/sunos/local/epics                       
value = 0 = 0x0

Done executing startup script nfs.hq
-> <ktao313/mem
< nfs.hq
#
# $Id: nfs.hq,v 1.8 1997/07/24 20:56:43 ktsubota Exp $
#
# script to nfs mount individual disks onto VxWorks when booted
#
routeAdd "128.171.136.0","128.171.96.1"
value = -1 = 0xffffffff = _end + 0xfff69acf
routeAdd "128.171.95.0", "128.171.96.1"
value = -1 = 0xffffffff = _end + 0xfff69acf
hostAdd "kahala","128.171.96.178"
value = -1 = 0xffffffff = _end + 0xfff69acf
hostAdd "hana","128.171.96.176"
value = -1 = 0xffffffff = _end + 0xfff69acf
hostAdd "kapua","128.171.96.152"
value = -1 = 0xffffffff = _end + 0xfff69acf
hostAdd "polihua","128.171.96.180"
value = -1 = 0xffffffff = _end + 0xfff69acf
hostAdd "papahaku","128.171.96.181"
value = -1 = 0xffffffff = _end + 0xfff69acf
#

hostAdd "kamehame","128.171.96.159"
value = -1 = 0xffffffff = _end + 0xfff69acf
#
nfsMount "kamehame","/kamehame","/home/kamehame"
value = -1 = 0xffffffff = _end + 0xfff69acf
#
nfsMount "kahala","/kahala","/home/kahala"
value = -1 = 0xffffffff = _end + 0xfff69acf
nfsMount "hana","/hana/wlupton","/home/wlupton"
value = -1 = 0xffffffff = _end + 0xfff69acf
nfsMount "kapua","/kapua/hlewis","/home/hlewis"
value = -1 = 0xffffffff = _end + 0xfff69acf
nfsMount "polihua","/polihua","/home/polihua"
value = -1 = 0xffffffff = _end + 0xfff69acf
nfsMount "papahaku","/sunos/local/kroot","/kroot"
value = -1 = 0xffffffff = _end + 0xfff69acf
nfsMount "papahaku","/sunos/local/epics","/usr/local/epics"
value = -1 = 0xffffffff = _end + 0xfff69acf
#
hostShow
hostname         inet address       aliases
--------         ------------       -------
cpu4             128.171.96.84     
localhost        127.0.0.1         
host             128.171.96.162    
kahala           128.171.96.178    
hana             128.171.96.176    
kapua            128.171.96.152    
polihua          128.171.96.180    
papahaku         128.171.96.181    
kamehame         128.171.96.159    
value = 0 = 0x0
nfsDevShow
device name          file system                                       
-----------          -----------                                       
/home/kamehame       kamehame:/kamehame                                
/home/kahala         kahala:/kahala                                    
/home/wlupton        hana:/hana/wlupton                                
/home/hlewis         kapua:/kapua/hlewis                               
/home/polihua        polihua:/polihua                                  
/kroot               papahaku:/sunos/local/kroot                       
/usr/local/epics     papahaku:/sunos/local/epics                       
value = 0 = 0x0

newTable = calloc(1,1024)
new symbol "newTable" added to symbol table.
newTable = 0xfa2150: value = 16295912 = 0xf8a7e8
memcpy(newTable,intVecBaseGet(),1024)
value = 16295912 = 0xf8a7e8
intVecBaseSet newTable
value = 0 = 0x0

shellPromptSet "kt313.> "
value = 532000 = 0x81e20 = _shellHistSize + 0x4

 sysMemTop
value = 16777216 = 0x1000000
 memShow 1

FREE LIST:
  num     addr      size
  --- ---------- ----------
    1   0xffea28         28
    2   0xf8a7c0         32
    3   0xfa1edc         16
    4   0xfa2028         32
    5   0xffef08         20
    6   0xfa3648         20
    7   0xffec28         20
    8   0xfa2858        400
    9   0xffd8f8        180
   10   0xfa378c        168
   11   0xf91ae4        404
   12   0xf8929c       3708
   13   0xf8e204      13968
   14   0xf6a860     104988
   15   0xf51634     102848
   16   0xf93a70         24
   17   0x18d2d0   14313040
   18   0xffc000       6376
   19   0xff2000       8184
   20   0xfe8000       8184
   21   0xfde000       8184
   22   0xfd4000       8112


SUMMARY:
 status   bytes    blocks   avg block  max block
 ------ --------- -------- ---------- ----------
current
   free  14578936       22     662678  14313040
  alloc    571424     3470        164        -
cumulative
  alloc   1238708     4077        303        -
value = 0 = 0x0

 bfill( 0x1000000, 0x4000000,0xffff)
value = 65535 = 0xffff = _vfprintf + 0x1d3

 memAddToPool( 0x1000000,  0x4000000 )
value = 0 = 0x0

 sysMemTop
value = 16777216 = 0x1000000
 memShow 1

FREE LIST:
  num     addr      size
  --- ---------- ----------
    1  0x1000008   67108848
    2   0xffea28         28
    3   0xf8a7c0         32
    4   0xfa1edc         16
    5   0xfa2028         32
    6   0xffef08         20
    7   0xfa3648         20
    8   0xffec28         20
    9   0xfa2858        400
   10   0xffd8f8        180
   11   0xfa378c        168
   12   0xf91ae4        404
   13   0xf8929c       3708
   14   0xf8e204      13968
   15   0xf6a860     104988
   16   0xf51634     102848
   17   0xf93a70         24
   18   0x18d2d0   14313040
   19   0xffc000       6376
   20   0xff2000       8184
   21   0xfe8000       8184
   22   0xfde000       8184
   23   0xfd4000       8112


SUMMARY:
 status   bytes    blocks   avg block  max block
 ------ --------- -------- ---------- ----------
current
   free  81687784       23    3551642  67108848
  alloc    571424     3470        164        -
cumulative
  alloc   1250772     4085        306        -
value = 0 = 0x0

cd "/home/kahala/ktsubota/kroot/rel/ao313/obs"
value = 0 = 0x0
pwd
/home/kahala/ktsubota/kroot/rel/ao313/obs
value = 42 = 0x2a = '*'

ld < dcs/bin/frc40/fmodFix
value = 16298140 = 0xf8b09c = fmodFix_bss + 0x8


ld < epics/base/bin/frc40/iocCore
ld error: error reading file (errno = 0x300046).
value = 0 = 0x0
kt313.> printErrno 0x300046
S_nfsLib_NFSERR_STALE
value = 22 = 0x16
kt313.> memShow 1
                 
FREE LIST:
  num     addr      size
  --- ---------- ----------
    1   0xf9e254        316
    2   0xffea7c         20
    3  0x4ff9460       9040
    4  0x4ff9068        356
    5   0xf8b248       1384
    6   0xf8ac74         72
    7   0xf8abe8         24
    8  0x1000008   66723916
    9   0xffea28         28
   10   0xf8a7c0         32
   11   0xfa1edc         16
   12   0xfa2028         32
   13   0xffef08         20
   14   0xfa3648         20
   15   0xffec28        324
   16   0xfa2858        400
   17   0xffd8f8       2080
   18   0xfa378c       2296
   19   0xf91ae4        936
   20   0xf8929c       4148
   21   0xf8e204      13968
   22   0xf6a860     122696
   23   0xf51634     102848
   24   0xf93a70         24
   25   0x18d2d0   14313040
   26   0xffc000       6376
   27   0xff2000       8184
   28   0xfe8000       8184
   29   0xfde000       8184
   30   0xfd4000       8112


SUMMARY:
 status   bytes    blocks   avg block  max block
 ------ --------- -------- ---------- ----------
current
   free  81337076       30    2711235  66723916
  alloc    922132     3480        264        -
cumulative
  alloc   1721380     4146        415        -
value = 0 = 0x0
kt313.>                       

Navigate by Date:
Prev: vxWorks 5.3.1 and windSh Kevin Tsubota
Next: Re: trying to add 64M offboard memory to system pool Kevin Tsubota
Index: 1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: vxWorks 5.3.1 and windSh Kevin Tsubota
Next: Re: trying to add 64M offboard memory to system pool Kevin Tsubota
Index: 1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·