rtcpsu
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Groups Pages
xrtcpsu_seconds_interrupt_example.c File Reference

Overview

This file contains an seconds example using the XRtcPsu driver in interrupt mode.

Note
In the example,if interrupts are not working it may hang.

MODIFICATION HISTORY:

Ver   Who    Date     Changes


1.00 kvn 05/12/15 First Release ms 04/10/17 Modified filename tag to include the file in doxygen examples. 1.12 sne 04/25/22 Added volatile keyword for Seconds variable. 1.13 ht 06/21/23 Added support for system device-tree flow. 1.15 ht 12/13/24 Fix C++ compilation warnings and errors in SDT flow. 1.17 vlt 12/18/25 Update Doxygen comments to include SDT flow details.

#include "xparameters.h"
#include "xrtcpsu.h"
#include "xscugic.h"
#include "xil_exception.h"
#include "xil_printf.h"
#include "xinterrupt_wrap.h"

Functions

int RtcPsuSecondsIntrExample (XRtcPsu *RtcInstPtr, UINTPTR BaseAddress)
 This function does a minimal test on the Rtc device and driver as a design example. More...
 
void Handler (void *CallBackRef, u32 Event)
 This function is the handler which performs processing to handle interrupt events from the device. More...
 
int main (void)
 Main function to call the RTC Seconds interrupt example. More...
 

Function Documentation

void Handler ( void *  CallBackRef,
u32  Event 
)

This function is the handler which performs processing to handle interrupt events from the device.

It is called from an interrupt context. so the amount of processing should be minimal.

This handler provides an example of how to handle interrupt data for the device and is application specific.

Parameters
CallBackRefcontains a callback reference from the driver, in this case it is the instance pointer for the XRtcPsu driver.
Eventcontains the specific kind of event that has occurred.
Returns
None.
Note
None.
int main ( void  )

Main function to call the RTC Seconds interrupt example.

Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful
Note
None

References RtcPsuSecondsIntrExample().

int RtcPsuSecondsIntrExample ( XRtcPsu RtcInstPtr,
UINTPTR  BaseAddress 
)

This function does a minimal test on the Rtc device and driver as a design example.

The purpose of this function is to illustrate how to seconds feature is available in the XRtcPsu driver.

This function shows the seconds interrupt feature..

Parameters
RtcInstPtris a pointer to the instance of the RTC driver which is going to be connected to the interrupt controller.
BaseAddresscontains the base address of the device
RtcIntrIdis the interrupt Id and is typically XPAR_<RTCPSU_instance>_INTR value from xparameters.h.
Returns
XST_SUCCESS if successful, otherwise XST_FAILURE.
Note
- In XSCT/classic flow, DeviceId is used to look up the device configuration.
  • In this function ,if interrupts are not working it may never return.

References XRtcPsu_Config::BaseAddr, Handler(), XRtcPsu_Config::IntrId, XRtcPsu_Config::IntrParent, XRtcPsu_CfgInitialize(), XRtcPsu_ClearInterruptMask(), XRtcPsu_InterruptHandler(), XRtcPsu_LookupConfig(), XRtcPsu_SelfTest(), XRtcPsu_SetHandler(), and XRtcPsu_SetInterruptMask().

Referenced by main().