Example "short" of LDD / Parallel port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I'm trying to run the example "short" of LDD3.
It doesn't work with the parallel port.

The parallel port is ok, and the circuit for testing is ok.

I run a counter in user-space and it works[1].

If I enable the interrupts and I set the line 10 to
1 (using the output of the data7 bit, see [2]) then it
generates the interrupts (I verified using /proc/interrupts).


The problem is that when I try to run the example, I have
to unload the module parport_pc, and then I can hook the interrupt
handler of the example of LDD, but somehow I cannot write to it.
I tried to make the simplest code that would work, but it does not.
Note that when I unload module parport_pc, the kernel logs the
following message:

pnp: Device 00:07 disabled.

So it might be the problem. I have Linux  2.6.16 (Debian).

What should I try?


This is the code I tested:

http://svn.arhuaco.org/svn/src/linux/examples/modules/parallel/par.c

I expect the initialization function to set the output bits to 1
but nothing happens.

(from /proc/interrupts)
 7:         0          0    IO-APIC-edge  par

The lines

    outb(0x10,par_base+2);
    outb(0xFF,par_base);

In the following snippet of code don't work.

What should I do? I need to use an interrupt for a training course. I
could also use User Mode LInux but I don't know how[3]. Not yet. I'd
like to use the real parallel port.

Regards,
Nelson.-

int par_init(void)
{
 int result;


 if (!request_region(par_base, NPORTS, "par")) /* puertos */
 {
   printk(KERN_INFO "par: No pude obtener dirección del puerto de I/O
0x%lx\n", par_base);
   return -ENODEV;
 }

 result = register_chrdev(major, "par", &par_fops);

 if (result < 0) /* Dinámico */
 {
   printk(KERN_INFO "par: can't get major number\n");
   release_region(par_base, NPORTS);
   return result;
 }

 if (major == 0)
   major = result;

  par_irq = 7;

  result = request_irq(par_irq, par_interrupt, SA_INTERRUPT, "par", NULL);

  if (result)
  {
    printk(KERN_INFO "par: No pude obtener la IRQ%i\n", par_irq);
			par_irq = -1;
  }
  else
  {
    outb(0x10,par_base+2);
    outb(0xFF,par_base);
    udelay(5);
  }

 return 0;
}

Thanks,
Nelson.-


[1]http://svn.arhuaco.org/svn/src/linux/examples/modules/parallel/count.c
[2]http://svn.arhuaco.org/svn/src/linux/examples/modules/parallel/enable-intr.c
[3]http://marc.theaimsgroup.com/?l=user-mode-linux-user&m=115014526626964&w=2
--
http://arhuaco.org/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux