[LinuxPPS] Considerations on pps_event()

Rodolfo Giometti giometti at enneenne.com
Tue Feb 20 09:52:04 CET 2007


Hello,

looking at serial code I'm thinking about the possibility to add a
special version of the pps_event function, that is the couple:

   pps_get_timestamp(struct timespec *ts);

   pps_event_ts(int source, int event, struct timespec *ts, void *data)

By using these functions we can do:

static inline void
uart_handle_dcd_change(struct uart_port *port, unsigned int status)
{
        struct uart_info *info = port->info;
#ifdef CONFIG_PPS
	struct timespec ts;

	pps_get_timestamp(&ts);

        if (port->flags & UPF_HARDPPS_CD) {
                if (status) {
                        pps_event_ts(up->port.pps_source, PPS_CAPTUREASSERT, &ts, port);
                        dbg("serial8250: PPS assert event at %lu on source #%d",
                                jiffies, up->port.pps_source);
                }
                else {
                        pps_event_ts(up->port.pps_source, PPS_CAPTURECLEAR, &ts, port);
                        dbg("serial8250: PPS clear event at %lu on source #%d",
                                jiffies, up->port.pps_source);
                }
        }
#endif

        port->icount.dcd++;

        if (info->flags & UIF_CHECK_CD) {
        ...

In this manner we anticipate the timestamp recording of few
instructions: some if clauses and a function call, since the
pps_get_timestamp() could be implemented as a define.

I'm asking to myself if this could improve the PPS resolution...

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti at enneenne.com
Linux Device Driver                             giometti at gnudd.com
Embedded Systems                     		giometti at linux.it
UNIX programming                     phone:     +39 349 2432127



More information about the LinuxPPS mailing list