- updated simulation
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
#
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Initialization script for a simulated AMOR instrument
|
# Initialization script for a simulated AMOR instrument
|
||||||
#
|
#
|
||||||
@ -186,8 +185,8 @@ Motor COX SIM -100. 100. .1 2. # counter x
|
|||||||
ClientPut "Motors initialized"
|
ClientPut "Motors initialized"
|
||||||
|
|
||||||
#======================== histogram memory
|
#======================== histogram memory
|
||||||
#MakeHM hm SinqHM
|
MakeHM hm SinqHM
|
||||||
MakeHM hm SIM
|
#MakeHM hm SIM
|
||||||
hm configure OverFlowMode Ceil
|
hm configure OverFlowMode Ceil
|
||||||
hm configure HistMode PSD
|
hm configure HistMode PSD
|
||||||
hm configure Rank 1
|
hm configure Rank 1
|
||||||
|
2
danu.dat
2
danu.dat
@ -1,3 +1,3 @@
|
|||||||
239
|
245
|
||||||
NEVER, EVER modify or delete this file
|
NEVER, EVER modify or delete this file
|
||||||
You'll risk eternal damnation and a reincarnation as a cockroach!|n
|
You'll risk eternal damnation and a reincarnation as a cockroach!|n
|
@ -1021,7 +1021,7 @@ extern int close(int fp);
|
|||||||
/* initialize the Request data */
|
/* initialize the Request data */
|
||||||
Req_buff.bigend = htonl (0x12345678);
|
Req_buff.bigend = htonl (0x12345678);
|
||||||
Req_buff.cmnd = htonl (SQHM_READ);
|
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.first_bin = htonl (iStart);
|
||||||
Req_buff.u.read.hist_no = htonl (iNum);
|
Req_buff.u.read.hist_no = htonl (iNum);
|
||||||
|
|
||||||
|
9
nxamor.c
9
nxamor.c
@ -394,10 +394,9 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
|
|||||||
{
|
{
|
||||||
if( (iDim[1] % i) == 0)
|
if( (iDim[1] % i) == 0)
|
||||||
{
|
{
|
||||||
if(i*chunkSize*sizeof(HistInt) > TOFBLOCK)
|
if(i*chunkSize*sizeof(HistInt) < TOFBLOCK)
|
||||||
{
|
{
|
||||||
iChunk[1] = i;
|
iChunk[1] = i;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,7 +421,8 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
|
|||||||
{
|
{
|
||||||
memset(lData,0,chunkSize*sizeof(HistInt));
|
memset(lData,0,chunkSize*sizeof(HistInt));
|
||||||
GetHistogramDirect(pHM,pCon,
|
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
|
yield a little in order to allow other clients to receive a
|
||||||
response. Also allow for interrupting.
|
response. Also allow for interrupting.
|
||||||
@ -639,7 +639,8 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(lData,0,MAXSINGLE*iDim[2]*sizeof(HistInt));
|
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));
|
lData, MAXSINGLE*iDim[2]*sizeof(HistInt));
|
||||||
NXDputalias(hfil,hdict,"singleup",lData);
|
NXDputalias(hfil,hdict,"singleup",lData);
|
||||||
NXDaliaslink(hfil,hdict,"singledana","singleup");
|
NXDaliaslink(hfil,hdict,"singledana","singleup");
|
||||||
|
@ -166,6 +166,8 @@
|
|||||||
|
|
||||||
#ifdef MV2600
|
#ifdef MV2600
|
||||||
#include "../config/mv2604/config.h"
|
#include "../config/mv2604/config.h"
|
||||||
|
#elif MEN_A012
|
||||||
|
#include "../config/men_824x_ali/config.h"
|
||||||
#else
|
#else
|
||||||
#if (CPU == PPC603)
|
#if (CPU == PPC603)
|
||||||
#include "../config/mv1603/config.h"
|
#include "../config/mv1603/config.h"
|
||||||
@ -189,6 +191,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "SinqHM_def.h"
|
#include "SinqHM_def.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_ACTIONS 8
|
#define MAX_ACTIONS 8
|
||||||
#define MAX_ARGS 10
|
#define MAX_ARGS 10
|
||||||
#define NIL '\0'
|
#define NIL '\0'
|
||||||
@ -1116,8 +1119,13 @@
|
|||||||
taskDelay (1 * sysClkRateGet ()); /* Give lwl_server time to get going */
|
taskDelay (1 * sysClkRateGet ()); /* Give lwl_server time to get going */
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**--------------------------------------------------------------------------*/
|
**--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef MEN_A012
|
||||||
|
extern int Hist_base_MEN_alloc;
|
||||||
|
#endif
|
||||||
int sbpc_spawnSinqHM (
|
int sbpc_spawnSinqHM (
|
||||||
/* ================
|
/* ================
|
||||||
*/ int spnd_flg, /* Suspend flag (arg10) */
|
*/ int spnd_flg, /* Suspend flag (arg10) */
|
||||||
@ -1169,6 +1177,13 @@
|
|||||||
return False;
|
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);
|
printf ("Spawning SinqHM_srv ..\n TCP/IP port = %d.\n", port);
|
||||||
if (use_level_gen == 0) {
|
if (use_level_gen == 0) {
|
||||||
|
@ -39,6 +39,15 @@
|
|||||||
** by Hist_base_addr.
|
** by Hist_base_addr.
|
||||||
*/
|
*/
|
||||||
void *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
|
** The buffer for holding a frame of data for CERCA type
|
||||||
** interfaces (e.g. HRPT) is pointed to by Frame_base_addr.
|
** interfaces (e.g. HRPT) is pointed to by Frame_base_addr.
|
||||||
|
@ -151,7 +151,7 @@
|
|||||||
|
|
||||||
Dbg_mask = 0;
|
Dbg_mask = 0;
|
||||||
Dbg_lev0 = 0;
|
Dbg_lev0 = 0;
|
||||||
Dbg_lev1 = 1;
|
Dbg_lev1 = 0;
|
||||||
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. */
|
||||||
|
@ -50,6 +50,13 @@
|
|||||||
#include <hostLib.h>
|
#include <hostLib.h>
|
||||||
#include <inetLib.h>
|
#include <inetLib.h>
|
||||||
#include <sysLib.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 <tickLib.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -63,6 +70,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <vme.h>
|
#include <vme.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**==================== Global Definitions =====================================
|
**==================== Global Definitions =====================================
|
||||||
*/
|
*/
|
||||||
@ -1588,12 +1597,20 @@
|
|||||||
|
|
||||||
if (n_extra_bytes != 0) free (my_rqst);
|
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 */
|
i = memFindMax (); /* Get size of biggest free memory block */
|
||||||
if (i > Total_bytes) {
|
if (i > Total_bytes) {
|
||||||
Hist_base_addr = calloc (Total_bytes, sizeof (char));
|
Hist_base_addr = calloc (Total_bytes, sizeof (char));
|
||||||
}else {
|
}else {
|
||||||
Hist_base_addr = NULL;
|
Hist_base_addr = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
printf("Successfully allocated %d bytes\n", Total_bytes);
|
printf("Successfully allocated %d bytes\n", Total_bytes);
|
||||||
if (Hist_base_addr == NULL) {
|
if (Hist_base_addr == NULL) {
|
||||||
printf ("\007do_SQHM__PSD_alloc:\n"
|
printf ("\007do_SQHM__PSD_alloc:\n"
|
||||||
@ -3071,7 +3088,16 @@
|
|||||||
/*
|
/*
|
||||||
** Release any allocated histogram buffer
|
** Release any allocated histogram buffer
|
||||||
*/
|
*/
|
||||||
|
#ifdef MEN_A012
|
||||||
|
if(Hist_base_MEN_alloc == 1){
|
||||||
|
memPartFree(sysHighMemPart, Hist_base_addr);
|
||||||
|
} else {
|
||||||
free (Hist_base_addr);
|
free (Hist_base_addr);
|
||||||
|
}
|
||||||
|
Hist_base_MEN_alloc = 0;
|
||||||
|
#else
|
||||||
|
free(Hist_base_addr);
|
||||||
|
#endif
|
||||||
Hist_base_addr = NULL;
|
Hist_base_addr = NULL;
|
||||||
free (Frame_base_addr);
|
free (Frame_base_addr);
|
||||||
Frame_base_addr = NULL;
|
Frame_base_addr = NULL;
|
||||||
|
@ -45,6 +45,7 @@ alias ccvx 'ccppc ' \
|
|||||||
' -fno-for-scope -Wall -I/h -I$MEN/VXWORKS/INCLUDE/NATIVE '\
|
' -fno-for-scope -Wall -I/h -I$MEN/VXWORKS/INCLUDE/NATIVE '\
|
||||||
' -I$MEN/VXWORKS/INCLUDE/COM -I$MEN/VXWORKS -I. '\
|
' -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/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/h '\
|
||||||
' -I/home/pss123/aco/sinqhm/wind2/2.0.2/target/src/config '\
|
' -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 '\
|
' -I/home/pss123/aco/sinqhm/wind2/2.0.2/target/src/drv -DCPU=PPC603 '\
|
||||||
|
@ -745,7 +745,7 @@ pCon);
|
|||||||
pInternal = self->pPriv;
|
pInternal = self->pPriv;
|
||||||
|
|
||||||
/* we do not need to do a lot of copying when datasizes match! */
|
/* 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))
|
if(self->iBinWidth == sizeof(HistInt))
|
||||||
{
|
{
|
||||||
/* read HM */
|
/* read HM */
|
||||||
|
Reference in New Issue
Block a user