Synergy Software Package User's Manual

Driver for the Realtime Clock (RTC). More...

Data Structures

struct  rtc_instance_ctrl_t
 

Enumerations

enum  rtc_count_mode_t { RTC_CALENDAR_MODE = 0, RTC_BINARY_MODE = 1 }
 

Functions

ssp_err_t R_RTC_Open (rtc_ctrl_t *const p_api_ctrl, rtc_cfg_t const *const p_cfg)
 Open the RTC driver. More...
 
ssp_err_t R_RTC_Close (rtc_ctrl_t *const p_api_ctrl)
 Close the RTC driver. More...
 
ssp_err_t R_RTC_Configure (rtc_ctrl_t *const p_api_ctrl, void *const p_extend)
 Configure the RTC driver. More...
 
ssp_err_t R_RTC_CalendarTimeSet (rtc_ctrl_t *const p_api_ctrl, rtc_time_t *p_time, bool clock_start)
 Set the calendar time. More...
 
ssp_err_t R_RTC_CalendarTimeGet (rtc_ctrl_t *const p_api_ctrl, rtc_time_t *p_time)
 Get the calendar time. (Should not be called from critical section as it may return incorrect time) More...
 
ssp_err_t R_RTC_CalendarAlarmSet (rtc_ctrl_t *const p_api_ctrl, rtc_alarm_time_t *p_alarm, bool interrupt_enable_flag)
 Set the calendar alarm time. More...
 
ssp_err_t R_RTC_CalendarAlarmGet (rtc_ctrl_t *const p_api_ctrl, rtc_alarm_time_t *p_alarm)
 Get the calendar alarm time. More...
 
ssp_err_t R_RTC_CalendarCounterStart (rtc_ctrl_t *const p_api_ctrl)
 Start the calendar counter. More...
 
ssp_err_t R_RTC_CalendarCounterStop (rtc_ctrl_t *const p_api_ctrl)
 Stop the calendar counter. More...
 
ssp_err_t R_RTC_IrqEnable (rtc_ctrl_t *const p_api_ctrl, rtc_event_t event)
 Enable the alarm interrupt. More...
 
ssp_err_t R_RTC_IrqDisable (rtc_ctrl_t *const p_api_ctrl, rtc_event_t event)
 Disable the alarm interrupt. More...
 
ssp_err_t R_RTC_PeriodicIrqRateSet (rtc_ctrl_t *const p_api_ctrl, rtc_periodic_irq_select_t rate)
 Set the periodic interrupt rate. More...
 
ssp_err_t R_RTC_InfoGet (rtc_ctrl_t *p_api_ctrl, rtc_info_t *p_rtc_info)
 This function returns information about the driver clock source. More...
 
ssp_err_t R_RTC_ErrorAdjustmentModeSet (rtc_ctrl_t *p_api_ctrl, rtc_error_adjustment_mode_cfg_t *p_error_adjustment_mode)
 This function sets time error adjustment mode. More...
 
ssp_err_t R_RTC_ErrorAdjustmentSet (rtc_ctrl_t *p_api_ctrl, rtc_error_adjustment_cfg_t *p_error_adjustment_config)
 This function sets time error adjustment. More...
 
ssp_err_t R_RTC_VersionGet (ssp_version_t *p_version)
 Get driver version based on compile time macros. More...
 

Detailed Description

Driver for the Realtime Clock (RTC).

This module supports the Real Time Clock (RTC). It implements the following interfaces:

Enumeration Type Documentation

◆ rtc_count_mode_t

Counting mode

Enumerator
RTC_CALENDAR_MODE 

Calender count mode.

RTC_BINARY_MODE 

Binary count mode.

Function Documentation

◆ R_RTC_CalendarAlarmGet()

ssp_err_t R_RTC_CalendarAlarmGet ( rtc_ctrl_t *const  p_api_ctrl,
rtc_alarm_time_t p_alarm 
)

Get the calendar alarm time.

Implements rtc_api_t::calendarAlarmGet

Return values
SSP_SUCCESSCalendar alarm time get operation was successful.
SSP_ERR_ASSERTIONInvalid p_api_ctrl, p_alarm or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.

Get the alarm time

◆ R_RTC_CalendarAlarmSet()

ssp_err_t R_RTC_CalendarAlarmSet ( rtc_ctrl_t *const  p_api_ctrl,
rtc_alarm_time_t p_alarm,
bool  interrupt_enable_flag 
)

Set the calendar alarm time.

Implements rtc_api_t::calendarAlarmSet.

Precondition
The calendar counter must be running before the alarm can be set.
Return values
SSP_SUCCESSCalendar alarm time set operation was successful.
SSP_ERR_INVALID_ARGUMENTInvalid time parameter field.
SSP_ERR_ASSERTIONInvalid p_api_ctrl, p_alarm or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.

Disable the ICU alarm interrupt request

Set alarm time

◆ R_RTC_CalendarCounterStart()

ssp_err_t R_RTC_CalendarCounterStart ( rtc_ctrl_t *const  p_api_ctrl)

Start the calendar counter.

Implements rtc_api_t::calendarCounterStart.

Return values
SSP_SUCCESSCalendar counter started.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.
SSP_ERR_TIMEOUTStart bit not set.

Set the start bit.

◆ R_RTC_CalendarCounterStop()

ssp_err_t R_RTC_CalendarCounterStop ( rtc_ctrl_t *const  p_api_ctrl)

Stop the calendar counter.

Implements rtc_api_t::calendarCounterStop.

Return values
SSP_SUCCESSCalendar counter stopped.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.
SSP_ERR_TIMEOUTStart bit not cleared.

Clear the start bit.

◆ R_RTC_CalendarTimeGet()

ssp_err_t R_RTC_CalendarTimeGet ( rtc_ctrl_t *const  p_api_ctrl,
rtc_time_t p_time 
)

Get the calendar time. (Should not be called from critical section as it may return incorrect time)

Implements rtc_api_t::calendarTimeGet

Return values
SSP_SUCCESSCalendar time get operation was successful.
SSP_ERR_ASSERTIONInvalid p_api_ctrl, p_time or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.
SSP_ERR_TIMEOUTIRQ enable operation timed out.

Read all the time registers, if a carry irq occurred in-between read again

This flag will be set to 'true' in the carry ISR

Restore the state of carry IRQ.

◆ R_RTC_CalendarTimeSet()

ssp_err_t R_RTC_CalendarTimeSet ( rtc_ctrl_t *const  p_api_ctrl,
rtc_time_t p_time,
bool  clock_start 
)

Set the calendar time.

Implements rtc_api_t::calendarTimeSet.

Return values
SSP_SUCCESSCalendar time set operation was successful.
SSP_ERR_ASSERTIONInvalid p_api_ctrl, p_time or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.
SSP_ERR_INVALID_ARGUMENTInvalid time parameter field.
SSP_ERR_TIMEOUTSoftware reset status check failed.

◆ R_RTC_Close()

ssp_err_t R_RTC_Close ( rtc_ctrl_t *const  p_api_ctrl)

Close the RTC driver.

Implements rtc_api_t::close

Return values
SSP_SUCCESSDe-Initialization was successful and RTC driver closed.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for close.

Disable the periodic interrupt, alarm interrupt, carry interrupts, and disable there interrupt priority and vector info.

◆ R_RTC_Configure()

ssp_err_t R_RTC_Configure ( rtc_ctrl_t *const  p_api_ctrl,
void *const  p_extend 
)

Configure the RTC driver.

Implements rtc_api_t::configure

Return values
SSP_SUCCESSRTC was successful configured.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.
SSP_ERR_TIMEOUTStatus check for counter mode or reset timed out

Parameter checking

p_extend is currently not used, reserved for future use

Set the clock source of the RTC block according to the UM

◆ R_RTC_ErrorAdjustmentModeSet()

ssp_err_t R_RTC_ErrorAdjustmentModeSet ( rtc_ctrl_t p_api_ctrl,
rtc_error_adjustment_mode_cfg_t p_error_adjustment_mode 
)

This function sets time error adjustment mode.

Implements rtc_api_t::errorAdjustmentModeSet

Return values
SSP_SUCCESSTime error adjustment mode set successful.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or error_adjustment_mode pointer.
SSP_ERR_NOT_OPENDriver not open for operation.
SSP_ERR_UNSUPPORTEDThe clock source is not SubClock.
SSP_ERR_INVALID_ARGUMENTInvalid error adjustment period.
SSP_ERR_TIMEOUTTime error adjustment get query timed out.

◆ R_RTC_ErrorAdjustmentSet()

ssp_err_t R_RTC_ErrorAdjustmentSet ( rtc_ctrl_t p_api_ctrl,
rtc_error_adjustment_cfg_t p_error_adjustment_config 
)

This function sets time error adjustment.

Implements rtc_api_t::errorAdjustmentSet

Return values
SSP_SUCCESSTime error adjustment successful.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_error_adjustment_config pointer.
SSP_ERR_NOT_OPENDriver not open for operation.
SSP_ERR_UNSUPPORTEDThe clock source is not SubClock.
SSP_ERR_INVALID_ARGUMENTInvalid error adjustment value.
SSP_ERR_TIMEOUTTime error adjustment get query timed out.

◆ R_RTC_InfoGet()

ssp_err_t R_RTC_InfoGet ( rtc_ctrl_t p_api_ctrl,
rtc_info_t p_rtc_info 
)

This function returns information about the driver clock source.

Implements rtc_api_t::infoGet

Return values
SSP_SUCCESSGet information Successful.
SSP_ERR_ASSERTIONInvalid p_api_ctrl, p_rtc_info or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_NOT_OPENDriver not open already for operation.

◆ R_RTC_IrqDisable()

ssp_err_t R_RTC_IrqDisable ( rtc_ctrl_t *const  p_api_ctrl,
rtc_event_t  event 
)

Disable the alarm interrupt.

Implements rtc_api_t::interruptDisable.

Return values
SSP_SUCCESSAlarm interrupt disabled.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_IRQ_BSP_DISABLEDUser IRQ parameter not valid
SSP_ERR_INVALID_ARGUMENTInvalid IRQ event
SSP_ERR_TIMEOUTIRQ disable operation timed out.
SSP_ERR_NOT_OPENDriver not open already for operation.

◆ R_RTC_IrqEnable()

ssp_err_t R_RTC_IrqEnable ( rtc_ctrl_t *const  p_api_ctrl,
rtc_event_t  event 
)

Enable the alarm interrupt.

Implements rtc_api_t::interruptEnable.

Return values
SSP_SUCCESSAlarm interrupt enabled.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_IRQ_BSP_DISABLEDUser IRQ parameter not valid.
SSP_ERR_INVALID_ARGUMENTInvalid IRQ event.
SSP_ERR_TIMEOUTIRQ enable operation timed out.
SSP_ERR_NOT_OPENDriver not open already for operation.

◆ R_RTC_Open()

ssp_err_t R_RTC_Open ( rtc_ctrl_t *const  p_api_ctrl,
rtc_cfg_t const *const  p_cfg 
)

Open the RTC driver.

Implements rtc_api_t::open.

Opens and configures the RTC driver module. Configuration includes clock source, and interrupt callback function. If the sub-clock oscillator is the clock source it is started in this function.

Return values
SSP_SUCCESSInitialization was successful and RTC has started.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_cfg pointer.
SSP_ERR_HW_LOCKEDHardware in use
SSP_ERR_TIMEOUTStatus check for counter mode or reset timed out
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

Mark driver as open by initializing it to "RTC" in its ASCII equivalent.

◆ R_RTC_PeriodicIrqRateSet()

ssp_err_t R_RTC_PeriodicIrqRateSet ( rtc_ctrl_t *const  p_api_ctrl,
rtc_periodic_irq_select_t  rate 
)

Set the periodic interrupt rate.

Implements rtc_api_t::periodicInterruptRateSet.

Return values
SSP_SUCCESSThe periodic interrupt rate was successfully set.
SSP_ERR_ASSERTIONInvalid p_api_ctrl or p_ctrl->p_reg member pointed by p_api_ctrl pointer.
SSP_ERR_TIMEOUTPeriodic interrupt rate get query timed out.
SSP_ERR_NOT_OPENDriver not open already for operation.

◆ R_RTC_VersionGet()

ssp_err_t R_RTC_VersionGet ( ssp_version_t p_version)

Get driver version based on compile time macros.

Implements rtc_api_t::versionGet

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONThe parameter p_version is NULL.