Merge branch 'eurecom-develop' into episys/merge_nsa_w_develop
At this point we are successfully able to build. Additionally, we can run the scenario, however, it does not pass. It seems that the gNB is not connecting to the proxy correctly. Just wanted to push the progress so far. FYI, the items that had to be changed to correct the linking issues were the following: - mac_rrc_data_ind_ue vs. nr_mac_rrc_data_ind_ue - rrc_data_req vs. nr_rrc_data_req - mac_rrc_data_req_ue vs. nr_mac_rrc_data_req_ue - rrc_data_req_ue vs. rrc_data_req_nr_ue - rrc_data_req vs. nr_rrc_data_req The listed functions should be declard in the LTE/NR UE directory depending on the functionality. Several were mixed. i.e.: LTE functions being called in NR UE. Also, removing siWindowLength, siWindowLength_int, SIBType, SIBPeriod, and siPeriod_int from the NR UE RRC. These variable were not used in the NR UE and are defined for LTE only. Lastly, in the NR_IF_Module.c of the NR UE, the global variable def_dci_pdu_rel15 is not accessible. Need to revisit this. For not it is commented out.
This commit is contained in:
@@ -90,7 +90,8 @@ int write_file_matlab(const char *fname,
|
||||
void *data,
|
||||
int length,
|
||||
int dec,
|
||||
unsigned int format)
|
||||
unsigned int format,
|
||||
int multiVec)
|
||||
{
|
||||
FILE *fp=NULL;
|
||||
int i;
|
||||
@@ -102,8 +103,7 @@ int write_file_matlab(const char *fname,
|
||||
|
||||
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
||||
|
||||
|
||||
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
|
||||
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14 || multiVec) {
|
||||
fp = fopen(fname,"a+");
|
||||
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
|
||||
fp = fopen(fname,"w+");
|
||||
@@ -139,8 +139,7 @@ int write_file_matlab(const char *fname,
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
|
||||
if ((format != 10 && format !=11 && format != 12 && format != 13 && format != 14) || multiVec)
|
||||
fprintf(fp,"%s = [",vname);
|
||||
|
||||
switch (format) {
|
||||
@@ -249,7 +248,7 @@ int write_file_matlab(const char *fname,
|
||||
AssertFatal(false, "unknown dump format: %u\n", format);
|
||||
}
|
||||
|
||||
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
|
||||
if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) {
|
||||
fprintf(fp,"];\n");
|
||||
fclose(fp);
|
||||
return(0);
|
||||
@@ -463,7 +462,7 @@ int logInit (void)
|
||||
register_log_component("LOCALIZE","log",LOCALIZE);
|
||||
register_log_component("NAS","log",NAS);
|
||||
register_log_component("UDP","",UDP_);
|
||||
register_log_component("GTPV1U","",GTPU);
|
||||
register_log_component("GTPU","",GTPU);
|
||||
register_log_component("S1AP","",S1AP);
|
||||
register_log_component("F1AP","",F1AP);
|
||||
register_log_component("M2AP","",M2AP);
|
||||
|
||||
@@ -351,6 +351,7 @@ typedef struct {
|
||||
@param length length of data vector to output
|
||||
@param dec decimation level
|
||||
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
|
||||
@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1)
|
||||
*/
|
||||
#define MATLAB_RAW (1<<31)
|
||||
#define MATLAB_SHORT 0
|
||||
@@ -370,7 +371,7 @@ typedef struct {
|
||||
#define MATLAB_CSHORT_BRACKET2 14
|
||||
#define MATLAB_CSHORT_BRACKET3 15
|
||||
|
||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format);
|
||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format, int multiVec);
|
||||
|
||||
/*----------------macro definitions for reading log configuration from the config module */
|
||||
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
||||
@@ -425,7 +426,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
# define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0)
|
||||
# define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */
|
||||
# define LOG_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0)
|
||||
# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0)
|
||||
# define LOG_D(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0)
|
||||
# define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0)
|
||||
|
||||
# define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0)
|
||||
@@ -452,7 +453,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
|
||||
/* bitmask dependent macros, to generate debug file such as matlab file or message dump */
|
||||
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
|
||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
|
||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)/* */
|
||||
/* define variable only used in LOG macro's */
|
||||
# define LOG_VAR(A,B) A B
|
||||
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
|
||||
@@ -470,8 +471,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
# define LOG_DUMPFLAG(D) (g_log->debug_mask & D)
|
||||
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
|
||||
|
||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
|
||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
|
||||
# define LOG_VAR(A,B) A B
|
||||
# define T_ACTIVE(a) (0)
|
||||
# endif /* T_TRACER */
|
||||
#endif // LOG_MINIMAL
|
||||
|
||||
@@ -480,9 +482,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
|
||||
|
||||
/* unfiltered macros, useful for simulators or messages at init time, before log is configured */
|
||||
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
|
||||
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
|
||||
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
|
||||
#define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */
|
||||
# define LOG_MM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 1);} while(0)
|
||||
/* @}*/
|
||||
|
||||
|
||||
|
||||
@@ -302,6 +302,9 @@ const char* eurecomFunctionsNames[] = {
|
||||
/* PHY signals */
|
||||
"ue_synch",
|
||||
"ue_slot_fep",
|
||||
"ue_slot_fep_pdcch",
|
||||
"ue_slot_fep_pbch",
|
||||
"ue_slot_fep_pdsch",
|
||||
"ue_slot_fep_mbsfn",
|
||||
"ue_slot_fep_mbsfn_khz_1dot25",
|
||||
"ue_rrc_measurements",
|
||||
@@ -390,6 +393,8 @@ const char* eurecomFunctionsNames[] = {
|
||||
"rx_pmch",
|
||||
"rx_pmch_khz_1dot25",
|
||||
"pdsch_procedures",
|
||||
"pdsch_procedures_crnti",
|
||||
//"dlsch_procedures_crnti",
|
||||
"pdsch_procedures_si",
|
||||
"pdsch_procedures_p",
|
||||
"pdsch_procedures_ra",
|
||||
|
||||
@@ -283,6 +283,9 @@ typedef enum {
|
||||
/* PHY signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_MBSFN,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_MBSFN_KHZ_1DOT25,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS,
|
||||
@@ -371,9 +374,11 @@ typedef enum {
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PMCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PMCH_KHZ_1DOT25,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA,
|
||||
//VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PROC_C,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB1_ENB,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB2_ENB,
|
||||
|
||||
@@ -4,6 +4,7 @@ T_IDs.h
|
||||
T_messages.txt.h
|
||||
genids
|
||||
tracer/enb
|
||||
tracer/gnb
|
||||
tracer/extract_config
|
||||
tracer/record
|
||||
tracer/replay
|
||||
|
||||
@@ -18,7 +18,7 @@ T_messages.txt.h: T_messages.txt
|
||||
T_IDs.h: $(GENIDS) T_messages.txt
|
||||
./$(GENIDS) T_messages.txt T_IDs.h
|
||||
|
||||
check_vcd:
|
||||
check_vcd: T_IDs.h T_messages.txt.h
|
||||
gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
|
||||
./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
|
||||
rm -f ./_check_vcd
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
/* maximum size of a message - increase if needed */
|
||||
#if BASIC_SIMULATOR
|
||||
/* let's have 100 RBs functional for the basic simulator */
|
||||
# define T_BUFFER_MAX (1024*64*2)
|
||||
# define T_BUFFER_MAX (1024*64*4)
|
||||
#else
|
||||
# define T_BUFFER_MAX (1024*64*2)
|
||||
# define T_BUFFER_MAX (1024*64*4)
|
||||
#endif
|
||||
|
||||
/* size of the local cache for messages (must be pow(2,something)) */
|
||||
@@ -73,7 +73,7 @@ typedef struct {
|
||||
} T_cache_t;
|
||||
|
||||
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
|
||||
#define VCD_NUM_FUNCTIONS (269)
|
||||
#define VCD_NUM_FUNCTIONS (273)
|
||||
|
||||
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
|
||||
#define VCD_NUM_VARIABLES (187)
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
ID = BENETEL
|
||||
GROUP = ALL
|
||||
FORMAT = int,frame : int,slot : buffer,rxdataF
|
||||
|
||||
#general logs
|
||||
ID = ENB_MASTER_TICK
|
||||
DESC = eNodeB master tick - one tick per ms, to be used as "reference clock", mostly for ticktime view
|
||||
@@ -93,6 +89,14 @@ ID = GNB_PHY_MIB
|
||||
DESC = NR MIB data
|
||||
GROUP = ALL:PHY:GNB:WIRESHARK
|
||||
FORMAT = int,gNB_ID : int,frame : int,slot : buffer,data
|
||||
ID = GNB_PHY_PUCCH_PUSCH_IQ
|
||||
DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
|
||||
FORMAT = int,frame : int,slot : buffer,rxdataF
|
||||
ID = GNB_PHY_PRACH_INPUT_SIGNAL
|
||||
DESC = gNodeB input data in the time domain for slots with PRACH detection
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
|
||||
FORMAT = int,frame : int,slot : int,antenna : buffer,rxdata
|
||||
|
||||
#MAC logs
|
||||
ID = ENB_MAC_UE_DL_SDU
|
||||
@@ -2407,6 +2411,21 @@ ID = VCD_FUNCTION_UE_SLOT_FEP
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = ue_slot_fep
|
||||
ID = VCD_FUNCTION_UE_SLOT_FEP_PDCCH
|
||||
DESC = VCD function UE_SLOT_FEP_PDCCH
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = ue_slot_fep_pdcch
|
||||
ID = VCD_FUNCTION_UE_SLOT_FEP_PBCH
|
||||
DESC = VCD function UE_SLOT_FEP_PBCH
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = ue_slot_fep_pbch
|
||||
ID = VCD_FUNCTION_UE_SLOT_FEP_PDSCH
|
||||
DESC = VCD function UE_SLOT_FEP_PDSCH
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = ue_slot_fep_pdsch
|
||||
ID = VCD_FUNCTION_UE_SLOT_FEP_MBSFN
|
||||
DESC = VCD function UE_SLOT_FEP_MBSFN
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
@@ -2847,6 +2866,11 @@ ID = VCD_FUNCTION_PDSCH_PROC
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = pdsch_procedures
|
||||
ID = VCD_FUNCTION_PDSCH_PROC_C
|
||||
DESC = VCD function PDSCH_PROC_C
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = pdsch_procedures_crnti
|
||||
ID = VCD_FUNCTION_PDSCH_PROC_SI
|
||||
DESC = VCD function PDSCH_PROC_SI
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
|
||||
@@ -7,7 +7,8 @@ LIBS=-lm
|
||||
XLIBS=-lX11 -lpng -lXft
|
||||
|
||||
all: record replay extract_config textlog enb ue vcd macpdu2wireshark \
|
||||
extract_input_subframe extract_output_subframe to_vcd extract multi
|
||||
extract_input_subframe extract_output_subframe to_vcd extract multi \
|
||||
gnb
|
||||
|
||||
record: utils.o record.o database.o config.o
|
||||
$(CC) $(CFLAGS) -o record $^ $(LIBS)
|
||||
@@ -60,6 +61,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
|
||||
multi: multi.o utils.o database.o config.o
|
||||
$(CC) $(CFLAGS) -o multi $^ $(LIBS)
|
||||
|
||||
gnb: utils.o gnb.o database.o event.o handler.o config.o \
|
||||
view/view.a gui/gui.a logger/logger.a \
|
||||
filter/filter.a
|
||||
$(CC) $(CFLAGS) -o gnb $^ $(LIBS) $(XLIBS)
|
||||
|
||||
multi.o: ../T_IDs.h
|
||||
|
||||
../T_IDs.h:
|
||||
@@ -85,7 +91,7 @@ filter/filter.a:
|
||||
clean:
|
||||
rm -f *.o core tracer_remote textlog enb ue vcd record replay
|
||||
rm -f extract_config macpdu2wireshark extract_input_subframe
|
||||
rm -f extract_output_subframe to_vcd extract multi
|
||||
rm -f extract_output_subframe to_vcd extract multi gnb
|
||||
cd gui && $(MAKE) clean
|
||||
cd view && $(MAKE) clean
|
||||
cd logger && $(MAKE) clean
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include "database.h"
|
||||
#include "handler.h"
|
||||
#include "config.h"
|
||||
#include "logger/logger.h"
|
||||
#include "view/view.h"
|
||||
#include "gui/gui.h"
|
||||
|
||||
typedef struct {
|
||||
widget *pucch_pusch_iq_plot;
|
||||
logger *pucch_pusch_iq_logger;
|
||||
} gnb_gui;
|
||||
|
||||
typedef struct {
|
||||
int socket;
|
||||
int *is_on;
|
||||
int nevents;
|
||||
pthread_mutex_t lock;
|
||||
gnb_gui *e;
|
||||
void *database;
|
||||
} gnb_data;
|
||||
|
||||
void is_on_changed(void *_d)
|
||||
{
|
||||
gnb_data *d = _d;
|
||||
char t;
|
||||
|
||||
if (pthread_mutex_lock(&d->lock)) abort();
|
||||
|
||||
if (d->socket == -1) goto no_connection;
|
||||
|
||||
t = 1;
|
||||
if (socket_send(d->socket, &t, 1) == -1 ||
|
||||
socket_send(d->socket, &d->nevents, sizeof(int)) == -1 ||
|
||||
socket_send(d->socket, d->is_on, d->nevents * sizeof(int)) == -1)
|
||||
goto connection_dies;
|
||||
|
||||
no_connection:
|
||||
if (pthread_mutex_unlock(&d->lock)) abort();
|
||||
return;
|
||||
|
||||
connection_dies:
|
||||
close(d->socket);
|
||||
d->socket = -1;
|
||||
if (pthread_mutex_unlock(&d->lock)) abort();
|
||||
}
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
printf(
|
||||
"options:\n"
|
||||
" -d <database file> this option is mandatory\n"
|
||||
" -ip <host> connect to given IP address (default %s)\n"
|
||||
" -p <port> connect to given port (default %d)\n",
|
||||
DEFAULT_REMOTE_IP,
|
||||
DEFAULT_REMOTE_PORT
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void *gui_thread(void *_g)
|
||||
{
|
||||
gui *g = _g;
|
||||
gui_loop(g);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database,
|
||||
gnb_data *ed)
|
||||
{
|
||||
widget *main_window;
|
||||
widget *top_container;
|
||||
widget *line;
|
||||
widget *w;
|
||||
logger *l;
|
||||
view *v;
|
||||
|
||||
main_window = new_toplevel_window(g, 500, 300, "gNB tracer");
|
||||
|
||||
top_container = new_container(g, VERTICAL);
|
||||
widget_add_child(g, main_window, top_container, -1);
|
||||
|
||||
line = new_container(g, HORIZONTAL);
|
||||
widget_add_child(g, top_container, line, -1);
|
||||
|
||||
/* PUCCH/PUSCH IQ data */
|
||||
w = new_xy_plot(g, 55, 55, "", 50);
|
||||
e->pucch_pusch_iq_plot = w;
|
||||
widget_add_child(g, line, w, -1);
|
||||
xy_plot_set_range(g, w, -1000, 1000, -1000, 1000);
|
||||
xy_plot_set_title(g, w, "rxdataF");
|
||||
l = new_iqlog_full(h, database, "GNB_PHY_PUCCH_PUSCH_IQ", "rxdataF");
|
||||
v = new_view_xy(300*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
|
||||
logger_add_view(l, v);
|
||||
e->pucch_pusch_iq_logger = l;
|
||||
}
|
||||
|
||||
int main(int n, char **v)
|
||||
{
|
||||
char *database_filename = NULL;
|
||||
void *database;
|
||||
char *ip = DEFAULT_REMOTE_IP;
|
||||
int port = DEFAULT_REMOTE_PORT;
|
||||
int *is_on;
|
||||
int number_of_events;
|
||||
int i;
|
||||
event_handler *h;
|
||||
gnb_data gnb_data;
|
||||
gui *g;
|
||||
gnb_gui eg;
|
||||
|
||||
for (i = 1; i < n; i++) {
|
||||
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
|
||||
if (!strcmp(v[i], "-d"))
|
||||
{ if (i > n-2) usage(); database_filename = v[++i]; continue; }
|
||||
usage();
|
||||
}
|
||||
|
||||
if (database_filename == NULL) {
|
||||
printf("ERROR: provide a database file (-d)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
database = parse_database(database_filename);
|
||||
|
||||
load_config_file(database_filename);
|
||||
|
||||
number_of_events = number_of_ids(database);
|
||||
is_on = calloc(number_of_events, sizeof(int));
|
||||
if (is_on == NULL) abort();
|
||||
|
||||
h = new_handler(database);
|
||||
|
||||
on_off(database, "GNB_PHY_PUCCH_PUSCH_IQ", is_on, 1);
|
||||
|
||||
gnb_data.database = database;
|
||||
gnb_data.socket = -1;
|
||||
gnb_data.is_on = is_on;
|
||||
gnb_data.nevents = number_of_events;
|
||||
if (pthread_mutex_init(&gnb_data.lock, NULL)) abort();
|
||||
|
||||
g = gui_init();
|
||||
new_thread(gui_thread, g);
|
||||
|
||||
gnb_main_gui(&eg, g, h, database, &gnb_data);
|
||||
|
||||
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
|
||||
|
||||
restart:
|
||||
clear_remote_config();
|
||||
if (gnb_data.socket != -1) close(gnb_data.socket);
|
||||
gnb_data.socket = connect_to(ip, port);
|
||||
|
||||
/* send the first message - activate selected traces */
|
||||
is_on_changed(&gnb_data);
|
||||
|
||||
/* read messages */
|
||||
while (1) {
|
||||
event e;
|
||||
e = get_event(gnb_data.socket, &ebuf, database);
|
||||
if (e.type == -1) goto restart;
|
||||
if (pthread_mutex_lock(&gnb_data.lock)) abort();
|
||||
handle_event(h, e);
|
||||
if (pthread_mutex_unlock(&gnb_data.lock)) abort();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -74,6 +74,44 @@ static void _event(void *p, event e)
|
||||
l->common.v[i]->append(l->common.v[i], l->i, l->q, count);
|
||||
}
|
||||
|
||||
static void _event_full(void *p, event e)
|
||||
{
|
||||
struct iqlog *l = p;
|
||||
int i;
|
||||
void *buffer;
|
||||
int bsize;
|
||||
int nsamples;
|
||||
float *idst, *qdst;
|
||||
|
||||
if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0)
|
||||
return;
|
||||
|
||||
buffer = e.e[l->buffer_arg].b;
|
||||
bsize = e.e[l->buffer_arg].bsize;
|
||||
|
||||
nsamples = bsize / 4;
|
||||
|
||||
if (nsamples > l->max_length) {
|
||||
l->i = realloc(l->i, nsamples * sizeof(float));
|
||||
if (l->i == NULL) abort();
|
||||
l->q = realloc(l->q, nsamples * sizeof(float));
|
||||
if (l->q == NULL) abort();
|
||||
l->max_length = nsamples;
|
||||
}
|
||||
|
||||
idst = l->i;
|
||||
qdst = l->q;
|
||||
for (i = 0; i < nsamples; i++) {
|
||||
*idst = ((int16_t *)buffer)[i * 2];
|
||||
*qdst = ((int16_t *)buffer)[i * 2 + 1];
|
||||
idst++;
|
||||
qdst++;
|
||||
}
|
||||
|
||||
for (i = 0; i < l->common.vsize; i++)
|
||||
l->common.v[i]->append(l->common.v[i], l->i, l->q, nsamples);
|
||||
}
|
||||
|
||||
logger *new_iqlog(event_handler *h, void *database,
|
||||
char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti,
|
||||
char *buffer_varname)
|
||||
@@ -149,3 +187,43 @@ logger *new_iqlog(event_handler *h, void *database,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
logger *new_iqlog_full(event_handler *h, void *database, char *event_name,
|
||||
char *buffer_varname)
|
||||
{
|
||||
struct iqlog *ret;
|
||||
int event_id;
|
||||
database_event_format f;
|
||||
int i;
|
||||
|
||||
ret = calloc(1, sizeof(struct iqlog)); if (ret == NULL) abort();
|
||||
|
||||
ret->common.event_name = strdup(event_name);
|
||||
if (ret->common.event_name == NULL) abort();
|
||||
ret->database = database;
|
||||
|
||||
event_id = event_id_from_name(database, event_name);
|
||||
|
||||
ret->common.handler_id = register_handler_function(h, event_id, _event_full,
|
||||
ret);
|
||||
|
||||
f = get_format(database, event_id);
|
||||
|
||||
/* look for args */
|
||||
ret->buffer_arg = -1;
|
||||
for (i = 0; i < f.count; i++) {
|
||||
if (!strcmp(f.name[i], buffer_varname)) ret->buffer_arg = i;
|
||||
}
|
||||
if (ret->buffer_arg == -1) {
|
||||
printf("%s:%d: buffer argument '%s' not found in event '%s'\n",
|
||||
__FILE__, __LINE__, buffer_varname, event_name);
|
||||
abort();
|
||||
}
|
||||
if (strcmp(f.type[ret->buffer_arg], "buffer") != 0) {
|
||||
printf("%s:%d: argument '%s' has wrong type (should be 'buffer')\n",
|
||||
__FILE__, __LINE__, buffer_varname);
|
||||
abort();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ logger *new_ticklog(void *event_handler, void *database,
|
||||
logger *new_iqlog(void *event_handler, void *database,
|
||||
char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti,
|
||||
char *buffer_varname);
|
||||
logger *new_iqlog_full(void *event_handler, void *database, char *event_name,
|
||||
char *buffer_varname);
|
||||
logger *new_iqdotlog(void *event_handler, void *database,
|
||||
char *event_name, char *I, char *Q);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void output_log_mem(void);
|
||||
display_backtrace(); \
|
||||
fflush(stdout); \
|
||||
fflush(stderr); \
|
||||
exit(EXIT_FAILURE); \
|
||||
abort();
|
||||
|
||||
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
|
||||
do { \
|
||||
|
||||
@@ -38,7 +38,7 @@ void display_backtrace(void) {
|
||||
size_t i;
|
||||
char *test=getenv("NO_BACKTRACE");
|
||||
|
||||
if (test!=0) *((int *)0)=0;
|
||||
if (test!=0) abort();
|
||||
|
||||
size = backtrace(array, 10);
|
||||
strings = backtrace_symbols(array, size);
|
||||
|
||||
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file common/utils/lte/prach_utils.c
|
||||
* \brief utils for PRACH common to both PHY and MAC
|
||||
* \author R. Knopp
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "PHY/LTE_TRANSPORT/transport_common.h"
|
||||
|
||||
// This is table 5.7.1-4 from 36.211
|
||||
PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
|
||||
// TDD Configuration Index 0
|
||||
{ {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}},
|
||||
// TDD Configuration Index 1
|
||||
{ {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}},
|
||||
// TDD Configuration Index 2
|
||||
{ {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}},
|
||||
// TDD Configuration Index 3
|
||||
{ {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}},
|
||||
// TDD Configuration Index 4
|
||||
{ {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}},
|
||||
// TDD Configuration Index 5
|
||||
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
|
||||
// TDD Configuration Index 6
|
||||
{ {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 7
|
||||
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
|
||||
// TDD Configuration Index 8
|
||||
{ {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 9
|
||||
{ {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 10
|
||||
{ {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}},
|
||||
// TDD Configuration Index 11
|
||||
{ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}},
|
||||
// TDD Configuration Index 12
|
||||
{ {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}},
|
||||
{4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 13
|
||||
{ {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 14
|
||||
{ {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 15
|
||||
{ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}},
|
||||
{5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}},
|
||||
{5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}},
|
||||
{5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 16
|
||||
{ {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}},
|
||||
{5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}},
|
||||
{5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
|
||||
},
|
||||
// TDD Configuration Index 17
|
||||
{ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
|
||||
},
|
||||
// TDD Configuration Index 18
|
||||
{ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}},
|
||||
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}},
|
||||
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}}
|
||||
},
|
||||
// TDD Configuration Index 19
|
||||
{ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}
|
||||
},
|
||||
// TDD Configuration Index 20
|
||||
{ {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
|
||||
// TDD Configuration Index 21
|
||||
{ {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 22
|
||||
{ {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 23
|
||||
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 24
|
||||
{ {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 25
|
||||
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 26
|
||||
{ {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 27
|
||||
{ {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 28
|
||||
{ {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
|
||||
{5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 29
|
||||
{ {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
|
||||
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
|
||||
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
|
||||
},
|
||||
|
||||
|
||||
// TDD Configuration Index 30
|
||||
{ {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 31
|
||||
{ {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 32
|
||||
{ {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 33
|
||||
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 34
|
||||
{ {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 35
|
||||
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
|
||||
|
||||
// TDD Configuration Index 36
|
||||
{ {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
|
||||
|
||||
// TDD Configuration Index 37
|
||||
{ {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 38
|
||||
{ {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
|
||||
{5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 39
|
||||
{ {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
|
||||
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
|
||||
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
|
||||
},
|
||||
|
||||
// TDD Configuration Index 40
|
||||
{ {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}},
|
||||
// TDD Configuration Index 41
|
||||
{ {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 42
|
||||
{ {1,{{0,1,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 43
|
||||
{ {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 44
|
||||
{ {1,{{0,0,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 45
|
||||
{ {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 46
|
||||
{ {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}},
|
||||
|
||||
// TDD Configuration Index 47
|
||||
{ {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
|
||||
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type) {
|
||||
if (frame_type == FDD) // FDD
|
||||
return(prach_ConfigIndex>>4);
|
||||
else {
|
||||
if (prach_ConfigIndex < 20)
|
||||
return (0);
|
||||
|
||||
if (prach_ConfigIndex < 30)
|
||||
return (1);
|
||||
|
||||
if (prach_ConfigIndex < 40)
|
||||
return (2);
|
||||
|
||||
if (prach_ConfigIndex < 48)
|
||||
return (3);
|
||||
else
|
||||
return (4);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t get_prach_prb_offset(int frame_type,
|
||||
int tdd_config,
|
||||
int N_RB_UL,
|
||||
uint8_t prach_ConfigIndex,
|
||||
uint8_t n_ra_prboffset,
|
||||
uint8_t tdd_mapindex, uint16_t Nf) {
|
||||
uint8_t n_ra_prb;
|
||||
uint8_t f_ra,t1_ra;
|
||||
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
|
||||
uint8_t Nsp=2;
|
||||
|
||||
if (frame_type == TDD) { // TDD
|
||||
if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
|
||||
LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
|
||||
f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
|
||||
|
||||
if (prach_fmt < 4) {
|
||||
if ((f_ra&1) == 0) {
|
||||
n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
|
||||
} else {
|
||||
n_ra_prb = N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
|
||||
}
|
||||
} else {
|
||||
if ((tdd_config >2) && (tdd_config<6))
|
||||
Nsp = 2;
|
||||
|
||||
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
|
||||
|
||||
if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
|
||||
n_ra_prb = 6*f_ra;
|
||||
} else {
|
||||
n_ra_prb = N_RB_UL - 6*(f_ra+1);
|
||||
}
|
||||
}
|
||||
} else { //FDD
|
||||
n_ra_prb = n_ra_prboffset;
|
||||
}
|
||||
|
||||
return(n_ra_prb);
|
||||
}
|
||||
|
||||
int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) {
|
||||
uint8_t t0_ra;
|
||||
uint8_t t1_ra;
|
||||
uint8_t t2_ra;
|
||||
int prach_mask = 0;
|
||||
|
||||
if (frame_type == FDD) { //FDD
|
||||
//implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
|
||||
if ((((frame&1) == 1) && (subframe < 9)) ||
|
||||
(((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
|
||||
if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
|
||||
((prach_ConfigIndex&0x1f)==18) || // 18,50
|
||||
((prach_ConfigIndex&0xf)==15)) // 15,47
|
||||
return(0);
|
||||
|
||||
switch (prach_ConfigIndex&0x1f) {
|
||||
case 0:
|
||||
case 3:
|
||||
if (subframe==1) prach_mask = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 4:
|
||||
if (subframe==4) prach_mask = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 5:
|
||||
if (subframe==7) prach_mask = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if ((subframe==1) || (subframe==6)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
if ((subframe==2) || (subframe==7)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if ((subframe==3) || (subframe==8)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 11:
|
||||
if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 12:
|
||||
if ((subframe&1)==0) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 13:
|
||||
if ((subframe&1)==1) prach_mask=1;
|
||||
|
||||
break;
|
||||
|
||||
case 14:
|
||||
prach_mask=1;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
if (subframe==9) prach_mask=1;
|
||||
|
||||
break;
|
||||
}
|
||||
} else { // TDD
|
||||
AssertFatal(prach_ConfigIndex<64,
|
||||
"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
|
||||
AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
|
||||
"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
|
||||
t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
|
||||
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
|
||||
t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
|
||||
#ifdef PRACH_DEBUG
|
||||
LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
|
||||
prach_ConfigIndex,
|
||||
subframe,
|
||||
t0_ra,t1_ra,t2_ra);
|
||||
#endif
|
||||
|
||||
if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
|
||||
((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
|
||||
(t0_ra == 0)) && // PRACH is in all frames
|
||||
(((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
|
||||
(((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
|
||||
if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
|
||||
(((subframe%5)-2)==t2_ra)) prach_mask=1;
|
||||
else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
|
||||
}
|
||||
}
|
||||
|
||||
return(prach_mask);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file common/utils/prach_utils.h
|
||||
* \brief computation of some PRACH variables used in both MAC and PHY
|
||||
* \author R. Knopp
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type);
|
||||
|
||||
uint8_t get_prach_prb_offset(int frame_type,
|
||||
int tdd_config,
|
||||
int N_RB_UL,
|
||||
uint8_t prach_ConfigIndex,
|
||||
uint8_t n_ra_prboffset,
|
||||
uint8_t tdd_mapindex, uint16_t Nf);
|
||||
int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file ue_power.c
|
||||
* \brief Routines to compute UE TX power according to 36.213
|
||||
* \author R. Knopp, F. Kaltenberger
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/TOOLS/dB_routines.h"
|
||||
|
||||
extern int16_t hundred_times_delta_TF[100];
|
||||
extern uint16_t hundred_times_log10_NPRB[100];
|
||||
|
||||
int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs)
|
||||
{
|
||||
|
||||
/// The payload + CRC size in bits, "B"
|
||||
uint32_t B;
|
||||
/// Number of code segments
|
||||
uint32_t C;
|
||||
/// Number of "small" code segments
|
||||
uint32_t Cminus;
|
||||
/// Number of "large" code segments
|
||||
uint32_t Cplus;
|
||||
/// Number of bits in "small" code segments (<6144)
|
||||
uint32_t Kminus;
|
||||
/// Number of bits in "large" code segments (<6144)
|
||||
uint32_t Kplus;
|
||||
/// Total number of bits across all segments
|
||||
uint32_t sumKr;
|
||||
/// Number of "Filler" bits
|
||||
uint32_t F;
|
||||
// num resource elements
|
||||
uint32_t num_re=0.0;
|
||||
// num symbols
|
||||
uint32_t num_symb=0.0;
|
||||
/// effective spectral efficiency of the PUSCH
|
||||
uint32_t MPR_x100=0;
|
||||
/// beta_offset
|
||||
uint16_t beta_offset_pusch_x8=8;
|
||||
/// delta mcs
|
||||
float delta_mcs=0.0;
|
||||
/// bandwidth factor
|
||||
float bw_factor=0.0;
|
||||
|
||||
B= tbs+24;
|
||||
lte_segmentation(NULL,
|
||||
NULL,
|
||||
B,
|
||||
&C,
|
||||
&Cplus,
|
||||
&Cminus,
|
||||
&Kplus,
|
||||
&Kminus,
|
||||
&F);
|
||||
|
||||
|
||||
sumKr = Cminus*Kminus + Cplus*Kplus;
|
||||
num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
|
||||
num_re = num_symb * nb_rb * 12;
|
||||
|
||||
if (num_re == 0)
|
||||
return(0);
|
||||
|
||||
MPR_x100 = 100*sumKr/num_re;
|
||||
|
||||
if (control_only == 1 )
|
||||
beta_offset_pusch_x8=8; // fixme
|
||||
|
||||
//(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
|
||||
|
||||
// if deltamcs_enabledm
|
||||
delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
|
||||
|
||||
bw_factor = (norm!=0) ? 0 : (hundred_times_log10_NPRB[nb_rb-1]/100.0);
|
||||
LOG_D(PHY,"estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
|
||||
(int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
|
||||
return (int16_t)ceil(delta_mcs + bw_factor);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file ue_power.h
|
||||
* \brief support routines used in MAC and PHY
|
||||
* \author R. Knopp, F. Kaltenberger
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#ifndef T_TRACER
|
||||
int T_stdout;
|
||||
#endif
|
||||
|
||||
void exit_function(const char *file, const char *function, const int line, const char *s) {
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
FILE *g_msc_fd;
|
||||
char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
|
||||
|
||||
msc_interface_t msc_interface;
|
||||
|
||||
typedef unsigned long msc_message_number_t;
|
||||
typedef struct msc_queue_item_s {
|
||||
|
||||
@@ -117,7 +117,7 @@ void msc_log_message(
|
||||
|
||||
#define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded
|
||||
|
||||
msc_interface_t msc_interface;
|
||||
extern msc_interface_t msc_interface;
|
||||
#define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2)
|
||||
#define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use
|
||||
#define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end
|
||||
|
||||
@@ -32,12 +32,85 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "assertions.h"
|
||||
#include "nr_common.h"
|
||||
|
||||
// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101)
|
||||
// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101)
|
||||
// Notes:
|
||||
// - N_OFFs for bands from 80 to 89 and band 95 is referred to UL
|
||||
// - Frequencies are expressed in KHz
|
||||
// - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster
|
||||
nr_bandentry_t nr_bandtable[] = {
|
||||
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
|
||||
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
|
||||
{3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100},
|
||||
{5, 824000, 849000, 869000, 894000, 20, 173800, 100},
|
||||
{7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100},
|
||||
{8, 880000, 915000, 925000, 960000, 20, 185000, 100},
|
||||
{12, 698000, 716000, 729000, 746000, 20, 145800, 100},
|
||||
{14, 788000, 798000, 758000, 768000, 20, 151600, 100},
|
||||
{18, 815000, 830000, 860000, 875000, 20, 172000, 100},
|
||||
{20, 832000, 862000, 791000, 821000, 20, 158200, 100},
|
||||
{25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100},
|
||||
{26, 814000, 849000, 859000, 894000, 20, 171800, 100},
|
||||
{28, 703000, 758000, 758000, 813000, 20, 151600, 100},
|
||||
{29, 000, 000, 717000, 728000, 20, 143400, 100},
|
||||
{30, 2305000, 2315000, 2350000, 2360000, 20, 470000, 100},
|
||||
{34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100},
|
||||
{38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100},
|
||||
{39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100},
|
||||
{40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100},
|
||||
{41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
|
||||
{41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
|
||||
{47, 5855000, 5925000, 5855000, 5925000, 1, 790334, 15},
|
||||
//{48, 3550000, 3700000, 3550000, 3700000, 1, 636667, 15},
|
||||
//{48, 3550000, 3700000, 3550000, 3700000, 2, 636668, 30},
|
||||
{50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100},
|
||||
{51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100},
|
||||
{53, 2483500, 2495000, 2483500, 2495000, 20, 496700, 100},
|
||||
{65, 1920000, 2010000, 2110000, 2200000, 20, 422000, 100},
|
||||
{66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100},
|
||||
{70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100},
|
||||
{71, 663000, 698000, 617000, 652000, 20, 123400, 100},
|
||||
{74, 1427000, 1470000, 1475000, 1518000, 20, 295000, 100},
|
||||
{75, 000, 000, 1432000, 1517000, 20, 286400, 100},
|
||||
{76, 000, 000, 1427000, 1432000, 20, 285400, 100},
|
||||
{77, 3300000, 4200000, 3300000, 4200000, 1, 620000, 15},
|
||||
{77, 3300000, 4200000, 3300000, 4200000, 2, 620000, 30},
|
||||
{78, 3300000, 3800000, 3300000, 3800000, 1, 620000, 15},
|
||||
{78, 3300000, 3800000, 3300000, 3800000, 2, 620000, 30},
|
||||
{79, 4400010, 5000000, 4400010, 5000000, 1, 693334, 15},
|
||||
{79, 4400010, 5000000, 4400010, 5000000, 2, 693334, 30},
|
||||
{80, 1710000, 1785000, 000, 000, 20, 342000, 100},
|
||||
{81, 880000, 915000, 000, 000, 20, 176000, 100},
|
||||
{82, 832000, 862000, 000, 000, 20, 166400, 100},
|
||||
{83, 703000, 748000, 000, 000, 20, 140600, 100},
|
||||
{84, 1920000, 1980000, 000, 000, 20, 384000, 100},
|
||||
{86, 1710000, 1785000, 000, 000, 20, 342000, 100},
|
||||
{89, 824000, 849000, 000, 000, 20, 342000, 100},
|
||||
{90, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
|
||||
{90, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
|
||||
{90, 2496000, 2690000, 2496000, 2690000, 20, 499200, 100},
|
||||
{91, 832000, 862000, 1427000, 1432000, 20, 285400, 100},
|
||||
{92, 832000, 862000, 1432000, 1517000, 20, 286400, 100},
|
||||
{93, 880000, 915000, 1427000, 1432000, 20, 285400, 100},
|
||||
{94, 880000, 915000, 1432000, 1517000, 20, 286400, 100},
|
||||
{95, 2010000, 2025000, 000, 000, 20, 402000, 100},
|
||||
{257,26500020,29500000,26500020,29500000, 1,2054166, 60},
|
||||
{257,26500080,29500000,26500080,29500000, 2,2054167, 120},
|
||||
{258,24250080,27500000,24250080,27500000, 1,2016667, 60},
|
||||
{258,24250080,27500000,24250080,27500000, 2,2016667, 120},
|
||||
{260,37000020,40000000,37000020,40000000, 1,2229166, 60},
|
||||
{260,37000080,40000000,37000080,40000000, 2,2229167, 120},
|
||||
{261,27500040,28350000,27500040,28350000, 1,2070833, 60},
|
||||
{261,27500040,28350000,27500040,28350000, 2,2070833, 120}
|
||||
};
|
||||
|
||||
const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t);
|
||||
|
||||
int NRRIV2BW(int locationAndBandwidth,int N_RB) {
|
||||
int tmp = locationAndBandwidth/N_RB;
|
||||
int tmp2 = locationAndBandwidth%N_RB;
|
||||
|
||||
|
||||
if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp+1);
|
||||
else return(N_RB+1-tmp);
|
||||
|
||||
@@ -46,8 +119,6 @@ int NRRIV2BW(int locationAndBandwidth,int N_RB) {
|
||||
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) {
|
||||
int tmp = locationAndBandwidth/N_RB;
|
||||
int tmp2 = locationAndBandwidth%N_RB;
|
||||
|
||||
|
||||
if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp2);
|
||||
else return(N_RB-1-tmp2);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,20 @@
|
||||
#include <stdint.h>
|
||||
#include "assertions.h"
|
||||
|
||||
typedef struct nr_bandentry_s {
|
||||
int16_t band;
|
||||
uint64_t ul_min;
|
||||
uint64_t ul_max;
|
||||
uint64_t dl_min;
|
||||
uint64_t dl_max;
|
||||
uint64_t step_size;
|
||||
uint64_t N_OFFs_DL;
|
||||
uint8_t deltaf_raster;
|
||||
} nr_bandentry_t;
|
||||
|
||||
extern const size_t nr_bandtable_size;
|
||||
extern nr_bandentry_t nr_bandtable[];
|
||||
|
||||
int NRRIV2BW(int locationAndBandwidth,int N_RB);
|
||||
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
|
||||
int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize);
|
||||
|
||||
@@ -136,7 +136,7 @@ extern "C" {
|
||||
LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
|
||||
|
||||
if ( s > 50 )
|
||||
LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1);
|
||||
LOG_I(TMR,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message));
|
||||
|
||||
t->message_queue.insert(t->message_queue.begin(), message);
|
||||
eventfd_t sem_counter = 1;
|
||||
@@ -339,7 +339,9 @@ extern "C" {
|
||||
int itti_create_queue(const task_info_t *taskInfo) {
|
||||
pthread_mutex_lock (&lock_nb_queues);
|
||||
int newQueue=nb_queues++;
|
||||
AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),"");
|
||||
task_list_t **new_tasks = (task_list_t **)realloc(tasks, nb_queues * sizeof(*tasks));
|
||||
AssertFatal(new_tasks != NULL, "could not realloc() tasks list");
|
||||
tasks = new_tasks;
|
||||
tasks[newQueue]= new task_list_t;
|
||||
pthread_mutex_unlock (&lock_nb_queues);
|
||||
LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue);
|
||||
|
||||
@@ -340,6 +340,7 @@ void *rrc_enb_process_msg(void *);
|
||||
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
|
||||
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
|
||||
TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
|
||||
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\
|
||||
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
@@ -347,6 +348,7 @@ void *rrc_enb_process_msg(void *);
|
||||
TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_RRC_NSA_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_RRC_NSA_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_NAS_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
|
||||
|
||||
#define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc },
|
||||
@@ -475,6 +477,9 @@ void itti_subscribe_event_fd(task_id_t task_id, int fd);
|
||||
void itti_unsubscribe_event_fd(task_id_t task_id, int fd);
|
||||
|
||||
/** \brief Return the list of events excluding the fd associated with itti
|
||||
\the fd associated with itti can return, but it is marked events[i].events &= ~EPOLLIN
|
||||
\as it is not EPOLLIN, the reader should ignore this fd
|
||||
\or it can manage the list of fd's in his interest, so ignore the other ones
|
||||
\param task_id Task ID of the task
|
||||
\param events events list
|
||||
@returns number of events to handle
|
||||
|
||||
+82
-9
@@ -96,6 +96,54 @@ static void read_pipe(int p, char *b, int size) {
|
||||
}
|
||||
}
|
||||
|
||||
static int baseRunTimeCommand(char* cmd, size_t cmdSize) {
|
||||
FILE *fp;
|
||||
size_t retSize = 0;
|
||||
|
||||
fp = popen(cmd, "r");
|
||||
if(fp) {
|
||||
memset(cmd, 0, cmdSize);
|
||||
retSize = fread(cmd, 1, cmdSize, fp);
|
||||
fclose(fp);
|
||||
} else {
|
||||
LOG_D(HW,"%s:%d:%s: Cannot open %s\n", __FILE__, __LINE__, __FUNCTION__, cmd);
|
||||
}
|
||||
|
||||
if (retSize == 0) {
|
||||
return 0;
|
||||
}
|
||||
return atoi(cmd);
|
||||
}
|
||||
|
||||
int checkIfFedoraDistribution(void) {
|
||||
char cmd[200];
|
||||
|
||||
memset(cmd, 0, 200);
|
||||
sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora || true");
|
||||
return baseRunTimeCommand(cmd, 200);
|
||||
}
|
||||
|
||||
int checkIfGenericKernelOnFedora(void) {
|
||||
char cmd[200];
|
||||
|
||||
memset(cmd, 0, 200);
|
||||
sprintf(cmd, "uname -a | grep -c rt || true");
|
||||
return (1 - baseRunTimeCommand(cmd, 200));
|
||||
}
|
||||
|
||||
int checkIfInsideContainer(void) {
|
||||
char cmd[200];
|
||||
int res = 0;
|
||||
|
||||
memset(cmd, 0, 200);
|
||||
sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods' || true");
|
||||
res = baseRunTimeCommand(cmd, 200);
|
||||
if (res > 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* background process */
|
||||
/********************************************************************/
|
||||
@@ -199,15 +247,41 @@ void start_background_system(void) {
|
||||
|
||||
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
|
||||
struct sched_param sparam={0};
|
||||
sparam.sched_priority = priority;
|
||||
pthread_attr_setschedparam(&attr, &sparam);
|
||||
int ret;
|
||||
int settingPriority = 1;
|
||||
ret=pthread_attr_init(&attr);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
if (checkIfFedoraDistribution())
|
||||
if (checkIfGenericKernelOnFedora())
|
||||
if (checkIfInsideContainer())
|
||||
settingPriority = 0;
|
||||
|
||||
pthread_create(t, &attr, func, param);
|
||||
if (settingPriority) {
|
||||
ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
if(priority<sched_get_priority_min(SCHED_OAI) || priority>sched_get_priority_max(SCHED_FIFO)) {
|
||||
LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n",
|
||||
priority,
|
||||
sched_get_priority_min(SCHED_OAI),
|
||||
sched_get_priority_max(SCHED_OAI));
|
||||
if(priority<sched_get_priority_min(SCHED_OAI))
|
||||
priority=sched_get_priority_min(SCHED_OAI);
|
||||
if(priority>sched_get_priority_max(SCHED_OAI))
|
||||
priority=sched_get_priority_max(SCHED_OAI);
|
||||
}
|
||||
AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),"");
|
||||
struct sched_param sparam={0};
|
||||
sparam.sched_priority = priority;
|
||||
ret=pthread_attr_setschedparam(&attr, &sparam);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
}
|
||||
|
||||
ret=pthread_create(t, &attr, func, param);
|
||||
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
|
||||
|
||||
pthread_setname_np(*t, name);
|
||||
if (affinity != -1 ) {
|
||||
@@ -216,7 +290,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
|
||||
CPU_SET(affinity, &cpuset);
|
||||
AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity");
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
|
||||
|
||||
+13
-3
@@ -46,9 +46,11 @@ void set_latency_target(void);
|
||||
void configure_linux(void);
|
||||
|
||||
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority);
|
||||
#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_FIFO)
|
||||
#define OAI_PRIORITY_RT sched_get_priority_max(SCHED_FIFO)-10
|
||||
#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_FIFO)
|
||||
|
||||
#define SCHED_OAI SCHED_RR
|
||||
#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI)
|
||||
#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2)
|
||||
#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2
|
||||
|
||||
void thread_top_init(char *thread_name,
|
||||
int affinity,
|
||||
@@ -56,6 +58,14 @@ void thread_top_init(char *thread_name,
|
||||
uint64_t deadline,
|
||||
uint64_t period);
|
||||
|
||||
/****************************************************
|
||||
* Functions to check system at runtime.
|
||||
****************************************************/
|
||||
|
||||
int checkIfFedoraDistribution(void);
|
||||
int checkIfGenericKernelOnFedora(void);
|
||||
int checkIfInsideContainer(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -461,12 +461,12 @@ int process_command(char *buf) {
|
||||
int i,j,k;
|
||||
char modulename[TELNET_CMD_MAXSIZE];
|
||||
char cmd[TELNET_CMD_MAXSIZE];
|
||||
char cmdb[TELNET_MAX_MSGLENGTH];
|
||||
char *cmdb=NULL;
|
||||
char *bufbck;
|
||||
int rt;
|
||||
memset(modulename,0,sizeof(modulename));
|
||||
memset(cmd,0,sizeof(cmd));
|
||||
memset(cmdb,0,sizeof(cmdb));
|
||||
|
||||
|
||||
if (strncasecmp(buf,"ex",2) == 0)
|
||||
return CMDSTATUS_EXIT;
|
||||
@@ -490,12 +490,10 @@ int process_command(char *buf) {
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
|
||||
memset(modulename,0,sizeof(modulename));
|
||||
memset(cmd,0,sizeof(cmd));
|
||||
memset(cmdb,0,sizeof(cmdb));
|
||||
|
||||
bufbck=strdup(buf);
|
||||
rt=CMDSTATUS_NOTFOUND;
|
||||
j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb);
|
||||
j = sscanf(buf,"%19s %19s %m[^\t\n]",modulename,cmd,&cmdb);
|
||||
|
||||
if (telnetparams.telnetdbg > 0)
|
||||
printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb);
|
||||
@@ -562,7 +560,7 @@ int process_command(char *buf) {
|
||||
rt= CMDSTATUS_FOUND;
|
||||
} /* loop */
|
||||
} /* for i */
|
||||
|
||||
free(cmdb);
|
||||
free(bufbck);
|
||||
return rt;
|
||||
}
|
||||
@@ -702,7 +700,7 @@ void poll_telnetcmdq(void *qid, void *arg) {
|
||||
*/
|
||||
void exec_moduleinit(char *modname) {
|
||||
void (*fptr)(void);
|
||||
char initfunc[TELNET_CMD_MAXSIZE+9];
|
||||
char initfunc[TELNET_CMD_MAXSIZE+10];
|
||||
|
||||
if (strlen(modname) > TELNET_CMD_MAXSIZE) {
|
||||
fprintf(stderr,"[TELNETSRV] module %s not loaded, name exceeds the %i size limit\n",
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#ifndef TELNETSRV_H
|
||||
#define TELNETSRV_H
|
||||
|
||||
#include <common/ran_context.h>
|
||||
#define TELNETSRV_MODNAME "telnetsrv"
|
||||
|
||||
#define TELNET_PORT 9090
|
||||
|
||||
@@ -37,14 +37,21 @@
|
||||
#else
|
||||
#define THREADINIT PTHREAD_MUTEX_INITIALIZER
|
||||
#endif
|
||||
#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,"");
|
||||
#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,"");
|
||||
#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,"");
|
||||
#define mutexinit(mutex) {int ret=pthread_mutex_init(&mutex,NULL); \
|
||||
AssertFatal(ret==0,"ret=%d\n",ret);}
|
||||
#define condinit(signal) {int ret=pthread_cond_init(&signal,NULL); \
|
||||
AssertFatal(ret==0,"ret=%d\n",ret);}
|
||||
#define mutexlock(mutex) {int ret=pthread_mutex_lock(&mutex); \
|
||||
AssertFatal(ret==0,"ret=%d\n",ret);}
|
||||
#define mutextrylock(mutex) pthread_mutex_trylock(&mutex)
|
||||
#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,"");
|
||||
#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,"");
|
||||
#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
|
||||
#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
|
||||
#define mutexunlock(mutex) {int ret=pthread_mutex_unlock(&mutex); \
|
||||
AssertFatal(ret==0,"ret=%d\n",ret);}
|
||||
#define condwait(condition, mutex) {int ret=pthread_cond_wait(&condition, &mutex); \
|
||||
AssertFatal(ret==0,"ret=%d\n",ret);}
|
||||
#define condbroadcast(signal) {int ret=pthread_cond_broadcast(&signal); \
|
||||
AssertFatal(ret==0,"ret=%d\n",ret);}
|
||||
#define condsignal(signal) {int ret=pthread_cond_broadcast(&signal); \
|
||||
AssertFatal(ret==0,"ret=%d\n",ret);}
|
||||
#define tpool_nbthreads(tpool) (tpool.nbThreads)
|
||||
typedef struct notifiedFIFO_elt_s {
|
||||
struct notifiedFIFO_elt_s *next;
|
||||
@@ -78,7 +85,7 @@ static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size,
|
||||
ret->reponseFifo=reponseFifo;
|
||||
ret->processingFunc=processingFunc;
|
||||
// We set user data piece aligend 32 bytes to be able to process it with SIMD
|
||||
ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32;
|
||||
ret->msgData=(void *)((uint8_t*)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32);
|
||||
ret->malloced=true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -210,8 +210,8 @@ time the worker finished the job
|
||||
time the client reads the result
|
||||
|
||||
if you set the environement variable:
|
||||
thread-pool-measurements to a valid file name
|
||||
threadPoolMeasurements to a valid file name
|
||||
These measurements will be wrote to this Linux pipe.
|
||||
|
||||
A tool to read the linux fifo and display it in ascii is provided:
|
||||
see the local directory Makefile for this tool and to compile the thread pool unitary tests.
|
||||
A tool to read the linux fifo and display it in ascii is provided; compute the binay:
|
||||
in cmake building directory: make/ninja measurement_display
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define sizeofArray(a) (sizeof(a)/sizeof(*(a)))
|
||||
void *calloc_or_fail(size_t size);
|
||||
void *malloc_or_fail(size_t size);
|
||||
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len);
|
||||
|
||||
Reference in New Issue
Block a user