Driver for the Digital-to-Analog Converter Controller. It provides access to the main features of the DAC controller.
This driver does not depend on other modules.
Macros | |
#define | DACC_WP_KEY (0x444143) |
DACC Write Protect Key "DAC" in ASCII. More... | |
#define | DACC_WPMR_WPKEY_PASSWD DACC_WPMR_WPKEY(DACC_WP_KEY) |
#define | MAX_CH_NB 0 |
Max channel number. More... | |
Functions | |
void | dacc_disable (Dacc *p_dacc) |
Disable DACC. More... | |
uint32_t | dacc_disable_channel (Dacc *p_dacc, uint32_t ul_channel) |
Disable DACC channel. More... | |
void | dacc_disable_interrupt (Dacc *p_dacc, uint32_t ul_interrupt_mask) |
Disable DACC interrupts. More... | |
void | dacc_disable_trigger (Dacc *p_dacc, uint32_t channel) |
Disable trigger (free run mode). More... | |
void | dacc_enable (Dacc *p_dacc) |
Enable DACC. More... | |
uint32_t | dacc_enable_channel (Dacc *p_dacc, uint32_t ul_channel) |
Enable DACC channel. More... | |
void | dacc_enable_flexible_selection (Dacc *p_dacc) |
Enable the flexible channel selection mode (TAG). More... | |
void | dacc_enable_interrupt (Dacc *p_dacc, uint32_t ul_interrupt_mask) |
Enable DACC interrupts. More... | |
uint32_t | dacc_get_analog_control (Dacc *p_dacc) |
Get the analog control value. More... | |
uint32_t | dacc_get_channel_status (Dacc *p_dacc) |
Get the channel status. More... | |
uint32_t | dacc_get_interrupt_mask (Dacc *p_dacc) |
Get the interrupt mask. More... | |
uint32_t | dacc_get_interrupt_status (Dacc *p_dacc) |
Get the interrupt status. More... | |
Pdc * | dacc_get_pdc_base (Dacc *p_dacc) |
Get PDC registers base address. More... | |
uint32_t | dacc_get_writeprotect_status (Dacc *p_dacc) |
Get the write protect status. More... | |
void | dacc_reset (Dacc *p_dacc) |
Reset DACC. More... | |
uint32_t | dacc_set_analog_control (Dacc *p_dacc, uint32_t ul_analog_control) |
Set the analog control value. More... | |
uint32_t | dacc_set_channel_selection (Dacc *p_dacc, uint32_t ul_channel) |
Disable flexible (TAG) mode and select a channel for DAC outputs. More... | |
uint32_t | dacc_set_osr (Dacc *p_dacc, uint32_t channel, uint32_t ul_osr) |
Set DACC osr. More... | |
uint32_t | dacc_set_power_save (Dacc *p_dacc, uint32_t ul_sleep_mode, uint32_t ul_fast_wakeup_mode) |
Set the power save mode. More... | |
uint32_t | dacc_set_prescaler (Dacc *p_dacc, uint32_t ul_prescaler) |
Set DACC prescaler. More... | |
uint32_t | dacc_set_timing (Dacc *p_dacc, uint32_t ul_startup, uint32_t ul_clock_divider) |
Set the DACC timing. More... | |
uint32_t | dacc_set_timing (Dacc *p_dacc, uint32_t ul_refresh, uint32_t ul_maxs, uint32_t ul_startup) |
Set DACC timings. More... | |
uint32_t | dacc_set_transfer_mode (Dacc *p_dacc, uint32_t ul_mode) |
Set the transfer mode. More... | |
uint32_t | dacc_set_trigger (Dacc *p_dacc, uint32_t ul_trigger, uint32_t channel) |
Enable trigger and set the trigger source. More... | |
void | dacc_set_writeprotect (Dacc *p_dacc, uint32_t ul_enable) |
Enable or disable write protect of DACC registers. More... | |
void | dacc_write_conversion_data (Dacc *p_dacc, uint32_t ul_data, uint32_t channel) |
Write data to conversion register. More... | |
#define DACC_WP_KEY (0x444143) |
DACC Write Protect Key "DAC" in ASCII.
#define DACC_WPMR_WPKEY_PASSWD DACC_WPMR_WPKEY(DACC_WP_KEY) |
Referenced by dacc_set_writeprotect().
#define MAX_CH_NB 0 |
Max channel number.
Referenced by dacc_disable_channel(), dacc_enable_channel(), and dacc_set_channel_selection().
void dacc_disable | ( | Dacc * | p_dacc | ) |
uint32_t dacc_disable_channel | ( | Dacc * | p_dacc, |
uint32_t | ul_channel | ||
) |
Disable DACC channel.
p_dacc | Pointer to a DACC instance. |
ul_channel | The output channel to disable. |
References DACC_RC_INVALID_PARAM, DACC_RC_OK, and MAX_CH_NB.
void dacc_disable_interrupt | ( | Dacc * | p_dacc, |
uint32_t | ul_interrupt_mask | ||
) |
Disable DACC interrupts.
p_dacc | Pointer to a DACC instance. |
ul_interrupt_mask | The interrupt mask. |
void dacc_disable_trigger | ( | Dacc * | p_dacc, |
uint32_t | channel | ||
) |
Disable trigger (free run mode).
p_dacc | Pointer to a DACC instance. |
channel | Channel to be disabled |
void dacc_enable | ( | Dacc * | p_dacc | ) |
uint32_t dacc_enable_channel | ( | Dacc * | p_dacc, |
uint32_t | ul_channel | ||
) |
Enable DACC channel.
p_dacc | Pointer to a DACC instance. |
ul_channel | The output channel to enable. |
References DACC_RC_INVALID_PARAM, DACC_RC_OK, and MAX_CH_NB.
void dacc_enable_flexible_selection | ( | Dacc * | p_dacc | ) |
Enable the flexible channel selection mode (TAG).
In this mode the 2 bits, DACC_CDR[13:12] which are otherwise unused, are employed to select the channel in the same way as with the USER_SEL field. Finally, if the WORD field is set, the 2 bits, DACC_CDR[13:12] are used for channel selection of the first data and the 2 bits, DACC_CDR[29:28] for channel selection of the second data.
p_dacc | Pointer to a DACC instance. |
void dacc_enable_interrupt | ( | Dacc * | p_dacc, |
uint32_t | ul_interrupt_mask | ||
) |
Enable DACC interrupts.
p_dacc | Pointer to a DACC instance. |
ul_interrupt_mask | The interrupt mask. |
uint32_t dacc_get_analog_control | ( | Dacc * | p_dacc | ) |
Get the analog control value.
p_dacc | Pointer to a DACC instance. |
uint32_t dacc_get_channel_status | ( | Dacc * | p_dacc | ) |
Get the channel status.
p_dacc | Pointer to a DACC instance. |
uint32_t dacc_get_interrupt_mask | ( | Dacc * | p_dacc | ) |
Get the interrupt mask.
p_dacc | Pointer to a DACC instance. |
uint32_t dacc_get_interrupt_status | ( | Dacc * | p_dacc | ) |
Get the interrupt status.
p_dacc | Pointer to a DACC instance. |
Pdc* dacc_get_pdc_base | ( | Dacc * | p_dacc | ) |
Get PDC registers base address.
p_dacc | Pointer to a DACC instance. |
References UNUSED.
uint32_t dacc_get_writeprotect_status | ( | Dacc * | p_dacc | ) |
Get the write protect status.
p_dacc | Pointer to a DACC instance. |
void dacc_reset | ( | Dacc * | p_dacc | ) |
uint32_t dacc_set_analog_control | ( | Dacc * | p_dacc, |
uint32_t | ul_analog_control | ||
) |
Set the analog control value.
p_dacc | Pointer to a DACC instance. |
ul_analog_control | Analog control configuration. |
References DACC_RC_OK.
uint32_t dacc_set_channel_selection | ( | Dacc * | p_dacc, |
uint32_t | ul_channel | ||
) |
Disable flexible (TAG) mode and select a channel for DAC outputs.
p_dacc | Pointer to a DACC instance. |
ul_channel | Channel to select. |
References DACC_RC_INVALID_PARAM, DACC_RC_OK, and MAX_CH_NB.
uint32_t dacc_set_osr | ( | Dacc * | p_dacc, |
uint32_t | channel, | ||
uint32_t | ul_osr | ||
) |
Set DACC osr.
p_dacc | Pointer to a DACC instance. |
channel | DACC osr channel to be set. |
ul_prescaler | Osr value. |
References DACC_RC_OK.
uint32_t dacc_set_power_save | ( | Dacc * | p_dacc, |
uint32_t | ul_sleep_mode, | ||
uint32_t | ul_fast_wakeup_mode | ||
) |
Set the power save mode.
p_dacc | Pointer to a DACC instance. |
ul_sleep_mode | Sleep mode configuration. |
ul_fast_wakeup_mode | Fast wakeup mode configuration. |
References DACC_RC_OK.
uint32_t dacc_set_prescaler | ( | Dacc * | p_dacc, |
uint32_t | ul_prescaler | ||
) |
Set DACC prescaler.
p_dacc | Pointer to a DACC instance. |
ul_prescaler | Prescaler value. |
References DACC_RC_OK.
uint32_t dacc_set_timing | ( | Dacc * | p_dacc, |
uint32_t | ul_startup, | ||
uint32_t | ul_clock_divider | ||
) |
Set the DACC timing.
Set DACC timings.
p_dacc | Pointer to a DACC instance. |
ul_startup | Startup time selection. |
ul_clock_divider | Clock divider for internal trigger. |
p_dacc | Pointer to a DACC instance. |
ul_maxs | Max speed mode configuration. |
ul_startup | Startup time selection. |
References DACC_RC_OK.
Referenced by init_dacc().
uint32_t dacc_set_timing | ( | Dacc * | p_dacc, |
uint32_t | ul_refresh, | ||
uint32_t | ul_maxs, | ||
uint32_t | ul_startup | ||
) |
Set DACC timings.
p_dacc | Pointer to a DACC instance. |
ul_refresh | Refresh period setting value. |
ul_maxs | Max speed mode configuration. |
ul_startup | Startup time selection. |
References DACC_RC_OK.
uint32_t dacc_set_transfer_mode | ( | Dacc * | p_dacc, |
uint32_t | ul_mode | ||
) |
Set the transfer mode.
p_dacc | Pointer to a DACC instance. |
ul_mode | Transfer mode configuration. |
References DACC_RC_OK.
Referenced by init_dacc().
uint32_t dacc_set_trigger | ( | Dacc * | p_dacc, |
uint32_t | ul_trigger, | ||
uint32_t | channel | ||
) |
Enable trigger and set the trigger source.
p_dacc | Pointer to a DACC instance. |
ul_trigger | Trigger source number. |
channel | Channel to be set |
References DACC_RC_OK.
Referenced by init_dacc().
void dacc_set_writeprotect | ( | Dacc * | p_dacc, |
uint32_t | ul_enable | ||
) |
Enable or disable write protect of DACC registers.
p_dacc | Pointer to a DACC instance. |
ul_enable | 1 to enable, 0 to disable. |
References DACC_WPMR_WPKEY_PASSWD.
void dacc_write_conversion_data | ( | Dacc * | p_dacc, |
uint32_t | ul_data, | ||
uint32_t | channel | ||
) |
Write data to conversion register.
In flexible mode the 2 bits, DACC_CDR[13:12] which are otherwise unused, are employed to select the channel in the same way as with the USER_SEL field. Finally, if the WORD field is set, the 2 bits, DACC_CDR[13:12] are used for channel selection of the first data and the 2 bits, DACC_CDR[29:28] for channel selection of the second data.
p_dacc | Pointer to a DACC instance. |
ul_data | The data to be transferred to analog value. |
channel | The channel to convert the data ul_data |
Referenced by run_events_ast_test(), and run_events_software_test().