sysmonpsu: xsysmonpsu_single_ch_intr_example.c File Reference

| sysmonpsu Xilinx SDK Drivers API Documentation

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

Functions
xsysmonpsu_single_ch_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 single channel interrupt mode to handle End of Conversion (EOC) and VCCINT alarm interrupts.

Note

This code assumes that no Operating System is being used.

The value of the on-chip Vccint voltage is read from the device and then the alarm thresholds are set in such a manner that the alarm occurs.

    MODIFICATION HISTORY:

    Ver   Who    Date     Changes

    1.0   kvn    12/15/15 First release
                 02/15/16 Corrected order of Enabling / Disabling of
                          interrupts.
          mn     03/08/18 Update code to run at higher frequency

## Functions
int | SysMonPsuSingleChannelIntrExample (XScuGic *XScuGicInstancePtr, 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 Single Channel Interrupt example. More...

## Function Documentation

int main | ( | void |  | ) |

Main function that invokes the Single Channel Interrupt example.

Parameters

  None. |

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

Note
  None.

References SysMonPsuSingleChannelIntrExample().

int SysMonPsuSingleChannelIntrExample | ( | XScuGic * | XScuGicInstancePtr,
|  | 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 alarm for VCCINT
- Set up the configuration registers for single channel continuous mode for VCCINT channel
- Setup interrupt system
- Enable interrupts
- Wait until the VCCINT alarm interrupt occurs

Parameters

  XScuGicInstancePtr | is a pointer to the Interrupt Controller driver Instance.
  SysMonInstPtr | is a pointer to the XSysMon driver Instance.
  SysMonDeviceId | is the XPAR_<SYSMON_instance>_DEVICE_ID value from xparameters.h.
  SysMonIntrId | is XPAR_<SYSMON_instance>_VEC_ID 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_CH_SUPPLY1, XSM_SEQ_MODE_SINGCHAN, XSysMonPsu_CfgInitialize(), XSysMonPsu_GetAdcData(), XSysMonPsu_IntrClear(), XSysMonPsu_IntrDisable(), XSysMonPsu_IntrEnable(), XSysMonPsu_IntrGetStatus(), XSysMonPsu_LookupConfig(), XSysMonPsu_SelfTest(), XSysMonPsu_SetAlarmEnables(), XSysMonPsu_SetAlarmThreshold(), XSysMonPsu_SetSequencerMode(), and XSysMonPsu_SetSingleChParams().

Referenced by main().