14 unsigned int max_block_no = 0;
16 max_block_no = (size - 1023) / 4096;
18 if (block != max_block_no)
41 }
else if (block == 0) {
61 return (size - 1023) / 4096 + 1;
77 unsigned int or_n,
unsigned int board_id,
unsigned int user) :
80 (
uint64_t(lv1_id & LV1ID_mask) << LV1ID_shift) |
81 (
uint64_t(bx_id & BX_mask) << BX_shift) |
85 (
uint64_t(or_n & OrN_mask) << OrN_shift) |
87 (
uint64_t(user & User_mask) << User_shift)
94 (
uint64_t(crc & CRC_mask) << CRC_shift) |
106 <<
"Found AMC trailer with:" 108 <<
", CRC " << std::hex << std::setw(8) << std::setfill(
'0') <<
getCRC() <<
std::dec 110 <<
"\n\tLV1 ID " << (lv1_id &
LV1ID_mask) <<
", size " << size
111 <<
", CRC " << std::hex << std::setw(8) << std::setfill(
'0') << crc;
120 std::string dstring(reinterpret_cast<const char*>(start), reinterpret_cast<const char*>(end) + 4);
126 Packet::Packet(
unsigned int amc,
unsigned int board,
unsigned int lv1id,
unsigned int orbit,
unsigned int bx,
const std::vector<uint64_t>&
load) :
127 block_header_(amc, board, load.
size() + 3),
128 header_(amc, lv1id, bx, load.
size() + 3, orbit, board, 0),
129 trailer_(0, lv1id, load.
size() + 3)
166 std::vector<uint64_t>
178 std::unique_ptr<uint64_t[]>
183 for (
unsigned int i = 0;
i <
payload_.size() - 3; ++
i)
unsigned int getLV1ID() const
static const unsigned int CRC_mask
unsigned int getSize() const
static void writeCRC(const uint64_t *start, uint64_t *end)
unsigned int getCRC() const
BlockHeader block_header_
std::vector< uint64_t > block(unsigned int id) const
static const unsigned int CRC_shift
void addPayload(const uint64_t *, unsigned int)
void finalize(unsigned int lv1, unsigned int bx, bool legacy_mc=false, bool mtf7_mode=false)
static const unsigned int split_block_size
unsigned int size() const
static const unsigned int LV1ID_mask
unsigned long long uint64_t
std::unique_ptr< uint64_t[]> data()
bool check(unsigned int crc, unsigned int lv1_id, unsigned int size, bool mtf7_mode=false) const
Packet(const uint64_t *d)
std::vector< uint64_t > payload_