- Fixes to HM code for AMOR TOF

- A couple of TAS fixes
- o2t was fixed to work with any drivable
- FOCUS was mended to include beam monitor in data file
This commit is contained in:
cvs
2002-07-19 15:09:21 +00:00
parent e0c5afcf6d
commit bde19bb973
38 changed files with 604 additions and 249 deletions

View File

@@ -14,7 +14,8 @@
**
** Author . . . . . . . . . . : D. Maden
** Date of creation . . . . . . : Mar 2000
**
** Well, start a motor. But not a3 in powder mode in order to
** Updates:
** 1A01 7-Mar-2000 DM Initial version.
**---------------------------------------------------------------------------
@@ -101,8 +102,11 @@
#include "SinqHM_def.h"
#include "FOCUS_gbl.h"
#define READBUFSIZE 66560
extern char *vxWorksVersion; /* Version string of vxWorks */
extern char *creationDate; /* Creation Date string of vxWorks */
static uchar readBuffer[READBUFSIZE];
/*
**=============================================================================
** Local routines.
@@ -1593,7 +1597,7 @@
uint bins_to_go, lastbin;
struct req_buff_struct my_rqst;
struct rply_buff_struct my_rply;
uchar *buff_pntr, *last_byte, *nxt;
uchar *buff_pntr, *last_byte, *nxt;
uchar buff[pkt_size];
register union {
@@ -1661,23 +1665,12 @@
/***************************************************************/
/*
** The args are OK.
** Reserve some space for buffering the histogram data.
** Set up fixed buffer to do transfer
*/
my_pntr.base = NULL;
i = memFindMax (); /* Get size of biggest free memory block */
if (i > (my_nbins * FS_bpb)) { /* If there's room to hold everything,
** try to get it */
bins_in_buff = my_nbins;
my_pntr.base = malloc (bins_in_buff * FS_bpb);
if (my_pntr.base == NULL) {
bins_in_buff = my_nbins/2; /* A fall-back position! */
my_pntr.base = malloc (bins_in_buff * FS_bpb);
}
}else {
i = (i * 3)/4; /* there's not room to hold everything, so get less! */
bins_in_buff = (i + FS_bpb - 1)/FS_bpb;
my_pntr.base = malloc (bins_in_buff * FS_bpb);
}
my_pntr.base = readBuffer;
bins_in_buff = READBUFSIZE/FS_bpb;
if (my_pntr.base == NULL ) {
if (FS_dbg_lev0) printf (
"\n%s -- SQHM_READ: no buffer space available!\n",
@@ -1708,6 +1701,7 @@
nbins_to_send = my_nbins;
bytes_in_buff = 0;
nxt = (char *) my_pntr.base;
while (nbins_to_send > 0) {
/* Read some histogram data into buffer */
lastbin = nxtbin_to_send + bins_in_buff;
@@ -1743,7 +1737,7 @@
nxtbin_to_send += bins_to_go;
nbins_to_send -= bins_to_go;
}
free (my_pntr.base);
/*
** Read-out complete so let DAQ continue.
*/

View File

@@ -950,8 +950,10 @@
}
/*
We have a valid single detector packet.
Subtract one form the number because Urs Greuter starts
counting at 1, and ANSI-C at 0
*/
edNum = edData.ui2[1];
edNum = edData.ui2[1] - 1;
if(edNum < 0 || edNum >= MAX_PSD_ED){
printf("Got invalid detector number %d\n",edNum);
continue;
@@ -999,7 +1001,13 @@
/*
calculate histogram position to update
*/
dataPos = (psdYSize*psdXSize + edNum)*Tof_edges[0]->n_bins + middl;
dataPos = (psdYSize*psdXSize)*Tof_edges[0]->n_bins
+ edNum*Tof_edges[0]->n_bins + middl - 1;
if(Dbg_lev1){
printf("dataPos = %d\n", dataPos);
}
/* UD must come but the UD bit is not defined......
if ((Hm_mode_UD != 0) &&
@@ -1358,3 +1366,6 @@
exit (KER__SUCCESS);
}
/*======================================= End of SinqHM_srv_filler.c ========*/

View File

@@ -151,7 +151,7 @@
Dbg_mask = 0;
Dbg_lev0 = 0;
Dbg_lev1 = 0;
Dbg_lev1 = 1;
Dbg_lev2 = 0;
Dbg_lev3 = 0;
Cfgn_done = 0; /* Force a configuration before we can do anything. */

View File

@@ -1322,6 +1322,7 @@
psdYSize = ntohs(my_rqst->u.cnfg.u.psd.ySize);
printf("\txSize = %4d, ySize = %4d\n",
psdXSize, psdYSize);
N_hists = psdXSize*psdYSize+MAX_PSD_ED;
Tof_dts_soll = ntohl (my_rqst->u.cnfg.u.psd.preset_delay); /* The
** required "Delay-Time-to-Start" */
@@ -1368,6 +1369,7 @@
edge_arr_pntr = &my_rqst->u.cnfg.u.psd.edge_0;
for (i = 0; i < N_tof_edges; i++) {
n_bins = ntohl (edge_arr_pntr->n_bins);
N_bins = n_bins;
flag = ntohl (edge_arr_pntr->flag);
edge_0 = ntohl (edge_arr_pntr->edges[0]);
edge_1 = ntohl (edge_arr_pntr->edges[1]);
@@ -1567,7 +1569,8 @@
Total_bytes += ((n_cntrs + MAX_PSD_ED) * n_bins * bytes_per_bin);
if (i == 0) { /* Use the first counter bank to define some .. */
N_hists = n_cntrs; /* .. globals since we expect there usually to .. */
N_hists = n_cntrs+MAX_PSD_ED;
/* .. globals since we expect there usually to .. */
/* .. be only 1 counter bank. */
N_bins = n_bins;
Lo_cntr = first;
@@ -1591,6 +1594,7 @@
}else {
Hist_base_addr = NULL;
}
printf("Successfully allocated %d bytes\n", Total_bytes);
if (Hist_base_addr == NULL) {
printf ("\007do_SQHM__PSD_alloc:\n"
" Unable to reserve %d bytes of memory!\n"

View File

@@ -82,6 +82,7 @@
mv bld bld.save
rcp -p "${src}bld" ./bld
rcp -p "${src}bld2" ./bld2
rcp -p "${src}bld604" ./bld604
exit
#-----------------------------------------------------------------------------
startup: