microHAL
An abstraction layer for your future F4xx projects
|
Function defines the DMA driver. More...
#include "dma.h"
Functions | |
void | dma_set_addresses (const dma_peripheral_t dma, const uint8_t stream, const uint32_t PA, const uint32_t M0A, const uint32_t M1A) |
Set the DMA source and destination addresses. | |
void | dma_configure_data (const dma_peripheral_t dma, const uint8_t stream, const uint16_t count, const dma_datasize_t msize, const dma_datasize_t psize) |
Set DMA transfers to specified configuration. | |
void | dma_set_direction (const dma_peripheral_t dma, const uint8_t stream, const dma_dir_t direction) |
Set DMA transfers to the desired direction. | |
void | dma_configure_stream (const dma_peripheral_t dma, const uint8_t stream, const struct DMAStreamConfig config) |
Set DMA stream to the specified configuration. | |
void | dma_set_channel (const dma_peripheral_t dma, const uint8_t stream, const uint8_t channel, const dma_priority_t priority) |
Set the DMA stream channel and priority. | |
void | dma_set_interrupts (const dma_peripheral_t dma, const uint8_t stream, const struct DMAStreamISR config) |
Enabled the specified DMA stream interrupts. | |
void | dma_enable (const dma_peripheral_t dma, const uint8_t stream) |
Enables DMA stream transfers. | |
void | dma_disable (const dma_peripheral_t dma, const uint8_t stream) |
Disables DMA stream transfers. | |
Function defines the DMA driver.
This file contains all of the function definitions declared in dma.h.
void dma_configure_data | ( | const dma_peripheral_t | dma, |
const uint8_t | stream, | ||
const uint16_t | count, | ||
const dma_datasize_t | msize, | ||
const dma_datasize_t | psize ) |
Set DMA transfers to specified configuration.
The DMA datasizes are specified in the dma_datasize_t enum. Any other value will be ignored.
dma | The selected DMA |
stream | The selected stream (0..7) |
count | The total number of data items |
msize | The size of data stored in memory |
psize | The size of data stored in the peripheral |
void dma_configure_stream | ( | const dma_peripheral_t | dma, |
const uint8_t | stream, | ||
const struct DMAStreamConfig | config ) |
Set DMA stream to the specified configuration.
The DMA stream options are specified in the DMAStreamConfig struct.
dma | The selected DMA |
stream | The selected stream (0..7) |
config | The stream configuration |
void dma_disable | ( | const dma_peripheral_t | dma, |
const uint8_t | stream ) |
Disables DMA stream transfers.
dma | The selected DMA |
stream | The selected stream (0..7) |
void dma_enable | ( | const dma_peripheral_t | dma, |
const uint8_t | stream ) |
Enables DMA stream transfers.
dma | The selected DMA |
stream | The selected stream (0..7) |
void dma_set_addresses | ( | const dma_peripheral_t | dma, |
const uint8_t | stream, | ||
const uint32_t | PA, | ||
const uint32_t | M0A, | ||
const uint32_t | M1A ) |
Set the DMA source and destination addresses.
Usually only the peripheral and M0 addresses are needed. In that case you shall set M1A to zero.
dma | The selected DMA |
stream | The selected stream (0..7) |
PA | The peripheral address |
M0A | The memory 0 address |
M1A | The memory 1 address |
void dma_set_channel | ( | const dma_peripheral_t | dma, |
const uint8_t | stream, | ||
const uint8_t | channel, | ||
const dma_priority_t | priority ) |
Set the DMA stream channel and priority.
The DMA priority levels are specified in the dma_priority_t enum. Any other value will be ignored. Refer to the chip's manual for the channel function matrix.
dma | The selected DMA |
stream | The selected stream (0..7) |
channel | The selected channel (0..7) |
priority | The stream priority level |
void dma_set_direction | ( | const dma_peripheral_t | dma, |
const uint8_t | stream, | ||
const dma_dir_t | direction ) |
Set DMA transfers to the desired direction.
The DMA directions are specified in the dma_dir_t enum. Any other value will be ignored. After that set the addresses according to the chip's manual.
dma | The selected DMA |
stream | The selected stream (0..7) |
direction | The transfer direction |
void dma_set_interrupts | ( | const dma_peripheral_t | dma, |
const uint8_t | stream, | ||
const struct DMAStreamISR | config ) |
Enabled the specified DMA stream interrupts.
The available DMA interrupts are located in the DMAStreamISR struct.
dma | The selected DMA |
stream | The selected stream (0..7) |
config | The interrupt configuration |