thamwaypulser.h
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 #include "pulserdriver.h"
15 #include "chardevicedriver.h"
16 #include "charinterface.h"
17 #include <vector>
18 
19 class XThamwayUSBPulser;
20 class XThamwayCharPulser;
21 
22 //! pulser driver
23 class XThamwayPulser : public XPulser {
24 public:
25  XThamwayPulser(const char *name, bool runtime,
26  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
27  virtual ~XThamwayPulser() {}
28 
29  struct Payload : public XPulser::Payload {
30  private:
31  friend class XThamwayPulser;
32  friend class XThamwayUSBPulser;
33  friend class XThamwayCharPulser;
34  struct Pulse {
35  uint32_t term_n_cmd;
36  uint32_t data;
37  };
38  std::deque<Pulse> m_patterns;
39  };
40 
41  //! time resolution [ms]
42  virtual double resolution() const;
43 protected:
44  virtual void open() throw (XKameError &) = 0;
45  //! Sends patterns to pulser or turns off.
46  virtual void changeOutput(const Snapshot &shot, bool output, unsigned int blankpattern) = 0;
47 
48  virtual void getStatus(bool *running = 0L, bool *extclk_det = 0L) = 0;
49 
50  //! Converts RelPatList to native patterns
51  virtual void createNativePatterns(Transaction &tr);
52  virtual double resolutionQAM() const {return 0.0;}
53  //! minimum period of pulses [ms]
54  virtual double minPulseWidth() const;
55  //! existense of AO ports.
56  virtual bool hasQAMPorts() const {return false;}
57 private:
58  //! Add 1 pulse pattern
59  //! \param term a period of the pattern to appear
60  //! \param pattern a pattern for digital, to appear
61  int pulseAdd(Transaction &tr, uint64_t term, uint16_t pattern);
62 };
63 
64 #if defined USE_EZUSB
65  #include "ezusbthamway.h"
67  public:
68  XThamwayPGCUSBInterface(const char *name, bool runtime, const shared_ptr<XDriver> &driver)
69  : XWinCUSBInterface(name, runtime, driver, 0, "PG32") {}
70  virtual ~XThamwayPGCUSBInterface() {}
71  };
72 
73  class XThamwayUSBPulser : public XCharDeviceDriver<XThamwayPulser, XThamwayPGCUSBInterface> {
74  public:
75  XThamwayUSBPulser(const char *name, bool runtime,
76  Transaction &tr_meas, const shared_ptr<XMeasure> &meas) :
77  XCharDeviceDriver<XThamwayPulser, XThamwayPGCUSBInterface>(name, runtime, ref(tr_meas), meas) {}
78  virtual ~XThamwayUSBPulser() {}
79  protected:
80  virtual void open() throw (XKameError &);
81  //! Sends patterns to pulser or turns off.
82  virtual void changeOutput(const Snapshot &shot, bool output, unsigned int blankpattern);
83 
84  virtual void getStatus(bool *running = 0L, bool *extclk_det = 0L);
85  };
86 #endif
87 class XThamwayCharPulser : public XCharDeviceDriver<XThamwayPulser> {
88 public:
89  XThamwayCharPulser(const char *name, bool runtime,
90  Transaction &tr_meas, const shared_ptr<XMeasure> &meas) :
91  XCharDeviceDriver<XThamwayPulser>(name, runtime, ref(tr_meas), meas) {}
92  virtual ~XThamwayCharPulser() {}
93 protected:
94  virtual void open() throw (XKameError &);
95  //! Sends patterns to pulser or turns off.
96  virtual void changeOutput(const Snapshot &shot, bool output, unsigned int blankpattern);
97 
98  virtual void getStatus(bool *running = 0L, bool *extclk_det = 0L);
99 };

Generated for KAME4 by  doxygen 1.8.3