vmod/vmodttl: fixed bug related to luns not ordered and/or not starting from zero.
[ht-drivers.git] / cvorg / include / cvorg.h
blob4e749763249aa5803ac415572d876b6ccf5e2bf5
1 /*
2 * cvorg.h
4 * CVORG kernel/user-space interface
5 */
7 #ifndef _CVORG_H_
8 #define _CVORG_H_
10 #if !defined(__KERNEL__)
11 #include <stdint.h>
12 #else
13 #include <linux/types.h>
14 #endif
16 /* 2MB of SRAM per channel --> 1M samples/channel (i.e. 2 bytes/sample) */
17 #define CVORG_SRAM_SIZE 0x200000
18 #define CVORG_SRAM_SIZE_LONGS ((CVORG_SRAM_SIZE)/sizeof(uint32_t))
20 /* 100MHz maximum sampling frequency */
21 #define CVORG_MAX_FREQ 100000000
23 /**
24 * @brief CVORG channels
26 enum cvorg_channelnr {
27 CVORG_CHANNEL_A = 1,
28 CVORG_CHANNEL_B
31 /**
32 * @brief Analog output offset
34 enum cvorg_outoff {
35 CVORG_OUT_OFFSET_0V,
36 CVORG_OUT_OFFSET_2_5V
39 /**
40 * @brief CVORG Input (triggers) polarity
42 enum cvorg_inpol {
43 CVORG_POSITIVE_PULSE,
44 CVORG_NEGATIVE_PULSE
47 /* channel status bitmask */
48 #define CVORG_CHANSTAT_READY 0x1
49 #define CVORG_CHANSTAT_BUSY 0x2
50 #define CVORG_CHANSTAT_ERR 0x4
51 #define CVORG_CHANSTAT_CLKOK 0x8
52 #define CVORG_CHANSTAT_ERR_CLK 0x10
53 #define CVORG_CHANSTAT_ERR_TRIG 0x20
54 #define CVORG_CHANSTAT_ERR_SYNC 0x40
55 #define CVORG_CHANSTAT_SRAM_BUSY 0x80
56 #define CVORG_CHANSTAT_STARTABLE 0x100
57 #define CVORG_CHANSTAT_OUT_ENABLED 0x200
60 /**
61 * @brief CVORG triggers
63 enum cvorg_trigger {
64 CVORG_TRIGGER_START,
65 CVORG_TRIGGER_STOP,
66 CVORG_TRIGGER_EVSTOP
69 /**
70 * @brief Operation modes
72 enum cvorg_mode {
73 CVORG_MODE_OFF,
74 CVORG_MODE_NORMAL,
75 CVORG_MODE_DAC,
76 CVORG_MODE_TEST1,
77 CVORG_MODE_TEST2,
78 CVORG_MODE_TEST3
81 /**
82 * @brief Waveform struct
84 struct cvorg_wv {
85 uint32_t recurr; /**< play this wv 'recurr' times */
86 uint32_t size; /**< size (in bytes) of the waveform */
87 uint32_t dynamic_gain; /**< 1 to use gain_val, 0 otherwise */
88 int32_t gain_val; /**< [-22,20] dB */
89 void *form; /**< address of the waveform */
92 /**
93 * @brief write buffer
95 struct cvorg_seq {
96 uint32_t nr; /**< play this sequence nr times */
97 uint32_t n_waves; /**< number of waveforms */
98 struct cvorg_wv *waves; /**< address of the waveforms */
102 * @brief SRAM entry
103 * @param address - address of the SRAM entry
104 * @param data - value of the SRAM entry
106 struct cvorg_sram_entry {
107 uint32_t address;
108 uint16_t data[2];
111 enum cvorg_adc_channel {
112 CVORG_ADC_CHANNEL_MONITOR,
113 CVORG_ADC_CHANNEL_REF,
114 CVORG_ADC_CHANNEL_5V,
115 CVORG_ADC_CHANNEL_GND
118 enum cvorg_adc_range {
119 CVORG_ADC_RANGE_5V_BIPOLAR,
120 CVORG_ADC_RANGE_5V_UNIPOLAR,
121 CVORG_ADC_RANGE_10V_BIPOLAR,
122 CVORG_ADC_RANGE_10V_UNIPOLAR
126 * @brief ADC configuration struct
127 * @param channel - ADC channel. See enum cvorg_adc_channel.
128 * @param range - Input range. See enum cvorg_adc_range.
129 * @param value - Read value of the selected ADC for the given number/range.
131 struct cvorg_adc {
132 uint32_t channel;
133 uint32_t range;
134 uint32_t value;
138 * @brief DAC configuration struct
139 * @param gain - Gain value used by the DAC.
140 * @param offset - Offset value used by the DAC.
142 struct cvorg_dac {
143 uint32_t gain;
144 uint32_t offset;
147 #endif /* _CVORG_H_ */