mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 04:04:15 +08:00
device/pipe: add a control cmd to get the space left in pipe
This commit is contained in:
@@ -190,6 +190,8 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
|
||||
|
||||
static rt_err_t rt_pipe_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
{
|
||||
if (cmd == PIPE_CTRL_GET_SPACE && args)
|
||||
*(rt_size_t*)args = rt_ringbuffer_space_len(&PIPE_DEVICE(dev)->ringbuffer);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user