VSF Documented
Macros | Functions
timer_common.c File Reference
#include "hal/driver/driver.h"

Macros

#define VSF_TIMER_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_timer_init (vsf_timer_t *timer_ptr, vsf_timer_cfg_t *cfg_ptr)
 Initialize a Timer instance.
 
void vsf_timer_fini (vsf_timer_t *timer_ptr)
 Finalize a TIMER instance.
 
fsm_rt_t vsf_timer_enable (vsf_timer_t *timer_ptr)
 Enable a TIMER instance.
 
fsm_rt_t vsf_timer_disable (vsf_timer_t *timer_ptr)
 Disable a TIMER instance.
 
void vsf_timer_irq_enable (vsf_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask)
 Enable interrupt masks of TIMER instance.
 
void vsf_timer_irq_disable (vsf_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask)
 Disable interrupt masks of TIMER instance.
 
vsf_timer_status_t vsf_timer_status (vsf_timer_t *timer_ptr)
 Get the status of TIMER instance.
 
vsf_timer_capability_t vsf_timer_capability (vsf_timer_t *timer_ptr)
 get the capability of TIMER instance.
 
vsf_err_t vsf_timer_set_period (vsf_timer_t *timer_ptr, uint32_t period)
 TIMER set period (maximum count), used for change the period of TIMER dynamically.
 
vsf_err_t vsf_timer_ctrl (vsf_timer_t *timer_ptr, vsf_timer_ctrl_t ctrl, void *param)
 Execute a control command on the TIMER instance.
 
vsf_err_t vsf_timer_channel_config (vsf_timer_t *timer_ptr, uint8_t channel, vsf_timer_channel_cfg_t *channel_ptr)
 TIMER set the period width and pulse width for a channel.
 
vsf_err_t vsf_timer_channel_start (vsf_timer_t *timer_ptr, uint8_t channel)
 start a TIMER channel
 
vsf_err_t vsf_timer_channel_stop (vsf_timer_t *timer_ptr, uint8_t channel)
 stop a TIMER channel
 
vsf_err_t vsf_timer_channel_ctrl (vsf_timer_t *timer_ptr, uint8_t channel, vsf_timer_channel_ctrl_t ctrl, void *param)
 Execute a control command on the TIMER channel.
 
vsf_err_t vsf_timer_get_configuration (vsf_timer_t *timer_ptr, vsf_timer_cfg_t *cfg_ptr)
 Get the current configuration of a TIMER instance.
 

Macro Definition Documentation

◆ VSF_TIMER_CFG_FUNCTION_RENAME

#define VSF_TIMER_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_timer_init()

vsf_err_t vsf_timer_init ( vsf_timer_t timer_ptr,
vsf_timer_cfg_t cfg_ptr 
)

Initialize a Timer instance.

Parameters
[in]timer_ptrpointer to Timer instance
[in]cfg_ptrpointer to configuration structure
Returns
vsf_err_t: VSF_ERR_NONE if successful, otherwise return error code
Note
It is not necessary to call vsf_timer_fini() to deinitialization. vsf_timer_init() should be called before any other Timer API except vsf_timer_capability().

◆ vsf_timer_fini()

void vsf_timer_fini ( vsf_timer_t timer_ptr)

Finalize a TIMER instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
Returns
none

◆ vsf_timer_enable()

fsm_rt_t vsf_timer_enable ( vsf_timer_t timer_ptr)

Enable a TIMER instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
Returns
fsm_rt_t: FSM_RT_CPL if TIMER was enabled, fsm_rt_on_going if TIMER is still enabling

◆ vsf_timer_disable()

fsm_rt_t vsf_timer_disable ( vsf_timer_t timer_ptr)

Disable a TIMER instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
Returns
fsm_rt_t: FSM_RT_CPL if TIMER was disabled, fsm_rt_on_going if TIMER is still disabling

◆ vsf_timer_irq_enable()

void vsf_timer_irq_enable ( vsf_timer_t timer_ptr,
vsf_timer_irq_mask_t  irq_mask 
)

Enable interrupt masks of TIMER instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]irq_maskone or more value of enum vsf_timer_irq_mask_t
Returns
none
Note
All pending interrupts should be cleared before interrupts are enabled.

◆ vsf_timer_irq_disable()

void vsf_timer_irq_disable ( vsf_timer_t timer_ptr,
vsf_timer_irq_mask_t  irq_mask 
)

Disable interrupt masks of TIMER instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]irq_maskone or more value of enum vsf_timer_irq_mask_t, vsf_timer_irq_mask_t
Returns
none

◆ vsf_timer_status()

vsf_timer_status_t vsf_timer_status ( vsf_timer_t timer_ptr)

Get the status of TIMER instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
Returns
vsf_timer_status_t: return all status of current TIMER

◆ vsf_timer_capability()

vsf_timer_capability_t vsf_timer_capability ( vsf_timer_t timer_ptr)

get the capability of TIMER instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
Returns
vsf_timer_capability_t: all capability of current TIMER vsf_timer_capability_t

◆ vsf_timer_set_period()

vsf_err_t vsf_timer_set_period ( vsf_timer_t timer_ptr,
uint32_t  period 
)

TIMER set period (maximum count), used for change the period of TIMER dynamically.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]periodtimer period width (in clock counter)
Returns
vsf_err_t: VSF_ERR_NONE if the TIMER set period was successfully, or a negative error code

◆ vsf_timer_ctrl()

vsf_err_t vsf_timer_ctrl ( vsf_timer_t timer_ptr,
vsf_timer_ctrl_t  ctrl,
void *  param 
)

Execute a control command on the TIMER instance.

Parameters
[in,out]timer_ptrPointer to TIMER instance structure vsf_timer_t
[in]ctrlControl command from vsf_timer_ctrl_t enumeration
[in]paramCommand-specific parameter (can be NULL depending on command)
Returns
vsf_err_t: VSF_ERR_NONE if command executed successfully, VSF_ERR_NOT_SUPPORT if command is not supported, other negative error codes for specific failures
Note
Available commands and their parameters are hardware-dependent
Some commands may not be supported on all hardware platforms

◆ vsf_timer_channel_config()

vsf_err_t vsf_timer_channel_config ( vsf_timer_t timer_ptr,
uint8_t  channel,
vsf_timer_channel_cfg_t channel_cfg_ptr 
)

TIMER set the period width and pulse width for a channel.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]channeltimer channel
[in]channel_cfg_ptra pointer to structure vsf_timer_channel_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if the TIMER channel set was successfully, or a negative error code

◆ vsf_timer_channel_start()

vsf_err_t vsf_timer_channel_start ( vsf_timer_t timer_ptr,
uint8_t  channel 
)

start a TIMER channel

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]channeltimer channel
Returns
vsf_err_t: VSF_ERR_NONE if the TIMER channel start was successfully, or a negative error code

◆ vsf_timer_channel_stop()

vsf_err_t vsf_timer_channel_stop ( vsf_timer_t timer_ptr,
uint8_t  channel 
)

stop a TIMER channel

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]channeltimer channel
Returns
vsf_err_t: VSF_ERR_NONE if the TIMER channel stop was successfully, or a negative error code

◆ vsf_timer_channel_ctrl()

vsf_err_t vsf_timer_channel_ctrl ( vsf_timer_t timer_ptr,
uint8_t  channel,
vsf_timer_channel_ctrl_t  ctrl,
void *  param 
)

Execute a control command on the TIMER channel.

Parameters
[in,out]timer_ptrPointer to TIMER instance structure vsf_timer_t
[in]channeltimer channel
[in]ctrlControl command from vsf_timer_channel_ctrl_t enumeration
[in]paramCommand-specific parameter (can be NULL depending on command)
Returns
vsf_err_t: VSF_ERR_NONE if command executed successfully, VSF_ERR_NOT_SUPPORT if command is not supported, other negative error codes for specific failures
Note
Available commands and their parameters are hardware-dependent
Some commands may not be supported on all hardware platforms

◆ vsf_timer_get_configuration()

vsf_err_t vsf_timer_get_configuration ( vsf_timer_t timer_ptr,
vsf_timer_cfg_t cfg_ptr 
)

Get the current configuration of a TIMER instance.

Parameters
[in]timer_ptrpointer to structure vsf_timer_t
[out]cfg_ptrpointer to configuration structure vsf_timer_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 TIMER configuration including interrupt settings and other parameters. The TIMER instance should be initialized before calling this function.
Generated from commit: vsfteam/vsf@74aa6ce