- Fix for SANS

This commit is contained in:
cvs
2002-11-13 07:47:17 +00:00
parent 3ace74d9d7
commit 995484cc44
8 changed files with 479 additions and 31 deletions

View File

@ -1525,7 +1525,7 @@ extern int close(int fp);
assert(self); assert(self);
assert(iBankNumber >= 0); assert(iBankNumber >= 0);
assert(iBankNumber < MAXBANK); assert(iBankNumber < MAXBANK);
assert(iEdgeLength >= 2); assert(iEdgeLength >= 1);
assert(iStart >= 0); assert(iStart >= 0);
assert(iEnd >= iStart); assert(iEnd >= iStart);

View File

@ -1019,12 +1019,6 @@
return 0; return 0;
} }
if(iDataLen < iEnd*sizeof(HistInt))
{
SCWrite(pCon,"ERROR: Data space mismatch in GetHistogramDirect",
eError);
return 0;
}
/* try at least three times */ /* try at least three times */
for(ii = 0; ii < 3; ii++) for(ii = 0; ii < 3; ii++)

View File

@ -217,7 +217,7 @@ static int gummiFlag = 0; /* a flag indicating stroboscopic, or gummi mode */
float fRot, fTilt, fLambda; float fRot, fTilt, fLambda;
pDummy pDum; pDummy pDum;
pIDrivable pDrive; pIDrivable pDrive;
int iDim[MAXDIM], nDim, histSize; int iDim[MAXDIM], nDim, histSize,iStart;
/* start file */ /* start file */
Nfil = SNXStartSANS(pCon,pSics); Nfil = SNXStartSANS(pCon,pSics);
@ -635,7 +635,8 @@ static int gummiFlag = 0; /* a flag indicating stroboscopic, or gummi mode */
eWarning); eWarning);
} else { } else {
memset(lData,0,histSize*sizeof(HistInt)); memset(lData,0,histSize*sizeof(HistInt));
GetHistogram(self,pCon,0,iDim[0]*iDim[1]*iDim[2],histSize, iStart = iDim[0]*iDim[1]*iDim[2];
GetHistogramDirect(self,pCon,0,iStart,iStart+histSize,
lData,histSize*sizeof(HistInt)); lData,histSize*sizeof(HistInt));
NXDputalias(Nfil,pDict,"gummimon1",lData); NXDputalias(Nfil,pDict,"gummimon1",lData);
NXDputalias(Nfil,pDict,"gummimon2",lData+iDim[2]); NXDputalias(Nfil,pDict,"gummimon2",lData+iDim[2]);

View File

@ -14,7 +14,7 @@ FF = f90
CC = cc CC = cc
CFLAGS = -std -g -I. -I../hardsup -I$(PGPLOT_DIR) -I/data/koenneck/include CFLAGS = -std -g -I. -I../hardsup -I$(PGPLOT_DIR) -I/data/koenneck/include
BIN = ../bin BIN = ../bin
LFLAGS = -L../hardsup -L$PGPLOT_DIR -L/data/lnslib/lib LFLAGS = -L../hardsup -L$PGPLOT_DIR -L/data/lnslib/lib -lX11
#------------ for Linux #------------ for Linux
## FF = g77 ## FF = g77
## CC = gcc ## CC = gcc
@ -99,3 +99,5 @@ clean:
.c.o: .c.o:
$(CC) $(CFLAGS) -c $*.c $(CC) $(CFLAGS) -c $*.c
#---------------------------------------------------------- #----------------------------------------------------------

View File

@ -814,20 +814,6 @@
We have a valid PSD packet. Find and check positions. We have a valid PSD packet. Find and check positions.
*/ */
/*
old style calculation, left in for now
xPos = xData.ui2[1];
if(xPos > 32767)
xPos -= 65536;
yPos = yData.ui2[1];
if(yPos > 32767)
yPos -= 65536;
xPos = (int) ( (float)(xPos+xOff)/(float)psdXFactor);
yPos = (int)( (float)(yPos+yOff)/(float)psdYFactor);
*/
/* /*
This is the new version where all values are offset by 4096 This is the new version where all values are offset by 4096
@ -894,8 +880,17 @@
} }
if(middl >= Tof_edges[0]->n_bins){ if(middl >= Tof_edges[0]->n_bins){
middl = Tof_edges[0]->n_bins-1; if(Tof_edges[0]->n_bins < 5){
printf("WARNING: Fixed bad time bin!\n"); /*
fix for PSD without TOF
*/
middl = Tof_edges[0]->n_bins-1;
} else {
/*
skip it, out of range
*/
continue;
}
} }
/* /*
@ -1263,6 +1258,20 @@
Lwl_fifo = (uint *) 0x80810080; /* for MVME1603 boards */ Lwl_fifo = (uint *) 0x80810080; /* for MVME1603 boards */
#endif #endif
/*
For the MEN board the pci-to-pci bridge to the mezzanine card
has to be configured...........
*/
#ifdef MEN_A012
printf("Configuring for MEN....\n");
Lwl_fifo = (uint *) 0x8a200000;
pciConfigOutWord(0,0x1d,0,0x04,0x0007);
pciConfigOutWord(0,0x1d,0,0x20,0x8a20);
pciConfigOutWord(0,0x1d,0,0x22,0x8a20);
#endif
printf("Value at lwl_fifo = %x, address = %x\n", *Lwl_fifo, Lwl_fifo);
Lwl_csr = &Lwl_dummy_csr; /* Set up address of dummy CSR */ Lwl_csr = &Lwl_dummy_csr; /* Set up address of dummy CSR */
/*============================================================================ /*============================================================================
** Define our signal mask first and define an action routine to catch ** Define our signal mask first and define an action routine to catch
@ -1384,3 +1393,4 @@

View File

@ -151,7 +151,7 @@
Dbg_mask = 0; Dbg_mask = 0;
Dbg_lev0 = 0; Dbg_lev0 = 0;
Dbg_lev1 = 0; Dbg_lev1 = 1;
Dbg_lev2 = 0; Dbg_lev2 = 0;
Dbg_lev3 = 0; Dbg_lev3 = 0;
Cfgn_done = 0; /* Force a configuration before we can do anything. */ Cfgn_done = 0; /* Force a configuration before we can do anything. */
@ -281,13 +281,13 @@
Lwl_hdr_daq_mask = 0x00f00000; Lwl_hdr_daq_mask = 0x00f00000;
Lwl_hdr_daq_soll = 0x00e00000; Lwl_hdr_daq_soll = 0x00e00000;
}else if (strcmp(INST,"AMOR") == 0) { }else if (strcmp(INST,"AMOR") == 0) {
printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "TriCS"); printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "AMOR");
/*
Lwl_hdr_daq_mask = LWL_HDR_NRL_MASK | LWL_PSD_PWF; Lwl_hdr_daq_mask = LWL_HDR_NRL_MASK | LWL_PSD_PWF;
Lwl_hdr_daq_soll = 0; Lwl_hdr_daq_soll = 0;
*/ /*
Lwl_hdr_daq_mask = 0x00f00000; Lwl_hdr_daq_mask = 0x00f00000;
Lwl_hdr_daq_soll = 0x00600000; Lwl_hdr_daq_soll = 0x00600000;
*/
}else if (strcmp (INST, "POLDI") == 0) { }else if (strcmp (INST, "POLDI") == 0) {
printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "POLDI"); printf ("%s: Instrument = \"%s\"\n", Tsk_name[0], "POLDI");
Lwl_hdr_daq_mask = LWL_HDR_NRL_MASK; Lwl_hdr_daq_mask = LWL_HDR_NRL_MASK;

View File

@ -3590,7 +3590,10 @@ void process_gummi_monitor(uint hdr){
return; return;
} }
} }
// put them together again
/*
put them together again
*/
for(imon = 0; imon < 3; imon++){ for(imon = 0; imon < 3; imon++){
lwl_data.ui4 = readbuf[imon*2]; lwl_data.ui4 = readbuf[imon*2];
monitor.ui2[0] = lwl_data.ui2[1]; monitor.ui2[0] = lwl_data.ui2[1];

438
sinqhm/bldmen Executable file
View File

@ -0,0 +1,438 @@
#! /bin/csh
# pss123:~sinqhm/wind/SinqHM/<instr>/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 MEN-A12 board
# for testing.
#
# Mark Koennecke, October 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'
setenv MEN_WORK_DIR /home/pss123/aco/sinqhm/wind2/MEN
setenv MEN /home/pss123/aco/sinqhm/wind2/MEN
alias ccvx 'ccppc ' \
'-B/home/pss123/aco/sinqhm/wind2/2.0.2/host/sun4-solaris2/lib/gcc-lib/' \
' -mstrict-align -ansi -nostdinc -O2 -fvolatile -fno-builtin' \
' -fno-for-scope -Wall -I/h -I$MEN/VXWORKS/INCLUDE/NATIVE '\
' -I$MEN/VXWORKS/INCLUDE/COM -I$MEN/VXWORKS -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=PPC603 '\
' -DMEN_A012 -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 <inst> all - build all modules for instrument <inst>."
echo " bld <inst> SinqHM_srv [<module>] - build SinqHM_srv module"
echo " bld <inst> lwl_server - build lwl_server module"
echo " bld <inst> SinqHM_bootParamsConfig - build auto-config module"
echo " bld <inst> SinqHM_bootUtil - build boot-utility module"
echo " bld focus FOCUS_srv [<module>] - build FOCUS_srv module"
echo " bld <inst> 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/men_824x_ali
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 <instr> 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 " Cpy 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 -o SinqHM_srv_main.o SinqHM_srv_main.c
echo " Compiling SinqHM_srv_routines.c ..."
ccvx $defn -o SinqHM_srv_routines.o SinqHM_srv_routines.c
echo " Compiling SinqHM_srv_filler.c ..."
ccvx $defn -o SinqHM_srv_filler.o SinqHM_srv_filler.c
echo " Compiling SinqHM_srv_server.c ..."
ccvx $defn -o SinqHM_srv_server.o 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 -o lwl_server.o 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 \
-o SinqHM_bootParamsConfig.o 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 \
-o SinqHM_bootUtil.o 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 <instr> 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/men_824x_ali
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