1 #ifndef CSCALCTTrailer_h 2 #define CSCALCTTrailer_h 18 void setCRC(
unsigned int crc) {
crc0 = crc&0x7FF;
crc1 = (crc >> 11) & 0x7FF;}
31 void setCRC(
unsigned int crc) {
crc0 = crc&0x7FF;
crc1 = (crc >> 11) & 0x7FF;}
57 switch (firmwareVersion) {
59 switch (firmwareVersion.load()) {
62 memcpy(theOriginalBuffer, &trailer2006, trailer2006.sizeInWords()*2);
65 memcpy(theOriginalBuffer, &trailer2007, trailer2007.sizeInWords()*2);
69 <<
"couldn't access data: ALCT firmware version is bad/not defined!";
72 return theOriginalBuffer;
80 switch (firmwareVersion) {
82 switch (firmwareVersion.load()) {
85 trailer2006.setCRC(crc);
88 trailer2007.setCRC(crc);
92 <<
"couldn't setCRC: ALCT firmware version is bad/not defined!";
100 switch (firmwareVersion) {
102 switch (firmwareVersion.load()) {
105 return ((trailer2006.crc1&0x7ff)<<11) | (trailer2006.crc0&0x7ff);
107 return ((trailer2007.crc1&0x7ff)<<11) | (trailer2007.crc0&0x7ff);
110 <<
"couldn't getCRC: ALCT firmware version is bad/not defined!";
117 switch (firmwareVersion) {
119 switch (firmwareVersion.load()) {
122 return (trailer2006.e0dLine & 0xfff) == 0xe0d;
124 return (trailer2007.e0dLine & 0xffff) == 0xde0d;
127 <<
"couldn't check: ALCT firmware version is bad/not defined!";
134 switch (firmwareVersion) {
136 switch (firmwareVersion.load()) {
139 return trailer2006.frameCount;
141 return trailer2007.frameCount;
144 <<
"couldn't wordCount: ALCT firmware version is bad/not defined!";
151 switch (firmwareVersion) {
153 switch (firmwareVersion.load()) {
156 return trailer2006.reserved_3;
158 return trailer2007.reserved_3;
161 <<
"couldn't CRCcheck: ALCT firmware version is bad/not defined!";
175 static unsigned short int firmwareVersion;
183 unsigned short int theOriginalBuffer[4];
CSCALCTTrailer(const CSCALCTStatusDigi &digi)
const uint16_t * trailer() const
unsigned FrameCount() const
void setCRC(unsigned int crc)
short unsigned int sizeInWords() const
CSCALCTTrailer2006 alctTrailer2006()
static std::atomic< bool > debug
unsigned alctCRCCheck() const
static std::atomic< unsigned short int > firmwareVersion
CSCALCTTrailer2007 trailer2007
static int sizeInWords()
in 16-bit frames
CSCALCTTrailer2006 trailer2006
short unsigned int sizeInWords() const
void setCRC(unsigned int crc)
CSCALCTTrailer2007 alctTrailer2007()
static void setDebug(bool debugValue)
void setCRC(unsigned int crc)