Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
Zephyr API Documentation
►
Introduction
Deprecated List
►
Topics
►
Data Structures
▼
Files
▼
File List
►
doc
►
kernel
►
lib
►
modules
►
subsys
▼
zephyr
►
acpi
►
app_memory
►
arch
►
audio
►
bluetooth
►
canbus
►
console
►
crypto
►
data
►
debug
►
devicetree
►
dfu
►
display
▼
drivers
►
adc
►
bluetooth
►
can
►
clock_control
►
comparator
►
console
►
dac
▼
dma
►
dma_esp32.h
►
dma_gd32.h
►
dma_intel_lpss.h
►
dma_mcux_lpc.h
►
dma_mcux_pxp.h
►
dma_mcux_smartdma.h
►
dma_silabs_ldma.h
►
dma_smartbond.h
►
dma_stm32.h
►
eeprom
►
ethernet
►
firmware
►
flash
►
gnss
►
gpio
►
haptics
►
i2c
►
i3c
►
ieee802154
►
interrupt_controller
►
led
►
led_strip
►
mfd
►
mic_privacy
►
mipi_dsi
►
misc
►
mm
►
modem
►
mspi
►
pcie
►
pinctrl
►
pm_cpu_ops
►
power
►
pwm
►
regulator
►
retained_mem
►
rtc
►
sensor
►
serial
►
sip_svc
►
spi
►
stepper
►
timer
►
uart
►
usb
►
usb_c
►
virtualization
►
adc.h
►
auxdisplay.h
►
bbram.h
►
bluetooth.h
cache.h
►
can.h
►
cellular.h
►
charger.h
►
clock_control.h
►
comparator.h
►
coredump.h
►
counter.h
►
dac.h
►
dai.h
►
disk.h
►
display.h
►
dma.h
►
edac.h
►
eeprom.h
►
emul.h
►
emul_bbram.h
►
emul_fuel_gauge.h
►
emul_sensor.h
►
emul_stub_device.h
►
entropy.h
►
espi.h
►
espi_emul.h
►
espi_saf.h
►
flash.h
►
fpga.h
►
fuel_gauge.h
►
gnss.h
►
gpio.h
►
haptics.h
►
hwinfo.h
►
hwspinlock.h
►
i2c.h
►
i2c_emul.h
►
i2s.h
►
i3c.h
►
ipm.h
►
led.h
►
led_strip.h
►
loopback_disk.h
►
lora.h
►
mbox.h
►
mdio.h
►
mipi_dbi.h
►
mipi_dsi.h
►
mspi.h
►
mspi_emul.h
►
peci.h
►
pinctrl.h
►
pm_cpu_ops.h
►
ps2.h
►
ptp_clock.h
►
pwm.h
►
regulator.h
►
reset.h
►
retained_mem.h
►
rtc.h
►
sdhc.h
►
sensor.h
►
sensor_attribute_types.h
►
sensor_clock.h
►
sensor_data_types.h
►
smbus.h
►
spi.h
►
spi_emul.h
►
stepper.h
►
swdp.h
►
syscon.h
►
tee.h
►
uart.h
►
uart_emul.h
►
uart_pipe.h
►
video-controls.h
►
video.h
►
w1.h
►
watchdog.h
►
dsp
►
dt-bindings
►
fs
►
input
►
internal
►
ipc
►
kernel
►
linker
►
llext
►
logging
►
lorawan
►
math
►
mem_mgmt
►
mgmt
►
misc
►
modbus
►
modem
►
multi_heap
►
net
►
platform
►
pm
►
pmci
►
portability
►
posix
►
psa
►
random
►
retention
►
rtio
►
sd
►
sensing
►
settings
►
shell
►
sip_svc
►
stats
►
storage
►
sys
►
task_wdt
►
timing
►
toolchain
►
tracing
►
usb
►
usb_c
►
virtio
►
xen
►
zbus
►
zvfs
►
bindesc.h
►
cache.h
►
device.h
►
devicetree.h
►
fatal.h
►
fatal_types.h
►
init.h
►
irq.h
►
irq_multilevel.h
►
irq_nextlevel.h
►
irq_offload.h
►
kernel.h
kernel_includes.h
►
kernel_structs.h
►
kernel_version.h
►
net_buf.h
►
shared_irq.h
►
smf.h
►
spinlock.h
►
sw_isr_table.h
►
sys_clock.h
►
syscall.h
►
toolchain.h
types.h
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
dma_stm32.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Linaro Limited
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_DRIVERS_DMA_STM32_H_
8
#define ZEPHYR_INCLUDE_DRIVERS_DMA_STM32_H_
9
10
/* @brief linked_channel value to inform zephyr dma driver that
11
* DMA channel will be handled by HAL
12
*/
13
#define STM32_DMA_HAL_OVERRIDE 0x7F
14
15
/* @brief gives the first DMA channel : 0 or 1 in the register map
16
* when counting channels from 1 to N or from 0 to N-1
17
*/
18
#if defined(CONFIG_DMA_STM32U5)
19
/* from DTS the dma stream id is in range 0..N-1 */
20
#define STM32_DMA_STREAM_OFFSET 0
21
#elif !defined(CONFIG_DMA_STM32_V1)
22
/* from DTS the dma stream id is in range 1..N */
23
/* so decrease to set range from 0 from now on */
24
#define STM32_DMA_STREAM_OFFSET 1
25
#elif defined(CONFIG_DMA_STM32_V1) && defined(CONFIG_DMAMUX_STM32)
26
/* typically on the stm32H7 series, DMA V1 with mux */
27
#define STM32_DMA_STREAM_OFFSET 1
28
#else
29
/* from DTS the dma stream id is in range 0..N-1 */
30
#define STM32_DMA_STREAM_OFFSET 0
31
#endif
/* ! CONFIG_DMA_STM32_V1 */
32
33
/* macro for dma slot (only for dma-v1 or dma-v2 types) */
34
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v2bis)
35
#define STM32_DMA_SLOT(id, dir, slot) 0
36
#define STM32_DMA_SLOT_BY_IDX(id, idx, slot) 0
37
#else
38
#define STM32_DMA_SLOT(id, dir, slot) DT_INST_DMAS_CELL_BY_NAME(id, dir, slot)
39
#define STM32_DMA_SLOT_BY_IDX(id, idx, slot) DT_INST_DMAS_CELL_BY_IDX(id, idx, slot)
40
#endif
41
42
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v2) || \
43
DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v2bis) || \
44
DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dmamux)
45
#define STM32_DMA_FEATURES(id, dir) 0
46
#else
47
#define STM32_DMA_FEATURES(id, dir) \
48
DT_INST_DMAS_CELL_BY_NAME(id, dir, features)
47
#define STM32_DMA_FEATURES(id, dir) \
…
49
#endif
50
51
#define STM32_DMA_CTLR(id, dir) \
52
DT_INST_DMAS_CTLR_BY_NAME(id, dir)
51
#define STM32_DMA_CTLR(id, dir) \
…
53
#define STM32_DMA_CHANNEL_CONFIG(id, dir) \
54
DT_INST_DMAS_CELL_BY_NAME(id, dir, channel_config)
53
#define STM32_DMA_CHANNEL_CONFIG(id, dir) \
…
55
#define STM32_DMA_CHANNEL_CONFIG_BY_IDX(id, idx) \
56
DT_INST_DMAS_CELL_BY_IDX(id, idx, channel_config)
55
#define STM32_DMA_CHANNEL_CONFIG_BY_IDX(id, idx) \
…
57
58
/* macros for channel-config */
59
/* enable circular buffer */
60
#define STM32_DMA_CONFIG_CYCLIC(config) ((config >> 5) & 0x1)
61
/* direction defined on bits 6-7 */
62
/* 0 -> MEM_TO_MEM, 1 -> MEM_TO_PERIPH, 2 -> PERIPH_TO_MEM */
63
#define STM32_DMA_CONFIG_DIRECTION(config) ((config >> 6) & 0x3)
64
/* periph increment defined on bit 9 as true/false */
65
#define STM32_DMA_CONFIG_PERIPHERAL_ADDR_INC(config) ((config >> 9) & 0x1)
66
/* mem increment defined on bit 10 as true/false */
67
#define STM32_DMA_CONFIG_MEMORY_ADDR_INC(config) ((config >> 10) & 0x1)
68
/* periph data size defined on bits 11-12 */
69
/* 0 -> 1 byte, 1 -> 2 bytes, 2 -> 4 bytes */
70
#define STM32_DMA_CONFIG_PERIPHERAL_DATA_SIZE(config) \
71
(1 << ((config >> 11) & 0x3))
70
#define STM32_DMA_CONFIG_PERIPHERAL_DATA_SIZE(config) \
…
72
/* memory data size defined on bits 13, 14 */
73
/* 0 -> 1 byte, 1 -> 2 bytes, 2 -> 4 bytes */
74
#define STM32_DMA_CONFIG_MEMORY_DATA_SIZE(config) \
75
(1 << ((config >> 13) & 0x3))
74
#define STM32_DMA_CONFIG_MEMORY_DATA_SIZE(config) \
…
76
/* priority increment offset defined on bit 15 */
77
#define STM32_DMA_CONFIG_PERIPHERAL_INC_FIXED(config) ((config >> 15) & 0x1)
78
/* priority defined on bits 16-17 as 0, 1, 2, 3 */
79
#define STM32_DMA_CONFIG_PRIORITY(config) ((config >> 16) & 0x3)
80
81
/* macro for features (only for dma-v1) */
82
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v1)
83
#define STM32_DMA_FEATURES_FIFO_THRESHOLD(features) (features & 0x3)
84
#else
85
#define STM32_DMA_FEATURES_FIFO_THRESHOLD(features) 0
86
#endif
87
88
#endif
/* ZEPHYR_INCLUDE_DRIVERS_DMA_STM32_H_ */
zephyr
drivers
dma
dma_stm32.h
Generated on Thu Jun 5 2025 15:05:49 for Zephyr API Documentation by
1.12.0