ICP  1
QxtrmSimulation.h
Go to the documentation of this file.
1 #ifndef QXTRM_SIMULATION_H
2 #define QXTRM_SIMULATION_H
3 
4 #include "isisvme.h"
5 #include "vme_simulation.h"
6 //#include "sim_environment_card.h"
7 //#include "sim_detector_card.h"
8 //#include "sim_period_card.h"
9 
10 class DAEstatus;
11 class DAE3Policy;
12 class DAE3CardPolicy;
14 class DAE3DetCardPolicy;
15 class VMESimulationIface;
16 template <class DAECardPolicy> class SIMDAE2Card;
17 template <class EnvPeriodPolicy> class SIMEnvCard;
18 template <class EnvPeriodPolicy> class SIMEnvPeriodCard;
19 template <class DetCardPolicy> class SIMDetectorCard;
20 
22 {
23 private:
26  static std::vector<VMESimulationIface*> m_sim_vme;
31 
32  public:
33  std::vector<MySIMDetectorCard*> m_det_card_list;
34  std::vector<MySIMEnvPeriodCard*> m_env_card_list;
35  int getCardIds(std::vector<int>& card_ids);
36 
37  public:
38  CRITICAL_SECTION m_critical;
40 
41  public: // functions
42  QxtrmSimulation(DAEstatus& status);
43  virtual ~QxtrmSimulation();
44  int open(const char* device, DAEstatus& status);
45  int openBackplane(const char* device_bp, DAEstatus& status);
46  int lockDevice(int timeout, DAEstatus& status);
47  int unlockDevice(DAEstatus& status);
48  void lockInterface(int /*timeout*/, DAEstatus& /*dstatus*/) { }
49  void unlockInterface(DAEstatus& /*dstatus*/) { }
50  int readU16noRetry(unsigned long address, isisU16_t* data16, TransferProps props, DAEstatus& dstatus);
51  int readU32noRetry(unsigned long address, isisU32_t* data32, TransferProps props, DAEstatus& dstatus);
52  int readU16(unsigned long address, isisU16_t* data16, TransferProps props, DAEstatus& status);
53  int readU32(unsigned long address, isisU32_t* data32, TransferProps props, DAEstatus& status);
54  int readBlockU16(unsigned long address, isisU16_t* data16, long nitems, TransferProps props, DAEstatus& status);
55  int readBlockU32(unsigned long address, isisU32_t* data32, long nitems, TransferProps props, DAEstatus& status);
56  int writeU16(unsigned long address, isisU16_t data16, TransferProps props, DAEstatus& status);
57  int writeU32(unsigned long address, isisU32_t data32, TransferProps props, DAEstatus& status);
58  int writeBlockU16(unsigned long address, isisU16_t* data16, long nitems, TransferProps props, DAEstatus& status);
59  int writeBlockU32(unsigned long address, isisU32_t* data32, long nitems, TransferProps props, DAEstatus& status);
60  int close(DAEstatus& status);
61  int scanBus(DAEstatus& status);
62  bool resetBus(DAEstatus& status);
63  bool initOK();
65  static void simulation_routineImpl(void* arg);
66 
67  bool isCrateVetoing();
68  bool isCrateRunning();
69  static bool isVetoing();
70  static bool isRunning();
71  static int frameNumber();
72 
73 // bool ECusingHardwarePeriods() { return (!(m_runControlRegister & RCPERSZEQZERO)); }
74 
75  public:
76  int simulateRead16(TransferProps props, unsigned long address, isisU16_t* data16, long nitems, DAEstatus& status);
77  int simulateRead32(TransferProps props, unsigned long address, isisU32_t* data32, long nitems, DAEstatus& status);
78  int simulateWrite16(TransferProps props, unsigned long address, isisU16_t* data16, long nitems, DAEstatus& status);
79  int simulateWrite32(TransferProps props, unsigned long address, isisU32_t* data32, long nitems, DAEstatus& status);
82  const char* device() { return "simulation"; }
83  void setTriggerFunc(trigger_func_t* func, void* arg) { m_trigger_func = func; m_trigger_func_arg = arg; }
84  int onTrigger(time_t the_secs, unsigned short the_ms, int trig_id);
85 
86 };
87 
88 #endif /* QXTRM_SIMULATION_H */
std::vector< MySIMEnvPeriodCard * > m_env_card_list
uint32_t TransferProps
combination of TransferProp values
Definition: isisvme.h:16
SIMEnvPeriodCard< DAE3EnvPeriodPolicy > MySIMEnvPeriodCard
int readU32noRetry(unsigned long address, isisU32_t *data32, TransferProps props, DAEstatus &dstatus)
int readU16noRetry(unsigned long address, isisU16_t *data16, TransferProps props, DAEstatus &dstatus)
std::vector< MySIMDetectorCard * > m_det_card_list
static int frameNumber()
int readBlockU16(unsigned long address, isisU16_t *data16, long nitems, TransferProps props, DAEstatus &status)
int open(const char *device, DAEstatus &status)
int simulateRead32(TransferProps props, unsigned long address, isisU32_t *data32, long nitems, DAEstatus &status)
static std::vector< VMESimulationIface * > m_sim_vme
static bool isRunning()
unsigned long isisU32_t
Definition: isisvme_types.h:8
static bool isVetoing()
int incrementDetectorCardPeriod()
int getCardIds(std::vector< int > &card_ids)
int writeBlockU32(unsigned long address, isisU32_t *data32, long nitems, TransferProps props, DAEstatus &status)
int onTrigger(time_t the_secs, unsigned short the_ms, int trig_id)
SIMDetectorCard< DAE3DetCardPolicy > MySIMDetectorCard
int simulateWrite16(TransferProps props, unsigned long address, isisU16_t *data16, long nitems, DAEstatus &status)
const char * device()
SIMDAE2Card< DAE3CardPolicy > MySIMDAE2Card
int lockDevice(int timeout, DAEstatus &status)
void setTriggerFunc(trigger_func_t *func, void *arg)
QxtrmSimulation(DAEstatus &status)
int writeU16(unsigned long address, isisU16_t data16, TransferProps props, DAEstatus &status)
int readU32(unsigned long address, isisU32_t *data32, TransferProps props, DAEstatus &status)
void lockInterface(int, DAEstatus &)
int close(DAEstatus &status)
void * m_trigger_func_arg
void unlockInterface(DAEstatus &)
unsigned short isisU16_t
Definition: isisvme_types.h:7
int writeU32(unsigned long address, isisU32_t data32, TransferProps props, DAEstatus &status)
int readU16(unsigned long address, isisU16_t *data16, TransferProps props, DAEstatus &status)
trigger_func_t * m_trigger_func
bool shutdownRequested()
bool isCrateRunning()
int trigger_func_t(void *arg, time_t the_secs, unsigned short the_ms, int trig_id)
Definition: isisvme.h:8
int scanBus(DAEstatus &status)
int readBlockU32(unsigned long address, isisU32_t *data32, long nitems, TransferProps props, DAEstatus &status)
bool resetBus(DAEstatus &status)
int simulateRead16(TransferProps props, unsigned long address, isisU16_t *data16, long nitems, DAEstatus &status)
SIMEnvCard< DAE3EnvPeriodPolicy > MySIMEnvCard
CRITICAL_SECTION m_critical
int simulateWrite32(TransferProps props, unsigned long address, isisU32_t *data32, long nitems, DAEstatus &status)
virtual void simulation_routineImpl()=0
virtual ~QxtrmSimulation()
int resetDetectorCardPeriod()
bool isCrateVetoing()
int writeBlockU16(unsigned long address, isisU16_t *data16, long nitems, TransferProps props, DAEstatus &status)
int openBackplane(const char *device_bp, DAEstatus &status)
int unlockDevice(DAEstatus &status)