|
@@ -25,16 +25,6 @@
|
|
|
#include <drivers/spi.h>
|
|
|
|
|
|
/* SPI bus device interface, compatible with RT-Thread 0.3.x/1.0.x */
|
|
|
-static rt_err_t _spi_bus_device_init(rt_device_t dev)
|
|
|
-{
|
|
|
- struct rt_spi_bus *bus;
|
|
|
-
|
|
|
- bus = (struct rt_spi_bus *)dev;
|
|
|
- RT_ASSERT(bus != RT_NULL);
|
|
|
-
|
|
|
- return RT_EOK;
|
|
|
-}
|
|
|
-
|
|
|
static rt_size_t _spi_bus_device_read(rt_device_t dev,
|
|
|
rt_off_t pos,
|
|
|
void *buffer,
|
|
@@ -67,11 +57,7 @@ static rt_err_t _spi_bus_device_control(rt_device_t dev,
|
|
|
rt_uint8_t cmd,
|
|
|
void *args)
|
|
|
{
|
|
|
- struct rt_spi_bus *bus;
|
|
|
-
|
|
|
- bus = (struct rt_spi_bus *)dev;
|
|
|
- RT_ASSERT(bus != RT_NULL);
|
|
|
-
|
|
|
+ /* TODO: add control command handle */
|
|
|
switch (cmd)
|
|
|
{
|
|
|
case 0: /* set device */
|
|
@@ -93,7 +79,7 @@ rt_err_t rt_spi_bus_device_init(struct rt_spi_bus *bus, const char *name)
|
|
|
/* set device type */
|
|
|
device->type = RT_Device_Class_SPIBUS;
|
|
|
/* initialize device interface */
|
|
|
- device->init = _spi_bus_device_init;
|
|
|
+ device->init = RT_NULL;
|
|
|
device->open = RT_NULL;
|
|
|
device->close = RT_NULL;
|
|
|
device->read = _spi_bus_device_read;
|
|
@@ -105,16 +91,6 @@ rt_err_t rt_spi_bus_device_init(struct rt_spi_bus *bus, const char *name)
|
|
|
}
|
|
|
|
|
|
/* SPI Dev device interface, compatible with RT-Thread 0.3.x/1.0.x */
|
|
|
-static rt_err_t _spidev_device_init(rt_device_t dev)
|
|
|
-{
|
|
|
- struct rt_spi_device *device;
|
|
|
-
|
|
|
- device = (struct rt_spi_device *)dev;
|
|
|
- RT_ASSERT(device != RT_NULL);
|
|
|
-
|
|
|
- return RT_EOK;
|
|
|
-}
|
|
|
-
|
|
|
static rt_size_t _spidev_device_read(rt_device_t dev,
|
|
|
rt_off_t pos,
|
|
|
void *buffer,
|
|
@@ -147,11 +123,6 @@ static rt_err_t _spidev_device_control(rt_device_t dev,
|
|
|
rt_uint8_t cmd,
|
|
|
void *args)
|
|
|
{
|
|
|
- struct rt_spi_device *device;
|
|
|
-
|
|
|
- device = (struct rt_spi_device *)dev;
|
|
|
- RT_ASSERT(device != RT_NULL);
|
|
|
-
|
|
|
switch (cmd)
|
|
|
{
|
|
|
case 0: /* set device */
|
|
@@ -172,7 +143,7 @@ rt_err_t rt_spidev_device_init(struct rt_spi_device *dev, const char *name)
|
|
|
|
|
|
/* set device type */
|
|
|
device->type = RT_Device_Class_SPIDevice;
|
|
|
- device->init = _spidev_device_init;
|
|
|
+ device->init = RT_NULL;
|
|
|
device->open = RT_NULL;
|
|
|
device->close = RT_NULL;
|
|
|
device->read = _spidev_device_read;
|