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

Function rtlink_fops_poll

components/utilities/rt-link/src/rtlink_dev.c:113–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113int 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
141const static struct dfs_file_ops _rtlink_fops =
142{

Callers

nothing calls this directly

Calls 4

rt_poll_addFunction · 0.85
rt_slist_firstFunction · 0.85
rt_hw_interrupt_disableFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50

Tested by

no test coverage detected