11 const std::vector<unsigned int>
31 LogTrace(
"L1T") <<
"Writing MP7 link header";
38 LogTrace(
"L1T") <<
"Writing CTP7 link header";
46 LogDebug(
"L1T") <<
"Reached end of payload";
47 return std::auto_ptr<Block>();
50 if (
data_[0] == 0xffffffff) {
51 LogDebug(
"L1T") <<
"Skipping padding word";
60 <<
"Expecting a block size of " << header.getSize()
61 <<
" but only " << (
end_ -
data_) <<
" words remaining";
62 return std::auto_ptr<Block>();
65 LogTrace(
"L1T") <<
"Creating block with size " << header.getSize();
67 auto res = std::auto_ptr<Block>(
new Block(header,
data_,
data_ + header.getSize()));
68 data_ += header.getSize();
90 LogTrace(
"L1T") <<
"Getting header from " << std::hex << std::setw(8) << *
data_;
97 const uint16_t * data16 =
reinterpret_cast<const uint16_t*
>(
data);
98 const uint16_t * end16 =
reinterpret_cast<const uint16_t*
>(
end);
101 edm::LogError(
"L1T") <<
"MTF7 payload smaller than allowed!";
104 ((data16[0] >> 12) != 0x9) || ((data16[1] >> 12) != 0x9) ||
105 ((data16[2] >> 12) != 0x9) || ((data16[3] >> 12) != 0x9) ||
106 ((data16[4] >> 12) != 0xA) || ((data16[5] >> 12) != 0xA) ||
107 ((data16[6] >> 12) != 0xA) || ((data16[7] >> 12) != 0xA) ||
108 ((data16[8] >> 9) != 0b1000000) || ((data16[9] >> 11) != 0) ||
109 ((data16[10] >> 11) != 0) || ((data16[11] >> 11) != 0)) {
113 ((data16[12] >> 15) != 0) || ((data16[13] >> 15) != 1) ||
114 ((data16[14] >> 15) != 0) || ((data16[15] >> 15) != 0)) {
115 edm::LogError(
"L1T") <<
"MTF7 payload has invalid counter block!";
126 unsigned int mask = 0;
127 for (; length > 0; length--)
128 mask = (mask << 4) | 0xf;
132 count += (
p & mask) == pattern;
150 return std::auto_ptr<Block>(0);
152 const uint16_t * data16 =
reinterpret_cast<const uint16_t*
>(
data_);
153 const uint16_t * end16 =
reinterpret_cast<const uint16_t*
>(
end_);
157 std::vector<uint32_t> payload;
161 for (
int j = 0;
j < 4; ++
j) {
163 pattern |= (data16[
n] >> 15) <<
n;
164 payload.push_back(data16[
n]);
167 if (
count(pattern, i + 1) == 1 and
valid(pattern))
171 if (not
valid(pattern)) {
173 return std::auto_ptr<Block>(0);
176 data_ += (i + 1) * 2;
177 return std::auto_ptr<Block>(
new Block(pattern, payload, 0,
MTF7));
static const unsigned int size_shift
virtual BlockHeader getHeader() override
MP7Payload(const uint32_t *data, const uint32_t *end, bool legacy_mc=false)
virtual std::auto_ptr< Block > getBlock()
virtual std::auto_ptr< Block > getBlock() override
static const unsigned int trailer_size
int count(unsigned int pattern, unsigned int length) const
virtual BlockHeader getHeader()=0
CTP7Payload(const uint32_t *data, const uint32_t *end)
static const unsigned int counter_size
bool valid(unsigned int pattern) const
virtual unsigned getHeaderSize() const =0
MTF7Payload(const uint32_t *data, const uint32_t *end)
virtual BlockHeader getHeader() override
static const unsigned int size_mask
char data[epos_bytes_allocation]
static const unsigned int header_size
static const unsigned int max_block_length_
static const std::vector< unsigned int > block_patterns_