summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-04-27 20:52:33 +0800
committerGitHub <[email protected]>2021-04-27 20:52:33 +0800
commitff4dfda5ff85ef7071e5c9da562e902d1f0c1d59 (patch)
tree65c11a7d708bd7107b05a3207d94db7513eff7b4
parentb33c6854865a99979bf3d6665f451dff9bc48930 (diff)
parent7c074c07171a342ff953b531af4d52b88fd9358e (diff)
Merge pull request #4633 from whj4674672/spi
[add] spi config increases irq_type
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h2
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h3
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h3
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h5
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h5
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h2
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h5
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h5
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/l1/spi_config.h3
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h3
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/mp1/spi_config.h5
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/wb/spi_config.h3
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/config/wl/spi_config.h3
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/drv_spi.c6
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/drv_spi.h1
-rw-r--r--bsp/stm32/stm32f072-st-nucleo/board/Kconfig42
16 files changed, 56 insertions, 40 deletions
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h
index 79523e704d..39cda3c5dd 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h
@@ -24,6 +24,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -56,6 +57,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h
index bf28c2fc72..fb44c6145c 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h
@@ -24,6 +24,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -56,6 +57,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -88,6 +90,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h
index b3e9507b19..cfe1e252eb 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h
@@ -24,6 +24,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -58,6 +59,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -92,6 +94,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h
index d03b31ce8a..da3e05d8bd 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h
@@ -24,6 +24,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -58,6 +59,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -92,6 +94,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
@@ -126,6 +129,7 @@ extern "C" {
{ \
.Instance = SPI4, \
.bus_name = "spi4", \
+ .irq_type = SPI4_IRQn, \
}
#endif /* SPI4_BUS_CONFIG */
#endif /* BSP_USING_SPI4 */
@@ -160,6 +164,7 @@ extern "C" {
{ \
.Instance = SPI5, \
.bus_name = "spi5", \
+ .irq_type = SPI5_IRQn, \
}
#endif /* SPI5_BUS_CONFIG */
#endif /* BSP_USING_SPI5 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h
index 26f230d9b1..aab36015b9 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h
@@ -23,6 +23,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -57,6 +58,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -91,6 +93,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
@@ -125,6 +128,7 @@ extern "C" {
{ \
.Instance = SPI4, \
.bus_name = "spi4", \
+ .irq_type = SPI4_IRQn, \
}
#endif /* SPI4_BUS_CONFIG */
#endif /* BSP_USING_SPI4 */
@@ -159,6 +163,7 @@ extern "C" {
{ \
.Instance = SPI5, \
.bus_name = "spi5", \
+ .irq_type = SPI5_IRQn, \
}
#endif /* SPI5_BUS_CONFIG */
#endif /* BSP_USING_SPI5 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h
index a33777977a..a8f60fddbf 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h
@@ -24,6 +24,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -58,6 +59,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h
index d03b31ce8a..da3e05d8bd 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h
@@ -24,6 +24,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -58,6 +59,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -92,6 +94,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
@@ -126,6 +129,7 @@ extern "C" {
{ \
.Instance = SPI4, \
.bus_name = "spi4", \
+ .irq_type = SPI4_IRQn, \
}
#endif /* SPI4_BUS_CONFIG */
#endif /* BSP_USING_SPI4 */
@@ -160,6 +164,7 @@ extern "C" {
{ \
.Instance = SPI5, \
.bus_name = "spi5", \
+ .irq_type = SPI5_IRQn, \
}
#endif /* SPI5_BUS_CONFIG */
#endif /* BSP_USING_SPI5 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h
index 26f230d9b1..aab36015b9 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h
@@ -23,6 +23,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -57,6 +58,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -91,6 +93,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
@@ -125,6 +128,7 @@ extern "C" {
{ \
.Instance = SPI4, \
.bus_name = "spi4", \
+ .irq_type = SPI4_IRQn, \
}
#endif /* SPI4_BUS_CONFIG */
#endif /* BSP_USING_SPI4 */
@@ -159,6 +163,7 @@ extern "C" {
{ \
.Instance = SPI5, \
.bus_name = "spi5", \
+ .irq_type = SPI5_IRQn, \
}
#endif /* SPI5_BUS_CONFIG */
#endif /* BSP_USING_SPI5 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l1/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l1/spi_config.h
index bf28c2fc72..fb44c6145c 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/l1/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/l1/spi_config.h
@@ -24,6 +24,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -56,6 +57,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -88,6 +90,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h
index d510ca379d..16fab826d0 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h
@@ -23,6 +23,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -57,6 +58,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -91,6 +93,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/mp1/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/mp1/spi_config.h
index 3236751624..d1c6c44cc3 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/mp1/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/mp1/spi_config.h
@@ -23,6 +23,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -57,6 +58,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -91,6 +93,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
@@ -125,6 +128,7 @@ extern "C" {
{ \
.Instance = SPI4, \
.bus_name = "spi4", \
+ .irq_type = SPI4_IRQn, \
}
#endif /* SPI4_BUS_CONFIG */
#endif /* BSP_USING_SPI4 */
@@ -159,6 +163,7 @@ extern "C" {
{ \
.Instance = SPI5, \
.bus_name = "spi5", \
+ .irq_type = SPI5_IRQn, \
}
#endif /* SPI5_BUS_CONFIG */
#endif /* BSP_USING_SPI5 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/wb/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/wb/spi_config.h
index 0f37cfe2af..1704fcdfe1 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/wb/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/wb/spi_config.h
@@ -23,6 +23,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -57,6 +58,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -91,6 +93,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/wl/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/wl/spi_config.h
index d510ca379d..64c8e23f07 100644
--- a/bsp/stm32/libraries/HAL_Drivers/config/wl/spi_config.h
+++ b/bsp/stm32/libraries/HAL_Drivers/config/wl/spi_config.h
@@ -23,6 +23,7 @@ extern "C" {
{ \
.Instance = SPI1, \
.bus_name = "spi1", \
+ .irq_type = SPI1_IRQn, \
}
#endif /* SPI1_BUS_CONFIG */
#endif /* BSP_USING_SPI1 */
@@ -57,6 +58,7 @@ extern "C" {
{ \
.Instance = SPI2, \
.bus_name = "spi2", \
+ .irq_type = SPI2_IRQn, \
}
#endif /* SPI2_BUS_CONFIG */
#endif /* BSP_USING_SPI2 */
@@ -91,6 +93,7 @@ extern "C" {
{ \
.Instance = SPI3, \
.bus_name = "spi3", \
+ .irq_type = SPI3_IRQn, \
}
#endif /* SPI3_BUS_CONFIG */
#endif /* BSP_USING_SPI3 */
diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_spi.c b/bsp/stm32/libraries/HAL_Drivers/drv_spi.c
index a521e4bb83..44d2d0e418 100644
--- a/bsp/stm32/libraries/HAL_Drivers/drv_spi.c
+++ b/bsp/stm32/libraries/HAL_Drivers/drv_spi.c
@@ -263,6 +263,12 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur
HAL_NVIC_SetPriority(spi_drv->config->dma_tx->dma_irq, 0, 1);
HAL_NVIC_EnableIRQ(spi_drv->config->dma_tx->dma_irq);
}
+
+ if(spi_drv->spi_dma_flag & SPI_USING_TX_DMA_FLAG || spi_drv->spi_dma_flag & SPI_USING_RX_DMA_FLAG)
+ {
+ HAL_NVIC_SetPriority(spi_drv->config->irq_type, 2, 0);
+ HAL_NVIC_EnableIRQ(spi_drv->config->irq_type);
+ }
LOG_D("%s init done", spi_drv->config->bus_name);
return RT_EOK;
diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_spi.h b/bsp/stm32/libraries/HAL_Drivers/drv_spi.h
index f30d97f777..65f752fc8a 100644
--- a/bsp/stm32/libraries/HAL_Drivers/drv_spi.h
+++ b/bsp/stm32/libraries/HAL_Drivers/drv_spi.h
@@ -37,6 +37,7 @@ struct stm32_spi_config
{
SPI_TypeDef *Instance;
char *bus_name;
+ IRQn_Type irq_type;
struct dma_config *dma_rx, *dma_tx;
};
diff --git a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig
index d86ed868ed..d6b07e5bd3 100644
--- a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig
+++ b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig
@@ -31,8 +31,8 @@ menu "On-chip Peripheral Drivers"
bool "Enable UART1 RX DMA"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
-
- config BSP_USING_UART2
+
+ config BSP_USING_UART2
bool "Enable UART2"
default y
@@ -41,44 +41,6 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n
endif
-
- menuconfig BSP_USING_SPI
- bool "Enable SPI BUS"
- default n
- select RT_USING_SPI
- if BSP_USING_SPI
- config BSP_USING_SPI1
- bool "Enable SPI1 BUS"
- default n
-
- config BSP_SPI1_TX_USING_DMA
- bool "Enable SPI1 TX DMA"
- depends on BSP_USING_SPI1
- default n
-
- config BSP_SPI1_RX_USING_DMA
- bool "Enable SPI1 RX DMA"
- depends on BSP_USING_SPI1
- select BSP_SPI1_TX_USING_DMA
- default n
- endif
-
- menuconfig BSP_USING_I2C1
- bool "Enable I2C1 BUS (software simulation)"
- default n
- select RT_USING_I2C
- select RT_USING_I2C_BITOPS
- select RT_USING_PIN
- if BSP_USING_I2C1
- config BSP_I2C1_SCL_PIN
- int "i2c1 scl pin number"
- range 1 216
- default 15
- config BSP_I2C1_SDA_PIN
- int "I2C1 sda pin number"
- range 1 216
- default 16
- endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu