rtcpsu
Xilinx SDK Drivers API Documentation
Rtcpsu_v1_6

Data Structures

struct  XRtcPsu_Config
 This typedef contains configuration information for a device. More...
 
struct  XRtcPsu
 The XRtcPsu driver instance data. More...
 
struct  XRtcPsu_DT
 This typedef contains DateTime format structure. More...
 

Macros

#define XRTCPSU_CRYSTAL_OSC_EN   ((u32)1 << XRTC_CTL_OSC_SHIFT)
 Separate Mask for Crystal oscillator bit Enable. More...
 
#define XRtcPsu_WriteSetTime(InstancePtr, Time)
 This macro updates the current time of RTC device. More...
 
#define XRtcPsu_GetLastSetTime(InstancePtr)
 This macro returns the last set time of RTC device. More...
 
#define XRtcPsu_GetCalibration(InstancePtr)   XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr+XRTC_CALIB_RD_OFFSET)
 This macro returns the calibration value of RTC device. More...
 
#define XRtcPsu_ReadCurrentTime(InstancePtr)   XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr+XRTC_CUR_TIME_OFFSET)
 This macro returns the current time of RTC device. More...
 
#define XRtcPsu_SetControlRegister(InstancePtr, Value)
 This macro sets the control register value of RTC device. More...
 
#define XRtcPsu_GetSafetyCheck(InstancePtr)   XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr+XRTC_SFTY_CHK_OFFSET)
 This macro returns the safety check register value of RTC device. More...
 
#define XRtcPsu_SetSafetyCheck(InstancePtr, Value)
 This macro sets the safety check register value of RTC device. More...
 
#define XRtcPsu_ResetAlarm(InstancePtr)
 This macro resets the alarm register. More...
 
#define XRtcPsu_RoundOff(Number)
 This macro rounds off the given number. More...
 
#define XRTC_BASEADDR   0xFFA60000U
 Xrtc Base Address. More...
 
#define XRTC_SET_TIME_WR_OFFSET   0x00000000U
 Register: XrtcSetTimeWr. More...
 
#define XRTC_SET_TIME_RD_OFFSET   0x00000004U
 Register: XrtcSetTimeRd. More...
 
#define XRTC_CALIB_WR_OFFSET   0x00000008U
 Register: XrtcCalibWr. More...
 
#define XRTC_CALIB_RD_OFFSET   0x0000000CU
 Register: XrtcCalibRd. More...
 
#define XRTC_CUR_TIME_OFFSET   0x00000010U
 Register: XrtcCurTime. More...
 
#define XRTC_CUR_TCK_OFFSET   0x00000014U
 Register: XrtcCurTck. More...
 
#define XRTC_ALRM_OFFSET   0x00000018U
 Register: XrtcAlrm. More...
 
#define XRTC_INT_STS_OFFSET   0x00000020U
 Register: XrtcIntSts. More...
 
#define XRTC_INT_MSK_OFFSET   0x00000024U
 Register: XrtcIntMsk. More...
 
#define XRTC_INT_EN_OFFSET   0x00000028U
 Register: XrtcIntEn. More...
 
#define XRTC_INT_DIS_OFFSET   0x0000002CU
 Register: XrtcIntDis. More...
 
#define XRTC_ADD_ERR_OFFSET   0x00000030U
 Register: XrtcAddErr. More...
 
#define XRTC_ADD_ERR_INT_MSK_OFFSET   0x00000034U
 Register: XrtcAddErrIntMsk. More...
 
#define XRTC_ADD_ERR_INT_EN_OFFSET   0x00000038U
 Register: XrtcAddErrIntEn. More...
 
#define XRTC_ADD_ERR_INT_DIS_OFFSET   0x0000003CU
 Register: XrtcAddErrIntDis. More...
 
#define XRTC_CTL_OFFSET   0x00000040U
 Register: XrtcCtl. More...
 
#define XRTC_SFTY_CHK_OFFSET   0x00000050U
 Register: XrtcSftyChk. More...
 
#define XRTC_ECO_OFFSET   0x00000060U
 Register: XrtcEco. More...
 
#define XRtcPsu_ReadReg(RegisterAddr)   Xil_In32(RegisterAddr)
 This macro reads the given register. More...
 
#define XRtcPsu_WriteReg(RegisterAddr, Data)   Xil_Out32(RegisterAddr, (u32)(Data))
 This macro writes the given register. More...
 

Typedefs

typedef void(* XRtcPsu_Handler) (void *CallBackRef, u32 Event)
 This data type defines a handler that an application defines to communicate with interrupt system to retrieve state information about an application. More...
 

Functions

void XRtcPsu_SetTime (XRtcPsu *InstancePtr, u32 Time)
 This function sets the RTC time by writing into rtc write register. More...
 
u32 XRtcPsu_GetCurrentTime (XRtcPsu *InstancePtr)
 This function gets the current RTC time. More...
 
void XRtcPsu_SetAlarm (XRtcPsu *InstancePtr, u32 Alarm, u32 Periodic)
 This function sets the alarm value of RTC device. More...
 
void XRtcPsu_SecToDateTime (u32 Seconds, XRtcPsu_DT *dt)
 This function translates time in seconds to a YEAR:MON:DAY HR:MIN:SEC format and saves it in the DT structure variable. More...
 
u32 XRtcPsu_DateTimeToSec (XRtcPsu_DT *dt)
 This function translates time in YEAR:MON:DAY HR:MIN:SEC format to seconds. More...
 
void XRtcPsu_CalculateCalibration (XRtcPsu *InstancePtr, u32 TimeReal, u32 CrystalOscFreq)
 This function calculates the calibration value depending on the actual realworld time and also helps in deriving new calibration value if the user wishes to change his oscillator frequency.TimeReal is generally the internet time with EPOCH time as reference i.e.,1/1/1970 1st second. More...
 
u32 XRtcPsu_IsSecondsEventGenerated (XRtcPsu *InstancePtr)
 This function returns the seconds event status by reading interrupt status register. More...
 
u32 XRtcPsu_IsAlarmEventGenerated (XRtcPsu *InstancePtr)
 This function returns the alarm event status by reading interrupt status register. More...
 
void XRtcPsu_SetInterruptMask (XRtcPsu *InstancePtr, u32 Mask)
 This function sets the interrupt mask. More...
 
void XRtcPsu_ClearInterruptMask (XRtcPsu *InstancePtr, u32 Mask)
 This function clears the interrupt mask. More...
 
void XRtcPsu_InterruptHandler (XRtcPsu *InstancePtr)
 This function is the interrupt handler for the driver. More...
 
void XRtcPsu_SetHandler (XRtcPsu *InstancePtr, XRtcPsu_Handler FuncPtr, void *CallBackRef)
 This function sets the handler that will be called when an event (interrupt) occurs that needs application's attention. More...
 
s32 XRtcPsu_SelfTest (XRtcPsu *InstancePtr)
 This function runs a self-test on the driver and hardware device. More...
 
XRtcPsu_ConfigXRtcPsu_LookupConfig (u16 DeviceId)
 This function looks for the device configuration based on the unique device ID. More...
 

Variables

XRtcPsu_Config XRtcPsu_ConfigTable [XPAR_XRTCPSU_NUM_INSTANCES]
 This table contains configuration information for RTC device in the system. More...
 
XRtcPsu_Config XRtcPsu_ConfigTable []
 This table contains configuration information for RTC device in the system. More...
 

Callback events

These constants specify the handler events that an application can handle using its specific handler function.

Note that these constants are not bit mask, so only one event can be passed to an application at a time.

#define XRTCPSU_EVENT_ALARM_GEN   1U
 Alarm generated event. More...
 
#define XRTCPSU_EVENT_SECS_GEN   2U
 A new second generated event. More...
 

Macro Definition Documentation

◆ XRTC_ADD_ERR_INT_DIS_OFFSET

#define XRTC_ADD_ERR_INT_DIS_OFFSET   0x0000003CU

#include <xrtcpsu_hw.h>

Register: XrtcAddErrIntDis.

◆ XRTC_ADD_ERR_INT_EN_OFFSET

#define XRTC_ADD_ERR_INT_EN_OFFSET   0x00000038U

#include <xrtcpsu_hw.h>

Register: XrtcAddErrIntEn.

◆ XRTC_ADD_ERR_INT_MSK_OFFSET

#define XRTC_ADD_ERR_INT_MSK_OFFSET   0x00000034U

#include <xrtcpsu_hw.h>

Register: XrtcAddErrIntMsk.

◆ XRTC_ADD_ERR_OFFSET

#define XRTC_ADD_ERR_OFFSET   0x00000030U

#include <xrtcpsu_hw.h>

Register: XrtcAddErr.

◆ XRTC_ALRM_OFFSET

#define XRTC_ALRM_OFFSET   0x00000018U

#include <xrtcpsu_hw.h>

Register: XrtcAlrm.

Referenced by XRtcPsu_SetAlarm().

◆ XRTC_BASEADDR

#define XRTC_BASEADDR   0xFFA60000U

#include <xrtcpsu_hw.h>

Xrtc Base Address.

◆ XRTC_CALIB_RD_OFFSET

#define XRTC_CALIB_RD_OFFSET   0x0000000CU

#include <xrtcpsu_hw.h>

Register: XrtcCalibRd.

◆ XRTC_CALIB_WR_OFFSET

#define XRTC_CALIB_WR_OFFSET   0x00000008U

#include <xrtcpsu_hw.h>

Register: XrtcCalibWr.

Referenced by XRtcPsu_SetTime().

◆ XRTC_CTL_OFFSET

#define XRTC_CTL_OFFSET   0x00000040U

#include <xrtcpsu_hw.h>

Register: XrtcCtl.

◆ XRTC_CUR_TCK_OFFSET

#define XRTC_CUR_TCK_OFFSET   0x00000014U

#include <xrtcpsu_hw.h>

Register: XrtcCurTck.

◆ XRTC_CUR_TIME_OFFSET

#define XRTC_CUR_TIME_OFFSET   0x00000010U

#include <xrtcpsu_hw.h>

Register: XrtcCurTime.

◆ XRTC_ECO_OFFSET

#define XRTC_ECO_OFFSET   0x00000060U

#include <xrtcpsu_hw.h>

Register: XrtcEco.

◆ XRTC_INT_DIS_OFFSET

#define XRTC_INT_DIS_OFFSET   0x0000002CU

#include <xrtcpsu_hw.h>

Register: XrtcIntDis.

Referenced by XRtcPsu_ClearInterruptMask().

◆ XRTC_INT_EN_OFFSET

#define XRTC_INT_EN_OFFSET   0x00000028U

#include <xrtcpsu_hw.h>

Register: XrtcIntEn.

◆ XRTC_INT_MSK_OFFSET

#define XRTC_INT_MSK_OFFSET   0x00000024U

#include <xrtcpsu_hw.h>

Register: XrtcIntMsk.

Referenced by XRtcPsu_GetCurrentTime(), and XRtcPsu_InterruptHandler().

◆ XRTC_INT_STS_OFFSET

#define XRTC_INT_STS_OFFSET   0x00000020U

◆ XRTC_SET_TIME_RD_OFFSET

#define XRTC_SET_TIME_RD_OFFSET   0x00000004U

#include <xrtcpsu_hw.h>

Register: XrtcSetTimeRd.

◆ XRTC_SET_TIME_WR_OFFSET

#define XRTC_SET_TIME_WR_OFFSET   0x00000000U

#include <xrtcpsu_hw.h>

Register: XrtcSetTimeWr.

◆ XRTC_SFTY_CHK_OFFSET

#define XRTC_SFTY_CHK_OFFSET   0x00000050U

#include <xrtcpsu_hw.h>

Register: XrtcSftyChk.

Referenced by XRtcPsu_SelfTest().

◆ XRTCPSU_CRYSTAL_OSC_EN

#define XRTCPSU_CRYSTAL_OSC_EN   ((u32)1 << XRTC_CTL_OSC_SHIFT)

#include <xrtcpsu.h>

Separate Mask for Crystal oscillator bit Enable.

◆ XRTCPSU_EVENT_ALARM_GEN

#define XRTCPSU_EVENT_ALARM_GEN   1U

#include <xrtcpsu.h>

Alarm generated event.

Referenced by Handler().

◆ XRTCPSU_EVENT_SECS_GEN

#define XRTCPSU_EVENT_SECS_GEN   2U

#include <xrtcpsu.h>

A new second generated event.

Referenced by Handler().

◆ XRtcPsu_GetCalibration

#define XRtcPsu_GetCalibration (   InstancePtr)    XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr+XRTC_CALIB_RD_OFFSET)

#include <xrtcpsu.h>

This macro returns the calibration value of RTC device.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
Calibration value for RTC.
Note
C-Style signature: u32 XRtcPsu_GetCalibration(XRtcPsu *InstancePtr)

Referenced by XRtcPsu_CalculateCalibration().

◆ XRtcPsu_GetLastSetTime

#define XRtcPsu_GetLastSetTime (   InstancePtr)

#include <xrtcpsu.h>

Value:
XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr + \
#define XRTC_SET_TIME_RD_OFFSET
Register: XrtcSetTimeRd.
Definition: xrtcpsu_hw.h:86
#define XRtcPsu_ReadReg(RegisterAddr)
This macro reads the given register.
Definition: xrtcpsu_hw.h:335

This macro returns the last set time of RTC device.

Whenever a reset happens, the last set time will be zeroth day first sec.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
The last set time in seconds.
Note
C-Style signature: u32 XRtcPsu_GetLastSetTime(XRtcPsu *InstancePtr)

Referenced by XRtcPsu_CalculateCalibration().

◆ XRtcPsu_GetSafetyCheck

#define XRtcPsu_GetSafetyCheck (   InstancePtr)    XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr+XRTC_SFTY_CHK_OFFSET)

#include <xrtcpsu.h>

This macro returns the safety check register value of RTC device.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
Safety check register value.
Note
C-Style signature: u32 XRtcPsu_GetSafetyCheck(XRtcPsu *InstancePtr)

◆ XRtcPsu_ReadCurrentTime

#define XRtcPsu_ReadCurrentTime (   InstancePtr)    XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr+XRTC_CUR_TIME_OFFSET)

#include <xrtcpsu.h>

This macro returns the current time of RTC device.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
Current Time. This current time will be in seconds.
Note
C-Style signature: u32 XRtcPsu_ReadCurrentTime(XRtcPsu *InstancePtr)

◆ XRtcPsu_ReadReg

#define XRtcPsu_ReadReg (   RegisterAddr)    Xil_In32(RegisterAddr)

#include <xrtcpsu_hw.h>

This macro reads the given register.

Parameters
RegisterAddris the register address in the address space of the RTC device.
Returns
The 32-bit value of the register
Note
None.

Referenced by XRtcPsu_GetCurrentTime(), XRtcPsu_InterruptHandler(), XRtcPsu_IsAlarmEventGenerated(), and XRtcPsu_IsSecondsEventGenerated().

◆ XRtcPsu_ResetAlarm

#define XRtcPsu_ResetAlarm (   InstancePtr)

#include <xrtcpsu.h>

Value:
XRtcPsu_WriteReg((InstancePtr)->RtcConfig.BaseAddr + \
XRTC_ALRM_OFFSET, XRTC_ALRM_RSTVAL)
#define XRTC_ALRM_OFFSET
Register: XrtcAlrm.
Definition: xrtcpsu_hw.h:161
#define XRtcPsu_WriteReg(RegisterAddr, Data)
This macro writes the given register.
Definition: xrtcpsu_hw.h:351

This macro resets the alarm register.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
None.
Note
C-Style signature: u32 XRtcPsu_ResetAlarm(XRtcPsu *InstancePtr)

◆ XRtcPsu_RoundOff

#define XRtcPsu_RoundOff (   Number)

#include <xrtcpsu.h>

Value:
(u32)(((Number) < (u32)0) ? ((Number) - (u32)0.5) : \
((Number) + (u32)0.5))

This macro rounds off the given number.

Parameters
Numberis the one that needs to be rounded off..
Returns
The rounded off value of the input number.
Note
C-Style signature: u32 XRtcPsu_RoundOff(float Number)

◆ XRtcPsu_SetControlRegister

#define XRtcPsu_SetControlRegister (   InstancePtr,
  Value 
)

#include <xrtcpsu.h>

Value:
XRtcPsu_WriteReg((InstancePtr)->RtcConfig.BaseAddr + \
XRTC_CTL_OFFSET, (Value))
#define XRtcPsu_WriteReg(RegisterAddr, Data)
This macro writes the given register.
Definition: xrtcpsu_hw.h:351
#define XRTC_CTL_OFFSET
Register: XrtcCtl.
Definition: xrtcpsu_hw.h:280

This macro sets the control register value of RTC device.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Valueis the desired control register value for RTC.
Returns
None.
Note
C-Style signature: void XRtcPsu_SetControlRegister(XRtcPsu *InstancePtr, u32 Value)

◆ XRtcPsu_SetSafetyCheck

#define XRtcPsu_SetSafetyCheck (   InstancePtr,
  Value 
)

#include <xrtcpsu.h>

Value:
XRtcPsu_WriteReg((InstancePtr)->RtcConfig.BaseAddr + \
#define XRtcPsu_WriteReg(RegisterAddr, Data)
This macro writes the given register.
Definition: xrtcpsu_hw.h:351
#define XRTC_SFTY_CHK_OFFSET
Register: XrtcSftyChk.
Definition: xrtcpsu_hw.h:301

This macro sets the safety check register value of RTC device.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Valueis a safety check value to be written in register.
Returns
None.
Note
C-Style signature: void XRtcPsu_SetSafetyCheck(XRtcPsu *InstancePtr, u32 Value)

◆ XRtcPsu_WriteReg

#define XRtcPsu_WriteReg (   RegisterAddr,
  Data 
)    Xil_Out32(RegisterAddr, (u32)(Data))

#include <xrtcpsu_hw.h>

This macro writes the given register.

Parameters
RegisterAddris the register address in the address space of the RTC device.
Datais the 32-bit value to write to the register.
Returns
None.
Note
None.

Referenced by XRtcPsu_ClearInterruptMask(), XRtcPsu_InterruptHandler(), XRtcPsu_SelfTest(), XRtcPsu_SetAlarm(), XRtcPsu_SetInterruptMask(), and XRtcPsu_SetTime().

◆ XRtcPsu_WriteSetTime

#define XRtcPsu_WriteSetTime (   InstancePtr,
  Time 
)

#include <xrtcpsu.h>

Value:
XRtcPsu_WriteReg(((InstancePtr)->RtcConfig.BaseAddr + \
#define XRtcPsu_WriteReg(RegisterAddr, Data)
This macro writes the given register.
Definition: xrtcpsu_hw.h:351
#define XRTC_SET_TIME_WR_OFFSET
Register: XrtcSetTimeWr.
Definition: xrtcpsu_hw.h:75

This macro updates the current time of RTC device.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Timeis the desired time for RTC in seconds.
Returns
None.
Note
C-Style signature: void XRtcPsu_SetTime(XRtcPsu *InstancePtr, u32 Time)

Typedef Documentation

◆ XRtcPsu_Handler

typedef void(* XRtcPsu_Handler) (void *CallBackRef, u32 Event)

#include <xrtcpsu.h>

This data type defines a handler that an application defines to communicate with interrupt system to retrieve state information about an application.

Parameters
CallBackRefis a callback reference passed in by the upper layer when setting the handler, and is passed back to the upper layer when the handler is called. It is used to find the device driver instance.
Eventcontains one of the event constants indicating events that have occurred.
EventDatacontains the number of bytes sent or received at the time of the call for send and receive events and contains the modem status for modem events.

Function Documentation

◆ XRtcPsu_CalculateCalibration()

void XRtcPsu_CalculateCalibration ( XRtcPsu InstancePtr,
u32  TimeReal,
u32  CrystalOscFreq 
)

#include <xrtcpsu.c>

This function calculates the calibration value depending on the actual realworld time and also helps in deriving new calibration value if the user wishes to change his oscillator frequency.TimeReal is generally the internet time with EPOCH time as reference i.e.,1/1/1970 1st second.

But this RTC driver assumes start time from 1/1/2000 1st second. Hence,if the user maps the internet time InternetTimeInSecs, then he has to use XRtcPsu_SecToDateTime(InternetTimeInSecs,&InternetTime), TimeReal = XRtcPsu_DateTimeToSec(InternetTime) consecutively to arrive at TimeReal value.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
TimeRealis the actual realworld time generally an network time / Internet time in seconds.
CrystalOscFreqis the Oscillator new frequency. Say, If the user is going with the typical 32768Hz, then he inputs the same frequency value.
Returns
None.
Note
After Calculating the calibration register, user / application has to call again CfgInitialize API to bring the new calibration into effect.

References XRtcPsu_GetCalibration, XRtcPsu_GetCurrentTime(), and XRtcPsu_GetLastSetTime.

◆ XRtcPsu_ClearInterruptMask()

void XRtcPsu_ClearInterruptMask ( XRtcPsu InstancePtr,
u32  Mask 
)

#include <xrtcpsu.h>

This function clears the interrupt mask.

Parameters
InstancePtris a pointer to the XRtcPsu instance
Maskcontains the interrupts to be disabled. A '1' enables an interrupt, and a '0' disables.
Returns
None.
Note
None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_INT_DIS_OFFSET, and XRtcPsu_WriteReg.

◆ XRtcPsu_DateTimeToSec()

u32 XRtcPsu_DateTimeToSec ( XRtcPsu_DT dt)

#include <xrtcpsu.c>

This function translates time in YEAR:MON:DAY HR:MIN:SEC format to seconds.

Parameters
dtis a pointer to a DatetTime format structure variable of time that has to be shown in seconds.
Returns
Seconds value of provided in dt time.
Note
None.

◆ XRtcPsu_GetCurrentTime()

u32 XRtcPsu_GetCurrentTime ( XRtcPsu InstancePtr)

#include <xrtcpsu.c>

This function gets the current RTC time.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
RTC Current time.
Note
None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_INT_MSK_OFFSET, and XRtcPsu_ReadReg.

Referenced by XRtcPsu_CalculateCalibration(), and XRtcPsu_SetAlarm().

◆ XRtcPsu_InterruptHandler()

void XRtcPsu_InterruptHandler ( XRtcPsu InstancePtr)

#include <xrtcpsu.h>

This function is the interrupt handler for the driver.

It must be connected to an interrupt system by the application such that it can be called when an interrupt occurs.

Parameters
InstancePtrcontains a pointer to the driver instance
Returns
None.
Note
None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::IsReady, XRtcPsu::RtcConfig, XRTC_INT_MSK_OFFSET, XRTC_INT_STS_OFFSET, XRtcPsu_ReadReg, and XRtcPsu_WriteReg.

◆ XRtcPsu_IsAlarmEventGenerated()

u32 XRtcPsu_IsAlarmEventGenerated ( XRtcPsu InstancePtr)

#include <xrtcpsu.c>

This function returns the alarm event status by reading interrupt status register.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
Returns 1 if the alarm event is generated.Else 0.
Note
This API is used in polled mode operation of RTC. This also clears interrupt status alarm bit.

References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_INT_STS_OFFSET, and XRtcPsu_ReadReg.

◆ XRtcPsu_IsSecondsEventGenerated()

u32 XRtcPsu_IsSecondsEventGenerated ( XRtcPsu InstancePtr)

#include <xrtcpsu.c>

This function returns the seconds event status by reading interrupt status register.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Returns
Returns 1 if a new second event is generated.Else 0..
Note
This API is used in polled mode operation of RTC. This also clears interrupt status seconds bit.

References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_INT_STS_OFFSET, and XRtcPsu_ReadReg.

◆ XRtcPsu_LookupConfig()

XRtcPsu_Config * XRtcPsu_LookupConfig ( u16  DeviceId)

#include <xrtcpsu.h>

This function looks for the device configuration based on the unique device ID.

The table XRtcPsu_ConfigTable[] contains the configuration information for each device in the system.

Parameters
DeviceIdis the unique device ID of the device being looked up.
Returns
A pointer to the configuration table entry corresponding to the given device ID, or NULL if no match is found.
Note
None.

Referenced by RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().

◆ XRtcPsu_SecToDateTime()

void XRtcPsu_SecToDateTime ( u32  Seconds,
XRtcPsu_DT dt 
)

#include <xrtcpsu.c>

This function translates time in seconds to a YEAR:MON:DAY HR:MIN:SEC format and saves it in the DT structure variable.

It also reports the weekday.

Parameters
Secondsis the time value that has to be shown in DateTime format.
dtis the DateTime format variable that stores the translated time.
Returns
None.
Note
This API supports this century i.e., 2000 - 2099 years only.

◆ XRtcPsu_SelfTest()

s32 XRtcPsu_SelfTest ( XRtcPsu InstancePtr)

#include <xrtcpsu.h>

This function runs a self-test on the driver and hardware device.

This self test writes reset value into safety check register and read backs the same. If mismatch offers, returns the failure.

Parameters
InstancePtris a pointer to the XRtcPsu instance
Returns
  • XST_SUCCESS if the test was successful
Note

This function can hang if the hardware is not functioning properly.

References XRtcPsu_Config::BaseAddr, XRtcPsu::IsReady, XRtcPsu::RtcConfig, XRTC_SFTY_CHK_OFFSET, and XRtcPsu_WriteReg.

◆ XRtcPsu_SetAlarm()

void XRtcPsu_SetAlarm ( XRtcPsu InstancePtr,
u32  Alarm,
u32  Periodic 
)

#include <xrtcpsu.c>

This function sets the alarm value of RTC device.

Parameters
InstancePtris a pointer to the XRtcPsu instance
Alarmis the desired alarm time for RTC.
Periodicsays whether the alarm need to set at periodic Intervals or a one-time alarm.
Returns
None.
Note
None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::IsReady, XRtcPsu::RtcConfig, XRTC_ALRM_OFFSET, XRtcPsu_GetCurrentTime(), and XRtcPsu_WriteReg.

◆ XRtcPsu_SetHandler()

void XRtcPsu_SetHandler ( XRtcPsu InstancePtr,
XRtcPsu_Handler  FuncPtr,
void *  CallBackRef 
)

#include <xrtcpsu.h>

This function sets the handler that will be called when an event (interrupt) occurs that needs application's attention.

Parameters
InstancePtris a pointer to the XRtcPsu instance
FuncPtris the pointer to the callback function.
CallBackRefis the upper layer callback reference passed back when the callback function is invoked.
Returns
None.
Note

There is no assert on the CallBackRef since the driver doesn't know what it is (nor should it)

References XRtcPsu::CallBackRef, and XRtcPsu::IsReady.

◆ XRtcPsu_SetInterruptMask()

void XRtcPsu_SetInterruptMask ( XRtcPsu InstancePtr,
u32  Mask 
)

#include <xrtcpsu.h>

This function sets the interrupt mask.

Parameters
InstancePtris a pointer to the XRtcPsu instance
Maskcontains the interrupts to be enabled. A '1' enables an interupt, and a '0' disables.
Returns
None.
Note
None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_INT_STS_OFFSET, and XRtcPsu_WriteReg.

◆ XRtcPsu_SetTime()

void XRtcPsu_SetTime ( XRtcPsu InstancePtr,
u32  Time 
)

#include <xrtcpsu.c>

This function sets the RTC time by writing into rtc write register.

Parameters
InstancePtris a pointer to the XRtcPsu instance.
Timethat should be updated into RTC write register.
Returns
None.
Note
None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_CALIB_WR_OFFSET, XRTC_INT_STS_OFFSET, and XRtcPsu_WriteReg.

Variable Documentation

◆ XRtcPsu_ConfigTable [1/2]

XRtcPsu_Config XRtcPsu_ConfigTable[]

#include <xrtcpsu_sinit.c>

This table contains configuration information for RTC device in the system.

◆ XRtcPsu_ConfigTable [2/2]

XRtcPsu_Config XRtcPsu_ConfigTable[XPAR_XRTCPSU_NUM_INSTANCES]

#include <xrtcpsu_g.c>

Initial value:
= {
{
(u16)XPAR_XRTCPSU_0_DEVICE_ID,
(u32)XPAR_XRTCPSU_0_BASEADDR
}
}

This table contains configuration information for RTC device in the system.