O-RAN E Maintenance Release contribution for ODULOW
[o-du/phy.git] / fhi_lib / lib / api / xran_timer.h
index b2cdfd8..a7e9330 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
 *
-*   Copyright (c) 2019 Intel.
+*   Copyright (c) 2020 Intel.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
@@ -37,6 +37,19 @@ extern "C" {
 #include <stdlib.h>
 #include <stdint.h>
 
+/* Difference between Unix seconds to GPS seconds
+   GPS epoch: 1980.1.6 00:00:00 (UTC); Unix time epoch: 1970:1.1 00:00:00 UTC
+   Value is calculated on Sep.6 2019. Need to be change if International
+   Earth Rotation and Reference Systems Service (IERS) adds more leap seconds
+   1970:1.1 - 1980.1.6: 3657 days
+   3657*24*3600=315 964 800 seconds (unix seconds value at 1980.1.6 00:00:00 (UTC))
+   There are 18 leap seconds inserted after 1980.1.6 00:00:00 (UTC), which means
+   GPS is 18 larger. 315 964 800 - 18 = 315 964 782
+*/
+#define UNIX_TO_GPS_SECONDS_OFFSET 315964782UL
+#define NUM_OF_FRAMES_PER_SFN_PERIOD 1024
+#define NUM_OF_FRAMES_PER_SECOND 100
+
 #define MSEC_PER_SEC 1000L
 
 #define XranIncrementSymIdx(sym_idx, numSymPerMs)  (((uint32_t)sym_idx >= (((uint32_t)numSymPerMs * MSEC_PER_SEC) - 1)) ? 0 : (uint32_t)sym_idx+1)
@@ -49,7 +62,9 @@ long sleep_next_tick(long interval);
 int timing_set_debug_stop(int value, int count);
 int timing_get_debug_stop(void);
 inline uint64_t timing_get_current_second(void);
+uint8_t timing_get_numerology(void);
 int timing_set_numerology(uint8_t value);
+uint32_t xran_max_ota_sym_idx(uint8_t numerlogy);
 
 #ifdef __cplusplus
 }