-
Notifications
You must be signed in to change notification settings - Fork 1
/
ptp_core.h
59 lines (42 loc) · 1.75 KB
/
ptp_core.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* The flexPTP project, (C) András Wiesner, 2024 */
#ifndef PTP_H
#define PTP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#ifndef SIMULATION
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#endif
#include <flexptp/timeutils.h>
#include <flexptp/ptp_types.h>
#include <flexptp/stats.h>
#include <flexptp/settings_interface.h>
// -------------------------------------------
// ----- FLEXPTP_OPTIONS.H INCLUDE AREA ------
// -------------------------------------------
#include <flexptp_options.h>
// -------------------------------------------
// (End of customizable area)
// -------------------------------------------
// -------------------------------------------
void ptp_init(); // initialize PTP subsystem
void ptp_deinit(); // deinitialize PTP subsystem
void ptp_reset(); // reset PTP subsystem
void ptp_process_packet(RawPtpMessage * pRawMsg); // process PTP packet
typedef void (*SyncCallback)(int64_t time_error, const PtpSyncCycleData * pSCD, uint32_t freqCodeWord);
void ptp_set_sync_callback(SyncCallback syncCB);
#define PTP_IS_LOCKED(th) (ptp_get_stats()->filtTimeErr < (th) && !(ptp_get_current_master_clock_identity() != 0)) // is ptp locked considering threshold passed?
extern PtpCoreState gPtpCoreState;
void ptp_store_config(PtpConfig * pConfig); // store PTP-engine configuration (param: output)
void ptp_load_config(const PtpConfig * pConfig); // load PTP-engine configuration
void ptp_load_config_from_dump(const void *pDump); // load PTP-engine configuration from binary dump (i.e. from unaligned address)
#ifdef __cplusplus
}
#endif
#endif /* PTP */