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

Using par0 for I/O and building a new kernel/image

Hi Folks!

I want to use lp0/par0 for driving LED's and read from a few switches.

If i use this code for switching on some of the LED's:

  devfd = open("/dev/lp0", O_RDWR);
  ioctl(devfd, _IO(ETRAXGPIO_IOCTYPE, IO_SETBITS), 1+4+16+64);
  ioctl(devfd, _IO(ETRAXGPIO_IOCTYPE, IO_CLRBITS), 2+8+32+128);
  close( devfd );

The LED's on d0 to d4 will only flicker and are still all on.
Description of my circuit:
  from d0 (..d4) output i go via a 18kOhm resistor in the base of the
  The emitter of the transistor is connected to ground.
  The kollektor is connected to a 180Ohm resistor.
  The 180Ohm resistor is connected to a LED.
  And the LED is connected to 3,3V.

After switching on the axis-board all LED's are on, cause the output
pin's d0..d7 are all high.
(there are 4,7kOhm resistors on the borad going to +3,3V, and the output
of the lp0-buffer-chip is high (open collektor))

So i think my circuit is correct.

1. Question: Why is the output automatically going to high on all output
pin (d0..d7) after the ioctl-command?
2. Question: Is there an interrupt-call going on, if i set/clr some
output-pins, and does the lp0-driver then set these pin back to high?
    (If i look at the LED's at the same time the ioctl-commands are
executed i can see, that the LED's are off an extremly short time.)

I tried this code before:

It only works, if these two commands are executed with 'no' commands
between, but the first command takes really long (maybe 10msec).
(These are the same commands used in the file

3. Question: Is it possible to set/clr bits using the first code with
ioctl or another way using /dev/lp0?? What's wrong with my code?

4. Question: Is it only possible to set/clr bits using the hardware
register (like in etrax100pardata.c)?
5. Question: If so, do i need to have a new kernel installed on the
devboard with lp0-support switched off?
6. Question: If so, what are the detailed steps for configuring /
building / installing the new kernel for/on the devboard?

I know, these are a lot of questions, but i didn't find the needed
information on the developer.axis.com-website.
I think the documentation on the developer-website from axis needs to be
updated, cause this info's are needed from very much developers.

Thanx for reading and posting answers!!!

Greetings to all developers,
    Stefan Weilhartner

tel;cell:+43 664 3106170
tel;fax:+43 732 771111-111
tel;home:+43 664 3106170
tel;work:+43 664 3106170
org:EINS - Einführung integrierter EDV-Systeme
adr;quoted-printable:;;Gruberstrasse 2-4;Linz;Oberösterreich;4020;=D6sterreich
fn:Weilhartner Stefan