1 #ifndef CSCALCTTrailer_h 2 #define CSCALCTTrailer_h 23 void setCRC(
unsigned int crc) {
crc0 = crc&0x7FF;
crc1 = (crc >> 11) & 0x7FF;}
41 void setCRC(
unsigned int crc) {
crc0 = crc&0x7FF;
crc1 = (crc >> 11) & 0x7FF;}
67 switch (firmwareVersion) {
69 switch (firmwareVersion.load()) {
72 memcpy(theOriginalBuffer, &trailer2006, trailer2006.sizeInWords()*2);
75 memcpy(theOriginalBuffer, &trailer2007, trailer2007.sizeInWords()*2);
79 <<
"couldn't access data: ALCT firmware version is bad/not defined!";
82 return theOriginalBuffer;
90 switch (firmwareVersion) {
92 switch (firmwareVersion.load()) {
95 trailer2006.setCRC(crc);
98 trailer2007.setCRC(crc);
102 <<
"couldn't setCRC: ALCT firmware version is bad/not defined!";
110 switch (firmwareVersion) {
112 switch (firmwareVersion.load()) {
115 return ((trailer2006.crc1&0x7ff)<<11) | (trailer2006.crc0&0x7ff);
117 return ((trailer2007.crc1&0x7ff)<<11) | (trailer2007.crc0&0x7ff);
120 <<
"couldn't getCRC: ALCT firmware version is bad/not defined!";
127 switch (firmwareVersion) {
129 switch (firmwareVersion.load()) {
132 return (trailer2006.e0dLine & 0xfff) == 0xe0d;
134 return (trailer2007.e0dLine & 0xffff) == 0xde0d;
137 <<
"couldn't check: ALCT firmware version is bad/not defined!";
144 switch (firmwareVersion) {
146 switch (firmwareVersion.load()) {
149 return trailer2006.frameCount;
151 return trailer2007.frameCount;
154 <<
"couldn't wordCount: ALCT firmware version is bad/not defined!";
161 switch (firmwareVersion) {
163 switch (firmwareVersion.load()) {
166 return trailer2006.reserved_3;
168 return trailer2007.reserved_3;
171 <<
"couldn't CRCcheck: ALCT firmware version is bad/not defined!";
185 static unsigned short int firmwareVersion;
193 unsigned short int theOriginalBuffer[4];
CSCALCTTrailer(const CSCALCTStatusDigi &digi)
const uint16_t * trailer() const
unsigned FrameCount() const
void setFromBuffer(unsigned short const *buf)
void setCRC(unsigned int crc)
void setFromBuffer(unsigned short const *buf)
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)