[PARPORT] Parport IRQ triggering (rising or falling)?

From: Petter Reinholdtsen (pere@hungry.com)
Date: Thu Apr 06 2000 - 23:02:57 EDT

  • Next message: Tim Waugh: "Re: [PARPORT] inb (problems)"

    Do all parallel ports trigger on the same edge? My Compaq Armada
    7380DMT running RedHat 6.2 trigger on the logically rising edge (0->1)
    of ACK. Is this the same for all PCs? Is it different on other

    I wrote the following small module to test the triggering direction.
    I would be very pleased if anyone would test it on other PCs and
    non-PCs to check the ACK trigger edge.

     * Author: Petter Reinholdtsen <pere@td.org.uit.no>
     * Date: 2000-04-05
     * Parport IRQ triggering test module for Linux. Connect parport
     * STROBE (pin 1) and ACK (pin 10) with a wire, and load this module.
     * Loading will fail, but the module will report the IRQ triggering to
     * syslog.

    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/kernel.h>
    #include <linux/parport.h>

    struct testinfo
      struct parport *pport;
      struct pardevice *pdev;
      int transitions;
      int irq_count;
      int ack_set;

    static void __init
    test_irq_handler(int irq, void *dev, struct pt_regs *regs)
      struct testinfo *info = (struct testinfo *)dev;
      if (parport_read_status(info->pport) & PARPORT_STATUS_ACK)

    static void __init
    error(struct testinfo *info)
        printk(KERN_ERR "pptest: Unknown triggering on %s: "
               "#edges=%d #irq=%d #ack_set=%d \n",
               info->pport->name, info->transitions, info->irq_count, info->ack_set);
        printk(KERN_ERR "pptest: Did you forget to connect STROBE (pin 1) "
               "and ACK (pin 10)\n");

    static void __init
    test_parport(struct parport *port)
      int i;
      struct testinfo info;

      info.transitions = 10;
      info.irq_count = 0;
      info.ack_set = 0;
      info.pport = port;
      info.pdev = parport_register_device(port, "Parport IRQ test", NULL, NULL,
                                     test_irq_handler, 0, &info);
      if (NULL == info.pdev)
          printk(KERN_ERR "pptest: couldn't register for %s.\n", port->name);


      for (i = 0 ; i < info.transitions; i++)
          parport_frob_control(info.pport, PARPORT_CONTROL_STROBE,
                               i % 2 ? PARPORT_CONTROL_STROBE : 0);

      if (info.irq_count == info.transitions/2)
          if (info.irq_count == info.ack_set)
            printk(KERN_ERR "pptest: %s trigger on rising ACK (0->1)\n",
          else if (info.irq_count == info.transitions/2 - info.ack_set)
            printk(KERN_ERR "pptest: %s trigger on falling ACK (1->0)\n",


    static void __init
      struct parport *port;
      for (port = parport_enumerate(); port; port=port->next)

    #ifdef MODULE

    #if LINUX_VERSION_CODE >= 0x020117
    MODULE_AUTHOR("Petter Reinholdtsen <pere@td.org.uit.no>");
    MODULE_DESCRIPTION("Test if parport interrupts trigger on rising or falling ACK.");


    int __init
      return -ENODEV;


    ##>  Petter Reinholdtsen  <##  |  pere@td.org.uit.no

    -- 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 2b29 : Thu Apr 06 2000 - 23:02:19 EDT