Re: [PARPORT] User-space parport driver 0.4


Andrea Arcangeli (arcangeli@mbox.queen.it)
Thu, 26 Feb 1998 17:36:57 +0100 (CET)


On Sun, 22 Feb 1998, Tim Waugh wrote:

>An updated version of ppuser can be found at:
>
> <http://www.cyberelk.demon.co.uk/parport/ppuser-0.4.tar.gz>
>and <ftp://ftp.torque.net/pub/parport/ppuser-0.4.tar.gz> (shortly)
>
>Please take a look and send me your comments.

I added the yield ioctls. ppuser should be also preemptive in order to
wake_up_interruptible(pp->irq_wait) when it' s sleeping on an irq that
doesn' t arrive as lp does, in order to avoid starvation. I will take a
look at this soon.

Andrea[s] Arcangeli

--- ppuser/ppuser.c 1998/02/26 15:20:50 1.1
+++ ppuser/ppuser.c 1998/02/26 16:25:10 1.2
@@ -236,6 +236,28 @@
                 return 0;
         }
 
+ if (cmd == PPYIELD) {
+ int retval;
+ if ((pp_table[minor].flags & PP_CLAIMED) == 0) {
+ printk (KERN_DEBUG
+ "ppuser%d: you don't have it!\n", minor);
+ return -EINVAL;
+ }
+ retval = parport_yield (pp_table[minor].pdev);
+ if (retval == -EAGAIN)
+ pp_table[minor].flags &= ~PP_CLAIMED;
+ return retval;
+ }
+
+ if (cmd == PPYIELD_BLOCKING) {
+ if ((pp_table[minor].flags & PP_CLAIMED) == 0) {
+ printk (KERN_DEBUG
+ "ppuser%d: you don't have it!\n", minor);
+ return -EINVAL;
+ }
+ return parport_yield_blocking (pp_table[minor].pdev);
+ }
+
         if ((pp_table[minor].flags & PP_CLAIMED) == 0) {
                 printk (KERN_DEBUG "ppuser%d: claim the port first\n", minor);
                 return -EPERM;
@@ -313,7 +335,7 @@
 static void pp_irq (int irq, void * private, struct pt_regs * unused)
 {
         struct pp_struct * pp = (struct pp_struct *) private;
- wake_up (&pp->irq_wait);
+ wake_up_interruptible (&pp->irq_wait);
 }
 
 static int pp_open (struct inode * inode, struct file * file)
@@ -360,7 +382,6 @@
         }
 
         pp_table[minor].pdev = pdev;
- init_waitqueue (&pp_table[minor].irq_wait);
         printk (KERN_DEBUG "%s: registered pardevice\n", name);
         return 0;
 }
--- ppuser/ppuser.h 1998/02/26 16:28:35 1.1
+++ ppuser/ppuser.h 1998/02/26 16:28:43
@@ -35,3 +35,7 @@
 
 /* Release the port when you aren't using it */
 #define PPRELEASE _IO(PP_IOCTL, 0x8c)
+
+/* Yield the port */
+#define PPYIELD _IO(PP_IOCTL, 0x8d)
+#define PPYIELD_BLOCKING _IO(PP_IOCTL, 0x8e)

-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --



This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:17:30 EST