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

Function scsi_device_setup

components/drivers/scsi/scsi.c:53–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51};
52
53static rt_err_t scsi_device_setup(struct rt_scsi_device *sdev)
54{
55 rt_err_t err;
56 rt_tick_t timeout;
57
58 if (sdev->host->ops->reset)
59 {
60 if ((err = sdev->host->ops->reset(sdev)))
61 {
62 return err;
63 }
64 }
65
66 if (!driver_table[sdev->devtype].probe)
67 {
68 LOG_E("Device type %x is not supported", sdev->devtype);
69
70 return -RT_ENOSYS;
71 }
72
73 timeout = rt_tick_from_millisecond(5000);
74 timeout += rt_tick_get();
75
76 while ((err = rt_scsi_test_unit_ready(sdev)))
77 {
78 if (rt_tick_get() >= timeout)
79 {
80 return -RT_ETIMEOUT;
81 }
82 }
83
84 return driver_table[sdev->devtype].probe(sdev);
85}
86
87rt_err_t rt_scsi_host_register(struct rt_scsi_host *scsi)
88{

Callers 1

rt_scsi_host_registerFunction · 0.85

Calls 3

rt_tick_from_millisecondFunction · 0.85
rt_tick_getFunction · 0.85
rt_scsi_test_unit_readyFunction · 0.70

Tested by

no test coverage detected