sysmonpsu: xsysmonpsu_intr_example.c File Reference

| sysmonpsu Xilinx SDK Drivers API Documentation

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

Functions
xsysmonpsu_intr_example.c File Reference

## Overview

This file contains a design example using the driver functions of the System Monitor 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, VccInt voltage and VccAux voltage are read from the device and then the alarm thresholds are set in such a manner that the alarms occur.

This examples also assumes that there is a STDIO device in the system. This example has floating point calculations and uses printfs for outputting floating point data, therefore the memory allocated for the Stack must be more.

    MODIFICATION HISTORY:

    Ver   Who    Date     Changes

    1.0   kvn    12/15/15 First release
                 02/15/16 Corrected order of Enabling / Disabling of
                          interrupts.
          ms     04/05/17 Modified Comment lines in functions to
                          recognize it as documentation block for doxygen
                          generation.
    2.3  ms      12/12/17 Added peripheral test support
          mn     03/08/18 Update code to run at higher frequency

## Functions
int | SysMonPsuIntrExample (XScuGic *XScuGicInstPtr, XSysMonPsu *SysMonInstPtr, u16 SysMonDeviceId, u16 SysMonIntrId)
| This function runs a test on the System Monitor 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 SysMonPsuIntrExample().

int SysMonPsuIntrExample | ( | XScuGic * | XScuGicInstPtr,
|  | XSysMonPsu * | SysMonInstPtr,
|  | u16 | SysMonDeviceId,
|  | u16 | SysMonIntrId
| ) |  |

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

The function does the following tasks:

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

Parameters

  XScuGicInstPtr | is a pointer to the Interrupt Controller driver Instance.
  SysMonInstPtr | is a pointer to the XSysMonPsu driver Instance.
  SysMonDeviceId | is the XPAR_<SYSMON_instance>_DEVICE_ID value from xparameters.h.
  SysMonIntrId | is XPAR_<SYSMON_instance>_INTR value from xparameters_ps.h

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 XSysMonPsu_Config::BaseAddress, XSM_ATR_SUP1_LOWER, XSM_ATR_SUP1_UPPER, XSM_ATR_SUP3_LOWER, XSM_ATR_SUP3_UPPER, XSM_ATR_TEMP_LOWER, XSM_ATR_TEMP_UPPER, XSM_AVG_16_SAMPLES, XSM_CFR_ALM_SUPPLY1_MASK, XSM_CFR_ALM_SUPPLY3_MASK, XSM_CFR_ALM_TEMP_MASK, XSM_CH_SUPPLY1, XSM_CH_SUPPLY3, XSM_CH_TEMP, XSM_MAX_SUPPLY1, XSM_MAX_SUPPLY3, XSM_MAX_TEMP, XSM_MIN_SUPPLY1, XSM_MIN_SUPPLY3, XSM_MIN_TEMP, XSM_SEQ_MODE_CONTINPASS, XSM_SEQ_MODE_SAFE, XSysMonPsu_CfgInitialize(), XSysMonPsu_GetAdcData(), XSysMonPsu_GetAlarmThreshold(), XSysMonPsu_GetMinMaxMeasurement(), XSysMonPsu_IntrClear(), XSysMonPsu_IntrEnable(), XSysMonPsu_IntrGetStatus(), XSysMonPsu_LookupConfig(), XSysMonPsu_RawToTemperature_OnChip, XSysMonPsu_RawToVoltage, XSysMonPsu_SelfTest(), XSysMonPsu_SetAlarmEnables(), XSysMonPsu_SetAlarmThreshold(), XSysMonPsu_SetAvg(), XSysMonPsu_SetSeqAcqTime(), XSysMonPsu_SetSeqAvgEnables(), XSysMonPsu_SetSeqChEnables(), XSysMonPsu_SetSeqInputMode(), XSysMonPsu_SetSequencerMode(), XSysMonPsu_TemperatureToRaw_OnChip, and XSysMonPsu_VoltageToRaw.

Referenced by main().