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

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Wed Dec  9 22:40:30 2009 +0100

analogy: fix wrong names of conversion functions

---

 include/analogy/analogy.h     |   10 ++++------
 src/drvlib/analogy/range.c    |   14 +++++++-------
 src/utils/analogy/insn_read.c |    2 +-
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/include/analogy/analogy.h b/include/analogy/analogy.h
index 8d11047..21c7e59 100644
--- a/include/analogy/analogy.h
+++ b/include/analogy/analogy.h
@@ -136,13 +136,11 @@ int a4l_find_range(a4l_desc_t * dsc,
                   unsigned long unit,
                   double min, double max, a4l_rnginfo_t ** rng);
 
-int a4l_to_phys(a4l_chinfo_t * chan,
-               a4l_rnginfo_t * rng, double *dst, void *src,
-               int cnt);
-    
 int a4l_from_phys(a4l_chinfo_t * chan,
-                 a4l_rnginfo_t * rng, void *dst, double *src,
-                 int cnt);
+                 a4l_rnginfo_t * rng, double *dst, void *src, int cnt);
+
+int a4l_to_phys(a4l_chinfo_t * chan,
+               a4l_rnginfo_t * rng, void *dst, double *src, int cnt);
 
 #endif /* !DOXYGEN_CPP */
 
diff --git a/src/drvlib/analogy/range.c b/src/drvlib/analogy/range.c
index ab41f1e..72293b9 100644
--- a/src/drvlib/analogy/range.c
+++ b/src/drvlib/analogy/range.c
@@ -143,7 +143,7 @@ out_get_range:
 }
 
 /**
- * @brief Convert samples to physical units
+ * @brief Convert physical units to samples
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
@@ -160,8 +160,8 @@ out_get_range:
  *    before using a4l_to_phys()
  *
  */
-int a4l_to_phys(a4l_chinfo_t * chan,
-               a4l_rnginfo_t * rng, double *dst, void *src, int cnt)
+int a4l_from_phys(a4l_chinfo_t * chan,
+                 a4l_rnginfo_t * rng, double *dst, void *src, int cnt)
 {
        int i = 0, j = 0;
        lsampl_t tmp;
@@ -197,7 +197,7 @@ int a4l_to_phys(a4l_chinfo_t * chan,
                (((1ULL << chan->nb_bits) - 1) * A4L_RNG_FACTOR);
        b = (double)rng->min / A4L_RNG_FACTOR;
 
-       while (i < cnt) {
+       while (j < cnt) {
 
                /* Properly retrieves the data */
                tmp = datax_get(src + i);
@@ -214,7 +214,7 @@ int a4l_to_phys(a4l_chinfo_t * chan,
 }
 
 /**
- * @brief Convert physical units to samples
+ * @brief Convert samples to physical units
  *
  * @param[in] chan Channel descriptor
  * @param[in] rng Range descriptor
@@ -231,7 +231,7 @@ int a4l_to_phys(a4l_chinfo_t * chan,
  *    before using a4l_from_phys()
  *
  */
-int a4l_from_phys(a4l_chinfo_t * chan,
+int a4l_to_phys(a4l_chinfo_t * chan,
                  a4l_rnginfo_t * rng, void *dst, double *src, int cnt)
 {
        int i = 0, j = 0;
@@ -268,7 +268,7 @@ int a4l_from_phys(a4l_chinfo_t * chan,
        b = ((double)(rng->min) / (rng->max - rng->min)) *
                ((1ULL << chan->nb_bits) - 1);
 
-       while (i < cnt) {
+       while (j < cnt) {
 
                /* Performs the conversion */
                datax_set(dst + i, (lsampl_t) (a * src[j] - b));
diff --git a/src/utils/analogy/insn_read.c b/src/utils/analogy/insn_read.c
index 50f2c98..d5e025d 100644
--- a/src/utils/analogy/insn_read.c
+++ b/src/utils/analogy/insn_read.c
@@ -245,7 +245,7 @@ int main(int argc, char *argv[])
 
                /* If a range was selected, converts the samples */
                if (idx_rng >= 0) {
-                       if (a4l_to_phys(chinfo, rnginfo, dbuf, buf, ret) < 0) {
+                       if (a4l_from_phys(chinfo, rnginfo, dbuf, buf, ret) < 0) 
{
                                fprintf(stderr,
                                        "insn_read: data conversion failed 
(ret=%d)\n",
                                        ret);


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

Reply via email to