[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080602145603.GG26854@enneenne.com>
Date: Mon, 2 Jun 2008 16:56:03 +0200
From: Rodolfo Giometti <giometti@...eenne.com>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: LinuxPPS low-level IRQs timestamps & ldisc
On Mon, Jun 02, 2008 at 03:02:57PM +0100, Alan Cox wrote:
> > It could be a bit better... I did as above since I supposed that you
> > wished all PPS code should be removed from serial port code.
>
> Ideally. But if it is genuinely the case that the serial port IRQ handler
> in some cases needs to do
>
> my_interrupt() {
> get_timestamp()
> frob_with_hardware()
> ld->dcd_change(blah, timestamp)
> }
>
> then that is still fairly clean and more importantly actually appears to
> work. I'd avoid all the ifdefs with this in the serial drivers that need
> more accuracy:
>
> {
> struct timespec ts;
> if (ld->dcd_change)
> getnstimeofday(&ts);
> existing tty stuff
> if (ld->dcd_change)
> ld->dcd_change(tty, status, &ts);
> }
I prefere avoid the if clause for getnstimeofday() since each
instruction delay may decrease time precision, so:
{
struct timespec ts;
getnstimeofday(&ts);
existing tty stuff
if (ld->dcd_change)
ld->dcd_change(tty, status, &ts);
}
In the wrost case the timestamp is not used.
> And in ld->dcd_change do
>
> struct timespec myts;
> /* Caller passed NULL meaning 'do your own timestamp' */
> if (ts == NULL) {
> ts = &myts;
> getnstimeofday(&myts);
> }
Ok.
> so for uart that would
>
> uart_dcd_change(struct uart_port *port, unsigned int status,
> struct timespec *ts) {
> {
> ...
> }
>
> passing the timestamp from the ttys own IRQ handler
Great!
Thanks,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@...eenne.com
Linux Device Driver giometti@...ux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists