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

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Wed Nov 11 17:39:01 2009 +0100

analogy: use the A4L_INSN_* constants to configure the DIO subdevice

---

 ksrc/drivers/analogy/intel/parport.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ksrc/drivers/analogy/intel/parport.c 
b/ksrc/drivers/analogy/intel/parport.c
index a1a1625..735656c 100644
--- a/ksrc/drivers/analogy/intel/parport.c
+++ b/ksrc/drivers/analogy/intel/parport.c
@@ -118,13 +118,30 @@ static int parport_insn_config_a(a4l_subd_t *subd, 
a4l_kinsn_t *insn)
        a4l_dev_t *dev = subd->dev;
        parport_spriv_t *spriv = (parport_spriv_t *)subd->priv;
 
-       if (insn->data[0]) {
+       /* No need to check the channel descriptor; the input / output
+          setting is global for all channels */
+
+       switch (insn->data[0]) {
+
+       case A4L_INSN_CONFIG_DIO_OUTPUT:
                spriv->io_bits = 0xff;
-               devpriv->c_data &= ~(1 << 5);
-       } else {
+               devpriv->c_data &= ~(1 << 5);           
+               break;
+
+       case A4L_INSN_CONFIG_DIO_INPUT:
                spriv->io_bits = 0;
                devpriv->c_data |= (1 << 5);
+               break;
+
+       case A4L_INSN_CONFIG_DIO_QUERY:
+               insn->data[1] = (spriv->io_bits == 0xff) ? 
+                       A4L_OUTPUT: A4L_INPUT;
+               break;
+
+       default:
+               return -EINVAL;
        }
+
        outb(devpriv->c_data, devpriv->io_base + PARPORT_C);
 
        return 0;


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

Reply via email to