mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
binaries in, std=gnu99, for loop variable declaration inside for loop
This commit is contained in:
@ -141,8 +141,7 @@ void Beb_Beb(int id) {
|
||||
exit(1);
|
||||
|
||||
LOG(logDEBUG1, ("Printing Beb infos:\n"));
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++)
|
||||
for (unsigned int i = 1; i < bebInfoSize; i++)
|
||||
BebInfo_Print(&beb_infos[i]);
|
||||
|
||||
Beb_bit_mode = 4;
|
||||
@ -750,8 +749,6 @@ void Beb_ResetFrameNumber() {
|
||||
}
|
||||
|
||||
void Beb_ClearBebInfos() {
|
||||
// unsigned int i;
|
||||
// for(i=0;i<bebInfoSize;i++) free(beb_infos[i]);
|
||||
bebInfoSize = 0;
|
||||
}
|
||||
|
||||
@ -817,8 +814,7 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig,
|
||||
}
|
||||
|
||||
int Beb_CheckSourceStuffBebInfo() {
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++) { // header stuff always starts from 1
|
||||
for (unsigned int i = 1; i < bebInfoSize; i++) { // header stuff always starts from 1
|
||||
if (!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 0,
|
||||
"00:00:00:00:00:00", "10.0.0.1", 20000) ||
|
||||
!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 1,
|
||||
@ -833,10 +829,7 @@ int Beb_CheckSourceStuffBebInfo() {
|
||||
}
|
||||
|
||||
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb) {
|
||||
/******************** if (!beb_numb) return
|
||||
* 0;******************************/
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++)
|
||||
for (unsigned int i = 1; i < bebInfoSize; i++)
|
||||
if (beb_numb == BebInfo_GetBebNumber(&beb_infos[i])) {
|
||||
LOG(logDEBUG1,
|
||||
("*****found beb index:%d, for beb number:%d\n", i, beb_numb));
|
||||
@ -870,14 +863,13 @@ int Beb_WriteTo(unsigned int index) {
|
||||
}
|
||||
|
||||
void Beb_SwapDataFun(int little_endian, unsigned int n, unsigned int *d) {
|
||||
unsigned int i;
|
||||
if (little_endian)
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
d[i] = (((d[i] & 0xff) << 24) | ((d[i] & 0xff00) << 8) |
|
||||
((d[i] & 0xff0000) >> 8) |
|
||||
((d[i] & 0xff000000) >> 24)); // little_endian
|
||||
else
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
d[i] = (((d[i] & 0xffff) << 16) | ((d[i] & 0xffff0000) >> 16));
|
||||
}
|
||||
|
||||
@ -976,13 +968,9 @@ udp_header_type udp_header = {
|
||||
|
||||
unsigned int *base_ptr = (unsigned int *)&udp_header;
|
||||
unsigned int num_words = (sizeof(struct udp_header_type) + 3) / 4;
|
||||
// for(unsigned int i=0; i<num_words; i++) word_ptr[i] = base_ptr[i];
|
||||
// for(unsigned int i=num_words; i<16; i++) word_ptr[i] = 0;
|
||||
// return word_ptr;
|
||||
unsigned int i;
|
||||
for (i = 0; i < num_words; i++)
|
||||
for (unsigned int i = 0; i < num_words; i++)
|
||||
Beb_send_data[i + 2] = base_ptr[i];
|
||||
for (i = num_words; i < 16; i++)
|
||||
for (unsigned int i = num_words; i < 16; i++)
|
||||
Beb_send_data[i + 2] = 0;
|
||||
|
||||
return 1;
|
||||
@ -1046,8 +1034,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) {
|
||||
|
||||
// calc ip checksum
|
||||
unsigned int ip_checksum = 0;
|
||||
unsigned int i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
for (unsigned int i = 0; i < 10; i++) {
|
||||
ip_checksum += ((cptr[2 * i] << 8) + (cptr[2 * i + 1]));
|
||||
if (ip_checksum & 0x00010000)
|
||||
ip_checksum = (ip_checksum + 1) & 0x0000ffff;
|
||||
@ -1190,11 +1177,9 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
LOG(logERROR, ("Beb Request N Images FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
}
|
||||
// Generating commands
|
||||
u_int32_t send_header_command =
|
||||
@ -1202,14 +1187,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
(ten_gig == 1) << 24 | header_size << 14 | 0;
|
||||
u_int32_t send_frame_command =
|
||||
0x62000000 | (!test_just_send_out_packets_no_wait) << 27 |
|
||||
(ten_gig == 1) << 24 | packet_size << 14 | (npackets - 1);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
(ten_gig == 1) << 24 | packet_size << 14 | (npackets - 1);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
}
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
|
||||
// Left
|
||||
Beb_Write32(csp0base, (LEFT_OFFSET + FIRST_CMD_PART1_OFFSET), 0);
|
||||
@ -1246,14 +1229,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
nimages * (2 + in_two_requests));
|
||||
Beb_Write32(csp0base, (RIGHT_OFFSET + COMMAND_COUNTER_OFFSET),
|
||||
nimages * (2 + in_two_requests));
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base,
|
||||
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base,
|
||||
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
|
||||
}
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
Beb_close(fd, csp0base);
|
||||
|
||||
LOG(logDEBUG1, ("----Beb_RequestNImages----\n"));
|
||||
@ -1275,8 +1256,7 @@ int Beb_Test(unsigned int beb_number) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (unsigned int i = 0; i < 64; i++) {
|
||||
if (!Beb_SetUpUDPHeader(beb_number, 0, i, "60:fb:42:f4:e3:d2",
|
||||
"129.129.205.186", 22000 + i)) {
|
||||
LOG(logERROR, ("Error setting up header table....\n"));
|
||||
@ -1288,7 +1268,7 @@ int Beb_Test(unsigned int beb_number) {
|
||||
// left_right, int ten_gig, unsigned int dst_number, unsigned int
|
||||
// npackets, unsigned int packet_size, int
|
||||
// stop_read_when_fifo_empty=1);
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (unsigned int i = 0; i < 64; i++) {
|
||||
if (!Beb_SendMultiReadRequest(beb_number, i % 3 + 1, 0, i, 1, 0, 1)) {
|
||||
LOG(logERROR, ("Error requesting data....\n"));
|
||||
return 0;
|
||||
|
@ -63,7 +63,6 @@ int Feb_Control_hv_fd = -1;
|
||||
|
||||
void Module_Module(struct Module *mod, unsigned int number,
|
||||
unsigned int address_top) {
|
||||
unsigned int i;
|
||||
mod->module_number = number;
|
||||
mod->top_address_valid = 1;
|
||||
mod->top_left_address = 0x100 | (0xff & address_top);
|
||||
@ -75,15 +74,14 @@ void Module_Module(struct Module *mod, unsigned int number,
|
||||
mod->high_voltage = -1;
|
||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
||||
}
|
||||
|
||||
void Module_ModuleBottom(struct Module *mod, unsigned int number,
|
||||
unsigned int address_bottom) {
|
||||
unsigned int i;
|
||||
mod->module_number = number;
|
||||
mod->top_address_valid = 0;
|
||||
mod->top_left_address = 0;
|
||||
@ -94,20 +92,19 @@ void Module_ModuleBottom(struct Module *mod, unsigned int number,
|
||||
|
||||
mod->high_voltage = -1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
mod->idelay_top[i] = mod->idelay_bottom[i] = 0;
|
||||
|
||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
||||
}
|
||||
|
||||
void Module_Module1(struct Module *mod, unsigned int number,
|
||||
unsigned int address_top, unsigned int address_bottom) {
|
||||
unsigned int i;
|
||||
mod->module_number = number;
|
||||
mod->top_address_valid = 1;
|
||||
mod->top_left_address = 0x100 | (0xff & address_top);
|
||||
@ -118,14 +115,14 @@ void Module_Module1(struct Module *mod, unsigned int number,
|
||||
|
||||
mod->high_voltage = -1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
mod->idelay_top[i] = mod->idelay_bottom[i] = 0;
|
||||
|
||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
||||
}
|
||||
|
||||
@ -219,7 +216,6 @@ void Feb_Control_FebControl() {
|
||||
}
|
||||
|
||||
int Feb_Control_Init(int master, int top, int normal, int module_num) {
|
||||
unsigned int i;
|
||||
Feb_Control_module_number = 0;
|
||||
Feb_Control_current_index = 0;
|
||||
Feb_control_master = master;
|
||||
@ -241,7 +237,7 @@ int Feb_Control_Init(int master, int top, int normal, int module_num) {
|
||||
|
||||
unsigned int nfebs = 0;
|
||||
unsigned int *feb_list = malloc(moduleSize * 4 * sizeof(unsigned int));
|
||||
for (i = 1; i < moduleSize; i++) {
|
||||
for (unsigned int i = 1; i < moduleSize; i++) {
|
||||
if (Module_TopAddressIsValid(&modules[i])) {
|
||||
feb_list[nfebs++] = Module_GetTopRightAddress(&modules[i]);
|
||||
feb_list[nfebs++] = Module_GetTopLeftAddress(&modules[i]);
|
||||
@ -321,9 +317,8 @@ void Feb_Control_CloseSerialCommunication() {
|
||||
}
|
||||
|
||||
void Feb_Control_PrintModuleList() {
|
||||
unsigned int i;
|
||||
LOG(logDEBUG1, ("Module list:\n"));
|
||||
for (i = 0; i < moduleSize; i++) {
|
||||
for (unsigned int i = 0; i < moduleSize; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("\t%d) %s modules: %d 0x%x %s\n", i,
|
||||
((i == 0) ? "All " : ((i == 1) ? "Master" : " ")),
|
||||
@ -338,8 +333,7 @@ void Feb_Control_PrintModuleList() {
|
||||
|
||||
int Feb_Control_GetModuleIndex(unsigned int module_number,
|
||||
unsigned int *module_index) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < moduleSize; i++) {
|
||||
for (unsigned int i = 0; i < moduleSize; i++) {
|
||||
if (Module_GetModuleNumber(&modules[i]) == module_number) {
|
||||
*module_index = i;
|
||||
return 1;
|
||||
@ -350,10 +344,9 @@ int Feb_Control_GetModuleIndex(unsigned int module_number,
|
||||
}
|
||||
|
||||
int Feb_Control_CheckModuleAddresses(struct Module *m) {
|
||||
unsigned int i;
|
||||
int found_t = 0;
|
||||
int found_b = 0;
|
||||
for (i = 0; i < moduleSize; i++) {
|
||||
for (unsigned int i = 0; i < moduleSize; i++) {
|
||||
if ((Module_TopAddressIsValid(m) &&
|
||||
Module_GetTopBaseAddress(&modules[i]) &&
|
||||
Module_GetTopBaseAddress(m) ==
|
||||
@ -408,8 +401,7 @@ int Feb_Control_AddModule1(unsigned int module_number, int top_enable,
|
||||
LOG(logINFO, ("\tRemoving previous assignment of module number %d.\n",
|
||||
module_number));
|
||||
// free(modules[pre_module_index]);
|
||||
int i;
|
||||
for (i = pre_module_index; i < moduleSize - 1; i++)
|
||||
for (int i = pre_module_index; i < moduleSize - 1; i++)
|
||||
modules[i] = modules[i + 1];
|
||||
moduleSize--;
|
||||
parameters_ok = 0;
|
||||
@ -460,13 +452,12 @@ Module_ModuleBottom(m,module_number,top_address);*/
|
||||
|
||||
int Feb_Control_CheckSetup(int master) {
|
||||
LOG(logDEBUG1, ("Checking Set up\n"));
|
||||
unsigned int i, j;
|
||||
unsigned int i;
|
||||
int ok = 1;
|
||||
|
||||
/*for(i=0;i<moduleSize;i++) {*/
|
||||
i = Feb_Control_current_index;
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (unsigned int j = 0; j < 4; j++) {
|
||||
if (Module_GetTopIDelay(&modules[i], j) < 0) {
|
||||
LOG(logERROR, ("module %d's idelay top number %d not set.\n",
|
||||
Module_GetModuleNumber(&modules[i]), j));
|
||||
@ -484,7 +475,7 @@ int Feb_Control_CheckSetup(int master) {
|
||||
Module_GetModuleNumber(&modules[i])));
|
||||
ok = 0;
|
||||
}
|
||||
for (j = 0; j < Module_ndacs; j++) {
|
||||
for (unsigned int j = 0; j < Module_ndacs; j++) {
|
||||
if (Module_GetTopDACValue(&modules[i], j) < 0) {
|
||||
LOG(logERROR,
|
||||
("module %d's top \"%s\" dac is not set.\n",
|
||||
@ -511,8 +502,7 @@ unsigned int Feb_Control_GetNModules() {
|
||||
|
||||
unsigned int Feb_Control_GetNHalfModules() {
|
||||
unsigned int n_half_modules = 0;
|
||||
unsigned int i;
|
||||
for (i = 1; i < moduleSize; i++) {
|
||||
for (unsigned int i = 1; i < moduleSize; i++) {
|
||||
if (Module_TopAddressIsValid(&modules[i]))
|
||||
n_half_modules++;
|
||||
if (Module_BottomAddressIsValid(&modules[i]))
|
||||
@ -536,7 +526,6 @@ int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units) {
|
||||
int Feb_Control_SetIDelays1(
|
||||
unsigned int module_num, unsigned int chip_pos,
|
||||
unsigned int ndelay_units) { // chip_pos 0=ll,1=lr,0=rl,1=rr
|
||||
unsigned int i;
|
||||
// currently set same for top and bottom
|
||||
if (chip_pos > 3) {
|
||||
LOG(logERROR, ("SetIDelay chip_pos %d doesn't exist.\n", chip_pos));
|
||||
@ -560,10 +549,10 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetTopIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else {
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
}
|
||||
@ -582,10 +571,10 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetBottomIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else {
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
}
|
||||
@ -605,7 +594,7 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetTopIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
} else {
|
||||
@ -623,7 +612,7 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetBottomIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
} else {
|
||||
@ -930,7 +919,6 @@ int Feb_Control_DecodeDACString(char *dac_str, unsigned int *module_index,
|
||||
}
|
||||
|
||||
int Feb_Control_SetDAC(char *dac_str, int value, int is_a_voltage_mv) {
|
||||
unsigned int i;
|
||||
unsigned int module_index, dac_ch;
|
||||
int top, bottom;
|
||||
if (!Feb_Control_DecodeDACString(dac_str, &module_index, &top, &bottom,
|
||||
@ -958,7 +946,7 @@ int Feb_Control_SetDAC(char *dac_str, int value, int is_a_voltage_mv) {
|
||||
if (module_index != 0)
|
||||
Module_SetTopDACValue(&modules[module_index], dac_ch, v);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopDACValue(&modules[i], dac_ch, v);
|
||||
}
|
||||
|
||||
@ -970,7 +958,7 @@ int Feb_Control_SetDAC(char *dac_str, int value, int is_a_voltage_mv) {
|
||||
if (module_index != 0)
|
||||
Module_SetBottomDACValue(&modules[module_index], dac_ch, v);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomDACValue(&modules[i], dac_ch, v);
|
||||
}
|
||||
|
||||
@ -1004,8 +992,7 @@ int Feb_Control_GetDACName(unsigned int dac_num, char *s) {
|
||||
}
|
||||
|
||||
int Feb_Control_GetDACNumber(char *s, unsigned int *n) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < Module_ndacs; i++) {
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++) {
|
||||
if (!strcmp(Module_dac_names[i], s)) {
|
||||
*n = i;
|
||||
return 1;
|
||||
@ -1051,10 +1038,6 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
int top) {
|
||||
LOG(logINFO, ("Setting Trimbits\n"));
|
||||
|
||||
// for (int iy=10000;iy<20020;++iy)//263681
|
||||
// for (int iy=263670;iy<263680;++iy)//263681
|
||||
// LOG(logINFO, ("%d:%c\t\t",iy,trimbits[iy]));
|
||||
|
||||
unsigned int trimbits_to_load_l[1024];
|
||||
unsigned int trimbits_to_load_r[1024];
|
||||
|
||||
@ -1067,8 +1050,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
if (Feb_Control_Reset() == STATUS_ERROR) {
|
||||
LOG(logERROR, ("could not reset DAQ.\n"));
|
||||
}
|
||||
int l_r;
|
||||
for (l_r = 0; l_r < 2; l_r++) { // l_r loop
|
||||
for (int l_r = 0; l_r < 2; l_r++) { // l_r loop
|
||||
unsigned int disable_chip_mask =
|
||||
l_r ? DAQ_CS_BAR_LEFT : DAQ_CS_BAR_RIGHT;
|
||||
if (Feb_Control_activated) {
|
||||
@ -1085,8 +1067,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
}
|
||||
}
|
||||
|
||||
int row_set;
|
||||
for (row_set = 0; row_set < 16; row_set++) { // 16 rows at a time
|
||||
for (int row_set = 0; row_set < 16; row_set++) { // 16 rows at a time
|
||||
if (row_set == 0) {
|
||||
if (!Feb_Control_SetCommandRegister(
|
||||
DAQ_RESET_COMPLETELY | DAQ_SEND_A_TOKEN_IN |
|
||||
@ -1104,11 +1085,9 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
}
|
||||
}
|
||||
|
||||
int row;
|
||||
for (row = 0; row < 16; row++) { // row loop
|
||||
for (int row = 0; row < 16; row++) { // row loop
|
||||
int offset = 2 * 32 * row;
|
||||
int sc;
|
||||
for (sc = 0; sc < 32; sc++) { // supercolumn loop sc
|
||||
for (int sc = 0; sc < 32; sc++) { // supercolumn loop sc
|
||||
int super_column_start_position_l =
|
||||
1030 * row + l_r * 258 + sc * 8;
|
||||
int super_column_start_position_r =
|
||||
@ -1125,8 +1104,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
trimbits_to_load_r[offset + chip_sc] = 0;
|
||||
trimbits_to_load_l[offset + chip_sc + 32] = 0;
|
||||
trimbits_to_load_r[offset + chip_sc + 32] = 0;
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) { // column loop i
|
||||
for (int i = 0; i < 8; i++) { // column loop i
|
||||
|
||||
if (top == 1) {
|
||||
trimbits_to_load_l[offset + chip_sc] |=
|
||||
@ -1865,8 +1843,7 @@ int Feb_Control_StartAcquisition() {
|
||||
static unsigned int reg_nums[20];
|
||||
static unsigned int reg_vals[20];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 14; i++) {
|
||||
for (int i = 0; i < 14; i++) {
|
||||
reg_nums[i] = DAQ_REG_CTRL;
|
||||
reg_vals[i] = 0;
|
||||
}
|
||||
@ -1888,8 +1865,7 @@ int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
||||
|
||||
int Feb_Control_SaveAllTrimbitsTo(int value, int top) {
|
||||
unsigned int chanregs[Feb_Control_trimbit_size];
|
||||
int i;
|
||||
for (i = 0; i < Feb_Control_trimbit_size; i++)
|
||||
for (int i = 0; i < Feb_Control_trimbit_size; i++)
|
||||
chanregs[i] = value;
|
||||
return Feb_Control_SetTrimbits(0, chanregs, top);
|
||||
}
|
||||
@ -1902,7 +1878,6 @@ int Feb_Control_Pulse_Pixel(int npulses, int x, int y) {
|
||||
// this function is not designed for speed
|
||||
|
||||
int pulse_multiple = 0; // has to be 0 or 1
|
||||
int i;
|
||||
|
||||
if (x < 0) {
|
||||
x = -x;
|
||||
@ -1939,7 +1914,7 @@ int Feb_Control_Pulse_Pixel(int npulses, int x, int y) {
|
||||
|
||||
if (!pulse_multiple)
|
||||
serial_in = 0;
|
||||
for (i = 0; i < x / 8; i++)
|
||||
for (int i = 0; i < x / 8; i++)
|
||||
Feb_Control_Shift32InSerialIn(serial_in);
|
||||
|
||||
Feb_Control_SendTokenIn();
|
||||
@ -2015,7 +1990,6 @@ int Feb_Control_ClockRowClock(unsigned int ntimes) {
|
||||
}
|
||||
|
||||
int Feb_Control_PulseChip(int npulses) {
|
||||
int i;
|
||||
int on = 1;
|
||||
|
||||
if (npulses == -1) {
|
||||
@ -2030,7 +2004,7 @@ int Feb_Control_PulseChip(int npulses) {
|
||||
Feb_Control_SetStaticBits(); // toggle the enable 2x times
|
||||
Feb_Control_ResetChipCompletely();
|
||||
|
||||
for (i = 0; i < npulses; i++) {
|
||||
for (int i = 0; i < npulses; i++) {
|
||||
if (!Feb_Control_SetCommandRegister(
|
||||
DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED | DAQ_RESET_PERIPHERY |
|
||||
DAQ_RESET_COLUMN_SELECT)) {
|
||||
@ -2092,8 +2066,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
tau_in_sec, period_in_sec));
|
||||
|
||||
LOG(logINFO, ("\tCalculating table for tau of %lld ns.\n", tau_in_Nsec));
|
||||
int i;
|
||||
for (i = 0; i < np; i++) {
|
||||
for (int i = 0; i < np; i++) {
|
||||
Feb_Control_rate_meas[i] = i * exp(-i / period_in_sec * tau_in_sec);
|
||||
if (Feb_Control_rate_meas[i] > ratemax)
|
||||
ratemax = Feb_Control_rate_meas[i];
|
||||
@ -2123,8 +2096,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
Feb_Control_rate_correction_table[0] =
|
||||
(((int)(m[0] + 0.5) & 0xf) << 14) | ((int)(b0[0] + 0.5) & 0x3fff);
|
||||
|
||||
int b = 0;
|
||||
for (b = 1; b < 1024; b++) {
|
||||
for (int b = 1; b < 1024; b++) {
|
||||
if (m[b - 1] < 15) {
|
||||
double s = 0, sx = 0, sy = 0, sxx = 0, sxy = 0;
|
||||
for (;; next_i++) {
|
||||
@ -2278,9 +2250,8 @@ void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction) {
|
||||
}
|
||||
|
||||
int Feb_Control_PrintCorrectedValues() {
|
||||
int i;
|
||||
int delta, slope, base, lsb, corr;
|
||||
for (i = 0; i < 4096; i++) {
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
lsb = i & 3;
|
||||
base = Feb_Control_rate_correction_table[i >> 2] & 0x3fff;
|
||||
slope = ((Feb_Control_rate_correction_table[i >> 2] & 0x3c000) >> 14);
|
||||
@ -2400,8 +2371,7 @@ int Feb_Control_SetInterruptSubframe(int val) {
|
||||
? Module_GetTopLeftAddress(&modules[1])
|
||||
: Module_GetBottomLeftAddress(&modules[1]);
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
// get previous value to keep it
|
||||
if (!Feb_Interface_ReadRegister(addr[iloop], offset, ®Val)) {
|
||||
LOG(logERROR, ("Could not read %s %s interrupt subframe\n", isTop,
|
||||
@ -2438,8 +2408,7 @@ int Feb_Control_GetInterruptSubframe() {
|
||||
: Module_GetBottomLeftAddress(&modules[1]);
|
||||
uint32_t value[2] = {0, 0};
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
if (!Feb_Interface_ReadRegister(addr[iloop], offset, ®Val)) {
|
||||
LOG(logERROR, ("Could not read back %s %s interrupt subframe\n",
|
||||
isTop, side[iloop]));
|
||||
@ -2469,8 +2438,7 @@ int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right) {
|
||||
addr[1] = Module_GetTopRightAddress(&modules[1]);
|
||||
}
|
||||
char *top_names[] = {TOP_NAMES};
|
||||
int i = 0;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (addr[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
@ -2518,8 +2486,7 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
||||
addr[0] = Module_GetTopLeftAddress(&modules[1]);
|
||||
addr[1] = Module_GetTopRightAddress(&modules[1]);
|
||||
char *master_names[] = {MASTER_NAMES};
|
||||
int i = 0;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
uint32_t value = 0;
|
||||
if (!Feb_Interface_ReadRegister(addr[i], offset, &value)) {
|
||||
LOG(logERROR, ("Could not read %s Feb reg to set Master flag\n",
|
||||
@ -2617,8 +2584,7 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
||||
actualOffset = offset - 0x100;
|
||||
}
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
if (run[iloop]) {
|
||||
LOG(logINFO, ("Writing 0x%x to %s %s 0x%x\n", data, isTop,
|
||||
side[iloop], actualOffset));
|
||||
@ -2666,8 +2632,7 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
|
||||
actualOffset = offset - 0x100;
|
||||
}
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
if (run[iloop]) {
|
||||
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
|
||||
&value[iloop])) {
|
||||
|
@ -42,12 +42,11 @@ void Feb_Interface_FebInterface() {
|
||||
}
|
||||
|
||||
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list) {
|
||||
unsigned int i;
|
||||
if (Feb_Interface_feb_numb)
|
||||
free(Feb_Interface_feb_numb);
|
||||
Feb_Interface_nfebs = n;
|
||||
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
Feb_Interface_feb_numb[i] = list[i];
|
||||
}
|
||||
|
||||
@ -72,7 +71,6 @@ int Feb_Interface_WriteTo(unsigned int ch) {
|
||||
}
|
||||
|
||||
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
|
||||
unsigned int t;
|
||||
if (ch >= 0xfff)
|
||||
return 0;
|
||||
|
||||
@ -81,7 +79,7 @@ int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
|
||||
usleep(20);
|
||||
|
||||
Feb_Interface_recv_ndata = -1;
|
||||
for (t = 0; t < ntrys; t++) {
|
||||
for (unsigned int t = 0; t < ntrys; t++) {
|
||||
if ((Feb_Interface_recv_ndata =
|
||||
Local_Read(ll, Feb_Interface_recv_buffer_size * 4,
|
||||
Feb_Interface_recv_data_raw) /
|
||||
@ -102,9 +100,8 @@ int Feb_Interface_SetByteOrder() {
|
||||
Feb_Interface_send_ndata = 2;
|
||||
Feb_Interface_send_data[0] = 0;
|
||||
Feb_Interface_send_data[1] = 0;
|
||||
unsigned int i;
|
||||
unsigned int dst = 0xff;
|
||||
for (i = 0; i < Feb_Interface_nfebs; i++)
|
||||
for (unsigned int i = 0; i < Feb_Interface_nfebs; i++)
|
||||
dst = (dst | Feb_Interface_feb_numb[i]);
|
||||
int passed = Feb_Interface_WriteTo(dst);
|
||||
|
||||
@ -119,8 +116,6 @@ int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
|
||||
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
unsigned int *reg_nums,
|
||||
unsigned int *values_read) {
|
||||
// here cout<<"Reading Register ...."<<endl;
|
||||
unsigned int i;
|
||||
nreads &= 0x3ff;
|
||||
if (!nreads || nreads > Feb_Interface_send_buffer_size - 2)
|
||||
return 0;
|
||||
@ -128,7 +123,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
Feb_Interface_send_ndata = nreads + 2;
|
||||
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
|
||||
|
||||
for (i = 0; i < nreads; i++)
|
||||
for (unsigned int i = 0; i < nreads; i++)
|
||||
Feb_Interface_send_data[i + 1] = reg_nums[i];
|
||||
Feb_Interface_send_data[nreads + 1] = 0;
|
||||
|
||||
@ -137,7 +132,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
Feb_Interface_recv_ndata != (int)(nreads + 2))
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < nreads; i++)
|
||||
for (unsigned int i = 0; i < nreads; i++)
|
||||
values_read[i] = Feb_Interface_recv_data[i + 1];
|
||||
|
||||
return 1;
|
||||
@ -154,7 +149,6 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
|
||||
unsigned int *reg_nums, unsigned int *values,
|
||||
int *wait_ons,
|
||||
unsigned int *wait_on_addresses) {
|
||||
unsigned int i;
|
||||
nwrites &= 0x3ff; // 10 bits
|
||||
if (!nwrites || 2 * nwrites > Feb_Interface_send_buffer_size - 2)
|
||||
return 0;
|
||||
@ -165,13 +159,13 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
|
||||
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
|
||||
Feb_Interface_send_data[2 * nwrites + 1] = 0;
|
||||
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[2 * i + 1] = 0x3fff & reg_nums[i];
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[2 * i + 2] = values[i];
|
||||
// wait on busy data(28), address of busy flag data(27 downto 14)
|
||||
if (wait_ons && wait_on_addresses)
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[2 * i + 1] |=
|
||||
(wait_ons[i] << 28 | (0x3fff & wait_on_addresses[i]) << 14);
|
||||
|
||||
@ -211,7 +205,6 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
|
||||
unsigned int start_address, unsigned int nwrites,
|
||||
unsigned int *values) {
|
||||
// -1 means write to all
|
||||
unsigned int i;
|
||||
mem_num &= 0x3f;
|
||||
start_address &= 0x3fff;
|
||||
nwrites &= 0x3ff;
|
||||
@ -226,7 +219,7 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
|
||||
start_address; // cmd -> write to memory, nwrites, mem number, start
|
||||
// address
|
||||
Feb_Interface_send_data[nwrites + 1] = 0;
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[i + 1] = values[i];
|
||||
|
||||
if (!Feb_Interface_WriteTo(sub_num))
|
||||
|
@ -81,7 +81,6 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
// note: buffer must be word (4 byte) aligned
|
||||
// frame_len in byte
|
||||
int vacancy = 0;
|
||||
int i;
|
||||
int words_send = 0;
|
||||
int last_word;
|
||||
unsigned int *word_ptr;
|
||||
@ -96,7 +95,7 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
|
||||
LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ", buffer_len,
|
||||
ll->ll_fifo_base));
|
||||
for (i = 0; i < buffer_len / 4; i++)
|
||||
for (int i = 0; i < buffer_len / 4; i++)
|
||||
LOG(logDEBUG1, ("%.8X ", *(((unsigned *)buffer) + i)));
|
||||
|
||||
while (words_send <= last_word) {
|
||||
@ -112,7 +111,7 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
}
|
||||
|
||||
// Just to know: #define PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS 100
|
||||
for (i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
|
||||
for (int i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
|
||||
(words_send <= last_word));
|
||||
i++) {
|
||||
fifo_ctrl = 0;
|
||||
|
@ -6,7 +6,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
BLACKFIN_CC = bfin-uclinux-gcc
|
||||
CROSS = powerpc-4xx-softfloat-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = eigerDetectorServer
|
||||
DESTDIR = bin
|
||||
|
Binary file not shown.
@ -639,8 +639,7 @@ void allocateDetectorStructureMemory() {
|
||||
thisSettings = UNINITIALIZED;
|
||||
|
||||
// if trimval requested, should return -1 to acknowledge unknown
|
||||
int ichan = 0;
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
*((detectorModules->chanregs) + ichan) = -1;
|
||||
}
|
||||
}
|
||||
@ -651,9 +650,8 @@ void setupDetector() {
|
||||
// set dacs
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if ((detectorModules)->dacs[i] != defaultvals[i]) {
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
@ -748,8 +746,7 @@ int setDynamicRange(int dr) {
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetDynamicRange(dr)) {
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
if (!Beb_SetUpTransferParameters(dr)) {
|
||||
LOG(logERROR, ("Could not set bit mode in the back end\n"));
|
||||
@ -829,8 +826,7 @@ void setNumFrames(int64_t val) {
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_ntriggers)) {
|
||||
eiger_nexposures = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
ndsts_in_use = 1;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
@ -851,8 +847,7 @@ void setNumTriggers(int64_t val) {
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_nexposures)) {
|
||||
eiger_ntriggers = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
@ -1021,18 +1016,15 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
}
|
||||
|
||||
// dacs
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
if (myMod.dacs[i] != (detectorModules)->dacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n",
|
||||
i);
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
if (myMod.dacs[i] != (detectorModules)->dacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n",
|
||||
i);
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1044,10 +1036,10 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
LOG(logINFO, ("Setting module with trimbits\n"));
|
||||
// includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy, ichip, ix, ip = 0, ich = 0;
|
||||
for (iy = 0; iy < 256; ++iy) {
|
||||
for (ichip = 0; ichip < 4; ++ichip) {
|
||||
for (ix = 0; ix < 256; ++ix) {
|
||||
int ip = 0, ich = 0;
|
||||
for (int iy = 0; iy < 256; ++iy) {
|
||||
for (int ichip = 0; ichip < 4; ++ichip) {
|
||||
for (int ix = 0; ix < 256; ++ix) {
|
||||
tt[ip++] = myMod.chanregs[ich++];
|
||||
}
|
||||
if (ichip < 3) {
|
||||
@ -1121,10 +1113,10 @@ int getModule(sls_detector_module *myMod) {
|
||||
tt = Feb_Control_GetTrimbits();
|
||||
|
||||
// exclude gap pixels
|
||||
int iy, ichip, ix, ip = 0, ich = 0;
|
||||
for (iy = 0; iy < 256; ++iy) {
|
||||
for (ichip = 0; ichip < 4; ++ichip) {
|
||||
for (ix = 0; ix < 256; ++iy) {
|
||||
int ip = 0, ich = 0;
|
||||
for (int iy = 0; iy < 256; ++iy) {
|
||||
for (int ichip = 0; ichip < 4; ++ichip) {
|
||||
for (int ix = 0; ix < 256; ++iy) {
|
||||
myMod->chanregs[ich++] = tt[ip++];
|
||||
}
|
||||
if (ichip < 3) {
|
||||
@ -1432,37 +1424,32 @@ int configureMAC() {
|
||||
if (!top)
|
||||
dst_port = dstport2;
|
||||
|
||||
int i = 0;
|
||||
/* for(i=0;i<32;i++) { modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num, send_to_ten_gig, src_mac, src_ip,
|
||||
srcport) &&
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number + i, dst_mac,
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number, dst_mac,
|
||||
dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, ("\tset up left ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
/*}*/
|
||||
|
||||
header_number = 32;
|
||||
dst_port = dstport2;
|
||||
if (!top)
|
||||
dst_port = dstport;
|
||||
|
||||
/*for(i=0;i<32;i++) {*/ /** modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num, send_to_ten_gig, src_mac, src_ip,
|
||||
srcport) &&
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number + i, dst_mac,
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number, dst_mac,
|
||||
dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, (" set up right ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
/*}*/
|
||||
|
||||
on_dst = 0;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
@ -1849,8 +1836,7 @@ int setAllTrimbits(int val) {
|
||||
}
|
||||
#endif
|
||||
if (detectorModules) {
|
||||
int ichan;
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
*((detectorModules->chanregs) + ichan) = val;
|
||||
}
|
||||
}
|
||||
@ -1860,10 +1846,9 @@ int setAllTrimbits(int val) {
|
||||
}
|
||||
|
||||
int getAllTrimbits() {
|
||||
int ichan = 0;
|
||||
int value = *((detectorModules->chanregs));
|
||||
if (detectorModules) {
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
if (*((detectorModules->chanregs) + ichan) != value) {
|
||||
value = -1;
|
||||
break;
|
||||
@ -2094,10 +2079,9 @@ void *start_timer(void *arg) {
|
||||
char imageData[databytes * 2];
|
||||
memset(imageData, 0, databytes * 2);
|
||||
{
|
||||
int i = 0;
|
||||
switch (dr) {
|
||||
case 4:
|
||||
for (i = 0; i < ntotpixels / 2; ++i) {
|
||||
for (int i = 0; i < ntotpixels / 2; ++i) {
|
||||
*((uint8_t *)(imageData + i)) =
|
||||
eiger_virtual_test_mode
|
||||
? 0xEE
|
||||
@ -2105,19 +2089,19 @@ void *start_timer(void *arg) {
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint8_t *)(imageData + i)) =
|
||||
eiger_virtual_test_mode ? 0xFE : (uint8_t)i;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFE : (uint16_t)i;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFFFFE : (uint32_t)i;
|
||||
}
|
||||
@ -2132,8 +2116,7 @@ void *start_timer(void *arg) {
|
||||
uint64_t frameNr = 0;
|
||||
getStartingFrameNumber(&frameNr);
|
||||
// loop over number of frames
|
||||
int iframes = 0;
|
||||
for (iframes = 0; iframes != numFrames; ++iframes) {
|
||||
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
||||
|
||||
usleep(eiger_virtual_transmission_delay_frame);
|
||||
|
||||
@ -2155,8 +2138,8 @@ void *start_timer(void *arg) {
|
||||
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != numPacketsPerFrame; ++i) {
|
||||
|
||||
int i = 0; i != numPacketsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
@ -2187,8 +2170,7 @@ void *start_timer(void *arg) {
|
||||
int dstOffset = sizeof(sls_detector_header);
|
||||
int dstOffset2 = sizeof(sls_detector_header);
|
||||
{
|
||||
int psize = 0;
|
||||
for (psize = 0; psize < datasize; psize += npixelsx) {
|
||||
for (int psize = 0; psize < datasize; psize += npixelsx) {
|
||||
|
||||
if (dr == 32 && tgEnable == 0) {
|
||||
memcpy(packetData + dstOffset,
|
||||
@ -2309,10 +2291,6 @@ int startReadOut() {
|
||||
if ((ret_val = (!Beb_RequestNImages(beb_num, send_to_ten_gig, on_dst,
|
||||
nimages_per_request, 0))))
|
||||
break;
|
||||
// for(i=0;i<nimages_per_request;i++)
|
||||
// if ((ret_val =
|
||||
//(!Beb_RequestNImages(beb_num,send_to_ten_gig,on_dst,1,0))))
|
||||
// break;
|
||||
|
||||
dst_requested[on_dst++] = 0;
|
||||
on_dst %= ndsts_in_use;
|
||||
@ -2407,10 +2385,6 @@ void readFrame(int *ret, char *mess) {
|
||||
/* common */
|
||||
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
|
||||
int idac, ichan;
|
||||
int ret = OK;
|
||||
|
||||
LOG(logDEBUG1, ("Copying module\n"));
|
||||
|
||||
if (srcMod->serialnumber >= 0) {
|
||||
@ -2445,19 +2419,19 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
LOG(logDEBUG1, ("Copying register %x (%x)\n", destMod->reg, srcMod->reg));
|
||||
|
||||
if (destMod->nchan != 0) {
|
||||
for (ichan = 0; ichan < (srcMod->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (srcMod->nchan); ichan++) {
|
||||
if (*((srcMod->chanregs) + ichan) >= 0)
|
||||
*((destMod->chanregs) + ichan) = *((srcMod->chanregs) + ichan);
|
||||
}
|
||||
} else
|
||||
LOG(logINFO, ("Not Copying trimbits\n"));
|
||||
|
||||
for (idac = 0; idac < (srcMod->ndac); idac++) {
|
||||
for (int idac = 0; idac < (srcMod->ndac); idac++) {
|
||||
if (*((srcMod->dacs) + idac) >= 0) {
|
||||
*((destMod->dacs) + idac) = *((srcMod->dacs) + idac);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int calculateDataBytes() {
|
||||
|
Reference in New Issue
Block a user