1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2022-05-16 shelton first version 9 */ 10 11 #ifndef __DRV_SPI__ 12 #define __DRV_SPI__ 13 14 #include <rtthread.h> 15 #include "drivers/dev_spi.h" 16 #include "drv_common.h" 17 #include "drv_dma.h" 18 19 struct at32_spi_config 20 { 21 spi_type *spi_x; 22 const char *spi_name; 23 IRQn_Type irqn; 24 struct dma_config *dma_rx; 25 struct dma_config *dma_tx; 26 rt_uint16_t spi_dma_flag; 27 }; 28 29 struct at32_spi 30 { 31 struct at32_spi_config *config; 32 struct rt_spi_bus spi_bus; 33 }; 34 35 struct at32_spi_cs 36 { 37 gpio_type *gpio_x; 38 uint32_t gpio_pin; 39 }; 40 41 /* public function */ 42 rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, gpio_type *cs_gpiox, uint16_t cs_gpio_pin); 43 44 #endif // __DRV_SPI__ 45