ICP  1
QxtrmInterface.h
Go to the documentation of this file.
1 #ifndef QXTRMINTERFACE_H
2 #define QXTRMINTERFACE_H
3 
4 #include "isisvme.h"
5 #include "../Qxtrm_driver/Qxtrm_driver.h"
6 
7 class QxtrmInterface : public ISISVME
8 {
9  protected: // variables
11  std::string m_device;
12  CRITICAL_SECTION m_visa_critical;
15  static const int m_tries;
16  static const int m_retry_time;
17 
18 
20  Poco::SharedPtr<Qxtrm_channel> m_rdma_mem;
21  Poco::SharedPtr<Qxtrm_channel> m_rdma_reg;
22 
23  uint32_t* m_dau_memory;
24  uint32_t m_nwords_memory;
25  uint32_t* m_dau_registers;
27 
28  protected: // functions
29  int reinit(DAEstatus& dstatus);
30 
31  template <typename F, typename T>
32  int retrySingle(F pFunc, unsigned long address, T data, TransferProps props, DAEstatus& dstatus);
33  template <typename F, typename T>
34  int retryBlock(F pFunc, unsigned long address, T data, long nitems, TransferProps props, DAEstatus& dstatus);
35 
36  template <typename T> int readUimpl(unsigned long address, T* data, int nitems, TransferProps props, DAEstatus& dstatus);
37  template <typename T> int writeUimpl(unsigned long address, T* data, int nitems, TransferProps props, DAEstatus& dstatus);
38  int readU16impl(unsigned long address, isisU16_t* data16, TransferProps props, DAEstatus& dstatus);
39  int readU32impl(unsigned long address, isisU32_t* data32, TransferProps props, DAEstatus& dstatus);
40  int readBlockU16impl(unsigned long address, isisU16_t* data16, long nitems, TransferProps props, DAEstatus& dstatus);
41  int readBlockU32impl(unsigned long address, isisU32_t* data32, long nitems, TransferProps props, DAEstatus& dstatus);
42  int readBlockU64impl(unsigned long address, uint64_t* data64, long nitems, TransferProps props, DAEstatus& dstatus);
43  int writeU16impl(unsigned long address, isisU16_t data16, TransferProps props, DAEstatus& dstatus);
44  int writeU32impl(unsigned long address, isisU32_t data32, TransferProps propsn, DAEstatus& dstatus);
45  int writeBlockU16impl(unsigned long address, isisU16_t* data16, long nitems, TransferProps props, DAEstatus& dstatus);
46  int writeBlockU32impl(unsigned long address, isisU32_t* data32, long nitems, TransferProps props, DAEstatus& dstatus);
47  int writeBlockU64impl(unsigned long address, uint64_t* data64, long nitems, TransferProps props, DAEstatus& dstatus);
48 
49  public: // functions
50  QxtrmInterface(DAEstatus& dstatus, uint32_t* dau_memory = NULL, uint32_t nwords_memory = 0, uint32_t* dau_registers = NULL, uint32_t nwords_registers = 0);
51  virtual ~QxtrmInterface();
52  int open(const char* device, DAEstatus& dstatus);
53  int openBackplane(const char* device_bp, DAEstatus& dstatus) { return ISISVME::Success; }
54  int lockDevice(int timeout, DAEstatus& dstatus);
55  int unlockDevice(DAEstatus& dstatus);
56  void lockInterface(int timeout, DAEstatus& dstatus) { }
57  void unlockInterface(DAEstatus& dstatus) { }
58  int readU16noRetry(unsigned long address, isisU16_t* data16, TransferProps props, DAEstatus& dstatus);
59  int readU32noRetry(unsigned long address, isisU32_t* data32, TransferProps props, DAEstatus& dstatus);
60  int readU16(unsigned long address, isisU16_t* data16, TransferProps props, DAEstatus& dstatus);
61  int readU32(unsigned long address, isisU32_t* data32, TransferProps props, DAEstatus& dstatus);
62  int readBlockU16(unsigned long address, isisU16_t* data16, long nitems, TransferProps props, DAEstatus& dstatus);
63  int readBlockU32(unsigned long address, isisU32_t* data32, long nitems, TransferProps props, DAEstatus& dstatus);
64  int readBlockU64(unsigned long address, uint64_t* data64, long nitems, TransferProps props, DAEstatus& dstatus);
65  int writeU16(unsigned long address, isisU16_t data16, TransferProps props, DAEstatus& dstatus);
66  int writeU32(unsigned long address, isisU32_t data32, TransferProps props, DAEstatus& dstatus);
67  int writeBlockU16(unsigned long address, isisU16_t* data16, long nitems, TransferProps props, DAEstatus& dstatus);
68  int writeBlockU32(unsigned long address, isisU32_t* data32, long nitems, TransferProps props, DAEstatus& dstatus);
69  int writeBlockU64(unsigned long address, uint64_t* data64, long nitems, TransferProps props, DAEstatus& dstatus);
70  int writeBlock(unsigned long address, isisU32_t* data, long nitems, TransferProps props, DAEstatus& status);
71  int writeBlock(unsigned long address, uint64_t* data, long nitems, TransferProps props, DAEstatus& status);
72  int readBlock(unsigned long address, isisU32_t* data, long nitems, TransferProps props, DAEstatus& status);
73  int readBlock(unsigned long address, uint64_t* data, long nitems, TransferProps props, DAEstatus& status);
74  int close(DAEstatus& dstatus);
75  int scanBus(DAEstatus& status) { return ISISVME::Success; }
76  bool resetBus(DAEstatus& status) { return ISISVME::Success;}
77  bool initOK();
78  const char* device() { return m_device.c_str(); }
79  const char* deviceBackplane() { return ""; }
80  void setTriggerFunc(trigger_func_t* func, void* arg) { m_trigger_func = func; m_trigger_func_arg = arg; }
81 };
82 
83 #endif /* QXTRMINTERFACE_H */
int writeBlockU64impl(unsigned long address, uint64_t *data64, long nitems, TransferProps props, DAEstatus &dstatus)
virtual ~QxtrmInterface()
int writeBlock(unsigned long address, isisU32_t *data, long nitems, TransferProps props, DAEstatus &status)
uint32_t TransferProps
combination of TransferProp values
Definition: isisvme.h:16
int writeBlockU16(unsigned long address, isisU16_t *data16, long nitems, TransferProps props, DAEstatus &dstatus)
bool resetBus(DAEstatus &status)
int writeU32(unsigned long address, isisU32_t data32, TransferProps props, DAEstatus &dstatus)
int readU16noRetry(unsigned long address, isisU16_t *data16, TransferProps props, DAEstatus &dstatus)
int writeBlockU32(unsigned long address, isisU32_t *data32, long nitems, TransferProps props, DAEstatus &dstatus)
uint32_t m_nwords_memory
trigger_func_t * m_trigger_func
int writeUimpl(unsigned long address, T *data, int nitems, TransferProps props, DAEstatus &dstatus)
int readU16impl(unsigned long address, isisU16_t *data16, TransferProps props, DAEstatus &dstatus)
int writeBlockU16impl(unsigned long address, isisU16_t *data16, long nitems, TransferProps props, DAEstatus &dstatus)
int retryBlock(F pFunc, unsigned long address, T data, long nitems, TransferProps props, DAEstatus &dstatus)
unsigned long isisU32_t
Definition: isisvme_types.h:8
int readBlockU32(unsigned long address, isisU32_t *data32, long nitems, TransferProps props, DAEstatus &dstatus)
int readBlockU64(unsigned long address, uint64_t *data64, long nitems, TransferProps props, DAEstatus &dstatus)
const char * device()
int close(DAEstatus &dstatus)
int retrySingle(F pFunc, unsigned long address, T data, TransferProps props, DAEstatus &dstatus)
Qxtrm_driver * m_qxtrm
int readBlockU64impl(unsigned long address, uint64_t *data64, long nitems, TransferProps props, DAEstatus &dstatus)
int openBackplane(const char *device_bp, DAEstatus &dstatus)
int readUimpl(unsigned long address, T *data, int nitems, TransferProps props, DAEstatus &dstatus)
Poco::SharedPtr< Qxtrm_channel > m_rdma_mem
void lockInterface(int timeout, DAEstatus &dstatus)
const char * deviceBackplane()
int scanBus(DAEstatus &status)
int writeU16impl(unsigned long address, isisU16_t data16, TransferProps props, DAEstatus &dstatus)
QxtrmInterface(DAEstatus &dstatus, uint32_t *dau_memory=NULL, uint32_t nwords_memory=0, uint32_t *dau_registers=NULL, uint32_t nwords_registers=0)
void * m_trigger_func_arg
static const int m_tries
number of times to try a read/write
static const int m_retry_time
milliseconds between retries
unsigned short isisU16_t
Definition: isisvme_types.h:7
int lockDevice(int timeout, DAEstatus &dstatus)
uint32_t * m_dau_registers
int readBlockU16(unsigned long address, isisU16_t *data16, long nitems, TransferProps props, DAEstatus &dstatus)
std::string m_device
Poco::SharedPtr< Qxtrm_channel > m_rdma_reg
CRITICAL_SECTION m_visa_critical
void setTriggerFunc(trigger_func_t *func, void *arg)
int readU32(unsigned long address, isisU32_t *data32, TransferProps props, DAEstatus &dstatus)
int readU32impl(unsigned long address, isisU32_t *data32, TransferProps props, DAEstatus &dstatus)
int trigger_func_t(void *arg, time_t the_secs, unsigned short the_ms, int trig_id)
Definition: isisvme.h:8
int writeBlockU32impl(unsigned long address, isisU32_t *data32, long nitems, TransferProps props, DAEstatus &dstatus)
int readU16(unsigned long address, isisU16_t *data16, TransferProps props, DAEstatus &dstatus)
int readBlockU16impl(unsigned long address, isisU16_t *data16, long nitems, TransferProps props, DAEstatus &dstatus)
uint32_t * m_dau_memory
int unlockDevice(DAEstatus &dstatus)
int readBlock(unsigned long address, isisU32_t *data, long nitems, TransferProps props, DAEstatus &status)
int readU32noRetry(unsigned long address, isisU32_t *data32, TransferProps props, DAEstatus &dstatus)
int readBlockU32impl(unsigned long address, isisU32_t *data32, long nitems, TransferProps props, DAEstatus &dstatus)
int writeU32impl(unsigned long address, isisU32_t data32, TransferProps propsn, DAEstatus &dstatus)
int writeBlockU64(unsigned long address, uint64_t *data64, long nitems, TransferProps props, DAEstatus &dstatus)
void unlockInterface(DAEstatus &dstatus)
int open(const char *device, DAEstatus &dstatus)
uint32_t m_nwords_registers
int writeU16(unsigned long address, isisU16_t data16, TransferProps props, DAEstatus &dstatus)
int reinit(DAEstatus &dstatus)