| 111 | } |
| 112 | |
| 113 | int rtlink_fops_poll(struct dfs_file *fd, struct rt_pollreq *req) |
| 114 | { |
| 115 | int mask = 0; |
| 116 | int flags = 0; |
| 117 | rt_device_t device; |
| 118 | struct rt_link_device *rtlink_dev; |
| 119 | |
| 120 | device = (rt_device_t)fd->vnode->data; |
| 121 | RT_ASSERT(device != RT_NULL); |
| 122 | |
| 123 | rtlink_dev = (struct rt_link_device *)device; |
| 124 | |
| 125 | flags = fd->flags & O_ACCMODE; |
| 126 | if (flags == O_RDONLY || flags == O_RDWR) |
| 127 | { |
| 128 | rt_base_t level; |
| 129 | rt_poll_add(&(device->wait_queue), req); |
| 130 | |
| 131 | level = rt_hw_interrupt_disable(); |
| 132 | if (RT_NULL != rt_slist_first(&rtlink_dev->recv_head)) |
| 133 | mask |= POLLIN; |
| 134 | rt_hw_interrupt_enable(level); |
| 135 | } |
| 136 | mask |= POLLOUT; |
| 137 | |
| 138 | return mask; |
| 139 | } |
| 140 | |
| 141 | const static struct dfs_file_ops _rtlink_fops = |
| 142 | { |
nothing calls this directly
no test coverage detected