mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 17:18:00 +02:00
runs, prints right in reciever
This commit is contained in:
@ -134,7 +134,7 @@ void Beb_Beb(int id) {
|
||||
|
||||
if (!Beb_InitBebInfos()) exit(1);
|
||||
|
||||
FILE_LOG(logDEBUG5, ("Printing Beb infos:\n"));
|
||||
FILE_LOG(logDEBUG1, ("Printing Beb infos:\n"));
|
||||
unsigned int i;
|
||||
for(i=1;i<bebInfoSize;i++) BebInfo_Print(&beb_infos[i]);
|
||||
|
||||
@ -162,8 +162,8 @@ void Beb_GetModuleConfiguration(int* master, int* top, int* normal) {
|
||||
} else {
|
||||
//read data
|
||||
ret = Beb_Read32(csp0base, MODULE_CONFIGURATION_MASK);
|
||||
FILE_LOG(logDEBUG5, ("Module Configuration OK\n"));
|
||||
FILE_LOG(logDEBUG5, ("Beb: value =0x%x\n",ret));
|
||||
FILE_LOG(logDEBUG1, ("Module Configuration OK\n"));
|
||||
FILE_LOG(logDEBUG1, ("Beb: value =0x%x\n",ret));
|
||||
if (ret&TOP_BIT_MASK) {
|
||||
*top = 1;
|
||||
Beb_top = 1;
|
||||
@ -228,7 +228,7 @@ void Beb_EndofDataSend(int tengiga) {
|
||||
r_framepktMsbcounter = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
|
||||
r_txndelaycounter = Beb_Read32(csp0base, addr_r_txndelaycounter);
|
||||
r_framedelaycounter = Beb_Read32(csp0base, addr_r_framedelaycounter);
|
||||
FILE_LOG(logDEBUG5, ("\nLeft\n"
|
||||
FILE_LOG(logDEBUG1, ("\nLeft\n"
|
||||
"FramepacketLsbcounter: %d\n"
|
||||
"FramepacketMsbcounter: %d\n"
|
||||
"Txndelaycounter:%d\n"
|
||||
@ -258,7 +258,7 @@ void Beb_EndofDataSend(int tengiga) {
|
||||
r_framepktMsbcounter_new = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
|
||||
r_txndelaycounter_new = Beb_Read32(csp0base, addr_r_txndelaycounter);
|
||||
r_framedelaycounter_new = Beb_Read32(csp0base, addr_r_framedelaycounter);
|
||||
FILE_LOG(logDEBUG5, ("\nLeft\n"
|
||||
FILE_LOG(logDEBUG1, ("\nLeft\n"
|
||||
"FramepacketLsbcounter: %d\n"
|
||||
"FramepacketMsbcounter: %d\n"
|
||||
"Txndelaycounter:%d\n"
|
||||
@ -706,10 +706,10 @@ unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb) {
|
||||
unsigned int i;
|
||||
for(i=1;i<bebInfoSize;i++)
|
||||
if (beb_numb==BebInfo_GetBebNumber(&beb_infos[i])) {
|
||||
FILE_LOG(logDEBUG5, ("*****found beb index:%d, for beb number:%d\n",i,beb_numb));
|
||||
FILE_LOG(logDEBUG1, ("*****found beb index:%d, for beb number:%d\n",i,beb_numb));
|
||||
return i;
|
||||
}
|
||||
FILE_LOG(logDEBUG5, ("*****Returning 0\n"));
|
||||
FILE_LOG(logDEBUG1, ("*****Returning 0\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -930,11 +930,11 @@ int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, i
|
||||
|
||||
|
||||
Beb_send_data[1] = 0x62000000 | (!stop_read_when_fifo_empty) << 27 | (ten_gig==1) << 24 | packet_size << 14 | dst_number << 8 | npackets;
|
||||
FILE_LOG(logDEBUG5, ("Beb_send_data[1]:%X\n",Beb_send_data[1]));
|
||||
FILE_LOG(logDEBUG1, ("Beb_send_data[1]:%X\n",Beb_send_data[1]));
|
||||
Beb_send_data[2] = 0;
|
||||
|
||||
Beb_SwapDataFun(0,2,&(Beb_send_data[1]));
|
||||
FILE_LOG(logDEBUG5, ("Beb_send_data[1] Swapped:%X\n",Beb_send_data[1]));
|
||||
FILE_LOG(logDEBUG1, ("Beb_send_data[1] Swapped:%X\n",Beb_send_data[1]));
|
||||
|
||||
if (Beb_activated) {
|
||||
if (!Beb_WriteTo(i)) return 0;
|
||||
@ -1004,8 +1004,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
|
||||
if (in_two_requests) npackets/=2;
|
||||
|
||||
FILE_LOG(logDEBUG5, ("----Beb_RequestNImages Start----\n"));
|
||||
FILE_LOG(logDEBUG5, ("beb_number:%X, ten_gig:%X,dst_number:%X, npackets:%X, "
|
||||
FILE_LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n"));
|
||||
FILE_LOG(logDEBUG1, ("beb_number:%X, ten_gig:%X,dst_number:%X, npackets:%X, "
|
||||
"Beb_bit_mode:%X, header_size:%X, nimages:%d, test_just_send_out_packets_no_wait:%X\n",
|
||||
beb_number, ten_gig, dst_number, npackets, Beb_bit_mode, header_size,
|
||||
nimages, test_just_send_out_packets_no_wait));
|
||||
@ -1051,7 +1051,7 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++)
|
||||
FILE_LOG(logDEBUG5, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
}
|
||||
// Generating commands
|
||||
send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0;
|
||||
@ -1059,8 +1059,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++)
|
||||
FILE_LOG(logDEBUG5, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
FILE_LOG(logDEBUG5, ("%d\n",in_two_requests));
|
||||
FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
FILE_LOG(logDEBUG1, ("%d\n",in_two_requests));
|
||||
}
|
||||
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
|
||||
//Left
|
||||
@ -1088,12 +1088,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++)
|
||||
FILE_LOG(logDEBUG5, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); //*(ptrl+i));
|
||||
FILE_LOG(logDEBUG5, ("%d\n",in_two_requests));
|
||||
FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); //*(ptrl+i));
|
||||
FILE_LOG(logDEBUG1, ("%d\n",in_two_requests));
|
||||
}
|
||||
Beb_close(fd,csp0base);
|
||||
|
||||
FILE_LOG(logDEBUG5, ("----Beb_RequestNImages----\n"));
|
||||
FILE_LOG(logDEBUG1, ("----Beb_RequestNImages----\n"));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -1268,8 +1268,8 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
}
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logINFO, ("Position set to...\n"
|
||||
"Left: [%d, %d, %d]\n"
|
||||
"Right:[%d, %d, %d]\n",
|
||||
"\tLeft: [%d, %d, %d]\n"
|
||||
"\tRight:[%d, %d, %d]\n",
|
||||
Beb_swap_uint16(pos[0]), Beb_top ? pos[1] : (pos[1]+1), Beb_swap_uint16(pos[2]),
|
||||
Beb_swap_uint16(pos[0]), Beb_top ? (pos[1]+1) : pos[1], Beb_swap_uint16(pos[2])));
|
||||
}
|
||||
@ -1288,13 +1288,13 @@ int Beb_open(u_int32_t** csp0base, u_int32_t offset) {
|
||||
if (fd == -1) {
|
||||
FILE_LOG(logERROR, ("\nCan't find /dev/mem!\n"));
|
||||
} else {
|
||||
FILE_LOG(logDEBUG5, ("/dev/mem opened\n"));
|
||||
FILE_LOG(logDEBUG1, ("/dev/mem opened\n"));
|
||||
*csp0base = (u_int32_t*)mmap(0, BEB_MMAP_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, offset);
|
||||
if (*csp0base == MAP_FAILED) {
|
||||
FILE_LOG(logERROR, ("\nCan't map memmory area!!\n"));
|
||||
fd = -1;
|
||||
}
|
||||
else FILE_LOG(logDEBUG5, ("CSP0 mapped %p\n",(void*)*csp0base));
|
||||
else FILE_LOG(logDEBUG1, ("CSP0 mapped %p\n",(void*)*csp0base));
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ int Feb_Control_Init(int master, int top, int normal, int module_num) {
|
||||
Feb_Control_module_number = (module_num & 0xFF);
|
||||
|
||||
int serial = !top;
|
||||
FILE_LOG(logDEBUG5, ("serial: %d\n",serial));
|
||||
FILE_LOG(logDEBUG1, ("serial: %d\n",serial));
|
||||
|
||||
Feb_Control_current_index = 1;
|
||||
|
||||
@ -268,7 +268,7 @@ int Feb_Control_OpenSerialCommunication() {
|
||||
FILE_LOG(logERROR, ("could not write to i2c bus\n"));
|
||||
return 0;
|
||||
}
|
||||
FILE_LOG(logDEBUG5, ("Sent: %d bytes\n",n));
|
||||
FILE_LOG(logDEBUG1, ("Sent: %d bytes\n",n));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -280,9 +280,9 @@ void Feb_Control_CloseSerialCommunication() {
|
||||
|
||||
void Feb_Control_PrintModuleList() {
|
||||
unsigned int i;
|
||||
FILE_LOG(logDEBUG5, ("Module list:\n"));
|
||||
FILE_LOG(logDEBUG1, ("Module list:\n"));
|
||||
for(i=0;i<moduleSize;i++) {
|
||||
FILE_LOG(logDEBUG5, ("\t%d) %s modules: %d 0x%x %s\n", i,
|
||||
FILE_LOG(logDEBUG1, ("\t%d) %s modules: %d 0x%x %s\n", i,
|
||||
((i == 0) ? "All " : ((i == 1) ? "Master" : " ")),
|
||||
Module_GetModuleNumber(&modules[i]),
|
||||
(Module_TopAddressIsValid(&modules[i]) ?
|
||||
@ -362,19 +362,19 @@ int Feb_Control_AddModule1(unsigned int module_number, int top_enable, unsigned
|
||||
|
||||
|
||||
if (Module_TopAddressIsValid(m)&&Module_BottomAddressIsValid(m)) {
|
||||
FILE_LOG(logDEBUG5, ("\tAdding full module number %d with top and bottom "
|
||||
FILE_LOG(logDEBUG1, ("\tAdding full module number %d with top and bottom "
|
||||
"base addresses: %d %d\n",Module_GetModuleNumber(m),
|
||||
Module_GetTopBaseAddress(m),Module_GetBottomBaseAddress(m)));
|
||||
modules[moduleSize] = mod;
|
||||
moduleSize++;
|
||||
} else if (Module_TopAddressIsValid(m)) {
|
||||
FILE_LOG(logDEBUG5, ("\tAdding half module number %d with "
|
||||
FILE_LOG(logDEBUG1, ("\tAdding half module number %d with "
|
||||
"top base address: %d\n",Module_GetModuleNumber(m),
|
||||
Module_GetTopBaseAddress(m)));
|
||||
modules[moduleSize] = mod;
|
||||
moduleSize++;
|
||||
} else if (Module_BottomAddressIsValid(m)) {
|
||||
FILE_LOG(logDEBUG5, ("\tAdding half module number %d with "
|
||||
FILE_LOG(logDEBUG1, ("\tAdding half module number %d with "
|
||||
"bottom base address: %d\n",Module_GetModuleNumber(m),
|
||||
Module_GetBottomBaseAddress(m)));
|
||||
modules[moduleSize] = mod;
|
||||
@ -389,7 +389,7 @@ int Feb_Control_AddModule1(unsigned int module_number, int top_enable, unsigned
|
||||
|
||||
|
||||
int Feb_Control_CheckSetup(int master) {
|
||||
FILE_LOG(logDEBUG5, ("Checking Set up\n"));
|
||||
FILE_LOG(logDEBUG1, ("Checking Set up\n"));
|
||||
unsigned int i,j;
|
||||
int ok = 1;
|
||||
|
||||
@ -422,7 +422,7 @@ int Feb_Control_CheckSetup(int master) {
|
||||
}
|
||||
}
|
||||
/* }*/
|
||||
FILE_LOG(logDEBUG5, ("Done Checking Set up\n"));
|
||||
FILE_LOG(logDEBUG1, ("Done Checking Set up\n"));
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -526,7 +526,7 @@ int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr, unsigned int chan
|
||||
unsigned int set_right_delay_channels = chip_lr ? 0:channels;
|
||||
|
||||
|
||||
FILE_LOG(logDEBUG5, ("\tSetting delays of %s chips of dst_num %d, "
|
||||
FILE_LOG(logDEBUG1, ("\tSetting delays of %s chips of dst_num %d, "
|
||||
"tracks 0x%x to %d, %d clks and %d units.\n",
|
||||
((set_left_delay_channels != 0) ? "left" : "right"),
|
||||
dst_num, channels, (((15-delay_data_valid_nclks)<<6)|ndelay_units),
|
||||
@ -559,7 +559,7 @@ float Feb_Control_DACToVoltage(unsigned int digital,unsigned int nsteps,float vm
|
||||
|
||||
//only master gets to call this function
|
||||
int Feb_Control_SetHighVoltage(int value) {
|
||||
FILE_LOG(logDEBUG5, (" Setting High Voltage:\t"));
|
||||
FILE_LOG(logDEBUG1, (" Setting High Voltage:\t"));
|
||||
/*
|
||||
* maximum voltage of the hv dc/dc converter:
|
||||
* 300 for single module power distribution board
|
||||
@ -581,14 +581,14 @@ int Feb_Control_SetHighVoltage(int value) {
|
||||
return -1;
|
||||
}
|
||||
FILE_LOG(logINFO, ("High Voltage set to %dV\n", value));
|
||||
FILE_LOG(logDEBUG5, ("High Voltage set to (%d dac):\t%dV\n", dacval, value));
|
||||
FILE_LOG(logDEBUG1, ("High Voltage set to (%d dac):\t%dV\n", dacval, value));
|
||||
|
||||
return Feb_Control_SendHighVoltage(dacval);
|
||||
}
|
||||
|
||||
|
||||
int Feb_Control_GetHighVoltage(int* value) {
|
||||
FILE_LOG(logDEBUG5, (" Getting High Voltage:\t"));
|
||||
FILE_LOG(logDEBUG1, (" Getting High Voltage:\t"));
|
||||
unsigned int dacval = 0;
|
||||
|
||||
if (!Feb_Control_ReceiveHighVoltage(&dacval))
|
||||
@ -610,7 +610,7 @@ int Feb_Control_GetHighVoltage(int* value) {
|
||||
unsigned int nsteps = ntotalsteps*vlimit/vmax;
|
||||
*value = (int)(Feb_Control_DACToVoltage(dacval,nsteps,vmin,vlimit)+0.5);
|
||||
FILE_LOG(logINFO, ("High Voltage read %dV\n", *value));
|
||||
FILE_LOG(logDEBUG5, ("High Voltage read (%d dac)\t%dV\n", dacval, *value));
|
||||
FILE_LOG(logDEBUG1, ("High Voltage read (%d dac)\t%dV\n", dacval, *value));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -895,7 +895,7 @@ int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int
|
||||
float voltage=Feb_Control_DACToVoltage(*value,4096,0,2048);
|
||||
|
||||
FILE_LOG(logINFO, ("%s set to %d (%.2fmV)\n", Module_dac_names[ch],*value,voltage));
|
||||
FILE_LOG(logDEBUG5, ("Dac number %d (%s) of dst %d set to %d (%f mV)\n",ch,Module_dac_names[ch],dst_num,*value,voltage));
|
||||
FILE_LOG(logDEBUG1, ("Dac number %d (%s) of dst %d set to %d (%f mV)\n",ch,Module_dac_names[ch],dst_num,*value,voltage));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1099,7 +1099,7 @@ int Feb_Control_AcquisitionInProgress() {
|
||||
|
||||
//running
|
||||
if ((status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING) {
|
||||
FILE_LOG(logDEBUG5, ("**runningggg\n"));
|
||||
FILE_LOG(logDEBUG1, ("**runningggg\n"));
|
||||
return STATUS_RUNNING;
|
||||
}
|
||||
//idle
|
||||
@ -1815,7 +1815,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
|
||||
double x = Feb_Control_rate_meas[next_i] - b*4;
|
||||
double y = next_i;
|
||||
/*FILE_LOG(logDEBUG5, ("Start Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
/*FILE_LOG(logDEBUG1, ("Start Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
"next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n",
|
||||
x, y, s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]));*/
|
||||
|
||||
@ -1826,7 +1826,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
sy += y;
|
||||
sxx += x*x;
|
||||
sxy += x*y;
|
||||
/*FILE_LOG(logDEBUG5, ("End Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
/*FILE_LOG(logDEBUG1, ("End Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
"next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n",
|
||||
x, y, s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]));*/
|
||||
}
|
||||
@ -1840,7 +1840,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
if (beforemax>ratemax) b0[b] = beforemax;
|
||||
else b0[b] = ratemax;
|
||||
}
|
||||
/*FILE_LOG(logDEBUG5, ("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
/*FILE_LOG(logDEBUG1, ("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
"next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n",
|
||||
s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]));*/
|
||||
// cout<<s<<" "<<sx<<" "<<sy<<" "<<sxx<<" "<<" "<<sxy<<" "<<delta<<" "<<m[b]<<" "<<b0[b]<<endl;
|
||||
@ -1850,7 +1850,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
m[b] = 15;
|
||||
}
|
||||
Feb_Control_rate_correction_table[b] = (((int)(m[b]+0.5)&0xf)<<14) | ((int)(b0[b]+0.5)&0x3fff);
|
||||
/*FILE_LOG(logDEBUG5, ("After Loop 4*b: %d\tbase:%d\tslope:%d\n",4*b, (int)(b0[b]+0.5), (int)(m[b]+0.5) ));*/
|
||||
/*FILE_LOG(logDEBUG1, ("After Loop 4*b: %d\tbase:%d\tslope:%d\n",4*b, (int)(b0[b]+0.5), (int)(m[b]+0.5) ));*/
|
||||
}
|
||||
|
||||
if (Feb_Control_SetRateCorrectionTable(Feb_Control_rate_correction_table)) {
|
||||
@ -1936,7 +1936,7 @@ int Feb_Control_PrintCorrectedValues() {
|
||||
corr = delta+base;
|
||||
if (slope==15) corr= 3*slope+base;
|
||||
|
||||
FILE_LOG(logDEBUG5, ("Readout Input: %d,\tBase:%d,\tSlope:%d,\tLSB:%d,\tDelta:%d\tResult:%d\tReal:%lf\n",
|
||||
FILE_LOG(logDEBUG1, ("Readout Input: %d,\tBase:%d,\tSlope:%d,\tLSB:%d,\tDelta:%d\tResult:%d\tReal:%lf\n",
|
||||
i, base, slope, lsb, delta, corr, Feb_Control_rate_meas[i]));
|
||||
}
|
||||
return 1;
|
||||
@ -1999,13 +1999,13 @@ int Feb_Control_SoftwareTrigger() {
|
||||
|
||||
if (Feb_Control_activated) {
|
||||
// set trigger bit
|
||||
FILE_LOG(logDEBUG5, ("Setting Trigger, Register:0x%x\n",cmd));
|
||||
FILE_LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n",cmd));
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CHIP_CMDS,cmd,0,0)) {
|
||||
FILE_LOG(logERROR, ("Could not give software trigger\n"));
|
||||
return 0;
|
||||
}
|
||||
// unset trigger bit
|
||||
FILE_LOG(logDEBUG5, ("Unsetting Trigger, Register:0x%x\n",orig_value));
|
||||
FILE_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)) {
|
||||
FILE_LOG(logERROR, ("Could not give software trigger\n"));
|
||||
return 0;
|
||||
|
@ -57,7 +57,7 @@ void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list) {
|
||||
int Feb_Interface_WriteTo(unsigned int ch) {
|
||||
if (ch>0xfff) return 0;
|
||||
|
||||
FILE_LOG(logDEBUG5, ("FIW ch %d\n", ch));
|
||||
FILE_LOG(logDEBUG1, ("FIW ch %d\n", ch));
|
||||
|
||||
Feb_Interface_send_data_raw[0] = 0x8fff0000;
|
||||
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
||||
|
@ -10,18 +10,18 @@
|
||||
|
||||
|
||||
void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr) {
|
||||
FILE_LOG(logDEBUG5, ("Initialize PLB LL FIFOs\n"));
|
||||
FILE_LOG(logDEBUG1, ("Initialize PLB LL FIFOs\n"));
|
||||
ll->ll_fifo_base=0;
|
||||
ll->ll_fifo_ctrl_reg=0;
|
||||
if (Local_Init(ll,ll_fifo_badr)) {
|
||||
Local_Reset(ll);
|
||||
FILE_LOG(logDEBUG5, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll)));
|
||||
FILE_LOG(logDEBUG1, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll)));
|
||||
} else FILE_LOG(logERROR, ("\tCould not map LocalLink : 0x%08x\n\n\n", ll_fifo_badr));
|
||||
}
|
||||
|
||||
|
||||
void Local_LocalLinkInterface(struct LocalLinkInterface* ll) {
|
||||
FILE_LOG(logDEBUG5, ("Initializing new memory\n"));
|
||||
FILE_LOG(logDEBUG1, ("Initializing new memory\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ int Local_Reset(struct LocalLinkInterface* ll) {
|
||||
|
||||
int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask) {
|
||||
ll->ll_fifo_ctrl_reg |= rst_mask;
|
||||
FILE_LOG(logDEBUG5, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg));
|
||||
FILE_LOG(logDEBUG1, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg));
|
||||
|
||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||
@ -92,9 +92,9 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf
|
||||
last_word = (buffer_len-1)/4;
|
||||
word_ptr = (unsigned int *)buffer;
|
||||
|
||||
FILE_LOG(logDEBUG5, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base));
|
||||
FILE_LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base));
|
||||
for (i=0; i < buffer_len/4; i++)
|
||||
FILE_LOG(logDEBUG5, ("%.8X ",*(((unsigned *) buffer)+i)));
|
||||
FILE_LOG(logDEBUG1, ("%.8X ",*(((unsigned *) buffer)+i)));
|
||||
|
||||
while (words_send <= last_word)
|
||||
{
|
||||
@ -138,7 +138,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
volatile unsigned int fifo_val;
|
||||
int sof = 0;
|
||||
|
||||
FILE_LOG(logDEBUG5, ("LL Read - If: %X - Data: ",ll->ll_fifo_base));
|
||||
FILE_LOG(logDEBUG1, ("LL Read - If: %X - Data: ",ll->ll_fifo_base));
|
||||
|
||||
word_ptr = (unsigned int *)buffer;
|
||||
do
|
||||
@ -164,7 +164,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
{
|
||||
if ( (buffer_len >> 2) > buffer_ptr)
|
||||
{
|
||||
FILE_LOG(logDEBUG5, ("%.8X ", fifo_val));
|
||||
FILE_LOG(logDEBUG1, ("%.8X ", fifo_val));
|
||||
word_ptr[buffer_ptr++] = fifo_val; //write to buffer
|
||||
}
|
||||
else
|
||||
@ -176,7 +176,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
if (status & PLB_LL_FIFO_STATUS_LL_EOF)
|
||||
{
|
||||
len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT );
|
||||
FILE_LOG(logDEBUG5, ("Len: %d\n",len));
|
||||
FILE_LOG(logDEBUG1, ("Len: %d\n",len));
|
||||
buffer_ptr = 0;
|
||||
return len;
|
||||
}
|
||||
@ -209,7 +209,7 @@ int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
|
||||
do{
|
||||
len = Local_Read(ll,rec_buff_len,rec_buffer);
|
||||
FILE_LOG(logDEBUG5, ("receive length: %i\n",len));
|
||||
FILE_LOG(logDEBUG1, ("receive length: %i\n",len));
|
||||
|
||||
if (len > 0) {
|
||||
rec_buffer[len]=0;
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/eigerDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: dfad145e1492e961c95063aa5b2f54e5e1b418a0
|
||||
Revision: 3
|
||||
Repsitory UUID: 92fc837eb490650d91c2283943cbd729b2e36567
|
||||
Revision: 6
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4127
|
||||
Last Changed Date: 2018-10-23 12:30:26.000000002 +0200 ./Beb.c
|
||||
Last Changed Rev: 4131
|
||||
Last Changed Date: 2018-10-29 17:14:27.000000002 +0100 ./Beb.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "dfad145e1492e961c95063aa5b2f54e5e1b418a0"
|
||||
#define GITREPUUID "92fc837eb490650d91c2283943cbd729b2e36567"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4127
|
||||
#define GITDATE 0x20181023
|
||||
#define GITREV 0x4131
|
||||
#define GITDATE 0x20181029
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -306,10 +306,10 @@ void initControlServer() {
|
||||
if (Feb_Control_OpenSerialCommunication())
|
||||
;// Feb_Control_CloseSerialCommunication();
|
||||
}
|
||||
FILE_LOG(logDEBUG5, ("Control server: FEB Initialization done\n"));
|
||||
FILE_LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
||||
Beb_Beb(detid);
|
||||
Beb_SetDetectorNumber(getDetectorNumber());
|
||||
FILE_LOG(logDEBUG5, ("Control server: BEB Initialization done\n"));
|
||||
FILE_LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
|
||||
|
||||
|
||||
setupDetector();
|
||||
@ -325,7 +325,7 @@ void initStopServer() {
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
Feb_Control_Init(master,top,normal,getDetectorNumber());
|
||||
FILE_LOG(logDEBUG5, ("Stop server: FEB Initialization done\n"));
|
||||
FILE_LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -385,10 +385,10 @@ void allocateDetectorStructureMemory() {
|
||||
detectorChans=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs=malloc(NDAC*sizeof(int));
|
||||
detectorAdcs=malloc(NADC*sizeof(int));
|
||||
FILE_LOG(logDEBUG5, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules));
|
||||
FILE_LOG(logDEBUG5, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans));
|
||||
FILE_LOG(logDEBUG5, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs));
|
||||
FILE_LOG(logDEBUG5, ("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs));
|
||||
FILE_LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules));
|
||||
FILE_LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans));
|
||||
FILE_LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs));
|
||||
FILE_LOG(logDEBUG1, ("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs));
|
||||
(detectorModules)->dacs=detectorDacs;
|
||||
(detectorModules)->adcs=detectorAdcs;
|
||||
(detectorModules)->chanregs=detectorChans;
|
||||
@ -455,7 +455,7 @@ void setupDetector() {
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_CheckSetup();
|
||||
#endif
|
||||
FILE_LOG(logDEBUG5, ("Setup detector done\n\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setup detector done\n\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -491,7 +491,7 @@ int setDynamicRange(int dr) {
|
||||
return eiger_dynamicrange;
|
||||
#else
|
||||
if (dr > 0) {
|
||||
FILE_LOG(logDEBUG5, ("Setting dynamic range: %d\n", dr));
|
||||
FILE_LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr));
|
||||
if (Feb_Control_SetDynamicRange(dr)) {
|
||||
|
||||
//EigerSetBitMode(dr);
|
||||
@ -518,7 +518,7 @@ int setDynamicRange(int dr) {
|
||||
enum speedVariable setSpeed(int val) {
|
||||
|
||||
if (val != -1) {
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Speed: %d\n", val));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Speed: %d\n", val));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetReadoutSpeed(val))
|
||||
#endif
|
||||
@ -538,15 +538,15 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) {
|
||||
switch(val) {
|
||||
case PARALLEL:
|
||||
val=E_PARALLEL;
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Flag: Parallel\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Parallel\n"));
|
||||
break;
|
||||
case NONPARALLEL:
|
||||
val=E_NON_PARALLEL;
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Flag: Non Parallel\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Non Parallel\n"));
|
||||
break;
|
||||
case SAFE:
|
||||
val=E_SAFE;
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Flag: Safe\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Safe\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -567,11 +567,11 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) {
|
||||
switch(val) {
|
||||
case SHOW_OVERFLOW:
|
||||
val=1;
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Flag: Overflow in 32 bit mode\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Overflow in 32 bit mode\n"));
|
||||
break;
|
||||
case NOOVERFLOW:
|
||||
val=0;
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Flag: No overflow in 32 bit mode\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Flag: No overflow in 32 bit mode\n"));
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", val));
|
||||
@ -591,11 +591,11 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) {
|
||||
switch(val) {
|
||||
case STORE_IN_RAM:
|
||||
val=1;
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Flag: Store in Ram\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Store in Ram\n"));
|
||||
break;
|
||||
case CONTINOUS_RO:
|
||||
val=0;
|
||||
FILE_LOG(logDEBUG5, ("Setting Read out Flag: Continuous Readout\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setting Read out Flag: Continuous Readout\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -638,7 +638,7 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) {
|
||||
break;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG5, ("Read out Flag: 0x%x\n", retval));
|
||||
FILE_LOG(logDEBUG1, ("Read out Flag: 0x%x\n", retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
switch(ind) {
|
||||
case FRAME_NUMBER:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG5, ("Setting number of frames: %d * %d\n", (unsigned int)val, eiger_ncycles));
|
||||
FILE_LOG(logDEBUG1, ("Setting number of frames: %d * %d\n", (unsigned int)val, eiger_ncycles));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val*eiger_ncycles)) {
|
||||
eiger_nexposures = val;
|
||||
@ -678,7 +678,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG5, ("Setting exp time: %fs\n", val/(1E9)));
|
||||
FILE_LOG(logDEBUG1, ("Setting exp time: %fs\n", val/(1E9)));
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExposureTime(val/(1E9));
|
||||
#else
|
||||
@ -693,7 +693,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG5, ("Setting sub exp time: %lldns\n", (long long int)val));
|
||||
FILE_LOG(logDEBUG1, ("Setting sub exp time: %lldns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
// calculate subdeadtime before settings subexptime
|
||||
subdeadtime = Feb_Control_GetSubFramePeriod() -
|
||||
@ -743,7 +743,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG5, ("Setting acq period: %fs\n", val/(1E9)));
|
||||
FILE_LOG(logDEBUG1, ("Setting acq period: %fs\n", val/(1E9)));
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExposurePeriod(val/(1E9));
|
||||
#else
|
||||
@ -758,7 +758,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG5, ("Setting number of triggers: %d * %d\n",
|
||||
FILE_LOG(logDEBUG1, ("Setting number of triggers: %d * %d\n",
|
||||
(unsigned int)val,eiger_nexposures));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)) {
|
||||
@ -1005,7 +1005,7 @@ int setThresholdEnergy(int ev) {
|
||||
/* parameters - dac, adc, hv */
|
||||
|
||||
void setDAC(enum DACINDEX ind, int val, int mV, int retval[]) {
|
||||
FILE_LOG(logDEBUG5, ("Going to set dac %d to %d with mv mode %d \n", (int)ind, val, mV));
|
||||
FILE_LOG(logDEBUG1, ("Going to set dac %d to %d with mv mode %d \n", (int)ind, val, mV));
|
||||
if (ind == VTHRESHOLD) {
|
||||
int ret[5];
|
||||
setDAC(VCMP_LL,val,mV,retval);
|
||||
@ -1040,7 +1040,7 @@ void setDAC(enum DACINDEX ind, int val, int mV, int retval[]) {
|
||||
FILE_LOG(logINFO, ("dac value outside range:%d\n",(int)ind));
|
||||
strcpy(iname,dac_names[0]);
|
||||
}
|
||||
FILE_LOG(logDEBUG5, ("%s dac %d: %s to %d %s\n",
|
||||
FILE_LOG(logDEBUG1, ("%s dac %d: %s to %d %s\n",
|
||||
(val >= 0) ? "Setting" : "Getting",
|
||||
ind, iname, val,
|
||||
mV ? "mV" : "dac units"));
|
||||
@ -1166,7 +1166,7 @@ void setTiming( enum externalCommunicationMode arg) {
|
||||
case BURST_TRIGGER: ret = 1; break;
|
||||
case GATE_FIX_NUMBER: ret = 3; break;
|
||||
}
|
||||
FILE_LOG(logDEBUG5, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||
FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetTriggerMode(ret,1))
|
||||
#endif
|
||||
@ -1216,10 +1216,10 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
|
||||
|
||||
FILE_LOG(logINFO, ("src_port:%d\n"
|
||||
"src_ip:%s\n"
|
||||
"dst_ip:%s\n"
|
||||
"src_mac:%s\n"
|
||||
"dst_mac:%s\n",
|
||||
"\tsrc_ip:%s\n"
|
||||
"\tdst_ip:%s\n"
|
||||
"\tsrc_mac:%s\n"
|
||||
"\tdst_mac:%s\n",
|
||||
src_port, src_ip, dst_ip, src_mac, dst_mac));
|
||||
|
||||
|
||||
@ -1229,7 +1229,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
if (!top)
|
||||
dst_port = udpport2;
|
||||
|
||||
FILE_LOG(logINFO, ("dst_port:%d\n", dst_port));
|
||||
FILE_LOG(logINFO, ("\tdst_port:%d\n", dst_port));
|
||||
|
||||
int i=0;
|
||||
/* for(i=0;i<32;i++) { modified for Aldo*/
|
||||
@ -1282,7 +1282,7 @@ int setDetectorPosition(int pos[]) {
|
||||
|
||||
int setIODelay(int val) {
|
||||
if (val!=-1) {
|
||||
FILE_LOG(logDEBUG5, ("Setting IO Delay: %d\n",val));
|
||||
FILE_LOG(logDEBUG1, ("Setting IO Delay: %d\n",val));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(),val))
|
||||
#endif
|
||||
@ -1788,7 +1788,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
int idac, ichan, iadc;
|
||||
int ret=OK;
|
||||
|
||||
FILE_LOG(logDEBUG5, ("Copying module %x to module %x\n",srcMod,destMod));
|
||||
FILE_LOG(logDEBUG1, ("Copying module %x to module %x\n",srcMod,destMod));
|
||||
|
||||
if (srcMod->serialnumber>=0) {
|
||||
|
||||
@ -1808,9 +1808,9 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG5, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac));
|
||||
FILE_LOG(logDEBUG5, ("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc));
|
||||
FILE_LOG(logDEBUG5, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan));
|
||||
FILE_LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac));
|
||||
FILE_LOG(logDEBUG1, ("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc));
|
||||
FILE_LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan));
|
||||
destMod->ndac=srcMod->ndac;
|
||||
destMod->nadc=srcMod->nadc;
|
||||
destMod->nchip=srcMod->nchip;
|
||||
@ -1823,7 +1823,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
destMod->tau=srcMod->tau;
|
||||
if (srcMod->eV>=0)
|
||||
destMod->eV=srcMod->eV;
|
||||
FILE_LOG(logDEBUG5, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg ));
|
||||
FILE_LOG(logDEBUG1, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg ));
|
||||
|
||||
if (destMod->nchan!=0) {
|
||||
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
||||
|
Reference in New Issue
Block a user