git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3486 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
1ae84c9323
commit
3d09e9e86c
|
@ -178,7 +178,18 @@
|
||||||
#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
|
#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* STM32_ADVANCED_DMA*/
|
#else /* !STM32_ADVANCED_DMA */
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
#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, 5)
|
||||||
|
#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6)
|
||||||
|
|
||||||
|
#endif /* !STM32_ADVANCED_DMA*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -201,10 +212,6 @@
|
||||||
#error "SPI driver activated but no SPI peripheral assigned"
|
#error "SPI driver activated but no SPI peripheral assigned"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if STM32_ADVANCED_DMA
|
|
||||||
|
|
||||||
/* Checks to be performed only on platforms using the advanced DMA
|
|
||||||
peripheral.*/
|
|
||||||
#if STM32_SPI_USE_SPI1 && \
|
#if STM32_SPI_USE_SPI1 && \
|
||||||
!STM32_DMA_IS_VALID_ID(STM32_SPI_SPI1_RX_DMA_STREAM, STM32_SPI1_RX_DMA_MSK)
|
!STM32_DMA_IS_VALID_ID(STM32_SPI_SPI1_RX_DMA_STREAM, STM32_SPI1_RX_DMA_MSK)
|
||||||
#error "invalid DMA stream associated to SPI1 RX"
|
#error "invalid DMA stream associated to SPI1 RX"
|
||||||
|
@ -235,19 +242,6 @@
|
||||||
#error "invalid DMA stream associated to SPI3 TX"
|
#error "invalid DMA stream associated to SPI3 TX"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* !STM32_ADVANCED_DMA */
|
|
||||||
|
|
||||||
/* 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)
|
|
||||||
#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, 5)
|
|
||||||
#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6)
|
|
||||||
|
|
||||||
#endif /* !STM32_ADVANCED_DMA */
|
|
||||||
|
|
||||||
#if !defined(STM32_DMA_REQUIRED)
|
#if !defined(STM32_DMA_REQUIRED)
|
||||||
#define STM32_DMA_REQUIRED
|
#define STM32_DMA_REQUIRED
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -168,22 +168,30 @@
|
||||||
* @name STM32L1xx capabilities
|
* @name STM32L1xx capabilities
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
/* ADC attributes.*/
|
||||||
#define STM32_HAS_ADC1 TRUE
|
#define STM32_HAS_ADC1 TRUE
|
||||||
#define STM32_HAS_ADC2 FALSE
|
#define STM32_HAS_ADC2 FALSE
|
||||||
#define STM32_HAS_ADC3 FALSE
|
#define STM32_HAS_ADC3 FALSE
|
||||||
|
|
||||||
|
/* CAN attributes.*/
|
||||||
#define STM32_HAS_CAN1 FALSE
|
#define STM32_HAS_CAN1 FALSE
|
||||||
#define STM32_HAS_CAN2 FALSE
|
#define STM32_HAS_CAN2 FALSE
|
||||||
|
|
||||||
|
/* DAC attributes.*/
|
||||||
#define STM32_HAS_DAC TRUE
|
#define STM32_HAS_DAC TRUE
|
||||||
|
|
||||||
|
/* DMA attributes.*/
|
||||||
|
#define STM32_ADVANCED_DMA FALSE
|
||||||
#define STM32_HAS_DMA1 TRUE
|
#define STM32_HAS_DMA1 TRUE
|
||||||
#define STM32_HAS_DMA2 FALSE
|
#define STM32_HAS_DMA2 FALSE
|
||||||
|
|
||||||
|
/* ETH attributes.*/
|
||||||
#define STM32_HAS_ETH FALSE
|
#define STM32_HAS_ETH FALSE
|
||||||
|
|
||||||
|
/* EXTI attributes.*/
|
||||||
#define STM32_EXTI_NUM_CHANNELS 23
|
#define STM32_EXTI_NUM_CHANNELS 23
|
||||||
|
|
||||||
|
/* GPIO attributes.*/
|
||||||
#define STM32_HAS_GPIOA TRUE
|
#define STM32_HAS_GPIOA TRUE
|
||||||
#define STM32_HAS_GPIOB TRUE
|
#define STM32_HAS_GPIOB TRUE
|
||||||
#define STM32_HAS_GPIOC TRUE
|
#define STM32_HAS_GPIOC TRUE
|
||||||
|
@ -194,18 +202,37 @@
|
||||||
#define STM32_HAS_GPIOH TRUE
|
#define STM32_HAS_GPIOH TRUE
|
||||||
#define STM32_HAS_GPIOI FALSE
|
#define STM32_HAS_GPIOI FALSE
|
||||||
|
|
||||||
|
/* I2C attributes.*/
|
||||||
#define STM32_HAS_I2C1 TRUE
|
#define STM32_HAS_I2C1 TRUE
|
||||||
#define STM32_HAS_I2C2 TRUE
|
#define STM32_HAS_I2C2 TRUE
|
||||||
#define STM32_HAS_I2C3 FALSE
|
#define STM32_HAS_I2C3 FALSE
|
||||||
|
|
||||||
|
/* RTC attributes.*/
|
||||||
#define STM32_HAS_RTC TRUE
|
#define STM32_HAS_RTC TRUE
|
||||||
|
|
||||||
|
/* SDIO attributes.*/
|
||||||
#define STM32_HAS_SDIO FALSE
|
#define STM32_HAS_SDIO FALSE
|
||||||
|
|
||||||
|
/* SPI attributes.*/
|
||||||
#define STM32_HAS_SPI1 TRUE
|
#define STM32_HAS_SPI1 TRUE
|
||||||
#define STM32_HAS_SPI2 TRUE
|
#define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
|
||||||
#define STM32_HAS_SPI3 FALSE
|
#define STM32_SPI1_RX_DMA_CHN 0x00000000
|
||||||
|
#define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
|
||||||
|
#define STM32_SPI1_TX_DMA_CHN 0x00000000
|
||||||
|
|
||||||
|
#define STM32_HAS_SPI2 TRUE
|
||||||
|
#define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
|
||||||
|
#define STM32_SPI2_RX_DMA_CHN 0x00000000
|
||||||
|
#define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
|
||||||
|
#define STM32_SPI2_TX_DMA_CHN 0x00000000
|
||||||
|
|
||||||
|
#define STM32_HAS_SPI3 FALSE
|
||||||
|
#define STM32_SPI3_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 5)
|
||||||
|
#define STM32_SPI3_RX_DMA_CHN 0x00000000
|
||||||
|
#define STM32_SPI3_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 6)
|
||||||
|
#define STM32_SPI3_TX_DMA_CHN 0x00000000
|
||||||
|
|
||||||
|
/* TIM attributes.*/
|
||||||
#define STM32_HAS_TIM1 FALSE
|
#define STM32_HAS_TIM1 FALSE
|
||||||
#define STM32_HAS_TIM2 TRUE
|
#define STM32_HAS_TIM2 TRUE
|
||||||
#define STM32_HAS_TIM3 TRUE
|
#define STM32_HAS_TIM3 TRUE
|
||||||
|
@ -224,6 +251,7 @@
|
||||||
#define STM32_HAS_TIM16 FALSE
|
#define STM32_HAS_TIM16 FALSE
|
||||||
#define STM32_HAS_TIM17 FALSE
|
#define STM32_HAS_TIM17 FALSE
|
||||||
|
|
||||||
|
/* USART attributes.*/
|
||||||
#define STM32_HAS_USART1 TRUE
|
#define STM32_HAS_USART1 TRUE
|
||||||
#define STM32_HAS_USART2 TRUE
|
#define STM32_HAS_USART2 TRUE
|
||||||
#define STM32_HAS_USART3 TRUE
|
#define STM32_HAS_USART3 TRUE
|
||||||
|
@ -231,6 +259,7 @@
|
||||||
#define STM32_HAS_UART5 FALSE
|
#define STM32_HAS_UART5 FALSE
|
||||||
#define STM32_HAS_USART6 FALSE
|
#define STM32_HAS_USART6 FALSE
|
||||||
|
|
||||||
|
/* USB attributes.*/
|
||||||
#define STM32_HAS_USB TRUE
|
#define STM32_HAS_USB TRUE
|
||||||
#define STM32_HAS_OTG1 FALSE
|
#define STM32_HAS_OTG1 FALSE
|
||||||
#define STM32_HAS_OTG2 FALSE
|
#define STM32_HAS_OTG2 FALSE
|
||||||
|
|
|
@ -71,6 +71,28 @@
|
||||||
*/
|
*/
|
||||||
#define STM32_DMA_STREAM_ID(dma, stream) ((stream) - 1)
|
#define STM32_DMA_STREAM_ID(dma, stream) ((stream) - 1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a DMA stream identifier mask.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param[in] dma the DMA unit number
|
||||||
|
* @param[in] stream the stream number
|
||||||
|
* @return A DMA stream identifier mask.
|
||||||
|
*/
|
||||||
|
#define STM32_DMA_STREAM_ID_MSK(dma, stream) \
|
||||||
|
(1 << STM32_DMA_STREAM_ID(dma, stream))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if a DMA stream unique identifier belongs to a mask.
|
||||||
|
* @param[in] id the stream numeric identifier
|
||||||
|
* @param[in] mask the stream numeric identifiers mask
|
||||||
|
*
|
||||||
|
* @retval The check result.
|
||||||
|
* @retval FALSE id does not belong to the mask.
|
||||||
|
* @retval TRUE id belongs to the mask.
|
||||||
|
*/
|
||||||
|
#define STM32_DMA_IS_VALID_ID(id, mask) (((1 << (id)) & (mask)))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a pointer to a stm32_dma_stream_t structure.
|
* @brief Returns a pointer to a stm32_dma_stream_t structure.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue