diff options
| author | Grissiom <[email protected]> | 2013-10-23 01:43:18 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2013-10-23 01:43:18 +0800 |
| commit | 0feefc03b6008301a19a430427390cc9c44decf8 (patch) | |
| tree | aff36cf75ff11a4bcf336edceaa53df3d001fef3 /components/drivers/src/pipe.c | |
| parent | ac5da68db79fb98071463da28ac88bb2981c8a53 (diff) | |
device/pipe: add a control cmd to get the space left in pipe
Diffstat (limited to 'components/drivers/src/pipe.c')
| -rw-r--r-- | components/drivers/src/pipe.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c index 8a6c97aabf..f438a92898 100644 --- a/components/drivers/src/pipe.c +++ b/components/drivers/src/pipe.c @@ -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; } |
