Commit 79fc7447 authored by frtabu's avatar frtabu

fix usrp problem, and some cppcheck errors

parent 10a3565d
...@@ -187,7 +187,6 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t ...@@ -187,7 +187,6 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
if (nfapi_mode == 0 || nfapi_mode == 1) */ if (nfapi_mode == 0 || nfapi_mode == 1) */
pthread_mutex_lock(&gNB->UL_INFO_mutex); pthread_mutex_lock(&gNB->UL_INFO_mutex);
gNB->UL_INFO.frame = frame_rx; gNB->UL_INFO.frame = frame_rx;
gNB->UL_INFO.slot = slot_rx; gNB->UL_INFO.slot = slot_rx;
...@@ -907,7 +906,6 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { ...@@ -907,7 +906,6 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = gNB->harq_pdu_list; gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = gNB->harq_pdu_list;
gNB->UL_INFO.cqi_ind.cqi_pdu_list = gNB->cqi_pdu_list; gNB->UL_INFO.cqi_ind.cqi_pdu_list = gNB->cqi_pdu_list;
gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list; gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;
gNB->prach_energy_counter = 0; gNB->prach_energy_counter = 0;
} }
} }
......
...@@ -525,6 +525,7 @@ void trashFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { ...@@ -525,6 +525,7 @@ void trashFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
dummy_rx, dummy_rx,
UE->frame_parms.samples_per_subframe, UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_rx); UE->frame_parms.nb_antennas_rx);
if (IS_SOFTMODEM_RFSIM ) { if (IS_SOFTMODEM_RFSIM ) {
usleep(1000); // slow down, as would do actuall rf to let cpu for the synchro thread usleep(1000); // slow down, as would do actuall rf to let cpu for the synchro thread
} }
...@@ -681,14 +682,12 @@ void *UE_thread(void *arg) { ...@@ -681,14 +682,12 @@ void *UE_thread(void *arg) {
curMsg->proc.decoded_frame_rx=-1; curMsg->proc.decoded_frame_rx=-1;
//LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB); //LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB);
#ifdef OAI_ADRV9371_ZC706 #ifdef OAI_ADRV9371_ZC706
/*uint32_t total_gain_dB_prev = 0; /*uint32_t total_gain_dB_prev = 0;
if (total_gain_dB_prev != UE->rx_total_gain_dB) { if (total_gain_dB_prev != UE->rx_total_gain_dB) {
total_gain_dB_prev = UE->rx_total_gain_dB; total_gain_dB_prev = UE->rx_total_gain_dB;
openair0_cfg[0].rx_gain[0] = UE->rx_total_gain_dB; openair0_cfg[0].rx_gain[0] = UE->rx_total_gain_dB;
UE->rfdevice.trx_set_gains_func(&UE->rfdevice,&openair0_cfg[0]); UE->rfdevice.trx_set_gains_func(&UE->rfdevice,&openair0_cfg[0]);
}*/ }*/
#endif #endif
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
...@@ -721,7 +720,7 @@ void *UE_thread(void *arg) { ...@@ -721,7 +720,7 @@ void *UE_thread(void *arg) {
readBlockSize, readBlockSize,
UE->frame_parms.nb_antennas_rx),""); UE->frame_parms.nb_antennas_rx),"");
if (slot_nr==18) if (slot_nr==18)
AssertFatal( writeBlockSize == AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice, UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+ timestamp+
......
...@@ -478,8 +478,7 @@ void init_openair0(void) { ...@@ -478,8 +478,7 @@ void init_openair0(void) {
if (frame_parms[0]->threequarter_fs) { if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=92.16e6; openair0_cfg[card].sample_rate=92.16e6;
openair0_cfg[card].samples_per_frame = 921600; openair0_cfg[card].samples_per_frame = 921600;
} } else {
else {
openair0_cfg[card].sample_rate=122.88e6; openair0_cfg[card].sample_rate=122.88e6;
openair0_cfg[card].samples_per_frame = 1228800; openair0_cfg[card].samples_per_frame = 1228800;
} }
...@@ -487,12 +486,11 @@ void init_openair0(void) { ...@@ -487,12 +486,11 @@ void init_openair0(void) {
LOG_E(PHY,"Unsupported numerology!\n"); LOG_E(PHY,"Unsupported numerology!\n");
exit(-1); exit(-1);
} }
}else if(frame_parms[0]->N_RB_DL == 273) { } else if(frame_parms[0]->N_RB_DL == 273) {
if (numerology==1) { if (numerology==1) {
if (frame_parms[0]->threequarter_fs) { if (frame_parms[0]->threequarter_fs) {
AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n"); AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n");
} } else {
else {
openair0_cfg[card].sample_rate=122.88e6; openair0_cfg[card].sample_rate=122.88e6;
openair0_cfg[card].samples_per_frame = 1228800; openair0_cfg[card].samples_per_frame = 1228800;
} }
...@@ -513,8 +511,7 @@ void init_openair0(void) { ...@@ -513,8 +511,7 @@ void init_openair0(void) {
if (frame_parms[0]->threequarter_fs) { if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=46.08e6; openair0_cfg[card].sample_rate=46.08e6;
openair0_cfg[card].samples_per_frame = 480800; openair0_cfg[card].samples_per_frame = 480800;
} } else {
else {
openair0_cfg[card].sample_rate=61.44e6; openair0_cfg[card].sample_rate=61.44e6;
openair0_cfg[card].samples_per_frame = 614400; openair0_cfg[card].samples_per_frame = 614400;
} }
...@@ -534,8 +531,7 @@ void init_openair0(void) { ...@@ -534,8 +531,7 @@ void init_openair0(void) {
} else if (frame_parms[0]->N_RB_DL == 6) { } else if (frame_parms[0]->N_RB_DL == 6) {
openair0_cfg[card].sample_rate=1.92e6; openair0_cfg[card].sample_rate=1.92e6;
openair0_cfg[card].samples_per_frame = 19200; openair0_cfg[card].samples_per_frame = 19200;
} } else {
else {
LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms[0]->N_RB_DL); LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms[0]->N_RB_DL);
exit(-1); exit(-1);
} }
...@@ -620,10 +616,7 @@ int main( int argc, char **argv ) { ...@@ -620,10 +616,7 @@ int main( int argc, char **argv ) {
logInit(); logInit();
// get options and fill parameters from configuration file // get options and fill parameters from configuration file
get_options (); //Command-line options, enb_properties get_options (); //Command-line options, enb_properties
set_softmodem_optmask(SOFTMODEM_NRUE_BIT); set_softmodem_optmask(SOFTMODEM_NRUE_BIT);
#if T_TRACER #if T_TRACER
T_Config_Init(); T_Config_Init();
#endif #endif
......
...@@ -114,7 +114,6 @@ void get_common_options(void) { ...@@ -114,7 +114,6 @@ void get_common_options(void) {
set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT); set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT);
} }
if(parallel_config != NULL) set_parallel_conf(parallel_config); if(parallel_config != NULL) set_parallel_conf(parallel_config);
if(worker_config != NULL) set_worker_conf(worker_config); if(worker_config != NULL) set_worker_conf(worker_config);
......
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
int16_t *base_sequence_less_than_36(unsigned int M_ZC, int16_t *base_sequence_less_than_36(unsigned int M_ZC,
unsigned int u, unsigned int u,
unsigned int scaling) unsigned int scaling) {
{
char *phi_table; char *phi_table;
int16_t *rv_overbar; int16_t *rv_overbar;
double x; double x;
...@@ -67,17 +66,22 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC, ...@@ -67,17 +66,22 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
case 6: case 6:
phi_table = (char *)phi_M_ZC_6; phi_table = (char *)phi_M_ZC_6;
break; break;
case 12: case 12:
phi_table = (char *)phi_M_ZC_12; phi_table = (char *)phi_M_ZC_12;
break; break;
case 18: case 18:
phi_table = (char *)phi_M_ZC_18; phi_table = (char *)phi_M_ZC_18;
break; break;
case 24: case 24:
phi_table = (char *)phi_M_ZC_24; phi_table = (char *)phi_M_ZC_24;
break; break;
case 30: case 30:
break; break;
default: default:
printf("function base_sequence_less_than 36_: unsupported base sequence size : %u \n", M_ZC); printf("function base_sequence_less_than 36_: unsupported base sequence size : %u \n", M_ZC);
abort(); abort();
...@@ -97,14 +101,14 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC, ...@@ -97,14 +101,14 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
rv_overbar[2*n] =(int16_t)(floor(scaling*cos(x))); rv_overbar[2*n] =(int16_t)(floor(scaling*cos(x)));
rv_overbar[2*n+1] =(int16_t)(floor(scaling*sin(x))); rv_overbar[2*n+1] =(int16_t)(floor(scaling*sin(x)));
} }
} } else {
else {
for (n=0; n<M_ZC; n++) { for (n=0; n<M_ZC; n++) {
x = (double)phi_table[n + u*M_ZC] * (M_PI/4); x = (double)phi_table[n + u*M_ZC] * (M_PI/4);
rv_overbar[2*n] = (int16_t)(floor(scaling*cos(x))); rv_overbar[2*n] = (int16_t)(floor(scaling*cos(x)));
rv_overbar[2*n+1] = (int16_t)(floor(scaling*sin(x))); rv_overbar[2*n+1] = (int16_t)(floor(scaling*sin(x)));
} }
} }
return rv_overbar; return rv_overbar;
} }
...@@ -126,22 +130,20 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC, ...@@ -126,22 +130,20 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
int16_t *base_sequence_36_or_larger(unsigned int Msc_RS, int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
unsigned int u, unsigned int u,
unsigned int v, unsigned int v,
unsigned int scaling) unsigned int scaling) {
{
int16_t *rv_overbar; int16_t *rv_overbar;
unsigned int N_ZC; unsigned int N_ZC;
double q_overbar, x; double q_overbar, x;
unsigned int q,m,n; unsigned int q,m,n;
unsigned int M_ZC = ul_allocated_re[Msc_RS]; unsigned int M_ZC = ul_allocated_re[Msc_RS];
rv_overbar = malloc16(IQ_SIZE*M_ZC); rv_overbar = malloc16(IQ_SIZE*M_ZC);
if (rv_overbar == NULL) { if (rv_overbar == NULL) {
msg("Fatal memory allocation problem \n"); msg("Fatal memory allocation problem \n");
assert(0); assert(0);
} }
N_ZC = ref_ul_primes[Msc_RS]; /* The length N_ZC is given by the largest prime number such that N_ZC < M_ZC */ N_ZC = ref_ul_primes[Msc_RS]; /* The length N_ZC is given by the largest prime number such that N_ZC < M_ZC */
q_overbar = N_ZC * (u+1)/(double)31; q_overbar = N_ZC * (u+1)/(double)31;
/* q = (q_overbar + 1/2) + v.(-1)^(2q_overbar) */ /* q = (q_overbar + 1/2) + v.(-1)^(2q_overbar) */
...@@ -156,6 +158,7 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS, ...@@ -156,6 +158,7 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
rv_overbar[2*n] = (int16_t)(floor(scaling*cos(M_PI*x))); /* cos(-x) = cos(x) */ rv_overbar[2*n] = (int16_t)(floor(scaling*cos(M_PI*x))); /* cos(-x) = cos(x) */
rv_overbar[2*n+1] = -(int16_t)(floor(scaling*sin(M_PI*x))); /* sin(-x) = -sin(x) */ rv_overbar[2*n+1] = -(int16_t)(floor(scaling*sin(M_PI*x))); /* sin(-x) = -sin(x) */
} }
return rv_overbar; return rv_overbar;
} }
...@@ -173,19 +176,16 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS, ...@@ -173,19 +176,16 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
* *
*********************************************************************/ *********************************************************************/
void generate_ul_reference_signal_sequences(unsigned int scaling) void generate_ul_reference_signal_sequences(unsigned int scaling) {
{
unsigned int u,v,Msc_RS; unsigned int u,v,Msc_RS;
#if 0 #if 0
char output_file[255]; char output_file[255];
char sequence_name[255]; char sequence_name[255];
#endif #endif
for (Msc_RS=0; Msc_RS <= INDEX_SB_LESS_32; Msc_RS++) { for (Msc_RS=0; Msc_RS <= INDEX_SB_LESS_32; Msc_RS++) {
v = 0; v = 0;
for (u=0; u < U_GROUP_NUMBER; u++) { for (u=0; u < U_GROUP_NUMBER; u++) {
rv_ul_ref_sig[u][v][Msc_RS] = base_sequence_less_than_36(ul_allocated_re[Msc_RS], u, scaling); rv_ul_ref_sig[u][v][Msc_RS] = base_sequence_less_than_36(ul_allocated_re[Msc_RS], u, scaling);
#if 0 #if 0
...@@ -193,7 +193,6 @@ void generate_ul_reference_signal_sequences(unsigned int scaling) ...@@ -193,7 +193,6 @@ void generate_ul_reference_signal_sequences(unsigned int scaling)
sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]); sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]);
printf("u %d Msc_RS %d allocate memory %x of size %d \n", u, Msc_RS, rv_ul_ref_sig[u][v][Msc_RS], (IQ_SIZE* ul_allocated_re[Msc_RS])); printf("u %d Msc_RS %d allocate memory %x of size %d \n", u, Msc_RS, rv_ul_ref_sig[u][v][Msc_RS], (IQ_SIZE* ul_allocated_re[Msc_RS]));
write_output(output_file, sequence_name, rv_ul_ref_sig[u][v][Msc_RS], ul_allocated_re[Msc_RS], 1, 1); write_output(output_file, sequence_name, rv_ul_ref_sig[u][v][Msc_RS], ul_allocated_re[Msc_RS], 1, 1);
#endif #endif
} }
} }
...@@ -207,7 +206,6 @@ void generate_ul_reference_signal_sequences(unsigned int scaling) ...@@ -207,7 +206,6 @@ void generate_ul_reference_signal_sequences(unsigned int scaling)
sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]); sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]);
printf("u %d Msc_RS %d allocate memory %x of size %d \n", u, Msc_RS, rv_ul_ref_sig[u][v][Msc_RS], (IQ_SIZE* ul_allocated_re[Msc_RS])); printf("u %d Msc_RS %d allocate memory %x of size %d \n", u, Msc_RS, rv_ul_ref_sig[u][v][Msc_RS], (IQ_SIZE* ul_allocated_re[Msc_RS]));
write_output(output_file, sequence_name, rv_ul_ref_sig[u][v][Msc_RS], ul_allocated_re[Msc_RS], 1, 1); write_output(output_file, sequence_name, rv_ul_ref_sig[u][v][Msc_RS], ul_allocated_re[Msc_RS], 1, 1);
#endif #endif
} }
} }
...@@ -225,9 +223,9 @@ void generate_ul_reference_signal_sequences(unsigned int scaling) ...@@ -225,9 +223,9 @@ void generate_ul_reference_signal_sequences(unsigned int scaling)
* DESCRIPTION : free of uplink reference signal sequences * DESCRIPTION : free of uplink reference signal sequences
* *
*********************************************************************/ *********************************************************************/
void free_ul_reference_signal_sequences(void) void free_ul_reference_signal_sequences(void) {
{
unsigned int u,v,Msc_RS; unsigned int u,v,Msc_RS;
for (Msc_RS=0; Msc_RS < SRS_SB_CONF; Msc_RS++) { for (Msc_RS=0; Msc_RS < SRS_SB_CONF; Msc_RS++) {
for (u=0; u < U_GROUP_NUMBER; u++) { for (u=0; u < U_GROUP_NUMBER; u++) {
for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) { for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) {
......
...@@ -80,7 +80,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, ...@@ -80,7 +80,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
time_stats_t *dlsch_modulation_stats); time_stats_t *dlsch_modulation_stats);
void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); void free_gNB_dlsch(NR_gNB_DLSCH_t **dlsch);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
......
This diff is collapsed.
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch); void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch);
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag); NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
...@@ -67,7 +67,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -67,7 +67,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
@param n_RNTI, CRNTI @param n_RNTI, CRNTI
*/ */
void nr_ulsch_unscrambling(int16_t* llr, void nr_ulsch_unscrambling(int16_t *llr,
uint32_t size, uint32_t size,
uint8_t q, uint8_t q,
uint32_t Nid, uint32_t Nid,
......
This diff is collapsed.
This diff is collapsed.
...@@ -64,8 +64,7 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; ...@@ -64,8 +64,7 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
uint16_t n_rnti = 0x1234; uint16_t n_rnti = 0x1234;
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
int main(int argc, char **argv) int main(int argc, char **argv) {
{
char c; char c;
int i; //,j,l,aa; int i; //,j,l,aa;
double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0; double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0;
...@@ -111,7 +110,6 @@ int main(int argc, char **argv) ...@@ -111,7 +110,6 @@ int main(int argc, char **argv)
uint16_t nb_rb = 50; uint16_t nb_rb = 50;
uint8_t Imcs = 9; uint8_t Imcs = 9;
uint8_t mcs_table = 0; uint8_t mcs_table = 0;
cpuf = get_cpu_freq_GHz(); cpuf = get_cpu_freq_GHz();
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) { if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) {
...@@ -137,7 +135,6 @@ int main(int argc, char **argv) ...@@ -137,7 +135,6 @@ int main(int argc, char **argv)
/*case 'd': /*case 'd':
frame_type = 1; frame_type = 1;
break;*/ break;*/
case 'g': case 'g':
switch ((char) *optarg) { switch ((char) *optarg) {
case 'A': case 'A':
...@@ -293,7 +290,8 @@ int main(int argc, char **argv) ...@@ -293,7 +290,8 @@ int main(int argc, char **argv)
default: default:
case 'h': case 'h':
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]); printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
argv[0]);
printf("-h This message\n"); printf("-h This message\n");
printf("-p Use extended prefix mode\n"); printf("-p Use extended prefix mode\n");
printf("-V Enable VCD dumb functions\n"); printf("-V Enable VCD dumb functions\n");
...@@ -480,9 +478,10 @@ int main(int argc, char **argv) ...@@ -480,9 +478,10 @@ int main(int argc, char **argv)
test_input[i] = (unsigned char) rand(); test_input[i] = (unsigned char) rand();
//estimated_output = harq_process->b; //estimated_output = harq_process->b;
#ifdef DEBUG_NR_DLSCHSIM #ifdef DEBUG_NR_DLSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]); for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]);
#endif #endif
/*for (int i=0; i<TBS/8; i++) /*for (int i=0; i<TBS/8; i++)
...@@ -500,10 +499,13 @@ int main(int argc, char **argv) ...@@ -500,10 +499,13 @@ int main(int argc, char **argv)
for (trial = 0; trial < n_trials; trial++) { for (trial = 0; trial < n_trials; trial++) {
errors_bit_uncoded = 0; errors_bit_uncoded = 0;
for (i = 0; i < available_bits; i++) { for (i = 0; i < available_bits; i++) {
#ifdef DEBUG_CODER #ifdef DEBUG_CODER
if ((i&0xf)==0) if ((i&0xf)==0)
printf("\ne %d..%d: ",i,i+15); printf("\ne %d..%d: ",i,i+15);
#endif #endif
//if (i<16) //if (i<16)
...@@ -544,13 +546,10 @@ int main(int argc, char **argv) ...@@ -544,13 +546,10 @@ int main(int argc, char **argv)
printf("\n"); printf("\n");
exit(-1); exit(-1);
#endif #endif
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0, VCD_FUNCTION_IN); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0, VCD_FUNCTION_IN);
ret = nr_dlsch_decoding(UE, channel_output_fixed, &UE->frame_parms, ret = nr_dlsch_decoding(UE, channel_output_fixed, &UE->frame_parms,
dlsch0_ue, dlsch0_ue->harq_processes[0], frame, nb_symb_sch, dlsch0_ue, dlsch0_ue->harq_processes[0], frame, nb_symb_sch,
slot,harq_pid, is_crnti, llr8_flag); slot,harq_pid, is_crnti, llr8_flag);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0, VCD_FUNCTION_OUT); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0, VCD_FUNCTION_OUT);
if (ret > dlsch0_ue->max_ldpc_iterations) if (ret > dlsch0_ue->max_ldpc_iterations)
...@@ -571,6 +570,7 @@ int main(int argc, char **argv) ...@@ -571,6 +570,7 @@ int main(int argc, char **argv)
if (errors_bit > 0) { if (errors_bit > 0) {
n_false_positive++; n_false_positive++;
if (n_trials == 1) if (n_trials == 1)
printf("errors_bit %u (trial %d)\n", errors_bit, trial); printf("errors_bit %u (trial %d)\n", errors_bit, trial);
} }
...@@ -621,7 +621,7 @@ int main(int argc, char **argv) ...@@ -621,7 +621,7 @@ int main(int argc, char **argv)
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
printf("gNB %d\n", i); printf("gNB %d\n", i);
free_gNB_dlsch(gNB->dlsch[0][i]); free_gNB_dlsch(&(gNB->dlsch[0][i]));
printf("UE %d\n", i); printf("UE %d\n", i);
free_nr_ue_dlsch(UE->dlsch[0][0][i]); free_nr_ue_dlsch(UE->dlsch[0][0][i]);
} }
......
...@@ -540,9 +540,6 @@ rrc_pdcp_config_security( ...@@ -540,9 +540,6 @@ rrc_pdcp_config_security(
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kenb, ue_context_pP->ue_context.kenb,
&kRRCint); &kRRCint);
#if !defined(USRP_REC_PLAY)
SET_LOG_DUMP(DEBUG_SECURITY) ;
#endif
if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) { if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) {
if (print_keys ==1 ) { if (print_keys ==1 ) {
......
...@@ -377,7 +377,22 @@ static void trx_usrp_end(openair0_device *device) { ...@@ -377,7 +377,22 @@ static void trx_usrp_end(openair0_device *device) {
} }
} }
} }
/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
@param device pointer to the device structure specific to the RF hardware target
@param timestamp The timestamp at which the first sample MUST be sent
@param buff Buffer which holds the samples
@param nsamps number of samples to be sent
@param antenna_id index of the antenna if the device has multiple antennas
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/
static int trx_usrp_write_recplay(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
struct timespec req;
usrp_state_t *s = (usrp_state_t *)device->priv;
req.tv_sec = 0;
req.tv_nsec = s->recplay_state->u_sf_write_delay * 1000;
nanosleep(&req, NULL);
return nsamps;
}
/*! \brief Called to send samples to the USRP RF target /*! \brief Called to send samples to the USRP RF target
@param device pointer to the device structure specific to the RF hardware target @param device pointer to the device structure specific to the RF hardware target
@param timestamp The timestamp at which the first sample MUST be sent @param timestamp The timestamp at which the first sample MUST be sent
...@@ -389,8 +404,6 @@ static void trx_usrp_end(openair0_device *device) { ...@@ -389,8 +404,6 @@ static void trx_usrp_end(openair0_device *device) {
static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int ret=0; int ret=0;
usrp_state_t *s = (usrp_state_t *)device->priv; usrp_state_t *s = (usrp_state_t *)device->priv;
if (s->recplay_mode != RECPLAY_REPLAYMODE) { // not replay mode
int nsamps2; // aligned to upper 32 or 16 byte boundary int nsamps2; // aligned to upper 32 or 16 byte boundary
#if defined(__x86_64) || defined(__i386__) #if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__ #ifdef __AVX2__
...@@ -510,13 +523,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -510,13 +523,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
} /* end of developnr code */ } /* end of developnr code */
if (ret != nsamps) LOG_E(HW,"[xmit] tx samples %d != %d\n",ret,nsamps); if (ret != nsamps) LOG_E(HW,"[xmit] tx samples %d != %d\n",ret,nsamps);
} else {
struct timespec req;
req.tv_sec = 0;
req.tv_nsec = s->recplay_state->u_sf_write_delay * 1000;
nanosleep(&req, NULL);
ret = nsamps;
}
return ret; return ret;
} }
...@@ -932,7 +938,9 @@ static void uhd_set_thread_priority(void) { ...@@ -932,7 +938,9 @@ static void uhd_set_thread_priority(void) {
uhd::set_thread_priority_safe(1.0); uhd::set_thread_priority_safe(1.0);
} }
void noop_func(void) {
return;
}
extern "C" { extern "C" {
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
LOG_D(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs); LOG_D(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs);
...@@ -941,7 +949,8 @@ extern "C" { ...@@ -941,7 +949,8 @@ extern "C" {
if ( device->priv == NULL) { if ( device->priv == NULL) {
s=(usrp_state_t *)calloc(sizeof(usrp_state_t),1); s=(usrp_state_t *)calloc(sizeof(usrp_state_t),1);
device->priv = s; device->priv=s;
AssertFatal( s!=NULL,"USRP device: memory allocation failure\n");
} else { } else {
LOG_E(HW, "multiple device init detected\n"); LOG_E(HW, "multiple device init detected\n");
return 0; return 0;
...@@ -949,11 +958,17 @@ extern "C" { ...@@ -949,11 +958,17 @@ extern "C" {
device->openair0_cfg = openair0_cfg; device->openair0_cfg = openair0_cfg;
read_usrpconfig(&(s->recplay_mode), &(s->recplay_state)); read_usrpconfig(&(s->recplay_mode), &(s->recplay_state));
device->trx_start_func = trx_usrp_start;
device->trx_get_stats_func = trx_usrp_get_stats;
device->trx_reset_stats_func = trx_usrp_reset_stats;
device->trx_end_func = trx_usrp_end;
device->trx_stop_func = trx_usrp_stop;
device->trx_set_freq_func = trx_usrp_set_freq;
device->trx_set_gains_func = trx_usrp_set_gains;
if (s!=NULL && s->recplay_mode == RECPLAY_REPLAYMODE) { if ( s->recplay_mode == RECPLAY_REPLAYMODE) {
// Replay subframes from from file // Replay subframes from from file
int bw_gain_adjust=0; int bw_gain_adjust=0;
device->openair0_cfg = openair0_cfg;
device->type = USRP_B200_DEV; device->type = USRP_B200_DEV;
openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38; openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
bw_gain_adjust=1; bw_gain_adjust=1;
...@@ -963,17 +978,9 @@ extern "C" { ...@@ -963,17 +978,9 @@ extern "C" {
openair0_cfg[0].iq_txshift = 4;//shift openair0_cfg[0].iq_txshift = 4;//shift
openair0_cfg[0].iq_rxrescale = 15;//rescale iqs openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
set_rx_gain_offset(&openair0_cfg[0],0,bw_gain_adjust); set_rx_gain_offset(&openair0_cfg[0],0,bw_gain_adjust);
device->trx_start_func = trx_usrp_start; device->trx_write_func = trx_usrp_write_recplay;
device->trx_write_func = trx_usrp_write;
device->trx_read_func = trx_usrp_read_recplay; device->trx_read_func = trx_usrp_read_recplay;
device->trx_get_stats_func = trx_usrp_get_stats; device->uhd_set_thread_priority = noop_func;
device->trx_reset_stats_func = trx_usrp_reset_stats;
device->trx_end_func = trx_usrp_end;
device->trx_stop_func = trx_usrp_stop;
device->trx_set_freq_func = trx_usrp_set_freq;
device->trx_set_gains_func = trx_usrp_set_gains;
device->openair0_cfg = openair0_cfg;
device->uhd_set_thread_priority = uhd_set_thread_priority;
std::cerr << "USRP device initialized in subframes replay mode for " << s->recplay_state->u_sf_loops << " loops. Use mmap=" std::cerr << "USRP device initialized in subframes replay mode for " << s->recplay_state->u_sf_loops << " loops. Use mmap="
<< s->recplay_state->use_mmap << std::endl; << s->recplay_state->use_mmap << std::endl;
} else { } else {
...@@ -1110,13 +1117,9 @@ extern "C" { ...@@ -1110,13 +1117,9 @@ extern "C" {
break; break;
case 46080000: case 46080000:
<<<<<<< HEAD
//openair0_cfg[0].samples_per_packet = 2048; //openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15; openair0_cfg[0].tx_sample_advance = 15;
=======
//openair0_cfg[0].samples_per_packet = 1024; //openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 115;
>>>>>>> Try to fix LTE UE connection problem
openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].tx_bw = 40e6;
openair0_cfg[0].rx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6;
break; break;
...@@ -1318,16 +1321,8 @@ extern "C" { ...@@ -1318,16 +1321,8 @@ extern "C" {
} }
LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs()); LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs());
device->trx_start_func = trx_usrp_start;
device->trx_write_func = trx_usrp_write; device->trx_write_func = trx_usrp_write;
device->trx_read_func = trx_usrp_read; device->trx_read_func = trx_usrp_read;
device->trx_get_stats_func = trx_usrp_get_stats;
device->trx_reset_stats_func = trx_usrp_reset_stats;
device->trx_end_func = trx_usrp_end;
device->trx_stop_func = trx_usrp_stop;
device->trx_set_freq_func = trx_usrp_set_freq;
device->trx_set_gains_func = trx_usrp_set_gains;
device->openair0_cfg = openair0_cfg;
device->uhd_set_thread_priority = uhd_set_thread_priority; device->uhd_set_thread_priority = uhd_set_thread_priority;
s->sample_rate = openair0_cfg[0].sample_rate; s->sample_rate = openair0_cfg[0].sample_rate;
......
...@@ -115,7 +115,6 @@ typedef struct { ...@@ -115,7 +115,6 @@ typedef struct {
size_t mapsize; size_t mapsize;
iqrec_t *ms_sample; // memory for all subframes iqrec_t *ms_sample; // memory for all subframes
unsigned int nb_samples; unsigned int nb_samples;
unsigned int u_sf_mode; // 1=record, 2=replay
char u_sf_filename[1024]; // subframes file path char u_sf_filename[1024]; // subframes file path
unsigned int u_sf_max ; // max number of recorded subframes unsigned int u_sf_max ; // max number of recorded subframes
unsigned int u_sf_loops ; // number of loops in replay mode unsigned int u_sf_loops ; // number of loops in replay mode
......
...@@ -80,7 +80,7 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -80,7 +80,7 @@ unsigned short config_frames[4] = {2,9,11,13};
//#include "PHY/TOOLS/time_meas.h" //#include "PHY/TOOLS/time_meas.h"
#ifndef OPENAIR2 #ifndef OPENAIR2
#include "UTIL/OTG/otg_vars.h" #include "UTIL/OTG/otg_vars.h"
#endif #endif
...@@ -256,6 +256,7 @@ void exit_function(const char *file, const char *function, const int line, const ...@@ -256,6 +256,7 @@ void exit_function(const char *file, const char *function, const int line, const
if (s != NULL) { if (s != NULL) {
printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s); printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
} }
close_log_mem(); close_log_mem();
oai_exit = 1; oai_exit = 1;
...@@ -515,8 +516,7 @@ static void wait_nfapi_init(char *thread_name) { ...@@ -515,8 +516,7 @@ static void wait_nfapi_init(char *thread_name) {
printf( "NFAPI: got sync (%s)\n", thread_name); printf( "NFAPI: got sync (%s)\n", thread_name);
} }
int main ( int argc, char **argv ) int main ( int argc, char **argv ) {
{
int i; int i;
int CC_id = 0; int CC_id = 0;
int ru_id; int ru_id;
...@@ -531,13 +531,13 @@ int main ( int argc, char **argv ) ...@@ -531,13 +531,13 @@ int main ( int argc, char **argv )
logInit(); logInit();
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
get_options (); get_options ();
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1; EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n"); fprintf(stderr,"Getting configuration failed\n");
exit(-1); exit(-1);
} }
set_softmodem_optmask(SOFTMODEM_ENB_BIT); set_softmodem_optmask(SOFTMODEM_ENB_BIT);
#if T_TRACER #if T_TRACER
T_Config_Init(); T_Config_Init();
...@@ -598,6 +598,7 @@ int main ( int argc, char **argv ) ...@@ -598,6 +598,7 @@ int main ( int argc, char **argv )
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration; RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
} }
node_type = RC.rrc[0]->node_type; node_type = RC.rrc[0]->node_type;
} else { } else {
printf("RC.nb_inst = 0, Initializing L1\n"); printf("RC.nb_inst = 0, Initializing L1\n");
...@@ -623,7 +624,6 @@ int main ( int argc, char **argv ) ...@@ -623,7 +624,6 @@ int main ( int argc, char **argv )
mlockall(MCL_CURRENT | MCL_FUTURE); mlockall(MCL_CURRENT | MCL_FUTURE);
pthread_cond_init(&sync_cond,NULL); pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL); pthread_mutex_init(&sync_mutex, NULL);
rt_sleep_ns(10*100000000ULL); rt_sleep_ns(10*100000000ULL);
if (NFAPI_MODE!=NFAPI_MONOLITHIC) { if (NFAPI_MODE!=NFAPI_MONOLITHIC) {
...@@ -701,15 +701,18 @@ int main ( int argc, char **argv ) ...@@ -701,15 +701,18 @@ int main ( int argc, char **argv )
pthread_mutex_unlock(&sync_mutex); pthread_mutex_unlock(&sync_mutex);
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
} }
// wait for end of program // wait for end of program
LOG_UI(ENB_APP,"TYPE <CTRL-C> TO TERMINATE\n"); LOG_UI(ENB_APP,"TYPE <CTRL-C> TO TERMINATE\n");
// CI -- Flushing the std outputs for the previous marker to show on the eNB / DU / CU log file // CI -- Flushing the std outputs for the previous marker to show on the eNB / DU / CU log file
fflush(stdout); fflush(stdout);
fflush(stderr); fflush(stderr);
// end of CI modifications // end of CI modifications
//getchar(); //getchar();
if(IS_SOFTMODEM_DOFORMS) if(IS_SOFTMODEM_DOFORMS)
load_softscope("enb"); load_softscope("enb");
itti_wait_tasks_end(); itti_wait_tasks_end();
oai_exit=1; oai_exit=1;
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit); LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
......
...@@ -314,7 +314,6 @@ static void get_options(void) { ...@@ -314,7 +314,6 @@ static void get_options(void) {
int timingadv = 0; int timingadv = 0;
uint8_t nfapi_mode = NFAPI_MONOLITHIC; uint8_t nfapi_mode = NFAPI_MONOLITHIC;
int simL1flag = 0; int simL1flag = 0;
set_default_frame_parms(frame_parms); set_default_frame_parms(frame_parms);
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
/* unknown parameters on command line will be checked in main /* unknown parameters on command line will be checked in main
...@@ -622,7 +621,6 @@ int main( int argc, char **argv ) { ...@@ -622,7 +621,6 @@ int main( int argc, char **argv ) {
cpuf=get_cpu_freq_GHz(); cpuf=get_cpu_freq_GHz();
pthread_cond_init(&sync_cond,NULL); pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL); pthread_mutex_init(&sync_mutex, NULL);
printf("ITTI init\n"); printf("ITTI init\n");
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
...@@ -680,10 +678,7 @@ int main( int argc, char **argv ) { ...@@ -680,10 +678,7 @@ int main( int argc, char **argv ) {
} }
cpuf=get_cpu_freq_GHz(); cpuf=get_cpu_freq_GHz();
#if 0 // #ifndef DEADLINE_SCHEDULER #if 0 // #ifndef DEADLINE_SCHEDULER
printf("NO deadline scheduler\n"); printf("NO deadline scheduler\n");
/* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */ /* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
cpu_set_t cpuset; cpu_set_t cpuset;
...@@ -692,6 +687,7 @@ int main( int argc, char **argv ) { ...@@ -692,6 +687,7 @@ int main( int argc, char **argv ) {
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY #ifdef CPU_AFFINITY
int j; int j;
if (get_nprocs() > 2) { if (get_nprocs() > 2) {
for (j = 2; j < get_nprocs(); j++) for (j = 2; j < get_nprocs(); j++)
CPU_SET(j, &cpuset); CPU_SET(j, &cpuset);
...@@ -702,6 +698,7 @@ int main( int argc, char **argv ) { ...@@ -702,6 +698,7 @@ int main( int argc, char **argv ) {
perror( "pthread_setaffinity_np"); perror( "pthread_setaffinity_np");
exit_fun("Error setting processor affinity"); exit_fun("Error setting processor affinity");
} }
LOG_I(HW, "Setting the affinity of main function to all CPUs, for device library to use CPU 0 only!\n"); LOG_I(HW, "Setting the affinity of main function to all CPUs, for device library to use CPU 0 only!\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment