diff options
| author | Grissiom <[email protected]> | 2013-08-20 10:48:15 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2013-08-20 12:54:43 +0800 |
| commit | 6e676e7754e9042c333ff7f3826766c6462f92be (patch) | |
| tree | ed77a0926063d1c2f717e381d29e722198c4dba6 /components/drivers/include/rtdevice.h | |
| parent | 7e68096a88aaa9279507df54da191893be99f7df (diff) | |
dev/portal: implement portal device
Portal is a device that connect devices. Currently, you can only connect
pipes in portal. Pipes are unidirectional. But with portal, you can
construct a bidirectional device with two pipes.
Diffstat (limited to 'components/drivers/include/rtdevice.h')
| -rw-r--r-- | components/drivers/include/rtdevice.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index 734839e69e..60d4dc1e8a 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -73,6 +73,14 @@ struct rt_ringbuffer rt_int16_t buffer_size; }; +/* portal device */ +struct rt_portal_device +{ + struct rt_device parent; + struct rt_device *write_dev; + struct rt_device *read_dev; +}; + /* pipe device */ #define PIPE_DEVICE(device) ((struct rt_pipe_device*)(device)) enum rt_pipe_flag @@ -101,6 +109,9 @@ struct rt_pipe_device /* suspended list */ rt_list_t suspended_read_list; rt_list_t suspended_write_list; + + struct rt_portal_device *write_portal; + struct rt_portal_device *read_portal; }; #define RT_DATAQUEUE_EVENT_UNKNOWN 0x00 @@ -225,6 +236,23 @@ void rt_pipe_destroy(struct rt_pipe_device *pipe); #endif /** + * Portal for DeviceDriver + */ + +rt_err_t rt_portal_init(struct rt_portal_device *portal, + const char *portal_name, + const char *write_dev, + const char *read_dev); +rt_err_t rt_portal_detach(struct rt_portal_device *portal); + +#ifdef RT_USING_HEAP +rt_err_t rt_portal_create(const char *name, + const char *write_dev, + const char *read_dev); +void rt_portal_destroy(struct rt_portal_device *portal); +#endif + +/** * DataQueue for DeviceDriver */ rt_err_t rt_data_queue_init(struct rt_data_queue *queue, |
