mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
wip
This commit is contained in:
@ -998,7 +998,7 @@ int Feb_Control_StartAcquisition() {
|
||||
|
||||
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
||||
|
||||
int Feb_Control_SoftwareTrigger() {
|
||||
int Feb_Control_SoftwareTrigger(int block) {
|
||||
if (Feb_Control_activated) {
|
||||
// read exp toggle value
|
||||
unsigned int value = 0;
|
||||
@ -1063,10 +1063,12 @@ int Feb_Control_SoftwareTrigger() {
|
||||
}
|
||||
|
||||
// wait for toggle for exposure to be done
|
||||
while (toggle == prev_toggle) {
|
||||
usleep(5000);
|
||||
toggle = ((value & FEB_REG_STATUS_EXP_TGL_MSK) >>
|
||||
FEB_REG_STATUS_EXP_TGL_OFST);
|
||||
if (block) {
|
||||
while (toggle == prev_toggle) {
|
||||
usleep(5000);
|
||||
toggle = ((value & FEB_REG_STATUS_EXP_TGL_MSK) >>
|
||||
FEB_REG_STATUS_EXP_TGL_OFST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -55,7 +55,7 @@ int Feb_Control_PrepareForAcquisition();
|
||||
void Feb_Control_PrintAcquisitionSetup();
|
||||
int Feb_Control_StartAcquisition();
|
||||
int Feb_Control_StopAcquisition();
|
||||
int Feb_Control_SoftwareTrigger();
|
||||
int Feb_Control_SoftwareTrigger(int block);
|
||||
|
||||
// parameters
|
||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||
|
@ -2404,12 +2404,12 @@ int stopStateMachine() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int softwareTrigger() {
|
||||
int softwareTrigger(int block) {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#else
|
||||
sharedMemory_lockLocalLink();
|
||||
if (!Feb_Control_SoftwareTrigger()) {
|
||||
if (!Feb_Control_SoftwareTrigger(block)) {
|
||||
sharedMemory_unlockLocalLink();
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "blackfin.h"
|
||||
#endif
|
||||
|
||||
#if defined(MYTHEN3D)
|
||||
#if defined(MYTHEN3D)
|
||||
#include "mythen3.h"
|
||||
#endif
|
||||
|
||||
@ -360,7 +360,7 @@ int isMaster();
|
||||
int setGainCaps(int caps);
|
||||
int getGainCaps();
|
||||
int setChipStatusRegister(int csr);
|
||||
int setDACS(int* dacs);
|
||||
int setDACS(int *dacs);
|
||||
#endif
|
||||
#if defined(GOTTHARDD) || defined(MYTHEN3D)
|
||||
void setExtSignal(int signalIndex, enum externalSignalFlag mode);
|
||||
@ -576,9 +576,12 @@ int startStateMachine();
|
||||
void *start_timer(void *arg);
|
||||
#endif
|
||||
int stopStateMachine();
|
||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||
#ifdef MYTHEN3D
|
||||
int softwareTrigger();
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
int softwareTrigger(int block);
|
||||
#endif
|
||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||
int startReadOut();
|
||||
#endif
|
||||
|
@ -642,9 +642,9 @@ int set_timing_mode(int file_des) {
|
||||
}
|
||||
// get
|
||||
retval = getTiming();
|
||||
#ifndef MYTHEN3D
|
||||
#ifndef MYTHEN3D
|
||||
validate((int)arg, (int)retval, "set timing mode", DEC);
|
||||
#endif
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Timing Mode: %d\n", retval));
|
||||
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
@ -1552,7 +1552,7 @@ int set_module(int file_des) {
|
||||
// check index
|
||||
|
||||
#if !(defined(EIGERD) || defined(MYTHEN3D))
|
||||
//TODO! Check if this is used for any detector
|
||||
// TODO! Check if this is used for any detector
|
||||
switch (module.reg) {
|
||||
#ifdef JUNGFRAUD
|
||||
case DYNAMICGAIN:
|
||||
@ -4163,16 +4163,29 @@ int check_version(int file_des) {
|
||||
int software_trigger(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Software Trigger (block: %d\n", arg));
|
||||
|
||||
LOG(logDEBUG1, ("Software Trigger\n"));
|
||||
#if !defined(EIGERD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
if (arg && myDetectorType == MYTHEN3) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Blocking trigger not implemented for Mythen3. Please use non blocking trigger.\n");
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
else if (Server_VerifyLock() == OK) {
|
||||
#ifdef MYTHEN3
|
||||
ret = softwareTrigger();
|
||||
#else
|
||||
ret = softwareTrigger(arg);
|
||||
#endif
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not send software trigger\n");
|
||||
strcpy(mess, "Could not send software trigger\n");
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
LOG(logDEBUG1, ("Software trigger successful\n"));
|
||||
@ -7576,21 +7589,23 @@ int set_pattern(int file_des) {
|
||||
|
||||
patternParameters *pat = malloc(sizeof(patternParameters));
|
||||
memset(pat, 0, sizeof(patternParameters));
|
||||
// ignoring endianness for eiger
|
||||
// ignoring endianness for eiger
|
||||
if (receiveData(file_des, pat, sizeof(patternParameters), INT32) < 0) {
|
||||
if (pat != NULL)
|
||||
free(pat);
|
||||
return printSocketReadError();
|
||||
}
|
||||
|
||||
|
||||
if (Server_VerifyLock() == OK) {
|
||||
LOG(logINFO, ("Setting Pattern from structure\n"));
|
||||
LOG(logINFO,
|
||||
("Setting Pattern Word (printing every 10 words that are not 0\n"));
|
||||
/****************************************************************************************************************/
|
||||
/* I SUGGEST TO VALIDATE THE VALUES HERE AND THEN WRITE THE PATTERN IN A SEPARATE FUNCTION WHICH COULD BE REUSED*/
|
||||
/* added loadPattern.c/h - the same func could be reused also in readDefaultPattern */
|
||||
/***************************************************************************************************************/
|
||||
("Setting Pattern Word (printing every 10 words that are not 0\n"));
|
||||
/****************************************************************************************************************/
|
||||
/* I SUGGEST TO VALIDATE THE VALUES HERE AND THEN WRITE THE PATTERN IN A
|
||||
* SEPARATE FUNCTION WHICH COULD BE REUSED*/
|
||||
/* added loadPattern.c/h - the same func could be reused also in
|
||||
* readDefaultPattern */
|
||||
/***************************************************************************************************************/
|
||||
|
||||
for (int i = 0; i < MAX_PATTERN_LENGTH; ++i) {
|
||||
if ((i % 10 == 0) && pat->word[i] != 0) {
|
||||
@ -7664,7 +7679,7 @@ int set_pattern(int file_des) {
|
||||
}
|
||||
}
|
||||
}
|
||||
/******* DOWN TO HERE ***********/
|
||||
/******* DOWN TO HERE ***********/
|
||||
}
|
||||
if (pat != NULL)
|
||||
free(pat);
|
||||
@ -8372,7 +8387,7 @@ int get_all_threshold_energy(int file_des) {
|
||||
return Server_SendResult(file_des, INT32, retvals, sizeof(retvals));
|
||||
}
|
||||
|
||||
int get_master(int file_des){
|
||||
int get_master(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
@ -8387,7 +8402,7 @@ int get_master(int file_des){
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_csr(int file_des){
|
||||
int get_csr(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
@ -8402,7 +8417,7 @@ int get_csr(int file_des){
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_gain_caps(int file_des){
|
||||
int set_gain_caps(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = 0;
|
||||
@ -8418,14 +8433,14 @@ int set_gain_caps(int file_des){
|
||||
#else
|
||||
if (Server_VerifyLock() == OK) {
|
||||
setGainCaps(arg);
|
||||
retval = getChipStatusRegister(); //TODO! fix
|
||||
retval = getChipStatusRegister(); // TODO! fix
|
||||
LOG(logDEBUG1, ("gain caps retval: %u\n", retval));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_gain_caps(int file_des){
|
||||
int get_gain_caps(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
// int arg = 0;
|
||||
|
Reference in New Issue
Block a user