diff --git a/sinqhm/SinqHM_bootParamsConfig.c b/sinqhm/SinqHM_bootParamsConfig.c index 943d0ddd..8e785959 100755 --- a/sinqhm/SinqHM_bootParamsConfig.c +++ b/sinqhm/SinqHM_bootParamsConfig.c @@ -164,10 +164,14 @@ #include "bootLib.h" #include "ioLib.h" +#ifdef MV2600 +#include "../config/mv2604/config.h" +#else #if (CPU == PPC603) #include "../config/mv1603/config.h" #elif (CPU == PPC604) -#include "../config/mv1603/config.h" +#include "../config/mv1604/config.h" +#endif #endif #include diff --git a/sinqhm/SinqHM_bootUtil.c b/sinqhm/SinqHM_bootUtil.c index 420fb07a..7caf7efc 100755 --- a/sinqhm/SinqHM_bootUtil.c +++ b/sinqhm/SinqHM_bootUtil.c @@ -58,11 +58,15 @@ #include "usrLib.h" #include "ioLib.h" +#ifdef MV2600 +#include "../config/mv2604/config.h" +#else #if (CPU == PPC603) #include "../config/mv1603/config.h" #elif (CPU == PPC604) #include "../config/mv1604/config.h" #endif +#endif #include #include diff --git a/sinqhm/SinqHM_srv_filler.c b/sinqhm/SinqHM_srv_filler.c index 1ed029c3..cbb10f58 100755 --- a/sinqhm/SinqHM_srv_filler.c +++ b/sinqhm/SinqHM_srv_filler.c @@ -1219,7 +1219,23 @@ SinqHM_Dsbl_Mask = 0; /* Start up with DAQ enabled */ - Lwl_fifo = (uint *) 0x80810080; /* Set up address of Fibre Optic */ + /* + set up address of fibre optic. This is very board specific! + The last 3 bytes of this address are set in the programmable logic + of the mezzanine card. The first byte is the offset of the PCI memory + space in the processor memory map. Together the address must result + in a valid address lying in the region reserved for PCI I/O. The + program on the mezzanine card may need updating in order to ensure just + that. + + Mark Koennecke, February 2002 + */ +#ifdef MV2600 + Lwl_fifo = (uint *) 0x80008080; +#else + Lwl_fifo = (uint *) 0x80810080; /* for MVME1603 boards */ +#endif + Lwl_csr = &Lwl_dummy_csr; /* Set up address of dummy CSR */ /*============================================================================ ** Define our signal mask first and define an action routine to catch @@ -1241,6 +1257,9 @@ ** flush out any data in the fibre-optic FIFO. */ *Lwl_csr = 0x0001; /* This will (maybe) initialise the fibre-optic FIFO. */ + printf("vxWorks thinks it still has %d bytes of memory\n",memFindMax()); + + printf("Flushing lwl.....\n"); lwl_Fifo_Flush (); /* Flush the fibre-optic FIFO. */ /*============================================================================ diff --git a/sinqhm/SinqHM_srv_main.c b/sinqhm/SinqHM_srv_main.c index 3d6880bd..2091f73c 100755 --- a/sinqhm/SinqHM_srv_main.c +++ b/sinqhm/SinqHM_srv_main.c @@ -170,7 +170,7 @@ } if (Sem_Server == NULL) { - Sem_Server = semBCreate (SEM_Q_FIFO, SEM_FULL); + Sem_Server = semBCreate (SEM_Q_FIFO,SEM_FULL); } /* ** Debug hint - set Use_sem_tmo to zero to disable semaphore time-outs diff --git a/sinqhm/bld b/sinqhm/bld index 64f31899..88dd24a7 100755 --- a/sinqhm/bld +++ b/sinqhm/bld @@ -80,7 +80,8 @@ #=== echo " Copying bld (previous version is bld.save) ..." mv bld bld.save - rcp -p "${src}bld." ./bld + rcp -p "${src}bld" ./bld + rcp -p "${src}bld2" ./bld2 exit #----------------------------------------------------------------------------- startup: diff --git a/sinqhm/bld2 b/sinqhm/bld2 new file mode 100755 index 00000000..357a9571 --- /dev/null +++ b/sinqhm/bld2 @@ -0,0 +1,432 @@ +#! /bin/csh +# pss123:~sinqhm/wind/SinqHM//bld V01G +# +# Script to compile and link the SinqHM_srv programs for vxWorks +# +# rcp -p "lnsa04:sinqhm/bld" ~/wind/SinqHM/bld +# +# This version is for the Tornado 2.0.2 version and the MVME2604 board +# as used at AMOR and SANS +# +# Mark Koennecke, February 2002 + +## printf 'Arg 0 = "%s"\n' $0 +## printf 'Arg 1 = "%s"\n' $1 +## printf 'Arg 2 = "%s"\n' $2 +## printf 'Arg 3 = "%s"\n' $3 +#---------------------------------------------------------------------------- + set proc = "$0" + if (`expr match "$proc" "\/"` != 1) set proc = "./$0" + cd $proc:h # Build in bld's directory! +#------------------------------------------------------------------------------ +# Uncomment the following command to disable remote-copy operations +# +## alias rcp 'echo " Warning -- remote copy disabled"; echo \!\!:* > /dev/null' +#------------------------------------------------------------------------------ + if ("`whoami`" == "maden") then + set src = "maden@lnsa06:sinqhm/" + else if ("`whoami`" == "sinqhm") then + set src = "koenneck@lnsa17:src/sics/sinqhm/" + else + echo Sorry, you are not recognised by this script. + exit + endif +#------------------------------------------------------------------------------ +# alias ccvx 'ccppc -O0 -mcpu=603 -I${WIND_BASE}/target/h ' \ +# '-fno-builtin -fno-for-scope ' \ +# '-nostdinc -DCPU=PPC603 -D_GNU_TOOL -gdwarf -c -Wimplicit' +alias ccvx 'ccppc ' \ + '-B/home/pss123/aco/sinqhm/wind2/2.0.2/host/sun4-solaris2/lib/gcc-lib/' \ + ' -mstrict-align -fdollars-in-identifiers -O2 -fvolatile -fno-builtin' \ + ' -fno-for-scope -Wall -I/h -I. '\ + ' -I/home/pss123/aco/sinqhm/wind2/2.0.2/target/config/all ' \ + ' -I/home/pss123/aco/sinqhm/wind2/2.0.2/target/h '\ + ' -I/home/pss123/aco/sinqhm/wind2/2.0.2/target/src/config '\ + ' -I/home/pss123/aco/sinqhm/wind2/2.0.2/target/src/drv -DCPU=PPC604 '\ + ' -DMV2600 -DSINQHM_SPAWN=1 -c ' + + +# + + set Insts = (dev dmc sans focus hrpt trics poldi amor) + + if (("$1" == "") || \ + ("$1" == "?") || \ + ("$1" == "h") || \ + ("$1" == "he") || \ + ("$1" == "hel") || \ + ("$1" == "help")) goto show_help + + printf "\n" + printf "Working directory is %s\n" "$cwd" + printf 'Source is "%s"\n' "$src" + printf "\n" + + if ("$1" == "bld") goto bld + if ("$1" == "startup") goto startup + if ("$1" == "basic") goto basic + + foreach inst ($Insts) + if ("$1" == "$inst") goto $inst + end + printf '\aI do not know how to build "%s"\!\n' $1 + goto show_help +#=========================================================================== + show_help_0: + printf '\n\007You must specify what you want to build\!\n\n' + show_help: +#========= + echo "Usage:" + echo " bld bld - copy over new version of bld script." + echo " bld startup - copy over new version of startup script." + echo " bld basic - build basic system." + echo " bld all - build all modules for instrument ." + echo " bld SinqHM_srv [] - build SinqHM_srv module" + echo " bld lwl_server - build lwl_server module" + echo " bld SinqHM_bootParamsConfig - build auto-config module" + echo " bld SinqHM_bootUtil - build boot-utility module" + echo " bld focus FOCUS_srv [] - build FOCUS_srv module" + echo " bld auto - build auto-spawn system" + echo " " + echo "Valid instruments are:" + echo " $Insts" + echo " " + exit +#----------------------------------------------------------------------------- + bld: +#=== + echo " Copying bld (previous version is bld.save) ..." + mv bld bld.save + rcp -p "${src}bld" ./bld + rcp -p "${src}bld2" ./bld2 + rcp -p "${src}tornado2" ./tornado2 + exit +#----------------------------------------------------------------------------- + startup: +#======= + echo " Copying startup ..." + rcp -p "${src}startup.template" ./startup + exit +#----------------------------------------------------------------------------- + basic: +#===== + set dflt = "$cwd" + cd $WIND_BASE/target/config/mv2604 + echo " " + echo "Default directory changed to:" + echo " $cwd" + printf "Building vxWorks_basic system image ...\n\n" + touch config.h # Force a complete re-compilation + + make ADDED_CFLAGS=" -DSINQHM_SPAWN=0" \ + ADDED_MODULES="" + + mv vxWorks vxWorks_basic + mv vxWorks.sym vxWorks.sym_basic + cp -p vxWorks_basic $dflt/vxWorks_basic + cp -p vxWorks.sym_basic $dflt/vxWorks.sym + cd $dflt + echo " Done. Result is $dflt/vxWorks_basic" + exit +#============================================================================= +# Now follow labels for all the valid instruments. + dev: +#---- + set instr = Devel + set defn = '-DINST="Devel" -DDevel' + set direc = Devel/NEW + goto comn + dmc: +#--- + set instr = DMC + set defn = '-DINST="DMC" -DDMC' + set direc = DMC/NEW + goto comn + sans: +#---- + set instr = SANS + set defn = '-DINST="SANS" -DSANS' + set direc = SANS/NEW + goto comn + focus: +#----- + set instr = FOCUS + set defn = '-DINST="FOCUS" -DFOCUS' + set direc = FOCUS/NEW + goto comn + hrpt: +#---- + set instr = HRPT + set defn = '-DINST="HRPT" -DHRPT' + set direc = HRPT/NEW + goto comn + trics: +#----- + set instr = TriCS + set defn = '-DINST="TRICS" -DTRICS' + set direc = TRICS + goto comn + poldi: +#----- + set instr = POLDI + set defn = '-DINST="POLDI" -DPOLDI' + set direc = POLDI/NEW + goto comn + amor: +#---- + set instr = AMOR + set defn = '-DINST="AMOR" -DAMOR' + set direc = AMOR/NEW + goto comn + comn: +#---- + echo The selected instrument is ${instr}. + + if ("$2" == "") goto show_help_0 + + cd $direc + printf "Working directory changed to %s\n" "$cwd" + if ("$2" == "SinqHM_srv") goto SinqHM_srv + if ("$2" == "lwl_server") goto lwl_server + if ("$2" == "SinqHM_bootParamsConfig") goto SinqHM_bootParamsConfig + if ("$2" == "SinqHM_bootUtil") goto SinqHM_bootUtil + if (("$instr" == "FOCUS") && ("$2" == "FOCUS_srv")) goto FOCUS_srv + if ("$2" == "auto") goto auto + if ("$2" != "all") then + printf '\007I do not know how to build "%s" for %s\!\n' "$2" $instr + printf 'Type "bld help" for help\!\n' + exit + endif +#-------------------------------------------------------------- + SinqHM_srv: +#========== + set Mods = (SinqHM_gbl.h \ + SinqHM_def.h \ + vmio10_def.h \ + SinqHM_srv_main.c \ + SinqHM_srv_routines.c \ + SinqHM_srv_filler.c \ + SinqHM_srv_server.c) + + if (("$3" == "") || ("$3" == "all")) goto SinqHM_srv_all + + foreach module ($Mods) + if ("$3" == "$module") goto SinqHM_srv_cpy + end + + if (("$3" != "?") && \ + ("$3" != "h") && \ + ("$3" != "he") && \ + ("$3" != "hel") && \ + ("$3" != "help")) then + printf '"%s" is not a recognised module of SinqHM_srv\!\n\n' "$3" + endif + + printf 'To build SinqHM_srv, use the command:\n' + printf '\n' + printf ' bld SinqHM_srv [module]\n' + printf '\n' + printf 'Valid instruments are:\n' + printf '\n' + printf ' %s\n' "$Insts" + printf '\n' + printf 'Valid modules are:\n' + printf '\n' + foreach module ($Mods) + printf ' %s\n' "$module" + end + printf '\n' + exit +#---------------------------------------------------------------------------- + SinqHM_srv_cpy: +#-------------- + echo " Copying $3 ..." + rcp -p "${src}$3" ./$3 + + if ("$3" == "SinqHM_gbl.h") goto SinqHM_srv_compile_all + if ("$3" == "SinqHM_def.h") goto SinqHM_srv_compile_all + if ("$3" == "vmio10_def.h") goto SinqHM_srv_compile_all + + echo " Compiling $3 ..." + ccvx $defn $3 + goto SinqHM_srv_link + + SinqHM_srv_all: +#-------------- + echo " " + echo "Building SinqHM_srv ..." + echo " Copying header files ..." + rcp -p "${src}SinqHM_gbl.h" ./SinqHM_gbl.h + rcp -p "${src}SinqHM_def.h" ./SinqHM_def.h + rcp -p "${src}vmio10_def.h" ./vmio10_def.h + echo " Copying source files ..." + rcp -p "${src}SinqHM_srv_main.c" ./SinqHM_srv_main.c + rcp -p "${src}SinqHM_srv_routines.c" ./SinqHM_srv_routines.c + rcp -p "${src}SinqHM_srv_filler.c" ./SinqHM_srv_filler.c + rcp -p "${src}SinqHM_srv_server.c" ./SinqHM_srv_server.c + + SinqHM_srv_compile_all: +#---------------------- + echo " Compiling SinqHM_srv_main.c ..." + ccvx $defn SinqHM_srv_main.c + echo " Compiling SinqHM_srv_routines.c ..." + ccvx $defn SinqHM_srv_routines.c + echo " Compiling SinqHM_srv_filler.c ..." + ccvx $defn SinqHM_srv_filler.c + echo " Compiling SinqHM_srv_server.c ..." + ccvx $defn SinqHM_srv_server.c + + SinqHM_srv_link: +#--------------- + echo " Linking ..." + ldppc -o SinqHM_srv.o -r \ + SinqHM_srv_main.o SinqHM_srv_routines.o \ + SinqHM_srv_filler.o SinqHM_srv_server.o + echo " Done. Result is $cwd/SinqHM_srv.o" + if ("$2" != "all") exit +#--------------------------------------------------------------------------- + lwl_server: +#========== + echo " " + echo "Building lwl_server ..." + echo " Copying header files ..." + rcp -p "${src}vmio10_def.h" ./vmio10_def.h + echo " Copying source files ..." + rcp -p "${src}lwl_server.c" ./lwl_server.c + echo " Compiling lwl_server.c ..." + ccvx $defn lwl_server.c + echo " Done. Result is $cwd/lwl_server.o" + if ("$2" != "all") exit +#--------------------------------------------------------------------------- + SinqHM_bootParamsConfig: +#======================= + echo " " + echo "Building SinqHM_bootParamsConfig ..." + echo " Copying header files ..." + rcp -p "${src}SinqHM_def.h" ./SinqHM_def.h + echo " Copying source files ..." + rcp -p "${src}SinqHM_bootParamsConfig.c" \ + ./SinqHM_bootParamsConfig.c + echo " Compiling SinqHM_bootParamsConfig.c ..." + ccvx $defn -I${WIND_BASE}/target/config/all \ + SinqHM_bootParamsConfig.c + echo " Done. Result is $cwd/SinqHM_bootParamsConfig.o" + if ("$2" != "all") exit +#--------------------------------------------------------------------------- + SinqHM_bootUtil: +#=============== + echo " " + echo "Building SinqHM_bootUtil ..." + echo " Copying header file ..." + rcp -p "${src}SinqHM_def.h" ./SinqHM_def.h + echo " Copying source file ..." + rcp -p "${src}SinqHM_bootUtil.c" \ + ./SinqHM_bootUtil.c + echo " Compiling SinqHM_bootUtil.c ..." + ccvx $defn -I${WIND_BASE}/target/config/all SinqHM_bootUtil.c + echo " Done. Result is $cwd/SinqHM_bootUtil.o" + if ("$2" != "all") exit +#--------------------------------------------------------------------------- + FOCUS_srv: +#========== + if ($instr != "FOCUS") goto FOCUS_srv_skp + set Mods = ( FOCUS_gbl.h \ + SinqHM_def.h \ + FOCUS_srv_main.c ) + + if (("$3" == "") || ("$3" == "all")) goto FOCUS_srv_all + + foreach module ( $Mods ) + if ("$3" == "$module") goto FOCUS_srv_cpy + end + + if (("$3" != "?") && \ + ("$3" != "h") && \ + ("$3" != "he") && \ + ("$3" != "hel") && \ + ("$3" != "help")) then + printf '"%s" is not a recognised module of FOCUS_srv\!\n\n' "$3" + endif + + printf 'To build FOCUS_srv, use the command:\n' + printf '\n' + printf ' bld FOCUS_srv [module]\n' + printf '\n' + printf 'Valid instruments are:\n' + printf '\n' + printf ' %s\n' "focus" + printf '\n' + printf 'Valid modules are:\n' + printf '\n' + foreach module ($Mods) + printf ' %s\n' "$module" + end + printf '\n' + exit +#---------------------------------------------------------------------------- + FOCUS_srv_cpy: +#-------------- + echo " Copying $3 ..." + rcp -p "${src}$3" ./$3 + + if ("$3" == "FOCUS_gbl.h") goto FOCUS_srv_compile_all + if ("$3" == "SinqHM_def.h") goto FOCUS_srv_compile_all + + echo " Compiling $3 ..." + ccvx $defn $3 + goto FOCUS_srv_link + + FOCUS_srv_all: +#-------------- + echo " " + echo "Building FOCUS_srv ..." + echo " Copying header files ..." + rcp -p "${src}FOCUS_gbl.h" ./FOCUS_gbl.h + rcp -p "${src}SinqHM_def.h" ./SinqHM_def.h + echo " Copying source files ..." + rcp -p "${src}FOCUS_srv_main.c" ./FOCUS_srv_main.c + + FOCUS_srv_compile_all: +#---------------------- + echo " Compiling FOCUS_srv_main.c ..." + ccvx $defn FOCUS_srv_main.c + + FOCUS_srv_link: +#--------------- + echo " Linking ..." + ldppc -o FOCUS_srv.o -r \ + FOCUS_srv_main.o + echo " Done. Result is $cwd/FOCUS_srv.o" + FOCUS_srv_skp: +#------------- + if ("$2" != "all") exit +#--------------------------------------------------------------------------- + auto: +#==== + set dflt = "$cwd" + cd $WIND_BASE/target/config/mv2604 + echo " " + echo "Default directory changed to:" + echo " $cwd" + printf "\n\n==================================================\n" + printf \ + "\n\nBuilding vxWorks_auto system image for $instr Instrument ...\n\n" + touch config.h # Force a complete re-compilation + + set mods = ( $dflt/SinqHM_srv.o \ + $dflt/lwl_server.o \ + $dflt/SinqHM_bootParamsConfig.o \ + $dflt/SinqHM_bootUtil.o ) + if ($instr == FOCUS) set mods = ( $mods $dflt/FOCUS_srv.o ) + + make ADDED_CFLAGS=" -DSINQHM_SPAWN=1" \ + ADDED_MODULES="$mods" + + mv vxWorks vxWorks_auto + mv vxWorks.sym vxWorks.sym_auto + cp -p vxWorks_auto $dflt/vxWorks_auto + cp -p vxWorks.sym_auto $dflt/vxWorks.sym + cd $dflt + echo " Done. Result is $dflt/vxWorks_auto" + exit +#------------------------------------------------------------------ End of bld diff --git a/sinqhm/lwl_client.c b/sinqhm/lwl_client.c index 17ff85be..6538b712 100755 --- a/sinqhm/lwl_client.c +++ b/sinqhm/lwl_client.c @@ -360,7 +360,7 @@ printf ("\nCycle %5d", i+1); for (j = 0; j < nrec; j++) { status = send (Cnct_skt, p_recs[j], (*p_recs[j])+1, 0); - sleep(2); + /* sleep(2); */ } } printf ("\nDone.\n"); diff --git a/sinqhm/lwl_server.c b/sinqhm/lwl_server.c index 59b88244..bf539cf7 100755 --- a/sinqhm/lwl_server.c +++ b/sinqhm/lwl_server.c @@ -479,3 +479,7 @@ return OK; } /*========================================= End of LWL_SERVER.C ========*/ + + + + diff --git a/sinqhm/monitor.c b/sinqhm/monitor.c new file mode 100644 index 00000000..2e2cc976 --- /dev/null +++ b/sinqhm/monitor.c @@ -0,0 +1,354 @@ +/***************************************************************************** +* File: monitor.c +* Purpose: to allow a user to easily edit memory using 1,2 +* or 4 byte +* words. +* Author: Scott Johnson +* Host Sys: VxWorks +* Started: 01/20/90 +* Updates: 02/13/90 added my own display routine +* 03/29/90 added history +* 08/22/90 fixed repeat command (return key) +* 11/13/90 bus errors are trapped +* Mark Koennecke +* 04/02/2002 for Tornado 2.0.2 +*****************************************************************************/ +/* tabstop = 4 */ + +#include "vxWorks.h" +#include "strLib.h" +#include "stdioLib.h" + +int data_type = 2; /* 1 = byte 2 = word 4 = long */ + +static void help(void); +static int process_command(char *command); + +int monitor (int a1, int a2, int a3, int a4, int a5, int a6, int a7, + int a8, int a9, int suspend) +{ + + char command [80]; + char input [80]; + char *from_read; + + printf ("VxWorks history added 03/29/90\n"); + printf ("Bus Error trapping added 11/13/90\n\n"); + do + { + switch (data_type) + { + case 1 : printf ("byte>"); break; + case 2 : printf ("word>"); break; + case 4 : printf ("long>"); break; + } + + if ((from_read = fgets(input,79,stdin)) != EOF) + { + if ( strlen(input) == 0 && (strlen(command) != 0)) + { + printf ("%s\n", command); + process_command (command); + } + else + { + printf ("%s\n", input); + process_command (input); + strcpy (command, input); + } + } + + } while ((input [0] != 'q') && (from_read != EOF)); + fflush (stdin); + fflush (stdout); + return 1; +} + +static int process_command (command) + char *command; +{ + + unsigned long longInt, longVal; + unsigned short shortInt; + unsigned char byte; + unsigned char *ptr; + unsigned char *address, *size; + unsigned int start, end, value; + int scanned; + char ch; + + switch (command [0]) + { + case 'q' : /* user wants to quit so do nothing */ + case '#' : /* comment character */ + break; + case 'f' : /* block fill */ + scanned=sscanf(command,"%c %x %x %x",&ch,&address,&size,&longInt); + if (scanned != 4) + printf ("usage : f address size value\n"); + else + { + for (ptr = address ;(int)ptr < ((int)size + (int)address); + ptr+=data_type) + { + switch (data_type) + { + case 1 : + if (vxMemProbe (ptr, READ, data_type, &byte) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + return (1); + } + else + *((unsigned char *) ptr) = byte; + break; + case 2 : + if (vxMemProbe (ptr, READ, data_type, &shortInt) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + return (1); + } + else + *((unsigned short *) ptr) = shortInt; + break; + case 4 : + if (vxMemProbe (ptr, READ, data_type, &longInt) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + return (1); + } + else + *((unsigned long *) ptr) = longInt; + break; + } + } + } + break; + case 's' : /* scan range */ + scanned=sscanf(command,"%c %x %x %x",&ch,&start,&end,&value); + if (scanned != 4) + printf ("usage : s start end value\n"); + else + { + /** + scanning does not work: some memory locations lock up!!!! + */ + printf("Scanning from %x %x for %x\n", start, end, value); + for (ptr = start ;(unsigned int)ptr < end; + ptr+=data_type) + { + switch (data_type) + { + case 1 : + if (vxMemProbe (ptr, READ, data_type, &byte) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + } + else { + if((unsigned char)*ptr == value){ + printf("Value found at %08x\n",ptr); + } + } + break; + case 2 : + if (vxMemProbe (ptr, READ, data_type, &shortInt) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + } + else + { + if((unsigned short)*ptr == value){ + printf("Value found at %08x\n",ptr); + } + } + break; + case 4 : + if (vxMemProbe (ptr, READ, data_type, &longInt) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + } + else + { + if((unsigned int)*ptr == value){ + printf("Value found at %08x\n",ptr); + } + } + } + } + } + printf("Finished scanning....\n"); + break; + case 'l' : + data_type = 4; + break; + case 'b' : + data_type = 1; + break; + case 'w' : + if (command [1] == 'o') + data_type = 2; + else + { + scanned=sscanf(command,"%c %x %x",&ch,&ptr,&longInt); + if (scanned != 3) + printf ("usage : w address value\n"); + else + { + switch (data_type) + { + case 1 : + byte = (unsigned char) longInt; + if (vxMemProbe (ptr, WRITE, data_type, &byte) != OK) + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + else + printf("%06X : %02X\n",(unsigned) ptr, byte); + break; + case 2 : + shortInt = (unsigned short) longInt; + if (vxMemProbe (ptr, WRITE, data_type, &shortInt) != OK) + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + else + printf ("%06X : %04X\n", (unsigned) ptr, shortInt); + break; + case 4 : + if (vxMemProbe (ptr, WRITE, data_type, &longInt) != OK) + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + else + printf ("%06X : %08X\n", (unsigned) ptr, longInt); + break; + } + } + } + break; + case 'r' : + scanned = sscanf (command,"%c %x", &ch,&ptr); + if (scanned != 2) + printf ("usage : r address\n"); + else + { + switch (data_type) + { + case 1 : + if (vxMemProbe (ptr, READ, data_type, &byte) != OK) + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + else + printf ("%06x : %02x\n",(unsigned) ptr, byte); + break; + case 2 : + if (vxMemProbe (ptr, READ, data_type, &shortInt) != OK) + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + else + printf ("%06x : %04x\n",(unsigned) ptr, shortInt); + break; + case 4 : + if (vxMemProbe (ptr, READ, data_type, &longInt) != OK) + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + else + printf ("%06X : %08X\n", (unsigned) ptr, longInt); + break; + } + } + break; + case 'd' : /* use VxWorks display routine */ + scanned = sscanf (command,"%c %x", &ch,&ptr); + if (scanned != 2) + printf ("usage : d address\n"); + else + { + int x,y; + for (y=0;y<16;y++) + { + printf ("%06X-", (unsigned int) ptr); + for (x=0;x<16/data_type;x++, ptr += data_type) + { + switch (data_type) + { + case 1 : + if (vxMemProbe (ptr, READ, data_type, &byte) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + return (1); + } + else + printf (" %02x", byte); + break; + case 2 : + if (vxMemProbe (ptr, READ, data_type, &shortInt) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + return (1); + } + else + printf (" %04x", shortInt); + break; + case 4 : + if (vxMemProbe (ptr, READ, data_type, &longInt) != OK) + { + printf ("Bus error: address = %06x, data size = %d\n", + (unsigned int) ptr, data_type); + return (1); + } + else + printf (" %08x", longInt); + break; + } + } + printf ("\n"); + } + } + break; + case 'h' : + help (); + break; + default : + printf ("Unrecognized command. Use h for help.\n"); + break; + } + return 1; +} + +static void help () +{ + + printf ("===================================================\n"); + printf ("= Monitor =\n"); + printf ("= By Scott Johnson =\n"); + printf ("===================================================\n"); + printf ("Commands:\n"); + printf ("[r]ead address..................reads given address\n"); + printf ("[w]rite address value...........writes value to address\n"); + printf ("[b]yte..........................read/write 8 bits\n"); + printf ("[wo]rd..........................read/write 16 bits\n"); + printf ("[l]ong..........................read/write 32 bits\n"); + printf ("[d]isplay address...............show memory at address\n"); + printf ("[f]ill address size value.......fill a block with value\n"); + printf + ("[s]scan start end value.........scan range between start end for value\n"); + printf ("[q]uit..........................quit\n"); + printf ("\n"); + printf ("Features:\n"); + printf ("1) Hit return to do a command again.\n"); + printf ("2) VxWorks history is supported\n"); + printf ("3) Redirect a script file while in the shell to easily\n"); + printf (" setup multiple locations.\n"); + printf (" Ex: -> monitor < script_file \n"); + printf ("\n"); + printf ("Remember to end script files with a 'q'\n"); + printf ("\n"); +} + +