2525#include <drivers/spi.h>
2626
2727/* SPI bus device interface, compatible with RT-Thread 0.3.x/1.0.x */
28- static rt_err_t _spi_bus_device_init (rt_device_t dev )
29- {
30- struct rt_spi_bus * bus ;
31-
32- bus = (struct rt_spi_bus * )dev ;
33- RT_ASSERT (bus != RT_NULL );
34-
35- return RT_EOK ;
36- }
37-
3828static rt_size_t _spi_bus_device_read (rt_device_t dev ,
3929 rt_off_t pos ,
4030 void * buffer ,
@@ -67,11 +57,7 @@ static rt_err_t _spi_bus_device_control(rt_device_t dev,
6757 rt_uint8_t cmd ,
6858 void * args )
6959{
70- struct rt_spi_bus * bus ;
71-
72- bus = (struct rt_spi_bus * )dev ;
73- RT_ASSERT (bus != RT_NULL );
74-
60+ /* TODO: add control command handle */
7561 switch (cmd )
7662 {
7763 case 0 : /* set device */
@@ -93,7 +79,7 @@ rt_err_t rt_spi_bus_device_init(struct rt_spi_bus *bus, const char *name)
9379 /* set device type */
9480 device -> type = RT_Device_Class_SPIBUS ;
9581 /* initialize device interface */
96- device -> init = _spi_bus_device_init ;
82+ device -> init = RT_NULL ;
9783 device -> open = RT_NULL ;
9884 device -> close = RT_NULL ;
9985 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)
10591}
10692
10793/* SPI Dev device interface, compatible with RT-Thread 0.3.x/1.0.x */
108- static rt_err_t _spidev_device_init (rt_device_t dev )
109- {
110- struct rt_spi_device * device ;
111-
112- device = (struct rt_spi_device * )dev ;
113- RT_ASSERT (device != RT_NULL );
114-
115- return RT_EOK ;
116- }
117-
11894static rt_size_t _spidev_device_read (rt_device_t dev ,
11995 rt_off_t pos ,
12096 void * buffer ,
@@ -147,11 +123,6 @@ static rt_err_t _spidev_device_control(rt_device_t dev,
147123 rt_uint8_t cmd ,
148124 void * args )
149125{
150- struct rt_spi_device * device ;
151-
152- device = (struct rt_spi_device * )dev ;
153- RT_ASSERT (device != RT_NULL );
154-
155126 switch (cmd )
156127 {
157128 case 0 : /* set device */
@@ -172,7 +143,7 @@ rt_err_t rt_spidev_device_init(struct rt_spi_device *dev, const char *name)
172143
173144 /* set device type */
174145 device -> type = RT_Device_Class_SPIDevice ;
175- device -> init = _spidev_device_init ;
146+ device -> init = RT_NULL ;
176147 device -> open = RT_NULL ;
177148 device -> close = RT_NULL ;
178149 device -> read = _spidev_device_read ;
0 commit comments