Module: xenomai-head
Branch: master
Commit: 1395fdfc28ad1dbc8d41c529fe823f718e90328e
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=1395fdfc28ad1dbc8d41c529fe823f718e90328e

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Sat Nov 21 00:52:11 2009 +0100

analogy: add error codes descriptions for the asynchronous API

---

 src/drvlib/analogy/async.c |   78 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/src/drvlib/analogy/async.c b/src/drvlib/analogy/async.c
index 9d90e5a..d83b032 100644
--- a/src/drvlib/analogy/async.c
+++ b/src/drvlib/analogy/async.c
@@ -43,7 +43,15 @@
  * optionally a4l_fill_desc())
  * @param[in] cmd Command structure
  *
- * @return 0 on success, otherwise a negative error code.
+ * @return 0 on success. Otherwise:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong (Please,
+ *    type "dmesg" for more info)
+ * - -ENOMEM is returned if the system is out of memory
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
+ * - -EIO is returned if the selected subdevice cannot handle command
+ * - -EBUSY is returned if the selected subdevice is already
+ *    processing an asynchronous operation
  *
  */
 int a4l_snd_command(a4l_desc_t * dsc, a4l_cmd_t * cmd)
@@ -65,7 +73,12 @@ int a4l_snd_command(a4l_desc_t * dsc, a4l_cmd_t * cmd)
  * optionally a4l_fill_desc())
  * @param[in] idx_subd Subdevice index
  *
- * @return 0 on success, otherwise a negative error code.
+ * @return 0 on success. Otherwise:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong (Please,
+ *    type "dmesg" for more info)
+ * - -EIO is returned if the selected subdevice does not support
+ *    asynchronous operation
  *
  */
 int a4l_snd_cancel(a4l_desc_t * dsc, unsigned int idx_subd)
@@ -94,7 +107,17 @@ int a4l_snd_cancel(a4l_desc_t * dsc, unsigned int idx_subd)
  * @param[in] size New buffer size, the maximal tolerated value is
  * 16MB (A4L_BUF_MAXSIZE)
  *
- * @return 0 on success, otherwise a negative error code.
+ * @return 0 on success. Otherwise:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong (Please,
+ *    type "dmesg" for more info)
+ * - -EPERM is returned if the function is called in an RT context or
+ *    if the buffer to resize is mapped in user-space (Please, type
+ *    "dmesg" for more info)
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
+ * - -EBUSY is returned if the selected subdevice is already
+ *    processing an asynchronous operation
+ * - -ENOMEM is returned if the system is out of memory
  *
  */
 int a4l_set_bufsize(a4l_desc_t * dsc,
@@ -124,7 +147,11 @@ int a4l_set_bufsize(a4l_desc_t * dsc,
  * @param[in] idx_subd Index of the concerned subdevice
  * @param[out] size Buffer size
  *
- * @return 0 on success, otherwise a negative error code.
+ * @return 0 on success. Otherwise:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong (Please,
+ *    type "dmesg" for more info)
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
  *
  */
 int a4l_get_bufsize(a4l_desc_t * dsc,
@@ -179,7 +206,12 @@ int a4l_get_bufsize(a4l_desc_t * dsc,
  * @param[in] cur Amount of consumed data
  * @param[out] new Amount of available data
  *
- * @return 0 on success, otherwise a negative error code.
+ * @return 0 on success. Otherwise:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong, the
+ *    descriptor and the new pointer should be checked; check also the
+ *    kernel log
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
  *
  */
 int a4l_mark_bufrw(a4l_desc_t * dsc,
@@ -216,7 +248,12 @@ int a4l_mark_bufrw(a4l_desc_t * dsc,
  * A4L_NONBLOCK causes the function to return immediately without
  * waiting for any available data
  *
- * @return the available data count.
+ * @return the available data count. Otherwise:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong (Please,
+ *    type "dmesg" for more info)
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
+ * - -EINTR is returned if calling task has been unblocked by a signal
  *
  */
 int a4l_poll(a4l_desc_t * dsc,
@@ -249,7 +286,16 @@ int a4l_poll(a4l_desc_t * dsc,
  * @param[out] ptr Address of the pointer containing the assigned
  * address on return
  *
- * @return 0 on success, otherwise a negative error code.
+ * @return 0 on success. Otherwise:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong, the
+ *    descriptor and the pointer should be checked; check also the
+ *    kernel log
+ * - -EPERM is returned if the function is called in an RT context or
+ *    if the buffer to resize is mapped in user-space (Please, type
+ *    "dmesg" for more info)
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
+ * - -EBUSY is returned if the buffer is already mapped in user-space
  *
  */
 int a4l_mmap(a4l_desc_t * dsc,
@@ -298,7 +344,14 @@ int a4l_mmap(a4l_desc_t * dsc,
  * A4L_NONBLOCK causes the function to return immediately without
  * waiting for any available data
  *
- * @return Number of bytes read, otherwise negative error code.
+ * @return Number of bytes read, otherwise negative error code:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong, the
+ *    descriptor should be checked; check also the kernel log
+ * - -ENOENT is returned if the device's reading subdevice is idle (no
+ *    command was sent)
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
+ * - -EINTR is returned if calling task has been unblocked by a signal
  *
  */
 int a4l_async_read(a4l_desc_t * dsc,
@@ -348,7 +401,14 @@ int a4l_async_read(a4l_desc_t * dsc,
  * A4L_NONBLOCK causes the function to return immediately without
  * waiting any available space to write data.
  *
- * @return Number of bytes written, otherwise negative error code.
+ * @return Number of bytes written, otherwise negative error code:
+ *
+ * - -EINVAL is returned if some argument is missing or wrong, the
+ *    descriptor should be checked; check also the kernel log
+ * - -ENOENT is returned if the device's reading subdevice is idle (no
+ *    command was sent)
+ * - -EFAULT is returned if a user <-> kernel transfer went wrong
+ * - -EINTR is returned if calling task has been unblocked by a signal
  *
  */
 int a4l_async_write(a4l_desc_t * dsc,


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to