Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jun 2022 13:03:19 +0200
From:      Sebastian Huber <sebastian.huber@embedded-brains.de>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        hackers@freebsd.org
Subject:   Re: pps_capture() and pps_fetch()
Message-ID:  <e1093df0-c719-0421-3e96-c6d7df861a51@embedded-brains.de>
In-Reply-To: <202206010725.2517PEfF036703@critter.freebsd.dk>
References:  <5b8310db-c94b-709f-8c57-bec2d413a80f@embedded-brains.de> <202206010725.2517PEfF036703@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Poul-Henning,

On 01/06/2022 09:25, Poul-Henning Kamp wrote:
> Sebastian Huber writes:
>=20
>> I try to understand how the PPS synchronization works in FreeBSD. It
>> seems that pps_capture() starts a transaction and pps_event() complete=
s
>> the transaction if nothing interfered in the meantime.
> The answer to most of your questions are in ./i386/i386/elan-mmcr.c
>=20
> The PPS capture in the Soekris 4501 used two hardware counters, countin=
g at the same rate.
>=20
> The first of the two were the timecounter, the other was started by the=
 hardware signal.
>=20
> Sometime later the hardware signals interrupt processing would happen.
>=20
> By reading read both counters as close to instantaneously as possible, =
and compensated for the interrupt latency by subtracting the event-starte=
d counter from the timecounter.
>=20
> (See also:http://phk.freebsd.dk/soekris/pps/)

thanks for the background information.

What I don't understand is why the th_generation is checked three times=20
(pps_capture(): 1, pps_event(): 2) and not only once in pps_event()=20
right before we use the captured time.

--=20
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht M=C3=BCnchen
Registernummer: HRB 157899
Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas=
 D=C3=B6rfler
Unsere Datenschutzerkl=C3=A4rung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e1093df0-c719-0421-3e96-c6d7df861a51>