Merge pull request #146 from grissiom/rtt-next

Some fix for the portal device
This commit is contained in:
Bernard Xiong 2013-08-26 21:12:55 -07:00
commit f7f14cf566
1 changed files with 7 additions and 2 deletions

View File

@ -53,6 +53,9 @@ static rt_err_t _portal_open(rt_device_t dev, rt_uint16_t oflag)
RT_ASSERT(dev); RT_ASSERT(dev);
if (!oflag)
return -RT_ERROR;
portal = (struct rt_portal_device*)dev; portal = (struct rt_portal_device*)dev;
if (oflag & RT_DEVICE_OFLAG_RDONLY) if (oflag & RT_DEVICE_OFLAG_RDONLY)
@ -113,7 +116,8 @@ static rt_err_t _portal_rx_indicate(rt_device_t dev, rt_size_t size)
pipe = (struct rt_pipe_device*)dev; pipe = (struct rt_pipe_device*)dev;
if (pipe->read_portal->parent.rx_indicate) if (pipe->read_portal->parent.rx_indicate)
return pipe->read_portal->parent.rx_indicate(dev, size); return pipe->read_portal->parent.rx_indicate(
(rt_device_t)pipe->read_portal, size);
return -RT_ENOSYS; return -RT_ENOSYS;
} }
@ -127,7 +131,8 @@ static rt_err_t _portal_tx_complete(rt_device_t dev, void *buf)
pipe = (struct rt_pipe_device*)dev; pipe = (struct rt_pipe_device*)dev;
if (pipe->write_portal->parent.tx_complete) if (pipe->write_portal->parent.tx_complete)
return pipe->write_portal->parent.tx_complete(dev, buf); return pipe->write_portal->parent.tx_complete(
(rt_device_t)pipe->write_portal, buf);
return -RT_ENOSYS; return -RT_ENOSYS;
} }