VSF Documented
Data Structures | Macros | Typedefs | Enumerations | Functions
vsf_template_exti.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_exti_channel_cfg_t
 
struct  vsf_exti_status_t
 Predefined VSF EXTI status that can be reimplemented in specific hal drivers. More...
 
struct  vsf_exti_capability_t
 
struct  vsf_exti_op_t
 
struct  vsf_exti_t
 

Macros

#define VSF_EXTI_CFG_MULTI_CLASS   ENABLED
 Enable multi-class support by default for maximum availability.
 
#define VSF_EXTI_CFG_PREFIX   vsf
 Define EXTI hardware mask if count is defined.
 
#define VSF_EXTI_CFG_REIMPLEMENT_TYPE_MODE   DISABLED
 Enable option to reimplement mode type in specific hardware drivers.
 
#define VSF_EXTI_CFG_FUNCTION_RENAME   ENABLED
 Enable function rename feature.
 
#define VSF_EXTI_CFG_REIMPLEMENT_TYPE_CFG   DISABLED
 
#define VSF_EXTI_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED
 
#define VSF_EXTI_CFG_INHERIT_HAL_CAPABILITY   ENABLED
 
#define VSF_EXTI_APIS(__prefix_name)
 
#define vsf_exti_channel_mask_t   vsf_exti_channel_mask_t
 
#define VSF_EXTI_MODE_LOW_LEVEL   VSF_EXTI_MODE_LOW_LEVEL
 
#define VSF_EXTI_MODE_HIGH_LEVEL   VSF_EXTI_MODE_HIGH_LEVEL
 

Typedefs

typedef uint32_t vsf_exti_channel_mask_t
 
typedef enum vsf_exti_mode_t vsf_exti_mode_t
 Predefined VSF EXTI modes that can be reimplemented in specific hal drivers.
 
typedef struct vsf_exti_t vsf_exti_t
 Pre-declaration of EXTI structures.
 
typedef void vsf_exti_isr_handler_t(void *target_ptr, vsf_exti_t *exti_ptr, vsf_exti_channel_mask_t channel_mask)
 External interrupt callback function for exti.
 
typedef struct vsf_exti_channel_cfg_t vsf_exti_channel_cfg_t
 
typedef struct vsf_exti_status_t vsf_exti_status_t
 Predefined VSF EXTI status that can be reimplemented in specific hal drivers.
 
typedef struct vsf_exti_capability_t vsf_exti_capability_t
 
typedef struct vsf_exti_op_t vsf_exti_op_t
 

Enumerations

enum  vsf_exti_mode_t {
  VSF_EXTI_MODE_NONE = (0 << 0) ,
  VSF_EXTI_MODE_RISING = (3 << 0) ,
  VSF_EXTI_MODE_FALLING = (4 << 0) ,
  VSF_EXTI_MODE_EDGE_RISING_FALLING = VSF_EXTI_MODE_RISING | VSF_EXTI_MODE_FALLING ,
  VSF_EXTI_MODE_LOW_LEVEL = (1 << 0) ,
  VSF_EXTI_MODE_LOW_LEVEL = (1 << 0) ,
  VSF_EXTI_MODE_HIGH_LEVEL = (2 << 0) ,
  VSF_EXTI_MODE_HIGH_LEVEL = (2 << 0)
}
 Predefined VSF EXTI modes that can be reimplemented in specific hal drivers. More...
 
enum  { VSF_EXTI_MODE_MASK }
 

Functions

vsf_err_t vsf_exti_init (vsf_exti_t *exti_ptr)
 Initialize a EXTI instance.
 
void vsf_exti_fini (vsf_exti_t *exti_ptr)
 Finalize a EXTI instance.
 
vsf_err_t vsf_exti_trigger (vsf_exti_t *exti_ptr, vsf_exti_channel_mask_t channel_mask)
 Trigger EXTI channels.
 
vsf_exti_status_t vsf_exti_status (vsf_exti_t *exti_ptr)
 Get the status of EXTI instance.
 
vsf_err_t vsf_exti_config_channels (vsf_exti_t *exti_ptr, vsf_exti_channel_mask_t channel_mask, vsf_exti_channel_cfg_t *cfg_ptr)
 Configure one or more channels of the exti instance.
 
vsf_exti_capability_t vsf_exti_capability (vsf_exti_t *exti_ptr)
 Get the capability of exti instance.
 
vsf_err_t vsf_exti_irq_enable (vsf_exti_t *exti_ptr, vsf_exti_channel_mask_t channel_mask)
 Enable interrupt of one or more channels.
 
vsf_err_t vsf_exti_irq_disable (vsf_exti_t *exti_ptr, vsf_exti_channel_mask_t channel_mask)
 Disable interrupt of one or more channels.
 

Macro Definition Documentation

◆ VSF_EXTI_CFG_MULTI_CLASS

#define VSF_EXTI_CFG_MULTI_CLASS   ENABLED

Enable multi-class support by default for maximum availability.

◆ VSF_EXTI_CFG_PREFIX

#define VSF_EXTI_CFG_PREFIX   vsf

Define EXTI hardware mask if count is defined.

Define EXTI hardware count if mask is defined.

Define EXTI channel mask if count is defined.

Define EXTI channel count if mask is defined.

VSF_EXTI_CFG_PREFIX is used to set the actual API call when calling the vsf_exti_*(). For example, if you configure VSF_EXTI_CFG_PREFIX to be vsf_hw, then call vsf_exti_enable(), which is actually vsf_hw_exti_enable()

If we want the call to vsf_exti_enable in xxxx.c to actually call vsf_example_exti_enable, then it can be configured in front of the .c:

#undef VSF_EXTI_CFG_PREFIX
#define VSF_EXTI_CFG_PREFIX vsf_example

◆ VSF_EXTI_CFG_REIMPLEMENT_TYPE_MODE

#define VSF_EXTI_CFG_REIMPLEMENT_TYPE_MODE   DISABLED

Enable option to reimplement mode type in specific hardware drivers.

◆ VSF_EXTI_CFG_FUNCTION_RENAME

#define VSF_EXTI_CFG_FUNCTION_RENAME   ENABLED

Enable function rename feature.

◆ VSF_EXTI_CFG_REIMPLEMENT_TYPE_CFG

#define VSF_EXTI_CFG_REIMPLEMENT_TYPE_CFG   DISABLED

Redefine struct vsf_exti_channel_cfg_t. The vsf_exti_isr_handler_t type also needs to be redefined For compatibility, members should not be deleted when struct vsf_exti_channel_cfg_t redefining.

◆ VSF_EXTI_CFG_REIMPLEMENT_TYPE_CAPABILITY

#define VSF_EXTI_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED

Redefine struct vsf_exti_capability_t. For compatibility, members should not be deleted when struct vsf_exti_capability_t redefining.

◆ VSF_EXTI_CFG_INHERIT_HAL_CAPABILITY

#define VSF_EXTI_CFG_INHERIT_HAL_CAPABILITY   ENABLED

◆ VSF_EXTI_APIS

#define VSF_EXTI_APIS (   __prefix_name)
Value:
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, exti, init, VSF_MCONNECT(__prefix_name, _t) *exti_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, exti, fini, VSF_MCONNECT(__prefix_name, _t) *exti_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_exti_status_t, exti, status, VSF_MCONNECT(__prefix_name, _t) *exti_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_exti_capability_t, exti, capability, VSF_MCONNECT(__prefix_name, _t) *exti_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, exti, trigger, VSF_MCONNECT(__prefix_name, _t) *exti_ptr, vsf_exti_channel_mask_t channel_mask) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, exti, config_channels, VSF_MCONNECT(__prefix_name, _t) *exti_ptr, vsf_exti_channel_mask_t channel_mask, vsf_exti_channel_cfg_t * cfg_ptr)\
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, exti, irq_enable, VSF_MCONNECT(__prefix_name, _t) *exti_ptr, vsf_exti_channel_mask_t channel_mask) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, exti, irq_disable, VSF_MCONNECT(__prefix_name, _t) *exti_ptr, vsf_exti_channel_mask_t channel_mask)
vsf_err_t
Definition __type.h:42
struct VSF_MCONNECT(VSF_EXTI_CFG_IMP_PREFIX, _exti_irq_t)
Definition exti.c:54
__le16 capability
Definition ieee80211.h:134
Definition vsf_template_exti.h:324
Definition vsf_template_exti.h:302
Predefined VSF EXTI status that can be reimplemented in specific hal drivers.
Definition vsf_template_exti.h:317
uint32_t vsf_exti_channel_mask_t
Definition vsf_template_exti.h:182
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:117
uint8_t status
Definition vsf_tgui.h:144

◆ vsf_exti_channel_mask_t

◆ VSF_EXTI_MODE_LOW_LEVEL

#define VSF_EXTI_MODE_LOW_LEVEL   VSF_EXTI_MODE_LOW_LEVEL

◆ VSF_EXTI_MODE_HIGH_LEVEL

#define VSF_EXTI_MODE_HIGH_LEVEL   VSF_EXTI_MODE_HIGH_LEVEL

Typedef Documentation

◆ vsf_exti_channel_mask_t

◆ vsf_exti_mode_t

Predefined VSF EXTI modes that can be reimplemented in specific hal drivers.

Even if the hardware doesn't support these features, these modes must be implemented: If the IO supports more modes, We can implement it in the hardware driver. If we add a new mode in the hardware driver, then we also need to define the macro VSF_EXTI_MODE_MASK, whose value is the OR of the value of all modes.

Optional features 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 runtime.

◆ vsf_exti_t

typedef struct vsf_exti_t vsf_exti_t

Pre-declaration of EXTI structures.

◆ vsf_exti_isr_handler_t

typedef void vsf_exti_isr_handler_t(void *target_ptr, vsf_exti_t *exti_ptr, vsf_exti_channel_mask_t channel_mask)

External interrupt callback function for exti.

◆ vsf_exti_channel_cfg_t

◆ vsf_exti_status_t

Predefined VSF EXTI status that can be reimplemented in specific hal drivers.

◆ vsf_exti_capability_t

◆ vsf_exti_op_t

typedef struct vsf_exti_op_t vsf_exti_op_t

Enumeration Type Documentation

◆ vsf_exti_mode_t

Predefined VSF EXTI modes that can be reimplemented in specific hal drivers.

Even if the hardware doesn't support these features, these modes must be implemented: If the IO supports more modes, We can implement it in the hardware driver. If we add a new mode in the hardware driver, then we also need to define the macro VSF_EXTI_MODE_MASK, whose value is the OR of the value of all modes.

Optional features 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 runtime.

Enumerator
VSF_EXTI_MODE_NONE 

No external interrupt detection enabled.

VSF_EXTI_MODE_RISING 

Detect interrupts on rising edge of signal.

VSF_EXTI_MODE_FALLING 

Detect interrupts on falling edge of signal.

VSF_EXTI_MODE_EDGE_RISING_FALLING 

Detect interrupts on both rising and falling edges.

VSF_EXTI_MODE_LOW_LEVEL 

Detect interrupts on low signal level.

VSF_EXTI_MODE_LOW_LEVEL 

Detect interrupts on low signal level.

VSF_EXTI_MODE_HIGH_LEVEL 

Detect interrupts on high signal level.

VSF_EXTI_MODE_HIGH_LEVEL 

Detect interrupts on high signal level.

◆ anonymous enum

anonymous enum
Enumerator
VSF_EXTI_MODE_MASK 

Function Documentation

◆ vsf_exti_init()

vsf_err_t vsf_exti_init ( vsf_exti_t exti_ptr)
extern

Initialize a EXTI instance.

Parameters
[in]exti_ptra pointer to structure vsf_exti_t
Returns
vsf_err_t: VSF_ERR_NONE if initialization successful, otherwise returns error code
Note
It is not necessary to call vsf_exti_fini() to deinitialization. vsf_exti_init() should be called before any other EXTI API except vsf_exti_capability().

◆ vsf_exti_fini()

void vsf_exti_fini ( vsf_exti_t exti_ptr)
extern

Finalize a EXTI instance.

Parameters
[in]exti_ptra pointer to structure vsf_exti_t
Returns
none

◆ vsf_exti_trigger()

vsf_err_t vsf_exti_trigger ( vsf_exti_t exti_ptr,
vsf_exti_channel_mask_t  channel_mask 
)
extern

Trigger EXTI channels.

Parameters
[in]exti_ptra pointer to structure vsf_exti_t
[in]channel_maskchannel mask, each channel corresponds to one bit, the value of this bit 1 means the configuration will be applied to the corresponding channel
Returns
vsf_err_t: VSF_ERR_NONE if required channels Triggered, or a negative error code

◆ vsf_exti_status()

vsf_exti_status_t vsf_exti_status ( vsf_exti_t exti_ptr)
extern

Get the status of EXTI instance.

Parameters
[in]exti_ptra pointer to structure vsf_exti_t
Returns
vsf_exti_status_t: all status of current EXTI

◆ vsf_exti_config_channels()

vsf_err_t vsf_exti_config_channels ( vsf_exti_t exti_ptr,
vsf_exti_channel_mask_t  channel_mask,
vsf_exti_channel_cfg_t cfg_ptr 
)
extern

Configure one or more channels of the exti instance.

Parameters
[in]exti_ptra pointer to structure vsf_exti_t
[in]channel_maskchannel mask, each channel corresponds to one bit, the value of this bit 1 means the configuration will be applied to the corresponding channel
[in]cfg_ptra pointer to structure vsf_exti_channel_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if EXTI Configuration Successful, or a negative error code

◆ vsf_exti_capability()

vsf_exti_capability_t vsf_exti_capability ( vsf_exti_t exti_ptr)
extern

Get the capability of exti instance.

Parameters
[in]exti_ptrpointer to the structure vsf_exti_t, refer to vsf_exti_t
Returns
vsf_exti_capability_t: all capabilities of current EXTI vsf_exti_capability_t

◆ vsf_exti_irq_enable()

vsf_err_t vsf_exti_irq_enable ( vsf_exti_t exti_ptr,
vsf_exti_channel_mask_t  channel_mask 
)
extern

Enable interrupt of one or more channels.

Parameters
[in]exti_ptra pointer to structure vsf_exti_t
[in]channel_maskchannel mask, each channel corresponds to one bit, 1 means the corresponding channel needs to be enabled, 0 means the corresponding channel does not need to be enabled
Returns
vsf_err_t: VSF_ERR_NONE if successful, or a negative error code
Note
For some devices, the interrupt priority may be shared between channels on the exti.
All pending interrupts should be cleared before interrupts are enabled.

◆ vsf_exti_irq_disable()

vsf_err_t vsf_exti_irq_disable ( vsf_exti_t exti_ptr,
vsf_exti_channel_mask_t  channel_mask 
)
extern

Disable interrupt of one or more channels.

Parameters
[in]exti_ptra pointer to structure vsf_exti_t
[in]channel_maskchannel mask, each channel corresponds to one bit, 1 means the corresponding channel needs to be disabled, 0 means the corresponding channel does not need to be disabled
Returns
vsf_err_t: VSF_ERR_NONE if successful, or a negative error code
Note
For some devices, the interrupt settings may be shared between channels on the exti.
Generated from commit: vsfteam/vsf@368bfa6