1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * PPS generator API header
4  *
5  * Copyright (C) 2024 Rodolfo Giometti <[email protected]>
6  */
7 
8 #ifndef _PPS_GEN_H_
9 #define _PPS_GEN_H_
10 
11 #include <linux/types.h>
12 #include <linux/ioctl.h>
13 
14 /**
15  * struct pps_gen_event - the PPS generator events
16  * @event: the event type
17  * @sequence: the event sequence number
18  *
19  * Userspace can get the last PPS generator event by using the
20  * ioctl(pps_gen, PPS_GEN_FETCHEVENT, ...) syscall.
21  * The sequence field can be used to save the last event ID, while in the
22  * event field is stored the last event type. Currently known event is:
23  *
24  *     PPS_GEN_EVENT_MISSEDPULSE	: last pulse was not generated
25  */
26 struct pps_gen_event {
27 	unsigned int event;
28 	unsigned int sequence;
29 };
30 
31 #define PPS_GEN_EVENT_MISSEDPULSE	1
32 
33 #define PPS_GEN_SETENABLE		_IOW('p', 0xb1, unsigned int *)
34 #define PPS_GEN_USESYSTEMCLOCK		_IOR('p', 0xb2, unsigned int *)
35 #define PPS_GEN_FETCHEVENT		_IOR('p', 0xb3, struct pps_gen_event *)
36 
37 #endif /* _PPS_GEN_H_ */
38