MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_spidev_device_init

Function rt_spidev_device_init

components/drivers/spi/dev_spi.c:143–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141#endif
142
143rt_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
168static rt_err_t spidev_probe(struct rt_spi_device *spi_dev)

Callers 2

spi_probeFunction · 0.85

Calls 1

rt_device_registerFunction · 0.85

Tested by

no test coverage detected