mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
changes for min fifo level
This commit is contained in:
parent
efad86335f
commit
e93f53f459
@ -21,10 +21,10 @@ class Fifo : private virtual slsReceiverDefs {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* Calls CreateFifos that creates fifos and allocates memory
|
* Calls CreateFifos that creates fifos and allocates memory
|
||||||
* @param fifoItemSize size of each fifo item
|
* @param fifoItemSize size of each fifo item
|
||||||
* @param fifoDepth fifo depth
|
* @param depth fifo depth
|
||||||
* @param success true if successful, else false
|
* @param success true if successful, else false
|
||||||
*/
|
*/
|
||||||
Fifo(uint32_t fifoItemSize, uint32_t fifoDepth, bool &success);
|
Fifo(uint32_t fifoItemSize, uint32_t depth, bool &success);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
@ -67,15 +67,20 @@ class Fifo : private virtual slsReceiverDefs {
|
|||||||
*/
|
*/
|
||||||
int GetMaxLevelForFifoBound();
|
int GetMaxLevelForFifoBound();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Minimum Level filled in Fifo Free
|
||||||
|
* and reset this value to max for next intake
|
||||||
|
*/
|
||||||
|
int GetMinLevelForFifoFree();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Fifos, allocate memory & push addresses into fifo
|
* Create Fifos, allocate memory & push addresses into fifo
|
||||||
* @param fifoItemSize size of each fifo item
|
* @param fifoItemSize size of each fifo item
|
||||||
* @param fifoDepth fifo depth
|
|
||||||
* @return OK if successful, else FAIL
|
* @return OK if successful, else FAIL
|
||||||
*/
|
*/
|
||||||
int CreateFifos(uint32_t fifoItemSize, uint32_t fifoDepth);
|
int CreateFifos(uint32_t fifoItemSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy Fifos and deallocate memory
|
* Destroy Fifos and deallocate memory
|
||||||
@ -101,5 +106,9 @@ class Fifo : private virtual slsReceiverDefs {
|
|||||||
/** Circular Fifo pointing to addresses of to be streamed data in memory */
|
/** Circular Fifo pointing to addresses of to be streamed data in memory */
|
||||||
CircularFifo<char>* fifoStream;
|
CircularFifo<char>* fifoStream;
|
||||||
|
|
||||||
|
/** Fifo depth set */
|
||||||
|
int fifoDepth;
|
||||||
|
|
||||||
volatile int status_fifoBound;
|
volatile int status_fifoBound;
|
||||||
|
volatile int status_fifoFree;
|
||||||
};
|
};
|
||||||
|
@ -66,11 +66,11 @@ int BinaryFile::CreateFile(uint64_t fnum) {
|
|||||||
else {
|
else {
|
||||||
char c[1000]; strcpy(c, currentFileName.c_str());
|
char c[1000]; strcpy(c, currentFileName.c_str());
|
||||||
if (loss)
|
if (loss)
|
||||||
bprintf(RED,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n",
|
bprintf(RED,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tNew_File:%s\n",
|
||||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , basename(c));
|
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , fifo->GetMinLevelForFifoFree(), basename(c));
|
||||||
else
|
else
|
||||||
bprintf(GREEN,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n",
|
bprintf(GREEN,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tNew_File:%s\n",
|
||||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), basename(c));
|
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), fifo->GetMinLevelForFifoFree(), basename(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -14,16 +14,18 @@ using namespace std;
|
|||||||
|
|
||||||
int Fifo::NumberofFifoClassObjects(0);
|
int Fifo::NumberofFifoClassObjects(0);
|
||||||
|
|
||||||
Fifo::Fifo(uint32_t fifoItemSize, uint32_t fifoDepth, bool &success):
|
Fifo::Fifo(uint32_t fifoItemSize, uint32_t depth, bool &success):
|
||||||
index(NumberofFifoClassObjects),
|
index(NumberofFifoClassObjects),
|
||||||
memory(0),
|
memory(0),
|
||||||
fifoBound(0),
|
fifoBound(0),
|
||||||
fifoFree(0),
|
fifoFree(0),
|
||||||
fifoStream(0),
|
fifoStream(0),
|
||||||
status_fifoBound(0){
|
fifoDepth(depth),
|
||||||
|
status_fifoBound(0),
|
||||||
|
status_fifoFree(depth){
|
||||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||||
NumberofFifoClassObjects++;
|
NumberofFifoClassObjects++;
|
||||||
if(CreateFifos(fifoItemSize, fifoDepth) == FAIL)
|
if(CreateFifos(fifoItemSize) == FAIL)
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,11 +39,12 @@ Fifo::~Fifo() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Fifo::CreateFifos(uint32_t fifoItemSize, uint32_t fifoDepth) {
|
int Fifo::CreateFifos(uint32_t fifoItemSize) {
|
||||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
//destroy if not already
|
//destroy if not already
|
||||||
DestroyFifos();
|
DestroyFifos();
|
||||||
|
|
||||||
//create fifos
|
//create fifos
|
||||||
fifoBound = new CircularFifo<char>(fifoDepth);
|
fifoBound = new CircularFifo<char>(fifoDepth);
|
||||||
fifoFree = new CircularFifo<char>(fifoDepth);
|
fifoFree = new CircularFifo<char>(fifoDepth);
|
||||||
@ -67,6 +70,7 @@ int Fifo::CreateFifos(uint32_t fifoItemSize, uint32_t fifoDepth) {
|
|||||||
buffer += fifoItemSize;
|
buffer += fifoItemSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG (logDEBUG) << "Fifo Reconstructed Depth " << index << ": " << fifoDepth;
|
FILE_LOG (logDEBUG) << "Fifo Reconstructed Depth " << index << ": " << fifoDepth;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -100,6 +104,9 @@ void Fifo::FreeAddress(char*& address) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Fifo::GetNewAddress(char*& address) {
|
void Fifo::GetNewAddress(char*& address) {
|
||||||
|
int temp = fifoFree->getSemValue();
|
||||||
|
if (temp < status_fifoFree)
|
||||||
|
status_fifoFree = temp;
|
||||||
fifoFree->pop(address);
|
fifoFree->pop(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,3 +135,10 @@ int Fifo::GetMaxLevelForFifoBound() {
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Fifo::GetMinLevelForFifoFree() {
|
||||||
|
int temp = status_fifoFree;
|
||||||
|
status_fifoFree = fifoDepth;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user