| 357 | MSH_CMD_EXPORT(rtlink_dwrite, rtlink device interface example); |
| 358 | |
| 359 | static void rtlink_dinit(void) |
| 360 | { |
| 361 | /* step1: register rtlink to to the device framework */ |
| 362 | rt_link_dev_register(&rtlink_dev, RTLINK01, |
| 363 | RT_DEVICE_FLAG_RDWR | |
| 364 | RT_DEVICE_FLAG_REMOVABLE | |
| 365 | RT_DEVICE_FLAG_STANDALONE, |
| 366 | RT_NULL); |
| 367 | |
| 368 | /* step2: Initialize the rlink device as the default configuration, */ |
| 369 | rt_device_t device = rt_device_find(RTLINK01); |
| 370 | if (device == RT_NULL) |
| 371 | { |
| 372 | LOG_E("device not find!"); |
| 373 | return ; |
| 374 | } |
| 375 | rt_device_init(device); |
| 376 | |
| 377 | /* step3: config rtlink device rx/tx callback, channel, send timeout */ |
| 378 | rt_device_set_rx_indicate(device, rtlink_dev_rx_ind); |
| 379 | rt_device_set_tx_complete(device, rtlink_dev_tx_done); |
| 380 | struct rt_link_service service; |
| 381 | service.service = RT_LINK_SERVICE_SOCKET; |
| 382 | service.timeout_tx = RT_WAITING_FOREVER; |
| 383 | service.flag = RT_LINK_FLAG_ACK | RT_LINK_FLAG_CRC; |
| 384 | rt_device_control(device, RT_DEVICE_CTRL_CONFIG, &service); |
| 385 | } |
| 386 | MSH_CMD_EXPORT(rtlink_dinit, rtlink device interface example); |
| 387 | |
| 388 | static void rtlink_dopen() |
nothing calls this directly
no test coverage detected