First round of documentation cleanup for oran_e_maintenance_release_v1.0
[o-du/phy.git] / fhi_lib / lib / api / xran_ecpri_owd_measurements.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2020 Intel.
4 *
5 *   Licensed under the Apache License, Version 2.0 (the "License");
6 *   you may not use this file except in compliance with the License.
7 *   You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *   Unless required by applicable law or agreed to in writing, software
12 *   distributed under the License is distributed on an "AS IS" BASIS,
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *   See the License for the specific language governing permissions and
15 *   limitations under the License.
16 *
17 *******************************************************************************/
18 // Ecpri One-way delay measurement support definitions
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <stdint.h>
28 #include <inttypes.h>
29 #include <sys/types.h>
30 #include <sys/queue.h>
31 #include <netinet/in.h>
32 #include <setjmp.h>
33 #include <stdarg.h>
34 #include <ctype.h>
35 #include <errno.h>
36 #include <getopt.h>
37 #include <unistd.h>
38
39 enum xran_owdm_state
40 {
41     XRAN_OWDM_IDLE = 0,
42     XRAN_OWDM_WAITRESP,
43     XRAN_OWDM_WAITREQ,
44     XRAN_OWDM_WAITFUP,
45     XRAN_OWDM_GENFUP,
46     XRAN_OWDM_WAITREQWFUP,
47     XRAN_OWDM_WAITREMREQ,
48     XRAN_OWDM_WAITREMREQWFUP,
49     XRAN_OWDM_DONE  
50 };
51
52 enum xran_owd_meas_method
53 {
54     XRAN_REQUEST = 0,
55     XRAN_REM_REQ,
56     XRAN_REQ_WFUP,
57     XRAN_REM_REQ_WFUP
58 };
59
60 enum xran_owdm_tx_state
61 {
62     OWDMTX_INIT = 0,
63     OWDMTX_IDLE,
64     OWDMTX_ACTIVE,
65     OWDTX_DONE
66 };
67
68 #define DELAY_THRESHOLD  60000 /* in ns */
69 #define ADJUSTMENT 60 /* in us */
70 #define MIN_OWDM_PL_LENGTH 40 /* Minimum owdm Payload length in bytes */
71 #define MAX_OWDM_PL_LENGTH 1400 /* Maximum owdm Payload length in bytes */
72
73 int xran_get_delay_measurements_results (void* Handle,  uint16_t port_id, uint8_t id, uint64_t* pdelay_avg);
74
75 void xran_adjust_timing_parameters(void* Handle);
76
77 void xran_initialize_and_verify_owd_pl_length(void* Handle);
78
79 int process_delay_meas(struct rte_mbuf *pkt,  void* handle, uint16_t port_id);