From ce80dcb337586d700d37580a5768400abcc797be Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Dec 2012 10:05:35 +0000 Subject: Added UART driver support to the STM32F3xx HAL. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4920 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/SPIv2/spi_lld.h | 8 ++++---- os/hal/platforms/STM32/USARTv2/uart_lld.h | 24 ++++++++++++++++++++++++ os/hal/platforms/STM32F3xx/platform.mk | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) (limited to 'os/hal/platforms') diff --git a/os/hal/platforms/STM32/SPIv2/spi_lld.h b/os/hal/platforms/STM32/SPIv2/spi_lld.h index d97775dc0..d8cc49357 100644 --- a/os/hal/platforms/STM32/SPIv2/spi_lld.h +++ b/os/hal/platforms/STM32/SPIv2/spi_lld.h @@ -186,17 +186,17 @@ #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) +#endif /* defined(STM32F0XX) */ -#else /* !defined(STM32F0XX) */ -/* Fixed streams for platforms using the old DMA peripheral, the values are - valid for STM32F3xx.*/ +#if defined(STM32F30X) +/* Fixed values for STM32F3xx devices.*/ #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) -#endif /* !defined(STM32F0XX) */ +#endif /* defined(STM32F30X) */ #endif /* !STM32_ADVANCED_DMA*/ /** @} */ diff --git a/os/hal/platforms/STM32/USARTv2/uart_lld.h b/os/hal/platforms/STM32/USARTv2/uart_lld.h index d832b9d02..a4e9c3428 100644 --- a/os/hal/platforms/STM32/USARTv2/uart_lld.h +++ b/os/hal/platforms/STM32/USARTv2/uart_lld.h @@ -130,6 +130,8 @@ #define STM32_UART_DMA_ERROR_HOOK(uartp) chSysHalt() #endif +#if STM32_ADVANCED_DMA || defined(__DOXYGEN__) + /** * @brief DMA stream used for USART1 RX operations. * @note This option is only available on platforms with enhanced DMA. @@ -177,6 +179,28 @@ #if !defined(STM32_UART_USART3_TX_DMA_STREAM) || defined(__DOXYGEN__) #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #endif + +#else /* !STM32_ADVANCED_DMA*/ + +#if defined(STM32F0XX) +/* Fixed values for STM32F0xx devices.*/ +#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) +#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) +#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) +#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) +#endif /* defined(STM32F0XX) */ + +#if defined(STM32F30X) +/* Fixed values for STM32F3xx devices.*/ +#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) +#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) +#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) +#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) +#define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) +#define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) +#endif /* defined(STM32F30X) */ + +#endif /* !STM32_ADVANCED_DMA*/ /** @} */ /*===========================================================================*/ diff --git a/os/hal/platforms/STM32F3xx/platform.mk b/os/hal/platforms/STM32F3xx/platform.mk index 6b02db68a..ae51f0140 100644 --- a/os/hal/platforms/STM32F3xx/platform.mk +++ b/os/hal/platforms/STM32F3xx/platform.mk @@ -8,6 +8,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32F3xx/stm32_dma.c \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv2/spi_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/serial_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/uart_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1/usb_lld.c # Required include directories -- cgit v1.2.3