XilinxProcessorIPLib/drivers/rtcpsu/examples/xrtcpsu_seconds_interrupt_example.c
int RtcPsuSecondsIntrExample(XScuGic *IntcInstPtr, XRtcPsu *RtcInstPtr,
			u16 DeviceId, u16 RtcIntrId)
{
	int Status;
	XRtcPsu_Config *Config;

	/*
	 * Initialize the RTC driver so that it's ready to use
	 * Look up the configuration in the config table, then initialize it.
	 */
	Config = XRtcPsu_LookupConfig(DeviceId);
	if (NULL == Config) {
		return XST_FAILURE;
	}

	Status = XRtcPsu_CfgInitialize(RtcInstPtr, Config, Config->BaseAddr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/* Check hardware build */
	Status = XRtcPsu_SelfTest(RtcInstPtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Connect the RTC to the interrupt subsystem such that interrupts
	 * can occur. This function is application specific.
	 */
	Status = SetupInterruptSystem(IntcInstPtr, RtcInstPtr, RtcIntrId);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Setup the handlers for the RTC that will be called from the
	 * interrupt context when alarm and seconds interrupts are raised,
	 * specify a pointer to the RTC driver instance as the callback reference
	 * so the handlers are able to access the instance data
	 */
	XRtcPsu_SetHandler(RtcInstPtr, (XRtcPsu_Handler)Handler, RtcInstPtr);

	/*
	 * Enable the interrupt of the RTC device so interrupts will occur.
	 */
	XRtcPsu_SetInterruptMask(RtcInstPtr,XRTC_INT_EN_SECS_MASK);

	while( Seconds != REPETATIONS);

	/*
	 * Disable the interrupt of the RTC device so interrupts will not occur.
	 */
	XRtcPsu_ClearInterruptMask(RtcInstPtr,XRTC_INT_DIS_SECS_MASK);

	return XST_SUCCESS;
}
/**************************************************************************/
/**
*
* 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..
*
* @param	IntcInstPtr is a pointer to the instance of the ScuGic driver.
* @param	RtcInstPtr is a pointer to the instance of the RTC driver
*		which is going to be connected to the interrupt controller.
* @param	DeviceId is the device Id of the RTC device and is typically
*		XPAR_<RTCPSU_instance>_DEVICE_ID value from xparameters.h.
* @param	RtcIntrId is the interrupt Id and is typically
*		XPAR_<RTCPSU_instance>_INTR value from xparameters.h.
*
* @return	XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note
*
* In this function ,if interrupts are not working it may never return.
*
**************************************************************************/
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
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
int RtcPsuSecondsIntrExample(XScuGic *IntcInstPtr, XRtcPsu *RtcInstPtr,
			u16 DeviceId, u16 RtcIntrId)
{
	int Status;
	XRtcPsu_Config *Config;
	Config = XRtcPsu_LookupConfig(DeviceId);
	if (NULL == Config) {
		return XST_FAILURE;
	}
	Status = XRtcPsu_CfgInitialize(RtcInstPtr, Config, Config->BaseAddr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XRtcPsu_SelfTest(RtcInstPtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = SetupInterruptSystem(IntcInstPtr, RtcInstPtr, RtcIntrId);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XRtcPsu_SetHandler(RtcInstPtr, (XRtcPsu_Handler)Handler, RtcInstPtr);
	XRtcPsu_SetInterruptMask(RtcInstPtr,XRTC_INT_EN_SECS_MASK);
	while( Seconds != REPETATIONS);
	XRtcPsu_ClearInterruptMask(RtcInstPtr,XRTC_INT_DIS_SECS_MASK);
	return XST_SUCCESS;
}
int RtcPsuSecondsIntrExample ( XScuGic * IntcInstPtr , XRtcPsu * RtcInstPtr , u16 DeviceId , u16 RtcIntrId ) { int Status ; XRtcPsu_Config * Config ; Config = XRtcPsu_LookupConfig ( DeviceId ) ; if ( NULL == Config ) { return XST_FAILURE ; } Status = XRtcPsu_CfgInitialize ( RtcInstPtr , Config , Config -> BaseAddr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = XRtcPsu_SelfTest ( RtcInstPtr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = SetupInterruptSystem ( IntcInstPtr , RtcInstPtr , RtcIntrId ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XRtcPsu_SetHandler ( RtcInstPtr , ( XRtcPsu_Handler ) Handler , RtcInstPtr ) ; XRtcPsu_SetInterruptMask ( RtcInstPtr , XRTC_INT_EN_SECS_MASK ) ; while ( Seconds != REPETATIONS ) ; XRtcPsu_ClearInterruptMask ( RtcInstPtr , XRTC_INT_DIS_SECS_MASK ) ; return XST_SUCCESS ; }
This function does a minimal test on the Rtc device and driver as a
design example.
This function does a minimal test on the Rtc device and driver as a design example .
/*
	 * Initialize the RTC driver so that it's ready to use
	 * Look up the configuration in the config table, then initialize it.
	 */ /* Check hardware build */ /*
	 * Connect the RTC to the interrupt subsystem such that interrupts
	 * can occur. This function is application specific.
	 */ /*
	 * Setup the handlers for the RTC that will be called from the
	 * interrupt context when alarm and seconds interrupts are raised,
	 * specify a pointer to the RTC driver instance as the callback reference
	 * so the handlers are able to access the instance data
	 */ /*
	 * Enable the interrupt of the RTC device so interrupts will occur.
	 */ /*
	 * Disable the interrupt of the RTC device so interrupts will not occur.
	 */