diff options
author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2018-09-17 13:47:54 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-09-21 12:12:49 +1000 |
commit | 84f4d58479516c4e842d195cc6a0a72e67fcb7b4 (patch) | |
tree | 79eb2a4d2b50b08e4be47d1aba0f7cf48b718b5d | |
parent | a2703649ea4455fe11388e24fad68a66441daf68 (diff) | |
download | micropython-84f4d58479516c4e842d195cc6a0a72e67fcb7b4.tar.gz micropython-84f4d58479516c4e842d195cc6a0a72e67fcb7b4.zip |
stm32/dcmi: Add F4/F7/H7 hal files and dma definitions for DCMI periph.
-rw-r--r-- | ports/stm32/Makefile | 2 | ||||
-rw-r--r-- | ports/stm32/dma.c | 27 | ||||
-rw-r--r-- | ports/stm32/dma.h | 1 | ||||
-rw-r--r-- | ports/stm32/mpconfigboard_common.h | 5 |
4 files changed, 35 insertions, 0 deletions
diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 51438b0b19..b8bd9063ee 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -320,6 +320,8 @@ endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h7)) SRC_HAL += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ hal_sdram.c \ + hal_dma_ex.c \ + hal_dcmi.c \ ) endif diff --git a/ports/stm32/dma.c b/ports/stm32/dma.c index 6c88618069..9817bf6c15 100644 --- a/ports/stm32/dma.c +++ b/ports/stm32/dma.c @@ -140,6 +140,27 @@ static const DMA_InitTypeDef dma_init_struct_dac = { }; #endif +#if MICROPY_HW_ENABLE_DCMI +static const DMA_InitTypeDef dma_init_struct_dcmi = { + #if defined(STM32H7) + .Request = DMA_REQUEST_DCMI, + #else + .Channel = DMA_CHANNEL_1, + #endif + .Direction = DMA_PERIPH_TO_MEMORY, + .PeriphInc = DMA_PINC_DISABLE, + .MemInc = DMA_MINC_ENABLE, + .PeriphDataAlignment = DMA_PDATAALIGN_WORD, + .MemDataAlignment = DMA_MDATAALIGN_WORD, + .Mode = DMA_NORMAL, + .Priority = DMA_PRIORITY_HIGH, + .FIFOMode = DMA_FIFOMODE_ENABLE, + .FIFOThreshold = DMA_FIFO_THRESHOLD_FULL, + .MemBurst = DMA_MBURST_INC4, + .PeriphBurst = DMA_PBURST_SINGLE +}; +#endif + #if defined(STM32F0) #define NCONTROLLERS (2) @@ -226,6 +247,9 @@ const dma_descr_t dma_I2C_1_TX = { DMA1_Stream6, DMA_CHANNEL_1, dma_id_6, &dma #if defined(STM32F7) && defined(SDMMC2) && MICROPY_HW_HAS_SDCARD const dma_descr_t dma_SDMMC_2 = { DMA2_Stream0, DMA_CHANNEL_11, dma_id_8, &dma_init_struct_sdio }; #endif +#if MICROPY_HW_ENABLE_DCMI +const dma_descr_t dma_DCMI_0 = { DMA2_Stream1, DMA_CHANNEL_1, dma_id_9, &dma_init_struct_dcmi }; +#endif const dma_descr_t dma_SPI_1_RX = { DMA2_Stream2, DMA_CHANNEL_3, dma_id_10, &dma_init_struct_spi_i2c }; const dma_descr_t dma_SPI_5_RX = { DMA2_Stream3, DMA_CHANNEL_2, dma_id_11, &dma_init_struct_spi_i2c }; #if defined(MICROPY_HW_HAS_SDCARD) && MICROPY_HW_HAS_SDCARD @@ -380,6 +404,9 @@ const dma_descr_t dma_I2C_1_TX = { DMA1_Stream7, DMA_REQUEST_I2C1_TX, dma_id_7, const dma_descr_t dma_I2C_2_TX = { DMA1_Stream7, DMA_REQUEST_I2C2_TX, dma_id_7, &dma_init_struct_spi_i2c }; // DMA2 streams +#if MICROPY_HW_ENABLE_DCMI +const dma_descr_t dma_DCMI_0 = { DMA2_Stream1, DMA_REQUEST_DCMI, dma_id_9, &dma_init_struct_dcmi }; +#endif const dma_descr_t dma_SPI_1_RX = { DMA2_Stream2, DMA_REQUEST_SPI1_RX, dma_id_10, &dma_init_struct_spi_i2c }; const dma_descr_t dma_SPI_5_RX = { DMA2_Stream3, DMA_REQUEST_SPI5_RX, dma_id_11, &dma_init_struct_spi_i2c }; const dma_descr_t dma_SPI_4_RX = { DMA2_Stream3, DMA_REQUEST_SPI4_RX, dma_id_11, &dma_init_struct_spi_i2c }; diff --git a/ports/stm32/dma.h b/ports/stm32/dma.h index a24422104f..84875374b2 100644 --- a/ports/stm32/dma.h +++ b/ports/stm32/dma.h @@ -56,6 +56,7 @@ extern const dma_descr_t dma_SPI_1_TX; extern const dma_descr_t dma_SDMMC_2; extern const dma_descr_t dma_SPI_6_RX; extern const dma_descr_t dma_SDIO_0; +extern const dma_descr_t dma_DCMI_0; #elif defined(STM32L4) diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index 2cc02b77cf..af20aa73b9 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -67,6 +67,11 @@ #define MICROPY_HW_ENABLE_DAC (0) #endif +// Whether to enable the DCMI peripheral +#ifndef MICROPY_HW_ENABLE_DCMI +#define MICROPY_HW_ENABLE_DCMI (0) +#endif + // Whether to enable USB support #ifndef MICROPY_HW_ENABLE_USB #define MICROPY_HW_ENABLE_USB (0) |