mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
wip
This commit is contained in:
Binary file not shown.
@ -253,12 +253,12 @@ int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
||||
int maxtimer = (MAX(MAX(l_txndelaycounter, l_framedelaycounter),
|
||||
MAX(r_txndelaycounter, r_framedelaycounter))) /
|
||||
100; // counter values in 10 ns
|
||||
printf("Will wait for %d us\n", maxtimer);
|
||||
printf("Beb: Will wait for %d us\n", maxtimer);
|
||||
usleep(maxtimer);
|
||||
}
|
||||
// wait for 1 ms
|
||||
else {
|
||||
printf("Will wait for 1 ms\n");
|
||||
printf("Beb: Will wait for 1 ms\n");
|
||||
usleep(1 * 1000);
|
||||
}
|
||||
|
||||
@ -1182,7 +1182,7 @@ int Beb_StopAcquisition() {
|
||||
// open file pointer
|
||||
int fd = Beb_open(&csp0base, XPAR_CMD_GENERATOR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Beb Stop Acquisition FAIL\n"));
|
||||
LOG(logERROR, ("Beb Reset FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
// find value
|
||||
@ -1199,7 +1199,7 @@ int Beb_StopAcquisition() {
|
||||
Beb_Write32(csp0base, (RIGHT_OFFSET + STOP_ACQ_OFFSET),
|
||||
(valuer & (~STOP_ACQ_BIT)));
|
||||
|
||||
LOG(logINFO, ("Beb Stop Acquisition OK\n"));
|
||||
LOG(logINFO, ("Beb: Reset done\n"));
|
||||
// close file pointer
|
||||
Beb_close(fd, csp0base);
|
||||
}
|
||||
|
@ -709,6 +709,32 @@ int Feb_Control_AcquisitionInProgress() {
|
||||
return STATUS_IDLE;
|
||||
}
|
||||
|
||||
int Feb_Control_ProcessingInProgress() {
|
||||
unsigned int regr = 0, regl = 0;
|
||||
// deactivated should return end of processing
|
||||
if (!Feb_Control_activated)
|
||||
return IDLE;
|
||||
|
||||
if (!Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS,
|
||||
®r)) {
|
||||
LOG(logERROR, ("Could not read right FEB_REG_STATUS to get feb "
|
||||
"processing status\n"));
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
||||
®l)) {
|
||||
LOG(logERROR, ("Could not read left FEB_REG_STATUS to get feb "
|
||||
"processing status\n"));
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
// processing done
|
||||
if ((regr | regl) & FEB_REG_STATUS_ACQ_DONE_MSK) {
|
||||
return STATUS_IDLE;
|
||||
}
|
||||
// processing running
|
||||
return STATUS_RUNNING;
|
||||
}
|
||||
|
||||
int Feb_Control_AcquisitionStartedBit() {
|
||||
unsigned int status_reg_r = 0, status_reg_l = 0;
|
||||
// deactivated should return acquisition started/ready
|
||||
@ -817,7 +843,7 @@ int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us) {
|
||||
}
|
||||
|
||||
int Feb_Control_Reset() {
|
||||
LOG(logINFO, ("Reset daq\n"));
|
||||
LOG(logINFO, ("Feb: Reset daq\n"));
|
||||
if (Feb_Control_activated) {
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CTRL, 0, 0, 0) ||
|
||||
@ -996,38 +1022,136 @@ int Feb_Control_StartAcquisition() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
||||
|
||||
int Feb_Control_SoftwareTrigger() {
|
||||
int Feb_Control_StopAcquisition() {
|
||||
if (Feb_Control_activated) {
|
||||
|
||||
// sends last frames from fifo
|
||||
unsigned int orig_value = 0;
|
||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CHIP_CMDS, &orig_value)) {
|
||||
LOG(logERROR, ("Could not read DAQ_REG_CHIP_CMDS to send software "
|
||||
"trigger\n"));
|
||||
DAQ_REG_CTRL, &orig_value)) {
|
||||
LOG(logERROR, ("Could not read DAQ_REG_CTRL to stop acquisition "
|
||||
"(send complete frames)\n"));
|
||||
return 0;
|
||||
}
|
||||
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CTRL,
|
||||
orig_value | DAQ_CTRL_STOP, 0, 0)) {
|
||||
LOG(logERROR, ("Could not send last frames.\n"));
|
||||
return 0;
|
||||
}
|
||||
LOG(logINFO, ("Feb: Command to Flush out images from fifo\n"));
|
||||
|
||||
// set trigger bit
|
||||
LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd));
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CHIP_CMDS, cmd, 0, 0)) {
|
||||
LOG(logERROR, ("Could not give software trigger\n"));
|
||||
return 0;
|
||||
// wait for feb processing to be done
|
||||
int is_processing = Feb_Control_ProcessingInProgress();
|
||||
int check_error = 0;
|
||||
while (is_processing != STATUS_IDLE) {
|
||||
usleep(500);
|
||||
is_processing = Feb_Control_ProcessingInProgress();
|
||||
|
||||
// check error only 5 times (ensuring it is not something that
|
||||
// happens sometimes)
|
||||
if (is_processing == STATUS_ERROR) {
|
||||
if (check_error == 5)
|
||||
break;
|
||||
check_error++;
|
||||
} // reset check_error for next time
|
||||
else
|
||||
check_error = 0;
|
||||
}
|
||||
// unset trigger bit
|
||||
LOG(logDEBUG1, ("Unsetting Trigger, Register:0x%x\n", orig_value));
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CHIP_CMDS, orig_value, 0, 0)) {
|
||||
LOG(logERROR, ("Could not give software trigger\n"));
|
||||
return 0;
|
||||
}
|
||||
LOG(logINFO, ("Software Internal Trigger Sent!\n"));
|
||||
LOG(logINFO, ("Feb: Processing done (to stop acq)\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Feb_Control_IsReadyForTrigger(int *readyForTrigger) {
|
||||
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
|
||||
unsigned int value[2] = {0, 0};
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (!Feb_Interface_ReadRegister(addr[i], FEB_REG_STATUS, &value[i])) {
|
||||
LOG(logERROR, ("Could not read %s FEB_REG_STATUS reg\n",
|
||||
(i == 0 ? "left" : "right")));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*readyForTrigger =
|
||||
((value[0] | value[1]) & FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Feb_Control_SendSoftwareTrigger() {
|
||||
// read old value in register
|
||||
unsigned int orig_value = 0;
|
||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CHIP_CMDS, &orig_value)) {
|
||||
LOG(logERROR, ("Could not read DAQ_REG_CHIP_CMDS to send software "
|
||||
"trigger\n"));
|
||||
return 0;
|
||||
}
|
||||
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
|
||||
|
||||
// set trigger bit
|
||||
LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd));
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CHIP_CMDS, cmd, 0, 0)) {
|
||||
LOG(logERROR, ("Could not give software trigger\n"));
|
||||
return 0;
|
||||
}
|
||||
// unset trigger bit
|
||||
LOG(logDEBUG1, ("Unsetting Trigger, Register:0x%x\n", orig_value));
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||
DAQ_REG_CHIP_CMDS, orig_value, 0, 0)) {
|
||||
LOG(logERROR, ("Could not give software trigger\n"));
|
||||
return 0;
|
||||
}
|
||||
LOG(logINFO, ("Software Internal Trigger Sent!\n"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Feb_Control_SoftwareTrigger(int block) {
|
||||
if (Feb_Control_activated) {
|
||||
// cant read reg
|
||||
int readyForTrigger = 0;
|
||||
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||
LOG(logERROR, ("Could not read FEB_REG_STATUS reg!\n"));
|
||||
return 0;
|
||||
}
|
||||
// if not ready for trigger, throw
|
||||
if (!readyForTrigger) {
|
||||
LOG(logWARNING, ("Not yet ready for trigger!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// send trigger to both fpgas
|
||||
Feb_Control_SendSoftwareTrigger();
|
||||
|
||||
// wait for next trigger ready
|
||||
if (block) {
|
||||
LOG(logINFO, ("Blocking Software Trigger\n"));
|
||||
int readyForTrigger = 0;
|
||||
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after giving "
|
||||
"trigger!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (!readyForTrigger) {
|
||||
usleep(5000);
|
||||
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after "
|
||||
"giving trigger!\n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Done waiting (wait for trigger)!\n"));
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// parameters
|
||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo) {
|
||||
static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM |
|
||||
@ -1883,15 +2007,15 @@ int Feb_Control_GetLeftFPGATemp() {
|
||||
if (!Feb_Control_activated) {
|
||||
return 0;
|
||||
}
|
||||
unsigned int temperature = 0;
|
||||
unsigned int value = 0;
|
||||
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
||||
&temperature)) {
|
||||
&value)) {
|
||||
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
|
||||
"temperature\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
temperature = temperature >> 16;
|
||||
unsigned int temperature =
|
||||
((value & FEB_REG_STATUS_TEMP_MSK) >> FEB_REG_STATUS_TEMP_OFST);
|
||||
temperature =
|
||||
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
|
||||
1000; // Static conversation, copied from xps sysmon standalone driver
|
||||
|
@ -40,6 +40,7 @@ unsigned int *Feb_Control_GetTrimbits();
|
||||
|
||||
// acquisition
|
||||
int Feb_Control_AcquisitionInProgress();
|
||||
int Feb_Control_ProcessingInProgress();
|
||||
int Feb_Control_AcquisitionStartedBit();
|
||||
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
||||
int Feb_Control_WaitForFinishedFlag(int sleep_time_us, int tempLock);
|
||||
@ -55,7 +56,9 @@ int Feb_Control_PrepareForAcquisition();
|
||||
void Feb_Control_PrintAcquisitionSetup();
|
||||
int Feb_Control_StartAcquisition();
|
||||
int Feb_Control_StopAcquisition();
|
||||
int Feb_Control_SoftwareTrigger();
|
||||
int Feb_Control_IsReadyForTrigger(int *readyForTrigger);
|
||||
int Feb_Control_SendSoftwareTrigger();
|
||||
int Feb_Control_SoftwareTrigger(int block);
|
||||
|
||||
// parameters
|
||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||
|
@ -30,7 +30,16 @@
|
||||
|
||||
#define DAQ_REG_RO_OFFSET 20
|
||||
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) // also pg and fifo status register
|
||||
|
||||
#define FEB_REG_STATUS (DAQ_REG_RO_OFFSET + 3)
|
||||
|
||||
#define FEB_REG_STATUS_WAIT_FOR_TRGGR_OFST (5)
|
||||
#define FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FEB_REG_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||
#define FEB_REG_STATUS_ACQ_DONE_OFST (6)
|
||||
#define FEB_REG_STATUS_ACQ_DONE_MSK (0x00000001 << FEB_REG_STATUS_ACQ_DONE_OFST)
|
||||
#define FEB_REG_STATUS_TEMP_OFST (16)
|
||||
#define FEB_REG_STATUS_TEMP_MSK (0x0000FFFF << FEB_REG_STATUS_TEMP_OFST)
|
||||
|
||||
#define MEAS_SUBPERIOD_REG (DAQ_REG_RO_OFFSET + 4)
|
||||
#define MEAS_PERIOD_REG (DAQ_REG_RO_OFFSET + 5)
|
||||
// clang-format on
|
||||
@ -38,7 +47,8 @@
|
||||
#define DAQ_CTRL_RESET 0x80000000
|
||||
#define DAQ_CTRL_START 0x40000000
|
||||
#define ACQ_CTRL_START 0x50000000 // this is 0x10000000 (acq) | 0x40000000 (daq)
|
||||
#define DAQ_CTRL_STOP 0x00000000
|
||||
#define DAQ_CTRL_STOP 0x08000000 // sends last complete frame
|
||||
#define DAQ_CTRL_DONE 0x00000040 // data processing done in feb
|
||||
|
||||
// direct chip commands to the DAQ_REG_CHIP_CMDS register
|
||||
#define DAQ_SET_STATIC_BIT 0x00000001
|
||||
|
Binary file not shown.
@ -46,7 +46,6 @@ int on_dst = 0;
|
||||
int dst_requested[32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
enum masterFlags masterMode = IS_SLAVE;
|
||||
int top = 0;
|
||||
int master = 0;
|
||||
int normal = 0;
|
||||
@ -1415,6 +1414,8 @@ int setHighVoltage(int val) {
|
||||
|
||||
/* parameters - timing, extsig */
|
||||
|
||||
int isMaster() { return master; }
|
||||
|
||||
void setTiming(enum timingMode arg) {
|
||||
int ret = 0;
|
||||
switch (arg) {
|
||||
@ -2444,29 +2445,53 @@ int stopStateMachine() {
|
||||
return OK;
|
||||
#else
|
||||
sharedMemory_lockLocalLink();
|
||||
if ((Feb_Control_StopAcquisition() != STATUS_IDLE) ||
|
||||
(!Beb_StopAcquisition())) {
|
||||
// sends last frames from fifo and wait for feb processing done
|
||||
if ((Feb_Control_StopAcquisition() != STATUS_IDLE)) {
|
||||
LOG(logERROR, ("failed to stop acquisition\n"));
|
||||
sharedMemory_unlockLocalLink();
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
|
||||
// wait for beb to finish sending packets
|
||||
int isTransmitting = 1;
|
||||
while (isTransmitting) {
|
||||
// wait for beb to send out all packets
|
||||
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
|
||||
LOG(logERROR, ("failed to stop beb acquisition\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (isTransmitting) {
|
||||
printf("Transmitting...\n");
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Beb: Detector has sent all data (stop)\n"));
|
||||
|
||||
// reset feb and beb
|
||||
sharedMemory_lockLocalLink();
|
||||
Feb_Control_Reset();
|
||||
sharedMemory_unlockLocalLink();
|
||||
if (!Beb_StopAcquisition()) {
|
||||
LOG(logERROR, ("failed to stop acquisition\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// ensure all have same starting frame numbers
|
||||
uint64_t retval = 0;
|
||||
if (Beb_GetNextFrameNumber(&retval, send_to_ten_gig) == -2) {
|
||||
Beb_SetNextFrameNumber(retval + 1);
|
||||
}
|
||||
LOG(logINFOBLUE, ("Stopping state machine complete\n\n"));
|
||||
return OK;
|
||||
#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;
|
||||
}
|
||||
@ -2567,6 +2592,21 @@ void readFrame(int *ret, char *mess) {
|
||||
// wait for detector to send
|
||||
int isTransmitting = 1;
|
||||
while (isTransmitting) {
|
||||
// wait for feb processing to be done
|
||||
sharedMemory_lockLocalLink();
|
||||
int i = Feb_Control_ProcessingInProgress();
|
||||
sharedMemory_unlockLocalLink();
|
||||
if (i == STATUS_ERROR) {
|
||||
strcpy(mess, "Could not read feb processing done register\n");
|
||||
*ret = (int)FAIL;
|
||||
return;
|
||||
}
|
||||
if (i == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: TRANSMITTING (feb processing)\n"));
|
||||
isTransmitting = 1;
|
||||
}
|
||||
|
||||
// wait for beb to send out all packets
|
||||
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
|
||||
strcpy(mess, "Could not read delay counters\n");
|
||||
*ret = (int)FAIL;
|
||||
@ -2576,7 +2616,7 @@ void readFrame(int *ret, char *mess) {
|
||||
printf("Transmitting...\n");
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Detector has sent all data\n"));
|
||||
LOG(logINFO, ("Beb: Detector has sent all data (acquire)\n"));
|
||||
LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||
#endif
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -55,7 +55,7 @@ int ipPacketSize = 0;
|
||||
int udpPacketSize = 0;
|
||||
|
||||
// master slave configuration (for 25um)
|
||||
int masterflags = NO_MASTER;
|
||||
int master = 0;
|
||||
int masterdefaultdelay = 62;
|
||||
int patternphase = 0;
|
||||
int adcphase = 0;
|
||||
@ -364,6 +364,8 @@ void initStopServer() {
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
#endif
|
||||
// to get master from file
|
||||
readConfigFile();
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
@ -621,14 +623,12 @@ int readConfigFile() {
|
||||
// key is master/ slave flag
|
||||
if (!strcasecmp(key, "masterflags")) {
|
||||
if (!strcasecmp(value, "is_master")) {
|
||||
masterflags = IS_MASTER;
|
||||
master = 1;
|
||||
LOG(logINFOBLUE, ("\tMaster\n"));
|
||||
} else if (!strcasecmp(value, "is_slave")) {
|
||||
masterflags = IS_SLAVE;
|
||||
LOG(logINFOBLUE, ("\tSlave\n"));
|
||||
} else if (!strcasecmp(value, "no_master")) {
|
||||
masterflags = NO_MASTER;
|
||||
LOG(logINFOBLUE, ("\tNo Master\n"));
|
||||
} else if ((!strcasecmp(value, "is_slave")) ||
|
||||
(!strcasecmp(value, "no_master"))) {
|
||||
master = 0;
|
||||
LOG(logINFOBLUE, ("\tSlave or No Master\n"));
|
||||
} else {
|
||||
LOG(logERROR,
|
||||
("\tCould not scan masterflags %s value from config file\n",
|
||||
@ -705,7 +705,7 @@ void setMasterSlaveConfiguration() {
|
||||
return;
|
||||
|
||||
// master configuration
|
||||
if (masterflags == IS_MASTER) {
|
||||
if (master) {
|
||||
// master default delay set, so reset delay
|
||||
setDelayAfterTrigger(0);
|
||||
|
||||
@ -876,7 +876,7 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
if (masterflags == IS_MASTER) {
|
||||
if (master) {
|
||||
val += masterdefaultdelay;
|
||||
LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int)val));
|
||||
}
|
||||
@ -900,7 +900,7 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
int64_t getDelayAfterTrigger() {
|
||||
int64_t retval =
|
||||
get64BitReg(SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||
if (masterflags == IS_MASTER) {
|
||||
if (master) {
|
||||
LOG(logDEBUG1,
|
||||
("\tActual Delay read (master): %lld\n", (long long int)retval));
|
||||
retval -= masterdefaultdelay;
|
||||
@ -924,7 +924,7 @@ int64_t getPeriodLeft() {
|
||||
int64_t getDelayAfterTriggerLeft() {
|
||||
int64_t retval =
|
||||
get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||
if (masterflags == IS_MASTER) {
|
||||
if (master) {
|
||||
LOG(logDEBUG1,
|
||||
("\tGetting Actual delay (master): %lld\n", (long long int)retval));
|
||||
retval -= masterdefaultdelay;
|
||||
@ -1201,6 +1201,8 @@ int setHighVoltage(int val) {
|
||||
|
||||
/* parameters - timing, extsig */
|
||||
|
||||
int isMaster() { return master; }
|
||||
|
||||
void setTiming(enum timingMode arg) {
|
||||
u_int32_t addr = EXT_SIGNAL_REG;
|
||||
switch (arg) {
|
||||
@ -1451,7 +1453,7 @@ int configureMAC() {
|
||||
setExpTime(900 * 1000);
|
||||
|
||||
// take an image
|
||||
if (masterflags == IS_MASTER)
|
||||
if (master)
|
||||
usleep(1 * 1000 * 1000); // required to ensure master starts
|
||||
// acquisition only after slave has changed
|
||||
// to basic parameters and is waiting
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1395,12 +1395,13 @@ int setHighVoltage(int val) {
|
||||
return highvoltage;
|
||||
}
|
||||
|
||||
/* parameters - timing */
|
||||
|
||||
int isMaster() {
|
||||
return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
|
||||
SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
|
||||
}
|
||||
|
||||
/* parameters - timing */
|
||||
void setTiming(enum timingMode arg) {
|
||||
|
||||
if (!isMaster() && arg == AUTO_TIMING)
|
||||
|
@ -347,6 +347,9 @@ int getADC(enum ADCINDEX ind);
|
||||
int setHighVoltage(int val);
|
||||
|
||||
// parameters - timing, extsig
|
||||
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD)
|
||||
int isMaster();
|
||||
#endif
|
||||
#ifdef GOTTHARD2D
|
||||
void updatingRegisters();
|
||||
#endif
|
||||
@ -354,7 +357,6 @@ void setTiming(enum timingMode arg);
|
||||
enum timingMode getTiming();
|
||||
#ifdef MYTHEN3D
|
||||
void setInitialExtSignals();
|
||||
int isMaster();
|
||||
int setGainCaps(int caps);
|
||||
int getGainCaps();
|
||||
int setChipStatusRegister(int csr);
|
||||
@ -556,9 +558,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
|
||||
|
@ -4096,16 +4096,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"));
|
||||
@ -8145,7 +8158,7 @@ int get_master(int file_des) {
|
||||
|
||||
LOG(logDEBUG1, ("Getting master\n"));
|
||||
|
||||
#ifndef MYTHEN3D
|
||||
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
retval = isMaster();
|
||||
|
Reference in New Issue
Block a user