1 /*
2  * Copyright (c) 2024 BayLibre SAS
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file btca.c
9  * @brief Interface for Best TimeTransmitter Clock Algorithm.
10  *
11  * References are to version 2019 of IEEE 1588, ("PTP")
12  */
13 
14 #ifndef ZEPHYR_INCLUDE_PTP_BTCA_H_
15 #define ZEPHYR_INCLUDE_PTP_BTCA_H_
16 
17 #include "ds.h"
18 #include "port.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /**
25  * @brief Function comparing two datasets.
26  *
27  * @param[in] a Pointer to the first dataset.
28  * @param[in] b Pointer to the second dataset.
29  *
30  * @return Negative if b is better than a, 0 if a == b, else positive.
31  */
32 int ptp_btca_ds_cmp(const struct ptp_dataset *a, const struct ptp_dataset *b);
33 
34 /**
35  * @brief Function performing Best TimeTransmitter Clock state decision algorithm.
36  *
37  * @param[in] port Pointer to a PTP Port.
38  *
39  * @return Proposed PTP Port's state after execution of the state decision algorithm.
40  */
41 enum ptp_port_state ptp_btca_state_decision(struct ptp_port *port);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 /**
48  * @}
49  */
50 
51 #endif /* ZEPHYR_INCLUDE_PTP_BCMA_H_ */
52