libptpmgmt  1.3
libptpmgmt library that provides the functionality of linuxptp pmc
ptp.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later
2  SPDX-FileCopyrightText: Copyright © 2023 Erez Geva <ErezGeva2@gmail.com> */
3 
12 #ifndef __PTPMGMT_C_IF_H
13 #define __PTPMGMT_C_IF_H
14 
15 #include <time.h>
16 #ifdef __linux__
17 #include <linux/ptp_clock.h>
18 #endif
19 
22 
24 typedef const struct ptpmgmt_ifInfo_t *const_ptpmgmt_ifInfo;
25 
32  void *_this;
38  void (*free)(ptpmgmt_ifInfo i);
45  bool (*initUsingName)(ptpmgmt_ifInfo i, const char *ifName);
70  const char *(*ifName)(const_ptpmgmt_ifInfo i);
76  const uint8_t *(*mac)(const_ptpmgmt_ifInfo i);
92 };
93 
99 
102 
104 typedef const struct ptpmgmt_clock_t *const_ptpmgmt_clock;
105 
112  void *_this;
119  void (*free)(ptpmgmt_clock clk);
120 
126  struct timespec(*getTime)(const_ptpmgmt_clock clk);
133  bool (*setTime)(const_ptpmgmt_clock clk, const struct timespec *ts);
140  bool (*offsetClock)(const_ptpmgmt_clock clk, int64_t offset);
146  double (*getFreq)(const_ptpmgmt_clock clk);
153  bool (*setFreq)(const_ptpmgmt_clock clk, double freq);
160  bool (*setPhase)(const_ptpmgmt_clock clk, int64_t offset);
167  bool (*isCharFile)(const char *file);
175  bool (*initUsingDevice)(ptpmgmt_clock clk, const char *device, bool readonly);
183  bool (*initUsingIndex)(ptpmgmt_clock clk, int ptpIndex, bool readonly);
195  clockid_t (*clkId)(const_ptpmgmt_clock clk);
220  const char *(*device)(const_ptpmgmt_clock clk);
239  bool (*fetchCaps)(const_ptpmgmt_clock clk, struct ptp_clock_caps *caps);
248  bool (*readPin)(const_ptpmgmt_clock clk, unsigned int index,
249  struct ptp_pin_desc *pin);
258  bool (*writePin)(const_ptpmgmt_clock clk, struct ptp_pin_desc *pin);
268  bool (*ExternTSEbable)(const_ptpmgmt_clock clk, unsigned int index,
269  uint8_t flags);
277  bool (*ExternTSDisable)(const_ptpmgmt_clock clk, unsigned int index);
291  bool (*MaskEnable)(const_ptpmgmt_clock clk, unsigned int index);
298  bool (*readEvent)(const_ptpmgmt_clock clk, struct ptp_extts_event *event);
307  bool (*readEvents)(const_ptpmgmt_clock clk, struct ptp_extts_event *events,
308  size_t *size);
318  bool (*setPinPeriod)(const_ptpmgmt_clock clk, unsigned int index,
319  struct ptp_perout_request *times);
328  bool (*setPtpPpsEvent)(const_ptpmgmt_clock clk, bool enable);
337  bool (*samplePtpSys)(const_ptpmgmt_clock clk, size_t count,
338  struct ptp_sys_offset *samples);
348  bool (*extSamplePtpSys)(const_ptpmgmt_clock clk, size_t count,
349  struct ptp_sys_offset_extended *samples);
358  struct ptp_sys_offset_precise *sample);
359 };
360 
367 bool ptpmgmt_clock_isCharFile(const char *file);
368 
374 
380 
381 #endif /* __PTPMGMT_C_IF_H */
ptpmgmt_clock ptpmgmt_clock_alloc_sys()
const struct ptpmgmt_ifInfo_t * const_ptpmgmt_ifInfo
Definition: ptp.h:24
struct ptpmgmt_ifInfo_t * ptpmgmt_ifInfo
Definition: ptp.h:21
bool ptpmgmt_clock_isCharFile(const char *file)
struct ptpmgmt_clock_t * ptpmgmt_clock
Definition: ptp.h:101
ptpmgmt_clock ptpmgmt_clock_alloc()
const struct ptpmgmt_clock_t * const_ptpmgmt_clock
Definition: ptp.h:104
ptpmgmt_ifInfo ptpmgmt_ifInfo_alloc()
Definition: ptp.h:110
bool(* ExternTSDisable)(const_ptpmgmt_clock clk, unsigned int index)
Definition: ptp.h:277
bool(* setTime)(const_ptpmgmt_clock clk, const struct timespec *ts)
Definition: ptp.h:133
bool(* initUsingIndex)(ptpmgmt_clock clk, int ptpIndex, bool readonly)
Definition: ptp.h:183
bool(* readPin)(const_ptpmgmt_clock clk, unsigned int index, struct ptp_pin_desc *pin)
Definition: ptp.h:248
bool(* initUsingDevice)(ptpmgmt_clock clk, const char *device, bool readonly)
Definition: ptp.h:175
bool(* readEvents)(const_ptpmgmt_clock clk, struct ptp_extts_event *events, size_t *size)
Definition: ptp.h:307
bool(* samplePtpSys)(const_ptpmgmt_clock clk, size_t count, struct ptp_sys_offset *samples)
Definition: ptp.h:337
bool(* readEvent)(const_ptpmgmt_clock clk, struct ptp_extts_event *event)
Definition: ptp.h:298
bool(* fetchCaps)(const_ptpmgmt_clock clk, struct ptp_clock_caps *caps)
Definition: ptp.h:239
bool(* setTimeFromSys)(const_ptpmgmt_clock clk)
Definition: ptp.h:226
bool(* extSamplePtpSys)(const_ptpmgmt_clock clk, size_t count, struct ptp_sys_offset_extended *samples)
Definition: ptp.h:348
void(* free)(ptpmgmt_clock clk)
Definition: ptp.h:119
const char *(* device)(const_ptpmgmt_clock clk)
Definition: ptp.h:220
bool(* setTimeToSys)(const_ptpmgmt_clock clk)
Definition: ptp.h:232
bool(* ExternTSEbable)(const_ptpmgmt_clock clk, unsigned int index, uint8_t flags)
Definition: ptp.h:268
bool(* writePin)(const_ptpmgmt_clock clk, struct ptp_pin_desc *pin)
Definition: ptp.h:258
int(* ptpIndex)(const_ptpmgmt_clock clk)
Definition: ptp.h:214
bool(* isInit)(const_ptpmgmt_clock clk)
Definition: ptp.h:189
bool(* setFreq)(const_ptpmgmt_clock clk, double freq)
Definition: ptp.h:153
int(* getFd)(const_ptpmgmt_clock clk)
Definition: ptp.h:201
int(* fileno)(const_ptpmgmt_clock clk)
Definition: ptp.h:207
double(* getFreq)(const_ptpmgmt_clock clk)
Definition: ptp.h:146
struct timespec(* getTime)(const_ptpmgmt_clock clk)
Definition: ptp.h:126
bool(* setPinPeriod)(const_ptpmgmt_clock clk, unsigned int index, struct ptp_perout_request *times)
Definition: ptp.h:318
bool(* MaskEnable)(const_ptpmgmt_clock clk, unsigned int index)
Definition: ptp.h:291
bool(* setPtpPpsEvent)(const_ptpmgmt_clock clk, bool enable)
Definition: ptp.h:328
bool(* setPhase)(const_ptpmgmt_clock clk, int64_t offset)
Definition: ptp.h:160
bool(* isCharFile)(const char *file)
Definition: ptp.h:167
bool(* offsetClock)(const_ptpmgmt_clock clk, int64_t offset)
Definition: ptp.h:140
clockid_t(* clkId)(const_ptpmgmt_clock clk)
Definition: ptp.h:195
bool(* MaskClearAll)(const_ptpmgmt_clock clk)
Definition: ptp.h:283
bool(* preciseSamplePtpSys)(const_ptpmgmt_clock clk, struct ptp_sys_offset_precise *sample)
Definition: ptp.h:357
Definition: ptp.h:30
bool(* initUsingIndex)(ptpmgmt_ifInfo i, int ifIndex)
Definition: ptp.h:52
const char *(* ifName)(const_ptpmgmt_ifInfo i)
Definition: ptp.h:70
bool(* isInit)(const_ptpmgmt_ifInfo i)
Definition: ptp.h:58
bool(* initUsingName)(ptpmgmt_ifInfo i, const char *ifName)
Definition: ptp.h:45
int(* ptpIndex)(const_ptpmgmt_ifInfo i)
Definition: ptp.h:91
size_t(* mac_size)(const_ptpmgmt_ifInfo i)
Definition: ptp.h:82
void(* free)(ptpmgmt_ifInfo i)
Definition: ptp.h:38
int(* ifIndex)(const_ptpmgmt_ifInfo i)
Definition: ptp.h:64