VSF Documented
Data Structures | Macros | Typedefs | Enumerations | Functions
vsf_template_timer.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_timer_isr_t
 
struct  vsf_timer_cfg_t
 timer configuration More...
 
struct  vsf_timer_channel_cfg_t
 
struct  vsf_timer_channel_request_t
 
struct  vsf_timer_status_t
 TIMER status information structure Contains the current status of TIMER operations. More...
 
struct  vsf_timer_capability_t
 
struct  vsf_timer_op_t
 
struct  vsf_timer_t
 

Macros

#define VSF_TIMER_CFG_MULTI_CLASS   ENABLED
 Enable multi-class support by default for maximum availability.
 
#define VSF_TIMER_CFG_PREFIX   vsf
 In the specific hardware driver, either VSF_HW_TIMER_COUNT or VSF_HW_TIMER_MASK is defined.
 
#define VSF_TIMER_CFG_FUNCTION_RENAME   ENABLED
 Disable VSF_TIMER_CFG_FUNCTION_RENAME to use the original function names.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED
 Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK in specific hardware drivers to redefine enum vsf_timer_irq_mask_t.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG   DISABLED
 Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG in specific hardware drivers to redefine struct vsf_timer_cfg_t. vsf_timer_isr_handler_t type also needs to be redefined. For compatibility, members should not be deleted when redefining.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE   DISABLED
 Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE in specific hardware drivers to redefine enum vsf_timer_channel_mode_t.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG   DISABLED
 Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG in specific hardware drivers to redefine struct vsf_timer_channel_cfg_t. For compatibility, members should not be deleted when redefining.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_REQUEST   DISABLED
 Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_REQUEST in specific hardware drivers to redefine struct vsf_timer_channel_request_t. For compatibility, members should not be deleted when redefining.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_STATUS   DISABLED
 In the specific hardware driver, we can enable VSF_TIMER_CFG_REIMPLEMENT_TYPE_STATUS to redefine struct vsf_timer_status_t.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CTRL   DISABLED
 In the specific hardware driver, we can enable VSF_TIMER_CFG_REIMPLEMENT_TYPE_CTRL to redefine vsf_timer_ctrl_t as needed.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CTRL   DISABLED
 In the specific hardware driver, we can enable VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CTRL to redefine vsf_timer_channel_ctrl_t as needed.
 
#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED
 Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY in specific hardware drivers to redefine struct vsf_timer_capability_t. For compatibility, members should not be deleted when redefining.
 
#define VSF_TIMER_CFG_INHERIT_HAL_CAPABILITY   ENABLED
 Enable macro VSF_TIMER_CFG_INHERIT_HAL_CAPABILITY to inherit capability from HAL.
 
#define VSF_TIMER_APIS(__prefix_name)
 Timer API template macros for generating timer function declarations and implementations.
 

Typedefs

typedef enum vsf_timer_channel_mode_t vsf_timer_channel_mode_t
 
typedef enum vsf_timer_irq_mask_t vsf_timer_irq_mask_t
 
typedef struct vsf_timer_t vsf_timer_t
 
typedef void vsf_timer_isr_handler_t(void *target_ptr, vsf_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask)
 
typedef struct vsf_timer_isr_t vsf_timer_isr_t
 
typedef struct vsf_timer_cfg_t vsf_timer_cfg_t
 timer configuration
 
typedef struct vsf_timer_channel_cfg_t vsf_timer_channel_cfg_t
 
typedef enum vsf_timer_ctrl_t vsf_timer_ctrl_t
 Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.
 
typedef enum vsf_timer_channel_ctrl_t vsf_timer_channel_ctrl_t
 Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.
 
typedef struct vsf_timer_channel_request_t vsf_timer_channel_request_t
 
typedef struct vsf_timer_status_t vsf_timer_status_t
 TIMER status information structure Contains the current status of TIMER operations.
 
typedef struct vsf_timer_capability_t vsf_timer_capability_t
 
typedef struct vsf_timer_op_t vsf_timer_op_t
 

Enumerations

enum  vsf_timer_channel_mode_t {
  VSF_TIMER_CHANNEL_MODE_BASE = (0x00 << 0) ,
  VSF_TIMER_BASE_ONESHOT = (0x00 << 5) ,
  VSF_TIMER_BASE_CONTINUES = (0x01 << 5)
}
 
enum  {
  VSF_TIMER_CHANNEL_MODE_MASK = VSF_TIMER_CHANNEL_MODE_BASE ,
  VSF_TIMER_BASE_COUNTER_MASK ,
  VSF_TIMER_CHANNEL_MODE_ALL_MASK
}
 
enum  vsf_timer_irq_mask_t { VSF_TIMER_IRQ_MASK_OVERFLOW = (0x01 << 0) }
 
enum  {
  VSF_TIMER_IRQ_COUNT = 1 ,
  VSF_TIMER_IRQ_ALL_BITS_MASK = VSF_TIMER_IRQ_MASK_OVERFLOW
}
 
enum  vsf_timer_ctrl_t { __VSF_TIMER_CTRL_DUMMY = 0 }
 Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time. More...
 
enum  vsf_timer_channel_ctrl_t { __VSF_TIMER_CHANNEL_CTRL_DUMMY = 0 }
 Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time. More...
 

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_cfg_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_request_start (vsf_timer_t *timer_ptr, uint8_t channel, vsf_timer_channel_request_t *request_ptr)
 start a TIMER channel request (usually based on DMA)
 
vsf_err_t vsf_timer_channel_request_stop (vsf_timer_t *timer_ptr, uint8_t channel)
 stop a TIMER channel request.
 
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.
 

Macro Definition Documentation

◆ VSF_TIMER_CFG_MULTI_CLASS

#define VSF_TIMER_CFG_MULTI_CLASS   ENABLED

Enable multi-class support by default for maximum availability.

◆ VSF_TIMER_CFG_PREFIX

#define VSF_TIMER_CFG_PREFIX   vsf

In the specific hardware driver, either VSF_HW_TIMER_COUNT or VSF_HW_TIMER_MASK is defined.

Application code can redefine this prefix to specify a specific driver to call.

◆ VSF_TIMER_CFG_FUNCTION_RENAME

#define VSF_TIMER_CFG_FUNCTION_RENAME   ENABLED

Disable VSF_TIMER_CFG_FUNCTION_RENAME to use the original function names.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED

Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK in specific hardware drivers to redefine enum vsf_timer_irq_mask_t.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG   DISABLED

Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG in specific hardware drivers to redefine struct vsf_timer_cfg_t. vsf_timer_isr_handler_t type also needs to be redefined. For compatibility, members should not be deleted when redefining.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE   DISABLED

Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE in specific hardware drivers to redefine enum vsf_timer_channel_mode_t.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG   DISABLED

Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG in specific hardware drivers to redefine struct vsf_timer_channel_cfg_t. For compatibility, members should not be deleted when redefining.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_REQUEST

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_REQUEST   DISABLED

Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_REQUEST in specific hardware drivers to redefine struct vsf_timer_channel_request_t. For compatibility, members should not be deleted when redefining.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_STATUS

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_STATUS   DISABLED

In the specific hardware driver, we can enable VSF_TIMER_CFG_REIMPLEMENT_TYPE_STATUS to redefine struct vsf_timer_status_t.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_CTRL

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CTRL   DISABLED

In the specific hardware driver, we can enable VSF_TIMER_CFG_REIMPLEMENT_TYPE_CTRL to redefine vsf_timer_ctrl_t as needed.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CTRL

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CTRL   DISABLED

In the specific hardware driver, we can enable VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_CTRL to redefine vsf_timer_channel_ctrl_t as needed.

◆ VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY

#define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED

Enable macro VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY in specific hardware drivers to redefine struct vsf_timer_capability_t. For compatibility, members should not be deleted when redefining.

◆ VSF_TIMER_CFG_INHERIT_HAL_CAPABILITY

#define VSF_TIMER_CFG_INHERIT_HAL_CAPABILITY   ENABLED

Enable macro VSF_TIMER_CFG_INHERIT_HAL_CAPABILITY to inherit capability from HAL.

◆ VSF_TIMER_APIS

#define VSF_TIMER_APIS (   __prefix_name)
Value:
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, init, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, vsf_timer_cfg_t *cfg_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, timer, fini, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, timer, enable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, timer, disable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, timer, irq_enable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, vsf_timer_irq_mask_t irq_mask) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, timer, irq_disable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, vsf_timer_irq_mask_t irq_mask) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_timer_status_t, timer, status, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_timer_capability_t, timer, capability, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, set_period, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint32_t period) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, ctrl, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, vsf_timer_ctrl_t ctrl, void* param) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, channel_config, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint8_t channel, vsf_timer_channel_cfg_t *channel_cfg_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, channel_start, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint8_t channel) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, channel_stop, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint8_t channel) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, channel_request_start, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint8_t channel, vsf_timer_channel_request_t *request_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, channel_request_stop, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint8_t channel) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, channel_ctrl, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint8_t channel, vsf_timer_channel_ctrl_t ctrl, void* param)
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
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_template_timer.h:598
timer configuration
Definition vsf_template_timer.h:498
Definition vsf_template_timer.h:509
Definition vsf_template_timer.h:561
TIMER status information structure Contains the current status of TIMER operations.
Definition vsf_template_timer.h:588
fsm_rt_t
Definition vsf_fsm.h:315
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:57
vsf_timer_irq_mask_t
Definition vsf_template_timer.h:448
vsf_timer_ctrl_t
Predefined VSF TIMER control command that can be reimplemented in specific hal drivers....
Definition vsf_template_timer.h:533
vsf_timer_channel_ctrl_t
Predefined VSF TIMER control command that can be reimplemented in specific hal drivers....
Definition vsf_template_timer.h:555
uint8_t status
Definition vsf_tgui.h:144

Timer API template macros for generating timer function declarations and implementations.

Typedef Documentation

◆ vsf_timer_channel_mode_t

◆ vsf_timer_irq_mask_t

◆ vsf_timer_t

typedef struct vsf_timer_t vsf_timer_t

◆ vsf_timer_isr_handler_t

typedef void vsf_timer_isr_handler_t(void *target_ptr, vsf_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask)

◆ vsf_timer_isr_t

◆ vsf_timer_cfg_t

timer configuration

Timer configuration structure

◆ vsf_timer_channel_cfg_t

◆ vsf_timer_ctrl_t

Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

◆ vsf_timer_channel_ctrl_t

Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

◆ vsf_timer_channel_request_t

◆ vsf_timer_status_t

TIMER status information structure Contains the current status of TIMER operations.

◆ vsf_timer_capability_t

◆ vsf_timer_op_t

Enumeration Type Documentation

◆ vsf_timer_channel_mode_t

Enumerator
VSF_TIMER_CHANNEL_MODE_BASE 
VSF_TIMER_BASE_ONESHOT 

The following mode only valid for VSF_TIMER_CHANNEL_MODE_BASE

VSF_TIMER_BASE_CONTINUES 

◆ anonymous enum

anonymous enum
Enumerator
VSF_TIMER_CHANNEL_MODE_MASK 
VSF_TIMER_BASE_COUNTER_MASK 
VSF_TIMER_CHANNEL_MODE_ALL_MASK 

◆ vsf_timer_irq_mask_t

Enumerator
VSF_TIMER_IRQ_MASK_OVERFLOW 

◆ anonymous enum

anonymous enum
Enumerator
VSF_TIMER_IRQ_COUNT 
VSF_TIMER_IRQ_ALL_BITS_MASK 

◆ vsf_timer_ctrl_t

Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

Enumerator
__VSF_TIMER_CTRL_DUMMY 

Dummy value for compilation.

◆ vsf_timer_channel_ctrl_t

Predefined VSF TIMER control command that can be reimplemented in specific hal drivers.Optional control command require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can switch to different modes at compile-time.

Enumerator
__VSF_TIMER_CHANNEL_CTRL_DUMMY 

Dummy value for compilation.

Function Documentation

◆ vsf_timer_init()

vsf_err_t vsf_timer_init ( vsf_timer_t timer_ptr,
vsf_timer_cfg_t cfg_ptr 
)
extern

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)
extern

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)
extern

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)
extern

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 
)
extern

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 
)
extern

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)
extern

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)
extern

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 
)
extern

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 
)
extern

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 
)
extern

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 
)
extern

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 
)
extern

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_request_start()

vsf_err_t vsf_timer_channel_request_start ( vsf_timer_t timer_ptr,
uint8_t  channel,
vsf_timer_channel_request_t request_ptr 
)
extern

start a TIMER channel request (usually based on DMA)

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]channeltimer channel
[in]request_ptra pointer to request structure vsf_timer_channel_request_t For VSF_TIMER_CHANNEL_MODE_BASE mode, period_buffer in structure vsf_timer_channel_request_t is array of period value to be set after each overflow. For VSF_TIMER_CHANNEL_MODE_PWM mode, pwm_buffer in structure vsf_timer_channel_request_t is array of pulse value to be set after each overflow. For VSF_TIMER_CHANNEL_MODE_OUTPUT_COMPARE mode, pulse_buffer in structure vsf_timer_channel_request_t is array of pulse value to be set after each overflow. For VSF_TIMER_CHANNEL_MODE_INPUT_CAPTURE mode, input_capture_buffer in structure vsf_timer_channel_request_t is array of input capture value. For VSF_TIMER_CHANNEL_MODE_ENCODER mode, channel_a_buffer and channel_b_buffer in structure vsf_timer_channel_request_t is array of encoder value for channel A and channel B.
Returns
vsf_err_t: VSF_ERR_NONE if the TIMER channel start was successfully, or a negative error code

◆ vsf_timer_channel_request_stop()

vsf_err_t vsf_timer_channel_request_stop ( vsf_timer_t timer_ptr,
uint8_t  channel 
)
extern

stop a TIMER channel request.

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 
)
extern

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
Generated from commit: vsfteam/vsf@2b286be