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

Function rt_device_init

components/drivers/core/device.c:186–211  ·  view source on GitHub ↗

* @brief This function will initialize the specified device. * * @param dev is the pointer of device driver structure. * * @return the result, RT_EOK on successfully. */

Source from the content-addressed store, hash-verified

184 * @return the result, RT_EOK on successfully.
185 */
186rt_err_t rt_device_init(rt_device_t dev)
187{
188 rt_err_t result = RT_EOK;
189
190 RT_ASSERT(dev != RT_NULL);
191
192 /* get device_init handler */
193 if (device_init != RT_NULL)
194 {
195 if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
196 {
197 result = device_init(dev);
198 if (result != RT_EOK)
199 {
200 LOG_E("To initialize device:%.*s failed. The error code is %d",
201 RT_NAME_MAX, dev->parent.name, result);
202 }
203 else
204 {
205 dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
206 }
207 }
208 }
209
210 return result;
211}
212
213/**
214 * @brief This function will open a device.

Callers 15

rt_usb_device_initFunction · 0.85
rt_usb_host_initFunction · 0.85
sys_device_initFunction · 0.85
rt_audio_registerFunction · 0.85
rt_wlan_dev_initFunction · 0.85
eth_netif_device_initFunction · 0.85
test_wdt_feedFunction · 0.85
test_wdt_nofeedFunction · 0.85
wdt_sampleFunction · 0.85
rt_hw_dc_initFunction · 0.85
rtgui_touch_hw_initFunction · 0.85

Calls

no outgoing calls

Tested by 7

test_wdt_feedFunction · 0.68
test_wdt_nofeedFunction · 0.68
_ic_test_openFunction · 0.68
wdt_sampleFunction · 0.68
test_wdtFunction · 0.68
test_watchdogFunction · 0.68
device_testFunction · 0.68