mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 12:27:14 +02:00
gotthard2:hv
This commit is contained in:
@ -4,7 +4,8 @@ add_executable(gotthard2DetectorServer_virtual
|
|||||||
../slsDetectorServer/src/slsDetectorServer_funcs.c
|
../slsDetectorServer/src/slsDetectorServer_funcs.c
|
||||||
../slsDetectorServer/src/communication_funcs.c
|
../slsDetectorServer/src/communication_funcs.c
|
||||||
../slsDetectorServer/src/blackfin.c
|
../slsDetectorServer/src/blackfin.c
|
||||||
../slsDetectorServer/src/communication_funcs_UDP.c
|
../slsDetectorServer/src/communication_funcs_UDP.c
|
||||||
|
../slsDetectorServer/src/DAC6571.c
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
|||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
SRCS = slsDetectorFunctionList.c
|
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)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -2,6 +2,8 @@
|
|||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "blackfin.h"
|
#include "blackfin.h"
|
||||||
|
#include "DAC6571.h"
|
||||||
|
#include "common.h"
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
#include "communication_funcs_UDP.h"
|
#include "communication_funcs_UDP.h"
|
||||||
#endif
|
#endif
|
||||||
@ -29,6 +31,7 @@ int virtual_status = 0;
|
|||||||
int virtual_stop = 0;
|
int virtual_stop = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int highvoltage = 0;
|
||||||
|
|
||||||
|
|
||||||
int isFirmwareCheckDone() {
|
int isFirmwareCheckDone() {
|
||||||
@ -57,6 +60,8 @@ void basictests() {
|
|||||||
firmware_check_done = 1;
|
firmware_check_done = 1;
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
|
// faking it
|
||||||
|
firmware_check_done = 1;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -173,6 +178,10 @@ void initStopServer() {
|
|||||||
void setupDetector() {
|
void setupDetector() {
|
||||||
FILE_LOG(logINFO, ("This Server is for 1 Gotthard2 module \n"));
|
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
|
//Initialization of acquistion parameters
|
||||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
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) {
|
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
char cDestIp[MAX_STR_LENGTH];
|
char cDestIp[MAX_STR_LENGTH];
|
||||||
|
@ -5,14 +5,22 @@
|
|||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
|
|
||||||
|
/* Enums */
|
||||||
|
enum DACINDEX {DAC0};
|
||||||
|
|
||||||
/* Hardware Definitions */
|
/* Hardware Definitions */
|
||||||
#define NCHAN (128)
|
#define NCHAN (128)
|
||||||
#define NCHIP (10)
|
#define NCHIP (10)
|
||||||
#define NDAC (16)
|
#define NDAC (16)
|
||||||
#define TEMP_CLK (20) /* MHz */
|
#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 */
|
/** Default Parameters */
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
#define DEFAULT_NUM_FRAMES (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
|
#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)
|
@ -215,7 +215,7 @@ void powerOff();
|
|||||||
int getADC(enum ADCINDEX ind);
|
int getADC(enum ADCINDEX ind);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
#if !defined(MYTHEN3D)
|
||||||
int setHighVoltage(int val);
|
int setHighVoltage(int val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
/* DAC6571 HV DEFINES */
|
/* DAC6571 HV DEFINES */
|
||||||
#define DAC6571_MIN_DAC_VAL (0x0)
|
#define DAC6571_MIN_DAC_VAL (0x0)
|
||||||
#define DAC6571_MAX_DAC_VAL (0x3FF)
|
#define DAC6571_MAX_DAC_VAL (0x3FF)
|
||||||
@ -42,7 +44,7 @@ int DAC6571_Set (int val) {
|
|||||||
//open file
|
//open file
|
||||||
FILE* fd=fopen(DAC6571_DriverFileName,"w");
|
FILE* fd=fopen(DAC6571_DriverFileName,"w");
|
||||||
if (fd==NULL) {
|
if (fd==NULL) {
|
||||||
FILE_LOG(logERROR, ("Could not open file for writing to set high voltage\n"));
|
FILE_LOG(logERROR, ("Could not open file %s for writing to set high voltage\n", DAC6571_DriverFileName));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
//convert to string, add 0 and write to file
|
//convert to string, add 0 and write to file
|
||||||
|
@ -654,7 +654,7 @@ int set_dac(int file_des) {
|
|||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
|
|
||||||
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
#if defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -779,6 +779,9 @@ int set_dac(int file_des) {
|
|||||||
case HIGH_VOLTAGE:
|
case HIGH_VOLTAGE:
|
||||||
case V_LIMIT:
|
case V_LIMIT:
|
||||||
break;
|
break;
|
||||||
|
#elif GOTTHARD2D
|
||||||
|
case HIGH_VOLTAGE:
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
@ -841,7 +844,7 @@ int set_dac(int file_des) {
|
|||||||
case HIGH_VOLTAGE:
|
case HIGH_VOLTAGE:
|
||||||
retval = setHighVoltage(val);
|
retval = setHighVoltage(val);
|
||||||
FILE_LOG(logDEBUG1, ("High Voltage: %d\n", retval));
|
FILE_LOG(logDEBUG1, ("High Voltage: %d\n", retval));
|
||||||
#if defined(JUNGFRAUD) || defined (CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(JUNGFRAUD) || defined (CHIPTESTBOARDD) || defined(MOENCHD) || defined(GOTTHARD2D)
|
||||||
validate(val, retval, "set high voltage", DEC);
|
validate(val, retval, "set high voltage", DEC);
|
||||||
#endif
|
#endif
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
@ -945,7 +948,10 @@ int set_dac(int file_des) {
|
|||||||
validate(val, retval, "set vlimit", DEC);
|
validate(val, retval, "set vlimit", DEC);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
#elif
|
||||||
// dacs
|
// dacs
|
||||||
default:
|
default:
|
||||||
if (mV && val > DAC_MAX_MV) {
|
if (mV && val > DAC_MAX_MV) {
|
||||||
@ -1001,6 +1007,7 @@ int set_dac(int file_des) {
|
|||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("Dac (%d): %d %s\n\n", serverDacIndex, retval, (mV ? "mV" : "dac units")));
|
FILE_LOG(logDEBUG1, ("Dac (%d): %d %s\n\n", serverDacIndex, retval, (mV ? "mV" : "dac units")));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
#define APIJUNGFRAU 0x190830
|
#define APIJUNGFRAU 0x190830
|
||||||
#define APIMYTHEN3 0x190830
|
#define APIMYTHEN3 0x190830
|
||||||
#define APIEIGER 0x190830
|
#define APIEIGER 0x190830
|
||||||
#define APIGOTTHARD2 0x190830
|
#define APIGOTTHARD2 0x190902
|
||||||
|
Reference in New Issue
Block a user