Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/drivers/ad9371/t_mykonos_gpio.h

raw symbols SCIP
1 /*!
2 * \file t_mykonos_gpio.h
3 * \brief Mykonos GPIO error handling and type defines
4 *
5 * Mykonos API version: 1.3.1.3534
6 */
7
8 #ifndef T_MYKONOSGPIO_H_
9 #define T_MYKONOSGPIO_H_
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15
16 #include "common.h"
17
18 /**
19 * \brief Enum of unique error codes from the Mykonos GPIO API functions.
20 * Each error condition in the library should get its own enum value to allow
21 * easy debug of errors.
22 */
23 typedef enum
24 {
25 MYKONOS_ERR_GPIO_OK = 0,
26 MYKONOS_ERR_EN_MONITOR_OUT_NOT_ENABLED,
27 MYKONOS_ERR_EN_MONITOR_OUT_SRC_CTRL,
28 MYKONOS_ERR_MONITOR_OUT_INDEX_RANGE,
29 MYKONOS_ERR_GETGPIOMON_INDEX_NULL_PARM,
30 MYKONOS_ERR_GETGPIOMON_MONITORMASK_NULL_PARM,
31
32 MYKONOS_ERR_MGCRX2_GPIO_DECPIN_INV_PARAM,
33 MYKONOS_ERR_MGCRX2_GPIO_INCPIN_INV_PARAM,
34 MYKONOS_ERR_MGCRX2_SOURCE_CONFIG,
35 MYKONOS_ERR_MGCRX2_STEP_INV_PARAM,
36 MYKONOS_ERR_MGCRX1_GPIO_DECPIN_INV_PARAM,
37 MYKONOS_ERR_MGCRX1_GPIO_INCPIN_INV_PARAM,
38 MYKONOS_ERR_MGCRX1_STEP_INV_PARAM,
39 MYKONOS_ERR_GETRX2PIN_INCSTEP_NULL_PARM,
40 MYKONOS_ERR_GETRX2PIN_DECSTEP_NULL_PARM,
41 MYKONOS_ERR_GETRX2PIN_INCPIN_NULL_PARM,
42 MYKONOS_ERR_GETRX2PIN_DECPIN_NULL_PARM,
43 MYKONOS_ERR_GETRX2PIN_EN_NULL_PARM,
44 MYKONOS_ERR_GETRX1PIN_INCSTEP_NULL_PARM,
45 MYKONOS_ERR_GETRX1PIN_DECSTEP_NULL_PARM,
46 MYKONOS_ERR_GETRX1PIN_INCPIN_NULL_PARM,
47 MYKONOS_ERR_GETRX1PIN_DECPIN_NULL_PARM,
48 MYKONOS_ERR_GETRX1PIN_EN_NULL_PARM,
49
50 MYKONOS_ERR_TPCTX2_GPIO_DECPIN_INV_PARAM,
51 MYKONOS_ERR_TPCTX2_GPIO_INCPIN_INV_PARAM,
52 MYKONOS_ERR_TPCTX2_GPIO_STEP_INV_PARAM,
53 MYKONOS_ERR_TPCTX1_GPIO_DECPIN_INV_PARAM,
54 MYKONOS_ERR_TPCTX1_GPIO_INCPIN_INV_PARAM,
55 MYKONOS_ERR_TPCTX1_GPIO_STEP_INV_PARAM,
56 MYKONOS_ERR_GETTX2PIN_STEP_NULL_PARM,
57 MYKONOS_ERR_GETTX2PIN_INC_NULL_PARM,
58 MYKONOS_ERR_GETTX2PIN_DEC_NULL_PARM,
59 MYKONOS_ERR_GETTX2PIN_EN_NULL_PARM,
60 MYKONOS_ERR_GETTX2PIN_TX1TX2_NULL_PARM,
61 MYKONOS_ERR_GETTX1PIN_STEP_NULL_PARM,
62 MYKONOS_ERR_GETTX1PIN_INC_NULL_PARM,
63 MYKONOS_ERR_GETTX1PIN_DEC_NULL_PARM,
64 MYKONOS_ERR_GETTX1PIN_EN_NULL_PARM,
65 MYKONOS_ERR_GETTX1PIN_TX1TX2_NULL_PARM,
66
67 MYKONOS_ERR_SPI2_INV_GPIO,
68 MYKONOS_ERR_SPI2_INV_SETUP,
69
70 MYKONOS_ERR_SET_GPIO_1V8_INV_POINTER,
71
72 MYKONOS_ERR_GETGPIOSETLEVEL_NULL_PARM,
73 MYKONOS_ERR_READGPIOSPI_NULL_PARM,
74 MYKONOS_ERR_SET_GPIO_1V8_INV_MODE,
75 MYKONOS_ERR_GETGPIO_OE_NULL_PARM,
76 MYKONOS_ERR_GPIO_OE_INV_PARAM,
77 MYKONOS_ERR_GPIO_SRC_PARAM_INV,
78
79 MYKONOS_ERR_INV_GP_INT_MASK_PARM,
80 MYKONOS_ERR_GP_INT_STATUS_NULL_PARAM,
81
82 MYKONOS_ERR_GETGPIO3V3OUT_NULL_PARM,
83 MYKONOS_ERR_SET_GPIO_3V3_INV_POINTER,
84 MYKONOS_ERR_GETGPIO3V3SPI_NULL_PARM,
85 MYKONOS_ERR_GPIO3V3OUTEN_NULL_PARM,
86 MYKONOS_ERR_SET_GPIO_3V3_INV_MODE,
87 MYKONOS_ERR_SET_GPIO_3V3_INV_SRC_CTRL,
88
89 MYKONOS_ERR_SET_ARMGPIO_INV_POINTER,
90 MYKONOS_ERR_SET_ARMGPIO_PINS_ARMERROR,
91 MYKONOS_ERR_SET_ARMGPIO_PINS_INV_SIGNALID,
92 MYKONOS_ERR_SET_ARMGPIO_PINS_INV_GPIOPIN,
93 MYKONOS_ERR_SET_RADIOCTRL_PINS_ARMERROR,
94
95 MYKONOS_ERR_SETUPAUXDAC_NULL_PARAM,
96 MYKONOS_ERR_WRITEAUXDAC_NULL_AUXIO,
97 MYKONOS_ERR_READAUXADC_NULL_PARAM,
98 MYKONOS_ERR_SETUPAUXDAC_INV_AUXDACCODE,
99 MYKONOS_ERR_WRITEAUXDAC_INV_AUXDACCODE,
100 MYKONOS_ERR_WRITEAUXDAC_INV_AUXDACINDEX,
101 MYKONOS_ERR_INV_AUX_ADC_CHAN_PARM,
102 MYKONOS_ERR_SETUPAUXADC_INV_VCODIV,
103 MYKONOS_ERR_INV_AUX_ADC_DEC_PARM,
104
105 MYKONOS_ERR_GAINCOMP_NULL_STRUCT,
106 MYKONOS_ERR_GAINCOMP_SET_NULL_STRUCT,
107 MYKONOS_ERR_GAINCOMP_INV_RX1_OFFSET,
108 MYKONOS_ERR_GAINCOMP_INV_RX2_OFFSET,
109 MYKONOS_ERR_GAINCOMP_INV_STEP,
110 MYKONOS_ERR_GAINCOMP_INV_EN,
111
112 MYKONOS_ERR_OBS_RX_GAINCOMP_SET_NULL_STRUCT,
113 MYKONOS_ERR_OBS_RX_GAINCOMP_INV_EN,
114 MYKONOS_ERR_OBS_RX_GAINCOMP_INV_OFFSET,
115 MYKONOS_ERR_OBS_RX_GAINCOMP_INV_STEP,
116 MYKONOS_ERR_OBS_RX_GAINCOMP_NULL_STRUCT,
117
118 MYKONOS_ERR_SLICER_STEP_OUT_OF_RANGE,
119 MYKONOS_ERR_SLICER_INV_RX1_SEL,
120 MYKONOS_ERR_SLICER_INV_RX2_SEL,
121 MYKONOS_ERR_SLICER_EN_INV,
122
123 MYKONOS_ERR_SLICER_RX1PIN_NULL_PARM,
124 MYKONOS_ERR_SLICER_RX2PIN_NULL_PARM,
125 MYKONOS_ERR_SLICER_STEP_NULL_PARM,
126 MYKONOS_ERR_SLICER_EN_NULL_PARM,
127
128 MYKONOS_ERR_SLICER_INV_OBS_RX_SEL,
129 MYKONOS_ERR_SLICER_OBS_RX_STEP_OUT_OF_RANGE,
130 MYKONOS_ERR_SLICER_OBS_RX_EN_INV,
131 MYKONOS_ERR_SLICER_OBS_RX_EN_NULL_PARM,
132 MYKONOS_ERR_SLICER_OBS_RX_STEP_NULL_PARM,
133 MYKONOS_ERR_SLICER_OBS_RXPIN_NULL_PARM,
134
135 MYKONOS_ERR_FLOATFRMT_NULL_STRUCT,
136 MYKONOS_ERR_FLOATFRMT_SET_NULL_STRUCT,
137 MYKONOS_ERR_FLOATFRMT_INV_ROUND_MODE,
138 MYKONOS_ERR_FLOATFRMT_INV_DATA_FORMAT,
139 MYKONOS_ERR_FLOATFRMT_INV_ENC_NAN,
140 MYKONOS_ERR_FLOATFRMT_INV_EXP_BITS,
141 MYKONOS_ERR_FLOATFRMT_INV_LEADING,
142 MYKONOS_ERR_FLOATFRMT_INV_RX1ATT,
143 MYKONOS_ERR_FLOATFRMT_INV_RX2ATT,
144 MYKONOS_ERR_FLOATFRMT_INV_EN,
145 MYKONOS_ERR_FLOATFRMT_NULL_RX1ATT,
146 MYKONOS_ERR_FLOATFRMT_NULL_RX2ATT,
147 MYKONOS_ERR_FLOATFRMT_NULL_ENABLE,
148 MYKONOS_ERR_FLOATFRMT_SET_INV_EN,
149 MYKONOS_ERR_FLOATFRMT_SET_INV_RX1ATT,
150 MYKONOS_ERR_FLOATFRMT_SET_INV_RX2ATT,
151
152 MYKONOS_ERR_FLOATFRMT_INV_ORXATT,
153 MYKONOS_ERR_FLOATFRMT_INV_ORXEN,
154 MYKONOS_ERR_FLOATFRMT_NULL_ORXATT,
155 MYKONOS_ERR_FLOATFRMT_NULL_ORXENABLE,
156
157 MYKONOS_ERR_SETUPTEMPSENSOR_NULL_PARAM,
158 MYKONOS_ERR_SETUPTEMPSENSOR_INV_TEMPDECIMATION,
159 MYKONOS_ERR_SETUPTEMPSENSOR_INV_OFFSET,
160 MYKONOS_ERR_SETUPTEMPSENSOR_INV_TEMPWINDOW,
161 MYKONOS_ERR_GETTEMPSENSORCFG_NULL_PARAM,
162 MYKONOS_ERR_READTEMPSENSOR_NULL_PARAM,
163 MYKONOS_ERR_READTEMPSENSOR_NOT_LOCKED,
164
165 MYKONOS_ERR_GAIN_CONTROL_NOT_HYBRID,
166 MYKONOS_ERR_GPIO_HYBRID_RX1_PIN,
167 MYKONOS_ERR_GPIO_HYBRID_RX2_PIN,
168 MYKONOS_ERR_GPIO_HYBRID_RX1_PIN_NULL_PARM,
169 MYKONOS_ERR_GPIO_HYBRID_RX2_PIN_NULL_PARM,
170 MYKONOS_ERR_GPIO_HYBRID_RX1_PIN_READ,
171 MYKONOS_ERR_GPIO_HYBRID_RX2_PIN_READ,
172 MYKONOS_ERR_AGC_OBS_NOT_IN_HYBRID,
173 MYKONOS_ERR_GPIO_HYBRID_ORX_PIN,
174 MYKONOS_ERR_GPIO_HYBRID_ORX_PIN_NULL_PARM,
175
176 MYKONOS_ERR_GAIN_CONTROL_NOT_AGC,
177 MYKONOS_ERR_GPIO_AGC_SYNC_RX1_PIN,
178 MYKONOS_ERR_GPIO_AGC_SYNC_RX2_PIN,
179 MYKONOS_ERR_GPIO_AGC_SYNC_RX1_PIN_NULL_PARM,
180 MYKONOS_ERR_GPIO_AGC_SYNC_RX2_PIN_NULL_PARM,
181 MYKONOS_ERR_OBS_GAIN_CONTROL_NOT_AGC,
182 MYKONOS_ERR_GPIO_AGC_SYNC_ORX_PIN,
183 MYKONOS_ERR_GPIO_AGC_SYNC_ORX_PIN_NULL_PARM,
184
185 MYKONOS_ERR_GETGPIODRV_NULL_PARAM,
186 MYKONOS_ERR_GPIO_DRV_INV_PARAM,
187
188 MYKONOS_ERR_GPIO_SLEW_RATE_INV_PARAM,
189 MYKONOS_ERR_GPIO_GETSLEW_NULL_PARAM,
190
191 MYKONOS_ERR_CMOS_DRV_INV_PARAM,
192 MYKONOS_ERR_CMOS_DRV_NULL_PARAM
193 } mykonosGpioErr_t;
194
195 /**
196 * \brief Enum of possible Rx Slicer pin combinations
197 */
198 typedef enum
199 {
200 GPIO_0_1_2 = 0, /*!< GPIO combination for RX1 */
201 GPIO_5_6_7 = 1, /*!< GPIO combination for RX1 or RX2 */
202 GPIO_8_9_10 = 2, /*!< GPIO combination for RX1 */
203 GPIO_11_12_13 = 3 /*!< GPIO combination for RX2 */
204 } mykonosRxSlicer_t;
205
206 /**
207 * \brief Enum of possible observation channel Slicer pin combinations
208 */
209 typedef enum
210 {
211 GPIO_18_17_16 = 0, /*!< GPIO combination for observation channel */
212 GPIO_16_15_14 = 1, /*!< GPIO combination for observation channel */
213 } mykonosObsRxSlicer_t;
214
215 /**
216 * \brief Enum of possible GPIO slew rate settings
217 */
218 typedef enum
219 {
220 MYK_SLEWRATE_NONE = 0, /*!< Lower slew rate for the GPIO */
221 MYK_SLEWRATE_LOW = 1, /*!< Low slew rate for the GPIO */
222 MYK_SLEWRATE_MEDIUM = 2, /*!< Medium slew rate for the GPIO */
223 MYK_SLEWRATE_HIGH = 3 /*!< High slew rate for the GPIO */
224 } mykonosGpioSlewRate_t;
225
226 /**
227 * \brief Enumerated list of CMOS pads drive strength options
228 */
229 typedef enum
230 {
231 MYK_CMOSPAD_DRV_1X = 0x00, /*!< 2.5pF load @ 65MHz */
232 MYK_CMOSPAD_DRV_2X = 0x01, /*!< 5pF load @ 65MHz */
233 MYK_CMOSPAD_DRV_3X = 0x03, /*!< 7.5pF load @ 65MHz */
234 MYK_CMOSPAD_DRV_4X = 0x07, /*!< 10pF load @ 65MHz */
235 MYK_CMOSPAD_DRV_5X = 0x0F /*!< 12.5pF load @ 65MHz */
236 } mykonosCmosPadDrvStr_t;
237
238
239 /**
240 * \brief Enumerated list for Aux ADCs
241 */
242 typedef enum
243 {
244 MYK_AUXADC_0 = 0x00, /*!< Aux ADC channel 0 */
245 MYK_AUXADC_1 = 0x01, /*!< Aux ADC channel 1 */
246 MYK_AUXADC_2 = 0x02, /*!< Aux ADC channel 2 */
247 MYK_AUXADC_3 = 0x03, /*!< Aux ADC channel 3 */
248 MYK_AUXADC_0_DIV2 = 0x04, /*!< Aux ADC channel 0 with the divider by 2 set */
249 MYK_TEMPSENSOR = 0x10 /*!< Temperature sensor channel */
250 } mykonosAuxAdcChannels_t;
251
252
253 /**
254 * \brief Data structure to hold Gain compensation settings for the main receive channels
255 **/
256 typedef struct
257 {
258 uint8_t rx1Offset; /*!< These parameter contains the Rx1 offset word used for the gain compensation
259 when the gain index is at its maximum setting.
260 It has a range of 0 to 0x1F with a resolution is 0.5dB per LSB. */
261 uint8_t rx2Offset; /*!< These parameter contains the Rx2 offset word used for the gain compensation
262 when the gain index is at its maximum setting.
263 It has a range of 0 to 0x1F with a resolution is 0.5dB per LSB. */
264 uint8_t compStep; /*!< These bits contains the value in dB that the total Rx gain changes
265 when there is an LSB change in the gain index according to the following settings:
266 compStep | dB ramp
267 ---------|------------
268 0 | 0.25dB
269 1 | 0.5dB
270 2 | 1.0dB
271 3 | 2.0dB
272 4 | 3.0dB
273 5 | 4.0dB
274 6 | 6.0dB
275 7 | Not valid defaulted to 0.25dB */
276 } mykonosGainComp_t;
277
278 /**
279 * \brief Data structure to hold Gain compensation settings for the observation channel
280 **/
281 typedef struct
282 {
283 uint8_t obsRxOffset; /*!< These parameter contains the Rx1 offset word used for the gain compensation
284 when the gain index is at its maximum setting.
285 It has a range of 0 to 0x1F with a resolution is 0.5dB per LSB. */
286 uint8_t compStep; /*!< These bits contains the value in dB that the total Rx gain changes
287 when there is an LSB change in the gain index according to the following settings:
288 compStep | dB ramp
289 ---------|------------
290 0 | 0.25dB
291 1 | 0.5dB
292 2 | 1.0dB
293 3 | 2.0dB
294 4 | 3.0dB
295 5 | 4.0dB
296 6 | 6.0dB
297 7 | Not valid defaulted to 0.25dB */
298 } mykonosObsRxGainComp_t;
299
300 /**
301 * \brief Data structure to hold floating point formatter settings for the floating point
302 * number generation
303 **/
304 typedef struct
305 {
306 uint8_t roundMode; /*!<These parameter set the round modes for the significand.
307 The following settings are defined in the IEEE754 specification:
308 roundMode | Round type
309 ----------|-----------------
310 0 | RoundTiesToEven
311 1 | RoundTowardsPositive
312 2 | RoundTowardsNegative
313 3 | RoundTowardsZero
314 4 | RoundTiesToAway*/
315 uint8_t dataFormat; /*!< These parameter sets the format of the 16-bit output on the JESD interface:
316 Setting this to 1 then the format is from MSB to LSB to {sign, significand, exponent}.
317 Clearing this bit sets the format to {sign, exponent, significand}.*/
318 uint8_t encNan; /*!< if this parameter is set to 1 then the floating point formatter reserves the highest value
319 of exponent for NaN to be compatible to the IEEE754 specification.
320 Clearing this parameter increases the range of the exponent by one.*/
321 uint8_t expBits; /*!<These parameter is used to indicate the number of exponent bits in the floating point number
322 according to the following settings:
323 expBits| Round type
324 --------|------------------------------------------------
325 0 | 2 bit exponent, 13 bit significand, 1 bit sign
326 1 | 3 bit exponent, 12 bit significand, 1 bit sign
327 2 | 4 bit exponent, 11 bit significand, 1 bit sign
328 3 | 5 bit exponent, 10 bit significand, 1 bit sign */
329 uint8_t leading; /*!< Setting this parameter hides the leading one in the the significand to be compatible to the IEEE754 specification.
330 Clearing this parameter causes the leading one to be at the MSB of the significand.*/
331 }mykonosFloatPntFrmt_t;
332
333 /**
334 * \brief Data structure used to configure the on-die Temperature Sensor
335 */
336 typedef struct
337 {
338 uint8_t tempDecimation; /*!<3-bit value that controls the AuxADC decimation factor when used for temp sensor calculations;
339 AuxADC_decimation = 256 * 2^tempDecimation */
340 uint8_t offset; /*!< 8-bit offset that gets added to temp sensor code internally */
341 uint8_t overrideFusedOffset; /*!< This bit overrides the factory-calibrated fuse offset
342 and uses the value stored in the offset member */
343 uint8_t tempWindow; /*!< 4-bit code with a resolution of 1?C/LSB, each time a temperature measurement is performed,
344 the device compares the current temperature against the previous value.*/
345 }mykonosTempSensorConfig_t;
346
347
348 /**
349 * \brief Data structure used to store Temperature Sensor related values
350 */
351 typedef struct
352 {
353 int16_t tempCode; /*!< 16-bit signed temperature value (in deg C) that is read back */
354 uint8_t windowExceeded; /*!< If the absolute value of the difference is greater than the value in temperature configuration
355 tempWindow, the windowExceeded flag is set.*/
356 uint8_t windowHiLo; /*!<when windowExceeded member gets set,
357 this bit is set to 1 if current value is greater than previous value, else reset */
358 uint8_t tempValid; /*!< When the reading is complete and a valid temperature value stored in tempCode*/
359 }mykonosTempSensorStatus_t;
360
361
362 #ifdef __cplusplus
363 }
364 #endif
365
366 #endif /* T_MYKONOSGPIO_H_ */