1. allow 1gbe non blocking acquire by creating another thread (#753)

* allow 1gbe non blocking acquire by creating another thread

* removed unnnecessary print out in ctb
This commit is contained in:
2023-05-24 13:39:40 +02:00
committed by GitHub
parent f0c789dc91
commit afee45790f
6 changed files with 66 additions and 40 deletions

View File

@ -2289,6 +2289,11 @@ enum runStatus getRunStatus() {
return TRANSMITTING;
}
// 1g might still be transmitting or reading from fifo (not virtual)
if (!enableTenGigabitEthernet(-1) && checkDataInFifo()) {
return TRANSMITTING;
}
if (!(retval & STATUS_IDLE_MSK)) {
LOG(logINFOBLUE, ("Status: Idle\n"));
return IDLE;
@ -2299,19 +2304,17 @@ enum runStatus getRunStatus() {
}
}
void readandSendUDPFrames(int *ret, char *mess) {
int validateUDPSocket() {
if (getUdPSocketDescriptor(0, 0) <= 0) {
return FAIL;
}
return OK;
}
void readandSendUDPFrames() {
LOG(logDEBUG1, ("Reading from 1G UDP\n"));
// validate udp socket
if (getUdPSocketDescriptor(0, 0) <= 0) {
*ret = FAIL;
sprintf(mess, "UDP Socket not created. sockfd:%d\n",
getUdPSocketDescriptor(0, 0));
LOG(logERROR, (mess));
return;
}
// every frame read
// read every frame
while (readFrameFromFifo() == OK) {
int bytesToSend = 0, n = 0;
while ((bytesToSend = fillUDPPacket(udpPacketData))) {
@ -2324,6 +2327,7 @@ void readandSendUDPFrames(int *ret, char *mess) {
}
}
closeUDPSocket(0);
LOG(logINFOBLUE, ("Transmitting frames done\n"));
}
void waitForAcquisitionEnd() {
@ -2339,20 +2343,6 @@ void waitForAcquisitionEnd() {
LOG(logINFOGREEN, ("Blocking Acquisition done\n"));
}
void readFrames(int *ret, char *mess) {
#ifdef VIRTUAL
while (runBusy()) {
usleep(500);
}
#else
// 1G force reading of frames
if (!enableTenGigabitEthernet(-1)) {
readandSendUDPFrames(ret, mess);
LOG(logINFOBLUE, ("Transmitting frames done\n"));
}
#endif
}
void unsetFifoReadStrobes() {
bus_w(DUMMY_REG, bus_r(DUMMY_REG) & (~DUMMY_ANLG_FIFO_RD_STRBE_MSK) &
(~DUMMY_DGTL_FIFO_RD_STRBE_MSK));
@ -2444,7 +2434,7 @@ uint32_t checkDataInFifo() {
uint32_t dataPresent = 0;
if (analogEnable) {
uint32_t analogFifoEmpty = bus_r(FIFO_EMPTY_REG);
LOG(logINFO,
LOG(logDEBUG1,
("Analog Fifo Empty (32 channels): 0x%08x\n", analogFifoEmpty));
dataPresent = (~analogFifoEmpty);
}