2019-02-15 10:43:09 +08:00
|
|
|
/*
|
2023-01-09 10:20:16 +08:00
|
|
|
* Copyright (c) 2006-2023, RT-Thread Development Team
|
2019-02-15 10:43:09 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2018-01-05 zylx first version
|
|
|
|
* 2019-01-08 SummerGift clean up the code
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SPI_CONFIG_H__
|
|
|
|
#define __SPI_CONFIG_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BSP_USING_SPI1
|
|
|
|
#ifndef SPI1_BUS_CONFIG
|
|
|
|
#define SPI1_BUS_CONFIG \
|
|
|
|
{ \
|
|
|
|
.Instance = SPI1, \
|
|
|
|
.bus_name = "spi1", \
|
2021-04-23 09:52:17 +08:00
|
|
|
.irq_type = SPI1_IRQn, \
|
2019-02-15 10:43:09 +08:00
|
|
|
}
|
|
|
|
#endif /* SPI1_BUS_CONFIG */
|
|
|
|
#endif /* BSP_USING_SPI1 */
|
2021-03-08 22:40:39 +08:00
|
|
|
|
2019-02-15 10:43:09 +08:00
|
|
|
#ifdef BSP_SPI1_TX_USING_DMA
|
|
|
|
#ifndef SPI1_TX_DMA_CONFIG
|
|
|
|
#define SPI1_TX_DMA_CONFIG \
|
|
|
|
{ \
|
|
|
|
.dma_rcc = SPI1_TX_DMA_RCC, \
|
|
|
|
.Instance = SPI1_TX_DMA_INSTANCE, \
|
|
|
|
.request = SPI1_TX_DMA_REQUEST, \
|
|
|
|
.dma_irq = SPI1_TX_DMA_IRQ, \
|
|
|
|
}
|
|
|
|
#endif /* SPI1_TX_DMA_CONFIG */
|
|
|
|
#endif /* BSP_SPI1_TX_USING_DMA */
|
|
|
|
|
|
|
|
#ifdef BSP_SPI1_RX_USING_DMA
|
|
|
|
#ifndef SPI1_RX_DMA_CONFIG
|
|
|
|
#define SPI1_RX_DMA_CONFIG \
|
|
|
|
{ \
|
|
|
|
.dma_rcc = SPI1_RX_DMA_RCC, \
|
|
|
|
.Instance = SPI1_RX_DMA_INSTANCE, \
|
|
|
|
.request = SPI1_RX_DMA_REQUEST, \
|
|
|
|
.dma_irq = SPI1_RX_DMA_IRQ, \
|
|
|
|
}
|
|
|
|
#endif /* SPI1_RX_DMA_CONFIG */
|
|
|
|
#endif /* BSP_SPI1_RX_USING_DMA */
|
|
|
|
|
|
|
|
#ifdef BSP_USING_SPI2
|
|
|
|
#ifndef SPI2_BUS_CONFIG
|
|
|
|
#define SPI2_BUS_CONFIG \
|
|
|
|
{ \
|
|
|
|
.Instance = SPI2, \
|
|
|
|
.bus_name = "spi2", \
|
2021-04-23 09:52:17 +08:00
|
|
|
.irq_type = SPI2_IRQn, \
|
2019-02-15 10:43:09 +08:00
|
|
|
}
|
|
|
|
#endif /* SPI2_BUS_CONFIG */
|
|
|
|
#endif /* BSP_USING_SPI2 */
|
2021-03-08 22:40:39 +08:00
|
|
|
|
2019-02-15 10:43:09 +08:00
|
|
|
#ifdef BSP_SPI2_TX_USING_DMA
|
|
|
|
#ifndef SPI2_TX_DMA_CONFIG
|
|
|
|
#define SPI2_TX_DMA_CONFIG \
|
|
|
|
{ \
|
|
|
|
.dma_rcc = SPI2_TX_DMA_RCC, \
|
|
|
|
.Instance = SPI2_TX_DMA_INSTANCE, \
|
2019-02-15 16:44:51 +08:00
|
|
|
.request = SPI2_TX_DMA_REQUEST, \
|
2019-02-15 10:43:09 +08:00
|
|
|
.dma_irq = SPI2_TX_DMA_IRQ, \
|
|
|
|
}
|
|
|
|
#endif /* SPI2_TX_DMA_CONFIG */
|
|
|
|
#endif /* BSP_SPI2_TX_USING_DMA */
|
|
|
|
|
|
|
|
#ifdef BSP_SPI2_RX_USING_DMA
|
|
|
|
#ifndef SPI2_RX_DMA_CONFIG
|
|
|
|
#define SPI2_RX_DMA_CONFIG \
|
|
|
|
{ \
|
|
|
|
.dma_rcc = SPI2_RX_DMA_RCC, \
|
|
|
|
.Instance = SPI2_RX_DMA_INSTANCE, \
|
2019-02-15 16:44:51 +08:00
|
|
|
.request = SPI2_RX_DMA_REQUEST, \
|
2019-02-15 10:43:09 +08:00
|
|
|
.dma_irq = SPI2_RX_DMA_IRQ, \
|
|
|
|
}
|
|
|
|
#endif /* SPI2_RX_DMA_CONFIG */
|
|
|
|
#endif /* BSP_SPI2_RX_USING_DMA */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /*__SPI_CONFIG_H__ */
|
|
|
|
|
|
|
|
|
|
|
|
|