summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-11-29 00:04:55 +0000
committer[email protected] <[email protected]>2010-11-29 00:04:55 +0000
commit7a80d831c961d5c116fba457d3783459bbf41b6e (patch)
treebca232bc65e37ea52c5970e47dbc5fe37fdae2d0 /src/device.c
parent36a93a4e4a0174529c2b669aa6d23f03c2d10b3a (diff)
update doxygen comments.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1132 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/device.c b/src/device.c
index c830ce6b1e..d8e467ee91 100644
--- a/src/device.c
+++ b/src/device.c
@@ -38,7 +38,7 @@ rt_err_t rt_device_register(rt_device_t dev, const char* name, rt_uint16_t flags
}
/**
- * This function removes a previouly registered device driver
+ * This function removes a previously registered device driver
*
* @param dev the pointer of device driver structure
*
@@ -138,7 +138,7 @@ rt_device_t rt_device_find(const char* name)
}
/**
- * This function will initialize the speicial device
+ * This function will initialize the specified device
*
* @param dev the pointer of device driver structure
*
@@ -175,6 +175,7 @@ rt_err_t rt_device_init(rt_device_t dev)
* This function will open a device
*
* @param dev the pointer of device driver structure
+ * @param oflag the flags for device open
*
* @return the result
*/
@@ -203,7 +204,7 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
}
}
- /* device is a standalone device and opened */
+ /* device is a stand alone device and opened */
if ((dev->flag & RT_DEVICE_FLAG_STANDALONE) &&
(dev->open_flag & RT_DEVICE_OFLAG_OPEN))
return -RT_EBUSY;
@@ -269,6 +270,8 @@ rt_err_t rt_device_close(rt_device_t dev)
* @param size the size of buffer
*
* @return the actually read size on successful, otherwise negative returned.
+ *
+ * @note since 0.4.0, the unit of size/pos is a block for block device.
*/
rt_size_t rt_device_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
{
@@ -297,6 +300,8 @@ rt_size_t rt_device_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t
* @param size the size of buffer
*
* @return the actually written size on successful, otherwise negative returned.
+ *
+ * @note since 0.4.0, the unit of size/pos is a block for block device.
*/
rt_size_t rt_device_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
{
@@ -341,6 +346,15 @@ rt_err_t rt_device_control(rt_device_t dev, rt_uint8_t cmd, void* arg)
return -RT_ENOSYS;
}
+/**
+ * This function will set the indication callback function when device receives
+ * data.
+ *
+ * @param dev the pointer of device driver structure
+ * @param rx_ind the indication callback function
+ *
+ * @return RT_EOK
+ */
rt_err_t rt_device_set_rx_indicate(rt_device_t dev, rt_err_t (*rx_ind )(rt_device_t dev, rt_size_t size))
{
RT_ASSERT(dev != RT_NULL);
@@ -349,6 +363,15 @@ rt_err_t rt_device_set_rx_indicate(rt_device_t dev, rt_err_t (*rx_ind )(rt_devic
return RT_EOK;
}
+/**
+ * This function will set the indication callback function when device has written
+ * data to physical hardware.
+ *
+ * @param dev the pointer of device driver structure
+ * @param tx_done the indication callback function
+ *
+ * @return RT_EOK
+ */
rt_err_t rt_device_set_tx_complete(rt_device_t dev, rt_err_t (*tx_done)(rt_device_t dev, void *buffer))
{
RT_ASSERT(dev != RT_NULL);