DAC driver APIs. More...
Data Structures | |
| struct | dac_config_t |
| DAC configuration structure. More... | |
| struct | dac_step_config_t |
| DAC step configuration structure. More... | |
| struct | dac_buffer_t |
| DAC buffer structure. More... | |
| struct | dac_buffer_config_t |
| DAC buffer configuration structure. More... | |
| struct | dac_buffer_data_t |
| DAC buffer data structure. More... | |
Macros | |
| #define | DAC_OUTPUT(PERCENT) (PERCENT / 10000.0f * DAC_SOC_MAX_DATA) |
| The range of DAC output value setting is from 0.0 to 10000.0, which is mapped to 0 to 100 in percentage. More... | |
| #define | DAC_AHB_ERROR_EVENT DAC_IRQ_EN_AHB_ERROR_MASK |
| DAC AHB error event. More... | |
| #define | DAC_FIFO_EMPTY_EVENT DAC_IRQ_EN_FIFO_EMPTY_MASK |
| DAC FIFO empty event. More... | |
| #define | DAC_BUF1_COMPLETE_EVENT DAC_IRQ_EN_BUF1_CMPT_MASK |
| DAC buffer 1 complete event. More... | |
| #define | DAC_BUF0_COMPLETE_EVENT DAC_IRQ_EN_BUF0_CMPT_MASK |
| DAC buffer 0 complete event. More... | |
Enumerations | |
| enum | dac_mode_t { dac_mode_direct = 0 , dac_mode_step , dac_mode_buffer , dac_mode_trig } |
| DAC operation mode. More... | |
| enum | dac_ana_div_t { dac_ana_div_2 = 0 , dac_ana_div_4 , dac_ana_div_6 , dac_ana_div_8 } |
| DAC analog divider. More... | |
| enum | dac_step_direction_t { dac_step_up = 0 , dac_step_down } |
| DAC step direction. More... | |
| enum | dac_round_mode_t { dac_round_mode_oneshot = 0 , dac_round_mode_loop } |
| DAC round mode. More... | |
| enum | dac_data_structure_t { dac_data_stru_2_point = 0 , dac_data_stru_1_point } |
| DAC data structure type. More... | |
| enum | dac_burst_type_t { dac_burst_single = 0 , dac_burst_incr4 = 3 , dac_burst_incr8 = 5 } |
| DAC burst type. More... | |
Functions | |
| void | dac_get_default_config (dac_config_t *config) |
| Get default DAC configuration. More... | |
| hpm_stat_t | dac_init (DAC_Type *ptr, dac_config_t *config) |
| Initialize DAC. More... | |
| hpm_stat_t | dac_set_direct_config (DAC_Type *ptr, uint16_t data) |
| Set DAC direct mode configuration. More... | |
| hpm_stat_t | dac_set_step_config (DAC_Type *ptr, uint8_t step_cfg_idx, dac_step_config_t *config) |
| Set DAC step mode configuration. More... | |
| hpm_stat_t | dac_set_buffer_config (DAC_Type *ptr, dac_buffer_config_t *config) |
| Set DAC buffer mode configuration. More... | |
| hpm_stat_t | dac_set_output_frequency (DAC_Type *ptr, uint32_t dac_input_freq, uint32_t dac_output_freq) |
| Set DAC output frequency. More... | |
| hpm_stat_t | dac_set_step_sw_trigger (DAC_Type *ptr, uint8_t step_sw_trig_idx) |
| Set DAC step software trigger. More... | |
| void | dac_set_buffer_sw_trigger (DAC_Type *ptr) |
| Set DAC buffer software trigger. More... | |
| void | dac_set_hw_trigger_enable (DAC_Type *ptr, bool enable) |
| Enable or disable DAC hardware trigger. More... | |
| hpm_stat_t | dac_external_dma_request_enable (DAC_Type *ptr, uint8_t buf_idx, bool enable) |
| Enable or disable DAC external DMA request. More... | |
| void | dac_set_buffer_dma_reset (DAC_Type *ptr) |
| Reset DAC buffer DMA. More... | |
| void | dac_enable_conversion (DAC_Type *ptr, bool enable) |
| Enable or disable DAC conversion. More... | |
| void | dac_enable_interrupts (DAC_Type *ptr, uint32_t mask) |
| Enable DAC interrupts. More... | |
| uint32_t | dac_get_status_flags (DAC_Type *ptr) |
| Get DAC status flags. More... | |
| void | dac_set_status_flags (DAC_Type *ptr, uint32_t mask) |
| Clear DAC status flags. More... | |
| uint8_t | dac_get_current_buffer_index (DAC_Type *ptr) |
| Get current DAC buffer index. More... | |
| uint16_t | dac_get_current_buffer_offset (DAC_Type *ptr) |
| Get current DAC buffer offset. More... | |
DAC driver APIs.
| #define DAC_AHB_ERROR_EVENT DAC_IRQ_EN_AHB_ERROR_MASK |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC AHB error event.
| #define DAC_BUF0_COMPLETE_EVENT DAC_IRQ_EN_BUF0_CMPT_MASK |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC buffer 0 complete event.
| #define DAC_BUF1_COMPLETE_EVENT DAC_IRQ_EN_BUF1_CMPT_MASK |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC buffer 1 complete event.
| #define DAC_FIFO_EMPTY_EVENT DAC_IRQ_EN_FIFO_EMPTY_MASK |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC FIFO empty event.
| #define DAC_OUTPUT | ( | PERCENT | ) | (PERCENT / 10000.0f * DAC_SOC_MAX_DATA) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
The range of DAC output value setting is from 0.0 to 10000.0, which is mapped to 0 to 100 in percentage.
| enum dac_ana_div_t |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC analog divider.
| Enumerator | |
|---|---|
| dac_ana_div_2 | Divide by 2 |
| dac_ana_div_4 | Divide by 4 |
| dac_ana_div_6 | Divide by 6 |
| dac_ana_div_8 | Divide by 8 |
| enum dac_burst_type_t |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC burst type.
| enum dac_data_structure_t |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC data structure type.
| Enumerator | |
|---|---|
| dac_data_stru_2_point | 2 point data structure: contains data0 and data1 |
| dac_data_stru_1_point | 1 point data structure: contains single data point |
| enum dac_mode_t |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC operation mode.
| enum dac_round_mode_t |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC round mode.
| Enumerator | |
|---|---|
| dac_round_mode_oneshot | Oneshot mode: execute once and stop |
| dac_round_mode_loop | Loop mode: execute repeatedly |
| enum dac_step_direction_t |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
DAC step direction.
| Enumerator | |
|---|---|
| dac_step_up | Step up: increase output value |
| dac_step_down | Step down: decrease output value |
| void dac_enable_conversion | ( | DAC_Type * | ptr, |
| bool | enable | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Enable or disable DAC conversion.
| [in] | ptr | DAC base address |
| [in] | enable | Enable flag (true to enable, false to disable) |
| void dac_enable_interrupts | ( | DAC_Type * | ptr, |
| uint32_t | mask | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Enable DAC interrupts.
| [in] | ptr | DAC base address |
| [in] | mask | Interrupt mask (combination of DAC_AHB_ERROR_EVENT, DAC_FIFO_EMPTY_EVENT, DAC_BUF1_COMPLETE_EVENT, DAC_BUF0_COMPLETE_EVENT) |
| hpm_stat_t dac_external_dma_request_enable | ( | DAC_Type * | ptr, |
| uint8_t | buf_idx, | ||
| bool | enable | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Enable or disable DAC external DMA request.
| [in] | ptr | DAC base address |
| [in] | buf_idx | Buffer index (0 or 1) |
| [in] | enable | Enable flag (true to enable, false to disable) |
| uint8_t dac_get_current_buffer_index | ( | DAC_Type * | ptr | ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Get current DAC buffer index.
| [in] | ptr | DAC base address |
| uint16_t dac_get_current_buffer_offset | ( | DAC_Type * | ptr | ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Get current DAC buffer offset.
| [in] | ptr | DAC base address |
| void dac_get_default_config | ( | dac_config_t * | config | ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Get default DAC configuration.
| [out] | config | Pointer to DAC configuration structure |
| uint32_t dac_get_status_flags | ( | DAC_Type * | ptr | ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Get DAC status flags.
| [in] | ptr | DAC base address |
| hpm_stat_t dac_init | ( | DAC_Type * | ptr, |
| dac_config_t * | config | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Initialize DAC.
| [in] | ptr | DAC base address |
| [in] | config | Pointer to DAC configuration structure |
| hpm_stat_t dac_set_buffer_config | ( | DAC_Type * | ptr, |
| dac_buffer_config_t * | config | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Set DAC buffer mode configuration.
| [in] | ptr | DAC base address |
| [in] | config | Pointer to buffer configuration structure |
| void dac_set_buffer_dma_reset | ( | DAC_Type * | ptr | ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Reset DAC buffer DMA.
| [in] | ptr | DAC base address |
| void dac_set_buffer_sw_trigger | ( | DAC_Type * | ptr | ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Set DAC buffer software trigger.
| [in] | ptr | DAC base address |
| hpm_stat_t dac_set_direct_config | ( | DAC_Type * | ptr, |
| uint16_t | data | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Set DAC direct mode configuration.
| [in] | ptr | DAC base address |
| [in] | data | Direct output data value |
| void dac_set_hw_trigger_enable | ( | DAC_Type * | ptr, |
| bool | enable | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Enable or disable DAC hardware trigger.
| [in] | ptr | DAC base address |
| [in] | enable | Enable flag (true to enable, false to disable) |
| hpm_stat_t dac_set_output_frequency | ( | DAC_Type * | ptr, |
| uint32_t | dac_input_freq, | ||
| uint32_t | dac_output_freq | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Set DAC output frequency.
| [in] | ptr | DAC base address |
| [in] | dac_input_freq | DAC input frequency |
| [in] | dac_output_freq | DAC output frequency |
| void dac_set_status_flags | ( | DAC_Type * | ptr, |
| uint32_t | mask | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Clear DAC status flags.
| [in] | ptr | DAC base address |
| [in] | mask | Status flags mask to clear |
| hpm_stat_t dac_set_step_config | ( | DAC_Type * | ptr, |
| uint8_t | step_cfg_idx, | ||
| dac_step_config_t * | config | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Set DAC step mode configuration.
| [in] | ptr | DAC base address |
| [in] | step_cfg_idx | Step configuration index |
| [in] | config | Pointer to step configuration structure |
| hpm_stat_t dac_set_step_sw_trigger | ( | DAC_Type * | ptr, |
| uint8_t | step_sw_trig_idx | ||
| ) |
#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_dac_drv.h>
Set DAC step software trigger.
| [in] | ptr | DAC base address |
| [in] | step_sw_trig_idx | Step software trigger index |