- updated simulation

This commit is contained in:
cvs
2002-12-05 14:28:16 +00:00
parent 995484cc44
commit c944355198
10 changed files with 63 additions and 12 deletions

View File

@ -1,4 +1,3 @@
#
# --------------------------------------------------------------------------
# Initialization script for a simulated AMOR instrument
#
@ -186,8 +185,8 @@ Motor COX SIM -100. 100. .1 2. # counter x
ClientPut "Motors initialized"
#======================== histogram memory
#MakeHM hm SinqHM
MakeHM hm SIM
MakeHM hm SinqHM
#MakeHM hm SIM
hm configure OverFlowMode Ceil
hm configure HistMode PSD
hm configure Rank 1

View File

@ -1,3 +1,3 @@
239
245
NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n

View File

@ -1021,7 +1021,7 @@ extern int close(int fp);
/* initialize the Request data */
Req_buff.bigend = htonl (0x12345678);
Req_buff.cmnd = htonl (SQHM_READ);
Req_buff.u.read.n_bins = htonl (iEnd);
Req_buff.u.read.n_bins = htonl (iEnd-iStart);
Req_buff.u.read.first_bin = htonl (iStart);
Req_buff.u.read.hist_no = htonl (iNum);

View File

@ -394,10 +394,9 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
{
if( (iDim[1] % i) == 0)
{
if(i*chunkSize*sizeof(HistInt) > TOFBLOCK)
if(i*chunkSize*sizeof(HistInt) < TOFBLOCK)
{
iChunk[1] = i;
break;
}
}
}
@ -422,7 +421,8 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
{
memset(lData,0,chunkSize*sizeof(HistInt));
GetHistogramDirect(pHM,pCon,
0,i*chunkSize,chunkSize,lData,chunkSize*sizeof(HistInt));
0,i*chunkSize,(i+1)*chunkSize,lData,
chunkSize*sizeof(HistInt));
/*
yield a little in order to allow other clients to receive a
response. Also allow for interrupting.
@ -639,7 +639,8 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
else
{
memset(lData,0,MAXSINGLE*iDim[2]*sizeof(HistInt));
GetHistogramDirect(pHM,pCon,0,iLength,MAXSINGLE*iDim[2],
GetHistogramDirect(pHM,pCon,0,iLength,
iLength + MAXSINGLE*iDim[2],
lData, MAXSINGLE*iDim[2]*sizeof(HistInt));
NXDputalias(hfil,hdict,"singleup",lData);
NXDaliaslink(hfil,hdict,"singledana","singleup");

View File

@ -166,6 +166,8 @@
#ifdef MV2600
#include "../config/mv2604/config.h"
#elif MEN_A012
#include "../config/men_824x_ali/config.h"
#else
#if (CPU == PPC603)
#include "../config/mv1603/config.h"
@ -189,6 +191,7 @@
*/
#include "SinqHM_def.h"
#define MAX_ACTIONS 8
#define MAX_ARGS 10
#define NIL '\0'
@ -1116,8 +1119,13 @@
taskDelay (1 * sysClkRateGet ()); /* Give lwl_server time to get going */
return True;
}
/*
**--------------------------------------------------------------------------*/
#ifdef MEN_A012
extern int Hist_base_MEN_alloc;
#endif
int sbpc_spawnSinqHM (
/* ================
*/ int spnd_flg, /* Suspend flag (arg10) */
@ -1169,6 +1177,13 @@
return False;
}
}
#ifdef MEN_A012
/*
make sure that the memory allocation flag is properly initialized at
the first time
*/
Hist_base_MEN_alloc = 0;
#endif
printf ("Spawning SinqHM_srv ..\n TCP/IP port = %d.\n", port);
if (use_level_gen == 0) {

View File

@ -39,6 +39,15 @@
** by Hist_base_addr.
*/
void *Hist_base_addr;
/*
** The MEN board has a divided memory architecture: below 32 MB everything
** is normal. The area above has to be allocated in a separate memory
** partition with the partition number stored in sysHighMemPart. This
** now is a flag which determines if Hist_base_addr has been allocated in
** such a way in order to be able to free it properly again.
**/
int Hist_base_MEN_alloc;
/*
** The buffer for holding a frame of data for CERCA type
** interfaces (e.g. HRPT) is pointed to by Frame_base_addr.

View File

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

View File

@ -50,6 +50,13 @@
#include <hostLib.h>
#include <inetLib.h>
#include <sysLib.h>
#ifdef MEN_A012
/*
#include <MEN/men_typs.h>
#include <sysLib_men.h>
*/
extern PART_ID sysHighMemPart;
#endif
#include <tickLib.h>
#include <stdlib.h>
@ -63,6 +70,8 @@
#include <unistd.h>
#include <setjmp.h>
#include <vme.h>
/*
**==================== Global Definitions =====================================
*/
@ -1588,12 +1597,20 @@
if (n_extra_bytes != 0) free (my_rqst);
#ifdef MEN_A012
Hist_base_addr = NULL;
printf("Calling memPartAlloc with %d, %d\n",
(int)sysHighMemPart, Total_bytes);
Hist_base_addr = memPartAlloc(sysHighMemPart,Total_bytes);
Hist_base_MEN_alloc = 1;
#else
i = memFindMax (); /* Get size of biggest free memory block */
if (i > Total_bytes) {
Hist_base_addr = calloc (Total_bytes, sizeof (char));
}else {
Hist_base_addr = NULL;
}
#endif
printf("Successfully allocated %d bytes\n", Total_bytes);
if (Hist_base_addr == NULL) {
printf ("\007do_SQHM__PSD_alloc:\n"
@ -3071,7 +3088,16 @@
/*
** Release any allocated histogram buffer
*/
free (Hist_base_addr);
#ifdef MEN_A012
if(Hist_base_MEN_alloc == 1){
memPartFree(sysHighMemPart, Hist_base_addr);
} else {
free (Hist_base_addr);
}
Hist_base_MEN_alloc = 0;
#else
free(Hist_base_addr);
#endif
Hist_base_addr = NULL;
free (Frame_base_addr);
Frame_base_addr = NULL;

View File

@ -45,6 +45,7 @@ alias ccvx 'ccppc ' \
' -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/config/men_824x_ali ' \
' -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 '\

View File

@ -745,7 +745,7 @@ pCon);
pInternal = self->pPriv;
/* we do not need to do a lot of copying when datasizes match! */
iByte = iEnd * self->iBinWidth;
iByte = (iEnd - iStart) * self->iBinWidth;
if(self->iBinWidth == sizeof(HistInt))
{
/* read HM */