This is an automated email from the ASF dual-hosted git repository. michallenc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b07ea9a8e08b26806bedbb2ea0d61fbd5ed8948c Author: raiden00pl <[email protected]> AuthorDate: Wed Aug 26 12:52:24 2026 +0200 arch/arm/stm32u3: Use the common GPDMA driver Select STM32_HAVE_IP_DMA_GPDMA and STM32_HAVE_DMA1, enable the GPDMA1 clock, and provide the GPDMA instance parameters, the request signal map taken from RM0487, and the USART RX DMA request numbers. DMA1 is the 12-channel GPDMA1 instance. Signed-off-by: raiden00pl <[email protected]> Assisted-by: Claude Code --- arch/arm/src/stm32u3/Kconfig | 2 + arch/arm/src/stm32u3/chip.h | 5 + arch/arm/src/stm32u3/hardware/stm32_dmasigmap.h | 146 ++++++++++++++++++++++++ arch/arm/src/stm32u3/stm32u3xx_rcc.c | 4 + 4 files changed, 157 insertions(+) diff --git a/arch/arm/src/stm32u3/Kconfig b/arch/arm/src/stm32u3/Kconfig index 83d130ece77..c6cb7333373 100644 --- a/arch/arm/src/stm32u3/Kconfig +++ b/arch/arm/src/stm32u3/Kconfig @@ -10,6 +10,8 @@ comment "STM32U3 Configuration Options" config STM32_U3_PERIPHERALS bool default y + select STM32_HAVE_DMA1 + select STM32_HAVE_IP_DMA_GPDMA select STM32_HAVE_IP_EXTI_M33_V1 select STM32_HAVE_IP_GPIO_M33_V1 select STM32_HAVE_IP_TIMERS_V3 diff --git a/arch/arm/src/stm32u3/chip.h b/arch/arm/src/stm32u3/chip.h index 94d48d411a5..b7834980cb0 100644 --- a/arch/arm/src/stm32u3/chip.h +++ b/arch/arm/src/stm32u3/chip.h @@ -50,4 +50,9 @@ #define ARMV8M_PERIPHERAL_INTERRUPTS STM32_IRQ_NEXTINTS +/* GPDMA instance parameters. DMA1 is the GPDMA1 instance. */ + +#define STM32_DMA1_NCHAN 12 +#define STM32_DMA1_IRQ_FIRST STM32_IRQ_GPDMA1_CH0 + #endif /* __ARCH_ARM_SRC_STM32U3_CHIP_H */ diff --git a/arch/arm/src/stm32u3/hardware/stm32_dmasigmap.h b/arch/arm/src/stm32u3/hardware/stm32_dmasigmap.h new file mode 100644 index 00000000000..bcdce58300d --- /dev/null +++ b/arch/arm/src/stm32u3/hardware/stm32_dmasigmap.h @@ -0,0 +1,146 @@ +/**************************************************************************** + * arch/arm/src/stm32u3/hardware/stm32_dmasigmap.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_STM32U3_HARDWARE_STM32_DMASIGMAP_H +#define __ARCH_ARM_SRC_STM32U3_HARDWARE_STM32_DMASIGMAP_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* GPDMA1 request signals */ + +#define GPDMA_REQ_ADC1 (0) +#define GPDMA_REQ_ADC2 (1) +#define GPDMA_REQ_DAC1_CH1 (2) +#define GPDMA_REQ_DAC1_CH2 (3) +#define GPDMA_REQ_TIM6_UP (4) +#define GPDMA_REQ_TIM7_UP (5) +#define GPDMA_REQ_SPI1_RX (6) +#define GPDMA_REQ_SPI1_TX (7) +#define GPDMA_REQ_SPI2_RX (8) +#define GPDMA_REQ_SPI2_TX (9) +#define GPDMA_REQ_SPI3_RX (10) +#define GPDMA_REQ_SPI3_TX (11) +#define GPDMA_REQ_I2C1_RX (12) +#define GPDMA_REQ_I2C1_TX (13) +#define GPDMA_REQ_I2C1_EVC (14) +#define GPDMA_REQ_I2C2_RX (15) +#define GPDMA_REQ_I2C2_TX (16) +#define GPDMA_REQ_I2C2_EVC (17) +#define GPDMA_REQ_I2C3_RX (18) +#define GPDMA_REQ_I2C3_TX (19) +#define GPDMA_REQ_I2C3_EVC (20) +#define GPDMA_REQ_I2C4_RX (21) +#define GPDMA_REQ_I2C4_TX (22) +#define GPDMA_REQ_I2C4_EVC (23) +#define GPDMA_REQ_USART1_RX (24) +#define GPDMA_REQ_USART1_TX (25) +#define GPDMA_REQ_USART2_RX (26) +#define GPDMA_REQ_USART2_TX (27) +#define GPDMA_REQ_USART3_RX (28) +#define GPDMA_REQ_USART3_TX (29) +#define GPDMA_REQ_UART4_RX (30) +#define GPDMA_REQ_UART4_TX (31) +#define GPDMA_REQ_UART5_RX (32) +#define GPDMA_REQ_UART5_TX (33) +#define GPDMA_REQ_LPUART1_RX (34) +#define GPDMA_REQ_LPUART1_TX (35) +#define GPDMA_REQ_SAI1_A (36) +#define GPDMA_REQ_SAI1_B (37) +#define GPDMA_REQ_OCTOSPI1 (40) +#define GPDMA_REQ_TIM1_CH1 (42) +#define GPDMA_REQ_TIM1_CH2 (43) +#define GPDMA_REQ_TIM1_CH3 (44) +#define GPDMA_REQ_TIM1_CH4 (45) +#define GPDMA_REQ_TIM1_UP (46) +#define GPDMA_REQ_TIM1_TRIG (47) +#define GPDMA_REQ_TIM1_COM (48) +#define GPDMA_REQ_I3C1_RX (49) +#define GPDMA_REQ_I3C1_TX (50) +#define GPDMA_REQ_I3C1_TC (51) +#define GPDMA_REQ_I3C1_RS (52) +#define GPDMA_REQ_GFXPAND_IN (53) +#define GPDMA_REQ_GFXPAND_OUT (54) +#define GPDMA_REQ_TIM2_CH1 (56) +#define GPDMA_REQ_TIM2_CH2 (57) +#define GPDMA_REQ_TIM2_CH3 (58) +#define GPDMA_REQ_TIM2_CH4 (59) +#define GPDMA_REQ_TIM2_UP (60) +#define GPDMA_REQ_TIM3_CH1 (61) +#define GPDMA_REQ_TIM3_CH2 (62) +#define GPDMA_REQ_TIM3_CH3 (63) +#define GPDMA_REQ_TIM3_CH4 (64) +#define GPDMA_REQ_TIM3_UP (65) +#define GPDMA_REQ_TIM3_TRIG (66) +#define GPDMA_REQ_TIM4_CH1 (67) +#define GPDMA_REQ_TIM4_CH2 (68) +#define GPDMA_REQ_TIM4_CH3 (69) +#define GPDMA_REQ_TIM4_CH4 (70) +#define GPDMA_REQ_TIM4_UP (71) +#define GPDMA_REQ_I3C2_RX (72) +#define GPDMA_REQ_I3C2_TX (73) +#define GPDMA_REQ_I3C2_TC (74) +#define GPDMA_REQ_I3C2_RS (75) +#define GPDMA_REQ_SPI4_RX (76) +#define GPDMA_REQ_SPI4_TX (77) +#define GPDMA_REQ_TIM15_CH1 (78) +#define GPDMA_REQ_TIM15_UP (79) +#define GPDMA_REQ_TIM15_TRIG (80) +#define GPDMA_REQ_TIM15_COM (81) +#define GPDMA_REQ_TIM16_CH1 (82) +#define GPDMA_REQ_TIM16_UP (83) +#define GPDMA_REQ_TIM17_CH1 (84) +#define GPDMA_REQ_TIM17_UP (85) +#define GPDMA_REQ_AES_IN (87) +#define GPDMA_REQ_AES_OUT (88) +#define GPDMA_REQ_HASH_IN (89) +#define GPDMA_REQ_TIM8_CH1 (91) +#define GPDMA_REQ_TIM8_CH2 (92) +#define GPDMA_REQ_TIM8_CH3 (93) +#define GPDMA_REQ_TIM8_CH4 (94) +#define GPDMA_REQ_TIM8_UP (95) +#define GPDMA_REQ_TIM8_TRIG (96) +#define GPDMA_REQ_TIM8_COM (97) +#define GPDMA_REQ_ADF1_FLT0 (98) +#define GPDMA_REQ_SAES_IN (103) +#define GPDMA_REQ_SAES_OUT (104) +#define GPDMA_REQ_LPTIM1_IC1 (105) +#define GPDMA_REQ_LPTIM1_IC2 (106) +#define GPDMA_REQ_LPTIM1_UE (107) +#define GPDMA_REQ_LPTIM2_IC1 (108) +#define GPDMA_REQ_LPTIM2_IC2 (109) +#define GPDMA_REQ_LPTIM2_UE (110) +#define GPDMA_REQ_LPTIM3_IC1 (111) +#define GPDMA_REQ_LPTIM3_IC2 (112) +#define GPDMA_REQ_LPTIM3_UE (113) + +/* USART RX DMA request numbers */ + +#define STM32_LPUART1_RXDMA_REQ GPDMA_REQ_LPUART1_RX +#define STM32_USART1_RXDMA_REQ GPDMA_REQ_USART1_RX +#define STM32_USART2_RXDMA_REQ GPDMA_REQ_USART2_RX +#define STM32_USART3_RXDMA_REQ GPDMA_REQ_USART3_RX +#define STM32_UART4_RXDMA_REQ GPDMA_REQ_UART4_RX +#define STM32_UART5_RXDMA_REQ GPDMA_REQ_UART5_RX + +#endif /* __ARCH_ARM_SRC_STM32U3_HARDWARE_STM32_DMASIGMAP_H */ diff --git a/arch/arm/src/stm32u3/stm32u3xx_rcc.c b/arch/arm/src/stm32u3/stm32u3xx_rcc.c index 213d3eb5b60..628c97bab0b 100644 --- a/arch/arm/src/stm32u3/stm32u3xx_rcc.c +++ b/arch/arm/src/stm32u3/stm32u3xx_rcc.c @@ -197,6 +197,10 @@ void stm32_rcc_enableperipherals(void) { uint32_t regval; +#ifdef CONFIG_STM32_DMA1 + modifyreg32(STM32_RCC_AHB1ENR1, 0, RCC_AHB1ENR1_GPDMA1EN); +#endif + /* Enable all GPIO ports implemented by STM32U3C5. */ regval = RCC_AHB2ENR1_GPIOAEN | RCC_AHB2ENR1_GPIOBEN |
