| 177 | } |
| 178 | |
| 179 | static void rtlink_fselect() |
| 180 | { |
| 181 | /* step1: register rtlink to to the device framework */ |
| 182 | rt_link_dev_register(&rtlink_fd, RTLINK02, |
| 183 | RT_DEVICE_FLAG_RDWR | |
| 184 | RT_DEVICE_FLAG_REMOVABLE | |
| 185 | RT_DEVICE_FLAG_STANDALONE, |
| 186 | RT_NULL); |
| 187 | |
| 188 | /* step2: Initialize the rlink device as the default configuration, */ |
| 189 | rt_device_t device = rt_device_find(RTLINK02); |
| 190 | if (device == RT_NULL) |
| 191 | { |
| 192 | LOG_E("device not find!"); |
| 193 | return ; |
| 194 | } |
| 195 | rt_device_init(device); |
| 196 | |
| 197 | /* step3: config rtlink device rx/tx callback, channel, send timeout */ |
| 198 | rt_device_set_rx_indicate(device, rtlink_dev_rx_ind); |
| 199 | rt_device_set_tx_complete(device, rtlink_dev_tx_done); |
| 200 | struct rt_link_service service; |
| 201 | service.service = RT_LINK_SERVICE_MNGT; |
| 202 | service.timeout_tx = RT_WAITING_NO; |
| 203 | rt_device_control(device, RT_DEVICE_CTRL_CONFIG, &service); |
| 204 | |
| 205 | rt_thread_t tid = rt_thread_create(RTLINK02, listen_thread, RT_NULL, 1024, 21, 20); |
| 206 | if (tid) |
| 207 | { |
| 208 | rt_thread_startup(tid); |
| 209 | } |
| 210 | } |
| 211 | MSH_CMD_EXPORT(rtlink_fselect, rtlink posix interface example); |
| 212 | #endif /* RT_USING_POSIX_DEVIO */ |
| 213 |
nothing calls this directly
no test coverage detected