corrected enums, typecasted mallocs, changed eiger server to compile only in c++

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@665 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-09-13 07:02:15 +00:00
parent 99b0ea47b0
commit 2218a2e7e5
6 changed files with 80 additions and 71 deletions

View File

@ -8,7 +8,7 @@
#ifndef EIGER_H
#define EIGER_H
#include <string.h>
#include <string>
#include <vector>
#include "Feb.h"

View File

@ -1,28 +1,30 @@
CC = powerpc-4xx-softfloat-gcc
CCX = powerpc-4xx-softfloat-g++
CLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL
LDLIBS += -lm -lstdc++
PROGS = eigerDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRC_CLNT = slsDetectorServer.c slsDetectorServer_funcs.c communication_funcs.c slsDetectorFunctionList.c
OBJS = $(SRC_CLNT:.cpp=.o)
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
SRC_CLNT2 = Eiger.cxx HardwareIO.cxx LocalLinkInterface.cxx Feb.cxx
OBJS = $(SRC_CLNT:.c=.o)
OBJS2 = $(SRC_CLNT2:.cpp=.o)
all: clean $(PROGS)
boot: $(OBJS)
boot: $(OBJS) $(OBJS2)
$(PROGS):
echo $(OBJS)
echo $(OBJS) $(OBJS2)
mkdir -p $(DESTDIR)
# $(CC) $(SRC_CLNT) $(CLAGS) $(LDLIBS) -o $@
$(CC) -c $(SRC_CLNT) $(CLAGS) $(LDLIBS)
$(CCX) -o $@ slsDetectorServer.o slsDetectorServer_funcs.o communication_funcs.o slsDetectorFunctionList.o
$(CCX) -o $@ $(SRC_CLNT) $(SRC_CLNT2) $(CFLAGS) $(LDLIBS)
# $(CCX) -c $(SRC_CLNT) $(CLAGS) $(LDLIBS)
# $(CCX) -o $@ slsDetectorServer.o slsDetectorServer_funcs.o communication_funcs.o slsDetectorFunctionList.o
mv $(PROGS) $(DESTDIR)
clean:

View File

@ -1,6 +1,7 @@
#ifdef SLS_DETECTOR_FUNCTION_LIST
#include "slsDetectorFunctionList.h"
#include "Eiger.h"
#include "svnInfoEiger.h"
#include <stdio.h>
@ -45,12 +46,12 @@ const char* dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vc
//temporary storage on server for debugging until Ian implements
int dacvalues[NDAC];
int framenum=0;
int trains=0;
int exposureTime=1e6;
int period=1e9;
int delay=0;
int gates=0;
int64_t framenum=0;
int64_t trains=0;
int64_t exposureTime=(int64_t)1e6;
int64_t period=(int64_t)1e9;
int64_t delay=0;
int64_t gates=0;
/** temporary
u_int32_t CSP0BASE;
@ -99,11 +100,11 @@ int initializeDetectorStructure(){
#ifdef VERBOSE
printf("Board is for %d modules\n",n);
#endif
detectorModules=malloc(n*sizeof(sls_detector_module));
detectorChips=malloc(n*NCHIP*sizeof(int));
detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int));
detectorDacs=malloc(n*NDAC*sizeof(int));
detectorAdcs=malloc(n*NADC*sizeof(int));
detectorModules=(sls_detector_module*)malloc(n*sizeof(sls_detector_module));
detectorChips=(int*)malloc(n*NCHIP*sizeof(int));
detectorChans=(int*)malloc(n*NCHIP*NCHAN*sizeof(int));
detectorDacs=(dacs_t*)malloc(n*NDAC*sizeof(int));
detectorAdcs=(dacs_t*)malloc(n*NADC*sizeof(int));
#ifdef VERBOSE
printf("modules from 0x%x to 0x%x\n",(unsigned int)(detectorModules), (unsigned int)(detectorModules+n));
printf("chips from 0x%x to 0x%x\n",(unsigned int)(detectorChips), (unsigned int)(detectorChips+n*NCHIP));
@ -311,9 +312,9 @@ int setModule(sls_detector_module myMod){
int i;
for(i=0;i<myMod.ndac;i++)
setDAC(i,myMod.dacs[i],myMod.module);
setDAC((detDacIndex)i,myMod.dacs[i],myMod.module);
thisSettings = myMod.reg;
thisSettings = (detectorSettings)myMod.reg;
return OK;
@ -343,7 +344,7 @@ int setThresholdEnergy(int thr, int imod){
enum detDacIndex setSettings(enum detDacIndex sett, int imod){
enum detectorSettings setSettings(enum detectorSettings sett, int imod){
//template setSettings() from mcb_funcs.c
//reads the dac registers from fpga to confirm which settings, if weird, undefined
@ -453,7 +454,7 @@ int setDynamicRange(int dr){
enum readOutFlags setReadOutFlags(enum readOutFlags val){
//template setStoreInRAM from firmware_funcs.c
return -1;
return GET_READOUT_FLAGS;
}
@ -508,7 +509,7 @@ int getNumberOfADCsPerModule(){return NADC;}
enum externalSignalFlag getExtSignal(int signalindex){
//template getExtSignal from firmware_funcs.c
//return signals[signalindex];
return -1;
return GET_EXTERNAL_SIGNAL_FLAG;
}
@ -576,7 +577,7 @@ enum externalCommunicationMode setTiming( enum externalCommunicationMode arg){
//if( flag=SIGNAL_OFF and signals[signalindex]==MASTER_SLAVE_SYNCHRONIZATION), return -1, (ensures masterslaveflag !=off now)
//else return flag
int ret=GET_EXTERNAL_COMMUNICATION_MODE;
enum externalCommunicationMode ret=GET_EXTERNAL_COMMUNICATION_MODE;
//sets timingmode variable
//ensures that the signals are in acceptance with timing mode and according sets the timing mode
/*