gotthard2:hv

This commit is contained in:
2019-09-02 12:57:24 +02:00
parent 4a112104ad
commit bd95126da2
9 changed files with 54 additions and 9 deletions

View File

@ -4,7 +4,8 @@ add_executable(gotthard2DetectorServer_virtual
../slsDetectorServer/src/slsDetectorServer_funcs.c
../slsDetectorServer/src/communication_funcs.c
../slsDetectorServer/src/blackfin.c
../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/DAC6571.c
)
include_directories(

View File

@ -12,7 +12,7 @@ DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)common.c $(main_src)DAC6571.c
OBJS = $(SRCS:.c=.o)

View File

@ -2,6 +2,8 @@
#include "versionAPI.h"
#include "clogger.h"
#include "blackfin.h"
#include "DAC6571.h"
#include "common.h"
#ifdef VIRTUAL
#include "communication_funcs_UDP.h"
#endif
@ -29,6 +31,7 @@ int virtual_status = 0;
int virtual_stop = 0;
#endif
int highvoltage = 0;
int isFirmwareCheckDone() {
@ -57,6 +60,8 @@ void basictests() {
firmware_check_done = 1;
return;
#else
// faking it
firmware_check_done = 1;
#endif
@ -173,6 +178,10 @@ void initStopServer() {
void setupDetector() {
FILE_LOG(logINFO, ("This Server is for 1 Gotthard2 module \n"));
// hv
DAC6571_SetDefines(HV_SOFT_MAX_VOLTAGE, HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
//Initialization of acquistion parameters
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
@ -286,6 +295,24 @@ int64_t getTimeLeft(enum timerIndex ind){
}
int setHighVoltage(int val){
#ifdef VIRTUAL
if (val >= 0)
highvoltage = val;
return highvoltage;
#endif
// setting hv
if (val >= 0) {
FILE_LOG(logINFO, ("Setting High voltage: %d V", val));
DAC6571_Set(val);
highvoltage = val;
}
return highvoltage;
}
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport) {
#ifdef VIRTUAL
char cDestIp[MAX_STR_LENGTH];

View File

@ -5,14 +5,22 @@
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
/* Enums */
enum DACINDEX {DAC0};
/* Hardware Definitions */
#define NCHAN (128)
#define NCHIP (10)
#define NDAC (16)
#define TEMP_CLK (20) /* MHz */
#define HV_SOFT_MAX_VOLTAGE (200)
#define HV_HARD_MAX_VOLTAGE (530)
#define HV_DRIVER_FILE_NAME ("/root/devlinks/hvdac")
/** Default Parameters */
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
#define DEFAULT_PERIOD (1 * 1000 * 1000 * 1000) // 1 s
#define DEFAULT_PERIOD (1 * 1000 * 1000 * 1000) // 1 s
#define DEFAULT_HIGH_VOLTAGE (0)