[LinuxPPS] http://lkml.org/lkml/2008/4/11/42

Cirilo Bernardo cirilo.bernardo at gmail.com
Sat Apr 19 00:26:25 CEST 2008


On Sat, Apr 19, 2008 at 1:16 AM, Udo van den Heuvel <udovdh at xs4all.nl> wrote:
[snip]
>  BTW: Besides the 'x86 lowlevel irq way' of obtaining timestamps (which
>  works well), could we just duplicate the serial code to some extent and
>  use that copy for the PPS stuff?
>  This driver could be as minimal as we like.
>
>  (I doubt that idea will be accepted at the lkml...)
>
The idea will probably not be liked by the kernel people, but you can
always try to convince them to change their minds.  That solution is
what I had to implement for my embedded system. I have a lot of
duplicated code, very few UARTs are supported, and the system
administrator needs to tell 'serialconfig' to use 'UART none' for the
devices which will be used by pps/gps.   The serial device code is
actually absolutely useless for pps/gps - not surprising because it
was written to handle serial terminals and modems and they have very
different requirements from pps/gps.

The other issue which has come up before when I mentioned dumping the
serial drivers is that many people use a single serial port for
multiple purposes; for example using the DCD pin coupled to the PPS of
a rubidium clock and the Tx/Rx pins connected to something completely
unrelated - for example an electronic barometer.

>  So what options do we have?
>
>  - Current approach
>  - Lowlevel x86-only irq method (works best for resolution)
>  - Copying the serial driver as I proposed above
>  - Alan's ldisc idea (how much does it differ?)
>  - ...

I suspect the best option is to rewrite the serial code for
timekeeping purposes and ignore the people who say "oh, but I want to
have a PPS on the DCD while running a gizmotronic 2008 on the same
serial line".  It will be complicated a bit since the following
variations are common:
1. Any of the other 2 interrupts can be used instead of DCD
2. Any interrupt can be used which is not related to the serial lines
(for example, the GPS board I use which uses an ISA interrupt line).
Even though the kernel people will almost certainly not like it, you
may still be able to push such a driver into the kernel on the grounds
that the serial terminal drivers really cannot meet the needs of
timekeeping.  Of course you will have to demonstrate the problem and
how the solution works much better and you will also have to fight the
people who like the current system because they can use the serial
port for multiple things.

I don't like the ldisc idea at all.  The timestamp should be created
when the IRQ is serviced.  The numerous layers and handlers inside the
TTY drivers make things unnecessarily complex and introduce a delay -
all for the sake of preserving the TTY code.  This is like using a
crowbar as a screwdriver just because it was already there and had
almost the right shape for the job.

- Cirilo



More information about the LinuxPPS mailing list