@@ -202,6 +202,46 @@ Sometimes one needs to be able not only to catch PPS signals but to produce
202
202
them also. For example, running a distributed simulation, which requires
203
203
computers' clock to be synchronized very tightly.
204
204
205
+ To do so the class pps-gen has been added. PPS generators can be
206
+ registered in the kernel by defining a struct pps_gen_source_info as
207
+ follows::
208
+
209
+ static struct pps_gen_source_info pps_gen_dummy_info = {
210
+ .name = "dummy",
211
+ .use_system_clock = true,
212
+ .get_time = pps_gen_dummy_get_time,
213
+ .enable = pps_gen_dummy_enable,
214
+ };
215
+
216
+ Where the use_system_clock states if the generator uses the system
217
+ clock to generate its pulses, or they are from a peripheral device
218
+ clock. Method get_time() is used to query the time stored into the
219
+ generator clock, while the method enable() is used to enable or
220
+ disable the PPS pulse generation.
221
+
222
+ Then calling the function pps_gen_register_source() in your
223
+ initialization routine as follows creates a new generator in the
224
+ system::
225
+
226
+ pps_gen = pps_gen_register_source(&pps_gen_dummy_info);
227
+
228
+ Generators SYSFS support
229
+ ------------------------
230
+
231
+ If the SYSFS filesystem is enabled in the kernel it provides a new class::
232
+
233
+ $ ls /sys/class/pps-gen/
234
+ pps-gen0/ pps-gen1/ pps-gen2/
235
+
236
+ Every directory is the ID of a PPS generator defined in the system and
237
+ inside of it you find several files::
238
+
239
+ $ ls -F /sys/class/pps-gen/pps-gen0/
240
+ dev enable name power/ subsystem@ system time uevent
241
+
242
+ To enable the PPS signal generation you can use the command below::
243
+
244
+ $ echo 1 > /sys/class/pps-gen/pps-gen0/enable
205
245
206
246
Parallel port generator
207
247
------------------------
0 commit comments