Mailing List Archive

How to use register_serial ?
Hi folks...
We are developing a PCI board on which we have a 16550A UART.
Since we don't want to (re-?)implement all sublevel functions
for this serial device, we would like to use the existing
functionalities of the kernel.
We digged out the "register_serial" and "unregister_serial"
functions, and implemented a small kernel module which
at the moment just calls this functions with hardcoded
ioport and interupt:
...
int init_module(void)
{
struct serial_struct ss;
memset(&ss, 0, sizeof(ss));
ss.type = 0;
ss.line = 0;
ss.port = 0xb400;
ss.irq = 0x09;
ss.flags = 0;
ss.xmit_fifo_size = 0;
ss.custom_divisor = 0;
ss.close_delay = 0;
line = register_serial(&ss);
return 0;
}
void cleanup_module(void)
{
printk("kmu serial Testdriver closed\n");
if (line)
unregister_serial(line);
}
...
It seems to work fine, since the kernel messages are:
Jan 13 18:37:38 harlekin kernel: tty02 at 0xb400 (irq = 9) is a 16550A
Jan 13 18:37:56 harlekin kernel: tty02 unloaded
But how can we access this registered port from within the kernel ?
We've searched the mailing list archive for this with no luck...
Any ideas ?
Please CC your answer to me by email, since I am not subscribed
to this list.
Thanks in advance
Regards
Karsten
--
Karsten Müller kmu@ratio.de
RATIO Entwicklungen GmbH http://www.ratio.de
Admiralitätstr. 59 Tel.: +49 40 369007-20
20459 Hamburg
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
Re: How to use register_serial ? [ In reply to ]
Karsten Müller wrote:
>
> But how can we access this registered port from within the kernel ?
> We've searched the mailing list archive for this with no luck...
>
> Any ideas ?
>
look at drivers/net/irda/irtty.c
note: you must have some process open the serial port for you..
--
------------------------+--------------------------------------------------
Thomas Davis | PDSF Project Leader
tadavis@lbl.gov |
(510) 486-4524 | "Only a petabyte of data this year?"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
Re: How to use register_serial ? [ In reply to ]
> We digged out the "register_serial" and "unregister_serial"
> functions, and implemented a small kernel module which
> Jan 13 18:37:38 harlekin kernel: tty02 at 0xb400 (irq = 9) is a 16550A
> Jan 13 18:37:56 harlekin kernel: tty02 unloaded
>
> But how can we access this registered port from within the kernel ?
> We've searched the mailing list archive for this with no luck...
It should have appeared as ttyS2/cua2 in that case. Register serial walks
the port list looking for the first free port available. The return
value indicates the port allocated.
So if you had ttyS0/1/2/3 it would allocate 4.
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/