eiger_packet definitions and initial related changes

This commit is contained in:
2021-01-27 16:47:49 +00:00
parent dd52eea55b
commit 11cb0eb3ce
13 changed files with 130 additions and 15 deletions
+38
View File
@@ -0,0 +1,38 @@
#ifndef EIGER_H
#define EIGER_H
#include <cstdint>
#define EIGER_N_MODULES 1
#define EIGER_BYTES_PER_PACKET 1072
#define EIGER_DATA_BYTES_PER_PACKET 1024
#define EIGER_N_PACKETS_PER_FRAME 128
#define EIGER_DATA_BYTES_PER_FRAME 131072
// 48 bytes + 8192 bytes = 8240 bytes
#pragma pack(push)
#pragma pack(2)
struct eiger_packet {
uint64_t framenum;
uint32_t exptime;
uint32_t packetnum;
double bunchid;
uint64_t timestamp;
uint16_t moduleID;
uint16_t xCoord;
uint16_t yCoord;
uint16_t zCoord;
uint32_t debug;
uint16_t roundRobin;
uint8_t detectortype;
uint8_t headerVersion;
char data[EIGER_DATA_BYTES_PER_PACKET];
};
#pragma pack(pop)
#endif
+2 -2
View File
@@ -2,7 +2,7 @@
#define SF_DAQ_BUFFER_FORMATS_HPP
#include "buffer_config.hpp"
#include "jungfrau.hpp"
#include "eiger.hpp"
#pragma pack(push)
#pragma pack(1)
@@ -27,7 +27,7 @@ struct ImageMetadata {
#pragma pack(pop)
struct ModuleFrameBuffer {
ModuleFrame module[JUNGFRAU_N_MODULES];
ModuleFrame module[EIGER_N_MODULES];
};
#pragma pack(push)
+2 -1
View File
@@ -6,6 +6,7 @@
#include "RamBuffer.hpp"
#include "buffer_config.hpp"
using namespace std;
using namespace buffer_config;
@@ -100,7 +101,7 @@ char* RamBuffer::read_image(const uint64_t pulse_id,
ModuleFrame *frame_meta = src_meta + i_module;
auto is_good_frame =
frame_meta->n_recv_packets == JF_N_PACKETS_PER_FRAME;
frame_meta->n_recv_packets == EIGER_N_PACKETS_PER_FRAME;
if (!is_good_frame) {
is_good_image = false;
+2 -2
View File
@@ -13,7 +13,7 @@ TEST(RamBuffer, simple_store)
frame_meta.pulse_id = 123523;
frame_meta.daq_rec = 1234;
frame_meta.frame_index = 12342300;
frame_meta.n_recv_packets = JF_N_PACKETS_PER_FRAME;
frame_meta.n_recv_packets = EIGER_N_PACKETS_PER_FRAME;
auto frame_buffer = make_unique<uint16_t[]>(MODULE_N_PIXELS);
@@ -25,7 +25,7 @@ TEST(RamBuffer, simple_store)
for (int i_module=0; i_module<n_modules; i_module++) {
frame_meta.module_id = i_module;
buffer.write_frame(&frame_meta, (char *) (frame_buffer.get()));
buffer.write_frame(frame_meta, (char *) (frame_buffer.get()));
}
ImageMetadata image_meta;