Program Listing for File l0id_decoder.hpp
↰ Return to documentation for file (l0id_decoder.hpp
)
#ifndef L0ID_DECODER_H_
#define L0ID_DECODER_H_
#include "block.hpp"
#include <functional>
#include <vector>
#include <sys/uio.h>
#include "felix/felix_fid.h"
inline bool is_ttc2h_elink(uint64_t fid)
{
uint32_t elink = get_elink(fid);
#if REGMAP_VERSION < 0x0500
if (elink == 315 || elink == 827 || elink == 1537 || elink == 0x600){
#else
if (elink == 0x600){
#endif
return true;
} else {
return false;
}
}
enum L0ID_FMT {
TTC2H = 1, LATOME = 2, FMEMU = 3, FELIG = 4, NSW_VMM = 5, NSW_TP = 6
};
class L0Decoder
{
public:
L0Decoder(int format, uint64_t fid);
std::function<bool(const uint8_t* data, size_t len)> check_sequence_error;
bool check_tohost_chunk(std::vector<iovec> const &data);
xl1id_t get_last(){return m_last;}
uint32_t get_ec_mask(){return m_ec_mask;}
private:
uint64_t m_fid;
xl1id_t m_last;
uint32_t m_required_bytes;
uint32_t m_ec_mask;
bool compare(xl1id_t current, xl1id_t expected);
bool check_sequence_ttc2h( const uint8_t* data, size_t len);
bool check_sequence_latome( const uint8_t* data, size_t len);
bool check_sequence_fmemu( const uint8_t* data, size_t len);
bool check_sequence_felig( const uint8_t* data, size_t len);
bool check_sequence_nsw_vmm(const uint8_t* data, size_t len);
bool check_sequence_nsw_tp( const uint8_t* data, size_t len);
};
#endif /* L0ID_DECODER_H_ */