this is testing

Committer:
pmallick
Date:
Thu Jan 14 18:54:16 2021 +0530
Revision:
0:3afcd581558d
this is testing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pmallick 0:3afcd581558d 1 /***************************************************************************//**
pmallick 0:3afcd581558d 2 * @file iio_ad7606_attr.h
pmallick 0:3afcd581558d 3 * @brief File for AD7606 IIO Attributes
pmallick 0:3afcd581558d 4 ********************************************************************************
pmallick 0:3afcd581558d 5 * Copyright (c) 2020 Analog Devices, Inc.
pmallick 0:3afcd581558d 6 *
pmallick 0:3afcd581558d 7 * All rights reserved.
pmallick 0:3afcd581558d 8 * This software is proprietary to Analog Devices, Inc. and its licensors.
pmallick 0:3afcd581558d 9 * By using this software you agree to the terms of the associated
pmallick 0:3afcd581558d 10 * Analog Devices Software License Agreement.
pmallick 0:3afcd581558d 11 *******************************************************************************/
pmallick 0:3afcd581558d 12 #ifndef IIO_AD7606_ATTR_H_
pmallick 0:3afcd581558d 13 #define IIO_AD7606_ATTR_H_
pmallick 0:3afcd581558d 14
pmallick 0:3afcd581558d 15 /******************************************************************************/
pmallick 0:3afcd581558d 16 /***************************** Include Files **********************************/
pmallick 0:3afcd581558d 17 /******************************************************************************/
pmallick 0:3afcd581558d 18
pmallick 0:3afcd581558d 19 #include <stdio.h>
pmallick 0:3afcd581558d 20 #include <stdbool.h>
pmallick 0:3afcd581558d 21
pmallick 0:3afcd581558d 22 #include "app_config.h"
pmallick 0:3afcd581558d 23 #include "iio.h"
pmallick 0:3afcd581558d 24 #include "iio_types.h"
pmallick 0:3afcd581558d 25
pmallick 0:3afcd581558d 26 /******************************************************************************/
pmallick 0:3afcd581558d 27 /****************************** Macros ****************************************/
pmallick 0:3afcd581558d 28 /******************************************************************************/
pmallick 0:3afcd581558d 29
pmallick 0:3afcd581558d 30 extern ssize_t get_chn_scale(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 31 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 32 extern ssize_t set_chn_scale(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 33 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 34
pmallick 0:3afcd581558d 35 extern ssize_t get_chn_range(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 36 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 37 extern ssize_t set_chn_range(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 38 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 39
pmallick 0:3afcd581558d 40 extern ssize_t get_chn_gain(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 41 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 42 extern ssize_t set_chn_gain(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 43 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 44
pmallick 0:3afcd581558d 45 extern ssize_t get_chn_offset(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 46 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 47 extern ssize_t set_chn_offset(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 48 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 49
pmallick 0:3afcd581558d 50 extern ssize_t get_chn_phase_offset(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 51 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 52 extern ssize_t set_chn_phase_offset(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 53 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 54
pmallick 0:3afcd581558d 55 extern ssize_t get_chn_temperature(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 56 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 57 extern ssize_t set_chn_temperature(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 58 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 59
pmallick 0:3afcd581558d 60 extern ssize_t get_chn_vref(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 61 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 62 extern ssize_t set_chn_vref(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 63 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 64
pmallick 0:3afcd581558d 65 extern ssize_t get_chn_vdrive(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 66 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 67 extern ssize_t set_chn_vdrive(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 68 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 69
pmallick 0:3afcd581558d 70 extern ssize_t get_chn_aldo(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 71 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 72 extern ssize_t set_chn_aldo(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 73 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 74
pmallick 0:3afcd581558d 75 extern ssize_t get_chn_dldo(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 76 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 77 extern ssize_t set_chn_dldo(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 78 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 79
pmallick 0:3afcd581558d 80 extern ssize_t get_bandwidth(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 81 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 82 extern ssize_t set_bandwidth(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 83 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 84
pmallick 0:3afcd581558d 85 extern ssize_t get_chn_open_wire_detect(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 86 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 87 extern ssize_t set_chn_open_wire_detect(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 88 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 89
pmallick 0:3afcd581558d 90 extern ssize_t get_chn_calibrate_adc(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 91 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 92 extern ssize_t set_chn_calibrate_adc(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 93 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 94
pmallick 0:3afcd581558d 95 extern ssize_t get_chn_raw(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 96 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 97 extern ssize_t set_chn_raw(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 98 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 99
pmallick 0:3afcd581558d 100 extern ssize_t get_operating_mode(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 101 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 102 extern ssize_t set_operating_mode(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 103 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 104
pmallick 0:3afcd581558d 105 extern ssize_t get_power_down_mode(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 106 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 107 extern ssize_t set_power_down_mode(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 108 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 109
pmallick 0:3afcd581558d 110 extern ssize_t get_range(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 111 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 112 extern ssize_t set_range(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 113 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 114
pmallick 0:3afcd581558d 115 extern ssize_t get_oversampling(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 116 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 117 extern ssize_t set_oversampling(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 118 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 119
pmallick 0:3afcd581558d 120 extern ssize_t get_direct_reg_access(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 121 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 122 extern ssize_t set_direct_reg_access(void *device, char *buf, size_t len,
pmallick 0:3afcd581558d 123 const struct iio_ch_info *channel);
pmallick 0:3afcd581558d 124
pmallick 0:3afcd581558d 125 /******************************************************************************/
pmallick 0:3afcd581558d 126 /*************************** Types Declarations *******************************/
pmallick 0:3afcd581558d 127 /******************************************************************************/
pmallick 0:3afcd581558d 128
pmallick 0:3afcd581558d 129 // XML describes the IIO context hierarchy for AD7606 family devices
pmallick 0:3afcd581558d 130 static const char * const ad7606_phy_xml =
pmallick 0:3afcd581558d 131 #if defined(DEV_AD7605_4)
pmallick 0:3afcd581558d 132 "<device id=\"AD7605-4-phy\" name=\"ID_AD7605-4-phy\" >"
pmallick 0:3afcd581558d 133 #elif defined(DEV_AD7606_4)
pmallick 0:3afcd581558d 134 "<device id=\"AD7606-4-phy\" name=\"AD7606-4-phy\" >"
pmallick 0:3afcd581558d 135 #elif defined(DEV_AD7606_6)
pmallick 0:3afcd581558d 136 "<device id=\"AD7606-6-phy\" name=\"AD7606-6-phy\" >"
pmallick 0:3afcd581558d 137 #elif defined(DEV_AD7606_8)
pmallick 0:3afcd581558d 138 "<device id=\"AD7606-8-phy\" name=\"AD7606-8-phy\" >"
pmallick 0:3afcd581558d 139 #elif defined(DEV_AD7606B)
pmallick 0:3afcd581558d 140 "<device id=\"AD7606B-phy\" name=\"AD7606B-phy\" >"
pmallick 0:3afcd581558d 141 #elif defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 142 "<device id=\"AD7606C-phy\" name=\"AD7606C-16-phy\" >"
pmallick 0:3afcd581558d 143 #elif defined(DEV_AD7606C_18)
pmallick 0:3afcd581558d 144 "<device id=\"AD7606C-phy\" name=\"AD7606C-18-phy\" >"
pmallick 0:3afcd581558d 145 #elif defined(DEV_AD7608)
pmallick 0:3afcd581558d 146 "<device id=\"AD7608-phy\" name=\"AD7608-phy\" >"
pmallick 0:3afcd581558d 147 #elif defined(DEV_AD7609)
pmallick 0:3afcd581558d 148 "<device id=\"AD7609-phy\" name=\"AD7609-phy\" >"
pmallick 0:3afcd581558d 149 #else
pmallick 0:3afcd581558d 150 #endif
pmallick 0:3afcd581558d 151 "<channel id=\"voltage1\" type=\"input\" >"
pmallick 0:3afcd581558d 152 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 153 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"0\" />"
pmallick 0:3afcd581558d 154 #else
pmallick 0:3afcd581558d 155 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"0\" />"
pmallick 0:3afcd581558d 156 #endif
pmallick 0:3afcd581558d 157 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 158 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 159 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 160 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 161 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 162 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 163 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 164 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 165 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 166 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 167 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 168 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 169 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 170 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 171 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 172 #endif
pmallick 0:3afcd581558d 173 #endif
pmallick 0:3afcd581558d 174 "</channel>"
pmallick 0:3afcd581558d 175 "<channel id=\"voltage2\" type=\"input\" >"
pmallick 0:3afcd581558d 176 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 177 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"1\" />"
pmallick 0:3afcd581558d 178 #else
pmallick 0:3afcd581558d 179 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"1\" />"
pmallick 0:3afcd581558d 180 #endif
pmallick 0:3afcd581558d 181 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 182 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 183 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 184 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 185 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 186 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 187 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 188 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 189 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 190 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 191 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 192 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 193 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 194 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 195 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 196 #endif
pmallick 0:3afcd581558d 197 #endif
pmallick 0:3afcd581558d 198 "</channel>"
pmallick 0:3afcd581558d 199 "<channel id=\"voltage3\" type=\"input\" >"
pmallick 0:3afcd581558d 200 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 201 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"2\" />"
pmallick 0:3afcd581558d 202 #else
pmallick 0:3afcd581558d 203 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"2\" />"
pmallick 0:3afcd581558d 204 #endif
pmallick 0:3afcd581558d 205 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 206 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 207 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 208 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 209 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 210 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 211 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 212 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 213 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 214 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 215 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 216 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 217 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 218 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 219 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 220 #endif
pmallick 0:3afcd581558d 221 #endif
pmallick 0:3afcd581558d 222 "</channel>"
pmallick 0:3afcd581558d 223 "<channel id=\"voltage4\" type=\"input\" >"
pmallick 0:3afcd581558d 224 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 225 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"3\" />"
pmallick 0:3afcd581558d 226 #else
pmallick 0:3afcd581558d 227 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"3\" />"
pmallick 0:3afcd581558d 228 #endif
pmallick 0:3afcd581558d 229 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 230 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 231 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 232 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 233 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 234 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 235 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 236 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 237 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 238 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 239 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 240 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 241 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 242 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 243 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 244 #endif
pmallick 0:3afcd581558d 245 #endif
pmallick 0:3afcd581558d 246 "</channel>"
pmallick 0:3afcd581558d 247 #if (NO_OF_CHANNELS > 4)
pmallick 0:3afcd581558d 248 "<channel id=\"voltage5\" type=\"input\" >"
pmallick 0:3afcd581558d 249 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 250 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"4\" />"
pmallick 0:3afcd581558d 251 #else
pmallick 0:3afcd581558d 252 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"4\" />"
pmallick 0:3afcd581558d 253 #endif
pmallick 0:3afcd581558d 254 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 255 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 256 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 257 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 258 "<attribute name=\"chn_oversampling\" />"
pmallick 0:3afcd581558d 259 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 260 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 261 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 262 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 263 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 264 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 265 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 266 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 267 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 268 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 269 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 270 #endif
pmallick 0:3afcd581558d 271 #endif
pmallick 0:3afcd581558d 272 "</channel>"
pmallick 0:3afcd581558d 273 "<channel id=\"voltage6\" type=\"input\" >"
pmallick 0:3afcd581558d 274 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 275 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"5\" />"
pmallick 0:3afcd581558d 276 #else
pmallick 0:3afcd581558d 277 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"5\" />"
pmallick 0:3afcd581558d 278 #endif
pmallick 0:3afcd581558d 279 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 280 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 281 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 282 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 283 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 284 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 285 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 286 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 287 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 288 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 289 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 290 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 291 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 292 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 293 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 294 #endif
pmallick 0:3afcd581558d 295 #endif
pmallick 0:3afcd581558d 296 "</channel>"
pmallick 0:3afcd581558d 297 #endif
pmallick 0:3afcd581558d 298 #if (NO_OF_CHANNELS > 6)
pmallick 0:3afcd581558d 299 "<channel id=\"voltage7\" type=\"input\" >"
pmallick 0:3afcd581558d 300 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 301 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"6\" />"
pmallick 0:3afcd581558d 302 #else
pmallick 0:3afcd581558d 303 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"6\" />"
pmallick 0:3afcd581558d 304 #endif
pmallick 0:3afcd581558d 305 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 306 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 307 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 308 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 309 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 310 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 311 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 312 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 313 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 314 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 315 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 316 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 317 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 318 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 319 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 320 #endif
pmallick 0:3afcd581558d 321 #endif
pmallick 0:3afcd581558d 322 "</channel>"
pmallick 0:3afcd581558d 323 "<channel id=\"voltage8\" type=\"input\" >"
pmallick 0:3afcd581558d 324 #if (ADC_RESOLUTION > 16)
pmallick 0:3afcd581558d 325 "<scan-element scale=\"0.1525\" format=\"le:s18/18>>0\" index =\"7\" />"
pmallick 0:3afcd581558d 326 #else
pmallick 0:3afcd581558d 327 "<scan-element scale=\"0.1525\" format=\"le:s16/16>>0\" index =\"7\" />"
pmallick 0:3afcd581558d 328 #endif
pmallick 0:3afcd581558d 329 "<attribute name=\"raw\" />"
pmallick 0:3afcd581558d 330 "<attribute name=\"scale\" />"
pmallick 0:3afcd581558d 331 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 332 "<attribute name=\"chn_range\" />"
pmallick 0:3afcd581558d 333 "<attribute name=\"chn_gain\" />"
pmallick 0:3afcd581558d 334 "<attribute name=\"chn_offset\" />"
pmallick 0:3afcd581558d 335 "<attribute name=\"Temperature\" />"
pmallick 0:3afcd581558d 336 "<attribute name=\"Vref\" />"
pmallick 0:3afcd581558d 337 "<attribute name=\"Vdrive\" />"
pmallick 0:3afcd581558d 338 "<attribute name=\"ALDO\" />"
pmallick 0:3afcd581558d 339 "<attribute name=\"DLDO\" />"
pmallick 0:3afcd581558d 340 "<attribute name=\"perform_open_wire_detect\" />"
pmallick 0:3afcd581558d 341 "<attribute name=\"do_calibration_(Vin_must_be_0)\" />"
pmallick 0:3afcd581558d 342 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 343 "<attribute name=\"bandwidth\" />"
pmallick 0:3afcd581558d 344 #endif
pmallick 0:3afcd581558d 345 #endif
pmallick 0:3afcd581558d 346 "</channel>"
pmallick 0:3afcd581558d 347 #endif
pmallick 0:3afcd581558d 348 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 349 "<attribute name=\"operating_mode\" />"
pmallick 0:3afcd581558d 350 "<attribute name=\"oversampling\" />"
pmallick 0:3afcd581558d 351 "<debug-attribute name =\"direct_reg_access\" />"
pmallick 0:3afcd581558d 352 #else
pmallick 0:3afcd581558d 353 "<attribute name=\"power_down_mode\" />"
pmallick 0:3afcd581558d 354 "<attribute name=\"range\" />"
pmallick 0:3afcd581558d 355 #endif
pmallick 0:3afcd581558d 356 "</device>";
pmallick 0:3afcd581558d 357
pmallick 0:3afcd581558d 358
pmallick 0:3afcd581558d 359 /* Channels IIO attribute structures */
pmallick 0:3afcd581558d 360
pmallick 0:3afcd581558d 361 static struct iio_attribute iio_attr_chn_scale = {
pmallick 0:3afcd581558d 362 .name = "scale",
pmallick 0:3afcd581558d 363 .show = get_chn_scale,
pmallick 0:3afcd581558d 364 .store = set_chn_scale,
pmallick 0:3afcd581558d 365 };
pmallick 0:3afcd581558d 366
pmallick 0:3afcd581558d 367 static struct iio_attribute iio_attr_chn_raw = {
pmallick 0:3afcd581558d 368 .name = "raw",
pmallick 0:3afcd581558d 369 .show = get_chn_raw,
pmallick 0:3afcd581558d 370 .store = set_chn_raw,
pmallick 0:3afcd581558d 371 };
pmallick 0:3afcd581558d 372
pmallick 0:3afcd581558d 373 static struct iio_attribute iio_attr_chn_range = {
pmallick 0:3afcd581558d 374 .name = "chn_range",
pmallick 0:3afcd581558d 375 .show = get_chn_range,
pmallick 0:3afcd581558d 376 .store = set_chn_range,
pmallick 0:3afcd581558d 377 };
pmallick 0:3afcd581558d 378
pmallick 0:3afcd581558d 379 static struct iio_attribute iio_attr_chn_gain = {
pmallick 0:3afcd581558d 380 .name = "chn_gain",
pmallick 0:3afcd581558d 381 .show = get_chn_gain,
pmallick 0:3afcd581558d 382 .store = set_chn_gain,
pmallick 0:3afcd581558d 383 };
pmallick 0:3afcd581558d 384
pmallick 0:3afcd581558d 385 static struct iio_attribute iio_attr_chn_offset = {
pmallick 0:3afcd581558d 386 .name = "chn_offset",
pmallick 0:3afcd581558d 387 .show = get_chn_offset,
pmallick 0:3afcd581558d 388 .store = set_chn_offset,
pmallick 0:3afcd581558d 389 };
pmallick 0:3afcd581558d 390
pmallick 0:3afcd581558d 391 static struct iio_attribute iio_attr_chn_phase_offset = {
pmallick 0:3afcd581558d 392 .name = "chn_phase offset",
pmallick 0:3afcd581558d 393 .show = get_chn_phase_offset,
pmallick 0:3afcd581558d 394 .store = set_chn_phase_offset,
pmallick 0:3afcd581558d 395 };
pmallick 0:3afcd581558d 396
pmallick 0:3afcd581558d 397 static struct iio_attribute iio_attr_chn_temperature = {
pmallick 0:3afcd581558d 398 .name = "Temperature",
pmallick 0:3afcd581558d 399 .show = get_chn_temperature,
pmallick 0:3afcd581558d 400 .store = set_chn_temperature,
pmallick 0:3afcd581558d 401 };
pmallick 0:3afcd581558d 402
pmallick 0:3afcd581558d 403 static struct iio_attribute iio_attr_chn_vref = {
pmallick 0:3afcd581558d 404 .name = "Vref",
pmallick 0:3afcd581558d 405 .show = get_chn_vref,
pmallick 0:3afcd581558d 406 .store = set_chn_vref,
pmallick 0:3afcd581558d 407 };
pmallick 0:3afcd581558d 408
pmallick 0:3afcd581558d 409 static struct iio_attribute iio_attr_chn_vdrive = {
pmallick 0:3afcd581558d 410 .name = "Vdrive",
pmallick 0:3afcd581558d 411 .show = get_chn_vdrive,
pmallick 0:3afcd581558d 412 .store = set_chn_vdrive,
pmallick 0:3afcd581558d 413 };
pmallick 0:3afcd581558d 414
pmallick 0:3afcd581558d 415 static struct iio_attribute iio_attr_chn_aldo = {
pmallick 0:3afcd581558d 416 .name = "ALDO",
pmallick 0:3afcd581558d 417 .show = get_chn_aldo,
pmallick 0:3afcd581558d 418 .store = set_chn_aldo,
pmallick 0:3afcd581558d 419 };
pmallick 0:3afcd581558d 420
pmallick 0:3afcd581558d 421 static struct iio_attribute iio_attr_chn_dldo = {
pmallick 0:3afcd581558d 422 .name = "DLDO",
pmallick 0:3afcd581558d 423 .show = get_chn_dldo,
pmallick 0:3afcd581558d 424 .store = set_chn_dldo,
pmallick 0:3afcd581558d 425 };
pmallick 0:3afcd581558d 426
pmallick 0:3afcd581558d 427 static struct iio_attribute iio_attr_bandwidth = {
pmallick 0:3afcd581558d 428 .name = "bandwidth",
pmallick 0:3afcd581558d 429 .show = get_bandwidth,
pmallick 0:3afcd581558d 430 .store = set_bandwidth,
pmallick 0:3afcd581558d 431 };
pmallick 0:3afcd581558d 432
pmallick 0:3afcd581558d 433 static struct iio_attribute iio_attr_chn_open_wire_detect = {
pmallick 0:3afcd581558d 434 .name = "perform_open_wire_detect",
pmallick 0:3afcd581558d 435 .show = get_chn_open_wire_detect,
pmallick 0:3afcd581558d 436 .store = set_chn_open_wire_detect,
pmallick 0:3afcd581558d 437 };
pmallick 0:3afcd581558d 438
pmallick 0:3afcd581558d 439 static struct iio_attribute iio_attr_calibrate_adc= {
pmallick 0:3afcd581558d 440 .name = "do_calibration_(Vin_must_be_0)",
pmallick 0:3afcd581558d 441 .show = get_chn_calibrate_adc,
pmallick 0:3afcd581558d 442 .store = set_chn_calibrate_adc,
pmallick 0:3afcd581558d 443 };
pmallick 0:3afcd581558d 444
pmallick 0:3afcd581558d 445
pmallick 0:3afcd581558d 446 struct iio_attribute *channel_input_attributes[] = {
pmallick 0:3afcd581558d 447 &iio_attr_chn_raw,
pmallick 0:3afcd581558d 448 &iio_attr_chn_scale,
pmallick 0:3afcd581558d 449 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 450 &iio_attr_chn_range,
pmallick 0:3afcd581558d 451 &iio_attr_chn_gain,
pmallick 0:3afcd581558d 452 &iio_attr_chn_offset,
pmallick 0:3afcd581558d 453 &iio_attr_chn_phase_offset,
pmallick 0:3afcd581558d 454 &iio_attr_chn_temperature,
pmallick 0:3afcd581558d 455 &iio_attr_chn_vref,
pmallick 0:3afcd581558d 456 &iio_attr_chn_vdrive,
pmallick 0:3afcd581558d 457 &iio_attr_chn_aldo,
pmallick 0:3afcd581558d 458 &iio_attr_chn_dldo,
pmallick 0:3afcd581558d 459 &iio_attr_chn_open_wire_detect,
pmallick 0:3afcd581558d 460 &iio_attr_calibrate_adc,
pmallick 0:3afcd581558d 461 #if defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 462 &iio_attr_bandwidth
pmallick 0:3afcd581558d 463 #endif
pmallick 0:3afcd581558d 464 #endif
pmallick 0:3afcd581558d 465 };
pmallick 0:3afcd581558d 466
pmallick 0:3afcd581558d 467
pmallick 0:3afcd581558d 468 /* Device IIO attribute structures */
pmallick 0:3afcd581558d 469
pmallick 0:3afcd581558d 470 static struct iio_attribute iio_attr_operating_mode = {
pmallick 0:3afcd581558d 471 .name = "operating_mode",
pmallick 0:3afcd581558d 472 .show = get_operating_mode,
pmallick 0:3afcd581558d 473 .store = set_operating_mode,
pmallick 0:3afcd581558d 474 };
pmallick 0:3afcd581558d 475
pmallick 0:3afcd581558d 476 static struct iio_attribute iio_attr_power_down_mode = {
pmallick 0:3afcd581558d 477 .name = "power_down_mode",
pmallick 0:3afcd581558d 478 .show = get_power_down_mode,
pmallick 0:3afcd581558d 479 .store = set_power_down_mode,
pmallick 0:3afcd581558d 480 };
pmallick 0:3afcd581558d 481
pmallick 0:3afcd581558d 482 static struct iio_attribute iio_attr_range = {
pmallick 0:3afcd581558d 483 .name = "range",
pmallick 0:3afcd581558d 484 .show = get_range,
pmallick 0:3afcd581558d 485 .store = set_range,
pmallick 0:3afcd581558d 486 };
pmallick 0:3afcd581558d 487
pmallick 0:3afcd581558d 488 static struct iio_attribute iio_attr_oversampling = {
pmallick 0:3afcd581558d 489 .name = "oversampling",
pmallick 0:3afcd581558d 490 .show = get_oversampling,
pmallick 0:3afcd581558d 491 .store = set_oversampling,
pmallick 0:3afcd581558d 492 };
pmallick 0:3afcd581558d 493
pmallick 0:3afcd581558d 494 static struct iio_attribute iio_attr_direct_reg_access = {
pmallick 0:3afcd581558d 495 .name = "direct_reg_access",
pmallick 0:3afcd581558d 496 .show = get_direct_reg_access,
pmallick 0:3afcd581558d 497 .store = set_direct_reg_access,
pmallick 0:3afcd581558d 498 };
pmallick 0:3afcd581558d 499
pmallick 0:3afcd581558d 500 static struct iio_attribute *global_attributes[] = {
pmallick 0:3afcd581558d 501 #if defined(DEV_AD7606B) || defined(DEV_AD7606C_18) || defined(DEV_AD7606C_16)
pmallick 0:3afcd581558d 502 &iio_attr_operating_mode,
pmallick 0:3afcd581558d 503 &iio_attr_oversampling,
pmallick 0:3afcd581558d 504 &iio_attr_direct_reg_access,
pmallick 0:3afcd581558d 505 #else
pmallick 0:3afcd581558d 506 &iio_attr_power_down_mode,
pmallick 0:3afcd581558d 507 &iio_attr_range,
pmallick 0:3afcd581558d 508 #endif
pmallick 0:3afcd581558d 509 };
pmallick 0:3afcd581558d 510
pmallick 0:3afcd581558d 511
pmallick 0:3afcd581558d 512 static struct iio_channel iio_channel_ch1_in = {
pmallick 0:3afcd581558d 513 .name = "voltage1",
pmallick 0:3afcd581558d 514 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 515 .ch_out = false,
pmallick 0:3afcd581558d 516 };
pmallick 0:3afcd581558d 517
pmallick 0:3afcd581558d 518 static struct iio_channel iio_channel_ch2_in = {
pmallick 0:3afcd581558d 519 .name = "voltage2",
pmallick 0:3afcd581558d 520 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 521 .ch_out = false,
pmallick 0:3afcd581558d 522 };
pmallick 0:3afcd581558d 523
pmallick 0:3afcd581558d 524 static struct iio_channel iio_channel_ch3_in = {
pmallick 0:3afcd581558d 525 .name = "voltage3",
pmallick 0:3afcd581558d 526 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 527 .ch_out = false,
pmallick 0:3afcd581558d 528 };
pmallick 0:3afcd581558d 529
pmallick 0:3afcd581558d 530 static struct iio_channel iio_channel_ch4_in = {
pmallick 0:3afcd581558d 531 .name = "voltage4",
pmallick 0:3afcd581558d 532 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 533 .ch_out = false,
pmallick 0:3afcd581558d 534 };
pmallick 0:3afcd581558d 535
pmallick 0:3afcd581558d 536 static struct iio_channel iio_channel_ch5_in = {
pmallick 0:3afcd581558d 537 .name = "voltage5",
pmallick 0:3afcd581558d 538 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 539 .ch_out = false,
pmallick 0:3afcd581558d 540 };
pmallick 0:3afcd581558d 541
pmallick 0:3afcd581558d 542 static struct iio_channel iio_channel_ch6_in = {
pmallick 0:3afcd581558d 543 .name = "voltage6",
pmallick 0:3afcd581558d 544 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 545 .ch_out = false,
pmallick 0:3afcd581558d 546 };
pmallick 0:3afcd581558d 547
pmallick 0:3afcd581558d 548 static struct iio_channel iio_channel_ch7_in = {
pmallick 0:3afcd581558d 549 .name = "voltage7",
pmallick 0:3afcd581558d 550 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 551 .ch_out = false,
pmallick 0:3afcd581558d 552 };
pmallick 0:3afcd581558d 553
pmallick 0:3afcd581558d 554 static struct iio_channel iio_channel_ch8_in = {
pmallick 0:3afcd581558d 555 .name = "voltage8",
pmallick 0:3afcd581558d 556 .attributes = channel_input_attributes,
pmallick 0:3afcd581558d 557 .ch_out = false,
pmallick 0:3afcd581558d 558 };
pmallick 0:3afcd581558d 559
pmallick 0:3afcd581558d 560
pmallick 0:3afcd581558d 561 static struct iio_channel *iio_ad7606_channels[] = {
pmallick 0:3afcd581558d 562 &iio_channel_ch1_in,
pmallick 0:3afcd581558d 563 &iio_channel_ch2_in,
pmallick 0:3afcd581558d 564 &iio_channel_ch3_in,
pmallick 0:3afcd581558d 565 &iio_channel_ch4_in,
pmallick 0:3afcd581558d 566 #if (NO_OF_CHANNELS > 4)
pmallick 0:3afcd581558d 567 &iio_channel_ch5_in,
pmallick 0:3afcd581558d 568 &iio_channel_ch6_in,
pmallick 0:3afcd581558d 569 #endif
pmallick 0:3afcd581558d 570 #if (NO_OF_CHANNELS > 6)
pmallick 0:3afcd581558d 571 &iio_channel_ch7_in,
pmallick 0:3afcd581558d 572 &iio_channel_ch8_in,
pmallick 0:3afcd581558d 573 #endif
pmallick 0:3afcd581558d 574 };
pmallick 0:3afcd581558d 575
pmallick 0:3afcd581558d 576 /******************************************************************************/
pmallick 0:3afcd581558d 577 /************************ Functions Declarations ******************************/
pmallick 0:3afcd581558d 578 /******************************************************************************/
pmallick 0:3afcd581558d 579
pmallick 0:3afcd581558d 580 #endif /* IIO_AD7606_ATTR_H_ */