rt-thread-official/bsp/tm4c123bsp/libraries/Drivers/drv_spi.h

46 lines
780 B
C
Raw Normal View History

#ifndef __DRV_SPI_H_
#define __DRV_SPI_H_
#include <rtdevice.h>
#include <rthw.h>
#include "drivers/spi.h"
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, uint32_t portindex, uint32_t cs_gpiobase, uint32_t cs_gpio_pin);
struct tm4c123_hw_spi_cs
{
uint32_t portbase;
uint32_t GPIO_Pin;
};
struct tm4c123_spi_config
{
uint32_t base;
char * bus_name;
};
/* tm4c123 spi dirver class */
struct tm4c123_spi
{
struct tm4c123_spi_config *config;
struct rt_spi_configuration *cfg;
struct rt_spi_bus spi_bus;
};
struct tm4c123_spi_device
{
rt_uint32_t pin;
char *bus_name;
char *device_name;
};
#define SPI_USING_RX_DMA_FLAG (1<<0)
#define SPI_USING_TX_DMA_FLAG (1<<1)
#endif /*__DRV_SPI_H_ */