From d1002cc72962c8a0b5fb608a92dcfb6ce70414de Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Mar 2024 13:40:36 +0100 Subject: [PATCH] move declarations out from log.h to a better place --- common/utils/LOG/log.c | 9 +++++++++ common/utils/LOG/log.h | 11 ----------- common/utils/utils.h | 1 + openair2/PHY_INTERFACE/phy_stub_UE.c | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 0d0bc144f7..fa2d8b4c81 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -48,6 +48,8 @@ #include #include "common/utils/LOG/log.h" +#define LOG_MEM_SIZE 100*1024*1024 + // main log variables // Fixme: a better place to be shure it is called @@ -58,6 +60,13 @@ void read_cpu_hardware (void) __attribute__ ((constructor)); void read_cpu_hardware (void) {} #endif + +typedef struct { + char* buf_p; + int buf_index; + int enable_flag; +} log_mem_cnt_t; + static log_mem_cnt_t log_mem_d[2]; static int log_mem_flag = 0; volatile int log_mem_side=0; diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index af4c0fe82f..542ebaa73c 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -57,8 +57,6 @@ #ifdef NDEBUG #warning assert is disabled #endif -#define NUM_ELEMENTS(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0])) -#define CHECK_INDEX(ARRAY, INDEX) assert((INDEX) < NUM_ELEMENTS(ARRAY)) #ifdef __cplusplus extern "C" { @@ -295,17 +293,8 @@ int is_newline( char *str, int size); int register_log_component(char *name, char *fext, int compidx); -#define LOG_MEM_SIZE 100*1024*1024 -#define LOG_MEM_FILE "./logmem.log" -void flush_mem_to_file(void); int logInit_log_mem(char*); void close_log_mem(void); - -typedef struct { - char* buf_p; - int buf_index; - int enable_flag; -} log_mem_cnt_t; /** @}*/ diff --git a/common/utils/utils.h b/common/utils/utils.h index b1a7305cd4..3d0ae99417 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -18,6 +18,7 @@ extern "C" { #endif #define sizeofArray(a) (sizeof(a)/sizeof(*(a))) +#define CHECK_INDEX(ARRAY, INDEX) assert((INDEX) < sizeofArray(ARRAY)) #define cmax(a,b) ((a>b) ? (a) : (b)) #define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c)) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 58cd8eacf7..9b87f06ba8 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1957,7 +1957,7 @@ static int get_mcs_from_sinr(float sinr) static int get_cqi_from_mcs(void) { static const int mcs_to_cqi[] = {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15}; - assert(NUM_ELEMENTS(mcs_to_cqi) == NUM_MCS); + assert(sizeofArray(mcs_to_cqi) == NUM_MCS); int sf = 0; while(sf < NUM_NFAPI_SUBFRAME) {