mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 01:50:40 +02:00
wip
This commit is contained in:
parent
1ab3bb8496
commit
69be046131
@ -709,6 +709,30 @@ int Feb_Control_AcquisitionInProgress() {
|
|||||||
return STATUS_IDLE;
|
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() {
|
int Feb_Control_AcquisitionStartedBit() {
|
||||||
unsigned int status_reg_r = 0, status_reg_l = 0;
|
unsigned int status_reg_r = 0, status_reg_l = 0;
|
||||||
// deactivated should return acquisition started/ready
|
// deactivated should return acquisition started/ready
|
||||||
@ -1002,8 +1026,7 @@ int Feb_Control_StopAcquisition() {
|
|||||||
unsigned int orig_value = 0;
|
unsigned int orig_value = 0;
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||||
DAQ_REG_CTRL, &orig_value)) {
|
DAQ_REG_CTRL, &orig_value)) {
|
||||||
LOG(logERROR, ("Could not read DAQ_REG_CHIP_CMDS to send software "
|
LOG(logERROR, ("Could not read DAQ_REG_CTRL to stop acquisition (send complete frames)\n"));
|
||||||
"trigger\n"));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||||
@ -1012,7 +1035,27 @@ int Feb_Control_StopAcquisition() {
|
|||||||
LOG(logERROR, ("Could not send last frames.\n"));
|
LOG(logERROR, ("Could not send last frames.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
usleep(100 *1000);
|
LOG(logINFOBLUE, ("send last frame value:0x%x\n", orig_value | DAQ_CTRL_STOP));
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// stop acquisition
|
// stop acquisition
|
||||||
return Feb_Control_Reset();
|
return Feb_Control_Reset();
|
||||||
}
|
}
|
||||||
@ -1904,15 +1947,15 @@ int Feb_Control_GetLeftFPGATemp() {
|
|||||||
if (!Feb_Control_activated) {
|
if (!Feb_Control_activated) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
unsigned int temperature = 0;
|
unsigned int value = 0;
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
||||||
&temperature)) {
|
&value)) {
|
||||||
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
|
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
|
||||||
"temperature\n"));
|
"temperature\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
temperature = temperature >> 16;
|
unsigned int temperature = ((value & FEB_REG_STATUS_TEMP_MSK) >> FEB_REG_STATUS_TEMP_OFST);
|
||||||
temperature =
|
temperature =
|
||||||
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
|
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
|
||||||
1000; // Static conversation, copied from xps sysmon standalone driver
|
1000; // Static conversation, copied from xps sysmon standalone driver
|
||||||
|
@ -40,6 +40,7 @@ unsigned int *Feb_Control_GetTrimbits();
|
|||||||
|
|
||||||
// acquisition
|
// acquisition
|
||||||
int Feb_Control_AcquisitionInProgress();
|
int Feb_Control_AcquisitionInProgress();
|
||||||
|
int Feb_Control_ProcessingInProgress();
|
||||||
int Feb_Control_AcquisitionStartedBit();
|
int Feb_Control_AcquisitionStartedBit();
|
||||||
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
||||||
int Feb_Control_WaitForFinishedFlag(int sleep_time_us, int tempLock);
|
int Feb_Control_WaitForFinishedFlag(int sleep_time_us, int tempLock);
|
||||||
|
@ -30,7 +30,14 @@
|
|||||||
|
|
||||||
#define DAQ_REG_RO_OFFSET 20
|
#define DAQ_REG_RO_OFFSET 20
|
||||||
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) // also pg and fifo status register
|
#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 (DAQ_REG_RO_OFFSET + 3)
|
||||||
|
|
||||||
|
#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_SUBPERIOD_REG (DAQ_REG_RO_OFFSET + 4)
|
||||||
#define MEAS_PERIOD_REG (DAQ_REG_RO_OFFSET + 5)
|
#define MEAS_PERIOD_REG (DAQ_REG_RO_OFFSET + 5)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
@ -39,6 +46,7 @@
|
|||||||
#define DAQ_CTRL_START 0x40000000
|
#define DAQ_CTRL_START 0x40000000
|
||||||
#define ACQ_CTRL_START 0x50000000 // this is 0x10000000 (acq) | 0x40000000 (daq)
|
#define ACQ_CTRL_START 0x50000000 // this is 0x10000000 (acq) | 0x40000000 (daq)
|
||||||
#define DAQ_CTRL_STOP 0x08000000 // sends last complete frame
|
#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
|
// direct chip commands to the DAQ_REG_CHIP_CMDS register
|
||||||
#define DAQ_SET_STATIC_BIT 0x00000001
|
#define DAQ_SET_STATIC_BIT 0x00000001
|
||||||
|
Binary file not shown.
@ -2511,6 +2511,19 @@ void readFrame(int *ret, char *mess) {
|
|||||||
// wait for detector to send
|
// wait for detector to send
|
||||||
int isTransmitting = 1;
|
int isTransmitting = 1;
|
||||||
while (isTransmitting) {
|
while (isTransmitting) {
|
||||||
|
// wait for feb processing to be done
|
||||||
|
int i = Feb_Control_ProcessingInProgress();
|
||||||
|
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) {
|
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
|
||||||
strcpy(mess, "Could not read delay counters\n");
|
strcpy(mess, "Could not read delay counters\n");
|
||||||
*ret = (int)FAIL;
|
*ret = (int)FAIL;
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
#define APILIB 0x210225
|
#define APILIB 0x210225
|
||||||
#define APIRECEIVER 0x210225
|
#define APIRECEIVER 0x210225
|
||||||
#define APIGUI 0x210225
|
#define APIGUI 0x210225
|
||||||
#define APIEIGER 0x210621
|
|
||||||
#define APICTB 0x210621
|
#define APICTB 0x210621
|
||||||
#define APIGOTTHARD 0x210621
|
#define APIGOTTHARD 0x210621
|
||||||
#define APIGOTTHARD2 0x210621
|
#define APIGOTTHARD2 0x210621
|
||||||
#define APIJUNGFRAU 0x210621
|
#define APIJUNGFRAU 0x210621
|
||||||
#define APIMYTHEN3 0x210621
|
#define APIMYTHEN3 0x210621
|
||||||
#define APIMOENCH 0x210621
|
#define APIMOENCH 0x210621
|
||||||
|
#define APIEIGER 0x210624
|
||||||
|
Loading…
x
Reference in New Issue
Block a user