| 50 | static rt_err_t rt_msd_control(rt_device_t dev, int cmd, void *args); |
| 51 | |
| 52 | static rt_err_t MSD_take_owner(struct rt_spi_device *spi_device) |
| 53 | { |
| 54 | rt_err_t result; |
| 55 | |
| 56 | result = rt_mutex_take(&(spi_device->bus->lock), RT_WAITING_FOREVER); |
| 57 | if (result == RT_EOK) |
| 58 | { |
| 59 | if (spi_device->bus->owner != spi_device) |
| 60 | { |
| 61 | /* not the same owner as current, re-configure SPI bus */ |
| 62 | result = spi_device->bus->ops->configure(spi_device, &spi_device->config); |
| 63 | if (result == RT_EOK) |
| 64 | { |
| 65 | /* set SPI bus owner */ |
| 66 | spi_device->bus->owner = spi_device; |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return result; |
| 72 | } |
| 73 | |
| 74 | static rt_bool_t rt_tick_timeout(rt_tick_t tick_start, rt_tick_t tick_long) |
| 75 | { |
no test coverage detected