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

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Sat Nov 21 01:22:28 2009 +0100

analogy: report scan size miscalculation fix in cmd_write and insn_*

---

 src/utils/analogy/cmd_write.c  |    3 ++-
 src/utils/analogy/insn_read.c  |    3 ++-
 src/utils/analogy/insn_write.c |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/utils/analogy/cmd_write.c b/src/utils/analogy/cmd_write.c
index 95b23c8..05b648a 100644
--- a/src/utils/analogy/cmd_write.c
+++ b/src/utils/analogy/cmd_write.c
@@ -243,7 +243,8 @@ int main(int argc, char *argv[])
                        printf("\t range's size = %d (bits)\n", info->nb_bits);
                }
 
-               scan_size += info->nb_bits / 8;
+               scan_size += (info->nb_bits % 8 == 0) ? 
+                       info->nb_bits / 8 : (info->nb_bits / 8) + 1;
        }
 
        if (verbose != 0) {
diff --git a/src/utils/analogy/insn_read.c b/src/utils/analogy/insn_read.c
index bd203a0..f4029be 100644
--- a/src/utils/analogy/insn_read.c
+++ b/src/utils/analogy/insn_read.c
@@ -212,7 +212,8 @@ int main(int argc, char *argv[])
        }
 
        /* Set the data size to read */
-       scan_size *= chinfo->nb_bits / 8;
+       scan_size *= (chinfo->nb_bits % 8 == 0) ? 
+               chinfo->nb_bits / 8 : (chinfo->nb_bits / 8) + 1;
 
        if (verbose != 0) {
                printf("insn_read: channel width is %u bits\n",
diff --git a/src/utils/analogy/insn_write.c b/src/utils/analogy/insn_write.c
index 007ef4a..f5bda70 100644
--- a/src/utils/analogy/insn_write.c
+++ b/src/utils/analogy/insn_write.c
@@ -212,7 +212,8 @@ int main(int argc, char *argv[])
        }
 
        /* Set the data size to write */
-       scan_size *= chinfo->nb_bits / 8;
+       scan_size *= (chinfo->nb_bits % 8 == 0) ? 
+               chinfo->nb_bits / 8 : (chinfo->nb_bits / 8) + 1;
 
        if (verbose != 0) {
                printf("insn_write: channel width is %u bits\n",


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

Reply via email to