detector servers moved out of slsdetector software, eiger server compiles with new headers

This commit is contained in:
2018-10-11 14:20:50 +02:00
parent c24a9b223c
commit 0ee7f67965
192 changed files with 56 additions and 44 deletions

View File

@@ -0,0 +1 @@
AXIS_BUILDTYPE ?= cris-axis-linux-gnu

View File

@@ -0,0 +1 @@
../slsDetectorServer/AD9257.h

View File

@@ -0,0 +1,46 @@
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DGOTTHARDD -DDEBUG # -DVERBOSE #-DVERYVERBOSE #-DVIRTUAL
PROGS= gotthardDetectorServer
INSTDIR= /tftpboot
INSTMODE= 0777
BINS = testlib_sharedlibc
SRCS = server.c firmware_funcs.c server_funcs.c communication_funcs.c
OBJS = $(SRCS:%.c=%.o)
all: clean versioning $(PROGS)
boot: $(OBJS)
versioning:
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
$(PROGS): $(OBJS)
# echo $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
rm gotthardDetectorServer.gdb
install: $(PROGS)
$(INSTALL) -d $(INSTDIR)
$(INSTALL) -m $(INSTMODE) $(PROGS) $(INSTDIR)
romfs:
$(ROMFSINST) /bin/$(PROGS)
clean:
rm -rf $(PROGS) *.o *.gdb

View File

@@ -0,0 +1,30 @@
DESTDIR ?= ./
CC = gcc
CFLAGS += -Wall -DGOTTHARDD -DVIRTUAL
PROGS= $(DESTDIR)/gotthardDetectorServer_virtual
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c
OBJS = $(SRCS:%.c=%.o)
gotthardVirtualServer = $(PROGS)
all: clean $(PROGS)
$(PROGS): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
clean:
rm -rf $(PROGS) *.o *.gdb

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/ansi.h

View File

@@ -0,0 +1 @@
../slsDetectorServer/commonServerFunctions.h

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/communication_funcs.c

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/communication_funcs.h

View File

@@ -0,0 +1,23 @@
#masterflags (no_master, is_master, is_slave)
masterflags no_master
#master default delay
masterdefaultdelay 70
#patternphase
patternphase 0
#adcphase
adcphase 0
#slave pattern phase
slavepatternphase 0
#slave adc phase
slaveadcphase 0
#rst to sw1 delay
rsttosw1delay 2
#start acquisition delay
startacqdelay 1

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,120 @@
#ifndef FIRMWARE_FUNCS_H
#define FIRMWARE_FUNCS_H
#include "sls_detector_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
int mapCSP0(void);
u_int16_t bus_r16(u_int32_t offset);
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
u_int32_t bus_w(u_int32_t offset, u_int32_t data);
u_int32_t bus_r(u_int32_t offset);
int initDetector();
int setDefaultDacs();
void setMasterSlaveConfiguration();
int configureADC();
int setPhaseShiftOnce();
int setPhaseShift(int numphaseshift);
int cleanFifo();
int setDAQRegister();
u_int32_t putout(char *s);
int setConfigurationRegister(int d);
int sendviaUDP(int d);
int setDACRegister(int idac, int val);
u_int32_t setExtSignal(enum externalSignalFlag mode);
int getExtSignal();
u_int32_t setFPGASignal(enum externalSignalFlag mode);
int getFPGASignal();
int setTiming(int t);
u_int64_t getDetectorNumber();
u_int32_t getFirmwareVersion();
u_int32_t getFirmwareSVNVersion();
u_int32_t testFpga(void);
int testBus(void);
int initHighVoltage(int val);
int getTemperature(int tempSensor);
int setSettings(int i);
int initConfGain(int isettings,int val);
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
int setADC(int adc);
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int ival, int udpport);
int getAdcConfigured();
int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
int64_t get64BitReg(int aLSB, int aMSB);
int64_t setFrames(int64_t value);
int64_t getFrames();
int64_t setExposureTime(int64_t value);
int64_t getExposureTime();
int64_t setGates(int64_t value);
int64_t getGates();
int64_t setPeriod(int64_t value);
int64_t getPeriod();
int64_t setDelay(int64_t value);
int64_t getDelay();
int64_t setTrains(int64_t value);
int64_t getTrains();
int64_t getActualTime();
int64_t getMeasurementTime();
u_int32_t fifoReadStatus();
u_int32_t fifo_full(void);
u_int32_t runBusy(void);
u_int32_t runState(void);
int startStateMachine();
int stopStateMachine();
int startReadOut();
void waitForAcquisitionFinish();
int getStatus();
int loadImage(int index, short int ImageVals[]);
int readCounterBlock(int startACQ, short int CounterVals[]);
int resetCounterBlock(int startACQ);
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
int setDAC(int ind,int val,int mV, int retval[]);
int getDAC(int ind);
int setModule(sls_detector_module);
void getModule(sls_detector_module*);
void initDACs(int* v);
void initDAC(int dac_addr, int value);
void clearDACSregister();
void nextDAC();
void program_one_dac(int addr, int value);
#endif

View File

@@ -0,0 +1,9 @@
Path: slsDetectorPackage/slsDetectorSoftware/slsDetectorServers/gotthardDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 923a7e8936cbfe32a8781554de32c66be2f78035
Revision: 2
Branch: refactor
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4068
Last Changed Date: 2018-10-09 09:15:04.000000002 +0200 ./firmware_funcs.c

View File

@@ -0,0 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "923a7e8936cbfe32a8781554de32c66be2f78035"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4068
#define GITDATE 0x20181009
#define GITBRANCH "refactor"

View File

@@ -0,0 +1,6 @@
#define GITURL ""
#define GITREPUUID ""
#define GITAUTH ""
#define GITREV ""
#define GITDATE ""
#define GITBRANCH ""

View File

@@ -0,0 +1,315 @@
#ifndef REGISTERS_G_H
#define REGISTERS_G_H
#include "sls_detector_defs.h"
/* Definitions for FPGA*/
#define CSP0 0x20200000
#define MEM_SIZE 0x100000
/* values defined for FPGA */
#define MCSNUM 0x0
#define FIXED_PATT_VAL 0xacdc1980
#define FPGA_INIT_PAT 0x60008
#define FPGA_INIT_ADDR 0xb0000000
/* registers defined in FPGA */
#define PCB_REV_REG 0x2c<<11
#define GAIN_REG 0x10<<11
//#define FLOW_CONTROL_REG 0x11<<11
//#define FLOW_STATUS_REG 0x12<<11
//#define FRAME_REG 0x13<<11
#define MULTI_PURPOSE_REG 0x14<<11
#define DAQ_REG 0x15<<11
//#define TIME_FROM_START_REG 0x16<<11
#define MCB_CNTRL_REG_OFF 0x17<<11// control the dacs
//ADC
#define ADC_SPI_REG 0x18<<11
#define ADC_SERIAL_CLK_OUT_OFST (0)
#define ADC_SERIAL_CLK_OUT_MSK (0x00000001 << ADC_SERIAL_CLK_OUT_OFST)
#define ADC_SERIAL_DATA_OUT_OFST (1)
#define ADC_SERIAL_DATA_OUT_MSK (0x00000001 << ADC_SERIAL_DATA_OUT_OFST)
#define ADC_SERIAL_CS_OUT_OFST (2)
#define ADC_SERIAL_CS_OUT_MSK (0x0000000F << ADC_SERIAL_CS_OUT_OFST)
#define ADC_SYNC_REG 0x19<<11
//#define MUTIME_REG 0x1a<<11
//temperature
#define TEMP_IN_REG 0x1b<<11
#define TEMP_OUT_REG 0x1c<<11
//configure MAC
#define TSE_CONF_REG 0x1d<<11
#define ENET_CONF_REG 0x1e<<11
//#define WRTSE_SHAD_REG 0x1f<<11
//HV
#define HV_REG 0x20<<11
#define DUMMY_REG 0x21<<11
#define FPGA_VERSION_REG 0x22<<11
#define FIX_PATT_REG 0x23<<11
#define CONTROL_REG 0x24<<11
#define STATUS_REG 0x25<<11
#define CONFIG_REG 0x26<<11
#define EXT_SIGNAL_REG 0x27<<11
#define FPGA_SVN_REG 0x29<<11
#define CHIP_OF_INTRST_REG 0x2A<<11
//FIFO
#define LOOK_AT_ME_REG 0x28<<11
#define FIFO_DATA_REG_OFF 0x50<<11 ///////
//to read back dac registers
#define MOD_DACS1_REG 0x65<<11
#define MOD_DACS2_REG 0x66<<11
#define MOD_DACS3_REG 0x67<<11
//user entered
#define SET_DELAY_LSB_REG 0x68<<11
#define SET_DELAY_MSB_REG 0x69<<11
#define GET_DELAY_LSB_REG 0x6a<<11
#define GET_DELAY_MSB_REG 0x6b<<11
#define SET_TRAINS_LSB_REG 0x6c<<11
#define SET_TRAINS_MSB_REG 0x6d<<11
#define GET_TRAINS_LSB_REG 0x6e<<11
#define GET_TRAINS_MSB_REG 0x6f<<11
#define SET_FRAMES_LSB_REG 0x70<<11
#define SET_FRAMES_MSB_REG 0x71<<11
#define GET_FRAMES_LSB_REG 0x72<<11
#define GET_FRAMES_MSB_REG 0x73<<11
#define SET_PERIOD_LSB_REG 0x74<<11
#define SET_PERIOD_MSB_REG 0x75<<11
#define GET_PERIOD_LSB_REG 0x76<<11
#define GET_PERIOD_MSB_REG 0x77<<11
#define SET_EXPTIME_LSB_REG 0x78<<11
#define SET_EXPTIME_MSB_REG 0x79<<11
#define GET_EXPTIME_LSB_REG 0x7a<<11
#define GET_EXPTIME_MSB_REG 0x7b<<11
#define SET_GATES_LSB_REG 0x7c<<11
#define SET_GATES_MSB_REG 0x7d<<11
#define GET_GATES_LSB_REG 0x7e<<11
#define GET_GATES_MSB_REG 0x7f<<11
//image
#define DARK_IMAGE_REG 0x81<<11
#define GAIN_IMAGE_REG 0x82<<11
//counter block memory
#define COUNTER_MEMORY_REG 0x85<<11
#define GET_MEASUREMENT_TIME_LSB_REG 0x023000
#define GET_MEASUREMENT_TIME_MSB_REG 0x024000
#define GET_ACTUAL_TIME_LSB_REG 0x025000
#define GET_ACTUAL_TIME_MSB_REG 0x026000
//not used
//#define MCB_DOUT_REG_OFF 0x200000
//#define FIFO_CNTRL_REG_OFF 0x300000
//#define FIFO_COUNTR_REG_OFF 0x400000
//not used so far
//#define SPEED_REG 0x006000
//#define SET_NBITS_REG 0x008000
//not used
//#define GET_SHIFT_IN_REG 0x022000
#define SHIFTMOD 2
#define SHIFTFIFO 9
/** for PCB_REV_REG */
#define DETECTOR_TYPE_MASK 0xF0000
#define DETECTOR_TYPE_OFFSET 16
#define BOARD_REVISION_MASK 0xFFFF
#define MOENCH_MODULE 2
/* for control register */
#define START_ACQ_BIT 0x00000001
#define STOP_ACQ_BIT 0x00000002
#define START_FIFOTEST_BIT 0x00000004 // ?????
#define STOP_FIFOTEST_BIT 0x00000008 // ??????
#define START_READOUT_BIT 0x00000010
#define STOP_READOUT_BIT 0x00000020
#define START_EXPOSURE_BIT 0x00000040
#define STOP_EXPOSURE_BIT 0x00000080
#define START_TRAIN_BIT 0x00000100
#define STOP_TRAIN_BIT 0x00000200
#define SYNC_RESET 0x00000400
/* for status register */
#define RUN_BUSY_BIT 0x00000001
#define READOUT_BUSY_BIT 0x00000002
#define FIFOTEST_BUSY_BIT 0x00000004 //????
#define WAITING_FOR_TRIGGER_BIT 0x00000008
#define DELAYBEFORE_BIT 0x00000010
#define DELAYAFTER_BIT 0x00000020
#define EXPOSING_BIT 0x00000040
#define COUNT_ENABLE_BIT 0x00000080
#define READSTATE_0_BIT 0x00000100
#define READSTATE_1_BIT 0x00000200
#define READSTATE_2_BIT 0x00000400
#define RUNSTATE_0_BIT 0x00001000
#define RUNSTATE_1_BIT 0x00002000
#define RUNSTATE_2_BIT 0x00004000
#define SOME_FIFO_FULL_BIT 0x00008000 // error!
#define ALL_FIFO_EMPTY_BIT 0x00010000 // data ready
#define RUNMACHINE_BUSY_BIT 0x00020000
#define READMACHINE_BUSY_BIT 0x00040000
#define STOPPED_BIT 0x00100000
/* for fifo status register */
#define FIFO_ENABLED_BIT 0x80000000
#define FIFO_DISABLED_BIT 0x01000000
#define FIFO_ERROR_BIT 0x08000000
#define FIFO_EMPTY_BIT 0x04000000
#define FIFO_DATA_READY_BIT 0x02000000
#define FIFO_COUNTER_MASK 0x000001ff
#define FIFO_NM_MASK 0x00e00000
#define FIFO_NM_OFF 21
#define FIFO_NC_MASK 0x001ffe00
#define FIFO_NC_OFF 9
/* for config register *///not really used yet
#define TOT_ENABLE_BIT 0x00000002
#define TIMED_GATE_BIT 0x00000004
#define CONT_RO_ENABLE_BIT 0x00080000
#define CPU_OR_RECEIVER_BIT 0x00001000
/* for speed register */
#define CLK_DIVIDER_MASK 0x000000ff
#define CLK_DIVIDER_OFFSET 0
#define SET_LENGTH_MASK 0x00000f00
#define SET_LENGTH_OFFSET 8
#define WAIT_STATES_MASK 0x0000f000
#define WAIT_STATES_OFFSET 12
#define TOTCLK_DIVIDER_MASK 0xff000000
#define TOTCLK_DIVIDER_OFFSET 24
#define TOTCLK_DUTYCYCLE_MASK 0x00ff0000
#define TOTCLK_DUTYCYCLE_OFFSET 16
/* for external signal register */
#define SIGNAL_OFFSET 4
#define SIGNAL_MASK 0xF
#define EXT_SIG_OFF 0x0
#define EXT_GATE_IN_ACTIVEHIGH 0x1
#define EXT_GATE_IN_ACTIVELOW 0x2
#define EXT_TRIG_IN_RISING 0x3
#define EXT_TRIG_IN_FALLING 0x4
#define EXT_RO_TRIG_IN_RISING 0x5
#define EXT_RO_TRIG_IN_FALLING 0x6
#define EXT_GATE_OUT_ACTIVEHIGH 0x7
#define EXT_GATE_OUT_ACTIVELOW 0x8
#define EXT_TRIG_OUT_RISING 0x9
#define EXT_TRIG_OUT_FALLING 0xA
#define EXT_RO_TRIG_OUT_RISING 0xB
#define EXT_RO_TRIG_OUT_FALLING 0xC
/* for temperature register */
#define T1_CLK_BIT 0x00000001
#define T1_CS_BIT 0x00000002
#define T2_CLK_BIT 0x00000004
#define T2_CS_BIT 0x00000008
/* fifo control register */
#define FIFO_RESET_BIT 0x00000001
#define FIFO_DISABLE_TOGGLE_BIT 0x00000002
//chip shiftin register meaning
#define OUTMUX_OFF 20
#define OUTMUX_MASK 0x1f
#define PROBES_OFF 4
#define PROBES_MASK 0x7f
#define OUTBUF_OFF 0
#define OUTBUF_MASK 1
/* multi purpose register */
#define PHASE_STEP_BIT 0x00000001
#define PHASE_STEP_OFFSET 0
// #define xxx_BIT 0x00000002
#define RESET_COUNTER_BIT 0x00000004
#define RESET_COUNTER_OFFSET 2
//#define xxx_BIT 0x00000008
//#define xxx_BIT 0x00000010
#define SW1_BIT 0x00000020
#define SW1_OFFSET 5
#define WRITE_BACK_BIT 0x00000040
#define WRITE_BACK_OFFSET 6
#define RESET_BIT 0x00000080
#define RESET_OFFSET 7
#define PLL_CLK_SEL_MSK 0x00000700
#define PLL_CLK_SEL_OFFSET 8
#define PLL_CLK_SEL_MASTER_VAL ((0x1 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
#define PLL_CLK_SEL_MASTER_ADC_VAL ((0x2 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
#define PLL_CLK_SEL_SLAVE_VAL ((0x3 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
#define PLL_CLK_SEL_SLAVE_ADC_VAL ((0x4 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
#define ENET_RESETN_BIT 0x00000800
#define ENET_RESETN_OFFSET 11
#define INT_RSTN_BIT 0x00001000
#define INT_RSTN_OFFSET 12
#define DIGITAL_TEST_BIT 0x00004000
#define DIGITAL_TEST_OFFSET 14
//#define CHANGE_AT_POWER_ON_BIT 0x00008000
//#define CHANGE_AT_POWER_ON_OFFSET 15
#define RST_TO_SW1_DELAY_MSK 0x000F0000
#define RST_TO_SW1_DELAY_OFFSET 16
#define START_ACQ_DELAY_MSK 0x00F00000
#define START_ACQ_DELAY_OFFSET 20
/* settings/conf gain register */
#define GAIN_MASK 0x000000ff
#define GAIN_OFFSET 0
#define SETTINGS_MASK 0x0000ff00
#define SETTINGS_OFFSET 8
/* CHIP_OF_INTRST_REG */
#define CHANNEL_MASK 0xffff0000
#define CHANNEL_OFFSET 16
#define ACTIVE_ADC_MASK 0x0000001f
/**ADC SYNC CLEAN FIFO*/
#define ADCSYNC_CLEAN_FIFO_BITS 0x300000
#endif

View File

@@ -0,0 +1,103 @@
/* A simple server in the internet domain using TCP
The port number is passed as an argument */
#include "sls_detector_defs.h"
#include "communication_funcs.h"
#include "server_funcs.h"
#include <stdlib.h>
#include <string.h>
extern int sockfd;
extern int phase_shift;
void error(char *msg)
{
perror(msg);
}
int main(int argc, char *argv[])
{
int portno, b;
char cmd[100];
int retval=OK;
int sd, fd;
int iarg;
for(iarg=1; iarg<argc; iarg++){
if(!strcasecmp(argv[iarg],"-phaseshift")){
if ( sscanf(argv[iarg+1],"%d",&phase_shift)==0) {
printf("could not decode phase shift\n");
return 1;
}
argc=1;
}
}
if (argc==1) {
portno = DEFAULT_PORTNO;
sprintf(cmd,"%s %d &",argv[0],DEFAULT_PORTNO+1);
printf("\n\nControl Server\nOpening control server on port %d\n",portno );
system(cmd);
b=1;
} else {
portno = DEFAULT_PORTNO+1;
if ( sscanf(argv[1],"%d",&portno) ==0) {
printf("could not open stop server: unknown port\n");
return 1;
}
b=0;
printf("\n\nStop Server\nOpening stop server on port %d\n",portno);
}
init_detector(b);
sd=bindSocket(portno);
sockfd=sd;
if (getServerError(sd)) {
printf("server error!\n");
return -1;
}
/* assign function table */
function_table();
#ifdef VERBOSE
printf("function table assigned \n");
#endif
/* waits for connection */
while(retval!=GOODBYE) {
#ifdef VERBOSE
printf("\n");
#endif
#ifdef VERY_VERBOSE
printf("Waiting for client call\n");
#endif
fd=acceptConnection(sockfd);
#ifdef VERY_VERBOSE
printf("Conenction accepted\n");
#endif
retval=decode_function(fd);
#ifdef VERY_VERBOSE
printf("function executed\n");
#endif
closeConnection(fd);
#ifdef VERY_VERBOSE
printf("connection closed\n");
#endif
}
exitServer(sockfd);
printf("Goodbye!\n");
return 0;
}

View File

@@ -0,0 +1,69 @@
#ifndef SERVER_DEFS_H
#define SERVER_DEFS_H
#include "sls_detector_defs.h"
#include <stdint.h>
// Hardware definitions
#define NCHAN 128
#define NCHIP 10
#define NDAC 8
#define NADC 5
#define NCHANS NCHAN*NCHIP
#define NDACS NDAC
#define NCHIPS_PER_ADC 2
#define DYNAMIC_RANGE 16
#define DATA_BYTES (NCHIP*NCHAN*2)
// for 25 um
#define CONFIG_FILE "config.txt"
#define ADCSYNC_VAL 0x32214
#define TOKEN_RESTART_DELAY 0x88000000
#define TOKEN_RESTART_DELAY_ROI 0x1b000000
#define TOKEN_TIMING_REV1 0x1f16
#define TOKEN_TIMING_REV2 0x1f0f
#define DEFAULT_PHASE_SHIFT 120
#define DEFAULT_IP_PACKETSIZE 0x0522
#define DEFAULT_UDP_PACKETSIZE 0x050E
#define ADC1_IP_PACKETSIZE (256*2+14+20)
#define ADC1_UDP_PACKETSIZE (256*2+4+8+2)
#define CLK_FREQ 32.007729
#define DAC_DR 1024
#define CONF_GAIN { \
0, /*standard gain*/ \
0, /*fast gain*/ \
0, /*high gain*/ \
8, /*dynamic gain*/ \
6, /*low gain*/ \
2, /*medium gain*/ \
1 /*very high gain*/ \
};
//dynamic gain confgain yet to be figured out-probably 8 or 16
// DAC definitions
enum dacsVal{VREF_DS, VCASCN_PB, VCASCP_PB, VOUT_CM, VCASC_OUT, VIN_CM, VREF_COMP, IB_TESTC,HIGH_VOLTAGE, CONFGAIN};
#define DEFAULT_DAC_VALS { \
660, /* VREF_DS */ \
650, /* VCASCN_PB */ \
1480, /* VCASCP_PB */ \
1520, /* VOUT_CM */ \
1320, /* VCASC_OUT */ \
1350, /* VIN_CM */ \
350, /* VREF_COMP */ \
2001 /* IB_TESTC */ \
};
//Register Definitions for temp,hv,dac gain
enum adcVals{TEMP_FPGA, TEMP_ADC};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
#ifndef SERVER_FUNCS_H
#define SERVER_FUNCS_H
#include "sls_detector_defs.h"
#include <stdio.h>
/*
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
*/
#include "communication_funcs.h"
#define GOODBYE -200
int sockfd;
int function_table();
int decode_function(int);
int init_detector(int);
int M_nofunc(int);
// General purpose functions
int exec_command(int);
int get_detector_type(int);
int set_external_signal_flag(int);
int set_external_communication_mode(int);
int get_id(int);
int digital_test(int);
int set_dac(int);
int get_adc(int);
int write_register(int);
int read_register(int);
int set_module(int);
int get_module(int);
int set_settings(int);
int start_acquisition(int);
int stop_acquisition(int);
int start_readout(int);
int get_run_status(int);
int start_and_read_all(int);
int read_all(int);
int set_timer(int);
int get_time_left(int);
int set_dynamic_range(int);
int set_readout_flags(int);
int set_roi(int);
int set_speed(int);
int exit_server(int);
int lock_server(int);
int get_last_client_ip(int);
int set_port(int);
int send_update(int);
int update_client(int);
int configure_mac(int);
int load_image(int);
int read_counter_block(int);
int reset_counter_block(int);
int write_adc_register(int);
int check_version(int);
#endif

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/sls_detector_defs.h

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/sls_detector_funcs.h

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/sls_receiver_defs.h

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/sls_receiver_funcs.h

View File

@@ -0,0 +1,46 @@
/* A simple server in the internet domain using TCP
The port number is passed as an argument */
#include "sls_detector_defs.h"
#include "communication_funcs.h"
#include "firmware_funcs.h"
int sockfd;
int main(int argc, char *argv[])
{
int portno;
int retval=0;
portno = DEFAULT_PORTNO;
bindSocket(portno);
if (getServerError())
return -1;
/* waits for connection */
while(retval!=GOODBYE) {
#ifdef VERBOSE
printf("\n");
#endif
#ifdef VERY_VERBOSE
printf("Stop server: waiting for client call\n");
#endif
acceptConnection();
retval=stopStateMachine();
closeConnection();
}
exitServer();
printf("Goodbye!\n");
return 0;
}

View File

@@ -0,0 +1,7 @@
SRCFILE=gitInfoGotthard.h
DSTFILE=versionAPI.h
SRCPATTERN=GITDATE
DSTPATTERN=APIGOTTHARD
awk -v a="$SRCFILE" -v b="$DSTFILE" -v c="$SRCPATTERN" -v d="$DSTPATTERN" 'FNR==NR&&$2==c{x=$3} NR!=FNR{if($2==d){$3="0x"substr(x,5)}print > b}' $SRCFILE $DSTFILE

View File

@@ -0,0 +1,30 @@
SERVER=gotthardDetectorServer
MAINDIR=slsDetectorPackage
SPECDIR=slsDetectorSoftware/slsDetectorServers/$SERVER
TMPFILE=gitInfoGotthardTmp.h
INCLFILE=gitInfoGotthard.h
#evaluate the variables
EVALFILE=../../../evalVersionVariables.sh
source $EVALFILE
#get modified date
#RDATE1='git log --pretty=format:"%ci" -1'
RDATE1="find . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|.git|updateGitVersion|.o' | head -n 1"
RDATE=`eval $RDATE1`
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
NEWDATE=${NEWDATE/#/0x}
#get old date from INCLFILE
OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}')
#update INCLFILE if changes
if [ "$OLDDATE" != "$NEWDATE" ]; then
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
cd ../../../
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
cd $WD
fi

View File

@@ -0,0 +1 @@
../../../slsSupportLib/include/versionAPI.h