sysmon
Xilinx SDK Drivers API Documentation
xsysmon_single_ch_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 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.00a sv 09/04/07 First release 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. 7.3 vns 15/04/16 Updated example to support ZynqMP 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.

Functions

int SysMonSingleChannelIntrExample (INTC *IntcInstancePtr, XSysMon *SysMonInstPtr, u16 SysMonDeviceId, u16 SysMonIntrId)
 This function runs a test on the System Monitor/ADC 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 SysMonSingleChannelIntrExample().

int SysMonSingleChannelIntrExample ( INTC *  IntcInstancePtr,
XSysMon SysMonInstPtr,
u16  SysMonDeviceId,
u16  SysMonIntrId 
)

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 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
IntcInstancePtris a pointer to the Interrupt Controller driver Instance.
SysMonInstPtris a pointer to the XSysMon driver Instance.
SysMonDeviceIdis the XPAR_<SYSMON_ADC_instance>_DEVICE_ID value from xparameters.h.
SysMonIntrIdis XPAR_<INTC_instance>_<SYSMON_ADC_instance>_VEC_ID value from xparameters.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 XSysMon_Config::BaseAddress, XSM_ATR_VCCINT_LOWER, XSM_ATR_VCCINT_UPPER, XSM_CFR1_ALM_VCCINT_MASK, XSM_CH_VCCINT, XSM_IPIXR_EOC_MASK, XSM_IPIXR_VCCINT_MASK, XSM_SEQ_MODE_SINGCHAN, XSysMon_CfgInitialize(), XSysMon_GetAdcData(), XSysMon_IntrClear(), XSysMon_IntrEnable(), XSysMon_IntrGetStatus(), XSysMon_IntrGlobalDisable(), XSysMon_IntrGlobalEnable(), XSysMon_LookupConfig(), XSysMon_SelfTest(), XSysMon_SetAdcClkDivisor(), XSysMon_SetAlarmEnables(), XSysMon_SetAlarmThreshold(), XSysMon_SetSequencerMode(), and XSysMon_SetSingleChParams().

Referenced by main().