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

Function MSD_take_owner

components/drivers/spi/dev_spi_msd.c:52–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50static rt_err_t rt_msd_control(rt_device_t dev, int cmd, void *args);
51
52static 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
74static rt_bool_t rt_tick_timeout(rt_tick_t tick_start, rt_tick_t tick_long)
75{

Callers 5

rt_msd_initFunction · 0.85
rt_msd_readFunction · 0.85
rt_msd_sdhc_readFunction · 0.85
rt_msd_writeFunction · 0.85
rt_msd_sdhc_writeFunction · 0.85

Calls 1

rt_mutex_takeFunction · 0.85

Tested by

no test coverage detected