mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
merged Ians section of the code and added a few functionalities
This commit is contained in:
parent
de319249cd
commit
0ee11cffb3
@ -18,6 +18,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "Beb.h"
|
#include "Beb.h"
|
||||||
|
#include "slsDetectorServer_defs.h" //include port number
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ int main(int argc, char* argv[]){
|
|||||||
|
|
||||||
// unsigned short int port_number = atoi(argv[1]);
|
// unsigned short int port_number = atoi(argv[1]);
|
||||||
|
|
||||||
unsigned short int port_number = 43212;
|
unsigned short int port_number = BEB_PORT;
|
||||||
if(!SetupListenSocket(port_number)) return 1;
|
if(!SetupListenSocket(port_number)) return 1;
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "slsDetectorServer_defs.h" //include port number
|
||||||
|
|
||||||
struct sockaddr_in eiger_socket_addr;
|
struct sockaddr_in eiger_socket_addr;
|
||||||
int eiger_max_message_length = 1024;
|
int eiger_max_message_length = 1024;
|
||||||
@ -32,8 +32,8 @@ float eiger_exposureperiod = 1;
|
|||||||
float EigerGetExposurePeriod(){return eiger_exposureperiod;}
|
float EigerGetExposurePeriod(){return eiger_exposureperiod;}
|
||||||
unsigned int eigerdynamicrange = 16;
|
unsigned int eigerdynamicrange = 16;
|
||||||
unsigned int EigerGetDynamicRange(){return eigerdynamicrange;}
|
unsigned int EigerGetDynamicRange(){return eigerdynamicrange;}
|
||||||
unsigned int eigergetphotonenergy = 8000;
|
int eigergetphotonenergy = 8000;
|
||||||
unsigned int EigerGetPhotonEnergy(){return eigergetphotonenergy;}
|
int EigerGetPhotonEnergy(){return eigergetphotonenergy;}
|
||||||
/* for later */
|
/* for later */
|
||||||
int eigernumberofexposureseries = 1;
|
int eigernumberofexposureseries = 1;
|
||||||
int EigerGetNumberOfExposureSeries(){return eigernumberofexposureseries;}
|
int EigerGetNumberOfExposureSeries(){return eigernumberofexposureseries;}
|
||||||
@ -47,12 +47,11 @@ int EigerInit(){
|
|||||||
if(!passed){
|
if(!passed){
|
||||||
struct hostent *dst_host;
|
struct hostent *dst_host;
|
||||||
if((dst_host = gethostbyname("localhost")) == NULL){ //or look into getaddrinfo(3)
|
if((dst_host = gethostbyname("localhost")) == NULL){ //or look into getaddrinfo(3)
|
||||||
/*if((dst_host = gethostbyname("beb026")) == NULL){ //or look into getaddrinfo(3)*/
|
|
||||||
fprintf(stderr,"ERROR, no such host\n");
|
fprintf(stderr,"ERROR, no such host\n");
|
||||||
return 0;
|
return 0;
|
||||||
}else{
|
}else{
|
||||||
//struct sockaddr_in eiger_socket_addr;
|
//struct sockaddr_in eiger_socket_addr;
|
||||||
int port = 43210;
|
int port = FEB_PORT;
|
||||||
bzero((char *) &eiger_socket_addr, sizeof(eiger_socket_addr));
|
bzero((char *) &eiger_socket_addr, sizeof(eiger_socket_addr));
|
||||||
eiger_socket_addr.sin_family = AF_INET;
|
eiger_socket_addr.sin_family = AF_INET;
|
||||||
bcopy((char *)dst_host->h_addr,(char *)&eiger_socket_addr.sin_addr.s_addr,dst_host->h_length);
|
bcopy((char *)dst_host->h_addr,(char *)&eiger_socket_addr.sin_addr.s_addr,dst_host->h_length);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "FebControl.h"
|
#include "FebControl.h"
|
||||||
|
#include "slsDetectorServer_defs.h" //include port number
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ int main(int argc, char* argv[]){
|
|||||||
|
|
||||||
FebControl *feb_controler = new FebControl();
|
FebControl *feb_controler = new FebControl();
|
||||||
|
|
||||||
unsigned short int port_number = 43210;
|
unsigned short int port_number = FEB_PORT;
|
||||||
if(!SetupListenSocket(port_number)) return 1;
|
if(!SetupListenSocket(port_number)) return 1;
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,22 +7,32 @@ PROGS = eigerDetectorServer
|
|||||||
DESTDIR ?= bin
|
DESTDIR ?= bin
|
||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
|
|
||||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
||||||
#SRC_CLNT2 = Eiger.cxx HardwareIO.cxx LocalLinkInterface.cxx Feb.cxx
|
SRC_CLNT2 = FebServer.cxx FebControl.cxx FebInterface.cxx LocalLinkInterface.cxx HardwareIO.cxx
|
||||||
|
SRC_CLNT3 = BebServer.cxx Beb.cxx LocalLinkInterface.cxx HardwareIO.cxx
|
||||||
|
|
||||||
OBJS = $(SRC_CLNT:.c=.o)
|
OBJS = $(SRC_CLNT:.c=.o)
|
||||||
OBJS2 = $(SRC_CLNT2:.cpp=.o)
|
|
||||||
|
|
||||||
|
|
||||||
all: clean $(PROGS)
|
all: clean $(PROGS) feb_debug beb_debug
|
||||||
|
|
||||||
|
|
||||||
boot: $(OBJS) $(OBJS2)
|
boot: $(OBJS)
|
||||||
|
|
||||||
$(PROGS):
|
$(PROGS):
|
||||||
echo $(OBJS) $(OBJS2)
|
echo $(OBJS)
|
||||||
mkdir -p $(DESTDIR)
|
mkdir -p $(DESTDIR)
|
||||||
$(CC) -o $@ $(SRC_CLNT) $(CFLAGS) $(LDLIBS)
|
$(CC) -o $@ $(SRC_CLNT) $(CFLAGS) $(LDLIBS)
|
||||||
mv $(PROGS) $(DESTDIR)
|
mv $(PROGS) $(DESTDIR)
|
||||||
|
|
||||||
|
feb_debug:$(SRC_CLNT2)
|
||||||
|
$(CCX) -o feb_debug $(SRC_CLNT2) -I.
|
||||||
|
mv feb_debug $(DESTDIR)
|
||||||
|
|
||||||
|
beb_debug:$(SRC_CLNT3)
|
||||||
|
$(CCX) -o beb_debug $(SRC_CLNT3) -I.
|
||||||
|
mv beb_debug $(DESTDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(DESTDIR)/$(PROGS) *.o
|
rm -rf $(DESTDIR)/$(PROGS) *.o
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS += -Wall -DDACS_INT -DEIGERD -DDACS_INT -DSTOP_SERVER -DPCCOMPILE#-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
CFLAGS += -Wall -DDACS_INT -DEIGERD -DDACS_INT -DPCCOMPILE -DSLS_DETECTOR_FUNCTION_LIST #-DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
||||||
LDLIBS += -lm -lstdc++
|
LDLIBS += -lm -lstdc++
|
||||||
|
|
||||||
PROGS = eigerDetectorServerVirtual
|
PROGS = eigerDetectorServerVirtual
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -9,14 +9,13 @@
|
|||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
#include "svnInfoEiger.h"
|
#include "svnInfoEiger.h"
|
||||||
#include "EigerHighLevelFunctions.c"
|
#include "EigerHighLevelFunctions.c"
|
||||||
|
#include "EigerBackEndFunctions.c"
|
||||||
|
|
||||||
enum detectorSettings thisSettings = STANDARD;
|
enum detectorSettings thisSettings = STANDARD;
|
||||||
//static const string dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vcmp_lr","Cal","Vcmp_rl","Vcmp_rr","Rxb_rb","Rxb_lb","Vcp","Vcn","Vis"};
|
//static const string dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vcmp_lr","Cal","Vcmp_rl","Vcmp_rr","Rxb_rb","Rxb_lb","Vcp","Vcn","Vis"};
|
||||||
|
|
||||||
|
|
||||||
int initDetector(){
|
int initDetector(){
|
||||||
printf("EIGER 10\n");
|
printf("EIGER Server\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,10 +249,11 @@ enum runStatus getRunStatus(){
|
|||||||
|
|
||||||
|
|
||||||
char *readFrame(int *ret, char *mess){
|
char *readFrame(int *ret, char *mess){
|
||||||
//template fifo_read_event() from firmware_funcs.c
|
EigerStartAcquisition(); /**polling should be done inside feb server */
|
||||||
//checks if state machine running and if fifo has data(look_at_me_reg) and accordingly reads frame
|
RequestImages();
|
||||||
// memcpy(now_ptr, values, dataBytes);
|
while(EigerRunStatus())
|
||||||
//returns ptr to values
|
usleep(50000);
|
||||||
|
*ret = (int)FINISHED;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,10 +317,17 @@ int64_t getTimeLeft(enum timerIndex ind){
|
|||||||
|
|
||||||
|
|
||||||
int setDynamicRange(int dr){
|
int setDynamicRange(int dr){
|
||||||
|
int r;
|
||||||
if(dr > 0){
|
if(dr > 0){
|
||||||
printf(" Setting dynamic range: %d\n",dr);
|
printf(" Setting dynamic range: %d\n",dr);
|
||||||
EigerSetDynamicRange(dr);
|
EigerSetDynamicRange(dr);
|
||||||
}return EigerGetDynamicRange();
|
EigerSetBitMode(dr);
|
||||||
|
}
|
||||||
|
//make sure back end and front end have the same bit mode
|
||||||
|
r= EigerGetDynamicRange();
|
||||||
|
if(r != EigerGetBitMode())
|
||||||
|
EigerSetBitMode(r);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -360,6 +367,8 @@ int executeTrimming(enum trimMode mode, int par1, int par2, int imod){
|
|||||||
|
|
||||||
|
|
||||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int ival){
|
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int ival){
|
||||||
|
EigerSetupTableEntryLeft(ipad, macad, detectormacadd, detipad, udpport);
|
||||||
|
EigerSetupTableEntryRight(ipad, macad, detectormacadd, detipad, udpport);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,10 +8,12 @@
|
|||||||
#ifndef SLSDETECTORSERVER_DEFS_H_
|
#ifndef SLSDETECTORSERVER_DEFS_H_
|
||||||
#define SLSDETECTORSERVER_DEFS_H_
|
#define SLSDETECTORSERVER_DEFS_H_
|
||||||
|
|
||||||
#include "sls_detector_defs.h"
|
//#include "sls_detector_defs.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define GOODBYE -200
|
#define GOODBYE -200
|
||||||
|
#define FEB_PORT 43210
|
||||||
|
#define BEB_PORT 43212
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2307,6 +2307,8 @@ int read_frame(int file_des) {
|
|||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
dataretval=readFrame(&dataret, mess);
|
dataretval=readFrame(&dataret, mess);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//dataret could be swapped during sendData
|
//dataret could be swapped during sendData
|
||||||
dataret1 = dataret;
|
dataret1 = dataret;
|
||||||
sendData(file_des,&dataret1,sizeof(dataret),INT32);
|
sendData(file_des,&dataret1,sizeof(dataret),INT32);
|
||||||
@ -2535,8 +2537,17 @@ int set_dynamic_range(int file_des) {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||||
} else {
|
} else {
|
||||||
retval=setDynamicRange(dr);
|
#ifdef EIGERD
|
||||||
|
switch(dr){
|
||||||
|
case -1:case 4: case 8: case 16:case 32:break;
|
||||||
|
default:
|
||||||
|
strcpy(mess,"could not set dynamic range. Must be 4,8,16 or 32.\n");
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
if(ret == OK)
|
||||||
|
retval=setDynamicRange(dr);
|
||||||
#endif
|
#endif
|
||||||
if (dr>=0 && retval!=dr)
|
if (dr>=0 && retval!=dr)
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -2961,6 +2972,7 @@ int configure_mac(int file_des) {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Configuring MAC of module %d at port %x\n", imod, udpport);
|
printf("Configuring MAC of module %d at port %x\n", imod, udpport);
|
||||||
#endif
|
#endif
|
||||||
|
printf("ret:%d\n",ret);
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
if(getRunStatus() == RUNNING)
|
if(getRunStatus() == RUNNING)
|
||||||
@ -2971,7 +2983,7 @@ int configure_mac(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Configured MAC with retval %d\n", retval);
|
printf("Configured MAC with retval %d\n", retval);
|
||||||
#endif
|
#endif
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
printf("configuring MAC of mod %d failed\n", imod);
|
printf("configuring MAC of mod %d failed\n", imod);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user