libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Macros | |
#define | CHANNEL_SUPPORT_LOOP(ch) (((ch) == DMA_CH0) || ((ch) == DMA_CH1)) |
Functions | |
void | dma_enable_with_privileged_access (void) |
Enable DMA with privileged access. More... | |
void | dma_enable_with_unprivileged_access (void) |
Enable DMA with un-privileged access. More... | |
void | dma_enable (void) |
same as dma_enable_with_unprivileged_access() More... | |
void | dma_disable (void) |
Disable DMA. More... | |
void | dma_set_desc_address (uint32_t desc_base) |
Set channel's descriptor address. More... | |
bool | dma_get_wait_on_request_flag (enum dma_ch ch) |
Get channel wait on request status flag. More... | |
void | dma_generate_software_request (enum dma_ch ch) |
Generate a software request on channel. More... | |
void | dma_enable_burst_only (enum dma_ch ch) |
Enable channel burst only. More... | |
void | dma_enable_single_and_burst (enum dma_ch ch) |
Enable channel single and burst. More... | |
void | dma_enable_periph_request (enum dma_ch ch) |
Enable channel peripherial request. More... | |
void | dma_disable_periph_request (enum dma_ch ch) |
Disable channel peripherial request. More... | |
void | dma_enable_channel (enum dma_ch ch) |
Enable channel. More... | |
void | dma_disable_channel (enum dma_ch ch) |
Disable channel. More... | |
void | dma_disable_alternate_structure (enum dma_ch ch) |
Disable channel alternate structure. More... | |
void | dma_enable_alternate_structure (enum dma_ch ch) |
Enable channel alternate structure. More... | |
void | dma_enable_priority (enum dma_ch ch) |
Enable channel high priority. More... | |
void | dma_disable_priority (enum dma_ch ch) |
Disable channel high priority. More... | |
bool | dma_get_bus_error_flag (void) |
Get bus error flag. More... | |
void | dma_clear_bus_error_flag (void) |
Clear bus error flag. More... | |
bool | dma_get_request_flag (enum dma_ch ch) |
Get channel request flag. More... | |
bool | dma_get_bus_error_interrupt_flag (void) |
Get bus error interrupt flag. More... | |
bool | dma_get_done_interrupt_flag (enum dma_ch ch) |
Get channel done interrupt flag. More... | |
void | dma_set_bus_error_interrupt_flag (void) |
Set bus error interrupt flag. More... | |
void | dma_set_done_interrupt_flag (enum dma_ch ch) |
Set channel done interrupt flag. More... | |
void | dma_clear_bus_error_interrupt_flag (void) |
Clear bus error interrupt flag. More... | |
void | dma_clear_done_interrupt_flag (enum dma_ch ch) |
Clear channel done interrupt flag. More... | |
void | dma_enable_bus_error_interrupt (void) |
Enable bus error interrupt. More... | |
void | dma_disable_bus_error_interrupt (void) |
Disable bus error interrupt. More... | |
void | dma_enable_done_interrupt (enum dma_ch ch) |
Enable channel done interrupt. More... | |
void | dma_disable_done_interrupt (enum dma_ch ch) |
Disable channel done interrupt. More... | |
void | dma_set_source (enum dma_ch ch, uint32_t source) |
Set channel source. More... | |
void | dma_set_signal (enum dma_ch ch, uint32_t signal) |
Set channel source signal. More... | |
void | dma_channel_reset (enum dma_ch ch) |
Reset channel. More... | |
void | dma_set_loop_count (enum dma_ch ch, uint16_t count) |
Set channel loop width to ( count + 1) More... | |
void | dma_enable_loop (enum dma_ch ch) |
Enable channel loop. More... | |
void | dma_disable_loop (enum dma_ch ch) |
Disable channel loop. More... | |
void | dma_desc_set_dest_size (uint32_t desc_base, enum dma_ch ch, enum dma_mem size) |
Set desination size. More... | |
void | dma_desc_set_dest_inc (uint32_t desc_base, enum dma_ch ch, enum dma_mem inc) |
Set destination increment. More... | |
void | dma_desc_set_src_size (uint32_t desc_base, enum dma_ch ch, enum dma_mem size) |
Set source size. More... | |
void | dma_desc_set_src_inc (uint32_t desc_base, enum dma_ch ch, enum dma_mem inc) |
Set source increment. More... | |
void | dma_desc_set_r_power (uint32_t desc_base, enum dma_ch ch, enum dma_r_power r_power) |
Set R Power. More... | |
void | dma_desc_enable_next_useburst (uint32_t desc_base, enum dma_ch ch) |
Enable next useburst. More... | |
void | dma_desc_disable_next_useburst (uint32_t desc_base, enum dma_ch ch) |
Disable next useburst. More... | |
void | dma_desc_set_count (uint32_t desc_base, enum dma_ch ch, uint16_t count) |
Set number (count) of transfer to be performed. More... | |
void | dma_desc_set_user_data (uint32_t desc_base, enum dma_ch ch, uint32_t user_data) |
Store user data field in channel descriptor. More... | |
uint32_t | dma_desc_get_user_data (uint32_t desc_base, enum dma_ch ch) |
Extract user data field from channel descriptor. More... | |
static uint32_t | dma_calc_end_from_start (uint32_t start, uint8_t inc, uint16_t n_minus_1) |
Calculate end from start address. More... | |
void | dma_desc_set_src_address (uint32_t desc_base, enum dma_ch ch, uint32_t src_start) |
Assign Source address to DMA Channel. More... | |
void | dma_desc_set_dest_address (uint32_t desc_base, enum dma_ch ch, uint32_t dest_start) |
Assign Destination address to DMA Channel. More... | |
void | dma_desc_set_mode (uint32_t desc_base, enum dma_ch ch, enum dma_mode mode) |
Set the channel mode ("Cycle control") More... | |
Definition at line 27 of file dma_common.c.
|
inlinestatic |
Calculate end from start address.
See "8.4.3.4 Address calculation" p68, EFM32LG-RM "d0183_Rev1.10"
[in] | start | address to start of memory |
[in] | inc | Increment (use DMA_MEM_*) |
[in] | n_minus_1 | the number of transfers minus 1 (ie count - 1) |
Definition at line 548 of file dma_common.c.
References DMA_MEM_BYTE, DMA_MEM_HALF_WORD, DMA_MEM_NONE, and DMA_MEM_WORD.
Referenced by dma_desc_set_dest_address(), and dma_desc_set_src_address().
void dma_channel_reset | ( | enum dma_ch | ch | ) |
Reset channel.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 334 of file dma_common.c.
References CHANNEL_SUPPORT_LOOP, DMA_CHALTC, DMA_CHALTC_CHxSALTC, DMA_CHENC, DMA_CHENC_CHxSENC, DMA_CHPRIC, DMA_CHPRIC_CHxSPRIC, DMA_CHx_CTRL, DMA_IFC, DMA_IFC_CHxDONE, and DMA_LOOPx.
void dma_clear_bus_error_flag | ( | void | ) |
Clear bus error flag.
Definition at line 201 of file dma_common.c.
References DMA_ERRORC, and DMA_ERRORC_ERRORC.
void dma_clear_bus_error_interrupt_flag | ( | void | ) |
Clear bus error interrupt flag.
Definition at line 260 of file dma_common.c.
References DMA_IFC, and DMA_IFC_ERR.
void dma_clear_done_interrupt_flag | ( | enum dma_ch | ch | ) |
Clear channel done interrupt flag.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 269 of file dma_common.c.
References DMA_IFC, and DMA_IFC_CHxDONE.
void dma_desc_disable_next_useburst | ( | uint32_t | desc_base, |
enum dma_ch | ch | ||
) |
Disable next useburst.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
Definition at line 491 of file dma_common.c.
References DMA_DESC_CH_CFG_NEXT_USEBURST, and DMA_DESC_CHx_CFG.
void dma_desc_enable_next_useburst | ( | uint32_t | desc_base, |
enum dma_ch | ch | ||
) |
Enable next useburst.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
Definition at line 480 of file dma_common.c.
References DMA_DESC_CHx_CFG.
uint32_t dma_desc_get_user_data | ( | uint32_t | desc_base, |
enum dma_ch | ch | ||
) |
Extract user data field from channel descriptor.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
Definition at line 531 of file dma_common.c.
References DMA_DESC_CHx_USER_DATA.
void dma_desc_set_count | ( | uint32_t | desc_base, |
enum dma_ch | ch, | ||
uint16_t | count | ||
) |
Set number (count) of transfer to be performed.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | count | Count |
Definition at line 503 of file dma_common.c.
References DMA_DESC_CH_CFG_N_MINUS_1, and DMA_DESC_CHx_CFG.
void dma_desc_set_dest_address | ( | uint32_t | desc_base, |
enum dma_ch | ch, | ||
uint32_t | dest_start | ||
) |
Assign Destination address to DMA Channel.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | dest_start | Destination data start address this function uses dma_calc_end_from_start to calculate the dest data end address from dest_start |
Definition at line 599 of file dma_common.c.
References dma_calc_end_from_start(), DMA_DESC_CH_CFG_DEST_INC_MASK, DMA_DESC_CH_CFG_DEST_INC_SHIFT, DMA_DESC_CH_CFG_N_MINUS_1_MASK, DMA_DESC_CH_CFG_N_MINUS_1_SHIFT, DMA_DESC_CHx_CFG, and DMA_DESC_CHx_DEST_DATA_END_PTR.
Set destination increment.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | inc | Increment (use DMA_MEM_*) |
Definition at line 417 of file dma_common.c.
References DMA_DESC_CH_CFG_DEST_INC, and DMA_DESC_CHx_CFG.
Set desination size.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | size | Size (use DMA_MEM_*) |
Definition at line 401 of file dma_common.c.
References DMA_DESC_CH_CFG_DEST_SIZE, and DMA_DESC_CHx_CFG.
Set the channel mode ("Cycle control")
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | mode | Mode (use DMA_MODE_*) |
Definition at line 619 of file dma_common.c.
References DMA_DESC_CH_CFG_CYCLE_CTRL, and DMA_DESC_CHx_CFG.
void dma_desc_set_r_power | ( | uint32_t | desc_base, |
enum dma_ch | ch, | ||
enum dma_r_power | r_power | ||
) |
Set R Power.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | r_power | R Power (Use DMA_R_POWER_*) |
Definition at line 465 of file dma_common.c.
References DMA_DESC_CH_CFG_R_POWER, and DMA_DESC_CHx_CFG.
void dma_desc_set_src_address | ( | uint32_t | desc_base, |
enum dma_ch | ch, | ||
uint32_t | src_start | ||
) |
Assign Source address to DMA Channel.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | src_start | Source data start address this function uses dma_calc_end_from_start to calculate the src data end address from src_start |
Definition at line 576 of file dma_common.c.
References dma_calc_end_from_start(), DMA_DESC_CH_CFG_N_MINUS_1_MASK, DMA_DESC_CH_CFG_N_MINUS_1_SHIFT, DMA_DESC_CH_CFG_SRC_INC_MASK, DMA_DESC_CH_CFG_SRC_INC_SHIFT, DMA_DESC_CHx_CFG, and DMA_DESC_CHx_SRC_DATA_END_PTR.
Set source increment.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | inc | Increment (use DMA_MEM_*) |
Definition at line 449 of file dma_common.c.
References DMA_DESC_CH_CFG_SRC_INC, and DMA_DESC_CHx_CFG.
Set source size.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | size | Size (use DMA_MEM_*) |
Definition at line 433 of file dma_common.c.
References DMA_DESC_CH_CFG_SRC_SIZE, and DMA_DESC_CHx_CFG.
void dma_desc_set_user_data | ( | uint32_t | desc_base, |
enum dma_ch | ch, | ||
uint32_t | user_data | ||
) |
Store user data field in channel descriptor.
[in] | desc_base | start of memory location that contain channel descriptor |
[in] | ch | Channel (use DMA_CHx) |
[in] | user_data | User data |
Definition at line 518 of file dma_common.c.
References DMA_DESC_CHx_USER_DATA.
void dma_disable | ( | void | ) |
void dma_disable_alternate_structure | ( | enum dma_ch | ch | ) |
Disable channel alternate structure.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 156 of file dma_common.c.
References DMA_CHALTC, and DMA_CHALTC_CHxSALTC.
void dma_disable_bus_error_interrupt | ( | void | ) |
void dma_disable_channel | ( | enum dma_ch | ch | ) |
Disable channel.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 147 of file dma_common.c.
References DMA_CHENC, and DMA_CHENC_CHxSENC.
void dma_disable_done_interrupt | ( | enum dma_ch | ch | ) |
Disable channel done interrupt.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 303 of file dma_common.c.
References DMA_IEN.
void dma_disable_loop | ( | enum dma_ch | ch | ) |
Disable channel loop.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 385 of file dma_common.c.
References CHANNEL_SUPPORT_LOOP, and DMA_LOOPx.
void dma_disable_periph_request | ( | enum dma_ch | ch | ) |
Disable channel peripherial request.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 129 of file dma_common.c.
References DMA_CHREQMASKS, and DMA_CHREQMASKS_CHxSREQMASKS.
void dma_disable_priority | ( | enum dma_ch | ch | ) |
Disable channel high priority.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 183 of file dma_common.c.
References DMA_CHPRIC, and DMA_CHPRIC_CHxSPRIC.
void dma_enable | ( | void | ) |
same as dma_enable_with_unprivileged_access()
Definition at line 51 of file dma_common.c.
References dma_enable_with_unprivileged_access().
void dma_enable_alternate_structure | ( | enum dma_ch | ch | ) |
Enable channel alternate structure.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 165 of file dma_common.c.
References DMA_CHALTS, and DMA_CHALTS_CHxSALTS.
void dma_enable_burst_only | ( | enum dma_ch | ch | ) |
Enable channel burst only.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 102 of file dma_common.c.
References DMA_CHUSEBURSTS, and DMA_CHUSEBURSTS_CHxSUSEBURSTS.
void dma_enable_bus_error_interrupt | ( | void | ) |
Enable bus error interrupt.
Definition at line 277 of file dma_common.c.
References DMA_IEN, and DMA_IEN_ERR.
void dma_enable_channel | ( | enum dma_ch | ch | ) |
Enable channel.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 138 of file dma_common.c.
References DMA_CHENS, and DMA_CHENS_CHxSENS.
void dma_enable_done_interrupt | ( | enum dma_ch | ch | ) |
Enable channel done interrupt.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 294 of file dma_common.c.
References DMA_IEN, and DMA_IEN_CHxDONE.
void dma_enable_loop | ( | enum dma_ch | ch | ) |
Enable channel loop.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 372 of file dma_common.c.
References CHANNEL_SUPPORT_LOOP, DMA_LOOP_EN, and DMA_LOOPx.
void dma_enable_periph_request | ( | enum dma_ch | ch | ) |
Enable channel peripherial request.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 120 of file dma_common.c.
References DMA_CHREQMASKC, and DMA_CHREQMASKC_CHxSREQMASKC.
void dma_enable_priority | ( | enum dma_ch | ch | ) |
Enable channel high priority.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 174 of file dma_common.c.
References DMA_CHPRIS, and DMA_CHPRIS_CHxSPRIC.
void dma_enable_single_and_burst | ( | enum dma_ch | ch | ) |
Enable channel single and burst.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 111 of file dma_common.c.
References DMA_CHUSEBURSTC, and DMA_CHUSEBURSTC_CHxSUSEBURSTC.
void dma_enable_with_privileged_access | ( | void | ) |
Enable DMA with privileged access.
Definition at line 33 of file dma_common.c.
References DMA_CONFIG, DMA_CONFIG_CHPROT, and DMA_CONFIG_EN.
void dma_enable_with_unprivileged_access | ( | void | ) |
Enable DMA with un-privileged access.
Definition at line 42 of file dma_common.c.
References DMA_CONFIG, and DMA_CONFIG_EN.
Referenced by dma_enable().
void dma_generate_software_request | ( | enum dma_ch | ch | ) |
Generate a software request on channel.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 93 of file dma_common.c.
References DMA_CHSWREQ, and DMA_CHSWREQ_CHxSWREQ.
bool dma_get_bus_error_flag | ( | void | ) |
Get bus error flag.
true | if flag is set |
false | if flag is not set |
Definition at line 193 of file dma_common.c.
References DMA_ERRORC, and DMA_ERRORC_ERRORC.
bool dma_get_bus_error_interrupt_flag | ( | void | ) |
Get bus error interrupt flag.
true | if flag is set |
false | if flag is not set |
Definition at line 223 of file dma_common.c.
References DMA_IF, and DMA_IF_ERR.
bool dma_get_done_interrupt_flag | ( | enum dma_ch | ch | ) |
Get channel done interrupt flag.
[in] | ch | Channel (use DMA_CHx) |
true | if flag is set |
false | if flag is not set |
Definition at line 235 of file dma_common.c.
References DMA_IF, and DMA_IF_CHxDONE.
bool dma_get_request_flag | ( | enum dma_ch | ch | ) |
Get channel request flag.
[in] | ch | Channel (use DMA_CHx) |
true | if flag is set |
false | if flag is not set |
Definition at line 212 of file dma_common.c.
References DMA_CHREQSTATUS, and DMA_CHREQSTATUS_CHxSREQSTATUS.
bool dma_get_wait_on_request_flag | ( | enum dma_ch | ch | ) |
Get channel wait on request status flag.
true | if flag is set |
false | if flag is not set |
Definition at line 83 of file dma_common.c.
References DMA_CHWAITSTATUS, and DMA_CHWAITSTATUS_CHxWAITSTATUS.
void dma_set_bus_error_interrupt_flag | ( | void | ) |
Set bus error interrupt flag.
Definition at line 243 of file dma_common.c.
References DMA_IFS, and DMA_IFS_ERR.
void dma_set_desc_address | ( | uint32_t | desc_base | ) |
Set channel's descriptor address.
[in] | desc_base | Address of channel's descriptor address |
Definition at line 69 of file dma_common.c.
References DMA_CTRLBASE.
void dma_set_done_interrupt_flag | ( | enum dma_ch | ch | ) |
Set channel done interrupt flag.
[in] | ch | Channel (use DMA_CHx) |
Definition at line 252 of file dma_common.c.
References DMA_IFS, and DMA_IFS_CHxDONE.
void dma_set_loop_count | ( | enum dma_ch | ch, |
uint16_t | count | ||
) |
Set channel loop width to ( count + 1)
[in] | ch | Channel (use DMA_CHx) |
[in] | count | Count |
Definition at line 358 of file dma_common.c.
References CHANNEL_SUPPORT_LOOP, DMA_LOOP_WIDTH, and DMA_LOOPx.
void dma_set_signal | ( | enum dma_ch | ch, |
uint32_t | signal | ||
) |
Set channel source signal.
[in] | ch | Channel (use DMA_CHx) |
[in] | signal | Signal (use DMA_CH_CTRL_SIGSEL_*) |
Definition at line 324 of file dma_common.c.
References DMA_CHx_CTRL.
void dma_set_source | ( | enum dma_ch | ch, |
uint32_t | source | ||
) |
Set channel source.
[in] | ch | Channel (use DMA_CHx) |
[in] | source | Source (use DMA_CH_CTRL_SOURCESEL_*) |
Definition at line 313 of file dma_common.c.
References DMA_CHx_CTRL.