VSF Documented
Data Structures | Macros | Typedefs | Enumerations | Functions
vsf_template_rtc.h File Reference
#include "./vsf_template_hal_driver.h"
#include "hal/arch/vsf_arch.h"

Go to the source code of this file.

Data Structures

struct  vsf_rtc_tm_t
 Time structure for RTC operations. Used to represent date and time information in a standardized format. More...
 
struct  vsf_rtc_isr_t
 RTC interrupt service routine configuration structure. More...
 
struct  vsf_rtc_cfg_t
 RTC configuration structure. More...
 
struct  vsf_rtc_capability_t
 RTC capability structure. Describes the features and capabilities supported by the RTC hardware. More...
 
struct  vsf_rtc_op_t
 RTC operation function pointer type, used for RTC Multi Class support. More...
 
struct  vsf_rtc_t
 RTC instance structure, used for RTC Multi Class support, not needed in non Multi Class mode. More...
 

Macros

#define VSF_RTC_CFG_MULTI_CLASS   ENABLED
 Enable multi-class support by default for maximum availability.
 
#define VSF_RTC_CFG_PREFIX   vsf
 Convert count to mask in specific hardware driver.
 
#define VSF_RTC_CFG_FUNCTION_RENAME   ENABLED
 Disable VSF_RTC_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_rtc_init()).
 
#define VSF_RTC_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED
 Enable macro VSF_RTC_CFG_REIMPLEMENT_TYPE_IRQ_MASK in specific hardware drivers to redefine enum vsf_rtc_irq_mask_t.
 
#define VSF_RTC_CFG_REIMPLEMENT_TYPE_CFG   DISABLED
 Enable reimplementation of configuration type.
 
#define VSF_RTC_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED
 Enable reimplementation of capability type.
 
#define VSF_RTC_CFG_TIME_TYPE   uint64_t
 Configure the data type used for time representation.
 
#define VSF_RTC_CFG_INHERIT_HAL_CAPABILITY   ENABLED
 Enable inheritance of HAL capability.
 
#define VSF_RTC_APIS(__prefix_name)
 RTC API template macro, used to generate RTC type, specific prefix function declarations, etc.
 

Typedefs

typedef enum vsf_rtc_irq_mask_t vsf_rtc_irq_mask_t
 RTC interrupt mask definition. Used to identify and manage different types of RTC interrupts.
 
typedef VSF_RTC_CFG_TIME_TYPE vsf_rtc_time_t
 RTC time type definition.
 
typedef struct vsf_rtc_tm_t vsf_rtc_tm_t
 Time structure for RTC operations. Used to represent date and time information in a standardized format.
 
typedef struct vsf_rtc_t vsf_rtc_t
 
typedef void vsf_rtc_isr_handler_t(void *target_ptr, vsf_rtc_t *rtc_ptr, vsf_rtc_irq_mask_t irq_mask)
 RTC interrupt handler function type.
 
typedef struct vsf_rtc_isr_t vsf_rtc_isr_t
 RTC interrupt service routine configuration structure.
 
typedef struct vsf_rtc_cfg_t vsf_rtc_cfg_t
 RTC configuration structure.
 
typedef struct vsf_rtc_capability_t vsf_rtc_capability_t
 RTC capability structure. Describes the features and capabilities supported by the RTC hardware.
 
typedef struct vsf_rtc_op_t vsf_rtc_op_t
 RTC operation function pointer type, used for RTC Multi Class support.
 

Enumerations

enum  vsf_rtc_irq_mask_t { VSF_RTC_IRQ_MASK_ALARM = (1 << 0) }
 RTC interrupt mask definition. Used to identify and manage different types of RTC interrupts. More...
 
enum  { VSF_RTC_IRQ_ALL_BITS_MASK = VSF_RTC_IRQ_MASK_ALARM }
 RTC interrupt mask completion. Used to define the combination of all available interrupt masks. More...
 

Functions

vsf_err_t vsf_rtc_init (vsf_rtc_t *rtc_ptr, vsf_rtc_cfg_t *cfg_ptr)
 Initialize a RTC instance.
 
void vsf_rtc_fini (vsf_rtc_t *rtc_ptr)
 Finalize a RTC instance.
 
fsm_rt_t vsf_rtc_enable (vsf_rtc_t *rtc_ptr)
 Enable a RTC instance.
 
fsm_rt_t vsf_rtc_disable (vsf_rtc_t *rtc_ptr)
 Disable a RTC instance.
 
vsf_rtc_capability_t vsf_rtc_capability (vsf_rtc_t *rtc_ptr)
 Get the capability of RTC instance.
 
vsf_err_t vsf_rtc_get_configuration (vsf_rtc_t *rtc_ptr, vsf_rtc_cfg_t *cfg_ptr)
 Get the current configuration of an RTC instance.
 
vsf_err_t vsf_rtc_get (vsf_rtc_t *rtc_ptr, vsf_rtc_tm_t *rtc_tm)
 Get RTC date and time.
 
vsf_err_t vsf_rtc_set (vsf_rtc_t *rtc_ptr, const vsf_rtc_tm_t *rtc_tm)
 Set RTC date and time.
 
vsf_err_t vsf_rtc_get_time (vsf_rtc_t *rtc_ptr, vsf_rtc_time_t *second_ptr, vsf_rtc_time_t *millisecond_ptr)
 Get RTC time in seconds and milliseconds.
 
vsf_err_t vsf_rtc_set_time (vsf_rtc_t *rtc_ptr, vsf_rtc_time_t seconds, vsf_rtc_time_t milliseconds)
 Set RTC time in seconds and milliseconds.
 

Macro Definition Documentation

◆ VSF_RTC_CFG_MULTI_CLASS

#define VSF_RTC_CFG_MULTI_CLASS   ENABLED

Enable multi-class support by default for maximum availability.

◆ VSF_RTC_CFG_PREFIX

#define VSF_RTC_CFG_PREFIX   vsf

Convert count to mask in specific hardware driver.

Note
This macro is used to convert a count value to its corresponding bit mask. For example, if VSF_HW_RTC_COUNT is 3, VSF_HW_RTC_MASK will be 0x07 (binary: 111).

Convert mask to count in specific hardware driver.

We can redefine macro VSF_RTC_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code.

◆ VSF_RTC_CFG_FUNCTION_RENAME

#define VSF_RTC_CFG_FUNCTION_RENAME   ENABLED

Disable VSF_RTC_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_rtc_init()).

◆ VSF_RTC_CFG_REIMPLEMENT_TYPE_IRQ_MASK

#define VSF_RTC_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED

Enable macro VSF_RTC_CFG_REIMPLEMENT_TYPE_IRQ_MASK in specific hardware drivers to redefine enum vsf_rtc_irq_mask_t.

◆ VSF_RTC_CFG_REIMPLEMENT_TYPE_CFG

#define VSF_RTC_CFG_REIMPLEMENT_TYPE_CFG   DISABLED

Enable reimplementation of configuration type.

◆ VSF_RTC_CFG_REIMPLEMENT_TYPE_CAPABILITY

#define VSF_RTC_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED

Enable reimplementation of capability type.

◆ VSF_RTC_CFG_TIME_TYPE

#define VSF_RTC_CFG_TIME_TYPE   uint64_t

Configure the data type used for time representation.

Note
Uses uint64_t by default for maximum range

◆ VSF_RTC_CFG_INHERIT_HAL_CAPABILITY

#define VSF_RTC_CFG_INHERIT_HAL_CAPABILITY   ENABLED

Enable inheritance of HAL capability.

Note
When enabled RTC capability structure inherits from vsf_peripheral_capability_t

◆ VSF_RTC_APIS

#define VSF_RTC_APIS (   __prefix_name)
Value:
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rtc, init, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr, vsf_rtc_cfg_t *cfg_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, rtc, fini, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rtc, get_configuration, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr, vsf_rtc_cfg_t *cfg_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, rtc, enable, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, rtc, disable, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_rtc_capability_t, rtc, capability, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rtc, get, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr, vsf_rtc_tm_t *rtc_tm) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rtc, set, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr, const vsf_rtc_tm_t *rtc_tm) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rtc, get_time, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr, vsf_rtc_time_t *second_ptr, vsf_rtc_time_t *millisecond_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rtc, set_time, VSF_MCONNECT(__prefix_name, _t) *rtc_ptr, vsf_rtc_time_t seconds, vsf_rtc_time_t milliseconds)
vsf_err_t
Definition __type.h:42
struct VSF_MCONNECT(VSF_FLASH_CFG_IMP_PREFIX, _flash_t)
Definition flash.c:53
__le16 capability
Definition ieee80211.h:134
RTC capability structure. Describes the features and capabilities supported by the RTC hardware.
Definition vsf_template_rtc.h:364
RTC configuration structure.
Definition vsf_template_rtc.h:350
Time structure for RTC operations. Used to represent date and time information in a standardized form...
Definition vsf_template_rtc.h:240
fsm_rt_t
Definition vsf_fsm.h:315
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:117
VSF_RTC_CFG_TIME_TYPE vsf_rtc_time_t
RTC time type definition.
Definition vsf_template_rtc.h:230

RTC API template macro, used to generate RTC type, specific prefix function declarations, etc.

Parameters
[in]__prefix_nameThe prefix to use for all generated functions

Typedef Documentation

◆ vsf_rtc_irq_mask_t

RTC interrupt mask definition. Used to identify and manage different types of RTC interrupts.

◆ vsf_rtc_time_t

RTC time type definition.

Note
This type is used for storing time values

◆ vsf_rtc_tm_t

typedef struct vsf_rtc_tm_t vsf_rtc_tm_t

Time structure for RTC operations. Used to represent date and time information in a standardized format.

◆ vsf_rtc_t

typedef struct vsf_rtc_t vsf_rtc_t

◆ vsf_rtc_isr_handler_t

typedef void vsf_rtc_isr_handler_t(void *target_ptr, vsf_rtc_t *rtc_ptr, vsf_rtc_irq_mask_t irq_mask)

RTC interrupt handler function type.

Parameters
[in,out]target_ptrUser defined target pointer for context data
[in]rtc_ptrRTC instance pointer for accessing RTC data
[in]irq_maskInterrupt mask indicating which interrupt(s) occurred

◆ vsf_rtc_isr_t

typedef struct vsf_rtc_isr_t vsf_rtc_isr_t

RTC interrupt service routine configuration structure.

◆ vsf_rtc_cfg_t

typedef struct vsf_rtc_cfg_t vsf_rtc_cfg_t

RTC configuration structure.

◆ vsf_rtc_capability_t

RTC capability structure. Describes the features and capabilities supported by the RTC hardware.

◆ vsf_rtc_op_t

typedef struct vsf_rtc_op_t vsf_rtc_op_t

RTC operation function pointer type, used for RTC Multi Class support.

Enumeration Type Documentation

◆ vsf_rtc_irq_mask_t

RTC interrupt mask definition. Used to identify and manage different types of RTC interrupts.

Enumerator
VSF_RTC_IRQ_MASK_ALARM 

Alarm interrupt mask. Triggers when the RTC time matches the configured alarm time.

◆ anonymous enum

anonymous enum

RTC interrupt mask completion. Used to define the combination of all available interrupt masks.

Enumerator
VSF_RTC_IRQ_ALL_BITS_MASK 

All supported RTC interrupt masks combined. Includes all interrupt types the RTC hardware supports.

Function Documentation

◆ vsf_rtc_init()

vsf_err_t vsf_rtc_init ( vsf_rtc_t rtc_ptr,
vsf_rtc_cfg_t cfg_ptr 
)
extern

Initialize a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[in]cfg_ptrPointer to configuration structure vsf_rtc_cfg_t
Returns
vsf_err_t VSF_ERR_NONE if initialization successful, otherwise returns error code
Note
It is not necessary to call vsf_rtc_fini() to deinitialize. vsf_rtc_init() should be called before any other RTC API except vsf_rtc_capability().

◆ vsf_rtc_fini()

void vsf_rtc_fini ( vsf_rtc_t rtc_ptr)
extern

Finalize a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
None

◆ vsf_rtc_enable()

fsm_rt_t vsf_rtc_enable ( vsf_rtc_t rtc_ptr)
extern

Enable a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
fsm_rt_t FSM_RT_CPL if RTC was enabled, fsm_rt_on_going if RTC is still enabling

◆ vsf_rtc_disable()

fsm_rt_t vsf_rtc_disable ( vsf_rtc_t rtc_ptr)
extern

Disable a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
fsm_rt_t FSM_RT_CPL if RTC was disabled, fsm_rt_on_going if RTC is still disabling

◆ vsf_rtc_capability()

vsf_rtc_capability_t vsf_rtc_capability ( vsf_rtc_t rtc_ptr)
extern

Get the capability of RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
vsf_rtc_capability_t All capabilities of current RTC, reference vsf_rtc_capability_t

◆ vsf_rtc_get_configuration()

vsf_err_t vsf_rtc_get_configuration ( vsf_rtc_t rtc_ptr,
vsf_rtc_cfg_t cfg_ptr 
)
extern

Get the current configuration of an RTC instance.

Parameters
[in]rtc_ptrpointer to structure vsf_rtc_t
[out]cfg_ptrpointer to configuration structure vsf_rtc_cfg_t to store the current configuration
Returns
vsf_err_t: VSF_ERR_NONE if successful, otherwise return error code
Note
This function retrieves the current RTC configuration including interrupt settings and other parameters. The RTC instance should be initialized before calling this function.

◆ vsf_rtc_get()

vsf_err_t vsf_rtc_get ( vsf_rtc_t rtc_ptr,
vsf_rtc_tm_t rtc_tm 
)
extern

Get RTC date and time.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[out]rtc_tmDate and time (year, month, day, hour, minute, second, etc.)
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code

◆ vsf_rtc_set()

vsf_err_t vsf_rtc_set ( vsf_rtc_t rtc_ptr,
const vsf_rtc_tm_t rtc_tm 
)
extern

Set RTC date and time.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[in]rtc_tmDate and time (year, month, day, hour, minute, second, etc.)
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code

◆ vsf_rtc_get_time()

vsf_err_t vsf_rtc_get_time ( vsf_rtc_t rtc_ptr,
vsf_rtc_time_t second_ptr,
vsf_rtc_time_t millisecond_ptr 
)
extern

Get RTC time in seconds and milliseconds.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[out]second_ptrSeconds
[out]millisecond_ptrMilliseconds
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code

◆ vsf_rtc_set_time()

vsf_err_t vsf_rtc_set_time ( vsf_rtc_t rtc_ptr,
vsf_rtc_time_t  seconds,
vsf_rtc_time_t  milliseconds 
)
extern

Set RTC time in seconds and milliseconds.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[in]secondsSeconds
[in]millisecondsMilliseconds
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code
Generated from commit: vsfteam/vsf@74aa6ce