Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
hal_stm32_dma.h File Reference

STM32 DMA subsystem driver header. More...

#include <ch.h>
#include <hal.h>
+ Include dependency graph for hal_stm32_dma.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DMAConfig
 DMA stream configuration structure. More...
 
struct  DMADriver
 Structure representing a DMA driver. More...
 

Macros

#define STM32_DMA_USE_WAIT   TRUE
 Enables synchronous APIs. More...
 
#define STM32_DMA_USE_MUTUAL_EXCLUSION   FALSE
 Enables the dmaAcquireBus() and dmaReleaseBus() APIs. More...
 
#define STM32_DMA_SUPPORTS_CSELR   FALSE
 
#define STM32_DMA_SUPPORTS_DMAMUX   FALSE
 
#define STM32_DMA_DUMMY_MEMORY_AREA_ADDRESS   0x80000000
 
#define __DCACHE_PRESENT   FALSE
 

Typedefs

typedef struct DMADriver DMADriver
 Type of a structure representing an DMA driver. More...
 
typedef void(* dmacallback_t) (DMADriver *dmap, void *buffer, const size_t n)
 DMA notification callback type. More...
 
typedef void *(* dmanextcallback_t) (DMADriver *dmap, const size_t n)
 DMA next buffer query callback type. More...
 
typedef void(* dmaerrorcallback_t) (DMADriver *dmap, dmaerrormask_t err)
 DMA error callback type. More...
 

Enumerations

enum  dmastate_t {
  DMA_UNINIT = 0 , DMA_STOP = 1 , DMA_READY = 2 , DMA_ACTIVE = 3 ,
  DMA_COMPLETE = 4 , DMA_ERROR = 5
}
 Driver state machine possible states. More...
 
enum  dmaerrormask_t {
  DMA_ERR_TRANSFER_ERROR = 1U << 0U , DMA_ERR_DIRECTMODE_ERROR = 1U << 1U , DMA_ERR_FIFO_ERROR = 1U << 2U , DMA_ERR_FIFO_FULL = 1U << 3U ,
  DMA_ERR_FIFO_EMPTY = 1U << 4U
}
 Possible DMA failure causes. More...
 
enum  dmadirection_t { DMA_DIR_P2M = 1 , DMA_DIR_M2P = 2 , DMA_DIR_M2M = 3 }
 DMA transfert direction. More...
 
enum  dmaopmode_t { DMA_ONESHOT = 1 , DMA_CONTINUOUS_HALF_BUFFER }
 DMA transfert memory mode. More...
 

Low level driver helper macros

#define _dma_reset_i(dmap)    osalThreadResumeI(&(dmap)->thread, MSG_RESET)
 Resumes a thread waiting for a dma transfert completion. More...
 
#define _dma_reset_s(dmap)    osalThreadResumeS(&(dmap)->thread, MSG_RESET)
 Resumes a thread waiting for a dma transfert completion. More...
 
#define _dma_wakeup_isr(dmap)
 Wakes up the waiting thread. More...
 
#define _dma_timeout_isr(dmap)
 Wakes up the waiting thread with a timeout message. More...
 
static void _dma_isr_half_code (DMADriver *dmap)
 Common ISR code, half buffer event. More...
 
static void _dma_isr_full_code (DMADriver *dmap)
 Common ISR code, full buffer event. More...
 
static void _dma_isr_error_code (DMADriver *dmap, dmaerrormask_t err)
 Common ISR code, error event. More...
 
void dmaObjectInit (DMADriver *dmap)
 
bool dmaStart (DMADriver *dmap, const DMAConfig *cfg)
 Configures and activates the DMA peripheral. More...
 
bool dmaReloadConf (DMADriver *dmap, const DMAConfig *cfg)
 Configures and activates the DMA peripheral. More...
 
void dmaStop (DMADriver *dmap)
 Deactivates the DMA peripheral. More...
 
msg_t dmaTransfertTimeout (DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size, sysinterval_t timeout)
 Performs a DMA transaction. More...
 
static msg_t dmaTransfert (DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size)
 
void dmaAcquireBus (DMADriver *dmap)
 Gains exclusive access to the DMA peripheral. More...
 
void dmaReleaseBus (DMADriver *dmap)
 Releases exclusive access to the DMA peripheral. More...
 
bool dmaStartTransfert (DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size)
 Starts a DMA transaction. More...
 
void dmaStopTransfert (DMADriver *dmap)
 Stops an ongoing transaction. More...
 
bool dmaStartTransfertI (DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size)
 Starts a DMA transaction. More...
 
void dmaStopTransfertI (DMADriver *dmap)
 Stops an ongoing transaction. More...
 
uint8_t dmaGetStreamIndex (DMADriver *dmap)
 
void dmaGetRegisters (DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size, DMA_Stream_TypeDef *registers)
 copy the dma register to memory. More...
 
static dmastate_t dmaGetState (DMADriver *dmap)
 
static size_t dmaGetTransactionCounter (DMADriver *dmap)
 
bool dma_lld_start (DMADriver *dmap, bool allocate_stream)
 Configures and activates the DMA peripheral. More...
 
void dma_lld_stop (DMADriver *dmap)
 Deactivates the DMA peripheral. More...
 
bool dma_lld_start_transfert (DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size)
 Starts a DMA transaction. More...
 
void dma_lld_stop_transfert (DMADriver *dmap)
 Stops an ongoing transaction. More...
 
void * dma_lld_set_next_double_buffer (DMADriver *dmap, void *nextBuffer)
 
void dma_lld_get_registers (DMADriver *dmap, volatile void *periphp, void *mem0p, const size_t size, DMA_Stream_TypeDef *registers)
 Copy the register of a ready stream. More...
 

Detailed Description

STM32 DMA subsystem driver header.

Author
Alexandre Bustico @maintainer Gautier Hattenberger gauti.nosp@m.er.h.nosp@m.atten.nosp@m.berg.nosp@m.er@en.nosp@m.ac.f.nosp@m.r

Definition in file hal_stm32_dma.h.


Data Structure Documentation

◆ DMAConfig

struct DMAConfig

DMA stream configuration structure.

This implementation-dependent structure describes a DMA operation.

Note
The use of this configuration structure requires knowledge of STM32 DMA registers interface, please refer to the STM32 reference manual for details.

Definition at line 273 of file hal_stm32_dma.h.

+ Collaboration diagram for DMAConfig:
Data Fields
uint8_t channel
dmadirection_t direction DMA transaction direction.
uint8_t dma_priority DMA priority (1 .

. 4)

dmacallback_t end_cb Callback function associated to the stream or NULL.
dmaerrorcallback_t error_cb Error callback or NULL.
bool inc_memory_addr Enable increment of memory address after each transfert.
bool inc_peripheral_addr Enable increment of peripheral address after each transfert.
uint8_t irq_priority DMA IRQ priority (2 .

. 7)

uint8_t msize DMA memory data granurality in bytes (1,2,4)
dmaopmode_t op_mode one shot, or circular half buffer, or circular double buffers
uint8_t psize DMA peripheral data granurality in bytes (1,2,4)
uint32_t stream stream associated with transaction
Note
use STM32_DMA_STREAM_ID macro

◆ DMADriver

struct DMADriver

Structure representing a DMA driver.

Definition at line 412 of file hal_stm32_dma.h.

+ Collaboration diagram for DMADriver:
Data Fields
const DMAConfig * config Current configuration data.
uint8_t controller controller associated with stream
uint32_t dmamode hold DMA CR register for the stream
const stm32_dma_stream_t * dmastream DMA stream associated with peripheral or memory.
void * mem0p memory address
Note
for now, only half buffer with one memory pointer is managed mem1p not yet interfaced
size_t size hold size of current transaction
volatile dmastate_t state Driver state.

Macro Definition Documentation

◆ __DCACHE_PRESENT

#define __DCACHE_PRESENT   FALSE

Definition at line 67 of file hal_stm32_dma.h.

◆ _dma_reset_i

#define _dma_reset_i (   dmap)     osalThreadResumeI(&(dmap)->thread, MSG_RESET)

Resumes a thread waiting for a dma transfert completion.

Parameters
[in]dmappointer to the DMADriver object

@notapi

Definition at line 168 of file hal_stm32_dma.h.

◆ _dma_reset_s

#define _dma_reset_s (   dmap)     osalThreadResumeS(&(dmap)->thread, MSG_RESET)

Resumes a thread waiting for a dma transfert completion.

Parameters
[in]dmappointer to the DMADriver object

@notapi

Definition at line 178 of file hal_stm32_dma.h.

◆ _dma_timeout_isr

#define _dma_timeout_isr (   dmap)
Value:
{ \
osalSysLockFromISR(); \
osalThreadResumeI(&(dmap)->thread, MSG_TIMEOUT); \
osalSysUnlockFromISR(); \
}

Wakes up the waiting thread with a timeout message.

Parameters
[in]dmappointer to the DMADriver object

@notapi

Definition at line 201 of file hal_stm32_dma.h.

◆ _dma_wakeup_isr

#define _dma_wakeup_isr (   dmap)
Value:
{ \
osalSysLockFromISR(); \
osalThreadResumeI(&(dmap)->thread, MSG_OK); \
osalSysUnlockFromISR(); \
}

Wakes up the waiting thread.

Parameters
[in]dmappointer to the DMADriver object

@notapi

Definition at line 188 of file hal_stm32_dma.h.

◆ STM32_DMA_DUMMY_MEMORY_AREA_ADDRESS

#define STM32_DMA_DUMMY_MEMORY_AREA_ADDRESS   0x80000000

Definition at line 63 of file hal_stm32_dma.h.

◆ STM32_DMA_SUPPORTS_CSELR

#define STM32_DMA_SUPPORTS_CSELR   FALSE

Definition at line 55 of file hal_stm32_dma.h.

◆ STM32_DMA_SUPPORTS_DMAMUX

#define STM32_DMA_SUPPORTS_DMAMUX   FALSE

Definition at line 59 of file hal_stm32_dma.h.

◆ STM32_DMA_USE_MUTUAL_EXCLUSION

#define STM32_DMA_USE_MUTUAL_EXCLUSION   FALSE

Enables the dmaAcquireBus() and dmaReleaseBus() APIs.

Note
Disabling this option saves both code and data space.

Definition at line 51 of file hal_stm32_dma.h.

◆ STM32_DMA_USE_WAIT

#define STM32_DMA_USE_WAIT   TRUE

Enables synchronous APIs.

Note
Disabling this option saves both code and data space.

Definition at line 43 of file hal_stm32_dma.h.

Typedef Documentation

◆ dmacallback_t

typedef void(* dmacallback_t) (DMADriver *dmap, void *buffer, const size_t n)

DMA notification callback type.

Parameters
[in]dmappointer to the DMADriver object triggering the callback
[in]bufferpointer to the most recent dma data
[in]nnumber of buffer rows available starting from buffer

Definition at line 128 of file hal_stm32_dma.h.

◆ DMADriver

typedef struct DMADriver DMADriver

Type of a structure representing an DMA driver.

Definition at line 1 of file hal_stm32_dma.h.

◆ dmaerrorcallback_t

typedef void(* dmaerrorcallback_t) (DMADriver *dmap, dmaerrormask_t err)

DMA error callback type.

Parameters
[in]dmappointer to the DMADriver object triggering the callback
[in]errDMA error code

Definition at line 148 of file hal_stm32_dma.h.

◆ dmanextcallback_t

typedef void*(* dmanextcallback_t) (DMADriver *dmap, const size_t n)

DMA next buffer query callback type.

Parameters
[in]dmappointer to the DMADriver object triggering the callback
[in]nnumber of buffer rows needed in the returned buffer pointer
Returns
pointer to the next to be used dma buffer

Definition at line 138 of file hal_stm32_dma.h.

Enumeration Type Documentation

◆ dmadirection_t

DMA transfert direction.

Enumerator
DMA_DIR_P2M 

PERIPHERAL to MEMORY

DMA_DIR_M2P 

MEMORY to PERIPHERAL

DMA_DIR_M2M 

MEMORY to MEMORY

Definition at line 98 of file hal_stm32_dma.h.

◆ dmaerrormask_t

Possible DMA failure causes.

Note
Error codes are architecture dependent and should not relied upon.
Enumerator
DMA_ERR_TRANSFER_ERROR 

DMA transfer failure.


DMA_ERR_DIRECTMODE_ERROR 

DMA Direct Mode failure.


DMA_ERR_FIFO_ERROR 

DMA FIFO error.


DMA_ERR_FIFO_FULL 

DMA FIFO overrun.

DMA_ERR_FIFO_EMPTY 

DMA FIFO underrun.

Definition at line 87 of file hal_stm32_dma.h.

◆ dmaopmode_t

DMA transfert memory mode.

Enumerator
DMA_ONESHOT 

One transert then stop

DMA_CONTINUOUS_HALF_BUFFER 

Continuous mode to/from the same buffer.

Definition at line 107 of file hal_stm32_dma.h.

◆ dmastate_t

enum dmastate_t

Driver state machine possible states.

Enumerator
DMA_UNINIT 

Not initialized.


DMA_STOP 

Stopped.


DMA_READY 

Ready.


DMA_ACTIVE 

Transfering.


DMA_COMPLETE 

Transfert complete.


DMA_ERROR 

Transfert error.


Definition at line 73 of file hal_stm32_dma.h.

Function Documentation

◆ _dma_isr_error_code()

static void _dma_isr_error_code ( DMADriver dmap,
dmaerrormask_t  err 
)
inlinestatic

Common ISR code, error event.

This code handles the portable part of the ISR code:

  • Callback invocation.
  • Waiting thread timeout signaling, if any.
  • Driver state transitions.
Note
This macro is meant to be used in the low level drivers implementation only.
Parameters
[in]adcppointer to the ADCDriver object
[in]errplatform dependent error code

@notapi

Definition at line 709 of file hal_stm32_dma.h.

References _dma_timeout_isr, DMADriver::config, DMA_ERR_DIRECTMODE_ERROR, DMA_ERR_FIFO_EMPTY, DMA_ERR_FIFO_ERROR, DMA_ERR_FIFO_FULL, DMA_ERR_TRANSFER_ERROR, DMA_ERROR, dma_lld_stop_transfert(), DMA_READY, DMAConfig::error_cb, and DMADriver::state.

Referenced by dma_lld_serve_interrupt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _dma_isr_full_code()

static void _dma_isr_full_code ( DMADriver dmap)
inlinestatic

Common ISR code, full buffer event.

This code handles the portable part of the ISR code:

  • Callback invocation.
  • Waiting thread wakeup, if any.
  • Driver state transitions.
Note
This macro is meant to be used in the low level drivers implementation only.
Parameters
[in]adcppointer to the ADCDriver object

@notapi

Definition at line 639 of file hal_stm32_dma.h.

References _dma_wakeup_isr, DMADriver::config, DMA_COMPLETE, DMA_CONTINUOUS_HALF_BUFFER, dma_lld_set_next_double_buffer(), dma_lld_stop_transfert(), DMA_ONESHOT, DMA_READY, DMAConfig::end_cb, DMADriver::mem0p, DMAConfig::msize, DMAConfig::op_mode, DMADriver::size, DMADriver::state, and STM32_DMA_DUMMY_MEMORY_AREA_ADDRESS.

Referenced by dma_lld_serve_interrupt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _dma_isr_half_code()

static void _dma_isr_half_code ( DMADriver dmap)
inlinestatic

Common ISR code, half buffer event.

This code handles the portable part of the ISR code:

  • Callback invocation.
Note
This macro is meant to be used in the low level drivers implementation only.
Parameters
[in]adcppointer to the ADCDriver object

@notapi

Definition at line 622 of file hal_stm32_dma.h.

References DMADriver::config, DMAConfig::end_cb, DMADriver::mem0p, and DMADriver::size.

Referenced by dma_lld_serve_interrupt().

+ Here is the caller graph for this function:

◆ dma_lld_get_registers()

void dma_lld_get_registers ( DMADriver dmap,
volatile void *  periphp,
void *  mem0p,
const size_t  size,
DMA_Stream_TypeDef *  registers 
)

Copy the register of a ready stream.

Parameters
[in]dmappointer to the DMADriver object
Note
: main use is preparing link list of transactions for mdma use @notapi

Definition at line 865 of file hal_stm32_dma.c.

References DMADriver::config, DMADriver::dmamode, DMADriver::dmastream, and DMAConfig::op_mode.

Referenced by dmaGetRegisters().

+ Here is the caller graph for this function:

◆ dma_lld_set_next_double_buffer()

void* dma_lld_set_next_double_buffer ( DMADriver dmap,
void *  nextBuffer 
)

Referenced by _dma_isr_full_code().

+ Here is the caller graph for this function:

◆ dma_lld_start()

bool dma_lld_start ( DMADriver dmap,
bool  allocate_stream 
)

◆ dma_lld_start_transfert()

bool dma_lld_start_transfert ( DMADriver dmap,
volatile void *  periphp,
void *  mem0p,
const size_t  size 
)

Starts a DMA transaction.

Parameters
[in]dmappointer to the DMADriver object

@notapi

Definition at line 897 of file hal_stm32_dma.c.

References DMADriver::config, DMAConfig::direction, DMA_DIR_P2M, DMADriver::dmamode, DMADriver::dmastream, getCrossCacheBoundaryAwareSize(), DMADriver::mem0p, DMAConfig::msize, DMAConfig::op_mode, and DMADriver::size.

Referenced by dmaStartTransfertI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dma_lld_stop()

void dma_lld_stop ( DMADriver dmap)

Deactivates the DMA peripheral.

Parameters
[in]dmappointer to the DMADriver object

@notapi

Definition at line 952 of file hal_stm32_dma.c.

References DMADriver::dmastream.

Referenced by dmaStop().

+ Here is the caller graph for this function:

◆ dma_lld_stop_transfert()

void dma_lld_stop_transfert ( DMADriver dmap)

Stops an ongoing transaction.

Parameters
[in]dmappointer to the DMADriver object

@notapi

Definition at line 940 of file hal_stm32_dma.c.

References DMADriver::dmastream.

Referenced by _dma_isr_error_code(), _dma_isr_full_code(), dmaStopTransfert(), and dmaStopTransfertI().

+ Here is the caller graph for this function:

◆ dmaAcquireBus()

void dmaAcquireBus ( DMADriver dmap)

Gains exclusive access to the DMA peripheral.

This function tries to gain ownership to the DMA bus, if the bus is already being used then the invoking thread is queued.

Precondition
In order to use this function the option DMA_USE_MUTUAL_EXCLUSION must be enabled.
Parameters
[in]dmappointer to the DMADriver object

@api

Definition at line 502 of file hal_stm32_dma.c.

◆ dmaGetRegisters()

void dmaGetRegisters ( DMADriver dmap,
volatile void *  periphp,
void *  mem0p,
const size_t  size,
DMA_Stream_TypeDef *  registers 
)

copy the dma register to memory.

mainly used to preapare mdma linked list chained transferts

Parameters
[in]dmappointer to the DMADriver object
[in,out]periphppointer to a peripheral register address
[in,out]mem0ppointer to the data buffer
[in]sizebuffer size. The buffer size must be one or an even number.
[out]registerspointer to structure representing a DMA stream set of registers

@iclass

Definition at line 328 of file hal_stm32_dma.c.

References DMADriver::config, DMA_CONTINUOUS_HALF_BUFFER, dma_lld_get_registers(), DMA_READY, DMAConfig::inc_peripheral_addr, DMAConfig::msize, DMAConfig::op_mode, DMAConfig::psize, and DMADriver::state.

+ Here is the call graph for this function:

◆ dmaGetState()

static dmastate_t dmaGetState ( DMADriver dmap)
inlinestatic

Definition at line 534 of file hal_stm32_dma.h.

References DMADriver::state.

◆ dmaGetStreamIndex()

uint8_t dmaGetStreamIndex ( DMADriver dmap)

Definition at line 438 of file hal_stm32_dma.c.

References DMADriver::dmastream.

◆ dmaGetTransactionCounter()

static size_t dmaGetTransactionCounter ( DMADriver dmap)
inlinestatic

Definition at line 535 of file hal_stm32_dma.h.

References DMADriver::dmastream.

Referenced by dshotRpmCatchErps().

+ Here is the caller graph for this function:

◆ dmaObjectInit()

void dmaObjectInit ( DMADriver dmap)

Definition at line 69 of file hal_stm32_dma.c.

References DMADriver::config, DMA_STOP, DMADriver::mem0p, and DMADriver::state.

Referenced by dshotStart(), initCache(), and light_ws2812_arch_init().

+ Here is the caller graph for this function:

◆ dmaReleaseBus()

void dmaReleaseBus ( DMADriver dmap)

Releases exclusive access to the DMA peripheral.

Precondition
In order to use this function the option DMA_USE_MUTUAL_EXCLUSION must be enabled.
Parameters
[in]dmappointer to the DMADriver object

@api

Definition at line 519 of file hal_stm32_dma.c.

◆ dmaReloadConf()

bool dmaReloadConf ( DMADriver dmap,
const DMAConfig cfg 
)

Configures and activates the DMA peripheral.

Parameters
[in]dmappointer to the DMADriver object
[in]configpointer to the DMAConfig object.
Returns
The operation result.
Return values
truedma driver is OK
falseincoherencies has been found in config @api

Definition at line 138 of file hal_stm32_dma.c.

References DMADriver::config, dma_lld_start(), DMA_READY, DMAConfig::op_mode, and DMADriver::state.

+ Here is the call graph for this function:

◆ dmaStart()

bool dmaStart ( DMADriver dmap,
const DMAConfig cfg 
)

Configures and activates the DMA peripheral.

Parameters
[in]dmappointer to the DMADriver object
[in]configpointer to the DMAConfig object.
Returns
The operation result.
Return values
truedma driver is OK
falseincoherencies has been found in config @api

Definition at line 105 of file hal_stm32_dma.c.

References DMADriver::config, dma_lld_start(), DMA_READY, DMA_STOP, DMAConfig::op_mode, and DMADriver::state.

Referenced by dshotStart(), initCache(), and light_ws2812_arch_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dmaStartTransfert()

bool dmaStartTransfert ( DMADriver dmap,
volatile void *  periphp,
void *  mem0p,
const size_t  size 
)

Starts a DMA transaction.

Starts one or many asynchronous dma transaction(s) depending on continuous field

Postcondition
The callbacks associated to the DMA config will be invoked on buffer fill and error events, and timeout events in case STM32_DMA_USE_ASYNC_TIMOUT == TRUE
Note
The datas are sequentially written into the buffer with no gaps.
Parameters
[in]dmappointer to the DMADriver object
[in,out]periphppointer to a peripheral register address
[in,out]mem0ppointer to the data buffer
[in]sizebuffer size. The buffer size must be one or an even number.

@api

Definition at line 201 of file hal_stm32_dma.c.

References dmaStartTransfertI().

Referenced by dshotRpmCatchErps(), and light_ws2812_arch_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dmaStartTransfertI()

bool dmaStartTransfertI ( DMADriver dmap,
volatile void *  periphp,
void *  mem0p,
const size_t  size 
)

Starts a DMA transaction.

Starts one or many asynchronous dma transaction(s) depending on continuous field

Postcondition
The callbacks associated to the DMA config will be invoked on buffer fill and error events, and timeout events in case STM32_DMA_USE_ASYNC_TIMOUT == TRUE
Note
The datas are sequentially written into the buffer with no gaps.
Parameters
[in]dmappointer to the DMADriver object
[in,out]periphppointer to a peripheral register address
[in,out]mem0ppointer to the data buffer
[in]sizebuffer size. The buffer size must be one or an even number.

@iclass

Definition at line 226 of file hal_stm32_dma.c.

References DMADriver::config, DMA_ACTIVE, DMA_COMPLETE, DMA_CONTINUOUS_HALF_BUFFER, DMA_ERROR, dma_lld_start_transfert(), DMA_READY, DMAConfig::inc_peripheral_addr, DMAConfig::msize, DMAConfig::op_mode, DMAConfig::psize, DMADriver::size, and DMADriver::state.

Referenced by dmaStartTransfert(), and dmaTransfertTimeout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dmaStop()

void dmaStop ( DMADriver dmap)

Deactivates the DMA peripheral.

Parameters
[in]dmappointer to the DMADriver object

@api

Definition at line 167 of file hal_stm32_dma.c.

References DMADriver::config, dma_lld_stop(), DMA_READY, DMA_STOP, DMADriver::mem0p, and DMADriver::state.

Referenced by dshotStop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dmaStopTransfert()

void dmaStopTransfert ( DMADriver dmap)

Stops an ongoing transaction.

This function stops the currently ongoing transaction and returns the driver in the DMA_READY state. If there was no transaction being processed then the function does nothing.

Parameters
[in]dmappointer to the DMADriver object

@api

Definition at line 393 of file hal_stm32_dma.c.

References _dma_reset_s, DMA_ACTIVE, dma_lld_stop_transfert(), DMA_READY, and DMADriver::state.

Referenced by dshotStop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dmaStopTransfertI()

void dmaStopTransfertI ( DMADriver dmap)

Stops an ongoing transaction.

This function stops the currently ongoing transaction and returns the driver in the DMA_READY state. If there was no transaction being processed then the function does nothing.

Parameters
[in]dmappointer to the DMADriver object

@iclass

Definition at line 421 of file hal_stm32_dma.c.

References _dma_reset_i, DMA_ACTIVE, DMA_COMPLETE, dma_lld_stop_transfert(), DMA_READY, and DMADriver::state.

Referenced by dmaTransfertTimeout(), and dshotRpmCatchErps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dmaTransfert()

static msg_t dmaTransfert ( DMADriver dmap,
volatile void *  periphp,
void *  mem0p,
const size_t  size 
)
inlinestatic

Definition at line 514 of file hal_stm32_dma.h.

References dmaTransfertTimeout().

Referenced by dshotSendFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dmaTransfertTimeout()

msg_t dmaTransfertTimeout ( DMADriver dmap,
volatile void *  periphp,
void *  mem0p,
const size_t  size,
sysinterval_t  timeout 
)

Performs a DMA transaction.

Performs one synchronous dma transaction

Note
The datas are sequentially written into the buffer with no gaps.
Parameters
[in]dmappointer to the DMADriver object
[in,out]periphppointer to a peripheral register address
[in,out]mem0ppointer to the data buffer
[in]sizebuffer size. The buffer size must be one or an even number.
[in]timeoutfunction will exit after timeout is transaction is not done can be TIME_INFINITE (but not TIME_IMMEDIATE)
Returns
The operation result.
Return values
MSG_OKTransaction finished.
MSG_RESETThe transaction has been stopped using dmaStopTransaction() or dmaStopTransactionI(), the result buffer may contain incorrect data.
MSG_TIMEOUTThe transaction has been stopped because of hardware error or timeout limit reach

@api

Definition at line 472 of file hal_stm32_dma.c.

References DMADriver::config, DMA_ONESHOT, dmaStartTransfertI(), dmaStopTransfertI(), msg, DMAConfig::op_mode, and timeout.

Referenced by dmaTransfert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: