PDK API Guide for J721E
PMIC RTC Driver API

Introduction

These are PMIC RTC driver parameters and API's

Files

file  pmic_rtc.h
 PMIC Low Level Driver API/interface file for RTC API.
 

Data Structures

struct  Pmic_RtcTime_t
 RTC time configuration The Pmic_RtcTime_s structure contains a set of time parameters to the RTC time. More...
 
struct  Pmic_RtcDate_t
 RTC Date configuration The Pmic_RtcDate_s structure contains a set of time parameters to characterize the RTC Date. More...
 

Functions

int32_t Pmic_rtcSetAlarmIntr (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_RtcTime_t *pTimeCfg, Pmic_RtcDate_t *pDateCfg)
 Set the alarm interrupt configurations in PMIC RTC function. This function is used to set the alarm date and time interrupt depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC. More...
 
int32_t Pmic_rtcGetAlarmIntr (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_RtcTime_t *pTimeCfg, Pmic_RtcDate_t *pDateCfg)
 Get the alarm interrupt configurations in PMIC RTC function. This function is used to Get the alarm date and time interrupt depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC. More...
 
int32_t Pmic_rtcSetTimerIntr (Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t timerPeriod)
 Set the timer interrupt configuration in PMIC RTC function. This function is used to set the timer interrupt in RTC present in the PMIC. More...
 
int32_t Pmic_rtcGetTimerIntr (Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t *pTimerPeriod)
 Get the timer interrupt configuration in PMIC RTC function. This function is used to set the timer interrupt in RTC present in the PMIC. More...
 
int32_t Pmic_rtcSetTimeDateInfo (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_RtcTime_t *pTimeCfg, Pmic_RtcDate_t *pDateCfg)
 Set the PMIC RTC date and time function. This function is used to Set the current date and time parameters, depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC. More...
 
int32_t Pmic_rtcGetTimeDateInfo (Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_RtcTime_t *pTimeCfg, Pmic_RtcDate_t *pDateCfg)
 Get the PMIC RTC date and time function. This function is used to Get the current date and time parameters, depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC. More...
 
int32_t Pmic_rtcSetFreqComp (Pmic_CoreHandle_t *pPmicCoreHandle, uint16_t compensation)
 Set the RTC frequency compensation. This function is used to enable frequency compensation in RTC present in the PMIC. More...
 
int32_t Pmic_rtcGetFreqComp (Pmic_CoreHandle_t *pPmicCoreHandle, uint16_t *pCompensation)
 Get the RTC frequency pCompensation. This function is used to get frequency pCompensation value in RTC present in the PMIC. More...
 
int32_t Pmic_rtcEnable (Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t enableRtc)
 Enable/Disable the RTC. This function is used to stop the RTC present in the PMIC. More...
 
int32_t Pmic_rtcEnableTimerIntr (Pmic_CoreHandle_t *pPmicCoreHandle, bool enableIntr)
 Enable/Disable the RTC Timer Interrupt. This function is used to enable/disable the RTC timer interrupt. More...
 
int32_t Pmic_rtcEnableAlarmIntr (Pmic_CoreHandle_t *pPmicCoreHandle, bool enableIntr)
 Enable/Disable the RTC Alarm Interrupt. This function is used to enable/disable the RTC alarm interrupt. More...
 

Macros

#define PMIC_RTC_AUTO_COMP_ON   (0x1U)
 RTC Compensation. More...
 
#define PMIC_RTC_CONVERT_4BIT_MSB_TO_DEC   (10U)
 Used to Extract the First and Second digit RTC Timer /Alarm decimal Values. More...
 
#define PMIC_RTC_EXTRACT_YEAR_DECIMAL_0_99   (100U)
 Used to Extract Year decimal value as 0 to 99 from values 2000 to 2099. More...
 

PMIC RTC timer interrupt Periods

#define PMIC_RTC_SECOND_INTR_PERIOD   (0x0U)
 
#define PMIC_RTC_MINUTE_INTR_PERIOD   (0x1U)
 
#define PMIC_RTC_HOUR_INTR_PERIOD   (0x2U)
 
#define PMIC_RTC_DAY_INTR_PERIOD   (0x3U)
 

PMIC RTC alarm interrupt Enable/Disable

#define PMIC_RTC_ALARM_INTR_ENABLE   (0x1U)
 
#define PMIC_RTC_ALARM_INTR_DISABLE   (0x0U)
 

PMIC RTC timer interrupt Enable/Disable

#define PMIC_RTC_TIMER_INTR_ENABLE   (0x1U)
 
#define PMIC_RTC_TIMER_INTR_DISABLE   (0x0U)
 

PMIC RTC time mode

#define PMIC_RTC_12_HOUR_MODE   (0x1U)
 
#define PMIC_RTC_24_HOUR_MODE   (0x0U)
 

PMIC RTC Operations for RTC/ALARM

#define PMIC_RTC_OPS_FOR_RTC   (0x0U)
 
#define PMIC_RTC_OPS_FOR_ALARM   (0x1U)
 

PMIC RTC Meridien mode

#define PMIC_RTC_AM_MODE   (0x0U)
 
#define PMIC_RTC_PM_MODE   (0x1U)
 

PMIC RTC State

#define PMIC_RTC_STOP   (0x0U)
 
#define PMIC_RTC_START   (0x1U)
 

PMIC RTC time Configuration Limit Values

#define PMIC_RTC_MINUTE_SEC_MAX   (59U)
 RTC max value for Minutes and Seconds. More...
 
#define PMIC_RTC_12HFMT_HR_MIN   (1U)
 RTC 12 Hour Time values limit. More...
 
#define PMIC_RTC_12HFMT_HR_MAX   (12U)
 
#define PMIC_RTC_24HFMT_HR_MAX   (23U)
 RTC 24 Hour Time values limit. More...
 

PMIC RTC Date Configuration Limit Values

#define PMIC_RTC_DAY_MIN   (1U)
 RTC month min values. More...
 
#define PMIC_RTC_YEAR_MIN   (2000U)
 RTC years values limit. More...
 
#define PMIC_RTC_YEAR_MAX   (2099U)
 
#define PMIC_RTC_NLPY_FEB_MNTH_DAY_MAX   (28U)
 RTC month max value for February month in a Non-leap year. More...
 
#define PMIC_RTC_LPY_FEB_MNTH_DAY_MAX   (29U)
 RTC month max value for February month in a leap year. More...
 
#define PMIC_RTC_MNTH_DAY_MAX_30   (30U)
 RTC month max value for general months. More...
 
#define PMIC_RTC_MNTH_DAY_MAX_31   (31U)
 

PMIC RTC Week Days

#define PMIC_RTC_WEEKDAY_SUNDAY   (1U)
 
#define PMIC_RTC_WEEKDAY_MONDAY   (2U)
 
#define PMIC_RTC_WEEKDAY_TUESDAY   (3U)
 
#define PMIC_RTC_WEEKDAY_WEDNESDAY   (4U)
 
#define PMIC_RTC_WEEKDAY_THURSDAY   (5U)
 
#define PMIC_RTC_WEEKDAY_FRIDAY   (6U)
 
#define PMIC_RTC_WEEKDAY_SATURDAY   (7U)
 

PMIC RTC Months

List of calendar months.

#define PMIC_RTC_MONTH_JAN   (1U)
 
#define PMIC_RTC_MONTH_FEB   (2U)
 
#define PMIC_RTC_MONTH_MAR   (3U)
 
#define PMIC_RTC_MONTH_APR   (4U)
 
#define PMIC_RTC_MONTH_MAY   (5U)
 
#define PMIC_RTC_MONTH_JUN   (6U)
 
#define PMIC_RTC_MONTH_JUL   (7U)
 
#define PMIC_RTC_MONTH_AUG   (8U)
 
#define PMIC_RTC_MONTH_SEP   (9U)
 
#define PMIC_RTC_MONTH_OCT   (10U)
 
#define PMIC_RTC_MONTH_NOV   (11U)
 
#define PMIC_RTC_MONTH_DEC   (12U)
 

PMIC RTC Time strcture Param Bits

#define PMIC_RTC_TIME_CFG_SEC_VALID   (0U)
 
#define PMIC_RTC_TIME_CFG_MIN_VALID   (1U)
 
#define PMIC_RTC_TIME_CFG_HRS_VALID   (2U)
 
#define PMIC_RTC_TIME_CFG_TIMEMODE_VALID   (3U)
 
#define PMIC_RTC_TIME_CFG_MERIDIAN_VALID   (4U)
 

PMIC RTC Time Structure Param Bit shift values

Application can use below shifted values to set the validParam member defined in Pmic_RtcTime_t structure

#define PMIC_RTC_TIME_CFG_SEC_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_SEC_VALID)
 
#define PMIC_RTC_TIME_CFG_MIN_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_MIN_VALID)
 
#define PMIC_RTC_TIME_CFG_HRS_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_HRS_VALID)
 
#define PMIC_RTC_TIME_CFG_TIMEMODE_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_TIMEMODE_VALID)
 
#define PMIC_RTC_TIME_CFG_MERIDIAN_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_MERIDIAN_VALID)
 

PMIC RTC Date strcture Param Bits

#define PMIC_RTC_DATE_CFG_DAY_VALID   (0U)
 
#define PMIC_RTC_DATE_CFG_MONTH_VALID   (1U)
 
#define PMIC_RTC_DATE_CFG_YEAR_VALID   (2U)
 
#define PMIC_RTC_DATE_CFG_WEEK_VALID   (3U)
 

PMIC RTC Date Structure Param Bit shift values

Application can use below shifted values to set the validParam member defined in Pmic_RtcDate_t structure

#define PMIC_RTC_DATE_CFG_DAY_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_DAY_VALID)
 
#define PMIC_RTC_DATE_CFG_MONTH_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_MONTH_VALID)
 
#define PMIC_RTC_DATE_CFG_YEAR_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_YEAR_VALID)
 
#define PMIC_RTC_DATE_CFG_WEEK_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_WEEK_VALID)
 

Macro Definition Documentation

#define PMIC_RTC_SECOND_INTR_PERIOD   (0x0U)
#define PMIC_RTC_MINUTE_INTR_PERIOD   (0x1U)
#define PMIC_RTC_HOUR_INTR_PERIOD   (0x2U)
#define PMIC_RTC_DAY_INTR_PERIOD   (0x3U)
#define PMIC_RTC_ALARM_INTR_ENABLE   (0x1U)
#define PMIC_RTC_ALARM_INTR_DISABLE   (0x0U)
#define PMIC_RTC_TIMER_INTR_ENABLE   (0x1U)
#define PMIC_RTC_TIMER_INTR_DISABLE   (0x0U)
#define PMIC_RTC_12_HOUR_MODE   (0x1U)
#define PMIC_RTC_24_HOUR_MODE   (0x0U)
#define PMIC_RTC_OPS_FOR_RTC   (0x0U)
#define PMIC_RTC_OPS_FOR_ALARM   (0x1U)
#define PMIC_RTC_AM_MODE   (0x0U)
#define PMIC_RTC_PM_MODE   (0x1U)
#define PMIC_RTC_STOP   (0x0U)
#define PMIC_RTC_START   (0x1U)
#define PMIC_RTC_AUTO_COMP_ON   (0x1U)

RTC Compensation.

#define PMIC_RTC_MINUTE_SEC_MAX   (59U)

RTC max value for Minutes and Seconds.

#define PMIC_RTC_12HFMT_HR_MIN   (1U)

RTC 12 Hour Time values limit.

#define PMIC_RTC_12HFMT_HR_MAX   (12U)
#define PMIC_RTC_24HFMT_HR_MAX   (23U)

RTC 24 Hour Time values limit.

#define PMIC_RTC_DAY_MIN   (1U)

RTC month min values.

#define PMIC_RTC_YEAR_MIN   (2000U)

RTC years values limit.

#define PMIC_RTC_YEAR_MAX   (2099U)
#define PMIC_RTC_NLPY_FEB_MNTH_DAY_MAX   (28U)

RTC month max value for February month in a Non-leap year.

#define PMIC_RTC_LPY_FEB_MNTH_DAY_MAX   (29U)

RTC month max value for February month in a leap year.

#define PMIC_RTC_MNTH_DAY_MAX_30   (30U)

RTC month max value for general months.

#define PMIC_RTC_MNTH_DAY_MAX_31   (31U)
#define PMIC_RTC_CONVERT_4BIT_MSB_TO_DEC   (10U)

Used to Extract the First and Second digit RTC Timer /Alarm decimal Values.

#define PMIC_RTC_EXTRACT_YEAR_DECIMAL_0_99   (100U)

Used to Extract Year decimal value as 0 to 99 from values 2000 to 2099.

#define PMIC_RTC_WEEKDAY_SUNDAY   (1U)
#define PMIC_RTC_WEEKDAY_MONDAY   (2U)
#define PMIC_RTC_WEEKDAY_TUESDAY   (3U)
#define PMIC_RTC_WEEKDAY_WEDNESDAY   (4U)
#define PMIC_RTC_WEEKDAY_THURSDAY   (5U)
#define PMIC_RTC_WEEKDAY_FRIDAY   (6U)
#define PMIC_RTC_WEEKDAY_SATURDAY   (7U)
#define PMIC_RTC_MONTH_JAN   (1U)
#define PMIC_RTC_MONTH_FEB   (2U)
#define PMIC_RTC_MONTH_MAR   (3U)
#define PMIC_RTC_MONTH_APR   (4U)
#define PMIC_RTC_MONTH_MAY   (5U)
#define PMIC_RTC_MONTH_JUN   (6U)
#define PMIC_RTC_MONTH_JUL   (7U)
#define PMIC_RTC_MONTH_AUG   (8U)
#define PMIC_RTC_MONTH_SEP   (9U)
#define PMIC_RTC_MONTH_OCT   (10U)
#define PMIC_RTC_MONTH_NOV   (11U)
#define PMIC_RTC_MONTH_DEC   (12U)
#define PMIC_RTC_TIME_CFG_SEC_VALID   (0U)
#define PMIC_RTC_TIME_CFG_MIN_VALID   (1U)
#define PMIC_RTC_TIME_CFG_HRS_VALID   (2U)
#define PMIC_RTC_TIME_CFG_TIMEMODE_VALID   (3U)
#define PMIC_RTC_TIME_CFG_MERIDIAN_VALID   (4U)
#define PMIC_RTC_TIME_CFG_SEC_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_SEC_VALID)
#define PMIC_RTC_TIME_CFG_MIN_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_MIN_VALID)
#define PMIC_RTC_TIME_CFG_HRS_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_HRS_VALID)
#define PMIC_RTC_TIME_CFG_TIMEMODE_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_TIMEMODE_VALID)
#define PMIC_RTC_TIME_CFG_MERIDIAN_VALID_SHIFT   (1U << PMIC_RTC_TIME_CFG_MERIDIAN_VALID)
#define PMIC_RTC_DATE_CFG_DAY_VALID   (0U)
#define PMIC_RTC_DATE_CFG_MONTH_VALID   (1U)
#define PMIC_RTC_DATE_CFG_YEAR_VALID   (2U)
#define PMIC_RTC_DATE_CFG_WEEK_VALID   (3U)
#define PMIC_RTC_DATE_CFG_DAY_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_DAY_VALID)
#define PMIC_RTC_DATE_CFG_MONTH_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_MONTH_VALID)
#define PMIC_RTC_DATE_CFG_YEAR_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_YEAR_VALID)
#define PMIC_RTC_DATE_CFG_WEEK_VALID_SHIFT   (1U << PMIC_RTC_DATE_CFG_WEEK_VALID)

Function Documentation

int32_t Pmic_rtcSetAlarmIntr ( Pmic_CoreHandle_t pPmicCoreHandle,
Pmic_RtcTime_t pTimeCfg,
Pmic_RtcDate_t pDateCfg 
)

Set the alarm interrupt configurations in PMIC RTC function. This function is used to set the alarm date and time interrupt depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
pTimeCfg[IN] PMIC RTC time configuration
pDateCfg[IN] PMIC RTC date configuration
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcGetAlarmIntr ( Pmic_CoreHandle_t pPmicCoreHandle,
Pmic_RtcTime_t pTimeCfg,
Pmic_RtcDate_t pDateCfg 
)

Get the alarm interrupt configurations in PMIC RTC function. This function is used to Get the alarm date and time interrupt depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
pTimeCfg[OUT] PMIC RTC time configuration
pDateCfg[OUT] PMIC RTC date configuration
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcSetTimerIntr ( Pmic_CoreHandle_t pPmicCoreHandle,
uint8_t  timerPeriod 
)

Set the timer interrupt configuration in PMIC RTC function. This function is used to set the timer interrupt in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
timerPeriod[IN] Timer interrupt periods Valid values: Pmic_RtcTimerIntrPeriod
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcGetTimerIntr ( Pmic_CoreHandle_t pPmicCoreHandle,
uint8_t *  pTimerPeriod 
)

Get the timer interrupt configuration in PMIC RTC function. This function is used to set the timer interrupt in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
pTimerPeriod[OUT] Timer interrupt periods
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcSetTimeDateInfo ( Pmic_CoreHandle_t pPmicCoreHandle,
Pmic_RtcTime_t pTimeCfg,
Pmic_RtcDate_t pDateCfg 
)

Set the PMIC RTC date and time function. This function is used to Set the current date and time parameters, depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
pTimeCfg[IN] PMIC RTC time configuration
pDateCfg[IN] PMIC RTC date configuration
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcGetTimeDateInfo ( Pmic_CoreHandle_t pPmicCoreHandle,
Pmic_RtcTime_t pTimeCfg,
Pmic_RtcDate_t pDateCfg 
)

Get the PMIC RTC date and time function. This function is used to Get the current date and time parameters, depending upon the bit fields set in validParams of Time and Date structures in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
pTimeCfg[OUT] PMIC RTC time configuration
pDateCfg[OUT] PMIC RTC date configuration
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcSetFreqComp ( Pmic_CoreHandle_t pPmicCoreHandle,
uint16_t  compensation 
)

Set the RTC frequency compensation. This function is used to enable frequency compensation in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
compensation[IN] PMIC RTC time configuration
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcGetFreqComp ( Pmic_CoreHandle_t pPmicCoreHandle,
uint16_t *  pCompensation 
)

Get the RTC frequency pCompensation. This function is used to get frequency pCompensation value in RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
pCompensation[OUT] PMIC RTC time configuration
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcEnable ( Pmic_CoreHandle_t pPmicCoreHandle,
uint8_t  enableRtc 
)

Enable/Disable the RTC. This function is used to stop the RTC present in the PMIC.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
enableRtc[IN] Parameter to start/stop RTC. Valid values: Pmic_RtcState
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcEnableTimerIntr ( Pmic_CoreHandle_t pPmicCoreHandle,
bool  enableIntr 
)

Enable/Disable the RTC Timer Interrupt. This function is used to enable/disable the RTC timer interrupt.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
enableIntr[IN] Parameter to enable/disable Timer Interrupt Valid values: Pmic_RtcTimerIntrEnable
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes
int32_t Pmic_rtcEnableAlarmIntr ( Pmic_CoreHandle_t pPmicCoreHandle,
bool  enableIntr 
)

Enable/Disable the RTC Alarm Interrupt. This function is used to enable/disable the RTC alarm interrupt.

Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
enableIntr[IN] Parameter to enable/disable alarm Interrupt Valid values: Pmic_RtcAlramIntrEnable
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values Pmic_ErrorCodes