📄 xadcps.h
字号:
/******************************************************************************** (c) Copyright 2011 Xilinx, Inc. All rights reserved.** This file contains confidential and proprietary information of Xilinx, Inc.* and is protected under U.S. and international copyright and other* intellectual property laws.** DISCLAIMER* This disclaimer is not a license and does not grant any rights to the* materials distributed herewith. Except as otherwise provided in a valid* license issued to you by Xilinx, and to the maximum extent permitted by* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;* and (2) Xilinx shall not be liable (whether in contract or tort, including* negligence, or under any other theory of liability) for any loss or damage* of any kind or nature related to, arising under or in connection with these* materials, including for any direct, or any indirect, special, incidental,* or consequential loss or damage (including loss of data, profits, goodwill,* or any type of loss or damage suffered as a result of any action brought by* a third party) even if such damage or loss was reasonably foreseeable or* Xilinx had been advised of the possibility of the same.** CRITICAL APPLICATIONS* Xilinx products are not designed or intended to be fail-safe, or for use in* any application requiring fail-safe performance, such as life-support or* safety devices or systems, Class III medical devices, nuclear facilities,* applications related to the deployment of airbags, or any other applications* that could lead to death, personal injury, or severe property or* environmental damage (individually and collectively, "Critical* Applications"). Customer assumes the sole risk and liability of any use of* Xilinx products in Critical Applications, subject only to applicable laws* and regulations governing limitations on product liability.** THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE* AT ALL TIMES.*******************************************************************************//****************************************************************************//**** @file xadcps.h** The XAdcPs driver supports the Xilinx XADC/ADC device.** The XADC/ADC device has the following features:* - 10-bit, 200-KSPS (kilo samples per second)* Analog-to-Digital Converter (ADC)* - Monitoring of on-chip supply voltages and temperature* - 1 dedicated differential analog-input pair and* 16 auxiliary differential analog-input pairs* - Automatic alarms based on user defined limits for the on-chip* supply voltages and temperature* - Automatic Channel Sequencer, programmable averaging, programmable* acquisition time for the external inputs, unipolar or differential* input selection for the external inputs* - Inbuilt Calibration* - Optional interrupt request generation*** The user should refer to the hardware device specification for detailed* information about the device.** This header file contains the prototypes of driver functions that can* be used to access the XADC/ADC device.*** <b> XADC Channel Sequencer Modes </b>** The XADC Channel Sequencer supports the following operating modes:** - <b> Default </b>: This is the default mode after power up.* In this mode of operation the XADC operates in* a sequence mode, monitoring the on chip sensors:* Temperature, VCCINT, and VCCAUX.* - <b> One pass through sequence </b>: In this mode the XADC* converts the channels enabled in the Sequencer Channel Enable* registers for a single pass and then stops.* - <b> Continuous cycling of sequence </b>: In this mode the XADC* converts the channels enabled in the Sequencer Channel Enable* registers continuously.* - <b> Single channel mode</b>: In this mode the XADC Channel* Sequencer is disabled and the XADC operates in a* Single Channel Mode.* The XADC can operate either in a Continuous or Event* driven sampling mode in the single channel mode.* - <b> Simultaneous Sampling Mode</b>: In this mode the XADC Channel* Sequencer will automatically sequence through eight fixed pairs* of auxiliary analog input channels for simulataneous conversion.* - <b> Independent ADC mode</b>: In this mode the first ADC (A) is used to* is used to implement a fixed monitoring mode similar to the* default mode but the alarm fucntions ar eenabled.* The second ADC (B) is available to be used with external analog* input channels only.** Read the XADC spec for more information about the sequencer modes.** <b> Initialization and Configuration </b>** The device driver enables higher layer software (e.g., an application) to* communicate to the XADC/ADC device.** XAdcPs_CfgInitialize() API is used to initialize the XADC/ADC* device. The user needs to first call the XAdcPs_LookupConfig() API which* returns the Configuration structure pointer which is passed as a parameter to* the XAdcPs_CfgInitialize() API.*** <b>Interrupts</b>** The XADC/ADC device supports interrupt driven mode and the default* operation mode is polling mode.** The interrupt mode is available only if hardware is configured to support* interrupts.** This driver does not provide a Interrupt Service Routine (ISR) for the device.* It is the responsibility of the application to provide one if needed. Refer to* the interrupt example provided with this driver for details on using the* device in interrupt mode.*** <b> Virtual Memory </b>** This driver supports Virtual Memory. The RTOS is responsible for calculating* the correct device base address in Virtual Memory space.*** <b> Threads </b>** This driver is not thread safe. Any needs for threads or thread mutual* exclusion must be satisfied by the layer above this driver.*** <b> Asserts </b>** Asserts are used within all Xilinx drivers to enforce constraints on argument* values. Asserts can be turned off on a system-wide basis by defining, at* compile time, the NDEBUG identifier. By default, asserts are turned on and it* is recommended that users leave asserts on during development.*** <b> Building the driver </b>** The XAdcPs driver is composed of several source files. This allows the user* to build and link only those parts of the driver that are necessary.** <b> Limitations of the driver </b>** XADC/ADC device can be accessed through the JTAG port and the PLB* interface. The driver implementation does not support the simultaneous access* of the device by both these interfaces. The user has to care of this situation* in the user application code.** <br><br>** <pre>** MODIFICATION HISTORY:** Ver Who Date Changes* ----- ----- -------- -----------------------------------------------------* 1.00a ssb 12/22/11 First release based on the XPS/AXI xadc driver* </pre>******************************************************************************/#ifndef XADCPS_H /* Prevent circular inclusions */#define XADCPS_H /* by using protection macros */#ifdef __cplusplusextern "C" {#endif/***************************** Include Files ********************************/#include "xil_types.h"#include "xil_assert.h"#include "xstatus.h"#include "xadcps_hw.h"/************************** Constant Definitions ****************************//** * @name Indexes for the different channels. * @{ */#define XADCPS_CH_TEMP 0x0 /**< On Chip Temperature */#define XADCPS_CH_VCCINT 0x1 /**< VCCINT */#define XADCPS_CH_VCCAUX 0x2 /**< VCCAUX */#define XADCPS_CH_VPVN 0x3 /**< VP/VN Dedicated analog inputs */#define XADCPS_CH_VREFP 0x4 /**< VREFP */#define XADCPS_CH_VREFN 0x5 /**< VREFN */#define XADCPS_CH_VBRAM 0x6 /**< On-chip VBRAM Data Reg, 7 series */#define XADCPS_CH_SUPPLY_CALIB 0x07 /**< Supply Calib Data Reg */#define XADCPS_CH_ADC_CALIB 0x08 /**< ADC Offset Channel Reg */#define XADCPS_CH_GAINERR_CALIB 0x09 /**< Gain Error Channel Reg */#define XADCPS_CH_VCCPINT 0x0D /**< On-chip PS VCCPINT Channel , Zynq */#define XADCPS_CH_VCCPAUX 0x0E /**< On-chip PS VCCPAUX Channel , Zynq */#define XADCPS_CH_VCCPDRO 0x0F /**< On-chip PS VCCPDRO Channel , Zynq */#define XADCPS_CH_AUX_MIN 16 /**< Channel number for 1st Aux Channel */#define XADCPS_CH_AUX_MAX 31 /**< Channel number for Last Aux channel *//*@}*//** * @name Indexes for reading the Calibration Coefficient Data. * @{ */#define XADCPS_CALIB_SUPPLY_COEFF 0 /**< Supply Offset Calib Coefficient */#define XADCPS_CALIB_ADC_COEFF 1 /**< ADC Offset Calib Coefficient */#define XADCPS_CALIB_GAIN_ERROR_COEFF 2 /**< Gain Error Calib Coefficient*//*@}*//** * @name Indexes for reading the Minimum/Maximum Measurement Data. * @{ */#define XADCPS_MAX_TEMP 0 /**< Maximum Temperature Data */#define XADCPS_MAX_VCCINT 1 /**< Maximum VCCINT Data */#define XADCPS_MAX_VCCAUX 2 /**< Maximum VCCAUX Data */#define XADCPS_MAX_VBRAM 3 /**< Maximum VBRAM Data */#define XADCPS_MIN_TEMP 4 /**< Minimum Temperature Data */#define XADCPS_MIN_VCCINT 5 /**< Minimum VCCINT Data */#define XADCPS_MIN_VCCAUX 6 /**< Minimum VCCAUX Data */#define XADCPS_MIN_VBRAM 7 /**< Minimum VBRAM Data */#define XADCPS_MAX_VCCPINT 8 /**< Maximum VCCPINT Register , Zynq */#define XADCPS_MAX_VCCPAUX 9 /**< Maximum VCCPAUX Register , Zynq */#define XADCPS_MAX_VCCPDRO 0xA /**< Maximum VCCPDRO Register , Zynq */#define XADCPS_MIN_VCCPINT 0xC /**< Minimum VCCPINT Register , Zynq */#define XADCPS_MIN_VCCPAUX 0xD /**< Minimum VCCPAUX Register , Zynq */#define XADCPS_MIN_VCCPDRO 0xE /**< Minimum VCCPDRO Register , Zynq *//*@}*//** * @name Alarm Threshold(Limit) Register (ATR) indexes. * @{ */#define XADCPS_ATR_TEMP_UPPER 0 /**< High user Temperature */#define XADCPS_ATR_VCCINT_UPPER 1 /**< VCCINT high voltage limit register */#define XADCPS_ATR_VCCAUX_UPPER 2 /**< VCCAUX high voltage limit register */#define XADCPS_ATR_OT_UPPER 3 /**< VCCAUX high voltage limit register */#define XADCPS_ATR_TEMP_LOWER 4 /**< Upper Over Temperature limit Reg */#define XADCPS_ATR_VCCINT_LOWER 5 /**< VCCINT high voltage limit register */#define XADCPS_ATR_VCCAUX_LOWER 6 /**< VCCAUX low voltage limit register */#define XADCPS_ATR_OT_LOWER 7 /**< Lower Over Temperature limit */#define XADCPS_ATR_VBRAM_UPPER_ 8 /**< VRBAM Upper Alarm Reg, 7 Series */#define XADCPS_ATR_VCCPINT_UPPER 9 /**< VCCPINT Upper Alarm Reg, Zynq */#define XADCPS_ATR_VCCPAUX_UPPER 0xA /**< VCCPAUX Upper Alarm Reg, Zynq */#define XADCPS_ATR_VCCPDRO_UPPER 0xB /**< VCCPDRO Upper Alarm Reg, Zynq */#define XADCPS_ATR_VBRAM_LOWER 0xC /**< VRBAM Lower Alarm Reg, 7 Series */#define XADCPS_ATR_VCCPINT_LOWER 0xD /**< VCCPINT Lower Alarm Reg , Zynq */#define XADCPS_ATR_VCCPAUX_LOWER 0xE /**< VCCPAUX Lower Alarm Reg , Zynq */#define XADCPS_ATR_VCCPDRO_LOWER 0xF /**< VCCPDRO Lower Alarm Reg , Zynq *//*@}*//** * @name Averaging to be done for the channels. * @{ */#define XADCPS_AVG_0_SAMPLES 0 /**< No Averaging */#define XADCPS_AVG_16_SAMPLES 1 /**< Average 16 samples */#define XADCPS_AVG_64_SAMPLES 2 /**< Average 64 samples */#define XADCPS_AVG_256_SAMPLES 3 /**< Average 256 samples *//*@}*//** * @name Channel Sequencer Modes of operation * @{ */#define XADCPS_SEQ_MODE_SAFE 0 /**< Default Safe Mode */#define XADCPS_SEQ_MODE_ONEPASS 1 /**< Onepass through Sequencer */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -