mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-18 18:12:21 +01:00
eiger receiver, receiving many packets at a time, with 16,8, 4 bitmode sort of working
This commit is contained in:
@@ -38,7 +38,9 @@ public:
|
||||
array.resize(Capacity);
|
||||
sem_init(&free_mutex,0,0);
|
||||
}
|
||||
virtual ~CircularFifo() {}
|
||||
virtual ~CircularFifo() {
|
||||
sem_destroy(&free_mutex);
|
||||
}
|
||||
|
||||
bool push(Element*& item_);
|
||||
bool pop(Element*& item_);
|
||||
@@ -151,111 +153,3 @@ unsigned int CircularFifo<Element>::increment(unsigned int idx_) const
|
||||
}
|
||||
|
||||
#endif /* CIRCULARFIFO_H_ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
#ifndef CIRCULARFIFO_H_
|
||||
#define CIRCULARFIFO_H_
|
||||
|
||||
#include "sls_receiver_defs.h"
|
||||
|
||||
#include "/usr/include/alsa/atomic.h"
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
template<typename Element>
|
||||
class CircularFifo {
|
||||
public:
|
||||
|
||||
CircularFifo(unsigned int Size) : tail(0), head(0){
|
||||
Capacity = Size + 1;
|
||||
array.resize(Capacity);
|
||||
}
|
||||
virtual ~CircularFifo() {}
|
||||
|
||||
bool push(Element*& item_);
|
||||
bool pop(Element*& item_);
|
||||
|
||||
bool wasEmpty() const;
|
||||
bool wasFull() const;
|
||||
bool isLockFree() const;
|
||||
|
||||
private:
|
||||
vector <Element*> array;
|
||||
unsigned int Capacity;
|
||||
|
||||
std::atomic<unsigned int> tail; // input index
|
||||
std::atomic<unsigned int> head; // output index
|
||||
|
||||
unsigned int increment(unsigned int idx_) const;
|
||||
};
|
||||
|
||||
|
||||
template<typename Element>
|
||||
bool CircularFifo<Element>::push(Element*& item_)
|
||||
{
|
||||
auto currentTail = tail.load();
|
||||
auto nextTail = increment(currentTail);
|
||||
if(nextTail != head.load())
|
||||
{
|
||||
array[currentTail] = item_;
|
||||
tail.store(nextTail);
|
||||
return true;
|
||||
}
|
||||
|
||||
// queue was full
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<typename Element>
|
||||
bool CircularFifo<Element>::pop(Element*& item_)
|
||||
{
|
||||
const auto currentHead = head.load();
|
||||
if(currentHead == tail.load())
|
||||
return false; // empty queue
|
||||
|
||||
item_ = array[currentHead];
|
||||
head.store(increment(currentHead));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<typename Element>
|
||||
bool CircularFifo<Element>::wasEmpty() const
|
||||
{
|
||||
return (head.load() == tail.load());
|
||||
}
|
||||
|
||||
|
||||
template<typename Element>
|
||||
bool CircularFifo<Element>::wasFull() const
|
||||
{
|
||||
const auto nextTail = increment(tail.load());
|
||||
return (nextTail == head.load());
|
||||
}
|
||||
|
||||
template<typename Element>
|
||||
bool CircularFifo<Element>::isLockFree() const
|
||||
{
|
||||
return (tail.is_lock_free() && head.is_lock_free());
|
||||
}
|
||||
|
||||
|
||||
template<typename Element>
|
||||
unsigned int CircularFifo<Element>::increment(unsigned int idx_) const
|
||||
{
|
||||
// increment or wrap
|
||||
// =================
|
||||
// index++;
|
||||
// if(index == array.lenght) -> index = 0;
|
||||
//
|
||||
//or as written below:
|
||||
// index = (index+1) % array.length
|
||||
return (idx_ + 1) % Capacity;
|
||||
}
|
||||
|
||||
#endif */
|
||||
|
||||
@@ -69,21 +69,24 @@
|
||||
|
||||
|
||||
|
||||
#define MAX_EIGER_PORTS 2
|
||||
#define EIGER_MAX_PORTS 2
|
||||
#define EIGER_HEADER_LENGTH 48
|
||||
|
||||
#define EIGER_FIFO_SIZE 2500 //cannot be less than max jobs per thread = 1000
|
||||
#define EIGER_FIFO_SIZE 250 //cannot be less than max jobs per thread = 1000
|
||||
/*#define EIGER_ALIGNED_FRAME_SIZE 65536*/
|
||||
#define EIGER_PACKETS_PER_FRAME (256*MAX_EIGER_PORTS) //default for 16B
|
||||
#define EIGER_ONE_PACKET_SIZE 1040 //default for 16B
|
||||
#define EIGER_BUFFER_SIZE (EIGER_ONE_PACKET_SIZE*EIGER_PACKETS_PER_FRAME) //1040*256//default for 16B
|
||||
#define EIGER_DATA_BYTES (1024*EIGER_PACKETS_PER_FRAME) //1024*256 //default for 16B
|
||||
#define EIGER_PACKETS_PER_FRAME_COSTANT (16*EIGER_MAX_PORTS)//*bit mode 4*16=64, 8*16=128, 16*16=256, 32*16=512
|
||||
#define EIGER_ONE_PACKET_SIZE 1040
|
||||
#define EIGER_ONE_DATA_SIZE 1024
|
||||
#define EIGER_BUFFER_SIZE_CONSTANT (EIGER_ONE_PACKET_SIZE*EIGER_PACKETS_PER_FRAME_COSTANT)//1040*16*2//*bit mode
|
||||
#define EIGER_DATA_BYTES_CONSTANT (EIGER_ONE_DATA_SIZE*EIGER_PACKETS_PER_FRAME_COSTANT) //1024*16*2//*bit mode
|
||||
|
||||
#define EIGER_FRAME_INDEX_MASK 0xFFFF
|
||||
#define EIGER_FRAME_INDEX_OFFSET 0
|
||||
#define EIGER_PACKET_INDEX_MASK 0x0
|
||||
|
||||
#define EIGER_IMAGE_HEADER_SIZE 32
|
||||
#define EIGER_IMAGE_HEADER_SIZE 48
|
||||
|
||||
#define EIGER_PIXELS_IN_ONE_ROW (256*4)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,9 @@ enum {
|
||||
F_RESET_RECEIVER_FRAMES_CAUGHT, /**< resets the frames caught by receiver */
|
||||
F_ENABLE_RECEIVER_FILE_WRITE, /**< sets the receiver file write */
|
||||
F_ENABLE_RECEIVER_COMPRESSION, /**< enable compression in receiver */
|
||||
F_ENABLE_RECEIVER_OVERWRITE /**< set overwrite flag in receiver */
|
||||
F_ENABLE_RECEIVER_OVERWRITE, /**< set overwrite flag in receiver */
|
||||
|
||||
F_ENABLE_RECEIVER_TEN_GIGA /**< enable 10Gbe in receiver */
|
||||
|
||||
/* Always append functions hereafter!!! */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user