clang format

This commit is contained in:
2021-10-19 14:49:43 +02:00
parent 3726ae3fd1
commit b39c64032d
66 changed files with 642 additions and 624 deletions

View File

@ -14,7 +14,6 @@ extern int isControlServer;
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
struct LocalLinkInterface ll_beb_local, *ll_beb;
struct udp_header_type udp_header;
@ -47,7 +46,6 @@ int Beb_deactivated_left_datastream = 1;
int Beb_deactivated_right_datastream = 1;
int Beb_deactivated_num_destinations = 1;
void Beb_Beb() {
Beb_send_ndata = 0;
Beb_send_buffer_size = 1026;
@ -90,7 +88,9 @@ void Beb_Beb() {
void Beb_ClearHeaderData(int ten_gig) {
for (int i = 0; i < MAX_UDP_DESTINATION; ++i) {
if (!Beb_SetUpUDPHeader(i, ten_gig, 0, 0, 0, 0, 0, 0)) {
LOG(logERROR, ("Could not clear header data for entry %d (tengiga:%d)\n", i, ten_gig));
LOG(logERROR,
("Could not clear header data for entry %d (tengiga:%d)\n", i,
ten_gig));
}
}
}
@ -112,7 +112,8 @@ int Beb_SetUpUDPHeader(unsigned int header_number, int ten_gig,
else
bram_phy_addr = 0xC6001000;
if (!Beb_SetHeaderData(src_mac, src_ip, src_port, dst_mac, dst_ip, dst_port))
if (!Beb_SetHeaderData(src_mac, src_ip, src_port, dst_mac, dst_ip,
dst_port))
return 0;
int fd = Beb_open(&csp0base, bram_phy_addr);
@ -493,7 +494,7 @@ int Beb_SetDataStream(enum portPosition port, int enable) {
: XPAR_GPIO_RGHT_STRM_DSBL_MSK);
u_int32_t value = Beb_Read32(csp0base, reg);
// disabling in firmware
// disabling in firmware
if (!enable)
value |= mask;
else
@ -875,11 +876,12 @@ int Beb_StopAcquisition() {
return 1;
}
int Beb_RequestNImages(int ten_gig, unsigned int nimages, int test_just_send_out_packets_no_wait) {
int Beb_RequestNImages(int ten_gig, unsigned int nimages,
int test_just_send_out_packets_no_wait) {
if (!Beb_activated)
return 1;
unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnp = (ten_gig ? 4 : 16) * Beb_bit_mode;
unsigned int nl = Beb_readNRows;
unsigned int npackets = (nl * maxnp) / maxnl;
@ -899,8 +901,8 @@ int Beb_RequestNImages(int ten_gig, unsigned int nimages, int test_just_send_out
LOG(logINFO, ("ten_gig:%d, npackets:%d, "
"Beb_bit_mode:%d, header_size:%d, nimages:%d, "
"test_just_send_out_packets_no_wait:%d\n",
ten_gig, npackets, Beb_bit_mode,
header_size, nimages, test_just_send_out_packets_no_wait));
ten_gig, npackets, Beb_bit_mode, header_size, nimages,
test_just_send_out_packets_no_wait));
u_int32_t right_port_value = 0x2000;
u_int32_t *csp0base = 0;

View File

@ -1143,7 +1143,8 @@ int Feb_Control_SoftwareTrigger(int block) {
// end of acquisition (cannot monitor readyForTrigger)
int status = Feb_Control_AcquisitionInProgress();
if (status == STATUS_ERROR) {
LOG(logERROR, ("Status: ERROR reading DAQ status register\n"));
LOG(logERROR,
("Status: ERROR reading DAQ status register\n"));
return 0;
} else if (status == STATUS_IDLE) {
break;
@ -1158,8 +1159,10 @@ int Feb_Control_SoftwareTrigger(int block) {
}
LOG(logDEBUG2, ("Done waiting (wait for trigger)!\n"));
}
LOG(logINFO, ("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"), (block ? "Acquired" : "Sent")));
fflush(stdout);
LOG(logINFO,
("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"),
(block ? "Acquired" : "Sent")));
fflush(stdout);
}
return 1;

View File

@ -15,7 +15,7 @@
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
#define DAQ_REG_SUBFRAME_EXPOSURES 6
#define DAQ_REG_SUBFRAME_PERIOD 7 // also pg and fifo status register
#define DAQ_REG_READ_N_ROWS 8
#define DAQ_REG_READ_N_ROWS 8
#define DAQ_REG_HRDWRE 12
// clang-format off

View File

@ -1,7 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
// from Gerd and was called mmap_test.h
#ifndef __PLB_LL_FIFO_H__

View File

@ -692,7 +692,7 @@ void setupDetector() {
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
setParallelMode(DEFAULT_PARALLEL_MODE);
setOverFlowMode(DEFAULT_READOUT_OVERFLOW32_MODE);
setReadoutSpeed(DEFAULT_CLK_SPEED);
setReadoutSpeed(DEFAULT_CLK_SPEED);
setIODelay(DEFAULT_IO_DELAY);
setTiming(DEFAULT_TIMING_MODE);
setNextFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
@ -1544,13 +1544,13 @@ int configureMAC() {
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
LOG(logINFO,
("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %d\n"
"\tDest Port2 : %d\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport, dstport2));
"\tSource MAC : %s\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %d\n"
"\tDest Port2 : %d\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport, dstport2));
}
#ifdef VIRTUAL
@ -1730,7 +1730,7 @@ int setReadoutSpeed(int val) {
return OK;
}
int getReadoutSpeed(int* retval) {
int getReadoutSpeed(int *retval) {
*retval = eiger_readoutspeed;
return OK;
}
@ -2311,14 +2311,11 @@ void *start_timer(void *arg) {
int readNRows = getReadNRows();
if (readNRows == -1) {
LOG(logERROR,
("readNRows is -1. Assuming no readNRows.\n"));
LOG(logERROR, ("readNRows is -1. Assuming no readNRows.\n"));
readNRows = MAX_ROWS_PER_READOUT;
}
const int maxRows = MAX_ROWS_PER_READOUT;
const int packetsPerFrame =
(maxPacketsPerFrame * readNRows) / maxRows;
const int packetsPerFrame = (maxPacketsPerFrame * readNRows) / maxRows;
LOG(logDEBUG1,
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
@ -2358,19 +2355,16 @@ void *start_timer(void *arg) {
break;
case 16:
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
eiger_virtual_test_mode ? 0xFFE
: (uint16_t)pixelVal;
eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
break;
case 32:
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
eiger_virtual_test_mode ? 0xFFFFFE
: (uint32_t)pixelVal;
eiger_virtual_test_mode ? 0xFFFFFE : (uint32_t)pixelVal;
break;
default:
break;
}
}
}
// Send data
@ -2404,7 +2398,6 @@ void *start_timer(void *arg) {
const int startval = 0;
const int endval = startval + packetsPerFrame - 1;
// set header
char packetData[packetsize];
memset(packetData, 0, packetsize);
@ -2466,18 +2459,21 @@ void *start_timer(void *arg) {
}
}
}
if (eiger_virtual_left_datastream && i >= startval && i <= endval) {
if (eiger_virtual_left_datastream && i >= startval &&
i <= endval) {
usleep(eiger_virtual_transmission_delay_left);
sendUDPPacket(iRxEntry, 0, packetData, packetsize);
LOG(logDEBUG1, ("Sent left packet: %d\n", i));
}
if (eiger_virtual_right_datastream && i >= startval && i <= endval) {
if (eiger_virtual_right_datastream && i >= startval &&
i <= endval) {
usleep(eiger_virtual_transmission_delay_right);
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
LOG(logDEBUG1, ("Sent right packet: %d\n", i));
}
}
LOG(logINFO, ("Sent frame %d [#%ld] to E%d\n", iframes, frameNr + iframes, iRxEntry));
LOG(logINFO, ("Sent frame %d [#%ld] to E%d\n", iframes,
frameNr + iframes, iRxEntry));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));