1 /******************************************************************************
3 * Copyright (C) 2016 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
36 * The XSysMon driver supports the Xilinx System Monitor device.
38 * The System Monitor device has the following features:
39 * - PL Sysmon instance has 10-bit, 200-KSPS (kilo samples per second)
40 * Analog-to-Digital Converter (ADC)
41 * - PS Sysmon instance has 10-bit, 1000-KSPS ADC.
42 * - Monitoring of on-chip supply voltages and temperature
43 * - 1 dedicated differential analog-input pair and
44 * 16 auxiliary differential analog-input pairs
45 * - Automatic alarms based on user defined limits for the on-chip
46 * supply voltages and temperature
47 * - Automatic Channel Sequencer, programmable averaging, programmable
48 * acquisition time for the external inputs, unipolar or differential
49 * input selection for the external inputs
50 * - Inbuilt Calibration
51 * - Optional interrupt request generation
55 * The user should refer to the hardware device specification for detailed
56 * information about the device.
58 * This header file contains the prototypes of driver functions that can
59 * be used to access the System Monitor device.
62 * <b> System Monitor Channel Sequencer Modes </b>
64 * The System Monitor Channel Sequencer supports the following operating modes:
66 * - <b> Default </b>: This is the default mode after power up.
67 * In this mode of operation the System Monitor operates in
68 * a sequence mode, monitoring the on chip sensors:
69 * Temperature, VCCINT, and VCCAUX.
70 * - <b> One pass through sequence </b>: In this mode the System Monitor
71 * converts the channels enabled in the Sequencer Channel Enable
72 * registers for a single pass and then stops.
73 * - <b> Continuous cycling of sequence </b>: In this mode the System Monitor
74 * converts the channels enabled in the Sequencer Channel Enable
75 * registers continuously.
76 * - <b> Single channel mode</b>: In this mode the System Monitor Channel
77 * Sequencer is disabled and the System Monitor operates in a
78 * Single Channel Mode.
79 * The System Monitor can operate either in a Continuous or Event
80 * driven sampling mode in the single channel mode.
83 * <b> Initialization and Configuration </b>
85 * The device driver enables higher layer software (e.g., an application) to
86 * communicate to the System Monitor device.
88 * XSysMonPsu_CfgInitialize() API is used to initialize the System Monitor
89 * device. The user needs to first call the XSysMonPsu_LookupConfig() API which
90 * returns the Configuration structure pointer which is passed as a parameter to
91 * the XSysMonPsu_CfgInitialize() API.
96 * The System Monitor device supports interrupt driven mode and the default
97 * operation mode is polling mode.
99 * This driver does not provide a Interrupt Service Routine (ISR) for the device.
100 * It is the responsibility of the application to provide one if needed. Refer to
101 * the interrupt example provided with this driver for details on using the
102 * device in interrupt mode.
105 * <b> Virtual Memory </b>
107 * This driver supports Virtual Memory. The RTOS is responsible for calculating
108 * the correct device base address in Virtual Memory space.
113 * This driver is not thread safe. Any needs for threads or thread mutual
114 * exclusion must be satisfied by the layer above this driver.
119 * Asserts are used within all Xilinx drivers to enforce constraints on argument
120 * values. Asserts can be turned off on a system-wide basis by defining, at
121 * compile time, the NDEBUG identifier. By default, asserts are turned on and it
122 * is recommended that users leave asserts on during development.
125 * <b> Building the driver </b>
127 * The XSysMonPsu driver is composed of several source files. This allows the user
128 * to build and link only those parts of the driver that are necessary.
131 * <b> Limitations of the driver </b>
133 * System Monitor device can be accessed through the JTAG port and the AXI
134 * interface. The driver implementation does not support the simultaneous access
135 * of the device by both these interfaces. The user has to take care of this
136 * situation in the user application code.
144 * MODIFICATION HISTORY:
146 * Ver Who Date Changes
147 * ----- ----- -------- -----------------------------------------------
148 * 1.00 kvn 12/15/15 First release
149 * 02/15/16 Corrected Assert function call in
150 * XSysMonPsu_GetMonitorStatus API.
151 * 03/03/16 Added Temperature remote channel for Setsingle
152 * channel API. Also corrected external mux channel
154 * 1.1 kvn 05/05/16 Modified code for MISRA-C:2012 Compliance.
155 * 2.0 vns 08/14/16 Fixed CR #956780, added support for enabling/disabling
156 * SEQ_CH2 and SEQ_AVG2 registers, modified function
157 * prototypes of XSysMonPsu_GetSeqAvgEnables,
158 * XSysMonPsu_SetSeqAvgEnables, XSysMonPsu_SetSeqChEnables,
159 * XSysMonPsu_GetSeqChEnables,
160 * XSysMonPsu_SetSeqInputMode, XSysMonPsu_GetSeqInputMode,
161 * XSysMonPsu_SetSeqAcqTime
162 * and XSysMonPsu_GetSeqAcqTime to provide support for
163 * set/get 64 bit value.
164 * Added constants XSM_CFR_ALM_SUPPLY*(8-31)_MASKs to
165 * provide support for enabling extra PS alarams.
169 ******************************************************************************/
172 #ifndef XSYSMONPSU_H_ /* prevent circular inclusions */
173 #define XSYSMONPSU_H_ /* by using protection macros */
179 /***************************** Include Files *********************************/
182 #include "xil_assert.h"
184 #include "xsysmonpsu_hw.h"
185 #include "xil_types.h"
187 /************************** Constant Definitions *****************************/
190 * @name Indexes for the different channels.
193 #define XSM_CH_TEMP 0x0U /**< On Chip Temperature */
194 #define XSM_CH_SUPPLY1 0x1U /**< SUPPLY1 VCC_PSINTLP */
195 #define XSM_CH_SUPPLY2 0x2U /**< SUPPLY2 VCC_PSINTFP */
196 #define XSM_CH_VPVN 0x3U /**< VP/VN Dedicated analog inputs */
197 #define XSM_CH_VREFP 0x4U /**< VREFP */
198 #define XSM_CH_VREFN 0x5U /**< VREFN */
199 #define XSM_CH_SUPPLY3 0x6U /**< SUPPLY3 VCC_PSAUX */
200 #define XSM_CH_SUPPLY_CALIB 0x08U /**< Supply Calib Data Reg */
201 #define XSM_CH_ADC_CALIB 0x09U /**< ADC Offset Channel Reg */
202 #define XSM_CH_GAINERR_CALIB 0x0AU /**< Gain Error Channel Reg */
203 #define XSM_CH_SUPPLY4 0x0DU /**< SUPPLY4 VCC_PSDDR_504 */
204 #define XSM_CH_SUPPLY5 0x0EU /**< SUPPLY5 VCC_PSIO3_503 */
205 #define XSM_CH_SUPPLY6 0x0FU /**< SUPPLY6 VCC_PSIO0_500 */
206 #define XSM_CH_AUX_MIN 16U /**< Channel number for 1st Aux Channel */
207 #define XSM_CH_AUX_MAX 31U /**< Channel number for Last Aux channel */
208 #define XSM_CH_SUPPLY7 32U /**< SUPPLY7 VCC_PSIO1_501 */
209 #define XSM_CH_SUPPLY8 33U /**< SUPPLY8 VCC_PSIO2_502 */
210 #define XSM_CH_SUPPLY9 34U /**< SUPPLY9 PS_MGTRAVCC */
211 #define XSM_CH_SUPPLY10 35U /**< SUPPLY10 PS_MGTRAVTT */
212 #define XSM_CH_VCCAMS 36U /**< VCCAMS */
213 #define XSM_CH_TEMP_REMTE 37U /**< Temperature Remote */
214 #define XSM_CH_VCC_PSLL0 38U /**< VCC_PSLL0 */
215 #define XSM_CH_VCC_PSLL1 39U /**< VCC_PSLL1 */
216 #define XSM_CH_VCC_PSLL2 40U /**< VCC_PSLL2 */
217 #define XSM_CH_VCC_PSLL3 41U /**< VCC_PSLL3 */
218 #define XSM_CH_VCC_PSLL4 42U /**< VCC_PSLL4 */
219 #define XSM_CH_VCC_PSBATT 43U /**< VCC_PSBATT */
220 #define XSM_CH_VCCINT 44U /**< VCCINT */
221 #define XSM_CH_VCCBRAM 45U /**< VCCBRAM */
222 #define XSM_CH_VCCAUX 46U /**< VCCAUX */
223 #define XSM_CH_VCC_PSDDRPLL 47U /**< VCC_PSDDRPLL */
224 #define XSM_CH_DDRPHY_VREF 48U /**< DDRPHY_VREF */
225 #define XSM_CH_DDRPHY_AT0 49U /**< DDRPHY_AT0 */
226 #define XSM_CH_PSGT_AT0 50U /**< PSGT_AT0 */
227 #define XSM_CH_PSGT_AT1 51U /**< PSGT_AT0 */
228 #define XSM_CH_RESERVE0 52U /**< PSGT_AT0 */
229 #define XSM_CH_RESERVE1 53U /**< PSGT_AT0 */
234 * @name Indexes for reading the Calibration Coefficient Data.
237 #define XSM_CALIB_SUPPLY_OFFSET_COEFF 0U /**< Supply Offset Calib Coefficient */
238 #define XSM_CALIB_ADC_OFFSET_COEFF 1U /**< ADC Offset Calib Coefficient */
239 #define XSM_CALIB_GAIN_ERROR_COEFF 2U /**< Gain Error Calib Coefficient*/
244 * @name Indexes for reading the Minimum/Maximum Measurement Data.
247 #define XSM_MAX_TEMP 0U /**< Maximum Temperature Data */
248 #define XSM_MAX_SUPPLY1 1U /**< Maximum SUPPLY1 Data */
249 #define XSM_MAX_SUPPLY2 2U /**< Maximum SUPPLY2 Data */
250 #define XSM_MAX_SUPPLY3 3U /**< Maximum SUPPLY3 Data */
251 #define XSM_MIN_TEMP 4U /**< Minimum Temperature Data */
252 #define XSM_MIN_SUPPLY1 5U /**< Minimum SUPPLY1 Data */
253 #define XSM_MIN_SUPPLY2 6U /**< Minimum SUPPLY2 Data */
254 #define XSM_MIN_SUPPLY3 7U /**< Minimum SUPPLY3 Data */
255 #define XSM_MAX_SUPPLY4 8U /**< Maximum SUPPLY4 Data */
256 #define XSM_MAX_SUPPLY5 9U /**< Maximum SUPPLY5 Data */
257 #define XSM_MAX_SUPPLY6 0xAU /**< Maximum SUPPLY6 Data */
258 #define XSM_MIN_SUPPLY4 0xCU /**< Minimum SUPPLY4 Data */
259 #define XSM_MIN_SUPPLY5 0xDU /**< Minimum SUPPLY5 Data */
260 #define XSM_MIN_SUPPLY6 0xEU /**< Minimum SUPPLY6 Data */
261 #define XSM_MAX_SUPPLY7 0x80U /**< Maximum SUPPLY7 Data */
262 #define XSM_MAX_SUPPLY8 0x81U /**< Maximum SUPPLY8 Data */
263 #define XSM_MAX_SUPPLY9 0x82U /**< Maximum SUPPLY9 Data */
264 #define XSM_MAX_SUPPLY10 0x83U /**< Maximum SUPPLY10 Data */
265 #define XSM_MAX_VCCAMS 0x84U /**< Maximum VCCAMS Data */
266 #define XSM_MAX_TEMP_REMOTE 0x85U /**< Maximum Remote Temperature Data */
267 #define XSM_MIN_SUPPLY7 0x88U /**< Minimum SUPPLY7 Data */
268 #define XSM_MIN_SUPPLY8 0x89U /**< Minimum SUPPLY8 Data */
269 #define XSM_MIN_SUPPLY9 0x8AU /**< Minimum SUPPLY9 Data */
270 #define XSM_MIN_SUPPLY10 0x8BU /**< Minimum SUPPLY10 Data */
271 #define XSM_MIN_VCCAMS 0x8CU /**< Minimum VCCAMS Data */
272 #define XSM_MIN_TEMP_REMOTE 0x8DU /**< Minimum Remote Temperature Data */
277 * @name Averaging to be done for the channels.
280 #define XSM_AVG_0_SAMPLES 0U /**< No Averaging */
281 #define XSM_AVG_16_SAMPLES 1U /**< Average 16 samples */
282 #define XSM_AVG_64_SAMPLES 2U /**< Average 64 samples */
283 #define XSM_AVG_256_SAMPLES 3U /**< Average 256 samples */
288 * @name Channel Sequencer Modes of operation.
291 #define XSM_SEQ_MODE_SAFE 0U /**< Default Safe Mode */
292 #define XSM_SEQ_MODE_ONEPASS 1U /**< Onepass through Sequencer */
293 #define XSM_SEQ_MODE_CONTINPASS 2U /**< Continuous Cycling Seqquencer */
294 #define XSM_SEQ_MODE_SINGCHAN 3U /**< Single channel - No Sequencing */
295 #define XSM_SEQ_MODE_OYLMPUS 6U /**< Olympus mode */
300 * @name Clock Divisor values range.
303 #define XSM_CLK_DIV_MIN 0U /**< Minimum Clock Divisor value */
304 #define XSM_CLK_DIV_MAX 255U /**< Maximum Clock Divisor value */
309 * @name Alarm Threshold(Limit) Register (ATR) indexes.
312 #define XSM_ATR_TEMP_UPPER 0U /**< High user Temperature limit */
313 #define XSM_ATR_SUP1_UPPER 1U /**< Supply1 high voltage limit */
314 #define XSM_ATR_SUP2_UPPER 2U /**< Supply2 high voltage limit */
315 #define XSM_ATR_OT_UPPER 3U /**< Upper Over Temperature limit */
316 #define XSM_ATR_TEMP_LOWER 4U /**< Low user Temperature */
317 #define XSM_ATR_SUP1_LOWER 5U /**< Suuply1 low voltage limit */
318 #define XSM_ATR_SUP2_LOWER 6U /**< Supply2 low voltage limit */
319 #define XSM_ATR_OT_LOWER 7U /**< Lower Over Temperature limit */
320 #define XSM_ATR_SUP3_UPPER 8U /**< Supply3 high voltage limit */
321 #define XSM_ATR_SUP4_UPPER 9U /**< Supply4 high voltage limit */
322 #define XSM_ATR_SUP5_UPPER 0xAU /**< Supply5 high voltage limit */
323 #define XSM_ATR_SUP6_UPPER 0xBU /**< Supply6 high voltage limit */
324 #define XSM_ATR_SUP3_LOWER 0xCU /**< Supply3 low voltage limit */
325 #define XSM_ATR_SUP4_LOWER 0xDU /**< Supply4 low voltage limit */
326 #define XSM_ATR_SUP5_LOWER 0xEU /**< Supply5 low voltage limit */
327 #define XSM_ATR_SUP6_LOWER 0xFU /**< Supply6 low voltage limit */
328 #define XSM_ATR_SUP7_UPPER 0x10U /**< Supply7 high voltage limit */
329 #define XSM_ATR_SUP8_UPPER 0x11U /**< Supply8 high voltage limit */
330 #define XSM_ATR_SUP9_UPPER 0x12U /**< Supply9 high voltage limit */
331 #define XSM_ATR_SUP10_UPPER 0x13U /**< Supply10 high voltage limit */
332 #define XSM_ATR_VCCAMS_UPPER 0x14U /**< VCCAMS high voltage limit */
333 #define XSM_ATR_TEMP_RMTE_UPPER 0x15U /**< High remote Temperature limit */
334 #define XSM_ATR_SUP7_LOWER 0x18U /**< Supply7 low voltage limit */
335 #define XSM_ATR_SUP8_LOWER 0x19U /**< Supply8 low voltage limit */
336 #define XSM_ATR_SUP9_LOWER 0x1AU /**< Supply9 low voltage limit */
337 #define XSM_ATR_SUP10_LOWER 0x1BU /**< Supply10 low voltage limit */
338 #define XSM_ATR_VCCAMS_LOWER 0x1CU /**< VCCAMS low voltage limit */
339 #define XSM_ATR_TEMP_RMTE_LOWER 0x1DU /**< Low remote Temperature limit */
344 * @name Alarm masks for channels in Configuration registers 1
347 #define XSM_CFR_ALM_SUPPLY13_MASK 0x200000 /**< Alarm 6 - SUPPLY6 */
348 #define XSM_CFR_ALM_SUPPLY12_MASK 0x100000 /**< Alarm 6 - SUPPLY6 */
349 #define XSM_CFR_ALM_SUPPLY11_MASK 0x080000 /**< Alarm 6 - SUPPLY6 */
350 #define XSM_CFR_ALM_SUPPLY10_MASK 0x040000 /**< Alarm 6 - SUPPLY6 */
351 #define XSM_CFR_ALM_SUPPLY9_MASK 0x020000 /**< Alarm 6 - SUPPLY6 */
352 #define XSM_CFR_ALM_SUPPLY8_MASK 0x010000 /**< Alarm 6 - SUPPLY6 */
353 #define XSM_CFR_ALM_SUPPLY6_MASK 0x0800 /**< Alarm 6 - SUPPLY6 */
354 #define XSM_CFR_ALM_SUPPLY5_MASK 0x0400 /**< Alarm 5 - SUPPLY5 */
355 #define XSM_CFR_ALM_SUPPLY4_MASK 0x0200 /**< Alarm 4 - SUPPLY4 */
356 #define XSM_CFR_ALM_SUPPLY3_MASK 0x0100 /**< Alarm 3 - SUPPLY3 */
357 #define XSM_CFR_ALM_SUPPLY2_MASK 0x0008 /**< Alarm 2 - SUPPLY2 */
358 #define XSM_CFR_ALM_SUPPLY1_MASK 0x0004 /**< Alarm 1 - SUPPLY1 */
359 #define XSM_CFR_ALM_TEMP_MASK 0x0002 /**< Alarm 0 - Temperature */
360 #define XSM_CFR_ALM_OT_MASK 0x0001 /**< Over Temperature Alarm */
364 /**************************** Type Definitions *******************************/
366 /******************************************************************************/
368 * This data type defines a handler that an application defines to communicate
369 * with interrupt system to retrieve state information about an application.
371 * @param CallBackRef is a callback reference passed in by the upper layer
372 * when setting the handler, and is passed back to the upper layer
373 * when the handler is called. It is used to find the device driver
376 ******************************************************************************/
377 typedef void (*XSysMonPsu_Handler) (void *CallBackRef);
380 * This typedef contains configuration information for a device.
383 u16 DeviceId; /**< Unique ID of device */
384 u32 BaseAddress; /**< Register base address */
388 * The XSysmonPsu driver instance data. The user is required to allocate a
389 * variable of this type for the SYSMON device in the system. A pointer
390 * to a variable of this type is then passed to the driver API functions.
393 XSysMonPsu_Config Config; /**< Device configuration */
394 u32 IsReady; /**< Device is initialized and ready */
395 XSysMonPsu_Handler Handler;
396 void *CallBackRef; /**< Callback reference for event handler */
399 /* BaseAddress Offsets */
400 #define XSYSMON_PS 1U
401 #define XSYSMON_PL 2U
402 #define XSYSMON_AMS 3U
403 #define XPS_BA_OFFSET 0x00000800U
404 #define XPL_BA_OFFSET 0x00000C00U
405 #define XSM_ADC_CH_OFFSET 0x00000200U
406 #define XSM_AMS_CH_OFFSET 0x00000060U
407 #define XSM_MIN_MAX_CH_OFFSET 0x00000080U
409 /************************* Variable Definitions ******************************/
411 /***************** Macros (Inline Functions) Definitions *********************/
413 /****************************************************************************/
416 * This macro converts System Monitor Raw Data to Temperature(centigrades)
417 * for On-Chip Sensors.
419 * @param AdcData is the SysMon Raw ADC Data.
421 * @return The Temperature in centigrades.
423 * @note C-Style signature:
424 * float XSysMon_RawToTemperature_OnChip(u32 AdcData)
426 *****************************************************************************/
427 #define XSysMonPsu_RawToTemperature_OnChip(AdcData) \
428 ((((float)(AdcData)/65536.0f)/0.00199451786f ) - 273.6777f)
430 /****************************************************************************/
433 * This macro converts System Monitor Raw Data to Temperature(centigrades)
434 * for external reference.
436 * @param AdcData is the SysMon Raw ADC Data.
438 * @return The Temperature in centigrades.
440 * @note C-Style signature:
441 * float XSysMon_RawToTemperature_ExternalRef(u32 AdcData)
443 *****************************************************************************/
444 #define XSysMonPsu_RawToTemperature_ExternalRef(AdcData) \
445 ((((float)(AdcData)/65536.0f)/0.00198842814f ) - 273.8195f)
447 /****************************************************************************/
450 * This macro converts System Monitor Raw Data to Voltage(volts).
452 * @param AdcData is the System Monitor ADC Raw Data.
454 * @return The Voltage in volts.
456 * @note C-Style signature:
457 * float XSysMon_RawToVoltage(u32 AdcData)
459 *****************************************************************************/
460 #define XSysMonPsu_RawToVoltage(AdcData) \
461 ((((float)(AdcData))* (3.0f))/65536.0f)
463 /****************************************************************************/
466 * This macro converts Temperature in centigrades to System Monitor Raw Data
467 * for On-Chip Sensors.
469 * @param Temperature is the Temperature in centigrades to be
470 * converted to System Monitor ADC Raw Data.
472 * @return The System Monitor ADC Raw Data.
474 * @note C-Style signature:
475 * int XSysMon_TemperatureToRaw_OnChip(float Temperature)
477 *****************************************************************************/
478 #define XSysMonPsu_TemperatureToRaw_OnChip(Temperature) \
479 ((s32)(((Temperature) + 273.6777f)*65536.0f*0.00199451786f))
481 /****************************************************************************/
484 * This macro converts Temperature in centigrades to System Monitor Raw Data
485 * for external reference.
487 * @param Temperature is the Temperature in centigrades to be
488 * converted to System Monitor ADC Raw Data.
490 * @return The System Monitor ADC Raw Data.
492 * @note C-Style signature:
493 * int XSysMon_TemperatureToRaw_ExternalRef(float Temperature)
495 *****************************************************************************/
496 #define XSysMonPsu_TemperatureToRaw_ExternalRef(Temperature) \
497 ((s32)(((Temperature) + 273.8195f)*65536.0f*0.00198842814f))
499 /****************************************************************************/
502 * This macro converts Voltage in Volts to System Monitor Raw Data.
504 * @param Voltage is the Voltage in volts to be converted to
505 * System Monitor/ADC Raw Data.
507 * @return The System Monitor ADC Raw Data.
509 * @note C-Style signature:
510 * int XSysMon_VoltageToRaw(float Voltage)
512 *****************************************************************************/
513 #define XSysMonPsu_VoltageToRaw(Voltage) \
514 ((s32)((Voltage)*65536.0f/3.0f))
516 /****************************************************************************/
519 * This static inline macro calculates the effective baseaddress based on the
520 * Sysmon instance. For PS Sysmon, use additional offset XPS_BA_OFFSET and For
521 * PL Sysmon, use additional offset XPL_BA_OFFSET.
523 * @param BaseAddress is the starting address of the SysMon block in
525 * @param SysmonBlk is the value that tells whether it is for PS Sysmon block
526 * or PL Sysmon block or the AMS controller register region.
528 * @return Returns the effective baseaddress of the sysmon instance.
530 *****************************************************************************/
531 static inline u32 XSysMonPsu_GetEffBaseAddress(u32 BaseAddress, u32 SysmonBlk)
535 if (SysmonBlk == XSYSMON_PS) {
536 EffBaseAddr = BaseAddress + XPS_BA_OFFSET;
537 } else if(SysmonBlk == XSYSMON_PL) {
538 EffBaseAddr = BaseAddress + XPL_BA_OFFSET;
540 EffBaseAddr = BaseAddress;
546 /************************** Function Prototypes ******************************/
548 /* Functions in xsysmonpsu.c */
549 s32 XSysMonPsu_CfgInitialize(XSysMonPsu *InstancePtr, XSysMonPsu_Config *ConfigPtr,
551 void XSysMonPsu_Reset(XSysMonPsu *InstancePtr);
552 void XSysMonPsu_Reset_FromLPD(XSysMonPsu *InstancePtr);
553 u32 XSysMonPsu_GetStatus(XSysMonPsu *InstancePtr, u32 SysmonBlk);
554 void XSysMonPsu_StartAdcConversion(XSysMonPsu *InstancePtr);
555 u16 XSysMonPsu_GetAdcData(XSysMonPsu *InstancePtr, u8 Channel, u32 Block);
556 u16 XSysMonPsu_GetCalibCoefficient(XSysMonPsu *InstancePtr, u8 CoeffType, u32 SysmonBlk);
557 u16 XSysMonPsu_GetMinMaxMeasurement(XSysMonPsu *InstancePtr, u8 MeasurementType,
559 void XSysMonPsu_SetAvg(XSysMonPsu *InstancePtr, u8 Average, u32 SysmonBlk);
560 u8 XSysMonPsu_GetAvg(XSysMonPsu *InstancePtr, u32 SysmonBlk);
561 s32 XSysMonPsu_SetSingleChParams(XSysMonPsu *InstancePtr, u8 Channel,
562 u32 IncreaseAcqCycles, u32 IsEventMode,
563 u32 IsDifferentialMode, u32 SysmonBlk);
564 void XSysMonPsu_SetAlarmEnables(XSysMonPsu *InstancePtr, u32 AlmEnableMask,
566 u32 XSysMonPsu_GetAlarmEnables(XSysMonPsu *InstancePtr, u32 SysmonBlk);
567 void XSysMonPsu_SetSequencerMode(XSysMonPsu *InstancePtr, u8 SequencerMode,
569 u8 XSysMonPsu_GetSequencerMode(XSysMonPsu *InstancePtr, u32 SysmonBlk);
570 void XSysMonPsu_SetSequencerEvent(XSysMonPsu *InstancePtr, u32 IsEventMode,
572 s32 XSysMonPsu_GetSequencerEvent(XSysMonPsu *InstancePtr, u32 SysmonBlk);
573 void XSysMonPsu_SetExtenalMux(XSysMonPsu *InstancePtr, u8 Channel, u32 SysmonBlk);
574 u32 XSysMonPsu_GetExtenalMux(XSysMonPsu *InstancePtr, u32 SysmonBlk);
575 void XSysMonPsu_SetAdcClkDivisor(XSysMonPsu *InstancePtr, u8 Divisor, u32 SysmonBlk);
576 u8 XSysMonPsu_GetAdcClkDivisor(XSysMonPsu *InstancePtr, u32 SysmonBlk);
577 s32 XSysMonPsu_SetSeqChEnables(XSysMonPsu *InstancePtr, u64 ChEnableMask,
579 u64 XSysMonPsu_GetSeqAvgEnables(XSysMonPsu *InstancePtr, u32 SysmonBlk);
580 u64 XSysMonPsu_GetSeqChEnables(XSysMonPsu *InstancePtr, u32 SysmonBlk);
581 s32 XSysMonPsu_SetSeqAvgEnables(XSysMonPsu *InstancePtr, u64 AvgEnableChMask,
583 s32 XSysMonPsu_SetSeqInputMode(XSysMonPsu *InstancePtr, u64 InputModeChMask,
585 u64 XSysMonPsu_GetSeqInputMode(XSysMonPsu *InstancePtr, u32 SysmonBlk);
586 s32 XSysMonPsu_SetSeqAcqTime(XSysMonPsu *InstancePtr, u64 AcqCyclesChMask,
588 u64 XSysMonPsu_GetSeqAcqTime(XSysMonPsu *InstancePtr, u32 SysmonBlk);
589 void XSysMonPsu_SetAlarmThreshold(XSysMonPsu *InstancePtr, u8 AlarmThrReg,
590 u16 Value, u32 SysmonBlk);
591 u16 XSysMonPsu_GetAlarmThreshold(XSysMonPsu *InstancePtr, u8 AlarmThrReg,
593 void XSysMonPsu_SetPSAutoConversion(XSysMonPsu *InstancePtr);
594 u32 XSysMonPsu_GetMonitorStatus(XSysMonPsu *InstancePtr);
596 /* interrupt functions in xsysmonpsu_intr.c */
597 void XSysMonPsu_IntrEnable(XSysMonPsu *InstancePtr, u64 Mask);
598 void XSysMonPsu_IntrDisable(XSysMonPsu *InstancePtr, u64 Mask);
599 u64 XSysMonPsu_IntrGetEnabled(XSysMonPsu *InstancePtr);
600 u64 XSysMonPsu_IntrGetStatus(XSysMonPsu *InstancePtr);
601 void XSysMonPsu_IntrClear(XSysMonPsu *InstancePtr, u64 Mask);
603 /* Functions in xsysmonpsu_selftest.c */
604 s32 XSysMonPsu_SelfTest(XSysMonPsu *InstancePtr);
606 /* Functions in xsysmonpsu_sinit.c */
607 XSysMonPsu_Config *XSysMonPsu_LookupConfig(u16 DeviceId);
610 #endif /* XSYSMONPSU_H_ */