6 template <
class DAECardPolicy>
12 template <
class DAECardPolicy>
15 return m_vme->device();
22 template <
class DAECardPolicy>
32 address = makeAddress(address);
35 stat = m_vme->readU32(address, value, props, status);
39 stat = m_vme->readU32noRetry(address, value, props, status);
52 template <
class DAECardPolicy>
57 readRegister(address, &value, status);
58 os << name <<
" (0x" << std::hex << address <<
") value 0x" << value << std::dec;
61 std::bitset<8*sizeof(value)> value_bits((
unsigned long long)value);
66 for(
int i=0; i < value_bits.size(); ++i)
68 if (value_bits.test(i))
79 template <
class DAECardPolicy>
90 address = makeAddress(address);
93 stat = m_vme->readU16(address, value, props, status);
97 stat = m_vme->readU16noRetry(address, value, props, status);
113 template <
class DAECardPolicy>
116 if (address0 == address1)
118 return readRegister(address0, value, status, little_endian);
123 readRegister(address0, &value0, status, little_endian);
124 readRegister(address1, &value1, status, little_endian);
127 *value = (value1 << 16) | value0;
134 template <
class DAECardPolicy>
137 if (address0 == address1)
139 return writeRegister(address0, value, status, little_endian);
145 value1 = (
isisU16_t)((value >> 16) & 0xffff);
146 writeRegister16(address0, value0, status, little_endian);
147 writeRegister16(address1, value1, status, little_endian);
154 template <
class DAECardPolicy>
162 address = makeAddress(address);
164 m_vme->writeU32(address, value, props, status);
168 template <
class DAECardPolicy>
176 address = makeAddress(address);
178 m_vme->writeU16(address, value, props, status);
182 template <
class DAECardPolicy>
191 address = makeAddress(address);
194 m_vme->readU32(address, &old_value, props, status);
197 return m_vme->writeU32(address, mask, props, status);
200 template <
class DAECardPolicy>
209 address = makeAddress(address);
210 m_vme->readU32(address, &old_value, props, status);
211 mask = (old_value & ~mask);
212 return m_vme->writeU32(address, mask, props, status);
215 template <
class DAECardPolicy>
221 stat = setRegisterBits(address, mask,
true, status, little_endian);
222 while( check && !registerBitsSet(address, mask, status, little_endian) )
226 stat = setRegisterBits(address, mask,
true, status, little_endian);
231 stat = clearRegisterBits(address, mask, status, little_endian);
232 while( check && !registerBitsClear(address, mask, status, little_endian) )
236 stat = clearRegisterBits(address, mask, status, little_endian);
242 template <
class DAECardPolicy>
251 address = makeAddress(address);
254 m_vme->readU32(address, &old_value, props, status);
255 val = mask | old_value;
256 m_vme->writeU32(address, val, props, status);
257 val = ~mask & old_value;
258 m_vme->writeU32(address, val, props, status);
262 m_vme->writeU32(address, mask, props, status);
263 m_vme->writeU32(address, 0, props, status);
268 template <
class DAECardPolicy>
277 address = makeAddress(address);
278 m_vme->readU32(address, &value, props, status);
279 if ((value & mask) == mask)
289 template <
class DAECardPolicy>
298 address = makeAddress(address);
299 m_vme->readU32(address, &value, props, status);
300 if ((value & mask) == 0)
316 template <
class DAECardPolicy>
323 unsigned long addr = makeAddress(position, FIRMVERS);
330 addr = makeAddress(position, 0x8000000);
347 addr = makeAddress(position, 0x40088);
360 template <
class DAECardPolicy>
369 getFirmwareVersion(position, vme, &fw, dstatus);
417 addr = makeAddress(position, 0x8000000);
428 addr = makeAddress(position, 0x40088);
452 template <
class DAECardPolicy>
455 os <<
"--- DAE2 card with address/position/number = " << m_position <<
" ---" << std::endl;
456 os << getFirmwareVersionAsString(dstatus) << std::endl;
459 template <
class DAECardPolicy>
462 std::stringstream sstr;
464 getFirmwareVersion(m_position, m_vme, &fw, dstatus);
465 sstr <<
"Firmware register: 0x" << std::hex << *(
isisU32_t*)&fw << std::dec <<
"\n";
469 sstr <<
"Hardware type: OTHER CARD (Not Defined)\n";
476 sstr <<
"Hardware type: ENVIRONMENT CARD (Dedicated)\n";
479 sstr <<
"Hardware type: ENVIRONMENT CARD (Configured from detector card)\n";
482 sstr <<
"Hardware type: ENVIRONMENT CARD (With period functions)\n";
485 sstr <<
"Hardware type: ENVIRONMENT CARD (UNKNOWN)\n";
494 sstr <<
"Hardware type: DETECTOR CARD (Neutron, 1 DIM)\n";
497 sstr <<
"Hardware type: DETECTOR CARD (Neutron, 2 DIM)\n";
500 sstr <<
"Hardware type: DETECTOR CARD (Neutron, 16 DIM)\n";
503 sstr <<
"Hardware type: DETECTOR CARD (Muon, 4 DIM)\n";
506 sstr <<
"Hardware type: DETECTOR CARD (Neutron, 32 DIM)\n";
509 sstr <<
"Hardware type: DETECTOR CARD (UNKNOWN)\n";
518 sstr <<
"Hardware type: OTHER CARD (Muon Period Card)\n";
521 sstr <<
"Hardware type: OTHER CARD (Defined, but UNKNOWN)\n";
527 sstr <<
"Hardware type: ERROR\n";
530 sstr <<
"Firmware sub version = " << fw.
sub_ver <<
"\n";
531 sstr <<
"Firmware minor version = " << fw.
minor_ver <<
"\n";
532 sstr <<
"Firmware hardware version = " << fw.
hard_ver;
536 template <
class DAECardPolicy>
539 unsigned long addr = makeAddress(position, FIRMVERS);
virtual int readU32noRetry(unsigned long address, isisU32_t *data32, TransferProps props, DAEstatus &dstatus)=0
uint32_t TransferProps
combination of TransferProp values
static const std::string policy_name
static const std::string card_type
static const std::string card_type
std::string getFirmwareVersionAsString(DAEstatus &status)
int setRegisterBits(unsigned long address, isisU32_t mask, bool preserve, DAEstatus &status, bool little_endian=false)
static const std::string card_policy_name
static const std::string env_period_policy_name
static CardType getCardType(int position, ISISVME *vme, DAEstatus &dstatus)
bool registerBitsSet(unsigned long address, isisU32_t mask, DAEstatus &status, bool little_endian=false)
static const std::string policy_name
int clearRegisterBits(unsigned long address, isisU32_t mask, DAEstatus &status, bool little_endian=false)
virtual void printStatus(std::ostream &os, DAEstatus &dstatus)
DAE2Card(int position, ISISVME *vme, DAEstatus &status)
int writeRegister(unsigned long address, isisU32_t value, DAEstatus &status, bool little_endian=false)
virtual int readU16noRetry(unsigned long address, isisU16_t *data16, TransferProps props, DAEstatus &dstatus)=0
int clear(int severity, int direction, bool reset_overall_severity=true)
static const std::string det_card_policy_name
static const std::string det_card_policy_name
static bool isCardPresent(int position, ISISVME *vme, DAEstatus &status)
static const std::string card_policy_name
int readRegister(unsigned long address, isisU32_t *value, DAEstatus &status, bool little_endian=false, bool retry=true)
int setAndClearRegisterBits(unsigned long address, isisU32_t mask, bool preserve, DAEstatus &status, bool little_endian=false)
int addWarningVa(int facility, const char *format,...)
std::string daeDevice() const
int changeRegisterBits(unsigned long address, isisU32_t mask, bool set, bool check, DAEstatus &status, bool little_endian=false)
int writeRegister16(unsigned long address, isisU16_t value, DAEstatus &status, bool little_endian=false)
static int getFirmwareVersion(int position, ISISVME *vme, firmware_version *fw, DAEstatus &status)
void setLoggerName(const std::string &logger_name)
static const std::string env_period_policy_name
int writeRegister32As16(unsigned long address0, unsigned long address1, isisU32_t value, DAEstatus &status, bool little_endian=false)
int readRegister16As32(unsigned long address0, unsigned long address1, isisU32_t *value, DAEstatus &status, bool little_endian=false)
bool registerBitsClear(unsigned long address, isisU32_t mask, DAEstatus &status, bool little_endian=false)
void printRegister(const char *name, unsigned long address, std::ostream &os, bool print_bits_set=false)