Adress from a serial device

I wrote a driver for digital IN/Output modules
(ADAM-Modules). In this driver, i use a direct inp/outp to the port. For a
better handling, i d’like to use a c-function to get the adress from the
port, like “stty < /dev/ser1”. The free source “stty.c”, from quantum, hase
includes from the qnx-version 2.15. Is there a newer function in the Watcom
10.6 to get the adress ??

Markus

Markus Brun <markus.brun@pup.ch> wrote:

I wrote a driver for digital IN/Output modules
(ADAM-Modules). In this driver, i use a direct inp/outp to the port. For a
better handling, i d’like to use a c-function to get the adress from the
port, like “stty < /dev/ser1”. The free source “stty.c”, from quantum, hase
includes from the qnx-version 2.15. Is there a newer function in the Watcom
10.6 to get the adress ??

stty sends a message to Dev.ser – which is a hardware driver that knows
how to auto-detect a few ports, and if it doesn’t find those, it doesn’t
handle the serial ports unless you specify their addresses on its command
line. That is, stty isn’t a hardware query and the source it uses won’t
help you – you’d still have to write the driver that answers the message
the stty uses to ask for the information.

If your device is a PCI device, though, you can use the CA_PCI* bios
functions to query the PCI bios to determine the configuration (io ports,
irqs, memory addresses etc) for your card.

If it is an ISA card, your stuck with command line options or hard coding
it into your driver – either that or an auto-detect routine, where you
write a bunch of potential ports, and check to see if you get the right
response. Of course, if you are auto-detecting, you better be mighty
careful you don’t hit some other hardware in a way that will upset it.
(NE1000/2000 cards or clones are particularly susceptible to this problem,
and can crash a machine if accessed improperly. I think that most QSSL
trapper programs first trap for an NE1000/2000, and if they find it, avoid
that(those) ioport(s) in trapping for their own devices.)

-David