Module: xenomai-abe
Branch: analogy
Commit: 549d8fe430dba37fcce1175d36518bfd3ab1bd7c
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=549d8fe430dba37fcce1175d36518bfd3ab1bd7c

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Wed Oct 28 01:00:40 2009 +0100

Fix comments

---

 src/utils/analogy/analogy_config.c |   22 ++++++++--------
 src/utils/analogy/cmd_read.c       |   50 ++++++++++++++++++------------------
 src/utils/analogy/cmd_write.c      |   44 ++++++++++++++++----------------
 src/utils/analogy/insn_read.c      |   32 +++++++++++-----------
 4 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/src/utils/analogy/analogy_config.c 
b/src/utils/analogy/analogy_config.c
index a40a178..316dcd4 100644
--- a/src/utils/analogy/analogy_config.c
+++ b/src/utils/analogy/analogy_config.c
@@ -31,12 +31,12 @@
 
 #include <analogy/analogy.h>
 
-/* Declares precompilation constants */
+/* Declare precompilation constants */
 #define __NBMIN_ARG 2
 #define __NBMAX_ARG 3
 #define __OPTS_DELIMITER ","
 
-/* Declares prog variables */
+/* Declare prog variables */
 int vlevel = 1;
 int unatt_act = 0;
 struct option a4l_conf_opts[] = {
@@ -55,7 +55,7 @@ int compute_opts(char *opts, unsigned int *nb, unsigned int 
*res)
 
        int ret = 0, len, ofs;
 
-       /* Checks arg and inits it */
+       /* Check arg and inits it */
        if (nb == NULL)
                return -EINVAL;
        *nb = 0;
@@ -103,10 +103,10 @@ int main(int argc, char *argv[])
        a4l_lnkdesc_t lnkdsc;
        int chk_nb, ret = 0, fd = -1;
 
-       /* Inits the descriptor structure */
+       /* Init the descriptor structure */
        memset(&lnkdsc, 0, sizeof(a4l_lnkdesc_t));
 
-       /* Computes arguments */
+       /* Compute arguments */
        while ((c =
                getopt_long(argc, argv, "hvqVrR:W:", a4l_conf_opts,
                            NULL)) >= 0) {
@@ -133,23 +133,23 @@ int main(int argc, char *argv[])
                }
        }
 
-       /* Checks the last arguments */
+       /* Check the last arguments */
        chk_nb = (unatt_act == 0) ? __NBMIN_ARG : __NBMIN_ARG - 1;
        if (argc - optind < chk_nb) {
                do_print_usage();
                goto out_a4l_config;
        }
 
-       /* Gets the device file name */
+       /* Get the device file name */
        devfile = argv[optind];
 
-       /* Fills the descriptor with the driver name */
+       /* Fill the descriptor with the driver name */
        if (unatt_act == 0) {
                lnkdsc.bname = argv[optind + 1];
                lnkdsc.bname_size = strlen(argv[optind + 1]);
        }
 
-       /* Handles the last arguments: the driver-specific args */
+       /* Handle the last arguments: the driver-specific args */
        if (unatt_act == 1 || argc - optind != __NBMAX_ARG)
                lnkdsc.opts_size = 0;
        else {
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       /* Opens the specified file */
+       /* Open the specified file */
        fd = a4l_sys_open(devfile);
        if (fd < 0) {
                ret = fd;
@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
                goto out_a4l_config;
        }
 
-       /* Triggers the ioctl */
+       /* Trigger the ioctl */
        if (unatt_act == 0)
                ret = a4l_sys_attach(fd, &lnkdsc);
        else
diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c
index c71c339..90518d9 100644
--- a/src/utils/analogy/cmd_read.c
+++ b/src/utils/analogy/cmd_read.c
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
        void *map = NULL;
        a4l_desc_t dsc;
 
-       /* Computes arguments */
+       /* Compute arguments */
        while ((ret = getopt_long(argc,
                                  argv,
                                  "vrd:s:S:c:mh", cmd_read_opts, NULL)) >= 0) {
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       /* Recovers the channels to compute */
+       /* Recover the channels to compute */
        do {
                cmd.nb_chan++;
                len = strlen(str_chans);
@@ -156,7 +156,7 @@ int main(int argc, char *argv[])
                str_chans += ofs + 1;
        } while (len != ofs);
 
-       /* Updates the command structure */
+       /* Update the command structure */
        cmd.scan_end_arg = cmd.nb_chan;
 
        if (real_time != 0) {
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
                if (verbose != 0)
                        printf("cmd_read: switching to real-time mode\n");
 
-               /* Prevents any memory-swapping for this program */
+               /* Prevent any memory-swapping for this program */
                ret = mlockall(MCL_CURRENT | MCL_FUTURE);
                if (ret < 0) {
                        ret = errno;
@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
                        goto out_main;
                }
 
-               /* Turns the current process into an RT task */
+               /* Turn the current process into an RT task */
                ret = rt_task_shadow(&rt_task_desc, NULL, 1, 0);
                if (ret < 0) {
                        fprintf(stderr,
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
 
        }
 
-       /* Opens the device */
+       /* Open the device */
        ret = a4l_open(&dsc, filename);
        if (ret < 0) {
                fprintf(stderr, "cmd_read: a4l_open %s failed (ret=%d)\n",
@@ -201,14 +201,14 @@ int main(int argc, char *argv[])
                printf("\t write subdevice index = %d\n", dsc.idx_write_subd);
        }
 
-       /* Allocates a buffer so as to get more info (subd, chan, rng) */
+       /* Allocate a buffer so as to get more info (subd, chan, rng) */
        dsc.sbdata = malloc(dsc.sbsize);
        if (dsc.sbdata == NULL) {
                fprintf(stderr, "cmd_read: malloc failed \n");
                return -ENOMEM;
        }
 
-       /* Gets this data */
+       /* Get this data */
        ret = a4l_fill_desc(&dsc);
        if (ret < 0) {
                fprintf(stderr,
@@ -219,7 +219,7 @@ int main(int argc, char *argv[])
        if (verbose != 0)
                printf("cmd_read: complex descriptor retrieved\n");
 
-       /* Gets the size of a single acquisition */
+       /* Get the size of a single acquisition */
        for (i = 0; i < cmd.nb_chan; i++) {
                a4l_chinfo_t *info;
 
@@ -247,12 +247,12 @@ int main(int argc, char *argv[])
                       scan_size * cmd.stop_arg);
        }
 
-       /* Cancels any former command which might be in progress */
+       /* Cancel any former command which might be in progress */
        a4l_snd_cancel(&dsc, cmd.idx_subd);
 
        if (use_mmap != 0) {
 
-               /* Gets the buffer size to map */
+               /* Get the buffer size to map */
                ret = a4l_get_bufsize(&dsc, cmd.idx_subd, &buf_size);
                if (ret < 0) {
                        fprintf(stderr,
@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
                if (verbose != 0)
                        printf("cmd_read: buffer size = %lu bytes\n", buf_size);
 
-               /* Maps the analog input subdevice buffer */
+               /* Map the analog input subdevice buffer */
                ret = a4l_mmap(&dsc, cmd.idx_subd, buf_size, &map);
                if (ret < 0) {
                        fprintf(stderr,
@@ -279,7 +279,7 @@ int main(int argc, char *argv[])
                                 map);
        }
 
-       /* Sends the command to the input device */
+       /* Send the command to the input device */
        ret = a4l_snd_command(&dsc, &cmd);
        if (ret < 0) {
                fprintf(stderr,
@@ -303,10 +303,10 @@ int main(int argc, char *argv[])
 
        if (use_mmap == 0) {
 
-               /* Fetches data */
+               /* Fetch data */
                while (cnt < cmd.stop_arg * scan_size) {
 
-                       /* Performs the read operation */
+                       /* Perform the read operation */
                        ret = a4l_sys_read(dsc.fd, buf, BUF_SIZE);
                        if (ret < 0) {
                                fprintf(stderr,
@@ -315,7 +315,7 @@ int main(int argc, char *argv[])
                                goto out_main;
                        }
 
-                       /* Dumps the results */
+                       /* Dump the results */
                        for (i = 0; i < ret; i++) {
                                printf("0x%x ", buf[i]);
                                if (((cnt + i + 1) % scan_size) == 0)
@@ -339,10 +339,10 @@ int main(int argc, char *argv[])
        } else {
                unsigned long front = 0;
 
-               /* Fetches data without any memcpy */
+               /* Fetch data without any memcpy */
                while (cnt < cmd.stop_arg * scan_size) {
 
-                       /* Retrieves and update the buffer's state
+                       /* Retrieve and update the buffer's state
                           (In input case, we recover how many bytes are 
available
                           to read) */
                        ret =
@@ -371,14 +371,14 @@ int main(int argc, char *argv[])
                                }
                        }
 
-                       /* Displays the results */
+                       /* Display the results */
                        for (i = cnt; i < cnt + front; i++) {
-                               /* Prints char by char */
+                               /* Print char by char */
                                fprintf(stdout,
                                        "0x%x ",
                                        ((unsigned char *)map)[i % buf_size]);
 
-                               /* Returns to the next line after each scan */
+                               /* Return to the next line after each scan */
                                if (((cnt + i + 1) % scan_size) == 0)
                                        fprintf(stdout, "\n");
                        }
@@ -393,7 +393,7 @@ int main(int argc, char *argv[])
                                }
                        }
 
-                       /* Updates the counter */
+                       /* Update the counter */
                        cnt += front;
                }
        }
@@ -406,13 +406,13 @@ int main(int argc, char *argv[])
 out_main:
 
        if (use_mmap != 0)
-               /* Cleans the pages table */
+               /* Clean the pages table */
                munmap(map, buf_size);
 
-       /* Frees the buffer used as device descriptor */
+       /* Free the buffer used as device descriptor */
        free(dsc.sbdata);
 
-       /* Releases the file descriptor */
+       /* Release the file descriptor */
        a4l_close(&dsc);
 
        return ret;
diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c
index d4ae6ab..95b23c8 100644
--- a/src/utils/analogy/cmd_write.c
+++ b/src/utils/analogy/cmd_write.c
@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
        void *map = NULL;
        a4l_desc_t dsc;
 
-       /* Computes arguments */
+       /* Compute arguments */
        while ((ret = getopt_long(argc,
                                  argv,
                                  "vrd:s:S:c:mh", cmd_write_opts, NULL)) >= 0) {
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       /* Recovers the channels to compute */
+       /* Recover the channels to compute */
        do {
                cmd.nb_chan++;
                len = strlen(str_chans);
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
                str_chans += ofs + 1;
        } while (len != ofs);
 
-       /* Updates the command structure */
+       /* Update the command structure */
        cmd.scan_end_arg = cmd.nb_chan;
 
        if (real_time != 0) {
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
                if (verbose != 0)
                        printf("cmd_write: switching to real-time mode\n");
 
-               /* Prevents any memory-swapping for this program */
+               /* Prevent any memory-swapping for this program */
                ret = mlockall(MCL_CURRENT | MCL_FUTURE);
                if (ret < 0) {
                        ret = errno;
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
                        goto out_main;
                }
 
-               /* Turns the current process into an RT task */
+               /* Turn the current process into an RT task */
                ret = rt_task_shadow(&rt_task_desc, NULL, 1, 0);
                if (ret < 0) {
                        fprintf(stderr,
@@ -188,7 +188,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       /* Opens the device */
+       /* Open the device */
        ret = a4l_open(&dsc, filename);
        if (ret < 0) {
                fprintf(stderr,
@@ -206,14 +206,14 @@ int main(int argc, char *argv[])
                printf("\t write subdevice index = %d\n", dsc.idx_write_subd);
        }
 
-       /* Allocates a buffer so as to get more info (subd, chan, rng) */
+       /* Allocate a buffer so as to get more info (subd, chan, rng) */
        dsc.sbdata = malloc(dsc.sbsize);
        if (dsc.sbdata == NULL) {
                fprintf(stderr, "cmd_write: malloc failed \n");
                return -ENOMEM;
        }
 
-       /* Gets this data */
+       /* Get this data */
        ret = a4l_fill_desc(&dsc);
        if (ret < 0) {
                fprintf(stderr,
@@ -224,7 +224,7 @@ int main(int argc, char *argv[])
        if (verbose != 0)
                printf("cmd_write: complex descriptor retrieved\n");
 
-       /* Gets the size of a single acquisition */
+       /* Get the size of a single acquisition */
        for (i = 0; i < cmd.nb_chan; i++) {
                a4l_chinfo_t *info;
 
@@ -252,12 +252,12 @@ int main(int argc, char *argv[])
                       scan_size * cmd.stop_arg);
        }
 
-       /* Cancels any former command which might be in progress */
+       /* Cancel any former command which might be in progress */
        a4l_snd_cancel(&dsc, cmd.idx_subd);
 
        if (use_mmap != 0) {
 
-               /* Gets the buffer size to map */
+               /* Get the buffer size to map */
                ret = a4l_get_bufsize(&dsc, cmd.idx_subd, &buf_size);
                if (ret < 0) {
                        fprintf(stderr,
@@ -270,7 +270,7 @@ int main(int argc, char *argv[])
                        printf("cmd_write: buffer size = %lu bytes\n",
                               buf_size);
 
-               /* Maps the analog input subdevice buffer */
+               /* Map the analog input subdevice buffer */
                ret = a4l_mmap(&dsc, cmd.idx_subd, buf_size, &map);
                if (ret < 0) {
                        fprintf(stderr,
@@ -284,7 +284,7 @@ int main(int argc, char *argv[])
                               "(map=0x%p)\n", map);
        }
 
-       /* Sends the command to the output device */
+       /* Send the command to the output device */
        ret = a4l_snd_command(&dsc, &cmd);
        if (ret < 0) {
                fprintf(stderr,
@@ -295,7 +295,7 @@ int main(int argc, char *argv[])
        if (verbose != 0)
                printf("cmd_write: command successfully sent\n");
 
-       /* Sets up the buffer to be written */
+       /* Set up the buffer to be written */
        for (i = 0; i < BUF_SIZE; i++)
                buf[i] = i;
 
@@ -312,7 +312,7 @@ int main(int argc, char *argv[])
 
        if (use_mmap == 0) {
 
-               /* Sends data */
+               /* Send data */
                while (cnt < scan_size * cmd.stop_arg) {
                        unsigned int tmp = 
                                (scan_size * cmd.stop_arg - cnt) > BUF_SIZE ? 
@@ -340,7 +340,7 @@ int main(int argc, char *argv[])
        } else {
                unsigned long front = 0;
 
-               /* Sends data through the shared buffer */
+               /* Send data through the shared buffer */
                while (cnt < cmd.stop_arg * scan_size) {
 
                        /* If the buffer is full, wait for an event
@@ -358,22 +358,22 @@ int main(int argc, char *argv[])
                                        front = (unsigned long)ret;
                        }
 
-                       /* Updates the variable front according to the data 
amount
+                       /* Update the variable front according to the data 
amount
                           we still have to send */
                        if (front > (scan_size * cmd.stop_arg - cnt))
                                front = scan_size * cmd.stop_arg - cnt;
 
-                       /* Performs the copy 
+                       /* Perform the copy 
                           (Usually, such an operation should be avoided: the 
shared
                           buffer should be used without any intermediate 
buffer,
                           the "mmaped" buffer is interesting for saving data 
copy) */
                        memcpy(map + (cnt % buf_size),
                               buf + (cnt % BUF_SIZE), front);
 
-                       /* Updates the counter */
+                       /* Update the counter */
                        cnt += front;
 
-                       /* Retrieves and update the buffer's state
+                       /* Retrieve and update the buffer's state
                           (In output case, we recover how many bytes can be
                           written into the shared buffer) */
                        ret = a4l_mark_bufrw(&dsc, cmd.idx_subd, front, &front);
@@ -403,10 +403,10 @@ int main(int argc, char *argv[])
 
 out_main:
 
-       /* Frees the buffer used as device descriptor */
+       /* Free the buffer used as device descriptor */
        free(dsc.sbdata);
 
-       /* Releases the file descriptor */
+       /* Release the file descriptor */
        a4l_close(&dsc);
 
        return ret;
diff --git a/src/utils/analogy/insn_read.c b/src/utils/analogy/insn_read.c
index 546b4e2..ce78dc6 100644
--- a/src/utils/analogy/insn_read.c
+++ b/src/utils/analogy/insn_read.c
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
        a4l_chinfo_t *chinfo;
        a4l_rnginfo_t *rnginfo;
 
-       /* Computes arguments */
+       /* Compute arguments */
        while ((ret = getopt_long(argc,
                                  argv,
                                  "vrd:s:S:c:R:h", insn_read_opts,
@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
                if (verbose != 0)
                        printf("insn_read: switching to real-time mode\n");
 
-               /* Prevents any memory-swapping for this program */
+               /* Prevent any memory-swapping for this program */
                ret = mlockall(MCL_CURRENT | MCL_FUTURE);
                if (ret < 0) {
                        ret = errno;
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
                        goto out_insn_read;
                }
 
-               /* Turns the current process into an RT task */
+               /* Turn the current process into an RT task */
                ret = rt_task_shadow(&rt_task_desc, NULL, 1, 0);
                if (ret < 0) {
                        fprintf(stderr,
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
 
        }
 
-       /* Opens the device */
+       /* Open the device */
        ret = a4l_open(&dsc, FILENAME);
        if (ret < 0) {
                fprintf(stderr, "insn_read: a4l_open %s failed (ret=%d)\n",
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
                return ret;
        }
 
-       /* Checks there is an input subdevice */
+       /* Check there is an input subdevice */
        if (dsc.idx_read_subd < 0) {
                ret = -ENOENT;
                fprintf(stderr, "insn_read: no input subdevice available\n");
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
                printf("\t write subdevice index = %d\n", dsc.idx_write_subd);
        }
 
-       /* Allocates a buffer so as to get more info (subd, chan, rng) */
+       /* Allocate a buffer so as to get more info (subd, chan, rng) */
        dsc.sbdata = malloc(dsc.sbsize);
        if (dsc.sbdata == NULL) {
                ret = -ENOMEM;
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
                goto out_insn_read;
        }
 
-       /* Gets this data */
+       /* Get this data */
        ret = a4l_fill_desc(&dsc);
        if (ret < 0) {
                fprintf(stderr, "insn_read: a4l_fill_desc failed (ret=%d)\n",
@@ -201,7 +201,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       /* Retrieves the subdevice data size */
+       /* Retrieve the subdevice data size */
        ret = a4l_get_chinfo(&dsc, idx_subd, idx_chan, &chinfo);
        if (ret < 0) {
                fprintf(stderr,
@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
                goto out_insn_read;
        }
 
-       /* Sets the data size to read */
+       /* Set the data size to read */
        scan_size *= chinfo->nb_bits / 8;
 
        if (verbose != 0) {
@@ -223,7 +223,7 @@ int main(int argc, char *argv[])
                int tmp = (scan_size - cnt) < BUF_SIZE ?
                        (scan_size - cnt) : BUF_SIZE;
 
-               /* Switches to RT primary mode */
+               /* Switch to RT primary mode */
                if (real_time != 0) {
                        ret = rt_task_set_mode(0, T_PRIMARY, NULL);
                        if (ret < 0) {
@@ -234,7 +234,7 @@ int main(int argc, char *argv[])
                        }
                }
 
-               /* Performs the synchronous read */
+               /* Perform the synchronous read */
                ret = a4l_sync_read(&dsc,
                                    idx_subd, 0, CHAN(idx_chan), buf, tmp);
 
@@ -251,10 +251,10 @@ int main(int argc, char *argv[])
                        }
                }
 
-               /* Dumps the results */
+               /* Dump the results */
                for (i = 0; i < ret; i++) {
 
-                       /* Prints the output byte by byte */
+                       /* Print the output byte by byte */
                        printf("0x%x ", buf[i]);
 
                        /* Unlike a4l_async_read(), a4l_sync_read() cannot
@@ -272,7 +272,7 @@ int main(int argc, char *argv[])
                        }
                }
 
-               /* Updates the count */
+               /* Update the count */
                cnt += ret;
        }
 
@@ -281,11 +281,11 @@ int main(int argc, char *argv[])
 
 out_insn_read:
 
-       /* Frees the information buffer */
+       /* Free the information buffer */
        if (dsc.sbdata != NULL)
                free(dsc.sbdata);
 
-       /* Releases the file descriptor */
+       /* Release the file descriptor */
        a4l_close(&dsc);
 
        return ret;


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

Reply via email to