VSF Documented
Data Structures | Macros | Typedefs | Enumerations | Functions
vsf_template_dac.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_dac_channel_cfg_t
 dac channel configuration More...
 
struct  vsf_dac_isr_t
 DAC interrupt configuration structure. More...
 
struct  vsf_dac_cfg_t
 DAC configuration structure. More...
 
struct  vsf_dac_status_t
 DAC status structure that can be reimplemented in specific HAL drivers. More...
 
struct  vsf_dac_capability_t
 DAC capability structure that can be reimplemented in specific HAL drivers. More...
 
struct  vsf_dac_op_t
 
struct  vsf_dac_t
 

Macros

#define VSF_DAC_CFG_MULTI_CLASS   ENABLED
 Enable multi-class support by default for maximum availability.
 
#define VSF_DAC_CFG_PREFIX   vsf
 Define DAC hardware mask if count is defined.
 
#define VSF_DAC_CFG_FUNCTION_RENAME   ENABLED
 Disable VSF_DAC_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_dac_init()).
 
#define VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED
 Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK to reimplement interrupt mask type vsf_dac_irq_mask_t in specific hardware drivers.
 
#define VSF_DAC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG   DISABLED
 Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG to reimplement channel configuration type vsf_dac_channel_cfg_t in specific hardware drivers. For compatibility, do not delete members when redefining vsf_dac_channel_cfg_t.
 
#define VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG   DISABLED
 Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG to reimplement DAC configuration type vsf_dac_cfg_t in specific hardware drivers. For compatibility, do not delete members when redefining vsf_dac_cfg_t. The vsf_dac_isr_handler_t type also needs to be redefined.
 
#define VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED
 Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY to reimplement capability type vsf_dac_capability_t in specific hardware drivers. For compatibility, do not delete members when redefining vsf_dac_capability_t.
 
#define VSF_DAC_CFG_INHERIT_HAL_CAPABILITY   ENABLED
 In specific hardware driver, we can enable macro VSF_DAC_CFG_INHERIT_HAL_CAPABILITY to inherit structure vsf_peripheral_capability_t.
 
#define VSF_DAC_APIS(__prefix_name)
 DAC API template, used to generate DAC type, specific prefix function declarations, etc.
 

Typedefs

typedef enum vsf_dac_irq_mask_t vsf_dac_irq_mask_t
 Predefined VSF DAC interrupts that can be reimplemented in specific HAL drivers. Even if the hardware doesn't support these features, these interrupts must be kept:
 
typedef struct vsf_dac_channel_cfg_t vsf_dac_channel_cfg_t
 dac channel configuration
 
typedef struct vsf_dac_t vsf_dac_t
 
typedef void vsf_dac_isr_handler_t(void *target_ptr, vsf_dac_t *dac_ptr, vsf_dac_irq_mask_t irq_mask)
 DAC interrupt handler function type.
 
typedef struct vsf_dac_isr_t vsf_dac_isr_t
 DAC interrupt configuration structure.
 
typedef struct vsf_dac_cfg_t vsf_dac_cfg_t
 DAC configuration structure.
 
typedef struct vsf_dac_status_t vsf_dac_status_t
 DAC status structure that can be reimplemented in specific HAL drivers.
 
typedef struct vsf_dac_capability_t vsf_dac_capability_t
 DAC capability structure that can be reimplemented in specific HAL drivers.
 
typedef struct vsf_dac_op_t vsf_dac_op_t
 

Enumerations

enum  vsf_dac_irq_mask_t {
  VSF_DAC_IRQ_MASK_IDLE = (0x01ul << 0) ,
  VSF_DAC_IRQ_MASK_CPL = (0x1ul << 0)
}
 Predefined VSF DAC interrupts that can be reimplemented in specific HAL drivers. Even if the hardware doesn't support these features, these interrupts must be kept: More...
 
enum  {
  VSF_DAC_IRQ_COUNT = 2 ,
  VSF_DAC_IRQ_ALL_BITS_MASK = VSF_DAC_IRQ_MASK_IDLE | VSF_DAC_IRQ_MASK_CPL
}
 

Functions

vsf_err_t vsf_dac_init (vsf_dac_t *dac_ptr, vsf_dac_cfg_t *cfg_ptr)
 Initialize a DAC instance.
 
void vsf_dac_fini (vsf_dac_t *dac_ptr)
 Finalize a DAC instance.
 
fsm_rt_t vsf_dac_enable (vsf_dac_t *dac_ptr)
 Enable a DAC instance.
 
fsm_rt_t vsf_dac_disable (vsf_dac_t *dac_ptr)
 Disable a DAC instance.
 
void vsf_dac_irq_enable (vsf_dac_t *dac_ptr, vsf_dac_irq_mask_t irq_mask)
 Enable interrupt masks of DAC instance.
 
void vsf_dac_irq_disable (vsf_dac_t *dac_ptr, vsf_dac_irq_mask_t irq_mask)
 Disable interrupt masks of DAC instance.
 
vsf_dac_status_t vsf_dac_status (vsf_dac_t *dac_ptr)
 Get the status of DAC instance.
 
vsf_dac_capability_t vsf_dac_capability (vsf_dac_t *dac_ptr)
 Get the capability of DAC instance.
 
vsf_err_t vsf_dac_channel_request_once (vsf_dac_t *dac_ptr, vsf_dac_channel_cfg_t *channel_cfg, uint_fast16_t value)
 DAC request convert once.
 
vsf_err_t vsf_dac_channel_config (vsf_dac_t *dac_ptr, vsf_dac_channel_cfg_t *cfgs_ptr, uint_fast8_t cnt)
 DAC channel configuration.
 
vsf_err_t vsf_dac_channel_request (vsf_dac_t *dac_ptr, void *buffer_ptr, uint_fast32_t count)
 DAC channel request.
 

Macro Definition Documentation

◆ VSF_DAC_CFG_MULTI_CLASS

#define VSF_DAC_CFG_MULTI_CLASS   ENABLED

Enable multi-class support by default for maximum availability.

◆ VSF_DAC_CFG_PREFIX

#define VSF_DAC_CFG_PREFIX   vsf

Define DAC hardware mask if count is defined.

Define DAC hardware count if mask is defined.

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

◆ VSF_DAC_CFG_FUNCTION_RENAME

#define VSF_DAC_CFG_FUNCTION_RENAME   ENABLED

Disable VSF_DAC_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_dac_init()).

◆ VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK

#define VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK   DISABLED

Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK to reimplement interrupt mask type vsf_dac_irq_mask_t in specific hardware drivers.

◆ VSF_DAC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG

#define VSF_DAC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG   DISABLED

Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG to reimplement channel configuration type vsf_dac_channel_cfg_t in specific hardware drivers. For compatibility, do not delete members when redefining vsf_dac_channel_cfg_t.

◆ VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG

#define VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG   DISABLED

Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG to reimplement DAC configuration type vsf_dac_cfg_t in specific hardware drivers. For compatibility, do not delete members when redefining vsf_dac_cfg_t. The vsf_dac_isr_handler_t type also needs to be redefined.

◆ VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY

#define VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED

Enable VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY to reimplement capability type vsf_dac_capability_t in specific hardware drivers. For compatibility, do not delete members when redefining vsf_dac_capability_t.

◆ VSF_DAC_CFG_INHERIT_HAL_CAPABILITY

#define VSF_DAC_CFG_INHERIT_HAL_CAPABILITY   ENABLED

In specific hardware driver, we can enable macro VSF_DAC_CFG_INHERIT_HAL_CAPABILITY to inherit structure vsf_peripheral_capability_t.

◆ VSF_DAC_APIS

#define VSF_DAC_APIS (   __prefix_name)
Value:
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, init, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_cfg_t *cfg_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, dac, fini, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, dac, enable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, dac, disable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_dac_status_t, dac, status, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_dac_capability_t, dac, capability, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, dac, irq_enable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_irq_mask_t irq_mask) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, dac, irq_disable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_irq_mask_t irq_mask) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, channel_request_once, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_channel_cfg_t *cfg, uint_fast16_t value) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, channel_config, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_channel_cfg_t *cfgs_ptr, uint_fast8_t cnt) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, channel_request, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, void *values_ptr, uint_fast32_t cnt)
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 char uint_fast8_t
Definition stdint.h:23
unsigned int uint_fast32_t
Definition stdint.h:27
unsigned short uint_fast16_t
Definition stdint.h:25
DAC capability structure that can be reimplemented in specific HAL drivers.
Definition vsf_template_dac.h:293
DAC configuration structure.
Definition vsf_template_dac.h:262
dac channel configuration
Definition vsf_template_dac.h:218
DAC status structure that can be reimplemented in specific HAL drivers.
Definition vsf_template_dac.h:275
vk_av_control_value_t value
Definition vsf_audio.h:171
fsm_rt_t
Definition vsf_fsm.h:315
vsf_dac_irq_mask_t
Predefined VSF DAC interrupts that can be reimplemented in specific HAL drivers. Even if the hardware...
Definition vsf_template_dac.h:198
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:57
uint8_t status
Definition vsf_tgui.h:144

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

Parameters
[in]__prefix_nameThe prefix used for generating DAC functions.

Typedef Documentation

◆ vsf_dac_irq_mask_t

Predefined VSF DAC interrupts that can be reimplemented in specific HAL drivers. Even if the hardware doesn't support these features, these interrupts must be kept:

  • VSF_DAC_IRQ_MASK_IDLE
  • VSF_DAC_IRQ_MASK_CPL

◆ vsf_dac_channel_cfg_t

dac channel configuration

Configuration structure for DAC channel

◆ vsf_dac_t

typedef struct vsf_dac_t vsf_dac_t

◆ vsf_dac_isr_handler_t

typedef void vsf_dac_isr_handler_t(void *target_ptr, vsf_dac_t *dac_ptr, vsf_dac_irq_mask_t irq_mask)

DAC interrupt handler function type.

Parameters
[in]target_ptrUser defined target pointer
[in]dac_ptrDAC instance pointer
[in]irq_maskInterrupt mask

◆ vsf_dac_isr_t

typedef struct vsf_dac_isr_t vsf_dac_isr_t

DAC interrupt configuration structure.

◆ vsf_dac_cfg_t

typedef struct vsf_dac_cfg_t vsf_dac_cfg_t

DAC configuration structure.

◆ vsf_dac_status_t

DAC status structure that can be reimplemented in specific HAL drivers.

◆ vsf_dac_capability_t

DAC capability structure that can be reimplemented in specific HAL drivers.

◆ vsf_dac_op_t

typedef struct vsf_dac_op_t vsf_dac_op_t

Enumeration Type Documentation

◆ vsf_dac_irq_mask_t

Predefined VSF DAC interrupts that can be reimplemented in specific HAL drivers. Even if the hardware doesn't support these features, these interrupts must be kept:

  • VSF_DAC_IRQ_MASK_IDLE
  • VSF_DAC_IRQ_MASK_CPL
Enumerator
VSF_DAC_IRQ_MASK_IDLE 

DAC is idle.

VSF_DAC_IRQ_MASK_CPL 

DAC transfer complete.

◆ anonymous enum

anonymous enum
Enumerator
VSF_DAC_IRQ_COUNT 
VSF_DAC_IRQ_ALL_BITS_MASK 

Function Documentation

◆ vsf_dac_init()

vsf_err_t vsf_dac_init ( vsf_dac_t dac_ptr,
vsf_dac_cfg_t cfg_ptr 
)
extern

Initialize a DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
[in]cfg_ptra pointer to structure vsf_dac_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if the initialization was successful, otherwise returns error code
Note
It is not necessary to call vsf_dac_fini() to deinitialize. vsf_dac_init() should be called before any other DAC API except vsf_dac_capability().

◆ vsf_dac_fini()

void vsf_dac_fini ( vsf_dac_t dac_ptr)
extern

Finalize a DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
Returns
none

◆ vsf_dac_enable()

fsm_rt_t vsf_dac_enable ( vsf_dac_t dac_ptr)
extern

Enable a DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
Returns
fsm_rt_t: fsm_rt_cpl if DAC was enabled, fsm_rt_on_going if DAC is still enabling

◆ vsf_dac_disable()

fsm_rt_t vsf_dac_disable ( vsf_dac_t dac_ptr)
extern

Disable a DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
Returns
fsm_rt_t: fsm_rt_cpl if DAC was disabled, fsm_rt_on_going if DAC is still disabling

◆ vsf_dac_irq_enable()

void vsf_dac_irq_enable ( vsf_dac_t dac_ptr,
vsf_dac_irq_mask_t  irq_mask 
)
extern

Enable interrupt masks of DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
[in]irq_maskone or more value of enum vsf_dac_irq_mask_t, vsf_dac_irq_mask_t
Returns
none
Note
All pending interrupts should be cleared before interrupts are enabled

◆ vsf_dac_irq_disable()

void vsf_dac_irq_disable ( vsf_dac_t dac_ptr,
vsf_dac_irq_mask_t  irq_mask 
)
extern

Disable interrupt masks of DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
[in]irq_maskone or more value of enum vsf_dac_irq_mask_t, vsf_dac_irq_mask_t
Returns
none

◆ vsf_dac_status()

vsf_dac_status_t vsf_dac_status ( vsf_dac_t dac_ptr)
extern

Get the status of DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
Returns
vsf_dac_status_t: All status of current DAC

◆ vsf_dac_capability()

vsf_dac_capability_t vsf_dac_capability ( vsf_dac_t dac_ptr)
extern

Get the capability of DAC instance.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
Returns
vsf_dac_capability_t: All capability of current DAC vsf_dac_capability_t

◆ vsf_dac_channel_request_once()

vsf_err_t vsf_dac_channel_request_once ( vsf_dac_t dac_ptr,
vsf_dac_channel_cfg_t channel_cfg,
uint_fast16_t  value 
)
extern

DAC request convert once.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
[in]channel_cfga pointer to convert channel configuration
[in]valuevalue to be converted
Returns
vsf_err_t: VSF_ERR_NONE if the request was successful, otherwise returns error code

◆ vsf_dac_channel_config()

vsf_err_t vsf_dac_channel_config ( vsf_dac_t dac_ptr,
vsf_dac_channel_cfg_t cfgs_ptr,
uint_fast8_t  cnt 
)
extern

DAC channel configuration.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
[in]cfgs_ptrconvert channel configuration array
[in]cntthe length of convert channel configuration array
Returns
vsf_err_t: VSF_ERR_NONE if the configuration was successful, otherwise returns error code

◆ vsf_dac_channel_request()

vsf_err_t vsf_dac_channel_request ( vsf_dac_t dac_ptr,
void *  buffer_ptr,
uint_fast32_t  count 
)
extern

DAC channel request.

Parameters
[in]dac_ptra pointer to structure vsf_dac_t
[out]buffer_ptrconvert channel data array
[in]countthe length of convert channel configuration data array
Returns
vsf_err_t: VSF_ERR_NONE if the request was successful, otherwise returns error code
Generated from commit: vsfteam/vsf@2b286be