From b295f4426ccac9cbafe9bd382a34175dffd8992a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 20 Sep 2013 11:03:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6307 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/hal.h | 8 +++++ os/hal/ports/STM32/I2Cv2/i2c_lld.h | 8 ----- os/hal/ports/STM32/SPIv1/spi_lld.h | 73 ++++++++++++-------------------------- os/hal/ports/STM32/SPIv2/spi_lld.h | 12 ------- 4 files changed, 30 insertions(+), 71 deletions(-) (limited to 'os/hal') diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h index c02007d92..01ed0dd1d 100644 --- a/os/hal/include/hal.h +++ b/os/hal/include/hal.h @@ -70,6 +70,14 @@ /* Driver constants. */ /*===========================================================================*/ +/** + * @name Return codes + * @{ + */ +#define HAL_SUCCESS false +#define HAL_FAILED true +/** @} */ + /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ diff --git a/os/hal/ports/STM32/I2Cv2/i2c_lld.h b/os/hal/ports/STM32/I2Cv2/i2c_lld.h index ca654d582..070b2edad 100644 --- a/os/hal/ports/STM32/I2Cv2/i2c_lld.h +++ b/os/hal/ports/STM32/I2Cv2/i2c_lld.h @@ -132,14 +132,6 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -/* TODO: Move the following DMA settings in the STM32F37X registry.*/ -#if defined(STM32F37X) -#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) -#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#endif - /** @brief error checks */ #if STM32_I2C_USE_I2C1 && !STM32_HAS_I2C1 #error "I2C1 not present in the selected device" diff --git a/os/hal/ports/STM32/SPIv1/spi_lld.h b/os/hal/ports/STM32/SPIv1/spi_lld.h index b0a65d7cd..2ea288ea9 100644 --- a/os/hal/ports/STM32/SPIv1/spi_lld.h +++ b/os/hal/ports/STM32/SPIv1/spi_lld.h @@ -124,58 +124,8 @@ #define STM32_SPI_DMA_ERROR_HOOK(spip) chSysHalt() #endif -#if STM32_ADVANCED_DMA || defined(__DOXYGEN__) - -/** - * @brief DMA stream used for SPI1 RX operations. - * @note This option is only available on platforms with enhanced DMA. - */ -#if !defined(STM32_SPI_SPI1_RX_DMA_STREAM) || defined(__DOXYGEN__) -#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) -#endif - -/** - * @brief DMA stream used for SPI1 TX operations. - * @note This option is only available on platforms with enhanced DMA. - */ -#if !defined(STM32_SPI_SPI1_TX_DMA_STREAM) || defined(__DOXYGEN__) -#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) -#endif - -/** - * @brief DMA stream used for SPI2 RX operations. - * @note This option is only available on platforms with enhanced DMA. - */ -#if !defined(STM32_SPI_SPI2_RX_DMA_STREAM) || defined(__DOXYGEN__) -#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#endif - -/** - * @brief DMA stream used for SPI2 TX operations. - * @note This option is only available on platforms with enhanced DMA. - */ -#if !defined(STM32_SPI_SPI2_TX_DMA_STREAM) || defined(__DOXYGEN__) -#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#endif - -/** - * @brief DMA stream used for SPI3 RX operations. - * @note This option is only available on platforms with enhanced DMA. - */ -#if !defined(STM32_SPI_SPI3_RX_DMA_STREAM) || defined(__DOXYGEN__) -#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#endif - -/** - * @brief DMA stream used for SPI3 TX operations. - * @note This option is only available on platforms with enhanced DMA. - */ -#if !defined(STM32_SPI_SPI3_TX_DMA_STREAM) || defined(__DOXYGEN__) -#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#endif - -#else /* !STM32_ADVANCED_DMA */ +#if 0 /* Fixed streams for platforms using the old DMA peripheral, the values are valid for both STM32F1xx and STM32L1xx.*/ #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) @@ -238,6 +188,26 @@ #error "Invalid DMA priority assigned to SPI3" #endif +/* The following checks are only required when there is a DMA able to + reassign streams to different channels.*/ +#if STM32_ADVANCED_DMA +/* Check on the presence of the DMA streams settings in mcuconf.h.*/ +#if STM32_SPI_USE_SPI1 && (!defined(STM32_SPI_SPI1_RX_DMA_STREAM) || \ + !defined(STM32_SPI_SPI1_TX_DMA_STREAM)) +#error "SPI1 DMA streams not defined" +#endif + +#if STM32_SPI_USE_SPI2 && (!defined(STM32_SPI_SPI2_RX_DMA_STREAM) || \ + !defined(STM32_SPI_SPI2_TX_DMA_STREAM)) +#error "SPI2 DMA streams not defined" +#endif + +#if STM32_SPI_USE_SPI3 && (!defined(STM32_SPI_SPI3_RX_DMA_STREAM) || \ + !defined(STM32_SPI_SPI3_TX_DMA_STREAM)) +#error "SPI3 DMA streams not defined" +#endif + +/* Check on the validity of the assigned DMA channels.*/ #if STM32_SPI_USE_SPI1 && \ !STM32_DMA_IS_VALID_ID(STM32_SPI_SPI1_RX_DMA_STREAM, STM32_SPI1_RX_DMA_MSK) #error "invalid DMA stream associated to SPI1 RX" @@ -267,6 +237,7 @@ !STM32_DMA_IS_VALID_ID(STM32_SPI_SPI3_TX_DMA_STREAM, STM32_SPI3_TX_DMA_MSK) #error "invalid DMA stream associated to SPI3 TX" #endif +#endif /* STM32_ADVANCED_DMA */ #if !defined(STM32_DMA_REQUIRED) #define STM32_DMA_REQUIRED diff --git a/os/hal/ports/STM32/SPIv2/spi_lld.h b/os/hal/ports/STM32/SPIv2/spi_lld.h index 07123df12..72ed48c94 100644 --- a/os/hal/ports/STM32/SPIv2/spi_lld.h +++ b/os/hal/ports/STM32/SPIv2/spi_lld.h @@ -124,18 +124,6 @@ #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") #endif -/* TODO: Move the following DMA settings in the STM32F37X registry.*/ -#if defined(STM32F37X) -/* 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(STM32F30X) */ -/** @} */ - /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ -- cgit v1.2.3