![]() |
rtcpsu
Vitis Drivers API Documentation
|
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 | XRTC_H_ |
< prevent circular inclusions More... | |
#define | XRTCPSU_CRYSTAL_OSC_EN ((u32)1 << XRTC_CTL_OSC_SHIFT) |
Separate Mask for Crystal oscillator bit Enable. More... | |
#define | XRTC_CALIBRATION_VALUE 0x7FFFU |
Calibration value. More... | |
#define | XRTC_TYPICAL_OSC_FREQ 32768U |
Oscillator frequency. 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_HW_H_ |
< prevent circular inclusions More... | |
#define | XRTC_BASEADDR 0xFFA60000U |
Xrtc Base Address. 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 | |
s32 | XRtcPsu_CfgInitialize (XRtcPsu *InstancePtr, XRtcPsu_Config *ConfigPtr, UINTPTR EffectiveAddr) |
This function initializes a XRtcPsu instance/driver. More... | |
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 FunctionPtr, 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_Config * | XRtcPsu_LookupConfig (u16 DeviceId) |
This function looks for the device configuration based on the unique device ID. More... | |
Variables | |
XRtcPsu_Config | XRtcPsu_ConfigTable [] |
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... | |
Set Timer Register | |
#define | XRTC_SET_TIME_WR_OFFSET 0x00000000U |
Register: XrtcSetTimeWr. More... | |
#define | XRTC_SET_TIME_WR_RSTVAL 0x00000000U |
#define | XRTC_SET_TIME_WR_VAL_SHIFT 0U |
#define | XRTC_SET_TIME_WR_VAL_WIDTH 32U |
#define | XRTC_SET_TIME_WR_VAL_MASK 0xffffffffU |
#define | XRTC_SET_TIME_WR_VAL_DEFVAL 0x0U |
#define | XRTC_SET_TIME_RD_OFFSET 0x00000004U |
Register: XrtcSetTimeRd. More... | |
#define | XRTC_SET_TIME_RD_RSTVAL 0x00000000U |
#define | XRTC_SET_TIME_RD_VAL_SHIFT 0U |
#define | XRTC_SET_TIME_RD_VAL_WIDTH 32U |
#define | XRTC_SET_TIME_RD_VAL_MASK 0xffffffffU |
#define | XRTC_SET_TIME_RD_VAL_DEFVAL 0x0U |
Calibration Register | |
This register contains bits for configuring Calibration values. | |
#define | XRTC_CALIB_WR_OFFSET 0x00000008U |
Register: XrtcCalibWr. More... | |
#define | XRTC_CALIB_WR_RSTVAL 0x00000000U |
#define | XRTC_CALIB_WR_FRACTN_EN_SHIFT 20U |
#define | XRTC_CALIB_WR_FRACTN_EN_WIDTH 1U |
#define | XRTC_CALIB_WR_FRACTN_EN_MASK 0x00100000U |
#define | XRTC_CALIB_WR_FRACTN_EN_DEFVAL 0x0U |
#define | XRTC_CALIB_WR_FRACTN_DATA_SHIFT 16U |
#define | XRTC_CALIB_WR_FRACTN_DATA_WIDTH 4U |
#define | XRTC_CALIB_WR_FRACTN_DATA_MASK 0x000f0000U |
#define | XRTC_CALIB_WR_FRACTN_DATA_DEFVAL 0x0U |
#define | XRTC_CALIB_WR_MAX_TCK_SHIFT 0U |
#define | XRTC_CALIB_WR_MAX_TCK_WIDTH 16U |
#define | XRTC_CALIB_WR_MAX_TCK_MASK 0x0000ffffU |
#define | XRTC_CALIB_WR_MAX_TCK_DEFVAL 0x0U |
#define | XRTC_CALIB_RD_OFFSET 0x0000000CU |
Register: XrtcCalibRd. More... | |
#define | XRTC_CALIB_RD_RSTVAL 0x00000000U |
#define | XRTC_CALIB_RD_FRACTN_EN_SHIFT 20U |
#define | XRTC_CALIB_RD_FRACTN_EN_WIDTH 1U |
#define | XRTC_CALIB_RD_FRACTN_EN_MASK 0x00100000U |
#define | XRTC_CALIB_RD_FRACTN_EN_DEFVAL 0x0U |
#define | XRTC_CALIB_RD_FRACTN_DATA_SHIFT 16U |
#define | XRTC_CALIB_RD_FRACTN_DATA_WIDTH 4U |
#define | XRTC_CALIB_RD_FRACTN_DATA_MASK 0x000f0000U |
#define | XRTC_CALIB_RD_FRACTN_DATA_DEFVAL 0x0U |
#define | XRTC_CALIB_RD_MAX_TCK_SHIFT 0U |
#define | XRTC_CALIB_RD_MAX_TCK_WIDTH 16U |
#define | XRTC_CALIB_RD_MAX_TCK_MASK 0x0000ffffU |
#define | XRTC_CALIB_RD_MAX_TCK_DEFVAL 0x0U |
Current time Register | |
#define | XRTC_CUR_TIME_OFFSET 0x00000010U |
Register: XrtcCurTime. More... | |
#define | XRTC_CUR_TIME_RSTVAL 0x00000000U |
#define | XRTC_CUR_TIME_VAL_SHIFT 0U |
#define | XRTC_CUR_TIME_VAL_WIDTH 32U |
#define | XRTC_CUR_TIME_VAL_MASK 0xffffffffU |
#define | XRTC_CUR_TIME_VAL_DEFVAL 0x0U |
#define | XRTC_CUR_TCK_OFFSET 0x00000014U |
Register: XrtcCurTck. More... | |
#define | XRTC_CUR_TCK_RSTVAL 0x00000000U |
#define | XRTC_CUR_TCK_VAL_SHIFT 0U |
#define | XRTC_CUR_TCK_VAL_WIDTH 16U |
#define | XRTC_CUR_TCK_VAL_MASK 0x0000ffffU |
#define | XRTC_CUR_TCK_VAL_DEFVAL 0x0U |
Alarm Register | |
#define | XRTC_ALRM_OFFSET 0x00000018U |
Register: XrtcAlrm. More... | |
#define | XRTC_ALRM_RSTVAL 0x00000000U |
#define | XRTC_ALRM_VAL_SHIFT 0U |
#define | XRTC_ALRM_VAL_WIDTH 32U |
#define | XRTC_ALRM_VAL_MASK 0xffffffffU |
#define | XRTC_ALRM_VAL_DEFVAL 0x0U |
Interrupt Status Register | |
#define | XRTC_INT_STS_OFFSET 0x00000020U |
Register: XrtcIntSts. More... | |
#define | XRTC_INT_STS_RSTVAL 0x00000000U |
#define | XRTC_INT_STS_ALRM_SHIFT 1U |
#define | XRTC_INT_STS_ALRM_WIDTH 1U |
#define | XRTC_INT_STS_ALRM_MASK 0x00000002U |
#define | XRTC_INT_STS_ALRM_DEFVAL 0x0U |
#define | XRTC_INT_STS_SECS_SHIFT 0U |
#define | XRTC_INT_STS_SECS_WIDTH 1U |
#define | XRTC_INT_STS_SECS_MASK 0x00000001U |
#define | XRTC_INT_STS_SECS_DEFVAL 0x0U |
#define | XRTC_INT_MSK_OFFSET 0x00000024U |
Register: XrtcIntMsk. More... | |
#define | XRTC_INT_MSK_RSTVAL 0x00000003U |
#define | XRTC_INT_MSK_ALRM_SHIFT 1U |
#define | XRTC_INT_MSK_ALRM_WIDTH 1U |
#define | XRTC_INT_MSK_ALRM_MASK 0x00000002U |
#define | XRTC_INT_MSK_ALRM_DEFVAL 0x1U |
#define | XRTC_INT_MSK_SECS_SHIFT 0U |
#define | XRTC_INT_MSK_SECS_WIDTH 1U |
#define | XRTC_INT_MSK_SECS_MASK 0x00000001U |
#define | XRTC_INT_MSK_SECS_DEFVAL 0x1U |
#define | XRTC_INT_EN_OFFSET 0x00000028U |
Register: XrtcIntEn. More... | |
#define | XRTC_INT_EN_RSTVAL 0x00000000U |
#define | XRTC_INT_EN_ALRM_SHIFT 1U |
#define | XRTC_INT_EN_ALRM_WIDTH 1U |
#define | XRTC_INT_EN_ALRM_MASK 0x00000002U |
#define | XRTC_INT_EN_ALRM_DEFVAL 0x0U |
#define | XRTC_INT_EN_SECS_SHIFT 0U |
#define | XRTC_INT_EN_SECS_WIDTH 1U |
#define | XRTC_INT_EN_SECS_MASK 0x00000001U |
#define | XRTC_INT_EN_SECS_DEFVAL 0x0U |
#define | XRTC_INT_DIS_OFFSET 0x0000002CU |
Register: XrtcIntDis. More... | |
#define | XRTC_INT_DIS_RSTVAL 0x00000000U |
#define | XRTC_INT_DIS_ALRM_SHIFT 1U |
#define | XRTC_INT_DIS_ALRM_WIDTH 1U |
#define | XRTC_INT_DIS_ALRM_MASK 0x00000002U |
#define | XRTC_INT_DIS_ALRM_DEFVAL 0x0U |
#define | XRTC_INT_DIS_SECS_SHIFT 0U |
#define | XRTC_INT_DIS_SECS_WIDTH 1U |
#define | XRTC_INT_DIS_SECS_MASK 0x00000001U |
#define | XRTC_INT_DIS_SECS_DEFVAL 0x0U |
#define | XRTC_ADD_ERR_OFFSET 0x00000030U |
Register: XrtcAddErr. More... | |
#define | XRTC_ADD_ERR_RSTVAL 0x00000000U |
#define | XRTC_ADD_ERR_STS_SHIFT 0U |
#define | XRTC_ADD_ERR_STS_WIDTH 1U |
#define | XRTC_ADD_ERR_STS_MASK 0x00000001U |
#define | XRTC_ADD_ERR_STS_DEFVAL 0x0U |
#define | XRTC_ADD_ERR_INT_MSK_OFFSET 0x00000034U |
Register: XrtcAddErrIntMsk. More... | |
#define | XRTC_ADD_ERR_INT_MSK_RSTVAL 0x00000001U |
#define | XRTC_ADD_ERR_INT_MSK_SHIFT 0U |
#define | XRTC_ADD_ERR_INT_MSK_WIDTH 1U |
#define | XRTC_ADD_ERR_INT_MSK_MASK 0x00000001U |
#define | XRTC_ADD_ERR_INT_MSK_DEFVAL 0x1U |
#define | XRTC_ADD_ERR_INT_EN_OFFSET 0x00000038U |
Register: XrtcAddErrIntEn. More... | |
#define | XRTC_ADD_ERR_INT_EN_RSTVAL 0x00000000U |
#define | XRTC_ADD_ERR_INT_EN_MSK_SHIFT 0U |
#define | XRTC_ADD_ERR_INT_EN_MSK_WIDTH 1U |
#define | XRTC_ADD_ERR_INT_EN_MSK_MASK 0x00000001U |
#define | XRTC_ADD_ERR_INT_EN_MSK_DEFVAL 0x0U |
#define | XRTC_ADD_ERR_INT_DIS_OFFSET 0x0000003CU |
Register: XrtcAddErrIntDis. More... | |
#define | XRTC_ADD_ERR_INT_DIS_RSTVAL 0x00000000U |
#define | XRTC_ADD_ERR_INT_DIS_MSK_SHIFT 0U |
#define | XRTC_ADD_ERR_INT_DIS_MSK_WIDTH 1U |
#define | XRTC_ADD_ERR_INT_DIS_MSK_MASK 0x00000001U |
#define | XRTC_ADD_ERR_INT_DIS_MSK_DEFVAL 0x0U |
Control Register | |
#define | XRTC_CTL_OFFSET 0x00000040U |
Register: XrtcCtl. More... | |
#define | XRTC_CTL_RSTVAL 0x01000000U |
#define | XRTC_CTL_BATTERY_EN_SHIFT 31U |
#define | XRTC_CTL_BATTERY_EN_WIDTH 1U |
#define | XRTC_CTL_BATTERY_EN_MASK 0x80000000U |
#define | XRTC_CTL_BATTERY_EN_DEFVAL 0x0U |
#define | XRTC_CTL_OSC_SHIFT 24U |
#define | XRTC_CTL_OSC_WIDTH 4U |
#define | XRTC_CTL_OSC_MASK 0x0f000000U |
#define | XRTC_CTL_OSC_DEFVAL 0x1U |
#define | XRTC_CTL_SLVERR_EN_SHIFT 0U |
#define | XRTC_CTL_SLVERR_EN_WIDTH 1U |
#define | XRTC_CTL_SLVERR_EN_MASK 0x00000001U |
#define | XRTC_CTL_SLVERR_EN_DEFVAL 0x0U |
Safety Check Register | |
#define | XRTC_SFTY_CHK_OFFSET 0x00000050U |
Register: XrtcSftyChk. More... | |
#define | XRTC_SFTY_CHK_RSTVAL 0x00000000U |
#define | XRTC_SFTY_CHK_REG_SHIFT 0U |
#define | XRTC_SFTY_CHK_REG_WIDTH 32U |
#define | XRTC_SFTY_CHK_REG_MASK 0xffffffffU |
#define | XRTC_SFTY_CHK_REG_DEFVAL 0x0U |
#define | XRTC_ECO_OFFSET 0x00000060U |
Register: XrtcEco. More... | |
#define | XRTC_ECO_RSTVAL 0x00000000U |
#define | XRTC_ECO_REG_SHIFT 0U |
#define | XRTC_ECO_REG_WIDTH 32U |
#define | XRTC_ECO_REG_MASK 0xffffffffU |
#define | XRTC_ECO_REG_DEFVAL 0x0U |
#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_CfgInitialize(), and XRtcPsu_SetTime().
#define XRTC_CALIBRATION_VALUE 0x7FFFU |
Calibration value.
Referenced by XRtcPsu_CfgInitialize().
#define XRTC_CTL_OFFSET 0x00000040U |
Register: XrtcCtl.
Referenced by XRtcPsu_CfgInitialize().
#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_H_ |
< prevent circular inclusions
by using protection macros
#define XRTC_HW_H_ |
< prevent circular inclusions
by using protection macros
#define XRTC_INT_DIS_OFFSET 0x0000002CU |
Register: XrtcIntDis.
Referenced by XRtcPsu_CfgInitialize(), and 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_CfgInitialize(), 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 XRTC_TYPICAL_OSC_FREQ 32768U |
Oscillator frequency.
Referenced by XRtcPsu_CfgInitialize().
#define XRTCPSU_CRYSTAL_OSC_EN ((u32)1 << XRTC_CTL_OSC_SHIFT) |
Separate Mask for Crystal oscillator bit Enable.
Referenced by XRtcPsu_CfgInitialize().
#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.
InstancePtr | is a pointer to the XRtcPsu instance. |
Referenced by XRtcPsu_CalculateCalibration().
#define XRtcPsu_GetLastSetTime | ( | InstancePtr | ) |
This macro returns the last set time of RTC device.
Whenever a reset happens, the last set time will be zeroth day first sec.
InstancePtr | is a pointer to the XRtcPsu instance. |
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.
InstancePtr | is a pointer to the XRtcPsu instance. |
#define XRtcPsu_ReadCurrentTime | ( | InstancePtr | ) | XRtcPsu_ReadReg((InstancePtr)->RtcConfig.BaseAddr+XRTC_CUR_TIME_OFFSET) |
This macro returns the current time of RTC device.
InstancePtr | is a pointer to the XRtcPsu instance. |
Referenced by XRtcPsu_GetCurrentTime().
#define XRtcPsu_ReadReg | ( | RegisterAddr | ) | Xil_In32(RegisterAddr) |
This macro reads the given register.
RegisterAddr | is the register address in the address space of the RTC device. |
Referenced by XRtcPsu_CfgInitialize(), XRtcPsu_GetCurrentTime(), XRtcPsu_InterruptHandler(), XRtcPsu_IsAlarmEventGenerated(), XRtcPsu_IsSecondsEventGenerated(), and XRtcPsu_SelfTest().
#define XRtcPsu_ResetAlarm | ( | InstancePtr | ) |
This macro resets the alarm register.
InstancePtr | is a pointer to the XRtcPsu instance. |
Referenced by RtcPsuPeriodicAlarmIntrExample().
#define XRtcPsu_RoundOff | ( | Number | ) |
This macro rounds off the given number.
Number | is the one that needs to be rounded off.. |
Referenced by XRtcPsu_CalculateCalibration().
#define XRtcPsu_SetControlRegister | ( | InstancePtr, | |
Value | |||
) |
This macro sets the control register value of RTC device.
InstancePtr | is a pointer to the XRtcPsu instance. |
Value | is the desired control register value for RTC. |
#define XRtcPsu_SetSafetyCheck | ( | InstancePtr, | |
Value | |||
) |
This macro sets the safety check register value of RTC device.
InstancePtr | is a pointer to the XRtcPsu instance. |
Value | is a safety check value to be written in register. |
#define XRtcPsu_WriteReg | ( | RegisterAddr, | |
Data | |||
) | Xil_Out32(RegisterAddr, (u32)(Data)) |
This macro writes the given register.
RegisterAddr | is the register address in the address space of the RTC device. |
Data | is the 32-bit value to write to the register. |
Referenced by XRtcPsu_CfgInitialize(), XRtcPsu_ClearInterruptMask(), XRtcPsu_InterruptHandler(), XRtcPsu_IsAlarmEventGenerated(), XRtcPsu_IsSecondsEventGenerated(), XRtcPsu_SelfTest(), XRtcPsu_SetAlarm(), XRtcPsu_SetInterruptMask(), and XRtcPsu_SetTime().
#define XRtcPsu_WriteSetTime | ( | InstancePtr, | |
Time | |||
) |
This macro updates the current time of RTC device.
InstancePtr | is a pointer to the XRtcPsu instance. |
Time | is the desired time for RTC in seconds. |
Referenced by XRtcPsu_SetTime().
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.
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. |
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.
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. |
References XRtcPsu::CalibrationValue, XRtcPsu::OscillatorFreq, XRtcPsu_GetCalibration, XRtcPsu_GetCurrentTime(), XRtcPsu_GetLastSetTime, and XRtcPsu_RoundOff.
Referenced by RtcPsuSetCalibrationExample().
s32 XRtcPsu_CfgInitialize | ( | XRtcPsu * | InstancePtr, |
XRtcPsu_Config * | ConfigPtr, | ||
UINTPTR | EffectiveAddr | ||
) |
This function initializes a XRtcPsu instance/driver.
The initialization entails:
InstancePtr | is a pointer to the XRtcPsu instance. |
ConfigPtr | points to the XRtcPsu device configuration structure. |
EffectiveAddr | is the device base address in the virtual memory address space. If the address translation is not used then the physical address is passed. Unexpected errors may occur if the address mapping is changed after this function is invoked. |
References XRtcPsu_Config::BaseAddr, XRtcPsu::CalibrationValue, XRtcPsu::CurrTimeUpdated, XRtcPsu_Config::DeviceId, XRtcPsu::Handler, XRtcPsu::IsPeriodicAlarm, XRtcPsu::IsReady, XRtcPsu::OscillatorFreq, XRtcPsu::RtcConfig, XRtcPsu::TimeUpdated, XRTC_CALIB_WR_OFFSET, XRTC_CALIBRATION_VALUE, XRTC_CTL_OFFSET, XRTC_INT_DIS_OFFSET, XRTC_INT_STS_OFFSET, XRTC_TYPICAL_OSC_FREQ, XRTCPSU_CRYSTAL_OSC_EN, XRtcPsu_ReadReg, and XRtcPsu_WriteReg.
Referenced by RtcPsuAlarmIntrExample(), RtcPsuAlarmPolledExample(), RtcPsuPeriodicAlarmIntrExample(), RtcPsuSecondsIntrExample(), RtcPsuSecondsPolledExample(), RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().
void XRtcPsu_ClearInterruptMask | ( | XRtcPsu * | InstancePtr, |
u32 | Mask | ||
) |
This function clears the interrupt mask.
InstancePtr | is a pointer to the XRtcPsu instance |
Mask | contains the interrupts to be disabled. A '1' enables an interrupt, and a '0' disables. |
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.
dt | is a pointer to a DatetTime format structure variable of time that has to be shown in seconds. |
References XRtcPsu_DT::Day, XRtcPsu_DT::Hour, XRtcPsu_DT::Min, XRtcPsu_DT::Month, XRtcPsu_DT::Sec, and XRtcPsu_DT::Year.
Referenced by RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().
u32 XRtcPsu_GetCurrentTime | ( | XRtcPsu * | InstancePtr | ) |
This function gets the current RTC time.
InstancePtr | is a pointer to the XRtcPsu instance. |
References XRtcPsu_Config::BaseAddr, XRtcPsu::CurrTimeUpdated, XRtcPsu::RtcConfig, XRtcPsu::TimeUpdated, 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.
InstancePtr | contains a pointer to the driver instance |
References XRtcPsu_Config::BaseAddr, XRtcPsu::CallBackRef, XRtcPsu::CurrTimeUpdated, XRtcPsu::Handler, XRtcPsu::IsPeriodicAlarm, XRtcPsu::IsReady, XRtcPsu::PeriodicAlarmTime, XRtcPsu::RtcConfig, XRtcPsu::TimeUpdated, 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.
Referenced by RtcPsuAlarmIntrExample(), RtcPsuPeriodicAlarmIntrExample(), and RtcPsuSecondsIntrExample().
u32 XRtcPsu_IsAlarmEventGenerated | ( | XRtcPsu * | InstancePtr | ) |
This function returns the alarm event status by reading interrupt status register.
InstancePtr | is a pointer to the XRtcPsu instance. |
References XRtcPsu_Config::BaseAddr, XRtcPsu::RtcConfig, XRTC_INT_STS_OFFSET, XRtcPsu_ReadReg, and XRtcPsu_WriteReg.
Referenced by RtcPsuAlarmPolledExample().
u32 XRtcPsu_IsSecondsEventGenerated | ( | XRtcPsu * | InstancePtr | ) |
This function returns the seconds event status by reading interrupt status register.
InstancePtr | is a pointer to the XRtcPsu instance. |
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.
DeviceId | is the unique device ID of the device being looked up. |
References XRtcPsu_ConfigTable.
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.
Seconds | is the time value that has to be shown in DateTime format. |
dt | is the DateTime format variable that stores the translated time. |
References XRtcPsu_DT::Day, XRtcPsu_DT::Hour, XRtcPsu_DT::Min, XRtcPsu_DT::Month, XRtcPsu_DT::Sec, XRtcPsu_DT::WeekDay, and XRtcPsu_DT::Year.
Referenced by RtcPsuAlarmIntrExample(), RtcPsuAlarmPolledExample(), RtcPsuPeriodicAlarmIntrExample(), and RtcPsuSetTimeExample().
s32 XRtcPsu_SelfTest | ( | 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.
InstancePtr | is a pointer to the XRtcPsu instance |
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.
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. |
References XRtcPsu_Config::BaseAddr, XRtcPsu::IsPeriodicAlarm, XRtcPsu::IsReady, XRtcPsu::PeriodicAlarmTime, 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 | FunctionPtr, | ||
void * | CallBackRef | ||
) |
This function sets the handler that will be called when an event (interrupt) occurs that needs application's attention.
InstancePtr | is a pointer to the XRtcPsu instance |
FunctionPtr | is the pointer to the callback function. |
CallBackRef | is the upper layer callback reference passed back when the callback function is invoked. |
There is no assert on the CallBackRef since the driver doesn't know what it is (nor should it)
References XRtcPsu::CallBackRef, XRtcPsu::Handler, and XRtcPsu::IsReady.
Referenced by RtcPsuAlarmIntrExample(), RtcPsuPeriodicAlarmIntrExample(), and RtcPsuSecondsIntrExample().
void XRtcPsu_SetInterruptMask | ( | XRtcPsu * | InstancePtr, |
u32 | Mask | ||
) |
This function sets the interrupt mask.
InstancePtr | is a pointer to the XRtcPsu instance |
Mask | contains the interrupts to be enabled. A '1' enables an interupt, and a '0' disables. |
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.
InstancePtr | is a pointer to the XRtcPsu instance. |
Time | that should be updated into RTC write register. |
References XRtcPsu_Config::BaseAddr, XRtcPsu::CalibrationValue, XRtcPsu::CurrTimeUpdated, XRtcPsu::RtcConfig, XRtcPsu::TimeUpdated, XRTC_CALIB_WR_OFFSET, XRTC_INT_STS_OFFSET, XRtcPsu_WriteReg, and XRtcPsu_WriteSetTime.
Referenced by RtcPsuSetCalibrationExample(), and RtcPsuSetTimeExample().
XRtcPsu_Config XRtcPsu_ConfigTable[XPAR_XRTCPSU_NUM_INSTANCES] |
This table contains configuration information for RTC device in the system.
Referenced by XRtcPsu_LookupConfig().
XRtcPsu_Config XRtcPsu_ConfigTable[] |
This table contains configuration information for RTC device in the system.
Referenced by XRtcPsu_LookupConfig().