|
PER Firmware
|
G4 DMA Peripheral public API implementation. More...
Functions | |
| static PHAL_DMA_Handle_t ** | dma_channel_owner_slot (DMA_TypeDef *periph, uint8_t channel_idx) |
| static bool | dma_wiring_is_valid (const PHAL_DMA_Wiring_t *wiring) |
| bool | PHAL_DMA_init (PHAL_DMA_Handle_t *handle) |
| Claim a DMA channel and configure it from handle->wiring and handle->params. | |
| bool | PHAL_DMA_initWithCallback (PHAL_DMA_Handle_t *handle, PHAL_DMA_IRQCallbackFn_t irq_fn, void *ctx) |
| Setup DMA callback then call PHAL_DMA_init() | |
| void | PHAL_DMA_deinit (PHAL_DMA_Handle_t *handle) |
| Disable the channel and release its claim/handle so another handle can use the periph/channel_idx afterward. Also disables the NVIC line if a callback was registered. | |
| void | PHAL_DMA_start (PHAL_DMA_Handle_t *handle) |
| Enable the channel, starting the transfer configured by PHAL_DMA_init() | |
| void | PHAL_DMA_stop (PHAL_DMA_Handle_t *handle) |
| Disable the channel, stopping the transfer immediately. | |
| void | PHAL_DMA_restart (PHAL_DMA_Handle_t *handle) |
| Reload the transfer count from handle->params.tx_size and start again. | |
| bool | PHAL_DMA_setMemAddress (PHAL_DMA_Handle_t *handle, uint32_t address) |
| Change the memory address for the next transfer. | |
| bool | PHAL_DMA_setLength (PHAL_DMA_Handle_t *handle, uint16_t length) |
| Change the transfer length (element count) for the next transfer. | |
| void | PHAL_DMA_setMemInc (PHAL_DMA_Handle_t *handle, bool mem_inc) |
| Set whether the memory address increments after each transfer and rebuild the channel configuration. | |
| uint16_t | PHAL_DMA_getRemaining (PHAL_DMA_Handle_t *handle) |
| Number of elements still left to transfer on this channel. | |
| bool | PHAL_DMA_isBusy (const PHAL_DMA_Handle_t *handle) |
| Check whether the channel is currently enabled (transfer in progress, or in circular mode, running continuously) | |
| bool | PHAL_DMA_isComplete (const PHAL_DMA_Handle_t *handle) |
| Check whether the channel has finished its transfer (TC flag set) | |
| bool | PHAL_DMA_isError (const PHAL_DMA_Handle_t *handle) |
| Check whether the channel reported a transfer error (TE flag set) | |
| void | PHAL_DMA_clearFlags (PHAL_DMA_Handle_t *handle) |
| Clear every latched status flag (complete/error/global) for the channel, so a finished transfer can be reused. | |
| DMA_TypeDef * | PHAL_DMA_getPeriph (PHAL_DMA_Handle_t *handle) |
| Get the DMA peripheral (DMA1 or DMA2) for a given handle. | |
| uint8_t | PHAL_DMA_getChannelIdx (PHAL_DMA_Handle_t *handle) |
| Get the channel number (1-8) for a given handle. | |
| static void | dma_dispatch (DMA_TypeDef *periph, uint8_t channel_idx) |
| void | DMA1_Channel1_IRQHandler (void) |
| void | DMA1_Channel2_IRQHandler (void) |
| void | DMA1_Channel3_IRQHandler (void) |
| void | DMA1_Channel4_IRQHandler (void) |
| void | DMA1_Channel5_IRQHandler (void) |
| void | DMA1_Channel6_IRQHandler (void) |
| void | DMA1_Channel7_IRQHandler (void) |
| void | DMA1_Channel8_IRQHandler (void) |
| void | DMA2_Channel1_IRQHandler (void) |
| void | DMA2_Channel2_IRQHandler (void) |
| void | DMA2_Channel3_IRQHandler (void) |
| void | DMA2_Channel4_IRQHandler (void) |
| void | DMA2_Channel5_IRQHandler (void) |
| void | DMA2_Channel6_IRQHandler (void) |
| void | DMA2_Channel7_IRQHandler (void) |
| void | DMA2_Channel8_IRQHandler (void) |
Variables | |
| static PHAL_DMA_Handle_t * | g_dma1_channel_owner [8] |
| static PHAL_DMA_Handle_t * | g_dma2_channel_owner [8] |
G4 DMA Peripheral public API implementation.
| void DMA1_Channel1_IRQHandler | ( | void | ) |
| void DMA1_Channel2_IRQHandler | ( | void | ) |
| void DMA1_Channel3_IRQHandler | ( | void | ) |
| void DMA1_Channel4_IRQHandler | ( | void | ) |
| void DMA1_Channel5_IRQHandler | ( | void | ) |
| void DMA1_Channel6_IRQHandler | ( | void | ) |
| void DMA1_Channel7_IRQHandler | ( | void | ) |
| void DMA1_Channel8_IRQHandler | ( | void | ) |
| void DMA2_Channel1_IRQHandler | ( | void | ) |
| void DMA2_Channel2_IRQHandler | ( | void | ) |
| void DMA2_Channel3_IRQHandler | ( | void | ) |
| void DMA2_Channel4_IRQHandler | ( | void | ) |
| void DMA2_Channel5_IRQHandler | ( | void | ) |
| void DMA2_Channel6_IRQHandler | ( | void | ) |
| void DMA2_Channel7_IRQHandler | ( | void | ) |
| void DMA2_Channel8_IRQHandler | ( | void | ) |
|
static |
|
static |
|
static |
| void PHAL_DMA_clearFlags | ( | PHAL_DMA_Handle_t * | handle | ) |
Clear every latched status flag (complete/error/global) for the channel, so a finished transfer can be reused.
| handle | initialized DMA handle |
| void PHAL_DMA_deinit | ( | PHAL_DMA_Handle_t * | handle | ) |
Disable the channel and release its claim/handle so another handle can use the periph/channel_idx afterward. Also disables the NVIC line if a callback was registered.
| uint8_t PHAL_DMA_getChannelIdx | ( | PHAL_DMA_Handle_t * | handle | ) |
Get the channel number (1-8) for a given handle.
| DMA_TypeDef * PHAL_DMA_getPeriph | ( | PHAL_DMA_Handle_t * | handle | ) |
Get the DMA peripheral (DMA1 or DMA2) for a given handle.
| uint16_t PHAL_DMA_getRemaining | ( | PHAL_DMA_Handle_t * | handle | ) |
Number of elements still left to transfer on this channel.
| bool PHAL_DMA_init | ( | PHAL_DMA_Handle_t * | handle | ) |
Claim a DMA channel and configure it from handle->wiring and handle->params.
Does not start the transfer (call PHAL_DMA_start() afterward).
Does not register an interrupt callback, handle->callback is left untouched (and should be zeroed).
| handle | wiring + params to configure. handle->channel is populated on success |
| bool PHAL_DMA_initWithCallback | ( | PHAL_DMA_Handle_t * | handle, |
| PHAL_DMA_IRQCallbackFn_t | irq_fn, | ||
| void * | ctx ) |
Setup DMA callback then call PHAL_DMA_init()
Additional behavior: On success, handle->callback is set and this channel's NVIC line is enabled
| handle | wiring + params to configure. handle->channel and handle->callback are populated on success |
| irq_fn | callback to invoke when this channel's interrupt fires; must not be nullptr |
| ctx | opaque pointer passed to irq_fn unexamined. See PHAL_DMA_IRQCallbackFn_t for its lifetime requirement |
| bool PHAL_DMA_isBusy | ( | const PHAL_DMA_Handle_t * | handle | ) |
Check whether the channel is currently enabled (transfer in progress, or in circular mode, running continuously)
| bool PHAL_DMA_isComplete | ( | const PHAL_DMA_Handle_t * | handle | ) |
Check whether the channel has finished its transfer (TC flag set)
A normal-mode channel clears EN and latches this flag on its own when the transfer count reaches zero, so this is the flag a blocking wrapper should busy-wait on.
| handle | initialized DMA handle |
| bool PHAL_DMA_isError | ( | const PHAL_DMA_Handle_t * | handle | ) |
Check whether the channel reported a transfer error (TE flag set)
A bus error during the transfer latches this flag and stops the channel.
| handle | initialized DMA handle |
| void PHAL_DMA_restart | ( | PHAL_DMA_Handle_t * | handle | ) |
Reload the transfer count from handle->params.tx_size and start again.
Safe to call regardless of whether the channel state (enabled, mid-transfer, or stopped on an error), it always disables first.
| bool PHAL_DMA_setLength | ( | PHAL_DMA_Handle_t * | handle, |
| uint16_t | length ) |
Change the transfer length (element count) for the next transfer.
| bool PHAL_DMA_setMemAddress | ( | PHAL_DMA_Handle_t * | handle, |
| uint32_t | address ) |
Change the memory address for the next transfer.
| void PHAL_DMA_setMemInc | ( | PHAL_DMA_Handle_t * | handle, |
| bool | mem_inc ) |
Set whether the memory address increments after each transfer and rebuild the channel configuration.
If the channel is currently enabled, this function will not change the configuration
| mem_inc | true to increment memory address after each transfer, false to keep it constant |
| void PHAL_DMA_start | ( | PHAL_DMA_Handle_t * | handle | ) |
Enable the channel, starting the transfer configured by PHAL_DMA_init()
| void PHAL_DMA_stop | ( | PHAL_DMA_Handle_t * | handle | ) |
Disable the channel, stopping the transfer immediately.
Whatever hasn't transferred yet is left un-transferred
|
static |
|
static |