RZT Flexible Software Package Documentation
Release v2.2.0
|
|
Driver for the RTC peripheral on RZ microprocessor. This module implements the RTC Interface.
The RTC HAL module configures the RTC module and controls clock, calendar and alarm functions. A callback can be used to respond to the alarm and periodic interrupt.
The RTC HAL module supports two different interrupt types:
A user-defined callback function can be registered (in the rtc_api_t::open API call) and will be called from the interrupt service routine (ISR) for alarm and periodic interrupt. When called, it is passed a pointer to a structure (rtc_callback_args_t) that holds a user-defined context pointer and an indication of which type of interrupt was fired.
"Parameter Checking" needs to be enabled if date and time validation is required for calendarTimeSet and calendarAlarmSet APIs. If "Parameter Checking" is enabled when using the calendarTimeSet API, the 'day of the week' field is automatically calculated and updated by the driver for the provided date.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Multiplex Interrupt |
| Disabled | Enable multiplex interrupt for a single driver. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_rtc0 | Module name. |
Frequency Comparison Value |
| 195311 | Frequency comparison value. This value is set in the register as it is. |
Callback | Name must be a valid C symbol | NULL | A user callback function can be provided. If this callback function is provided, it will be called from the interrupt service routine (ISR). |
Alarm Interrupt Priority | MCU Specific Options | Select the alarm interrupt priority. | |
Period Interrupt Priority | MCU Specific Options | Select the period interrupt priority. |
To activate interrupts for the RTC module, the desired interrupts must be enabled, The underlying implementation will be expected to handle any interrupts it can support and notify higher layers via callback.
The RTC HAL module uses the following clock sources:
This module does not use I/O pins.
This is a basic example of minimal use of the RTC in an application.
This is an example of periodic interrupt in RTC.
This is an example of alarm interrupt in RTC.
Data Structures | |
struct | rtc_instance_ctrl_t |
struct rtc_instance_ctrl_t |
Channel control block. DO NOT INITIALIZE. Initialization occurs when rtc_api_t::open is called
Data Fields | |
uint32_t | open |
Whether or not driver is open. | |
const rtc_cfg_t * | p_cfg |
Pointer to initial configurations. | |
fsp_err_t R_RTC_Open | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_cfg_t const *const | p_cfg | ||
) |
Opens and configures the RTC driver module. Implements rtc_api_t::open. Configuration includes clock source, and interrupt callback function.
FSP_SUCCESS | Initialization was successful and RTC has started. |
FSP_ERR_ASSERTION | Invalid p_ctrl or p_cfg pointer. |
FSP_ERR_ALREADY_OPEN | Module is already open. |
FSP_ERR_INVALID_ARGUMENT | Invalid parameter. |
fsp_err_t R_RTC_Close | ( | rtc_ctrl_t *const | p_ctrl | ) |
Close the RTC driver. Implements rtc_api_t::close
FSP_SUCCESS | De-Initialization was successful and RTC driver closed. |
FSP_ERR_ASSERTION | Invalid p_ctrl. |
FSP_ERR_NOT_OPEN | Driver not open already for close. |
fsp_err_t R_RTC_ClockSourceSet | ( | rtc_ctrl_t *const | p_ctrl | ) |
rtc_api_t::clockSourceSet is not supported on the RTC.
FSP_ERR_UNSUPPORTED | Function not supported in this implementation. |
fsp_err_t R_RTC_CalendarTimeSet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_time_t *const | p_time | ||
) |
Set the calendar time.
Implements rtc_api_t::calendarTimeSet.
FSP_SUCCESS | Calendar time set operation was successful. |
FSP_ERR_ASSERTION | Invalid input argument. |
FSP_ERR_NOT_OPEN | Driver not open already for operation. |
FSP_ERR_INVALID_ARGUMENT | Invalid time parameter field. |
fsp_err_t R_RTC_CalendarTimeGet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_time_t *const | p_time | ||
) |
Get the calendar time.
Implements rtc_api_t::calendarTimeGet
FSP_SUCCESS | Calendar time get operation was successful. |
FSP_ERR_ASSERTION | Invalid input argument. |
FSP_ERR_NOT_OPEN | Driver not open already for operation. |
fsp_err_t R_RTC_CalendarAlarmSet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_alarm_time_t *const | p_alarm | ||
) |
Set the calendar alarm time.
Implements rtc_api_t::calendarAlarmSet.
FSP_SUCCESS | Calendar alarm time set operation was successful. |
FSP_ERR_INVALID_ARGUMENT | Invalid time parameter field. |
FSP_ERR_ASSERTION | Invalid input argument. |
FSP_ERR_NOT_OPEN | Driver not open already for operation. |
FSP_ERR_IRQ_BSP_DISABLED | User IRQ parameter not valid |
fsp_err_t R_RTC_CalendarAlarmGet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_alarm_time_t *const | p_alarm | ||
) |
Get the calendar alarm time.
Implements rtc_api_t::calendarAlarmGet
FSP_SUCCESS | Calendar alarm time get operation was successful. |
FSP_ERR_ASSERTION | Invalid input argument. |
FSP_ERR_NOT_OPEN | Driver not open already for operation. |
fsp_err_t R_RTC_PeriodicIrqRateSet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_periodic_irq_select_t const | rate | ||
) |
Set the periodic interrupt rate and enable periodic interrupt.
Implements rtc_api_t::periodicIrqRateSet
FSP_SUCCESS | The periodic interrupt rate was successfully set. |
FSP_ERR_ASSERTION | Invalid input argument. |
FSP_ERR_NOT_OPEN | Driver not open already for operation. |
FSP_ERR_IRQ_BSP_DISABLED | User IRQ parameter not valid |
FSP_ERR_INVALID_ARGUMENT | Invalid periodic IRQ rate value |
fsp_err_t R_RTC_ErrorAdjustmentSet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_error_adjustment_cfg_t const *const | err_adj_cfg | ||
) |
rtc_api_t::errorAdjustmentSet is not supported on the RTC.
FSP_ERR_UNSUPPORTED | Function not supported in this implementation. |
fsp_err_t R_RTC_InfoGet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_info_t *const | p_rtc_info | ||
) |
Get RTC clock source and running status information and store it in provided pointer p_rtc_info. Before or immediately after the first call to R_RTC_CalendarTimeSet, RTC_STATUS_STOPPED will be returned. Two PCLKRTC after the first call to R_RTC_CalendarTimeSet, RTC_STATUS_RUNNING will be returned.
Implements rtc_api_t::infoGet
FSP_SUCCESS | Get information Successful. |
FSP_ERR_ASSERTION | Invalid input argument. |
FSP_ERR_NOT_OPEN | Driver not open already for operation. |
fsp_err_t R_RTC_CallbackSet | ( | rtc_ctrl_t *const | p_ctrl, |
void(*)(rtc_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
rtc_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback and has option of providing memory for callback structure. Implements rtc_api_t::callbackSet
FSP_SUCCESS | Callback updated successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | The control block has not been opened |
fsp_err_t R_RTC_TimeCaptureSet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_time_capture_t *const | p_time_capture | ||
) |
rtc_api_t::timeCaptureSet is not supported on the RTC.
FSP_ERR_UNSUPPORTED | Function not supported in this implementation. |
fsp_err_t R_RTC_TimeCaptureGet | ( | rtc_ctrl_t *const | p_ctrl, |
rtc_time_capture_t *const | p_time_capture | ||
) |
rtc_api_t::timeCaptureGet is not supported on the RTC.
FSP_ERR_UNSUPPORTED | Function not supported in this implementation. |