€•¯Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ"/translations/zh_CN/driver-api/pps”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/zh_TW/driver-api/pps”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/it_IT/driver-api/pps”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ja_JP/driver-api/pps”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ko_KR/driver-api/pps”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/pt_BR/driver-api/pps”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/sp_SP/driver-api/pps”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³Œ”h]”(hŒ%Copyright (C) 2007 Rodolfo Giometti <”…””}”(hhßh²hh³Nh´NubhŒ reference”“”)”}”(hŒgiometti@enneenne.com”h]”hŒgiometti@enneenne.com”…””}”(hhéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:giometti@enneenne.com”uh1hçhhßubhŒ>”…””}”(hhßh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhÞ)”}”(hŒïThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.”h]”hŒïThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hhÊh²hubhÞ)”}”(hŒéThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.”h]”hŒéThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhÉ)”}”(hhh]”(hÎ)”}”(hŒOverview”h]”hŒOverview”…””}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´KubhÞ)”}”(hŒ\LinuxPPS provides a programming interface (API) to define in the system several PPS sources.”h]”hŒ\LinuxPPS provides a programming interface (API) to define in the system several PPS sources.”…””}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjh²hubhÞ)”}”(hŒ°PPS means "pulse per second" and a PPS source is just a device which provides a high precision signal each second so that an application can use it to adjust system clock time.”h]”hŒ´PPS means “pulse per second†and a PPS source is just a device which provides a high precision signal each second so that an application can use it to adjust system clock time.”…””}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjh²hubhÞ)”}”(hX/A PPS source can be connected to a serial port (usually to the Data Carrier Detect pin) or to a parallel port (ACK-pin) or to a special CPU's GPIOs (this is the common case in embedded systems) but in each case when a new pulse arrives the system must apply to it a timestamp and record it for userland.”h]”hX1A PPS source can be connected to a serial port (usually to the Data Carrier Detect pin) or to a parallel port (ACK-pin) or to a special CPU’s GPIOs (this is the common case in embedded systems) but in each case when a new pulse arrives the system must apply to it a timestamp and record it for userland.”…””}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjh²hubhÞ)”}”(hŒ©Common use is the combination of the NTPD as userland program, with a GPS receiver as PPS source, to obtain a wallclock-time with sub-millisecond synchronisation to UTC.”h]”hŒ©Common use is the combination of the NTPD as userland program, with a GPS receiver as PPS source, to obtain a wallclock-time with sub-millisecond synchronisation to UTC.”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K%hjh²hubeh}”(h]”Œoverview”ah ]”h"]”Œoverview”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒRFC considerations”h]”hŒRFC considerations”…””}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjph²hh³hÇh´K+ubhÞ)”}”(hŒ“While implementing a PPS API as RFC 2783 defines and using an embedded CPU GPIO-Pin as physical link to the signal, I encountered a deeper problem:”h]”hŒ“While implementing a PPS API as RFC 2783 defines and using an embedded CPU GPIO-Pin as physical link to the signal, I encountered a deeper problem:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K-hjph²hubhŒ block_quote”“”)”}”(hŒVAt startup it needs a file descriptor as argument for the function time_pps_create(). ”h]”hÞ)”}”(hŒUAt startup it needs a file descriptor as argument for the function time_pps_create().”h]”hŒUAt startup it needs a file descriptor as argument for the function time_pps_create().”…””}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K1hj‘ubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K1hjph²hubhÞ)”}”(hX¼This implies that the source has a /dev/... entry. This assumption is OK for the serial and parallel port, where you can do something useful besides(!) the gathering of timestamps as it is the central task for a PPS API. But this assumption does not work for a single purpose GPIO line. In this case even basic file-related functionality (like read() and write()) makes no sense at all and should not be a precondition for the use of a PPS API.”h]”hX¼This implies that the source has a /dev/... entry. This assumption is OK for the serial and parallel port, where you can do something useful besides(!) the gathering of timestamps as it is the central task for a PPS API. But this assumption does not work for a single purpose GPIO line. In this case even basic file-related functionality (like read() and write()) makes no sense at all and should not be a precondition for the use of a PPS API.”…””}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K4hjph²hubhÞ)”}”(hŒrThe problem can be simply solved if you consider that a PPS source is not always connected with a GPS data source.”h]”hŒrThe problem can be simply solved if you consider that a PPS source is not always connected with a GPS data source.”…””}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K /sys/class/pps-gen/pps-gen0/enable”h]”hŒ-$ echo 1 > /sys/class/pps-gen/pps-gen0/enable”…””}”hj:sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jKh³hÇh´Kóhjãh²hubeh}”(h]”Œgenerators-sysfs-support”ah ]”h"]”Œgenerators sysfs support”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KäubhÉ)”}”(hhh]”(hÎ)”}”(hŒParallel port generator”h]”hŒParallel port generator”…””}”(hjSh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjPh²hh³hÇh´KöubhÞ)”}”(hX2One way to do this is to invent some complicated hardware solutions but it may be neither necessary nor affordable. The cheap way is to load a PPS generator on one of the computers (master) and PPS clients on others (slaves), and use very simple cables to deliver signals using parallel ports, for example.”h]”hX2One way to do this is to invent some complicated hardware solutions but it may be neither necessary nor affordable. The cheap way is to load a PPS generator on one of the computers (master) and PPS clients on others (slaves), and use very simple cables to deliver signals using parallel ports, for example.”…””}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KøhjPh²hubhÞ)”}”(hŒParallel port cable pinout::”h]”hŒParallel port cable pinout:”…””}”(hjoh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KþhjPh²hubjL)”}”(hXapin name master slave 1 STROBE *------ * 2 D0 * | * 3 D1 * | * 4 D2 * | * 5 D3 * | * 6 D4 * | * 7 D5 * | * 8 D6 * | * 9 D7 * | * 10 ACK * ------* 11 BUSY * * 12 PE * * 13 SEL * * 14 AUTOFD * * 15 ERROR * * 16 INIT * * 17 SELIN * * 18-25 GND *-----------*”h]”hXapin name master slave 1 STROBE *------ * 2 D0 * | * 3 D1 * | * 4 D2 * | * 5 D3 * | * 6 D4 * | * 7 D5 * | * 8 D6 * | * 9 D7 * | * 10 ACK * ------* 11 BUSY * * 12 PE * * 13 SEL * * 14 AUTOFD * * 15 ERROR * * 16 INIT * * 17 SELIN * * 18-25 GND *-----------*”…””}”hj}sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jKh³hÇh´MhjPh²hubhÞ)”}”(hX´Please note that parallel port interrupt occurs only on high->low transition, so it is used for PPS assert edge. PPS clear edge can be determined only using polling in the interrupt handler which actually can be done way more precisely because interrupt handling delays can be quite big and random. So current parport PPS generator implementation (pps_gen_parport module) is geared towards using the clear edge for time synchronization.”h]”hX´Please note that parallel port interrupt occurs only on high->low transition, so it is used for PPS assert edge. PPS clear edge can be determined only using polling in the interrupt handler which actually can be done way more precisely because interrupt handling delays can be quite big and random. So current parport PPS generator implementation (pps_gen_parport module) is geared towards using the clear edge for time synchronization.”…””}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MhjPh²hubhÞ)”}”(hXvClear edge polling is done with disabled interrupts so it's better to select delay between assert and clear edge as small as possible to reduce system latencies. But if it is too small slave won't be able to capture clear edge transition. The default of 30us should be good enough in most situations. The delay can be selected using 'delay' pps_gen_parport module parameter.”h]”hX~Clear edge polling is done with disabled interrupts so it’s better to select delay between assert and clear edge as small as possible to reduce system latencies. But if it is too small slave won’t be able to capture clear edge transition. The default of 30us should be good enough in most situations. The delay can be selected using ‘delay’ pps_gen_parport module parameter.”…””}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MhjPh²hubeh}”(h]”Œparallel-port-generator”ah ]”h"]”Œparallel port generator”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KöubhÉ)”}”(hhh]”(hÎ)”}”(hŒ$Intel Timed I/O PPS signal generator”h]”hŒ$Intel Timed I/O PPS signal generator”…””}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj¯h²hh³hÇh´M#ubhÞ)”}”(hŒpIntel Timed I/O is a high precision device, present on 2019 and newer Intel CPUs, that can generate PPS signals.”h]”hŒpIntel Timed I/O is a high precision device, present on 2019 and newer Intel CPUs, that can generate PPS signals.”…””}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M%hj¯h²hubhÞ)”}”(hXŸTimed I/O and system time are both driven by same hardware clock. The signal is generated with a precision of ~20 nanoseconds. The generated PPS signal is used to synchronize an external device with system clock. For example, it can be used to share your clock with a device that receives PPS signal, generated by Timed I/O device. There are dedicated Timed I/O pins to deliver the PPS signal to an external device.”h]”hXŸTimed I/O and system time are both driven by same hardware clock. The signal is generated with a precision of ~20 nanoseconds. The generated PPS signal is used to synchronize an external device with system clock. For example, it can be used to share your clock with a device that receives PPS signal, generated by Timed I/O device. There are dedicated Timed I/O pins to deliver the PPS signal to an external device.”…””}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M(hj¯h²hubhÞ)”}”(hŒ*Usage of Intel Timed I/O as PPS generator:”h]”hŒ*Usage of Intel Timed I/O as PPS generator:”…””}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M/hj¯h²hubhÞ)”}”(hŒStart generating PPS signal::”h]”hŒStart generating PPS signal:”…””}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M1hj¯h²hubjL)”}”(hŒ,$echo 1 > /sys/class/pps-gen/pps-genx/enable”h]”hŒ,$echo 1 > /sys/class/pps-gen/pps-genx/enable”…””}”hjøsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jKh³hÇh´M3hj¯h²hubhÞ)”}”(hŒStop generating PPS signal::”h]”hŒStop generating PPS signal:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M5hj¯h²hubjL)”}”(hŒ,$echo 0 > /sys/class/pps-gen/pps-genx/enable”h]”hŒ,$echo 0 > /sys/class/pps-gen/pps-genx/enable”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jKh³hÇh´M7hj¯h²hubeh}”(h]”Œ$intel-timed-i-o-pps-signal-generator”ah ]”h"]”Œ$intel timed i/o pps signal generator”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´M#ubeh}”(h]”Œpps-pulse-per-second”ah ]”h"]”Œpps - pulse per second”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jUŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j/j,jmjjjæjãj)j&jìjéjàjÝjsjpjàjÝjMjJj¬j©j'j$uŒ nametypes”}”(j/‰jm‰jæ‰j)‰jì‰jà‰js‰jà‰jM‰j¬‰j'‰uh}”(j,hÊjjjjãjpj&jéjéj,jÝjïjpjãjÝjvjJjãj©jPj$j¯uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.