mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
jungfrau server works
This commit is contained in:
@ -18,13 +18,10 @@ target_link_libraries(slsMultiReceiver
|
||||
pthread
|
||||
zmq
|
||||
rt
|
||||
${HDF5_LIBRARIES}
|
||||
)
|
||||
|
||||
if (HDF5_FOUND)
|
||||
target_link_libraries(slsMultiReceiver
|
||||
${HDF5_LIBRARIES}
|
||||
)
|
||||
target_link_libraries(slsMultiReceiver ${HDF5_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
|
||||
|
@ -1,13 +1,8 @@
|
||||
#include "xfs_types.h"
|
||||
#include "xparameters.h"
|
||||
#include "FebRegisterDefs.h"
|
||||
#include "logger.h"
|
||||
#include "Beb.h"
|
||||
#include "FebRegisterDefs.h"
|
||||
#include "xparameters.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
@ -1,18 +1,15 @@
|
||||
#include "FebRegisterDefs.h"
|
||||
#include "FebControl.h"
|
||||
#include "Beb.h"
|
||||
#include "FebRegisterDefs.h"
|
||||
#include "slsDetectorServer_defs.h"
|
||||
#include "logger.h"
|
||||
#include "Beb.h"
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <termios.h> // POSIX terminal control definitions(CS8, CREAD, CLOCAL..)
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
#include "FebInterface.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
struct Module{
|
||||
|
@ -3,8 +3,6 @@
|
||||
#include "xparameters.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
|
@ -1,10 +1,4 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
//daq register definitions
|
||||
#define DAQ_REG_CTRL 1
|
||||
#define DAQ_REG_CHIP_CMDS 2
|
||||
|
@ -1,9 +1,7 @@
|
||||
#include "LocalLinkInterface.h"
|
||||
#include "HardwareMMappingDefs.h"
|
||||
#include "logger.h"
|
||||
#include "ansi.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -8,7 +8,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
|
||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c FebControl.c Beb.c HardwareIO.c LocalLinkInterface.c FebInterface.c
|
||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c HardwareIO.c LocalLinkInterface.c FebInterface.c FebControl.c Beb.c
|
||||
OBJS = $(SRC_CLNT:.c=.o)
|
||||
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,14 +1,13 @@
|
||||
#include "slsDetectorFunctionList.h"
|
||||
#include "gitInfoEiger.h"
|
||||
#include "versionAPI.h"
|
||||
#include "logger.h"
|
||||
|
||||
#ifndef VIRTUAL
|
||||
#include "FebControl.h"
|
||||
#include "Beb.h"
|
||||
#include "versionAPI.h"
|
||||
#endif
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> //to gethostname
|
||||
#include <string.h>
|
||||
#ifdef VIRTUAL
|
||||
@ -20,6 +19,11 @@
|
||||
extern int debugflag;
|
||||
extern int isControlServer;
|
||||
|
||||
int firmware_compatibility = OK;
|
||||
int firmware_check_done = 0;
|
||||
char firmware_message[MAX_STR_LENGTH];
|
||||
|
||||
|
||||
const char* dac_names[16] = {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};
|
||||
int default_tau_from_file= -1;
|
||||
enum detectorSettings thisSettings;
|
||||
@ -42,12 +46,6 @@ int normal = 0;
|
||||
uint32_t detid = 0;
|
||||
#endif
|
||||
|
||||
|
||||
int firmware_compatibility = OK;
|
||||
int firmware_check_done = 0;
|
||||
char firmware_message[MAX_STR_LENGTH];
|
||||
|
||||
|
||||
int eiger_highvoltage = 0;
|
||||
int eiger_theo_highvoltage = 0;
|
||||
int eiger_iodelay = 0;
|
||||
@ -60,8 +58,6 @@ int eiger_readoutspeed = 0;
|
||||
int eiger_triggermode = 0;
|
||||
int eiger_extgating = 0;
|
||||
int eiger_extgatingpolarity = 0;
|
||||
|
||||
|
||||
int eiger_nexposures = 1;
|
||||
int eiger_ncycles = 1;
|
||||
|
||||
@ -381,25 +377,25 @@ void allocateDetectorStructureMemory() {
|
||||
FILE_LOG(logINFO, ("This Server is for 1 Eiger half module (250k)\n\n"));
|
||||
|
||||
//Allocation of memory
|
||||
detectorModules=malloc(sizeof(sls_detector_module));
|
||||
detectorChans=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs=malloc(NDAC*sizeof(int));
|
||||
detectorAdcs=malloc(NADC*sizeof(int));
|
||||
detectorModules = malloc(sizeof(sls_detector_module));
|
||||
detectorChans = malloc(NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs = malloc(NDAC*sizeof(int));
|
||||
detectorAdcs = malloc(NADC*sizeof(int));
|
||||
FILE_LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules));
|
||||
FILE_LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans));
|
||||
FILE_LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs));
|
||||
FILE_LOG(logDEBUG1, ("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs));
|
||||
(detectorModules)->dacs=detectorDacs;
|
||||
(detectorModules)->adcs=detectorAdcs;
|
||||
(detectorModules)->chanregs=detectorChans;
|
||||
(detectorModules)->ndac=NDAC;
|
||||
(detectorModules)->nadc=NADC;
|
||||
(detectorModules)->nchip=NCHIP;
|
||||
(detectorModules)->nchan=NCHIP*NCHAN;
|
||||
(detectorModules)->reg=0;
|
||||
(detectorModules)->iodelay=0;
|
||||
(detectorModules)->tau=0;
|
||||
(detectorModules)->eV=0;
|
||||
(detectorModules)->dacs = detectorDacs;
|
||||
(detectorModules)->adcs = detectorAdcs;
|
||||
(detectorModules)->chanregs = detectorChans;
|
||||
(detectorModules)->ndac = NDAC;
|
||||
(detectorModules)->nadc = NADC;
|
||||
(detectorModules)->nchip = NCHIP;
|
||||
(detectorModules)->nchan = NCHIP * NCHAN;
|
||||
(detectorModules)->reg = 0;
|
||||
(detectorModules)->iodelay = 0;
|
||||
(detectorModules)->tau = 0;
|
||||
(detectorModules)->eV = 0;
|
||||
thisSettings = UNINITIALIZED;
|
||||
|
||||
// if trimval requested, should return -1 to acknowledge unknown
|
||||
@ -1196,6 +1192,7 @@ enum externalCommunicationMode getTiming() {
|
||||
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2) {
|
||||
#ifndef VIRTUAL
|
||||
FILE_LOG(logINFO, ("Configuring MAC\n"));
|
||||
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
||||
int src_port = 0xE185;
|
||||
sprintf(src_ip,"%d.%d.%d.%d",(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff);
|
||||
@ -1215,12 +1212,14 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
|
||||
|
||||
|
||||
FILE_LOG(logINFO, ("src_port:%d\n"
|
||||
"\tsrc_ip:%s\n"
|
||||
"\tdst_ip:%s\n"
|
||||
"\tsrc_mac:%s\n"
|
||||
"\tdst_mac:%s\n",
|
||||
src_port, src_ip, dst_ip, src_mac, dst_mac));
|
||||
FILE_LOG(logINFO, (
|
||||
"\tSource IP : %s\n"
|
||||
"\tSource MAC : %s\n"
|
||||
"\tSource Port : %d\n"
|
||||
"\tDest IP : %s\n"
|
||||
"\tDest MAC : %s\n",
|
||||
src_ip, src_mac, src_port,
|
||||
dst_ip, dst_mac));
|
||||
|
||||
|
||||
int beb_num = detid;
|
||||
@ -1229,13 +1228,13 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
if (!top)
|
||||
dst_port = udpport2;
|
||||
|
||||
FILE_LOG(logINFO, ("\tdst_port:%d\n", dst_port));
|
||||
FILE_LOG(logINFO, ("\tDest Port : %d\n", dst_port));
|
||||
|
||||
int i=0;
|
||||
/* for(i=0;i<32;i++) { modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port)) {
|
||||
FILE_LOG(logINFO, ("set up left ok\n"));
|
||||
FILE_LOG(logDEBUG1, ("\tset up left ok\n"));
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
@ -1245,12 +1244,12 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
dst_port = udpport2;
|
||||
if (!top)
|
||||
dst_port = udpport;
|
||||
FILE_LOG(logINFO, ("dst_port:%d\n",dst_port));
|
||||
FILE_LOG(logINFO, ("\tDest Port : %d\n",dst_port));
|
||||
|
||||
/*for(i=0;i<32;i++) {*//** modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port)) {
|
||||
FILE_LOG(logINFO, ("set up right ok\n"));
|
||||
FILE_LOG(logDEBUG1, (" set up right ok\n"));
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
@ -1654,7 +1653,7 @@ void* start_timer(void* arg) {
|
||||
|
||||
|
||||
int stopStateMachine() {
|
||||
FILE_LOG(logERROR, ("Going to stop acquisition\n"));
|
||||
FILE_LOG(logINFORED, ("Going to stop acquisition\n"));
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_stop = 0;
|
||||
return OK;
|
||||
@ -1722,13 +1721,13 @@ enum runStatus getRunStatus() {
|
||||
int i = Feb_Control_AcquisitionInProgress();
|
||||
switch (i) {
|
||||
case STATUS_ERROR:
|
||||
FILE_LOG(logINFO, ("Status: ERROR reading status register\n"));
|
||||
FILE_LOG(logERROR, ("Status: ERROR reading status register\n"));
|
||||
return ERROR;
|
||||
case STATUS_IDLE:
|
||||
FILE_LOG(logINFO, ("Status: IDLE\n"));
|
||||
FILE_LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
default:
|
||||
FILE_LOG(logINFO, ("Status: RUNNING...\n"));
|
||||
FILE_LOG(logINFOBLUE, ("Status: RUNNING...\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define SLSDETECTORSERVER_DEFS_H_
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define GOODBYE (-200)
|
||||
#define REQUIRED_FIRMWARE_VERSION (22)
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/jungfrauDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: ee20932392a576a700f48140be02acb94b7eb6de
|
||||
Revision: 1
|
||||
Repsitory UUID: 92123069ce045314a12416a7e8b308875d7f9f21
|
||||
Revision: 7
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4103
|
||||
Last Changed Date: 2018-10-11 13:46:09.000000002 +0200 ./RegisterDefs.h
|
||||
Last Changed Rev: 4158
|
||||
Last Changed Date: 2018-11-02 12:00:46.000000002 +0100 ./Makefile
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "ee20932392a576a700f48140be02acb94b7eb6de"
|
||||
#define GITREPUUID "92123069ce045314a12416a7e8b308875d7f9f21"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4103
|
||||
#define GITDATE 0x20181011
|
||||
#define GITREV 0x4158
|
||||
#define GITDATE 0x20181102
|
||||
#define GITBRANCH "refactor"
|
||||
|
1
slsDetectorServers/jungfrauDetectorServer/logger.h
Symbolic link
1
slsDetectorServers/jungfrauDetectorServer/logger.h
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorServer/logger.h
|
File diff suppressed because it is too large
Load Diff
@ -3,14 +3,14 @@
|
||||
|
||||
#include "sls_detector_defs.h" //default dynamicgain in settings
|
||||
#include "RegisterDefs.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
#define GOODBYE (-200)
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||
#define REQRD_FRMWR_VRSN 0x180615
|
||||
|
||||
#define PROGRAMMING_MODE (0x2)
|
||||
#define BOARD_JUNGFRAU_TYPE (8)
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct ip_header_struct {
|
||||
|
@ -1,10 +1,7 @@
|
||||
#ifndef AD9257_H
|
||||
#define AD9257_H
|
||||
|
||||
#include "ansi.h"
|
||||
|
||||
#include "commonServerFunctions.h"
|
||||
#include <stdio.h>
|
||||
#include "commonServerFunctions.h" // blackfin.h, ansi.h
|
||||
|
||||
/* AD9257 ADC DEFINES */
|
||||
#define AD9257_ADC_NUMBITS (24)
|
||||
@ -81,36 +78,36 @@ void setAdc(int addr, int val) {
|
||||
|
||||
u_int32_t codata;
|
||||
codata = val + (addr << 8);
|
||||
printf(" Setting ADC SPI Register. Wrote 0x%04x at 0x%04x\n", val, addr);
|
||||
FILE_LOG(logINFO, ("\tSetting ADC SPI Register. Wrote 0x%04x at 0x%04x\n", val, addr));
|
||||
serializeToSPI(ADC_SPI_REG, codata, ADC_SERIAL_CS_OUT_MSK, AD9257_ADC_NUMBITS,
|
||||
ADC_SERIAL_CLK_OUT_MSK, ADC_SERIAL_DATA_OUT_MSK, ADC_SERIAL_DATA_OUT_OFST);
|
||||
}
|
||||
|
||||
void prepareADC(){
|
||||
printf("\n\nPreparing ADC ... \n");
|
||||
FILE_LOG(logINFOBLUE, ("Preparing ADC:\n"));
|
||||
|
||||
//power mode reset
|
||||
printf("power mode reset:\n");
|
||||
FILE_LOG(logINFO, ("\tPower mode reset\n"));
|
||||
setAdc(AD9257_POWER_MODE_REG,
|
||||
(AD9257_INT_RESET_VAL << AD9257_POWER_INTERNAL_OFST) & AD9257_POWER_INTERNAL_MSK);
|
||||
|
||||
//power mode chip run
|
||||
printf("power mode chip run:\n");
|
||||
FILE_LOG(logINFO, ("\tPower mode chip run\n"));
|
||||
setAdc(AD9257_POWER_MODE_REG,
|
||||
(AD9257_INT_CHIP_RUN_VAL << AD9257_POWER_INTERNAL_OFST) & AD9257_POWER_INTERNAL_MSK);
|
||||
|
||||
//output clock phase
|
||||
printf("output clock phase:\n");
|
||||
FILE_LOG(logINFO, ("\tOutput clock phase\n"));
|
||||
setAdc(AD9257_OUT_PHASE_REG,
|
||||
(AD9257_OUT_CLK_60_VAL << AD9257_OUT_CLK_OFST) & AD9257_OUT_CLK_MSK);
|
||||
|
||||
// lvds-iee reduced , binary offset
|
||||
printf("lvds-iee reduced, binary offset:\n");
|
||||
FILE_LOG(logINFO, ("\tLvds-iee reduced, binary offset\n"));
|
||||
setAdc(AD9257_OUT_MODE_REG,
|
||||
(AD9257_OUT_LVDS_IEEE_VAL << AD9257_OUT_LVDS_OPT_OFST) & AD9257_OUT_LVDS_OPT_MSK);
|
||||
|
||||
// all devices on chip to receive next command
|
||||
printf("all devices on chip to receive next command:\n");
|
||||
FILE_LOG(logINFO, ("\tAll devices on chip to receive next command\n"));
|
||||
setAdc(AD9257_DEV_IND_2_REG,
|
||||
AD9257_CHAN_H_MSK | AD9257_CHAN_G_MSK | AD9257_CHAN_F_MSK | AD9257_CHAN_E_MSK);
|
||||
setAdc(AD9257_DEV_IND_1_REG,
|
||||
@ -118,21 +115,19 @@ void prepareADC(){
|
||||
AD9257_CLK_CH_DCO_MSK | AD9257_CLK_CH_IFCO_MSK);
|
||||
|
||||
// vref 1.33
|
||||
printf("vref 1.33:\n");
|
||||
FILE_LOG(logINFO, ("\tVref 1.33\n"));
|
||||
setAdc(AD9257_VREF_REG,
|
||||
(AD9257_VREF_1_33_VAL << AD9257_VREF_OFST) & AD9257_VREF_MSK);
|
||||
|
||||
// no test mode
|
||||
printf("no test mode:\n");
|
||||
FILE_LOG(logINFO, ("\tNo test mode\n"));
|
||||
setAdc(AD9257_TEST_MODE_REG,
|
||||
(AD9257_NONE_VAL << AD9257_OUT_TEST_OFST) & AD9257_OUT_TEST_MSK);
|
||||
|
||||
#ifdef TESTADC
|
||||
printf("***************************************** *******\n");
|
||||
printf("******* PUTTING ADC IN TEST MODE!!!!!!!!! *******\n");
|
||||
printf("***************************************** *******\n");
|
||||
FILE_LOG(logINFOBLUE, ("Putting ADC in Test Mode!\n");
|
||||
// mixed bit frequency test mode
|
||||
printf("mixed bit frequency test mode:\n");
|
||||
FILE_LOG(logINFO, ("\tMixed bit frequency test mode\n"));
|
||||
setAdc(AD9257_TEST_MODE_REG,
|
||||
(AD9257_MIXED_BIT_FREQ_VAL << AD9257_OUT_TEST_OFST) & AD9257_OUT_TEST_MSK);
|
||||
#endif
|
||||
|
@ -1,9 +1,7 @@
|
||||
#ifndef BLACKFIN_H
|
||||
#define BLACKFIN_H
|
||||
#pragma once
|
||||
|
||||
#include "ansi.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h> // open
|
||||
#include <sys/mman.h> // mmap
|
||||
|
||||
@ -73,7 +71,7 @@ int64_t get64BitReg(int aLSB, int aMSB){
|
||||
vMSB=bus_r(aMSB);
|
||||
v64=vMSB;
|
||||
v64=(v64<<32) | vLSB;
|
||||
printf(" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, (long long unsigned int)v64);
|
||||
FILE_LOG(logDEBUG1, (" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, (long long unsigned int)v64));
|
||||
return v64;
|
||||
}
|
||||
|
||||
@ -124,39 +122,33 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
|
||||
int mapCSP0(void) {
|
||||
// if not mapped
|
||||
if (CSP0BASE == 0) {
|
||||
printf("Mapping memory\n");
|
||||
FILE_LOG(logINFO, ("Mapping memory\n"));
|
||||
#ifdef VIRTUAL
|
||||
CSP0BASE = malloc(MEM_SIZE);
|
||||
if (CSP0BASE == NULL) {
|
||||
cprintf(BG_RED, "Error: Could not allocate virtual memory.\n");
|
||||
FILE_LOG(logERROR, ("Could not allocate virtual memory.\n"));
|
||||
return FAIL;
|
||||
}
|
||||
printf("memory allocated\n");
|
||||
FILE_LOG(logINFO, (("memory allocated\n"));
|
||||
#else
|
||||
int fd;
|
||||
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||
if (fd == -1) {
|
||||
cprintf(BG_RED, "Error: Can't find /dev/mem\n");
|
||||
FILE_LOG(logERROR, ("Can't find /dev/mem\n"));
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("/dev/mem opened\n");
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("/dev/mem opened\n"));
|
||||
CSP0BASE = mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
|
||||
if (CSP0BASE == MAP_FAILED) {
|
||||
cprintf(BG_RED, "Error: Can't map memmory area\n");
|
||||
FILE_LOG(logERROR, ("Can't map memmory area\n"));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
printf("CSPOBASE mapped from 0x%llx to 0x%llx\n",
|
||||
FILE_LOG(logINFO, ("CSPOBASE mapped from 0x%llx to 0x%llx\n",
|
||||
(long long unsigned int)CSP0BASE,
|
||||
(long long unsigned int)(CSP0BASE+MEM_SIZE));
|
||||
printf("Status Register: %08x\n",bus_r(STATUS_REG));
|
||||
|
||||
(long long unsigned int)(CSP0BASE+MEM_SIZE)));
|
||||
FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||
}else
|
||||
printf("Memory already mapped before\n");
|
||||
FILE_LOG(logINFO, ("Memory already mapped before\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
#endif //BLACKFIN_H
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#ifndef GOTTHARDD //gotthard already had bus_w etc defined in its firmware_funcs.c (not yet made with common files)
|
||||
#include "blackfin.h"
|
||||
#else
|
||||
#include "ansi.h"
|
||||
#endif
|
||||
|
||||
/* global variables */
|
||||
@ -54,13 +56,11 @@ void sendDataToSPI (u_int32_t* valw, u_int32_t addr, u_int32_t val, int numbitst
|
||||
|
||||
|
||||
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int32_t csmask, int numbitstosend, u_int32_t clkmask, u_int32_t digoutmask, int digofset) {
|
||||
#ifdef VERBOSE
|
||||
if (numbitstosend == 16)
|
||||
printf("Writing to SPI Register: 0x%04x\n",val);
|
||||
else
|
||||
printf("Writing to SPI Register: 0x%08x\n", val);
|
||||
#endif
|
||||
|
||||
if (numbitstosend == 16) {
|
||||
FILE_LOG(logDEBUG1, ("Writing to SPI Register: 0x%04x\n", val));
|
||||
} else {
|
||||
FILE_LOG(logDEBUG1, ("Writing to SPI Register: 0x%08x\n", val));
|
||||
}
|
||||
u_int32_t valw;
|
||||
|
||||
SPIChipSelect (&valw, addr, csmask);
|
||||
|
@ -1,14 +1,15 @@
|
||||
|
||||
|
||||
#include "communication_funcs.h"
|
||||
#include "logger.h"
|
||||
|
||||
//#include <netinet/tcp.h> /* for TCP_NODELAY */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define SEND_REC_MAX_SIZE 4096
|
||||
#define DEFAULT_PORTNO 1952
|
||||
#define DEFAULT_BACKLOG 5
|
||||
|
||||
|
||||
// Global variables from errno.h
|
||||
extern int errno;
|
||||
@ -25,7 +26,6 @@ char mess[MAX_STR_LENGTH];
|
||||
|
||||
// Local variables
|
||||
char dummyClientIP[INET_ADDRSTRLEN] = "";
|
||||
const int send_rec_max_size = SEND_REC_MAX_SIZE;
|
||||
int myport = -1;
|
||||
// socket descriptor set
|
||||
fd_set readset, tempset;
|
||||
@ -36,10 +36,6 @@ int isock = 0;
|
||||
int maxfd = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_BACKLOG 5
|
||||
|
||||
int bindSocket(unsigned short int port_number) {
|
||||
ret = FAIL;
|
||||
int socketDescriptor = -1;
|
||||
@ -324,7 +320,7 @@ int receiveDataOnly(int file_des, void* buf,int length) {
|
||||
length, (isControlServer ? "control":"stop")));
|
||||
|
||||
while(length > 0) {
|
||||
nreceiving = (length>send_rec_max_size) ? send_rec_max_size:length; // (condition) ? if_true : if_false
|
||||
nreceiving = (length>SEND_REC_MAX_SIZE) ? SEND_REC_MAX_SIZE:length; // (condition) ? if_true : if_false
|
||||
nreceived = read(file_des,(char*)buf+total_received,nreceiving);
|
||||
if(!nreceived){
|
||||
if(!total_received) {
|
||||
|
@ -1,21 +1,9 @@
|
||||
#ifndef COMMUNICATION_FUNCS_H
|
||||
#define COMMUNICATION_FUNCS_H
|
||||
|
||||
#define SEND_REC_MAX_SIZE 4096
|
||||
#define DEFAULT_PORTNO 1952
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
|
||||
|
||||
typedef enum{
|
||||
INT16,
|
||||
INT32,
|
||||
|
@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
logERROR, logWARNING, logINFOBLUE, logINFOGREEN, logINFO,
|
||||
logERROR, logWARNING, logINFOBLUE, logINFOGREEN, logINFORED, logINFO,
|
||||
logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5
|
||||
}TLogLevel;
|
||||
|
||||
@ -36,6 +36,7 @@ static inline void FILELOG_PrintLog(TLogLevel level, char* m) {
|
||||
case logWARNING: cprintf(YELLOW BOLD, "WARNING: %s", m); break;
|
||||
case logINFOBLUE: cprintf(BLUE, "INFO: %s", m); break;
|
||||
case logINFOGREEN: cprintf(GREEN, "INFO: %s", m); break;
|
||||
case logINFORED: cprintf(RED, "INFO: %s", m); break;
|
||||
case logINFO: cprintf(RESET, "INFO: %s", m); break;
|
||||
case logDEBUG: cprintf(MAGENTA, "DEBUG: %s", m); break;
|
||||
case logDEBUG1: cprintf(MAGENTA, "DEBUG1: %s", m); break;
|
||||
|
@ -1,19 +1,17 @@
|
||||
#ifndef PROGRAM_FPGA_H
|
||||
#define PROGRAM_FPGA_H
|
||||
#pragma once
|
||||
|
||||
#include "ansi.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> // usleep
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* global variables */
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
int gpioDefined=0;
|
||||
#define MTDSIZE 10
|
||||
char mtdvalue[MTDSIZE];
|
||||
#define MTDSIZE 10
|
||||
|
||||
int gpioDefined = 0;
|
||||
char mtdvalue[MTDSIZE] = {0};
|
||||
|
||||
|
||||
/**
|
||||
@ -27,9 +25,9 @@ void defineGPIOpins(){
|
||||
//define their direction
|
||||
system("echo in > /sys/class/gpio/gpio7/direction");
|
||||
system("echo out > /sys/class/gpio/gpio9/direction");
|
||||
printf("gpio pins defined\n");
|
||||
FILE_LOG(logINFO, ("gpio pins defined\n"));
|
||||
gpioDefined = 1;
|
||||
}else printf("gpio pins already defined earlier\n");
|
||||
}else FILE_LOG(logDEBUG1, ("gpio pins already defined earlier\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,7 +52,7 @@ void FPGATouchFlash(){
|
||||
* Reset FPGA
|
||||
*/
|
||||
void resetFPGA(){
|
||||
cprintf(BLUE,"\n*** Reseting FPGA ***\n");
|
||||
FILE_LOG(logINFOBLUE, ("Reseting FPGA\n"));
|
||||
FPGAdontTouchFlash();
|
||||
FPGATouchFlash();
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
@ -64,14 +62,12 @@ void resetFPGA(){
|
||||
* Erasing flash
|
||||
*/
|
||||
void eraseFlash(){
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("\nErasing Flash\n");
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Erasing Flash\n"));
|
||||
char command[255];
|
||||
memset(command, 0, 255);
|
||||
sprintf(command,"flash_eraseall %s",mtdvalue);
|
||||
system(command);
|
||||
printf("Flash erased\n");
|
||||
FILE_LOG(logINFO, ("Flash erased\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,43 +77,40 @@ void eraseFlash(){
|
||||
* @return 0 for success, 1 for fail (cannot open file for writing program)
|
||||
*/
|
||||
int startWritingFPGAprogram(FILE** filefp){
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("\nStart Writing of FPGA program\n");
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Start Writing of FPGA program\n"));
|
||||
|
||||
//getting the drive
|
||||
char output[255];
|
||||
memset(output, 0, 255);
|
||||
FILE* fp = popen("awk \'$4== \"\\\"bitfile(spi)\\\"\" {print $1}\' /proc/mtd", "r");
|
||||
if (fp == NULL) {
|
||||
cprintf(RED,"popen returned NULL. Need that to get mtd drive.\n");
|
||||
FILE_LOG(logERROR, ("popen returned NULL. Need that to get mtd drive.\n"));
|
||||
return 1;
|
||||
}
|
||||
if (fgets(output, sizeof(output), fp) == NULL) {
|
||||
cprintf(RED,"fgets returned NULL. Need that to get mtd drive.\n");
|
||||
FILE_LOG(logERROR, ("fgets returned NULL. Need that to get mtd drive.\n"));
|
||||
return 1;
|
||||
}
|
||||
pclose(fp);
|
||||
//cprintf(RED,"output: %s\n", output);
|
||||
memset(mtdvalue, 0, MTDSIZE);
|
||||
strcpy(mtdvalue,"/dev/");
|
||||
char* pch = strtok(output,":");
|
||||
if(pch == NULL){
|
||||
cprintf(RED,"Could not get mtd value\n");
|
||||
FILE_LOG(logERROR, ("Could not get mtd value\n"));
|
||||
return 1;
|
||||
}
|
||||
strcat(mtdvalue,pch);
|
||||
printf ("\nFlash drive found: %s\n",mtdvalue);
|
||||
FILE_LOG(logINFO, ("Flash drive found: %s\n", mtdvalue));
|
||||
|
||||
FPGAdontTouchFlash();
|
||||
|
||||
//writing the program to flash
|
||||
*filefp = fopen(mtdvalue, "w");
|
||||
if(*filefp == NULL){
|
||||
cprintf(RED,"Unable to open %s in write mode\n",mtdvalue);
|
||||
FILE_LOG(logERROR, ("Unable to open %s in write mode\n", mtdvalue));
|
||||
return 1;
|
||||
}
|
||||
printf("Flash ready for writing\n");
|
||||
FILE_LOG(logINFO, ("Flash ready for writing\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -128,9 +121,7 @@ int startWritingFPGAprogram(FILE** filefp){
|
||||
* @param filefp pointer to flash
|
||||
*/
|
||||
void stopWritingFPGAprogram(FILE* filefp){
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("\nStopping of writing FPGA program\n");
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Stopping of writing FPGA program\n"));
|
||||
|
||||
int wait = 0;
|
||||
if(filefp!= NULL){
|
||||
@ -142,9 +133,7 @@ void stopWritingFPGAprogram(FILE* filefp){
|
||||
FPGATouchFlash();
|
||||
|
||||
if(wait){
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("Waiting for FPGA to program from flash\n");
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Waiting for FPGA to program from flash\n"));
|
||||
//waiting for success or done
|
||||
char output[255];
|
||||
int res=0;
|
||||
@ -153,12 +142,10 @@ void stopWritingFPGAprogram(FILE* filefp){
|
||||
fgets(output, sizeof(output), sysFile);
|
||||
pclose(sysFile);
|
||||
sscanf(output,"%d",&res);
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("gpi07 returned %d\n",res);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("gpi07 returned %d\n", res));
|
||||
}
|
||||
}
|
||||
printf("FPGA has picked up the program from flash\n\n");
|
||||
FILE_LOG(logINFO, ("FPGA has picked up the program from flash\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -170,21 +157,15 @@ void stopWritingFPGAprogram(FILE* filefp){
|
||||
* @return 0 for success, 1 for fail (cannot write)
|
||||
*/
|
||||
int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp){
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("\nWriting of FPGA Program\n");
|
||||
cprintf(BLUE,"address of fpgasrc:%p\n",(void *)fpgasrc);
|
||||
cprintf(BLUE,"fsize:%lu\n",fsize);
|
||||
cprintf(BLUE,"pointer:%p\n",(void*)filefp);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Writing of FPGA Program\n"
|
||||
"\taddress of fpgasrc:%p\n"
|
||||
"\tfsize:%lu\n\tpointer:%p\n",
|
||||
(void *)fpgasrc, fsize, (void*)filefp));
|
||||
|
||||
if(fwrite((void*)fpgasrc , sizeof(char) , fsize , filefp )!= fsize){
|
||||
cprintf(RED,"Could not write FPGA source to flash (size:%lu)\n", fsize);
|
||||
FILE_LOG(logERROR, ("Could not write FPGA source to flash (size:%lu)\n", fsize));
|
||||
return 1;
|
||||
}
|
||||
#ifdef VERY_VERBOSE
|
||||
cprintf(BLUE, "program written to flash\n");
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("program written to flash\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //PROGRAM_FPGA_H
|
||||
|
@ -37,9 +37,7 @@ u_int64_t getFirmwareAPIVersion();
|
||||
u_int16_t getHardwareVersionNumber();
|
||||
u_int16_t getHardwareSerialNumber();
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
u_int32_t getDetectorNumber();
|
||||
#endif
|
||||
u_int64_t getDetectorMAC();
|
||||
u_int32_t getDetectorIP();
|
||||
|
||||
|
@ -2,16 +2,15 @@
|
||||
The port number is passed as an argument */
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include "slsDetectorServer_defs.h"
|
||||
#include "logger.h"
|
||||
#include "communication_funcs.h"
|
||||
#include "slsDetectorServer_funcs.h"
|
||||
#include "slsDetectorServer_defs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// Global variables from communication_funcs
|
||||
extern int isControlServer;
|
||||
extern int ret;
|
||||
|
@ -3,19 +3,19 @@
|
||||
#include "communication_funcs.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
//defined in the detector specific Makefile
|
||||
#ifdef GOTTHARDD
|
||||
const enum detectorType myDetectorType=GOTTHARD;
|
||||
const enum detectorType myDetectorType = GOTTHARD;
|
||||
#elif EIGERD
|
||||
const enum detectorType myDetectorType=EIGER;
|
||||
const enum detectorType myDetectorType = EIGER;
|
||||
#elif JUNGFRAUD
|
||||
const enum detectorType myDetectorType=JUNGFRAU;
|
||||
const enum detectorType myDetectorType = JUNGFRAU;
|
||||
#else
|
||||
const enum detectorType myDetectorType=GENERIC;
|
||||
const enum detectorType myDetectorType = GENERIC;
|
||||
#endif
|
||||
|
||||
// Global variables from communication_funcs
|
||||
@ -64,7 +64,7 @@ void init_detector() {
|
||||
if (isControlServer) {
|
||||
basictests();
|
||||
#ifdef JUNGFRAUD
|
||||
if (debugflag == PROGRAMMING_MODE)
|
||||
if (debugflag != PROGRAMMING_MODE)
|
||||
#endif
|
||||
initControlServer();
|
||||
#ifdef EIGERD
|
||||
@ -1331,53 +1331,54 @@ int set_timer(int file_des) {
|
||||
|
||||
|
||||
int get_time_left(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum timerIndex ind = -1;
|
||||
int64_t retval = -1;
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum timerIndex ind = -1;
|
||||
int64_t retval = -1;
|
||||
|
||||
if (receiveData(file_des, &ind, sizeof(ind), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Getting timer left index %d\n", ind));
|
||||
if (receiveData(file_des, &ind, sizeof(ind), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Getting timer left index %d\n", ind));
|
||||
|
||||
// only get
|
||||
// check index
|
||||
switch(ind) {
|
||||
// only get
|
||||
// check index
|
||||
#ifdef JUNGFRAUD
|
||||
if (ind == DELAY_AFTER_TRIGGER) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Timer Left Index (%d) is not implemented for this release.\n", (int)ind);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
#endif
|
||||
if (ret == OK) {
|
||||
switch(ind) {
|
||||
#ifdef EIGERD
|
||||
case MEASURED_PERIOD:
|
||||
case MEASURED_SUBPERIOD:
|
||||
case MEASURED_PERIOD:
|
||||
case MEASURED_SUBPERIOD:
|
||||
#elif JUNGFRAUD
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
#elif GOTTHARDD
|
||||
case GATES_NUMBER:
|
||||
case GATES_NUMBER:
|
||||
#endif
|
||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD)
|
||||
case FRAME_NUMBER:
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
case PROGRESS:
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
case PROGRESS:
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
#endif
|
||||
retval = getTimeLeft(ind);
|
||||
FILE_LOG(logDEBUG1, ("Timer left index %d: %lld\n", ind, retval));
|
||||
break;
|
||||
#ifdef JUNGFRAUD
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Timer Left Index (%d) is not implemented for this release.\n", (int)ind);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
modeNotImplemented("Timer left index", (int)ind);
|
||||
break;
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, 1, &retval, sizeof(retval));
|
||||
retval = getTimeLeft(ind);
|
||||
FILE_LOG(logDEBUG1, ("Timer left index %d: %lld\n", ind, retval));
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Timer left index", (int)ind);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, 1, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
@ -1692,9 +1693,16 @@ int set_port(int file_des) {
|
||||
|
||||
|
||||
int update_client(int file_des) {
|
||||
ret = OK;
|
||||
ret = FORCE_UPDATE;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
#ifdef JUNGFRAUD
|
||||
if (debugflag == PROGRAMMING_MODE) {
|
||||
ret = OK;
|
||||
}
|
||||
#endif
|
||||
Server_SendResult(file_des, INT32, 0, NULL, 0);
|
||||
if (ret == OK)
|
||||
return ret;
|
||||
return send_update(file_des);
|
||||
}
|
||||
|
||||
@ -1702,6 +1710,7 @@ int update_client(int file_des) {
|
||||
|
||||
|
||||
int send_update(int file_des) {
|
||||
ret = OK;
|
||||
int n = 0;
|
||||
int i32 = -1;
|
||||
int64_t i64 = -1;
|
||||
@ -1769,7 +1778,7 @@ int send_update(int file_des) {
|
||||
strcpy(lastClientIP,thisClientIP);
|
||||
}
|
||||
|
||||
return OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -2369,7 +2378,6 @@ int program_fpga(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
FILE_LOG(logDEBUG1, ("Programming FPGA\n"));
|
||||
#ifndef JUNGFRAUD
|
||||
//to receive any arguments
|
||||
int n = 1;
|
||||
@ -2405,7 +2413,7 @@ int program_fpga(int file_des) {
|
||||
if (receiveData(file_des,&filesize,sizeof(filesize),INT32) < 0)
|
||||
return printSocketReadError();
|
||||
totalsize = filesize;
|
||||
FILE_LOG(logDEBUG1, ("Total program size is: %d\n", totalsize);
|
||||
FILE_LOG(logDEBUG1, ("Total program size is: %d\n", totalsize));
|
||||
|
||||
// opening file pointer to flash and telling FPGA to not touch flash
|
||||
if (startWritingFPGAprogram(&fp) != OK) {
|
||||
@ -2430,8 +2438,7 @@ int program_fpga(int file_des) {
|
||||
if (unitprogramsize > filesize) //less than 2mb
|
||||
unitprogramsize = filesize;
|
||||
FILE_LOG(logDEBUG1, ("unit size to receive is:%d\n"
|
||||
"filesize:%d currentpointer:%d\n",
|
||||
unitprogramsize, filesize, currentPointer));
|
||||
"filesize:%d\n", unitprogramsize, filesize));
|
||||
|
||||
|
||||
//receive part of program
|
||||
@ -2462,8 +2469,8 @@ int program_fpga(int file_des) {
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO("\nDone copying program\n"));
|
||||
printf("\n");
|
||||
FILE_LOG(logINFO, ("Done copying program\n"));
|
||||
|
||||
// closing file pointer to flash and informing FPGA
|
||||
stopWritingFPGAprogram(fp);
|
||||
@ -2712,29 +2719,30 @@ int auto_comp_disable(int file_des) {
|
||||
|
||||
|
||||
int storage_cell_start(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
int retval = -1;
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
int retval = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting Storage cell start to %d\n", arg));
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting Storage cell start to %d\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// set & get
|
||||
if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) {
|
||||
if (arg > MAX_STORAGE_CELL_VAL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Max Storage cell number should not exceed 15\n");
|
||||
FILE_LOG(logERROR, (mess));
|
||||
} else {
|
||||
retval = selectStoragecellStart(arg);
|
||||
FILE_LOG(logDEBUG1, ("Storage cell start: %d\n", retval));
|
||||
validate(arg, retval, "set storage cell start", 0);
|
||||
}
|
||||
// set & get
|
||||
if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) {
|
||||
if (arg > MAX_STORAGE_CELL_VAL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Max Storage cell number should not exceed 15\n");
|
||||
FILE_LOG(logERROR, (mess));
|
||||
} else {
|
||||
retval = selectStoragecellStart(arg);
|
||||
FILE_LOG(logDEBUG1, ("Storage cell start: %d\n", retval));
|
||||
validate(arg, retval, "set storage cell start", 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval));
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "sls_detector_defs.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
// initialization functions
|
||||
int printSocketReadError();
|
||||
|
@ -1430,8 +1430,9 @@ int slsDetector::updateDetector() {
|
||||
|
||||
if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) {
|
||||
ret = thisDetectorControl->Client_Send(fnum, NULL, 0, NULL, 0);
|
||||
// no ret handling as ret never fail
|
||||
updateDetectorNoWait();
|
||||
// if it returns ok (jungfrau in programming mode), dont update
|
||||
if (ret == FORCE_UPDATE)
|
||||
ret = updateDetectorNoWait();
|
||||
disconnectControl();
|
||||
}
|
||||
return ret;
|
||||
@ -4122,7 +4123,8 @@ int slsDetector::programFPGA(std::string fname) {
|
||||
//erasing flash
|
||||
if (ret != FAIL) {
|
||||
FILE_LOG(logINFO) << "This can take awhile. Please be patient...";
|
||||
printf("Erasing Flash: %d%%\r", 0);
|
||||
FILE_LOG(logINFO) << "Erasing Flash:";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
//erasing takes 65 seconds, printing here (otherwise need threads
|
||||
//in server-unnecessary)
|
||||
@ -4131,12 +4133,13 @@ int slsDetector::programFPGA(std::string fname) {
|
||||
while(count > 0) {
|
||||
usleep(1 * 1000 * 1000);
|
||||
--count;
|
||||
printf("Erasing Flash:%d%%\r",
|
||||
printf("%d%%\r",
|
||||
(int) (((double)(ERASE_TIME - count) / ERASE_TIME) * 100));
|
||||
std::cout << std::flush;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
printf("Writing to Flash:%d%%\r", 0);
|
||||
printf("\n");
|
||||
FILE_LOG(logINFO) << "Writing to Flash:";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
}
|
||||
|
||||
@ -4160,16 +4163,17 @@ int slsDetector::programFPGA(std::string fname) {
|
||||
currentPointer += unitprogramsize;
|
||||
|
||||
//print progress
|
||||
printf("Writing to Flash:%d%%\r",
|
||||
printf("%d%%\r",
|
||||
(int) (((double)(totalsize - filesize) / totalsize) * 100));
|
||||
std::cout << std::flush;
|
||||
} else {
|
||||
printf("\n");
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
FILE_LOG(logERROR) << "Detector returned error: " << mess;
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
}
|
||||
}
|
||||
std::cout << std::endl;
|
||||
printf("\n");
|
||||
|
||||
//check ending error
|
||||
if ((ret == FAIL) &&
|
||||
|
@ -31,9 +31,9 @@ if (USE_HDF5)
|
||||
endif (USE_HDF5)
|
||||
|
||||
|
||||
add_definitions(
|
||||
-DDACS_INT -DSLS_RECEIVER_UDP_FUNCTIONS
|
||||
)
|
||||
#add_definitions(
|
||||
# -DVERBOSE
|
||||
#)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
|
@ -82,7 +82,7 @@ void slsReceiverImplementation::InitializeMembers() {
|
||||
|
||||
//***connection parameters***
|
||||
strcpy(eth,"");
|
||||
for(int i=0;i<MAX_NUMBER_OF_LISTENING_THREADS;i++){
|
||||
for(int i=0;i<MAX_NUMBER_OF_LISTENING_THREADS;i++) {
|
||||
udpPortNum[i] = DEFAULT_UDP_PORTNO + i;
|
||||
}
|
||||
udpSocketBufferSize = 0;
|
||||
@ -205,7 +205,7 @@ uint64_t slsReceiverImplementation::getTotalFramesCaught() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (const auto& it : dataProcessor){
|
||||
for (const auto& it : dataProcessor) {
|
||||
flagsum += it->GetMeasurementStartedFlag();
|
||||
sum += it->GetNumTotalFramesCaught();
|
||||
}
|
||||
@ -220,7 +220,7 @@ uint64_t slsReceiverImplementation::getFramesCaught() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (const auto& it : dataProcessor){
|
||||
for (const auto& it : dataProcessor) {
|
||||
flagsum += it->GetMeasurementStartedFlag();
|
||||
sum += it->GetNumFramesCaught();
|
||||
}
|
||||
@ -235,7 +235,7 @@ int64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (const auto& it : dataProcessor){
|
||||
for (const auto& it : dataProcessor) {
|
||||
flagsum += it->GetMeasurementStartedFlag();
|
||||
sum += it->GetActualProcessedAcquisitionIndex();
|
||||
}
|
||||
@ -385,7 +385,7 @@ uint32_t slsReceiverImplementation::getActualUDPSocketBufferSize() const {
|
||||
|
||||
/**initial parameters***/
|
||||
|
||||
void slsReceiverImplementation::setDetectorHostname(const char *c){
|
||||
void slsReceiverImplementation::setDetectorHostname(const char *c) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
if(strlen(c))
|
||||
@ -411,7 +411,7 @@ void slsReceiverImplementation::setMultiDetectorSize(const int* size) {
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFlippedData(int axis, int enable){
|
||||
void slsReceiverImplementation::setFlippedData(int axis, int enable) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
if(axis<0 || axis>1)
|
||||
return;
|
||||
@ -436,8 +436,8 @@ int slsReceiverImplementation::setGapPixelsEnable(const bool b) {
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFileFormat(const fileFormat f){
|
||||
switch(f){
|
||||
void slsReceiverImplementation::setFileFormat(const fileFormat f) {
|
||||
switch(f) {
|
||||
#ifdef HDF5C
|
||||
case HDF5:
|
||||
fileFormatType = HDF5;
|
||||
@ -455,7 +455,7 @@ void slsReceiverImplementation::setFileFormat(const fileFormat f){
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFileName(const char c[]){
|
||||
void slsReceiverImplementation::setFileName(const char c[]) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
if(strlen(c))
|
||||
@ -464,11 +464,11 @@ void slsReceiverImplementation::setFileName(const char c[]){
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFilePath(const char c[]){
|
||||
void slsReceiverImplementation::setFilePath(const char c[]) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
|
||||
if(strlen(c)){
|
||||
if(strlen(c)) {
|
||||
//check if filepath exists
|
||||
struct stat st;
|
||||
if(stat(c,&st) == 0)
|
||||
@ -480,7 +480,7 @@ void slsReceiverImplementation::setFilePath(const char c[]){
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFileIndex(const uint64_t i){
|
||||
void slsReceiverImplementation::setFileIndex(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
fileIndex = i;
|
||||
@ -488,7 +488,7 @@ void slsReceiverImplementation::setFileIndex(const uint64_t i){
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFramesPerFile(const uint32_t i){
|
||||
void slsReceiverImplementation::setFramesPerFile(const uint32_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
framesPerFile = i;
|
||||
@ -496,7 +496,7 @@ void slsReceiverImplementation::setFramesPerFile(const uint32_t i){
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i){
|
||||
void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
if (i >= 0 && i < NUM_DISCARD_POLICIES)
|
||||
@ -506,7 +506,7 @@ void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFramePaddingEnable(const bool i){
|
||||
void slsReceiverImplementation::setFramePaddingEnable(const bool i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
framePadding = i;
|
||||
@ -514,8 +514,8 @@ void slsReceiverImplementation::setFramePaddingEnable(const bool i){
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFileWriteEnable(const bool b){
|
||||
if (fileWriteEnable != b){
|
||||
void slsReceiverImplementation::setFileWriteEnable(const bool b) {
|
||||
if (fileWriteEnable != b) {
|
||||
fileWriteEnable = b;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
dataProcessor[i]->SetupFileWriter(fileWriteEnable, (int*)numDet,
|
||||
@ -529,7 +529,7 @@ void slsReceiverImplementation::setFileWriteEnable(const bool b){
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setOverwriteEnable(const bool b){
|
||||
void slsReceiverImplementation::setOverwriteEnable(const bool b) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
overwriteEnable = b;
|
||||
@ -538,21 +538,21 @@ void slsReceiverImplementation::setOverwriteEnable(const bool b){
|
||||
|
||||
|
||||
/***connection parameters***/
|
||||
void slsReceiverImplementation::setUDPPortNumber(const uint32_t i){
|
||||
void slsReceiverImplementation::setUDPPortNumber(const uint32_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
udpPortNum[0] = i;
|
||||
FILE_LOG(logINFO) << "UDP Port Number[0]: " << udpPortNum[0];
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setUDPPortNumber2(const uint32_t i){
|
||||
void slsReceiverImplementation::setUDPPortNumber2(const uint32_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
udpPortNum[1] = i;
|
||||
FILE_LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1];
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setEthernetInterface(const char* c){
|
||||
void slsReceiverImplementation::setEthernetInterface(const char* c) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
strcpy(eth, c);
|
||||
@ -635,7 +635,7 @@ int slsReceiverImplementation::setStreamingFrequency(const uint32_t freq) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setStreamingTimer(const uint32_t time_in_ms){
|
||||
void slsReceiverImplementation::setStreamingTimer(const uint32_t time_in_ms) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
streamingTimerInMs = time_in_ms;
|
||||
@ -680,21 +680,21 @@ void slsReceiverImplementation::setStreamingPort(const uint32_t i) {
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setStreamingSourceIP(const char c[]){
|
||||
void slsReceiverImplementation::setStreamingSourceIP(const char c[]) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
strcpy(streamingSrcIP, c);
|
||||
FILE_LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP;
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setAdditionalJsonHeader(const char c[]){
|
||||
void slsReceiverImplementation::setAdditionalJsonHeader(const char c[]) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
strcpy(additionalJsonHeader, c);
|
||||
FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader;
|
||||
}
|
||||
|
||||
|
||||
int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||
int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionPeriod = i;
|
||||
@ -704,7 +704,7 @@ int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||
return OK;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setAcquisitionTime(const uint64_t i){
|
||||
int slsReceiverImplementation::setAcquisitionTime(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionTime = i;
|
||||
@ -714,21 +714,21 @@ int slsReceiverImplementation::setAcquisitionTime(const uint64_t i){
|
||||
return OK;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setSubExpTime(const uint64_t i){
|
||||
void slsReceiverImplementation::setSubExpTime(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
subExpTime = i;
|
||||
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime/(1E9) << "s";
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setSubPeriod(const uint64_t i){
|
||||
void slsReceiverImplementation::setSubPeriod(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
subPeriod = i;
|
||||
FILE_LOG(logINFO) << "Sub Exposure Period: " << (double)subPeriod/(1E9) << "s";
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setNumberOfFrames(const uint64_t i){
|
||||
int slsReceiverImplementation::setNumberOfFrames(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
numberOfFrames = i;
|
||||
@ -794,7 +794,7 @@ int slsReceiverImplementation::setFifoDepth(const uint32_t i) {
|
||||
|
||||
|
||||
/***receiver parameters***/
|
||||
bool slsReceiverImplementation::setActivate(bool enable){
|
||||
bool slsReceiverImplementation::setActivate(bool enable) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
activated = enable;
|
||||
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
|
||||
@ -802,14 +802,14 @@ bool slsReceiverImplementation::setActivate(bool enable){
|
||||
}
|
||||
|
||||
|
||||
bool slsReceiverImplementation::setDeactivatedPadding(bool enable){
|
||||
bool slsReceiverImplementation::setDeactivatedPadding(bool enable) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
deactivatedPaddingEnable = enable;
|
||||
FILE_LOG(logINFO) << "Deactivated Padding Enable: " << stringEnable(deactivatedPaddingEnable);
|
||||
return deactivatedPaddingEnable;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setSilentMode(const bool i){
|
||||
void slsReceiverImplementation::setSilentMode(const bool i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
silentMode = i;
|
||||
@ -902,7 +902,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
|
||||
|
||||
|
||||
void slsReceiverImplementation::setDetectorPositionId(const int i){
|
||||
void slsReceiverImplementation::setDetectorPositionId(const int i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
detID = i;
|
||||
FILE_LOG(logINFO) << "Detector Position Id:" << detID;
|
||||
@ -983,7 +983,7 @@ int slsReceiverImplementation::startReceiver(char *c) {
|
||||
|
||||
|
||||
|
||||
void slsReceiverImplementation::stopReceiver(){
|
||||
void slsReceiverImplementation::stopReceiver() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
FILE_LOG(logINFO) << "Stopping Receiver";
|
||||
|
||||
@ -1061,9 +1061,9 @@ void slsReceiverImplementation::stopReceiver(){
|
||||
|
||||
|
||||
|
||||
void slsReceiverImplementation::startReadout(){
|
||||
void slsReceiverImplementation::startReadout() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
if(status == RUNNING){
|
||||
if(status == RUNNING) {
|
||||
// wait for incoming delayed packets
|
||||
int totalPacketsReceived = 0;
|
||||
int previousValue=-1;
|
||||
@ -1071,9 +1071,9 @@ void slsReceiverImplementation::startReadout(){
|
||||
totalPacketsReceived += it->GetPacketsCaught();
|
||||
|
||||
//wait for all packets
|
||||
const auto numPacketsToReceive = numberOfFrames * generalData->packetsPerFrame * listener.size();
|
||||
if(totalPacketsReceived != numPacketsToReceive){
|
||||
while(totalPacketsReceived != previousValue){
|
||||
const int numPacketsToReceive = numberOfFrames * generalData->packetsPerFrame * listener.size();
|
||||
if(totalPacketsReceived != numPacketsToReceive) {
|
||||
while(totalPacketsReceived != previousValue) {
|
||||
FILE_LOG(logDEBUG3) << "waiting for all packets, previousValue:" << previousValue <<
|
||||
" totalPacketsReceived: " << totalPacketsReceived;
|
||||
usleep(5*1000);/* TODO! Need to find optimal time **/
|
||||
@ -1119,7 +1119,7 @@ void slsReceiverImplementation::closeFiles() {
|
||||
int slsReceiverImplementation::restreamStop() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
bool ret = OK;
|
||||
for (const auto& it : dataStreamer){
|
||||
for (const auto& it : dataStreamer) {
|
||||
if (it->RestreamStop() == FAIL)
|
||||
ret = FAIL;
|
||||
}
|
||||
@ -1134,24 +1134,24 @@ int slsReceiverImplementation::restreamStop() {
|
||||
|
||||
|
||||
/***callback functions***/
|
||||
void slsReceiverImplementation::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg){
|
||||
void slsReceiverImplementation::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg) {
|
||||
startAcquisitionCallBack=func;
|
||||
pStartAcquisition=arg;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg){
|
||||
void slsReceiverImplementation::registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg) {
|
||||
acquisitionFinishedCallBack=func;
|
||||
pAcquisitionFinished=arg;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::registerCallBackRawDataReady(void (*func)(char* ,
|
||||
char*, uint32_t, void*),void *arg){
|
||||
char*, uint32_t, void*),void *arg) {
|
||||
rawDataReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::registerCallBackRawDataModifyReady(void (*func)(char* ,
|
||||
char*, uint32_t&, void*),void *arg){
|
||||
char*, uint32_t&, void*),void *arg) {
|
||||
rawDataModifyReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
@ -1187,7 +1187,7 @@ void slsReceiverImplementation::SetLocalNetworkParameters() {
|
||||
void slsReceiverImplementation::SetThreadPriorities() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
for (const auto& it : listener){
|
||||
for (const auto& it : listener) {
|
||||
if (it->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "Could not prioritize listener threads. (No Root Privileges?)";
|
||||
return;
|
||||
@ -1288,15 +1288,15 @@ int slsReceiverImplementation::SetupWriter() {
|
||||
void slsReceiverImplementation::StartRunning() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
//set running mask and post semaphore to start the inner loop in execution thread
|
||||
for (const auto& it : listener){
|
||||
for (const auto& it : listener) {
|
||||
it->StartRunning();
|
||||
it->Continue();
|
||||
}
|
||||
for (const auto& it : dataProcessor){
|
||||
for (const auto& it : dataProcessor) {
|
||||
it->StartRunning();
|
||||
it->Continue();
|
||||
}
|
||||
for (const auto& it : dataStreamer){
|
||||
for (const auto& it : dataStreamer) {
|
||||
it->StartRunning();
|
||||
it->Continue();
|
||||
}
|
||||
|
@ -689,8 +689,9 @@ public:
|
||||
if(nsent == header_packet_size)
|
||||
continue;
|
||||
if(nsent != nsending){
|
||||
if(nsent && (nsent != -1))
|
||||
if(nsent && (nsent != -1)) {
|
||||
FILE_LOG(logERROR) << "Incomplete Packet size " << nsent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
length-=nsent;
|
||||
@ -707,8 +708,9 @@ public:
|
||||
if(nsent<=0 || nsent == packet_size)
|
||||
break;
|
||||
//incomplete packets or header packets ignored and read buffer again
|
||||
if(nsent != packet_size && nsent != header_packet_size)
|
||||
if(nsent != packet_size && nsent != header_packet_size) {
|
||||
FILE_LOG(logERROR) << portno << ": Incomplete Packet size " << nsent;
|
||||
}
|
||||
}
|
||||
//nsent = 1040;
|
||||
if(nsent > 0)total_sent+=nsent;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** API versions */
|
||||
#define APIRECEIVER 0x180927
|
||||
#define APIEIGER 0x181008
|
||||
#define APIJUNGFRAU 0x181008
|
||||
#define APIEIGER 0x181031
|
||||
#define APIJUNGFRAU 0x181102
|
||||
#define APIGOTTHARD 0x181009
|
||||
|
||||
|
Reference in New Issue
Block a user