Lines Matching refs:dev
20 #define RTLINK_SERV(dev) (((struct rt_link_device*)dev)->service) argument
223 rt_err_t rt_link_dev_init(rt_device_t dev) in rt_link_dev_init() argument
225 RT_ASSERT(dev != RT_NULL); in rt_link_dev_init()
227 dev->rx_indicate = RT_NULL; in rt_link_dev_init()
228 dev->tx_complete = RT_NULL; in rt_link_dev_init()
230 struct rt_link_device *rtlink = (struct rt_link_device *)dev; in rt_link_dev_init()
235 rtlink->service.user_data = (void *)dev; in rt_link_dev_init()
241 rt_err_t rt_link_dev_open(rt_device_t dev, rt_uint16_t oflag) in rt_link_dev_open() argument
243 RT_ASSERT(dev != RT_NULL); in rt_link_dev_open()
244 struct rt_link_device *rtlink = (struct rt_link_device *)dev; in rt_link_dev_open()
249 dev->open_flag = oflag & RT_DEVICE_OFLAG_MASK; in rt_link_dev_open()
250 if (dev->open_flag == RT_DEVICE_OFLAG_RDONLY) in rt_link_dev_open()
254 else if (dev->open_flag == RT_DEVICE_OFLAG_WRONLY) in rt_link_dev_open()
261 rt_err_t rt_link_dev_close(rt_device_t dev) in rt_link_dev_close() argument
263 RT_ASSERT(dev != RT_NULL); in rt_link_dev_close()
264 struct rt_link_device *rtlink = (struct rt_link_device *)dev; in rt_link_dev_close()
268 rt_ssize_t rt_link_dev_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) in rt_link_dev_read() argument
270 RT_ASSERT(dev != RT_NULL); in rt_link_dev_read()
274 struct rt_link_device *rtlink = (struct rt_link_device *)dev; in rt_link_dev_read()
279 if (dev->rx_indicate == RT_NULL) in rt_link_dev_read()
308 rt_ssize_t rt_link_dev_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) in rt_link_dev_write() argument
310 RT_ASSERT(dev != RT_NULL); in rt_link_dev_write()
314 return rt_link_send(&RTLINK_SERV(dev), buffer, size); in rt_link_dev_write()
317 rt_err_t rt_link_dev_control(rt_device_t dev, int cmd, void *args) in rt_link_dev_control() argument
319 RT_ASSERT(dev != RT_NULL); in rt_link_dev_control()
325 RTLINK_SERV(dev).service = ((struct rt_link_service *)args)->service; in rt_link_dev_control()
326 RTLINK_SERV(dev).timeout_tx = ((struct rt_link_service *)args)->timeout_tx; in rt_link_dev_control()
327 RTLINK_SERV(dev).flag = ((struct rt_link_service *)args)->flag; in rt_link_dev_control()
332 dev->rx_indicate = RT_NULL; in rt_link_dev_control()
336 RTLINK_SERV(dev).timeout_tx = RT_WAITING_FOREVER; in rt_link_dev_control()
337 dev->tx_complete = RT_NULL; in rt_link_dev_control()
341 RTLINK_SERV(dev).timeout_tx = RT_WAITING_NO; in rt_link_dev_control()