| sysmon Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xsysmon_intr_example.c File Reference

## Overview

This file contains a design example using the driver functions of the System Monitor/ADC driver.

This example here shows the usage of the driver/device in interrupt mode to handle on-chip temperature and voltage alarm interrupts.

Note

This code assumes that no Operating System is being used.

The values of the on-chip temperature and the on-chip Vccaux voltage are read from the device and then the alarm thresholds are set in such a manner that the alarms occur.

    MODIFICATION HISTORY:

    Ver   Who    Date     Changes

    1.00a xd/sv  05/22/07 First release
    2.00a sv     06/22/08 Modified the function description of the interrupt
                    handler
    2.00a sdm    09/26/08 Added code to return temperature value to the main
                    function. TestappPeripheral prints the temperature
    4.00a ktn    10/22/09 Updated the example to use HAL processor APIs/macros.
                    Updated the example to use macros that have been
                    renamed to remove _m from the name of the macro.
    5.03a bss    04/25/13 Modified SysMonIntrExample function to set
                    Sequencer Mode as Safe mode instead of Single
                    channel mode before configuring Sequencer registers.
                    CR #703729
    7.2   adk    29/02/16 Updated example to support Zynq and ZynqMP.
    7.3   ms   01/23/17 Added xil_printf statement in main function to
                        ensure that "Successfully ran" and "Failed" strings
                        are available in all examples. This is a fix for
                        CR-965028.
    7.8   cog  07/20/23 Added support for SDT flow

## Functions
int | SysMonIntrExample (INTC *IntcInstancePtr, XSysMon *SysMonInstPtr, u16 SysMonDeviceId, u32 SysMonIntrId, int *Temp)
| This function runs a test on the System Monitor/ADC device using the driver APIs. More...
int | main (void)
| Main function that invokes the Interrupt example. More...

## Function Documentation

int main | ( | void |  | ) |

Main function that invokes the Interrupt example.

Parameters

  None. |

Returns
  - XST_SUCCESS if the example has completed successfully.
  - XST_FAILURE if the example has failed.

Note
  None.

References SysMonIntrExample().

int SysMonIntrExample | ( | INTC * | IntcInstancePtr,
|  | XSysMon * | SysMonInstPtr,
|  | u16 | SysMonDeviceId,
|  | u32 | SysMonIntrId,
|  | int * | Temp
| ) |  |

This function runs a test on the System Monitor/ADC device using the driver APIs.

The function does the following tasks:

- Initiate the System Monitor/ADC device driver instance
- Run self-test on the device
- Reset the device
- Set up alarms for on-chip temperature and VCCAUX
- Set up sequence registers to continuously monitor on-chip temperature and VCCAUX
- Setup interrupt system
- Enable interrupts
- Set up configuration registers to start the sequence
- Wait until temperature alarm interrupt or VCCAUX alarm interrupt occurs

Parameters

  IntcInstancePtr | is a pointer to the Interrupt Controller driver Instance.
  SysMonInstPtr | is a pointer to the XSysMon driver Instance.
  SysMonDeviceId | is the XPAR_<SYSMON_ADC_instance>_DEVICE_ID value from xparameters.h.
  SysMonIntrId | is XPAR_<INTC_instance>_<SYSMON_ADC_instance>_VEC_ID value from xparameters.h
  Temp | is an output parameter, it is a pointer through which the current temperature value is returned to the main function.

Returns
  - XST_SUCCESS if the example has completed successfully.
  - XST_FAILURE if the example has failed.

Note
  This function may never return if no interrupt occurs.

References XSysMon_Config::BaseAddress, XSM_ATR_TEMP_LOWER, XSM_ATR_TEMP_UPPER, XSM_ATR_VCCAUX_LOWER, XSM_ATR_VCCAUX_UPPER, XSM_AVG_16_SAMPLES, XSM_CFR1_ALM_TEMP_MASK, XSM_CFR1_ALM_VCCAUX_MASK, XSM_CH_TEMP, XSM_CH_VCCAUX, XSM_IPIXR_TEMP_MASK, XSM_IPIXR_VCCAUX_MASK, XSM_SEQ_CH_AUX00, XSM_SEQ_CH_AUX15, XSM_SEQ_CH_TEMP, XSM_SEQ_CH_VCCAUX, XSM_SEQ_MODE_CONTINPASS, XSM_SEQ_MODE_SAFE, XSM_SR_EOS_MASK, XSysMon_CfgInitialize(), XSysMon_GetAdcData(), XSysMon_GetStatus(), XSysMon_IntrClear(), XSysMon_IntrEnable(), XSysMon_IntrGetStatus(), XSysMon_IntrGlobalDisable(), XSysMon_IntrGlobalEnable(), XSysMon_LookupConfig(), XSysMon_RawToTemperature, XSysMon_SelfTest(), XSysMon_SetAdcClkDivisor(), XSysMon_SetAlarmEnables(), XSysMon_SetAlarmThreshold(), XSysMon_SetAvg(), XSysMon_SetSeqAcqTime(), XSysMon_SetSeqAvgEnables(), XSysMon_SetSeqChEnables(), XSysMon_SetSeqInputMode(), and XSysMon_SetSequencerMode().

Referenced by main().