| 141 | #endif |
| 142 | |
| 143 | rt_err_t rt_spidev_device_init(struct rt_spi_device *dev, const char *name) |
| 144 | { |
| 145 | struct rt_device *device; |
| 146 | RT_ASSERT(dev != RT_NULL); |
| 147 | |
| 148 | device = &(dev->parent); |
| 149 | |
| 150 | /* set device type */ |
| 151 | device->type = RT_Device_Class_SPIDevice; |
| 152 | #ifdef RT_USING_DEVICE_OPS |
| 153 | device->ops = &spi_device_ops; |
| 154 | #else |
| 155 | device->init = RT_NULL; |
| 156 | device->open = RT_NULL; |
| 157 | device->close = RT_NULL; |
| 158 | device->read = _spidev_device_read; |
| 159 | device->write = _spidev_device_write; |
| 160 | device->control = _spidev_device_control; |
| 161 | #endif |
| 162 | |
| 163 | /* register to device manager */ |
| 164 | return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR); |
| 165 | } |
| 166 | |
| 167 | #ifdef RT_USING_DM |
| 168 | static rt_err_t spidev_probe(struct rt_spi_device *spi_dev) |
no test coverage detected