rtcpsu: Rtcpsu_v1_8

| rtcpsu Xilinx SDK Drivers API Documentation

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

Data Structures | Macros | Typedefs | Functions | Variables
Rtcpsu_v1_8

## 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 )(const 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 (const XRtcPsu *InstancePtr)
| This function returns the seconds event status by reading interrupt status register. More...
u32 | XRtcPsu_IsAlarmEventGenerated (const XRtcPsu *InstancePtr)
| This function returns the alarm event status by reading interrupt status register. More...
void | XRtcPsu_SetInterruptMask (const XRtcPsu *InstancePtr, u32 Mask)
| This function sets the interrupt mask. More...
void | XRtcPsu_ClearInterruptMask (const 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 (const XRtcPsu *InstancePtr)
| This function runs a self-test on the driver and hardware device. More...
XRtcPsu_Config * | XRtcPsu_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 [XPAR_XRTCPSU_NUM_INSTANCES]
| 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

#define XRTC_ADD_ERR_INT_DIS_OFFSET 0x0000003CU

Register: XrtcAddErrIntDis.

#define XRTC_ADD_ERR_INT_EN_OFFSET 0x00000038U

Register: XrtcAddErrIntEn.

#define XRTC_ADD_ERR_INT_MSK_OFFSET 0x00000034U

Register: XrtcAddErrIntMsk.

#define XRTC_ADD_ERR_OFFSET 0x00000030U

Register: XrtcAddErr.

#define XRTC_ALRM_OFFSET 0x00000018U

Register: XrtcAlrm.

Referenced by XRtcPsu_SetAlarm().

#define XRTC_BASEADDR 0xFFA60000U

Xrtc Base Address.

#define XRTC_CALIB_RD_OFFSET 0x0000000CU

Register: XrtcCalibRd.

#define XRTC_CALIB_WR_OFFSET 0x00000008U

Register: XrtcCalibWr.

Referenced by XRtcPsu_SetTime().

#define XRTC_CTL_OFFSET 0x00000040U

Register: XrtcCtl.

#define XRTC_CUR_TCK_OFFSET 0x00000014U

Register: XrtcCurTck.

#define XRTC_CUR_TIME_OFFSET 0x00000010U

Register: XrtcCurTime.

#define XRTC_ECO_OFFSET 0x00000060U

Register: XrtcEco.

#define XRTC_INT_DIS_OFFSET 0x0000002CU

Register: XrtcIntDis.

Referenced by XRtcPsu_ClearInterruptMask().

#define XRTC_INT_EN_OFFSET 0x00000028U

Register: XrtcIntEn.

Referenced by XRtcPsu_SetInterruptMask().

#define XRTC_INT_MSK_OFFSET 0x00000024U

Register: XrtcIntMsk.

Referenced by XRtcPsu_GetCurrentTime(), and XRtcPsu_InterruptHandler().

#define XRTC_INT_STS_OFFSET 0x00000020U

Register: XrtcIntSts.

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

#define XRTC_SET_TIME_RD_OFFSET 0x00000004U

Register: XrtcSetTimeRd.

#define XRTC_SET_TIME_WR_OFFSET 0x00000000U

Register: XrtcSetTimeWr.

#define XRTC_SFTY_CHK_OFFSET 0x00000050U

Register: XrtcSftyChk.

Referenced by XRtcPsu_SelfTest().

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

Separate Mask for Crystal oscillator bit Enable.

#define XRTCPSU_EVENT_ALARM_GEN 1U

Alarm generated event.

Referenced by Handler(), and XRtcPsu_InterruptHandler().

#define XRTCPSU_EVENT_SECS_GEN 2U

A new second generated event.

Referenced by XRtcPsu_InterruptHandler().

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

This macro returns the calibration value of RTC device.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.

Returns
  Calibration value for RTC.

Note
  C-Style signature: u32 XRtcPsu_GetCalibration(XRtcPsu *InstancePtr)

Referenced by XRtcPsu_CalculateCalibration().

#define XRtcPsu_GetLastSetTime | ( |  | InstancePtr | ) |

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

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

  InstancePtr | is a pointer to the XRtcPsu instance.

Returns
  The last set time in seconds.

Note
  C-Style signature: u32 XRtcPsu_GetLastSetTime(XRtcPsu *InstancePtr)

Referenced by RtcPsuSetTimeExample(), XRtcPsu_CalculateCalibration(), and XRtcPsu_GetCurrentTime().

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

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

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.

Returns
  Safety check register value.

Note
  C-Style signature: u32 XRtcPsu_GetSafetyCheck(XRtcPsu *InstancePtr)

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

This macro returns the current time of RTC device.

Parameters

  InstancePtr | is 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)

Referenced by XRtcPsu_GetCurrentTime().

#define XRtcPsu_ReadReg | ( |  | RegisterAddr | ) | Xil_In32(RegisterAddr)

This macro reads the given register.

Parameters

  RegisterAddr | is 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(), XRtcPsu_IsSecondsEventGenerated(), and XRtcPsu_SelfTest().

#define XRtcPsu_ResetAlarm | ( |  | InstancePtr | ) |

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

This macro resets the alarm register.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.

Returns
  None.

Note
  C-Style signature: u32 XRtcPsu_ResetAlarm(XRtcPsu *InstancePtr)

Referenced by RtcPsuPeriodicAlarmIntrExample().

#define XRtcPsu_RoundOff | ( |  | Number | ) |

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

This macro rounds off the given number.

Parameters

  Number | is 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)

Referenced by XRtcPsu_CalculateCalibration().

#define XRtcPsu_SetControlRegister | ( |  | InstancePtr,
|  |  | Value
| ) |  |

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

This macro sets the control register value of RTC device.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.
  Value | is the desired control register value for RTC.

Returns
  None.

Note
  C-Style signature: void XRtcPsu_SetControlRegister(XRtcPsu *InstancePtr, u32 Value)

#define XRtcPsu_SetSafetyCheck | ( |  | InstancePtr,
|  |  | Value
| ) |  |

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

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

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.
  Value | is a safety check value to be written in register.

Returns
  None.

Note
  C-Style signature: void XRtcPsu_SetSafetyCheck(XRtcPsu *InstancePtr, u32 Value)

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

This macro writes the given register.

Parameters

  RegisterAddr | is the register address in the address space of the RTC device.
  Data | is the 32-bit value to write to the register.

Returns
  None.

Note
  None.

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

#define XRtcPsu_WriteSetTime | ( |  | InstancePtr,
|  |  | Time
| ) |  |

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

This macro updates the current time of RTC device.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.
  Time | is the desired time for RTC in seconds.

Returns
  None.

Note
  C-Style signature: void XRtcPsu_SetTime(XRtcPsu *InstancePtr, u32 Time)

Referenced by XRtcPsu_SetTime().

## Typedef Documentation

typedef void(* XRtcPsu_Handler)(const 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.

Parameters

  CallBackRef | is 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.
  Event | contains one of the event constants indicating events that have occurred.
  EventData | contains 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

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.

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

  InstancePtr | is a pointer to the XRtcPsu instance.
  TimeReal | is the actual realworld time generally an network time / Internet time in seconds.
  CrystalOscFreq | is 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(), XRtcPsu_GetLastSetTime, and XRtcPsu_RoundOff.

Referenced by RtcPsuSetCalibrationExample().

void XRtcPsu_ClearInterruptMask | ( | const XRtcPsu * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function clears the interrupt mask.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance
  Mask | contains 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.

Referenced by RtcPsuAlarmIntrExample(), RtcPsuPeriodicAlarmIntrExample(), and RtcPsuSecondsIntrExample().

u32 XRtcPsu_DateTimeToSec | ( | XRtcPsu_DT * | dt | ) |

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

Parameters

  dt | is 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.

Referenced by RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().

u32 XRtcPsu_GetCurrentTime | ( | XRtcPsu * | InstancePtr | ) |

This function gets the current RTC time.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.

Returns
  RTC Current time.

Note
  None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_INT_MSK_OFFSET, XRTC_INT_STS_OFFSET, XRtcPsu_GetLastSetTime, XRtcPsu_ReadCurrentTime, and XRtcPsu_ReadReg.

Referenced by RtcPsuAlarmIntrExample(), RtcPsuAlarmPolledExample(), RtcPsuPeriodicAlarmIntrExample(), RtcPsuSetTimeExample(), XRtcPsu_CalculateCalibration(), XRtcPsu_InterruptHandler(), and XRtcPsu_SetAlarm().

void XRtcPsu_InterruptHandler | ( | XRtcPsu * | InstancePtr | ) |

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

  InstancePtr | contains a pointer to the driver instance

Returns
  None.

Note
  None.

References XRtcPsu_Config::BaseAddr, XRtcPsu::CallBackRef, XRtcPsu::IsReady, XRtcPsu::RtcConfig, XRTC_INT_MSK_OFFSET, XRTC_INT_STS_OFFSET, XRTCPSU_EVENT_ALARM_GEN, XRTCPSU_EVENT_SECS_GEN, XRtcPsu_GetCurrentTime(), XRtcPsu_ReadReg, XRtcPsu_SetAlarm(), and XRtcPsu_WriteReg.

u32 XRtcPsu_IsAlarmEventGenerated | ( | const XRtcPsu * | InstancePtr | ) |

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

Parameters

  InstancePtr | is 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, XRtcPsu_ReadReg, and XRtcPsu_WriteReg.

Referenced by RtcPsuAlarmPolledExample().

u32 XRtcPsu_IsSecondsEventGenerated | ( | const XRtcPsu * | InstancePtr | ) |

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

Parameters

  InstancePtr | is 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, XRtcPsu_ReadReg, and XRtcPsu_WriteReg.

Referenced by RtcPsuSecondsPolledExample().

XRtcPsu_Config * XRtcPsu_LookupConfig | ( | u16 | DeviceId | ) |

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

  DeviceId | is 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 RtcPsuAlarmIntrExample(), RtcPsuAlarmPolledExample(), RtcPsuPeriodicAlarmIntrExample(), RtcPsuSecondsIntrExample(), RtcPsuSecondsPolledExample(), RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().

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.

     It also reports the weekday.

Parameters

  Seconds | is the time value that has to be shown in DateTime format.
  dt | is the DateTime format variable that stores the translated time.

Returns
  None.

Note
  This API supports this century i.e., 2000 - 2099 years only.

Referenced by RtcPsuAlarmIntrExample(), RtcPsuAlarmPolledExample(), RtcPsuPeriodicAlarmIntrExample(), and RtcPsuSetTimeExample().

s32 XRtcPsu_SelfTest | ( | const XRtcPsu * | InstancePtr | ) |

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

  InstancePtr | is 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, XRtcPsu_ReadReg, and XRtcPsu_WriteReg.

Referenced by RtcPsuAlarmIntrExample(), RtcPsuAlarmPolledExample(), RtcPsuPeriodicAlarmIntrExample(), RtcPsuSecondsIntrExample(), RtcPsuSecondsPolledExample(), RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().

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

This function sets the alarm value of RTC device.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance
  Alarm | is the desired alarm time for RTC.
  Periodic | says 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.

Referenced by RtcPsuAlarmIntrExample(), RtcPsuAlarmPolledExample(), RtcPsuPeriodicAlarmIntrExample(), and XRtcPsu_InterruptHandler().

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.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance
  FuncPtr | is the pointer to the callback function.
  CallBackRef | is 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.

Referenced by RtcPsuAlarmIntrExample(), RtcPsuPeriodicAlarmIntrExample(), and RtcPsuSecondsIntrExample().

void XRtcPsu_SetInterruptMask | ( | const XRtcPsu * | InstancePtr,
|  | u32 | Mask
| ) |  |

This function sets the interrupt mask.

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance
  Mask | contains 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_EN_OFFSET, XRTC_INT_STS_OFFSET, and XRtcPsu_WriteReg.

Referenced by RtcPsuAlarmIntrExample(), RtcPsuPeriodicAlarmIntrExample(), and RtcPsuSecondsIntrExample().

void XRtcPsu_SetTime | ( | XRtcPsu * | InstancePtr,
|  | u32 | Time
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XRtcPsu instance.
  Time | that 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, XRtcPsu_WriteReg, and XRtcPsu_WriteSetTime.

Referenced by RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().

## Variable Documentation

XRtcPsu_Config XRtcPsu_ConfigTable[XPAR_XRTCPSU_NUM_INSTANCES]

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

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

XRtcPsu_Config XRtcPsu_ConfigTable[XPAR_XRTCPSU_NUM_INSTANCES]

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