mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
clang format
This commit is contained in:
@ -13,7 +13,8 @@ void NotifyServerStartSuccess();
|
||||
/** reset fpga and controller(only implemented for >= v1.1 boards) */
|
||||
void rebootControllerAndFPGA();
|
||||
|
||||
int eraseAndWriteToFlash(char *mess, char *checksum, char *fpgasrc, uint64_t fsize);
|
||||
int eraseAndWriteToFlash(char *mess, char *checksum, char *fpgasrc,
|
||||
uint64_t fsize);
|
||||
int getDrive(char *mess);
|
||||
int openFileForFlash(FILE **flashfd, char *mess);
|
||||
int eraseFlash(char *mess);
|
||||
|
@ -473,7 +473,7 @@ int setComparatorDisableTime(int64_t val);
|
||||
int64_t getComparatorDisableTime();
|
||||
void configureASICTimer();
|
||||
int setReadoutSpeed(int val);
|
||||
int getReadoutSpeed(int* retval);
|
||||
int getReadoutSpeed(int *retval);
|
||||
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||
int getPhase(enum CLKINDEX ind, int degrees);
|
||||
int getMaxPhase(enum CLKINDEX ind);
|
||||
@ -498,7 +498,7 @@ uint64_t getSelectCurrentSource();
|
||||
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
||||
#elif EIGERD
|
||||
int setReadoutSpeed(int val);
|
||||
int getReadoutSpeed(int* retval);
|
||||
int getReadoutSpeed(int *retval);
|
||||
int setIODelay(int val);
|
||||
int setCounterBit(int val);
|
||||
int pulsePixel(int n, int x, int y);
|
||||
@ -551,7 +551,7 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval);
|
||||
int getFrequency(enum CLKINDEX ind);
|
||||
int getVCOFrequency(enum CLKINDEX ind);
|
||||
int setReadoutSpeed(int val);
|
||||
int getReadoutSpeed(int* retval);
|
||||
int getReadoutSpeed(int *retval);
|
||||
int getMaxClockDivider();
|
||||
int setClockDivider(enum CLKINDEX ind, int val);
|
||||
int getClockDivider(enum CLKINDEX ind);
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h> // readlink
|
||||
|
||||
|
||||
int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
||||
int outputMax, int inputValue, int *outputValue) {
|
||||
LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n",
|
||||
@ -245,7 +244,8 @@ int verifyChecksumFromFlash(char *mess, char *clientChecksum, char *fname,
|
||||
|
||||
// read only until a particular size (drive)
|
||||
if (fsize != 0 && totalBytesRead >= fsize) {
|
||||
LOG(logINFO, ("\tReached %lu bytes. Not reading more\n", totalBytesRead));
|
||||
LOG(logINFO,
|
||||
("\tReached %lu bytes. Not reading more\n", totalBytesRead));
|
||||
break;
|
||||
}
|
||||
bytes = fread(buf, 1, readUnitSize, fp);
|
||||
|
@ -30,8 +30,9 @@ void setupUDPCommParameters() {
|
||||
memset(udpDestinationIp, 0, sizeof(udpDestinationIp));
|
||||
}
|
||||
|
||||
int getUdPSocketDescriptor(int iRxEntry, int index) { return udpSockfd[iRxEntry][index]; }
|
||||
|
||||
int getUdPSocketDescriptor(int iRxEntry, int index) {
|
||||
return udpSockfd[iRxEntry][index];
|
||||
}
|
||||
|
||||
int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
|
||||
unsigned short int port) {
|
||||
@ -62,16 +63,20 @@ int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
|
||||
int err = getaddrinfo(udpDestinationIp[iRxEntry][index], sport, &hints,
|
||||
&udpServerAddrInfo[iRxEntry][index]);
|
||||
if (err != 0) {
|
||||
LOG(logERROR, ("Failed to resolve remote socket address %s at port %d [entry:%d]. "
|
||||
LOG(logERROR, ("Failed to resolve remote socket address %s at port %d "
|
||||
"[entry:%d]. "
|
||||
"(Error code:%d, %s)\n",
|
||||
udpDestinationIp[iRxEntry][index], udpDestinationPort[iRxEntry][index], iRxEntry, err,
|
||||
udpDestinationIp[iRxEntry][index],
|
||||
udpDestinationPort[iRxEntry][index], iRxEntry, err,
|
||||
gai_strerror(err)));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpServerAddrInfo[iRxEntry][index] == NULL) {
|
||||
LOG(logERROR, ("Failed to resolve remote socket address %s at port %d [entry:%d]."
|
||||
"(getaddrinfo returned NULL)\n",
|
||||
udpDestinationIp[iRxEntry][index], udpDestinationPort[iRxEntry][index], iRxEntry));
|
||||
LOG(logERROR,
|
||||
("Failed to resolve remote socket address %s at port %d [entry:%d]."
|
||||
"(getaddrinfo returned NULL)\n",
|
||||
udpDestinationIp[iRxEntry][index],
|
||||
udpDestinationPort[iRxEntry][index], iRxEntry));
|
||||
udpServerAddrInfo[iRxEntry][index] = 0;
|
||||
return FAIL;
|
||||
}
|
||||
@ -80,41 +85,51 @@ int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
|
||||
}
|
||||
|
||||
int createUDPSocket(int index) {
|
||||
|
||||
|
||||
for (int iRxEntry = 0; iRxEntry != numUdpDestinations; ++iRxEntry) {
|
||||
|
||||
LOG(logDEBUG2, ("Creating UDP Socket %d [entry:%d]\n", index, iRxEntry));
|
||||
LOG(logDEBUG2,
|
||||
("Creating UDP Socket %d [entry:%d]\n", index, iRxEntry));
|
||||
if (!strlen(udpDestinationIp[iRxEntry][index])) {
|
||||
LOG(logERROR, ("No destination UDP ip specified for socket %d [entry:%d].\n", index, iRxEntry));
|
||||
LOG(logERROR,
|
||||
("No destination UDP ip specified for socket %d [entry:%d].\n",
|
||||
index, iRxEntry));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (udpSockfd[iRxEntry][index] != -1) {
|
||||
LOG(logERROR, ("Strange that Udp socket was still open [socket:%d, entry:%d]. Closing it to "
|
||||
"create a new one.\n", index, iRxEntry));
|
||||
LOG(logERROR, ("Strange that Udp socket was still open [socket:%d, "
|
||||
"entry:%d]. Closing it to "
|
||||
"create a new one.\n",
|
||||
index, iRxEntry));
|
||||
close(udpSockfd[iRxEntry][index]);
|
||||
udpSockfd[iRxEntry][index] = -1;
|
||||
}
|
||||
|
||||
// Creating socket file descriptor
|
||||
udpSockfd[iRxEntry][index] = socket(udpServerAddrInfo[iRxEntry][index]->ai_family,
|
||||
udpServerAddrInfo[iRxEntry][index]->ai_socktype,
|
||||
udpServerAddrInfo[iRxEntry][index]->ai_protocol);
|
||||
udpSockfd[iRxEntry][index] =
|
||||
socket(udpServerAddrInfo[iRxEntry][index]->ai_family,
|
||||
udpServerAddrInfo[iRxEntry][index]->ai_socktype,
|
||||
udpServerAddrInfo[iRxEntry][index]->ai_protocol);
|
||||
if (udpSockfd[iRxEntry][index] == -1) {
|
||||
LOG(logERROR, ("UDP socket at port %d failed [entry:%d]. (Error code:%d, %s)\n",
|
||||
udpDestinationPort[iRxEntry][index], iRxEntry, errno, gai_strerror(errno)));
|
||||
LOG(logERROR, ("UDP socket at port %d failed [entry:%d]. (Error "
|
||||
"code:%d, %s)\n",
|
||||
udpDestinationPort[iRxEntry][index], iRxEntry, errno,
|
||||
gai_strerror(errno)));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Udp client socket created for server (entry:%d, port %d, ip:%s)\n",
|
||||
iRxEntry, udpDestinationPort[iRxEntry][index], udpDestinationIp[iRxEntry][index]));
|
||||
|
||||
// Using connect expects that the receiver (udp server) exists to listen to
|
||||
// these packets connecting allows to use "send/write" instead of "sendto",
|
||||
// avoiding checking for server address for each packet using write without
|
||||
// a connect will end in segv
|
||||
LOG(logINFO, ("Udp client socket connected [%d, %d, %s]\n", iRxEntry, udpDestinationPort[iRxEntry][index],
|
||||
udpDestinationIp[iRxEntry][index]));
|
||||
LOG(logINFO, ("Udp client socket created for server (entry:%d, port "
|
||||
"%d, ip:%s)\n",
|
||||
iRxEntry, udpDestinationPort[iRxEntry][index],
|
||||
udpDestinationIp[iRxEntry][index]));
|
||||
|
||||
// Using connect expects that the receiver (udp server) exists to listen
|
||||
// to these packets connecting allows to use "send/write" instead of
|
||||
// "sendto", avoiding checking for server address for each packet using
|
||||
// write without a connect will end in segv
|
||||
LOG(logINFO, ("Udp client socket connected [%d, %d, %s]\n", iRxEntry,
|
||||
udpDestinationPort[iRxEntry][index],
|
||||
udpDestinationIp[iRxEntry][index]));
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -125,9 +140,9 @@ int sendUDPPacket(int iRxEntry, int index, const char *buf, int length) {
|
||||
udpServerAddrInfo[iRxEntry][index]->ai_addrlen);
|
||||
// udp sends atomically, no need to handle partial data
|
||||
if (n == -1) {
|
||||
LOG(logERROR,
|
||||
("Could not send udp packet for socket %d [entry:%d]. (Error code:%d, %s)\n",
|
||||
index, iRxEntry, errno, gai_strerror(errno)));
|
||||
LOG(logERROR, ("Could not send udp packet for socket %d [entry:%d]. "
|
||||
"(Error code:%d, %s)\n",
|
||||
index, iRxEntry, errno, gai_strerror(errno)));
|
||||
} else {
|
||||
LOG(logDEBUG2, ("%d bytes sent\n", n));
|
||||
}
|
||||
|
Reference in New Issue
Block a user