13#include "stm32g474xx.h"
G4 DMA Peripheral wiring configuration and definitions.
void PHAL_DMA_setMemAddress(dma_init_t *init, const uint32_t address)
Definition dma.c:136
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()
Definition dma.c:75
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 b...
Definition dma.c:158
bool PHAL_DMA_init(PHAL_DMA_Handle_t *handle)
Claim a DMA channel and configure it from handle->wiring and handle->params.
Definition dma.c:35
bool PHAL_DMA_isBusy(const PHAL_DMA_Handle_t *handle)
Check whether the channel is currently enabled (transfer in progress, or in circular mode,...
Definition dma.c:146
void(* PHAL_DMA_IRQCallbackFn_t)(void *ctx)
Signature for a DMA channel interrupt callback.
Definition dma.h:55
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.
Definition dma.c:133
uint8_t PHAL_DMA_getChannelIdx(PHAL_DMA_Handle_t *handle)
Get the channel number (1-8) for a given handle.
Definition dma.c:166
DMA_TypeDef * PHAL_DMA_getPeriph(PHAL_DMA_Handle_t *handle)
Get the DMA peripheral (DMA1 or DMA2) for a given handle.
Definition dma.c:162
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 aft...
Definition dma.c:84
void PHAL_DMA_restart(PHAL_DMA_Handle_t *handle)
Reload the transfer count from handle->params.tx_size and start again.
Definition dma.c:106
PHAL_DMA_Mode_t
What a channel does once its transfer count reaches zero.
Definition dma.h:26
@ DMA_MODE_CIRCULAR
Definition dma.h:28
@ DMA_MODE_MEM2MEM
Definition dma.h:29
@ DMA_MODE_NORMAL
Definition dma.h:27
bool PHAL_DMA_isComplete(const PHAL_DMA_Handle_t *handle)
Check whether the channel has finished its transfer (TC flag set)
Definition dma.c:150
uint16_t PHAL_DMA_getRemaining(PHAL_DMA_Handle_t *handle)
Number of elements still left to transfer on this channel.
Definition dma.c:142
void PHAL_DMA_stop(PHAL_DMA_Handle_t *handle)
Disable the channel, stopping the transfer immediately.
Definition dma.c:102
void PHAL_DMA_start(PHAL_DMA_Handle_t *handle)
Enable the channel, starting the transfer configured by PHAL_DMA_init()
Definition dma.c:98
PHAL_DMA_Priority_t
Relative priority when multiple DMA requests are pending at once.
Definition dma.h:18
@ DMA_PRIORITY_HIGH
Definition dma.h:21
@ DMA_PRIORITY_MEDIUM
Definition dma.h:20
@ DMA_PRIORITY_VERY_HIGH
Definition dma.h:22
@ DMA_PRIORITY_LOW
Definition dma.h:19
bool PHAL_DMA_setLength(PHAL_DMA_Handle_t *handle, uint16_t length)
Change the transfer length (element count) for the next transfer.
Definition dma.c:123
bool PHAL_DMA_isError(const PHAL_DMA_Handle_t *handle)
Check whether the channel reported a transfer error (TE flag set)
Definition dma.c:154
A DMA channel interrupt callback and the context passed to it.
Definition dma.h:65
PHAL_DMA_IRQCallbackFn_t irq_fn
Definition dma.h:66
void * ctx
Definition dma.h:67
A configured DMA transfer: fixed wiring + chosen parameters.
Definition dma.h:77
PHAL_DMA_Callback_t callback
Definition dma.h:81
DMA_Channel_TypeDef * channel
Definition dma.h:80
const PHAL_DMA_Wiring_t * wiring
Definition dma.h:78
PHAL_DMA_Params_t params
Definition dma.h:79
Per-transfer parameters (user can configure)
Definition dma.h:35
PHAL_DMA_Mode_t mode
Definition dma.h:39
uint16_t tx_size
Definition dma.h:37
bool tx_isr_en
Definition dma.h:41
uint32_t mem_addr
Definition dma.h:36
bool mem_inc
Definition dma.h:40
PHAL_DMA_Priority_t priority
Definition dma.h:38
Fixed hardware wiring for one peripheral + direction's DMA use.
Definition dma_wiring.h:64