pulserdriversh.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 <vector>
17 
18 //! My pulser driver
19 class XSHPulser : public XCharDeviceDriver<XPulser> {
20 public:
21  XSHPulser(const char *name, bool runtime,
22  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
23  virtual ~XSHPulser() {}
24 
25  struct Payload : public XPulser::Payload {
26  private:
27  friend class XSHPulser;
28  uint32_t m_lastPattern;
29  uint64_t m_dmaTerm;
30  std::vector<unsigned char> m_zippedPatterns;
31  int m_waveformPos[PAT_QAM_PULSE_IDX_MASK / PAT_QAM_PULSE_IDX];
32  };
33 
34  //! time resolution [ms]
35  virtual double resolution() const;
36 protected:
37  //! Sends patterns to pulser or turns off.
38  virtual void changeOutput(const Snapshot &shot, bool output, unsigned int blankpattern);
39  //! Converts RelPatList to native patterns
40  virtual void createNativePatterns(Transaction &tr);
41  virtual double resolutionQAM() const {return resolution();}
42  //! minimum period of pulses [ms]
43  virtual double minPulseWidth() const {return resolution();}
44  //! existence of AO ports.
45  virtual bool hasQAMPorts() const {return true;}
46 
47 private:
48  int setAUX2DA(Transaction &tr, double volt, int addr);
49  int insertPreamble(Transaction &tr, uint16_t startpattern);
50  int finishPulse(Transaction &tr);
51  //! Add 1 pulse pattern
52  //! \param term a period to next pattern
53  //! \param pattern a pattern for digital, to appear
54  int pulseAdd(Transaction &tr, uint64_t term, uint32_t pattern, bool firsttime, bool dryrun);
55 
56  //dma time commands
57  static const unsigned char PATTERN_ZIPPED_COMMAND_DMA_END;
58  //+1: a phase by 90deg.
59  //+2,3: from DMA start
60  //+4,5: src neg. offset from here
61  static const unsigned char PATTERN_ZIPPED_COMMAND_DMA_COPY_HBURST;
62  //+1,2: time to appear
63  //+2,3: pattern to appear
64  static const unsigned char PATTERN_ZIPPED_COMMAND_DMA_LSET_LONG;
65  //+0: time to appear + START
66  //+1,2: pattern to appear
67  static const unsigned char PATTERN_ZIPPED_COMMAND_DMA_LSET_START;
68  static const unsigned char PATTERN_ZIPPED_COMMAND_DMA_LSET_END;
69 
70  //off-dma time commands
71  static const unsigned char PATTERN_ZIPPED_COMMAND_END;
72  //+1,2 : TimerL
73  static const unsigned char PATTERN_ZIPPED_COMMAND_WAIT;
74  //+1,2 : TimerL
75  //+3,4: LSW of TimerU
76  static const unsigned char PATTERN_ZIPPED_COMMAND_WAIT_LONG;
77  //+1,2 : TimerL
78  //+3,4: MSW of TimerU
79  //+5,6: LSW of TimerU
80  static const unsigned char PATTERN_ZIPPED_COMMAND_WAIT_LONG_LONG;
81  //+1: byte
82  static const unsigned char PATTERN_ZIPPED_COMMAND_AUX1;
83  //+1: byte
84  static const unsigned char PATTERN_ZIPPED_COMMAND_AUX3;
85  //+1: address
86  //+2,3: value
87  static const unsigned char PATTERN_ZIPPED_COMMAND_AUX2_DA;
88  //+1,2: loops
89  static const unsigned char PATTERN_ZIPPED_COMMAND_DO;
90  static const unsigned char PATTERN_ZIPPED_COMMAND_LOOP;
91  static const unsigned char PATTERN_ZIPPED_COMMAND_LOOP_INF;
92  static const unsigned char PATTERN_ZIPPED_COMMAND_BREAKPOINT;
93  static const unsigned char PATTERN_ZIPPED_COMMAND_PULSEON;
94  //+1,2: last pattern
95  static const unsigned char PATTERN_ZIPPED_COMMAND_DMA_SET;
96  //+1,2: size
97  //+2n: patterns
98  static const unsigned char PATTERN_ZIPPED_COMMAND_DMA_HBURST;
99  //+1 (signed char): QAM1 offset
100  //+2 (signed char): QAM2 offset
101  static const unsigned char PATTERN_ZIPPED_COMMAND_SET_DA_TUNE_OFFSET;
102  //+1 (signed char): QAM1 level
103  //+2 (signed char): QAM2 level
104  static const unsigned char PATTERN_ZIPPED_COMMAND_SET_DA_TUNE_LEVEL;
105  //+1 (signed char): QAM1 delay
106  //+2 (signed char): QAM2 delay
107  static const unsigned char PATTERN_ZIPPED_COMMAND_SET_DA_TUNE_DELAY;
108 };

Generated for KAME4 by  doxygen 1.8.3