Analog Devices AD7124-8 - 8-Channel, Low Noise, Low Power, 24-Bit, Sigma-Delta ADC with PGA and Reference

Dependents:   CN0398 CN0391 CN0398_arduino

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AD7124.h Source File

AD7124.h

Go to the documentation of this file.
00001 /**
00002 *   @file     AD7124.h
00003 *   @brief    Header file for AD7790 ADC
00004 *   @author   Analog Devices Inc.
00005 *
00006 * For support please go to:
00007 * Github: https://github.com/analogdevicesinc/mbed-adi
00008 * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
00009 * Product: http://www.analog.com/AD7124
00010 * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
00011 
00012 ********************************************************************************
00013 * Copyright 2016(c) Analog Devices, Inc.
00014 *
00015 * All rights reserved.
00016 *
00017 * Redistribution and use in source and binary forms, with or without
00018 * modification, are permitted provided that the following conditions are met:
00019 *  - Redistributions of source code must retain the above copyright
00020 *    notice, this list of conditions and the following disclaimer.
00021 *  - Redistributions in binary form must reproduce the above copyright
00022 *    notice, this list of conditions and the following disclaimer in
00023 *    the documentation and/or other materials provided with the
00024 *    distribution.
00025 *  - Neither the name of Analog Devices, Inc. nor the names of its
00026 *    contributors may be used to endorse or promote products derived
00027 *    from this software without specific prior written permission.
00028 *  - The use of this software may or may not infringe the patent rights
00029 *    of one or more patent holders.  This license does not release you
00030 *    from the requirement that you obtain separate licenses from these
00031 *    patent holders to use this software.
00032 *  - Use of the software either in source or binary form, must be run
00033 *    on or directly connected to an Analog Devices Inc. component.
00034 *
00035 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
00036 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
00037 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00038 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
00039 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00040 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
00041 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00042 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00043 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00044 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00045 *
00046 ********************************************************************************/
00047 
00048 #ifndef AD7790_H
00049 #define AD7790_H
00050 
00051 #include "mbed.h"
00052 
00053 /**
00054  * Comment this line if you want to turn off the debug mode.
00055  * The debug mode will send a message if an exception occurs within AD7790 driver
00056  */
00057 
00058 #define AD7124_DEBUG_MODE
00059 
00060 /**
00061  * @brief Analog Devices AD7790 SPI 16-bit Buffered Sigma-Delta ADC
00062  */
00063  
00064 
00065 class AD7124
00066 {
00067 public:
00068     enum ad7124_registers {
00069         AD7124_Status = 0x00,
00070         AD7124_ADC_Control,
00071         AD7124_Data,
00072         AD7124_IOCon1,
00073         AD7124_IOCon2,
00074         AD7124_ID,
00075         AD7124_Error,
00076         AD7124_Error_En,
00077         AD7124_Mclk_Count,
00078         AD7124_Channel_0,
00079         AD7124_Channel_1,
00080         AD7124_Channel_2,
00081         AD7124_Channel_3,
00082         AD7124_Channel_4,
00083         AD7124_Channel_5,
00084         AD7124_Channel_6,
00085         AD7124_Channel_7,
00086         AD7124_Channel_8,
00087         AD7124_Channel_9,
00088         AD7124_Channel_10,
00089         AD7124_Channel_11,
00090         AD7124_Channel_12,
00091         AD7124_Channel_13,
00092         AD7124_Channel_14,
00093         AD7124_Channel_15,
00094         AD7124_Config_0,
00095         AD7124_Config_1,
00096         AD7124_Config_2,
00097         AD7124_Config_3,
00098         AD7124_Config_4,
00099         AD7124_Config_5,
00100         AD7124_Config_6,
00101         AD7124_Config_7,
00102         AD7124_Filter_0,
00103         AD7124_Filter_1,
00104         AD7124_Filter_2,
00105         AD7124_Filter_3,
00106         AD7124_Filter_4,
00107         AD7124_Filter_5,
00108         AD7124_Filter_6,
00109         AD7124_Filter_7,
00110         AD7124_Offset_0,
00111         AD7124_Offset_1,
00112         AD7124_Offset_2,
00113         AD7124_Offset_3,
00114         AD7124_Offset_4,
00115         AD7124_Offset_5,
00116         AD7124_Offset_6,
00117         AD7124_Offset_7,
00118         AD7124_Gain_0,
00119         AD7124_Gain_1,
00120         AD7124_Gain_2,
00121         AD7124_Gain_3,
00122         AD7124_Gain_4,
00123         AD7124_Gain_5,
00124         AD7124_Gain_6,
00125         AD7124_Gain_7,
00126         AD7124_REG_NO
00127     };
00128     
00129     /*! Device register info */
00130 
00131 
00132     typedef struct _ad7124_st_reg  {
00133         int32_t addr;
00134         int32_t value;
00135         int32_t size;
00136         int32_t rw;
00137     } ad7124_st_reg ;
00138     /*! Array holding the info for the ad7124 registers - address, initial value,
00139     size and access type. */
00140     ad7124_st_reg  ad7124_regs [57];
00141     
00142 private:
00143     enum {
00144         AD7124_RW = 1,   /* Read and Write */
00145         AD7124_R  = 2,   /* Read only */
00146         AD7124_W  = 3,   /* Write only */
00147     } ad7124_reg_access;
00148 
00149 
00150 
00151 
00152     /* AD7124 Register Map */
00153     enum AD7124_reg_map  {
00154         COMM_REG     = 0x00,
00155         STATUS_REG   = 0x00,
00156         ADC_CTRL_REG = 0x01,
00157         DATA_REG     = 0x02,
00158         IO_CTRL1_REG = 0x03,
00159         IO_CTRL2_REG = 0x04,
00160         ID_REG       = 0x05,
00161         ERR_REG      = 0x06,
00162         ERREN_REG    = 0x07,
00163         CH0_MAP_REG  = 0x09,
00164         CH1_MAP_REG  = 0x0A,
00165         CH2_MAP_REG  = 0x0B,
00166         CH3_MAP_REG  = 0x0C,
00167         CH4_MAP_REG  = 0x0D,
00168         CH5_MAP_REG  = 0x0E,
00169         CH6_MAP_REG  = 0x0F,
00170         CH7_MAP_REG  = 0x10,
00171         CH8_MAP_REG  = 0x11,
00172         CH9_MAP_REG  = 0x12,
00173         CH10_MAP_REG = 0x13,
00174         CH11_MAP_REG = 0x14,
00175         CH12_MAP_REG = 0x15,
00176         CH13_MAP_REG = 0x16,
00177         CH14_MAP_REG = 0x17,
00178         CH15_MAP_REG = 0x18,
00179         CFG0_REG     = 0x19,
00180         CFG1_REG     = 0x1A,
00181         CFG2_REG     = 0x1B,
00182         CFG3_REG     = 0x1C,
00183         CFG4_REG     = 0x1D,
00184         CFG5_REG     = 0x1E,
00185         CFG6_REG     = 0x1F,
00186         CFG7_REG     = 0x20,
00187         FILT0_REG    = 0x21,
00188         FILT1_REG    = 0x22,
00189         FILT2_REG    = 0x23,
00190         FILT3_REG    = 0x24,
00191         FILT4_REG    = 0x25,
00192         FILT5_REG    = 0x26,
00193         FILT6_REG    = 0x27,
00194         FILT7_REG    = 0x28,
00195         OFFS0_REG    = 0x29,
00196         OFFS1_REG    = 0x2A,
00197         OFFS2_REG    = 0x2B,
00198         OFFS3_REG    = 0x2C,
00199         OFFS4_REG    = 0x2D,
00200         OFFS5_REG    = 0x2E,
00201         OFFS6_REG    = 0x2F,
00202         OFFS7_REG    = 0x30,
00203         GAIN0_REG    = 0x31,
00204         GAIN1_REG    = 0x32,
00205         GAIN2_REG    = 0x33,
00206         GAIN3_REG    = 0x34,
00207         GAIN4_REG    = 0x35,
00208         GAIN5_REG    = 0x36,
00209         GAIN6_REG    = 0x37,
00210         GAIN7_REG    = 0x38,
00211     };
00212 
00213     /* Communication Register bits */
00214 #define AD7124_COMM_REG_WEN    (0 << 7)
00215 #define AD7124_COMM_REG_WR     (0 << 6)
00216 #define AD7124_COMM_REG_RD     (1 << 6)
00217 #define AD7124_COMM_REG_RA(x)  ((x) & 0x3F)
00218 
00219     /* Status Register bits */
00220 #define AD7124_STATUS_REG_RDY          (1 << 7)
00221 #define AD7124_STATUS_REG_ERROR_FLAG   (1 << 6)
00222 #define AD7124_STATUS_REG_POR_FLAG     (1 << 4)
00223 #define AD7124_STATUS_REG_CH_ACTIVE(x) ((x) & 0xF)
00224 
00225     /* ADC_Control Register bits */
00226 #define AD7124_ADC_CTRL_REG_DOUT_RDY_DEL   (1 << 12)
00227 #define AD7124_ADC_CTRL_REG_CONT_READ      (1 << 11)
00228 #define AD7124_ADC_CTRL_REG_DATA_STATUS    (1 << 10)
00229 #define AD7124_ADC_CTRL_REG_CS_EN          (1 << 9)
00230 #define AD7124_ADC_CTRL_REG_REF_EN         (1 << 8)
00231 #define AD7124_ADC_CTRL_REG_POWER_MODE(x)  (((x) & 0x3) << 6)
00232 #define AD7124_ADC_CTRL_REG_MODE(x)        (((x) & 0xF) << 2)
00233 #define AD7124_ADC_CTRL_REG_CLK_SEL(x)    (((x) & 0x3) << 0)
00234 
00235     /* IO_Control_1 Register bits */
00236 #define AD7124_IO_CTRL1_REG_GPIO_DAT2     (1 << 23)
00237 #define AD7124_IO_CTRL1_REG_GPIO_DAT1     (1 << 22)
00238 #define AD7124_IO_CTRL1_REG_GPIO_CTRL2    (1 << 19)
00239 #define AD7124_IO_CTRL1_REG_GPIO_CTRL1    (1 << 18)
00240 #define AD7124_IO_CTRL1_REG_PDSW          (1 << 15)
00241 #define AD7124_IO_CTRL1_REG_IOUT1(x)      (((x) & 0x7) << 11)
00242 #define AD7124_IO_CTRL1_REG_IOUT0(x)      (((x) & 0x7) << 8)
00243 #define AD7124_IO_CTRL1_REG_IOUT_CH1(x)   (((x) & 0xF) << 4)
00244 #define AD7124_IO_CTRL1_REG_IOUT_CH0(x)   (((x) & 0xF) << 0)
00245 
00246     /*IO_Control_1 AD7124-8 specific bits */
00247 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT4     (1 << 23)
00248 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT3     (1 << 22)
00249 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT2     (1 << 21)
00250 #define AD7124_8_IO_CTRL1_REG_GPIO_DAT1     (1 << 20)
00251 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL4    (1 << 19)
00252 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL3    (1 << 18)
00253 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL2    (1 << 17)
00254 #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL1    (1 << 16)
00255 
00256     /* IO_Control_2 Register bits */
00257 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS7   (1 << 15)
00258 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS6   (1 << 14)
00259 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS5   (1 << 11)
00260 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS4   (1 << 10)
00261 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS3   (1 << 5)
00262 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS2   (1 << 4)
00263 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS1   (1 << 1)
00264 #define AD7124_IO_CTRL2_REG_GPIO_VBIAS0   (1)
00265 
00266     /*IO_Control_2 AD7124-8 specific bits */
00267 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS15  (1 << 15)
00268 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS14  (1 << 14)
00269 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS13  (1 << 13)
00270 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS12  (1 << 12)
00271 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS11  (1 << 11)
00272 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS10  (1 << 10)
00273 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS9   (1 << 9)
00274 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS8   (1 << 8)
00275 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS7   (1 << 7)
00276 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS6   (1 << 6)
00277 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS5   (1 << 5)
00278 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS4   (1 << 4)
00279 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS3   (1 << 3)
00280 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS2   (1 << 2)
00281 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS1   (1 << 1)
00282 #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS0   (1 << 0)
00283 
00284     /* ID Register bits */
00285 #define AD7124_ID_REG_DEVICE_ID(x)   (((x) & 0xF) << 4)
00286 #define AD7124_ID_REG_SILICON_REV(x) (((x) & 0xF) << 0)
00287 
00288     /* Error Register bits */
00289 #define AD7124_ERR_REG_LDO_CAP_ERR        (1 << 19)
00290 #define AD7124_ERR_REG_ADC_CAL_ERR        (1 << 18)
00291 #define AD7124_ERR_REG_ADC_CONV_ERR       (1 << 17)
00292 #define AD7124_ERR_REG_ADC_SAT_ERR        (1 << 16)
00293 #define AD7124_ERR_REG_AINP_OV_ERR        (1 << 15)
00294 #define AD7124_ERR_REG_AINP_UV_ERR        (1 << 14)
00295 #define AD7124_ERR_REG_AINM_OV_ERR        (1 << 13)
00296 #define AD7124_ERR_REG_AINM_UV_ERR        (1 << 12)
00297 #define AD7124_ERR_REG_REF_DET_ERR        (1 << 11)
00298 #define AD7124_ERR_REG_DLDO_PSM_ERR       (1 << 9)
00299 #define AD7124_ERR_REG_ALDO_PSM_ERR       (1 << 7)
00300 #define AD7124_ERR_REG_SPI_IGNORE_ERR     (1 << 6)
00301 #define AD7124_ERR_REG_SPI_SLCK_CNT_ERR   (1 << 5)
00302 #define AD7124_ERR_REG_SPI_READ_ERR       (1 << 4)
00303 #define AD7124_ERR_REG_SPI_WRITE_ERR      (1 << 3)
00304 #define AD7124_ERR_REG_SPI_CRC_ERR        (1 << 2)
00305 #define AD7124_ERR_REG_MM_CRC_ERR         (1 << 1)
00306 
00307     /* Error_En Register bits */
00308 #define AD7124_ERREN_REG_MCLK_CNT_EN           (1 << 22)
00309 #define AD7124_ERREN_REG_LDO_CAP_CHK_TEST_EN   (1 << 21)
00310 #define AD7124_ERREN_REG_LDO_CAP_CHK(x)        (((x) & 0x3) << 19)
00311 #define AD7124_ERREN_REG_ADC_CAL_ERR_EN        (1 << 18)
00312 #define AD7124_ERREN_REG_ADC_CONV_ERR_EN       (1 << 17)
00313 #define AD7124_ERREN_REG_ADC_SAT_ERR_EN        (1 << 16)
00314 #define AD7124_ERREN_REG_AINP_OV_ERR_EN        (1 << 15)
00315 #define AD7124_ERREN_REG_AINP_UV_ERR_EN        (1 << 14)
00316 #define AD7124_ERREN_REG_AINM_OV_ERR_EN        (1 << 13)
00317 #define AD7124_ERREN_REG_AINM_UV_ERR_EN        (1 << 12)
00318 #define AD7124_ERREN_REG_REF_DET_ERR_EN        (1 << 11)
00319 #define AD7124_ERREN_REG_DLDO_PSM_TRIP_TEST_EN (1 << 10)
00320 #define AD7124_ERREN_REG_DLDO_PSM_ERR_ERR      (1 << 9)
00321 #define AD7124_ERREN_REG_ALDO_PSM_TRIP_TEST_EN (1 << 8)
00322 #define AD7124_ERREN_REG_ALDO_PSM_ERR_EN       (1 << 7)
00323 #define AD7124_ERREN_REG_SPI_IGNORE_ERR_EN     (1 << 6)
00324 #define AD7124_ERREN_REG_SPI_SCLK_CNT_ERR_EN   (1 << 5)
00325 #define AD7124_ERREN_REG_SPI_READ_ERR_EN       (1 << 4)
00326 #define AD7124_ERREN_REG_SPI_WRITE_ERR_EN      (1 << 3)
00327 #define AD7124_ERREN_REG_SPI_CRC_ERR_EN        (1 << 2)
00328 #define AD7124_ERREN_REG_MM_CRC_ERR_EN         (1 << 1)
00329 
00330     /* Channel Registers 0-15 bits */
00331 #define AD7124_CH_MAP_REG_CH_ENABLE    (1 << 15)
00332 #define AD7124_CH_MAP_REG_SETUP(x)     (((x) & 0x7) << 12)
00333 #define AD7124_CH_MAP_REG_AINP(x)      (((x) & 0x1F) << 5)
00334 #define AD7124_CH_MAP_REG_AINM(x)      (((x) & 0x1F) << 0)
00335 
00336     /* Configuration Registers 0-7 bits */
00337 #define AD7124_CFG_REG_BIPOLAR     (1 << 11)
00338 #define AD7124_CFG_REG_BURNOUT(x)  (((x) & 0x3) << 9)
00339 #define AD7124_CFG_REG_REF_BUFP    (1 << 8)
00340 #define AD7124_CFG_REG_REF_BUFM    (1 << 7)
00341 #define AD7124_CFG_REG_AIN_BUFP    (1 << 6)
00342 #define AD7124_CFG_REG_AINN_BUFM   (1 << 5)
00343 #define AD7124_CFG_REG_REF_SEL(x)  ((x) & 0x3) << 3
00344 #define AD7124_CFG_REG_PGA(x)      (((x) & 0x7) << 0)
00345 
00346     /* Filter Register 0-7 bits */
00347 #define AD7124_FILT_REG_FILTER(x)        ((uint32_t)((x) & 0x7) << 21)
00348 #define AD7124_FILT_REG_REJ60             ((uint32_t)1 << 20)
00349 #define AD7124_FILT_REG_POST_FILTER(x)    ((uint32_t)((x) & 0x7) << 17)
00350 #define AD7124_FILT_REG_SINGLE_CYCLE      ((uint32_t)1 << 16)
00351 #define AD7124_FILT_REG_FS(x)             ((uint32_t)((x) & 0x7FF) << 0)
00352 
00353 public:
00354 
00355     /** SPI configuration & constructor */
00356     AD7124( PinName CS = SPI_CS, PinName MOSI = SPI_MOSI, PinName MISO = SPI_MISO, PinName SCK = SPI_SCK);
00357     void frequency(int hz);
00358 
00359     /** Low level SPI bus comm methods */
00360     void reset(void);
00361 
00362     void write_reg(uint8_t regAddress, uint8_t regValue);
00363     uint16_t write_spi(uint16_t data);
00364     uint16_t read_reg (uint8_t regAddress);
00365     bool get_miso();
00366 
00367 
00368     int32_t Reset();
00369     /* Reads and returns the value of a device register. */
00370     uint32_t ReadDeviceRegister(enum ad7124_registers reg);
00371 
00372     /* Writes the specified value to a device register. */
00373     int32_t WriteDeviceRegister(enum ad7124_registers reg, uint32_t value);
00374 
00375     /*! Reads the value of the specified register. */
00376     int32_t ReadRegister(ad7124_st_reg * pReg);
00377 
00378     /*! Writes the value of the specified register. */
00379     int32_t WriteRegister(ad7124_st_reg  reg);
00380 
00381     /*! Reads the value of the specified register without a device state check. */
00382     int32_t NoCheckReadRegister(ad7124_st_reg * pReg);
00383 
00384     /*! Writes the value of the specified register without a device state check. */
00385     int32_t NoCheckWriteRegister(ad7124_st_reg  reg);
00386 
00387     /*! Waits until the device can accept read and write user actions. */
00388     int32_t WaitForSpiReady (uint32_t timeout);
00389 
00390     /*! Waits until a new conversion result is available. */
00391     int32_t WaitForConvReady (uint32_t timeout);
00392 
00393     /*! Reads the conversion result from the device. */
00394     int32_t ReadData (int32_t* pData);
00395 
00396     /*! Computes the CRC checksum for a data buffer. */
00397     uint8_t ComputeCRC8 (uint8_t* pBuf, uint8_t bufSize);
00398 
00399     /*! Updates the device SPI interface settings. */
00400     void UpdateDevSpiSettings ();
00401 
00402     /*! Initializes the AD7124. */
00403     int32_t Setup ();
00404 
00405     uint8_t SPI_Read(uint8_t *data, uint8_t bytes_number);
00406     uint8_t SPI_Write(uint8_t *data, uint8_t bytes_number);
00407 
00408     DigitalIn miso;///< DigitalIn must be initialized before SPI to prevent pin MUX overwrite
00409     SPI ad7124;    ///< SPI instance of the AD7790
00410     DigitalOut cs; ///< DigitalOut instance for the chipselect of the AD7790
00411 
00412 private:
00413 
00414 
00415     ad7124_st_reg  *regs; // reg map 38 bytes ?
00416     uint8_t useCRC; // boolean ?
00417     int check_ready; // ?
00418     int spi_rdy_poll_cnt; // timer ?
00419 
00420     const static uint8_t _SPI_MODE = 0x03;
00421     const static uint8_t _RESET = 0xFF;
00422     const static uint8_t _DUMMY_BYTE = 0xFF;
00423     const static uint16_t _READ_FLAG = 0x4000;
00424     const static uint8_t _DELAY_TIMING = 0x02;
00425 
00426 #define AD7124_CRC8_POLYNOMIAL_REPRESENTATION 0x07 /* x8 + x2 + x + 1 */
00427 #define AD7124_DISABLE_CRC 0
00428 #define AD7124_USE_CRC 1
00429 #define AD7124_READ_DATA 2
00430 
00431 #define INVALID_VAL -1 /* Invalid argument */
00432 #define COMM_ERR    -2 /* Communication error on receive */
00433 #define TIMEOUT     -3 /* A timeout has occured */
00434 
00435 };
00436 
00437 
00438 #endif
00439 
00440