PebbleOS v4.47.0-757-g12b6c531f
Loading...
Searching...
No Matches
STM32H7 DMA

DMA controller made of the DMAMUX1 request router and the DMA1 and DMA2 controllers behind it. More...

Data Structures

struct  pbl_dma_stm32h7_stream
 Stream state. More...
 
struct  pbl_dma_stm32h7
 Controller. More...
 

Macros

#define PBL_DMA_STM32H7_NUM_REQUESTS   108U
 Request lines of DMAMUX1, 1 to 107; 0 is none.
 
#define PBL_DMA_STM32H7_NUM_STREAMS   16U
 Streams, 8 of DMA1 then 8 of DMA2.
 
#define PBL_DMA_STM32H7_DEFINE(sym, _name, _mux, _dma1, _dma2, _clk1, _clk2, _i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15)
 Define the controller.
 

Detailed Description

DMA controller made of the DMAMUX1 request router and the DMA1 and DMA2 controllers behind it.

Channels are the request lines of DMAMUX1, from the reference manual, as consumers name them in the devicetree. The first slave configuration of a request binds it to a free stream of DMA1 or DMA2, which it keeps; there are 16. The configuration of a channel is a mask of stream configuration bits: the priority, DMA_SCR_PL_MASK, and the bufferable transfers the USARTs need, DMA_SCR_TRBUFF.

static const struct pbl_dma_chan s_rx = PBL_DMA_CHAN(&s_dmamux1, 41, 41, DMA_SCR_TRBUFF);
A channel, as used by a consumer.
Definition dma.h:122
#define PBL_DMA_CHAN(_ctrl, _channel, _request, _config)
Initializer for a struct pbl_dma_chan.
Definition dma.h:141

Each stream has its own interrupt line: the controller connects them all, with priority CONFIG_DMA_STM32H7_IRQ_PRIO, and enables a stream's while a transfer with a callback runs. Cyclic transfers run a ring of two periods, ended by the half and full transfer interrupts. Buffers must be in memory the DMA controllers reach: not in the DTCM.


Data Structure Documentation

◆ pbl_dma_stm32h7_stream

struct pbl_dma_stm32h7_stream

Stream state.

Data Fields
uint32_t config Configuration of its channel.
uint8_t request Request bound to the stream, 0 when free.

◆ pbl_dma_stm32h7

struct pbl_dma_stm32h7

Controller.

Data Fields
struct pbl_clk clk[2] DMA1 and DMA2 clocks.
struct pbl_dma_controller ctrl DMA controller.
uintptr_t dma[2] DMA1 and DMA2 registers.
pbl_irq_t irqs[PBL_DMA_STM32H7_NUM_STREAMS] Interrupt line of each stream.
uintptr_t mux DMAMUX1 registers.
struct pbl_dma_stm32h7_stream * streams State of each stream.

Macro Definition Documentation

◆ PBL_DMA_STM32H7_DEFINE

#define PBL_DMA_STM32H7_DEFINE (   sym,
  _name,
  _mux,
  _dma1,
  _dma2,
  _clk1,
  _clk2,
  _i0,
  _i1,
  _i2,
  _i3,
  _i4,
  _i5,
  _i6,
  _i7,
  _i8,
  _i9,
  _i10,
  _i11,
  _i12,
  _i13,
  _i14,
  _i15 
)
Value:
static struct pbl_dma_stm32h7_stream sym##_streams[PBL_DMA_STM32H7_NUM_STREAMS]; \
PBL_DEVICE_INSTANCE(sym, struct pbl_dma_stm32h7, struct pbl_dma_controller, ctrl){ \
.ctrl = \
PBL_DMA_CONTROLLER_INIT(sym, _name, pbl_dma_stm32h7_init, nullptr, &pbl_dma_stm32h7_ops), \
.mux = (_mux), \
.dma = {(_dma1), (_dma2)}, \
.clk = {_clk1, _clk2}, \
.irqs = \
{_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15}, \
.streams = sym##_streams, \
}; \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 0, _i0); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 1, _i1); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 2, _i2); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 3, _i3); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 4, _i4); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 5, _i5); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 6, _i6); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 7, _i7); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 8, _i8); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 9, _i9); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 10, _i10); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 11, _i11); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 12, _i12); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 13, _i13); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 14, _i14); \
PBL_DMA_STM32H7_STREAM_IRQ(sym, 15, _i15)
Stream state.
Definition stm32h7.h:42
Controller.
Definition stm32h7.h:50
#define PBL_DMA_STM32H7_NUM_REQUESTS
Request lines of DMAMUX1, 1 to 107; 0 is none.
Definition stm32h7.h:36
#define PBL_DMA_STM32H7_NUM_STREAMS
Streams, 8 of DMA1 then 8 of DMA2.
Definition stm32h7.h:39
A DMA controller.
Definition dma.h:176
#define PBL_DMA_CONTROLLER_STATE_DEFINE(sym, _num_channels)
Define the class state of DMA controller sym, for the driver's define macro.
Definition dma.h:193

Define the controller.

Parameters
symSymbol of the controller.
_nameName.
_muxDMAMUX1 registers.
_dma1DMA1 registers.
_dma2DMA2 registers.
_clk1DMA1 clock, from PBL_CLK().
_clk2DMA2 clock, from PBL_CLK().
_i0Interrupt line of DMA1 stream 0, followed by those of its streams 1 to 7, then those of DMA2 streams 0 to 7.

◆ PBL_DMA_STM32H7_NUM_REQUESTS

#define PBL_DMA_STM32H7_NUM_REQUESTS   108U

Request lines of DMAMUX1, 1 to 107; 0 is none.

◆ PBL_DMA_STM32H7_NUM_STREAMS

#define PBL_DMA_STM32H7_NUM_STREAMS   16U

Streams, 8 of DMA1 then 8 of DMA2.