Commit ff6710c8 authored by yilmazt's avatar yilmazt

develop-nr current as of 16.7.19

parents 4c49d5ab 590d2af5
...@@ -829,6 +829,85 @@ class SSHConnection(): ...@@ -829,6 +829,85 @@ class SSHConnection():
self.CreateHtmlTabFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
def InitializeOAIeNB(self):
if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.eNBSourceCodePath == '':
Usage()
sys.exit('Insufficient Parameter')
#initialize_OAI_eNB_flag = True
#pStatus = self.CheckOAIeNBProcessExist(initialize_OAI_eNB_flag)
#if (pStatus < 0):
# self.CreateHtmlTestRow(self.Initialize_OAI_eNB_args, 'KO', pStatus)
# self.CreateHtmlTabFooter(False)
# sys.exit(1)
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
if self.air_interface == 'lte':
nodeB_prefix = 'e'
else:
nodeB_prefix = 'g'
# Initialize_OAI_eNB_args usually start with -C and followed by the location in repository
#full_config_file = self.Initialize_OAI_eNB_args.replace('-O ','')
#extIdx = full_config_file.find('.conf')
#if (extIdx > 0):
# extra_options = full_config_file[extIdx + 5:]
# # if tracer options is on, compiling and running T Tracer
# result = re.search('T_stdout', str(extra_options))
## if result is not None:
# logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m')
# self.command('cd common/utils/T/tracer', '\$', 5)
# self.command('make', '\$', 10)
# self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.eNBUserName, 5)
# self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
# full_config_file = full_config_file[:extIdx + 5]
# config_path, config_file = os.path.split(full_config_file)
#ci_full_config_file = config_path + '/ci-' + config_file
#rruCheck = False
#result = re.search('rru', str(config_file))
#if result is not None:
# rruCheck = True
## Make a copy and adapt to EPC / eNB IP addresses
#self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
#self.command('sed -i -e \'s/CI_eNB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2);
# Launch eNB with the modified config file
self.command('source oaienv', '\$', 5)
self.command('cd cmake_targets/ran_build/build', '\$', 5)
self.eNBLogFile = 'enb_' + self.testCase_id + '.log'
self.command('echo "ulimit -c unlimited && ./' + self.air_interface + '-softmodem ' + self.Initialize_OAI_eNB_args + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log', '\$', 5)
#use nohup instead of daemon
self.command('echo $USER; nohup sudo ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh' + ' > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log' + ' 2>&1 &', self.eNBUserName, 5)
#self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets/ran_build/build -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
time.sleep(6)
self.command('cd ../..', '\$', 5)
doLoop = True
loopCounter = 10
while (doLoop):
loopCounter = loopCounter - 1
if (loopCounter == 0):
# In case of T tracer recording, we may need to kill it
#result = re.search('T_stdout', str(self.Initialize_OAI_eNB_args))
#if result is not None:
# self.command('killall --signal SIGKILL record', '\$', 5)
self.close()
doLoop = False
logging.error('\u001B[1;37;41m ' + nodeB_prefix + 'NB logging system did not show got sync! \u001B[0m')
self.CreateHtmlTestRow(self.Initialize_OAI_eNB_args, 'KO', ALL_PROCESSES_OK, 'OAI eNB')
self.CreateHtmlTabFooter(False)
## In case of T tracer recording, we need to kill tshark on EPC side
#result = re.search('T_stdout', str(self.Initialize_OAI_eNB_args))
#if result is not None:
# self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
# logging.debug('\u001B[1m Stopping tshark \u001B[0m')
# self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
# self.close()
# time.sleep(1)
# pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap'
# copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.')
# if (copyin_res == 0):
# self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
sys.exit(1)
def checkDevTTYisUnlocked(self): def checkDevTTYisUnlocked(self):
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
count = 0 count = 0
...@@ -2737,8 +2816,25 @@ class SSHConnection(): ...@@ -2737,8 +2816,25 @@ class SSHConnection():
mib_found = False mib_found = False
frequency_found = False frequency_found = False
plmn_found = False plmn_found = False
nrUEFlag = False
nrDecodeMib = 0
nrFoundDCI = 0
nrCRCOK = 0
self.htmlUEFailureMsg = '' self.htmlUEFailureMsg = ''
for line in ue_log_file.readlines(): for line in ue_log_file.readlines():
result = re.search('nr_synchro_time', str(line))
if result is not None:
nrUEFlag = True
if nrUEFlag:
result = re.search('decode mib', str(line))
if result is not None:
nrDecodeMib += 1
result = re.search('found 1 DCIs', str(line))
if result is not None:
nrFoundDCI += 1
result = re.search('CRC OK', str(line))
if result is not None:
nrCRCOK += 1
result = re.search('Exiting OAI softmodem', str(line)) result = re.search('Exiting OAI softmodem', str(line))
if result is not None: if result is not None:
exitSignalReceived = True exitSignalReceived = True
...@@ -2857,6 +2953,19 @@ class SSHConnection(): ...@@ -2857,6 +2953,19 @@ class SSHConnection():
statMsg = 'UE connected to eNB (' + str(rrcConnectionRecfgComplete) + ' RRCConnectionReconfigurationComplete message(s) generated)' statMsg = 'UE connected to eNB (' + str(rrcConnectionRecfgComplete) + ' RRCConnectionReconfigurationComplete message(s) generated)'
logging.debug('\033[94m' + statMsg + '\033[0m') logging.debug('\033[94m' + statMsg + '\033[0m')
self.htmlUEFailureMsg += statMsg + '\n' self.htmlUEFailureMsg += statMsg + '\n'
if nrUEFlag:
if nrDecodeMib > 0:
statMsg = 'UE showed ' + str(nrDecodeMib) + ' MIB decode message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
self.htmlUEFailureMsg += statMsg + '\n'
if nrFoundDCI > 0:
statMsg = 'UE showed ' + str(nrFoundDCI) + ' DCI found message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
self.htmlUEFailureMsg += statMsg + '\n'
if nrCRCOK > 0:
statMsg = 'UE showed ' + str(nrCRCOK) + ' PDSCH decoding message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
self.htmlUEFailureMsg += statMsg + '\n'
if uciStatMsgCount > 0: if uciStatMsgCount > 0:
statMsg = 'UE showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' statMsg = 'UE showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
...@@ -4125,4 +4234,4 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -4125,4 +4234,4 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
else: else:
Usage() Usage()
sys.exit('Invalid mode') sys.exit('Invalid mode')
sys.exit(0) sys.exit(0)
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<htmlTabName>run OAI gNB and OAI NR UE USRP</htmlTabName> <htmlTabName>run OAI gNB and OAI NR UE USRP</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon> <htmlTabIcon>tasks</htmlTabIcon>
<TestCaseRequestedList> <TestCaseRequestedList>
090101 000001 090102 000001 090108 090109 090101 000001 090102 000002 090108 090109
</TestCaseRequestedList> </TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList> <TestCaseExclusionList></TestCaseExclusionList>
...@@ -42,6 +42,12 @@ ...@@ -42,6 +42,12 @@
<idle_sleep_time_in_sec>5</idle_sleep_time_in_sec> <idle_sleep_time_in_sec>5</idle_sleep_time_in_sec>
</testCase> </testCase>
<testCase id="000002">
<class>IdleSleep</class>
<desc>Waiting for NR UE to synchronize w/ gNB</desc>
<idle_sleep_time_in_sec>180</idle_sleep_time_in_sec>
</testCase>
<testCase id="090102"> <testCase id="090102">
<class>Initialize_OAI_UE</class> <class>Initialize_OAI_UE</class>
<desc>Initialize NR UE USRP</desc> <desc>Initialize NR UE USRP</desc>
......
...@@ -1410,7 +1410,7 @@ set(PHY_SRC_UE ...@@ -1410,7 +1410,7 @@ set(PHY_SRC_UE
${PHY_POLARSRC} ${PHY_POLARSRC}
${PHY_SMALLBLOCKSRC} ${PHY_SMALLBLOCKSRC}
${PHY_LDPCSRC} ${PHY_LDPCSRC}
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/pucch_rx.c # added by prasanth ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/pucch_rx.c
) )
set(PHY_NR_UE_SRC set(PHY_NR_UE_SRC
......
...@@ -1160,6 +1160,29 @@ ...@@ -1160,6 +1160,29 @@
<nruns>3</nruns> <nruns>3</nruns>
</testCase> </testCase>
<testCase id="015109">
<class>execution</class>
<desc>nr_nr_pucchsim Test cases. (Test1: Format 0 ACK miss 106 PRB),
(Test2: Format 1 ACK miss 106 PRB),
(Test3: Format 1 ACK miss 273 PRB),
(Test4: Format 1 NACKtoACK 106 PRB)</desc>
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args> --phy_simulators -c </compile_prog_args>
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec> $OPENAIR_DIR/targets/bin/nr_pucchsim.Rel15</main_exec>
<main_exec_args>-R 106 -i 1 -P 0 -b 1 -s3 -n100
-R 106 -i 14 -P 1 -b 1 -s-6 -n 100
-R 273 -i 14 -P 1 -b 1 -s-6 -n100
-R 106 -i 14 -P 1 -b 1 -s-6 -T 0.001 -n1000</main_exec_args>
<tags>nr_pucchsim.test1 nr_pucchsim.test2 nr_pucchsim.test3 nr_pucchsim.test4</tags>
<search_expr_true>PUCCH test OK</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
<nruns>3</nruns>
</testCase>
<testCase id="015110"> <testCase id="015110">
<class>execution</class> <class>execution</class>
<desc>dlsim_tm4 test cases (Test 1: 10 MHz, R2.FDD (MCS 5), EVA5, -1dB), <desc>dlsim_tm4 test cases (Test 1: 10 MHz, R2.FDD (MCS 5), EVA5, -1dB),
......
...@@ -1080,10 +1080,18 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { ...@@ -1080,10 +1080,18 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->rx_bw = 40e6; cfg->rx_bw = 40e6;
} }
} else if(N_RB == 106) { } else if(N_RB == 106) {
cfg->sample_rate=61.44e6; if (fp->threequarter_fs) {
cfg->samples_per_frame = 614400; cfg->sample_rate=46.08e6;
cfg->tx_bw = 20e6; cfg->samples_per_frame = 460800;
cfg->rx_bw = 20e6; cfg->tx_bw = 20e6;
cfg->rx_bw = 20e6;
}
else {
cfg->sample_rate=61.44e6;
cfg->samples_per_frame = 614400;
cfg->tx_bw = 20e6;
cfg->rx_bw = 20e6;
}
} else { } else {
AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu);
} }
...@@ -1212,16 +1220,17 @@ static void *ru_thread_tx( void *param ) { ...@@ -1212,16 +1220,17 @@ static void *ru_thread_tx( void *param ) {
int i = 0; int i = 0;
int ret; int ret;
if(ru->if_south == LOCAL_RF)
{
//uhd_set_thread_prio();
LOG_I(PHY,"set ru_thread_tx uhd priority");
}
wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
printf( "ru_thread_tx ready\n"); printf( "ru_thread_tx ready\n");
if(ru->rfdevice.uhd_set_thread_priority != NULL)
{
LOG_I(PHY,"set ru_thread_tx uhd priority \n");
ru->rfdevice.uhd_set_thread_priority();
}
while (!oai_exit) { while (!oai_exit) {
if (oai_exit) break; if (oai_exit) break;
......
...@@ -631,8 +631,9 @@ void *UE_thread(void *arg) { ...@@ -631,8 +631,9 @@ void *UE_thread(void *arg) {
processingData_t *curMsg=(processingData_t *)NotifiedFifoData(msgToPush); processingData_t *curMsg=(processingData_t *)NotifiedFifoData(msgToPush);
curMsg->UE=UE; curMsg->UE=UE;
// update thread index for received subframe // update thread index for received subframe
curMsg->proc.nr_tti_rx= slot_nr;
curMsg->UE->current_thread_id[slot_nr] = thread_idx; curMsg->UE->current_thread_id[slot_nr] = thread_idx;
curMsg->proc.CC_id = 0;
curMsg->proc.nr_tti_rx= slot_nr;
curMsg->proc.subframe_rx=table_sf_slot[slot_nr]; curMsg->proc.subframe_rx=table_sf_slot[slot_nr];
curMsg->proc.nr_tti_tx = (absolute_slot + DURATION_RX_TO_TX) % nb_slot_frame; curMsg->proc.nr_tti_tx = (absolute_slot + DURATION_RX_TO_TX) % nb_slot_frame;
curMsg->proc.subframe_tx=curMsg->proc.nr_tti_rx; curMsg->proc.subframe_tx=curMsg->proc.nr_tti_rx;
......
...@@ -555,8 +555,27 @@ void init_openair0(void) { ...@@ -555,8 +555,27 @@ void init_openair0(void) {
for (card=0; card<MAX_CARDS; card++) { for (card=0; card<MAX_CARDS; card++) {
openair0_cfg[card].configFilename = NULL; openair0_cfg[card].configFilename = NULL;
openair0_cfg[card].threequarter_fs = frame_parms[0]->threequarter_fs;
if(frame_parms[0]->N_RB_DL == 106) { if(frame_parms[0]->N_RB_DL == 217) {
if (numerology==1) {
if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=92.16e6;
openair0_cfg[card].samples_per_frame = 921600;
openair0_cfg[card].tx_bw = 40e6;
openair0_cfg[card].rx_bw = 40e6;
}
else {
openair0_cfg[card].sample_rate=122.88e6;
openair0_cfg[card].samples_per_frame = 1228800;
openair0_cfg[card].tx_bw = 40e6;
openair0_cfg[card].rx_bw = 40e6;
}
} else {
LOG_E(PHY,"Unsupported numerology!\n");
exit(-1);
}
}else if(frame_parms[0]->N_RB_DL == 106) {
if (numerology==0) { if (numerology==0) {
if (frame_parms[0]->threequarter_fs) { if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=23.04e6; openair0_cfg[card].sample_rate=23.04e6;
...@@ -569,14 +588,22 @@ void init_openair0(void) { ...@@ -569,14 +588,22 @@ void init_openair0(void) {
openair0_cfg[card].tx_bw = 10e6; openair0_cfg[card].tx_bw = 10e6;
openair0_cfg[card].rx_bw = 10e6; openair0_cfg[card].rx_bw = 10e6;
} }
} else if (numerology==1) { } else if (numerology==1) {
openair0_cfg[card].sample_rate=61.44e6; if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].samples_per_frame = 307200; openair0_cfg[card].sample_rate=46.08e6;
openair0_cfg[card].tx_bw = 20e6; openair0_cfg[card].samples_per_frame = 480800;
openair0_cfg[card].rx_bw = 20e6; openair0_cfg[card].tx_bw = 20e6;
openair0_cfg[card].rx_bw = 20e6;
}
else {
openair0_cfg[card].sample_rate=61.44e6;
openair0_cfg[card].samples_per_frame = 614400;
openair0_cfg[card].tx_bw = 20e6;
openair0_cfg[card].rx_bw = 20e6;
}
} else if (numerology==2) { } else if (numerology==2) {
openair0_cfg[card].sample_rate=122.88e6; openair0_cfg[card].sample_rate=122.88e6;
openair0_cfg[card].samples_per_frame = 307200; openair0_cfg[card].samples_per_frame = 1228800;
openair0_cfg[card].tx_bw = 40e6; openair0_cfg[card].tx_bw = 40e6;
openair0_cfg[card].rx_bw = 40e6; openair0_cfg[card].rx_bw = 40e6;
} else { } else {
...@@ -599,6 +626,10 @@ void init_openair0(void) { ...@@ -599,6 +626,10 @@ void init_openair0(void) {
openair0_cfg[card].tx_bw = 1.5e6; openair0_cfg[card].tx_bw = 1.5e6;
openair0_cfg[card].rx_bw = 1.5e6; openair0_cfg[card].rx_bw = 1.5e6;
} }
else {
LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms[0]->N_RB_DL);
exit(-1);
}
if (frame_parms[0]->frame_type==TDD) if (frame_parms[0]->frame_type==TDD)
openair0_cfg[card].duplex_mode = duplex_mode_TDD; openair0_cfg[card].duplex_mode = duplex_mode_TDD;
...@@ -711,6 +742,7 @@ int main( int argc, char **argv ) { ...@@ -711,6 +742,7 @@ int main( int argc, char **argv ) {
frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx; frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx;
frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx; frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
frame_parms[CC_id]->threequarter_fs = threequarter_fs;
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx); LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
get_band(downlink_frequency[CC_id][0], &frame_parms[CC_id]->eutra_band, &uplink_frequency_offset[CC_id][0], &frame_parms[CC_id]->frame_type); get_band(downlink_frequency[CC_id][0], &frame_parms[CC_id]->eutra_band, &uplink_frequency_offset[CC_id][0], &frame_parms[CC_id]->frame_type);
} }
......
...@@ -89,6 +89,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -89,6 +89,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
dft = dft2048; dft = dft2048;
break; break;
case 3072:
dft = dft3072;
break;
case 4096: case 4096:
dft = dft4096; dft = dft4096;
break; break;
...@@ -98,8 +102,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -98,8 +102,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
break; break;
default: default:
dft = dft512; printf("unsupported ofdm symbol size \n");
break; assert(0);
} }
if (no_prefix) { if (no_prefix) {
......
...@@ -239,7 +239,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -239,7 +239,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
uint8_t nushift; uint8_t nushift;
uint32_t unscrambling_mask; uint32_t unscrambling_mask;
uint64_t a_reversed=0; uint64_t a_reversed=0;
LOG_I(PHY, "PBCH generation started\n"); LOG_D(PHY, "PBCH generation started\n");
///Payload generation ///Payload generation
memset((void *)pbch, 0, sizeof(NR_gNB_PBCH)); memset((void *)pbch, 0, sizeof(NR_gNB_PBCH));
pbch->pbch_a=0; pbch->pbch_a=0;
...@@ -267,7 +267,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -267,7 +267,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
else else
pbch->pbch_a |= ((config->sch_config.ssb_subcarrier_offset.value>>4)&1)<<29; //MSB of k_SSB (bit index 4) pbch->pbch_a |= ((config->sch_config.ssb_subcarrier_offset.value>>4)&1)<<29; //MSB of k_SSB (bit index 4)
LOG_I(PHY,"After extra byte: pbch_a = 0x%08x\n",pbch->pbch_a); LOG_D(PHY,"After extra byte: pbch_a = 0x%08x\n",pbch->pbch_a);
// Payload interleaving // Payload interleaving
......
This diff is collapsed.
...@@ -103,8 +103,9 @@ uint16_t nr_pbch_extract(int **rxdataF, ...@@ -103,8 +103,9 @@ uint16_t nr_pbch_extract(int **rxdataF,
j++; j++;
} }
rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1); //rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1);
} rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
}
rxF_ext+=9; rxF_ext+=9;
} else { //symbol 2 } else { //symbol 2
...@@ -125,11 +126,12 @@ uint16_t nr_pbch_extract(int **rxdataF, ...@@ -125,11 +126,12 @@ uint16_t nr_pbch_extract(int **rxdataF,
j++; j++;
} }
rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1); //rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1);
rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
} }
rxF_ext+=9; rxF_ext+=9;
} else rx_offset = (rx_offset+12)&(frame_parms->ofdm_symbol_size-1); } else rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12);//rx_offset = (rx_offset+12)&(frame_parms->ofdm_symbol_size-1);
} }
} }
......
...@@ -89,6 +89,10 @@ void *get_idft(int ofdm_symbol_size) ...@@ -89,6 +89,10 @@ void *get_idft(int ofdm_symbol_size)
idft = idft2048; idft = idft2048;
break; break;
case 3072:
idft = idft3072;
break;
case 4096: case 4096:
idft = idft4096; idft = idft4096;
break; break;
......
This diff is collapsed.
...@@ -42,10 +42,25 @@ ...@@ -42,10 +42,25 @@
#include "T.h" #include "T.h"
#define ONE_OVER_SQRT2 23170 // 32767/sqrt(2) = 23170 (ONE_OVER_SQRT2) #define ONE_OVER_SQRT2 23170 // 32767/sqrt(2) = 23170 (ONE_OVER_SQRT2)
void nr_decode_pucch1( int32_t **rxdataF,
pucch_GroupHopping_t pucch_GroupHopping,
uint32_t n_id, // hoppingID higher layer parameter
uint64_t *payload,
NR_DL_FRAME_PARMS *frame_parms,
int16_t amp,
int nr_tti_tx,
uint8_t m0,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint16_t startingPRB,
uint16_t startingPRB_intraSlotHopping,
uint8_t timeDomainOCC,
uint8_t nr_bit);
void nr_decode_pucch0( int32_t **rxdataF, void nr_decode_pucch0( int32_t **rxdataF,
pucch_GroupHopping_t PUCCH_GroupHopping, pucch_GroupHopping_t PUCCH_GroupHopping,
uint32_t n_id, //PHY_VARS_gNB *gNB, generally rxdataf is in gNB->common_vars uint32_t n_id, //PHY_VARS_gNB *gNB, generally rxdataf is in gNB->common_vars
uint8_t *payload, uint64_t *payload,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
int16_t amp, int16_t amp,
int nr_tti_tx, int nr_tti_tx,
...@@ -74,7 +89,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, ...@@ -74,7 +89,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
int16_t amp, int16_t amp,
int nr_tti_tx, int nr_tti_tx,
uint8_t m0, uint8_t m0,
uint8_t mcs, uint8_t mcs,
uint8_t nrofSymbols, uint8_t nrofSymbols,
uint8_t startingSymbolIndex, uint8_t startingSymbolIndex,
uint16_t startingPRB); uint16_t startingPRB);
......
This diff is collapsed.
...@@ -583,6 +583,9 @@ int8_t nr_ue_decode_mib( ...@@ -583,6 +583,9 @@ int8_t nr_ue_decode_mib(
mac->type0_pdcch_ss_n_c = n_c; mac->type0_pdcch_ss_n_c = n_c;
// fill in the elements in config request inside P5 message // fill in the elements in config request inside P5 message
mac->phy_config.Mod_id = module_id;
mac->phy_config.CC_id = cc_id;
mac->phy_config.config_req.pbch_config.system_frame_number = frame; // after calculation mac->phy_config.config_req.pbch_config.system_frame_number = frame; // after calculation
mac->phy_config.config_req.pbch_config.subcarrier_spacing_common = mac->mib->subCarrierSpacingCommon; mac->phy_config.config_req.pbch_config.subcarrier_spacing_common = mac->mib->subCarrierSpacingCommon;
mac->phy_config.config_req.pbch_config.ssb_subcarrier_offset = ssb_subcarrier_offset; // after calculation mac->phy_config.config_req.pbch_config.ssb_subcarrier_offset = ssb_subcarrier_offset; // after calculation
......
...@@ -53,17 +53,20 @@ int num_devices=0; ...@@ -53,17 +53,20 @@ int num_devices=0;
* \param device RF frontend parameters set by application * \param device RF frontend parameters set by application
* \returns 0 on success * \returns 0 on success
*/ */
int trx_brf_init(openair0_device *device) { int trx_brf_init(openair0_device *device)
{
return 0; return 0;
} }
/*! \brief get current timestamp /*! \brief get current timestamp
*\param device the hardware to use *\param device the hardware to use
*\param module the bladeRf module *\param module the bladeRf module
*\returns timestamp of BladeRF *\returns timestamp of BladeRF
*/ */
openair0_timestamp trx_get_timestamp(openair0_device *device,
openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module module) { bladerf_module module)
{
int status; int status;
struct bladerf_metadata meta; struct bladerf_metadata meta;
brf_state_t *brf = (brf_state_t*)device->priv; brf_state_t *brf = (brf_state_t*)device->priv;
...@@ -77,11 +80,13 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod ...@@ -77,11 +80,13 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod
return meta.timestamp; return meta.timestamp;
} }
/*! \brief Start BladeRF /*! \brief Start BladeRF
* \param device the hardware to use * \param device the hardware to use
* \returns 0 on success * \returns 0 on success
*/ */
int trx_brf_start(openair0_device *device) { int trx_brf_start(openair0_device *device)
{
brf_state_t *brf = (brf_state_t*)device->priv; brf_state_t *brf = (brf_state_t*)device->priv;
int status; int status;
...@@ -119,6 +124,7 @@ int trx_brf_start(openair0_device *device) { ...@@ -119,6 +124,7 @@ int trx_brf_start(openair0_device *device) {
return 0; return 0;
} }
/*! \brief Called to send samples to the BladeRF RF target /*! \brief Called to send samples to the BladeRF 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 whicch the first sample MUST be sent \param timestamp The timestamp at whicch the first sample MUST be sent
...@@ -128,8 +134,13 @@ int trx_brf_start(openair0_device *device) { ...@@ -128,8 +134,13 @@ int trx_brf_start(openair0_device *device) {
\param flags Ignored for the moment \param flags Ignored for the moment
\returns 0 on success \returns 0 on success
*/ */
static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp, void **buff, int nsamps, int cc, int flags) { static int trx_brf_write(openair0_device *device,
openair0_timestamp ptimestamp,
void **buff,
int nsamps,
int cc,
int flags)
{
int status; int status;
brf_state_t *brf = (brf_state_t*)device->priv; brf_state_t *brf = (brf_state_t*)device->priv;
/* BRF has only 1 rx/tx chaine : is it correct? */ /* BRF has only 1 rx/tx chaine : is it correct? */
...@@ -169,6 +180,7 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp, ...@@ -169,6 +180,7 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp,
return nsamps; //brf->meta_tx.actual_count; return nsamps; //brf->meta_tx.actual_count;
} }
/*! \brief Receive samples from hardware. /*! \brief Receive samples from hardware.
* Read \ref nsamps samples from each channel to buffers. buff[0] is the array for * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
* the first channel. *ptimestamp is the time at which the first sample * the first channel. *ptimestamp is the time at which the first sample
...@@ -180,8 +192,12 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp, ...@@ -180,8 +192,12 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp,
* \param cc Index of component carrier * \param cc Index of component carrier
* \returns number of samples read * \returns number of samples read
*/ */
static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { static int trx_brf_read(openair0_device *device,
openair0_timestamp *ptimestamp,
void **buff,
int nsamps,
int cc)
{
int status=0; int status=0;
brf_state_t *brf = (brf_state_t*)device->priv; brf_state_t *brf = (brf_state_t*)device->priv;
...@@ -222,10 +238,12 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp, ...@@ -222,10 +238,12 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
} }
/*! \brief Terminate operation of the BladeRF transceiver -- free all associated resources /*! \brief Terminate operation of the BladeRF transceiver -- free all associated resources
* \param device the hardware to use * \param device the hardware to use
*/ */
void trx_brf_end(openair0_device *device) { void trx_brf_end(openair0_device *device)
{
int status; int status;
brf_state_t *brf = (brf_state_t*)device->priv; brf_state_t *brf = (brf_state_t*)device->priv;
// Disable RX module, shutting down our underlying RX stream // Disable RX module, shutting down our underlying RX stream
...@@ -239,44 +257,47 @@ void trx_brf_end(openair0_device *device) { ...@@ -239,44 +257,47 @@ void trx_brf_end(openair0_device *device) {
exit(1); exit(1);
} }
/*! \brief print the BladeRF statistics /*! \brief print the BladeRF statistics
* \param device the hardware to use * \param device the hardware to use
* \returns 0 on success * \returns 0 on success
*/ */
int trx_brf_get_stats(openair0_device* device) { int trx_brf_get_stats(openair0_device* device)
{
return(0); return(0);
} }
/*! \brief Reset the BladeRF statistics /*! \brief Reset the BladeRF statistics
* \param device the hardware to use * \param device the hardware to use
* \returns 0 on success * \returns 0 on success
*/ */
int trx_brf_reset_stats(openair0_device* device) { int trx_brf_reset_stats(openair0_device* device)
{
return(0); return(0);
} }
/*! \brief Stop BladeRF /*! \brief Stop BladeRF
* \param card the hardware to use * \param card the hardware to use
* \returns 0 in success * \returns 0 in success
*/ */
int trx_brf_stop(openair0_device* device) { int trx_brf_stop(openair0_device* device)
{
return(0); return(0);
} }
/*! \brief Set frequencies (TX/RX) /*! \brief Set frequencies (TX/RX)
* \param device the hardware to use * \param device the hardware to use
* \param openair0_cfg1 openair0 Config structure (ignored. It is there to comply with RF common API) * \param openair0_cfg1 openair0 Config structure (ignored. It is there to comply with RF common API)
* \param exmimo_dump_config (ignored) * \param exmimo_dump_config (ignored)
* \returns 0 in success * \returns 0 in success
*/ */
int trx_brf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1,int exmimo_dump_config) { int trx_brf_set_freq(openair0_device* device,
openair0_config_t *openair0_cfg1,
int exmimo_dump_config)
{
int status; int status;
brf_state_t *brf = (brf_state_t *)device->priv; brf_state_t *brf = (brf_state_t *)device->priv;
openair0_config_t *openair0_cfg = (openair0_config_t *)device->openair0_cfg; openair0_config_t *openair0_cfg = (openair0_config_t *)device->openair0_cfg;
...@@ -298,19 +319,19 @@ int trx_brf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1,i ...@@ -298,19 +319,19 @@ int trx_brf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1,i
} }
/*! \brief Set Gains (TX/RX) /*! \brief Set Gains (TX/RX)
* \param device the hardware to use * \param device the hardware to use
* \param openair0_cfg openair0 Config structure * \param openair0_cfg openair0 Config structure
* \returns 0 in success * \returns 0 in success
*/ */
int trx_brf_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { int trx_brf_set_gains(openair0_device* device,
openair0_config_t *openair0_cfg)
{
return(0); return(0);
} }
#define RXDCLENGTH 16384 #define RXDCLENGTH 16384
int16_t cos_fsover8[8] = {2047, 1447, 0, -1448, -2047, -1448, 0, 1447}; int16_t cos_fsover8[8] = {2047, 1447, 0, -1448, -2047, -1448, 0, 1447};
int16_t cos_3fsover8[8] = {2047, -1448, 0, 1447, -2047, 1447, 0, -1448}; int16_t cos_3fsover8[8] = {2047, -1448, 0, 1447, -2047, 1447, 0, -1448};
...@@ -323,12 +344,14 @@ rx_gain_calib_table_t calib_table_fx4[] = { ...@@ -323,12 +344,14 @@ rx_gain_calib_table_t calib_table_fx4[] = {
{-1,0} {-1,0}
}; };
/*! \brief set RX gain offset from calibration table /*! \brief set RX gain offset from calibration table
* \param openair0_cfg RF frontend parameters set by application * \param openair0_cfg RF frontend parameters set by application
* \param chain_index RF chain ID * \param chain_index RF chain ID
*/ */
void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { void set_rx_gain_offset(openair0_config_t *openair0_cfg,
int chain_index)
{
int i=0; int i=0;
// loop through calibration table to find best adjustment factor for RX frequency // loop through calibration table to find best adjustment factor for RX frequency
double min_diff = 6e9,diff; double min_diff = 6e9,diff;
...@@ -348,11 +371,12 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { ...@@ -348,11 +371,12 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
} }
/*! \brief Calibrate LMSSDR RF /*! \brief Calibrate LMSSDR RF
* \param device the hardware to use * \param device the hardware to use
*/ */
void calibrate_rf(openair0_device *device) { void calibrate_rf(openair0_device *device)
{
/* TODO: this function does not seem to work. Disabled until fixed. */ /* TODO: this function does not seem to work. Disabled until fixed. */
return; return;
...@@ -925,12 +949,15 @@ void calibrate_rf(openair0_device *device) { ...@@ -925,12 +949,15 @@ void calibrate_rf(openair0_device *device) {
// LOG_M("blade_rf_test.m","rxs",calib_buff,RXDCLENGTH,1,1); // LOG_M("blade_rf_test.m","rxs",calib_buff,RXDCLENGTH,1,1);
} }
/*! \brief Initialize Openair BLADERF target. It returns 0 if OK /*! \brief Initialize Openair BLADERF target. It returns 0 if OK
* \param device the hardware to use * \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application * \param openair0_cfg RF frontend parameters set by application
* \returns 0 on success * \returns 0 on success
*/ */
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { int device_init(openair0_device *device,
openair0_config_t *openair0_cfg)
{
int status; int status;
brf_state_t *brf = (brf_state_t*)malloc(sizeof(brf_state_t)); brf_state_t *brf = (brf_state_t*)malloc(sizeof(brf_state_t));
memset(brf, 0, sizeof(brf_state_t)); memset(brf, 0, sizeof(brf_state_t));
...@@ -1120,6 +1147,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -1120,6 +1147,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device->trx_set_gains_func = trx_brf_set_gains; device->trx_set_gains_func = trx_brf_set_gains;
device->openair0_cfg = openair0_cfg; device->openair0_cfg = openair0_cfg;
device->priv = (void *)brf; device->priv = (void *)brf;
device->uhd_set_thread_priority = NULL;
calibrate_rf(device); calibrate_rf(device);
...@@ -1137,11 +1165,13 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -1137,11 +1165,13 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
return 0; return 0;
} }
/*! \brief bladeRF error report /*! \brief bladeRF error report
* \param status * \param status
* \returns 0 on success * \returns 0 on success
*/ */
int brf_error(int status) { int brf_error(int status)
{
fprintf(stderr, "[BRF] brf_error: %s\n", bladerf_strerror(status)); fprintf(stderr, "[BRF] brf_error: %s\n", bladerf_strerror(status));
exit(-1); exit(-1);
return status; // or status error code return status; // or status error code
...@@ -1152,8 +1182,8 @@ int brf_error(int status) { ...@@ -1152,8 +1182,8 @@ int brf_error(int status) {
* \param serial name of serial port on which to open BladeRF device * \param serial name of serial port on which to open BladeRF device
* \returns bladerf device structure * \returns bladerf device structure
*/ */
struct bladerf * open_bladerf_from_serial(const char *serial) { struct bladerf * open_bladerf_from_serial(const char *serial)
{
int status; int status;
struct bladerf *dev; struct bladerf *dev;
struct bladerf_devinfo info; struct bladerf_devinfo info;
...@@ -1179,12 +1209,13 @@ struct bladerf * open_bladerf_from_serial(const char *serial) { ...@@ -1179,12 +1209,13 @@ struct bladerf * open_bladerf_from_serial(const char *serial) {
} }
} }
/*! \brief Get BladeRF log level /*! \brief Get BladeRF log level
* \param log_level log level * \param log_level log level
* \returns log level of BLADERF device * \returns log level of BLADERF device
*/ */
int get_brf_log_level(int log_level) { int get_brf_log_level(int log_level)
{
int level=BLADERF_LOG_LEVEL_INFO; int level=BLADERF_LOG_LEVEL_INFO;
return BLADERF_LOG_LEVEL_INFO; return BLADERF_LOG_LEVEL_INFO;
switch(log_level) { switch(log_level) {
......
...@@ -112,9 +112,9 @@ typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *); ...@@ -112,9 +112,9 @@ typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *);
/* look for the interface library and load it */ /* look for the interface library and load it */
int load_lib(openair0_device *device, int load_lib(openair0_device *device,
openair0_config_t *openair0_cfg, openair0_config_t *openair0_cfg,
eth_params_t *cfg, eth_params_t *cfg,
uint8_t flag) uint8_t flag)
{ {
loader_shlibfunc_t shlib_fdesc[1]; loader_shlibfunc_t shlib_fdesc[1];
int ret=0; int ret=0;
...@@ -129,9 +129,8 @@ int load_lib(openair0_device *device, ...@@ -129,9 +129,8 @@ int load_lib(openair0_device *device,
if (getenv("RFSIMULATOR") != NULL) if (getenv("RFSIMULATOR") != NULL)
libname="rfsimulator"; libname="rfsimulator";
else else
libname=OAI_RF_LIBNAME; libname=OAI_RF_LIBNAME;
shlib_fdesc[0].fname="device_init"; shlib_fdesc[0].fname="device_init";
//shlib_fdesc[1].fname="uhd_set_thread_priority";
} else { } else {
libname=OAI_TP_LIBNAME; libname=OAI_TP_LIBNAME;
shlib_fdesc[0].fname="transport_init"; shlib_fdesc[0].fname="transport_init";
...@@ -142,32 +141,10 @@ int load_lib(openair0_device *device, ...@@ -142,32 +141,10 @@ int load_lib(openair0_device *device,
LOG_E(HW,"Library %s couldn't be loaded\n",libname); LOG_E(HW,"Library %s couldn't be loaded\n",libname);
} else { } else {
ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg); ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
//uhd_set_thread_priority_fun = (set_prio_func_t)shlib_fdesc[1].fptr; }
}
return ret; return ret;
} }
/*
void uhd_set_thread_prio(void) {
loader_shlibfunc_t shlib_fdesc[1];
int ret = 0;
char *libname;
if (getenv("RFSIMULATOR") != NULL)
libname="rfsimulator";
else
libname=OAI_RF_LIBNAME;
//shlib_fdesc[0].fname="uhd_set_thread_priority";
ret=load_module_shlib(libname,shlib_fdesc,1,NULL);
if (ret < 0) {
LOG_E(HW,"Library %s couldn't be loaded\n",libname);
} else {
//(set_prio_func_t)shlib_fdesc[0].fptr();
}
//return ret;
}
*/
int openair0_device_load(openair0_device *device, int openair0_device_load(openair0_device *device,
openair0_config_t *openair0_cfg) openair0_config_t *openair0_cfg)
...@@ -185,6 +162,7 @@ int openair0_device_load(openair0_device *device, ...@@ -185,6 +162,7 @@ int openair0_device_load(openair0_device *device,
return rc; return rc;
} }
int openair0_transport_load(openair0_device *device, int openair0_transport_load(openair0_device *device,
openair0_config_t *openair0_cfg, openair0_config_t *openair0_cfg,
eth_params_t *eth_params) eth_params_t *eth_params)
......
...@@ -406,6 +406,10 @@ struct openair0_device_t { ...@@ -406,6 +406,10 @@ struct openair0_device_t {
* \param arg pointer to capabilities or configuration * \param arg pointer to capabilities or configuration
*/ */
void (*configure_rru)(int idx, void *arg); void (*configure_rru)(int idx, void *arg);
/*! \brief set UHD thread priority
*/
void (*uhd_set_thread_priority)(void);
}; };
/* type of device init function, implemented in shared lib */ /* type of device init function, implemented in shared lib */
...@@ -491,9 +495,7 @@ int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *open ...@@ -491,9 +495,7 @@ int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *open
#define gettid() syscall(__NR_gettid) #define gettid() syscall(__NR_gettid)
/*@}*/ /*@}*/
void uhd_set_thread_prio(void);
typedef void(*set_prio_func_t)(void);
//set_prio_func_t uhd_set_thread_priority_fun;
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -53,8 +53,8 @@ struct sockaddr_in dest_addr[MAX_INST]; ...@@ -53,8 +53,8 @@ struct sockaddr_in dest_addr[MAX_INST];
int dest_addr_len[MAX_INST]; int dest_addr_len[MAX_INST];
int trx_eth_start(openair0_device *device) { int trx_eth_start(openair0_device *device)
{
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
/* initialize socket */ /* initialize socket */
...@@ -153,8 +153,8 @@ int trx_eth_start(openair0_device *device) { ...@@ -153,8 +153,8 @@ int trx_eth_start(openair0_device *device) {
} }
void trx_eth_end(openair0_device *device) { void trx_eth_end(openair0_device *device)
{
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
/* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */ /* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */
if ( close(eth->sockfdd) <0 ) { if ( close(eth->sockfdd) <0 ) {
...@@ -166,29 +166,42 @@ void trx_eth_end(openair0_device *device) { ...@@ -166,29 +166,42 @@ void trx_eth_end(openair0_device *device) {
} }
int trx_eth_stop(openair0_device *device) { int trx_eth_stop(openair0_device *device)
{
return(0); return(0);
} }
int trx_eth_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config) {
int trx_eth_set_freq(openair0_device* device,
openair0_config_t *openair0_cfg,
int exmimo_dump_config)
{
return(0); return(0);
} }
int trx_eth_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) {
int trx_eth_set_gains(openair0_device* device, openair0_config_t *openair0_cfg)
{
return(0); return(0);
} }
int trx_eth_get_stats(openair0_device* device) {
int trx_eth_get_stats(openair0_device* device)
{
return(0); return(0);
} }
int trx_eth_reset_stats(openair0_device* device) {
int trx_eth_reset_stats(openair0_device* device)
{
return(0); return(0);
} }
int ethernet_tune(openair0_device *device, unsigned int option, int value) { int ethernet_tune(openair0_device *device,
unsigned int option,
int value)
{
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
struct timeval timeout; struct timeval timeout;
struct ifreq ifr; struct ifreq ifr;
...@@ -363,8 +376,10 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -363,8 +376,10 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
} }
int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params ) { int transport_init(openair0_device *device,
openair0_config_t *openair0_cfg,
eth_params_t * eth_params )
{
eth_state_t *eth = (eth_state_t*)malloc(sizeof(eth_state_t)); eth_state_t *eth = (eth_state_t*)malloc(sizeof(eth_state_t));
memset(eth, 0, sizeof(eth_state_t)); memset(eth, 0, sizeof(eth_state_t));
...@@ -402,6 +417,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -402,6 +417,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
device->trx_stop_func = trx_eth_stop; device->trx_stop_func = trx_eth_stop;
device->trx_set_freq_func = trx_eth_set_freq; device->trx_set_freq_func = trx_eth_set_freq;
device->trx_set_gains_func = trx_eth_set_gains; device->trx_set_gains_func = trx_eth_set_gains;
device->uhd_set_thread_priority = NULL;
if (eth->flags == ETH_RAW_MODE) { if (eth->flags == ETH_RAW_MODE) {
device->trx_write_func = trx_eth_write_raw; device->trx_write_func = trx_eth_write_raw;
...@@ -470,8 +486,11 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -470,8 +486,11 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
/************************************************************************************************************************** /**************************************************************************************************************************
* DEBUGING-RELATED FUNCTIONS * * DEBUGING-RELATED FUNCTIONS *
**************************************************************************************************************************/ **************************************************************************************************************************/
void dump_packet(char *title, unsigned char* pkt, int bytes, unsigned int tx_rx_flag) { void dump_packet(char *title,
unsigned char* pkt,
int bytes,
unsigned int tx_rx_flag)
{
static int numSend = 1; static int numSend = 1;
static int numRecv = 1; static int numRecv = 1;
int num, k; int num, k;
...@@ -484,8 +503,10 @@ void dump_packet(char *title, unsigned char* pkt, int bytes, unsigned int tx_rx_ ...@@ -484,8 +503,10 @@ void dump_packet(char *title, unsigned char* pkt, int bytes, unsigned int tx_rx_
printf("%s-%s (%06d): %s 0x%04X\n", title,(tx_rx_flag)? "TX":"RX", num, tmp, cksum); printf("%s-%s (%06d): %s 0x%04X\n", title,(tx_rx_flag)? "TX":"RX", num, tmp, cksum);
} }
unsigned short calc_csum (unsigned short *buf, int nwords) {
unsigned short calc_csum (unsigned short *buf,
int nwords)
{
unsigned long sum; unsigned long sum;
for (sum = 0; nwords > 0; nwords--) for (sum = 0; nwords > 0; nwords--)
sum += *buf++; sum += *buf++;
...@@ -494,8 +515,9 @@ unsigned short calc_csum (unsigned short *buf, int nwords) { ...@@ -494,8 +515,9 @@ unsigned short calc_csum (unsigned short *buf, int nwords) {
return ~sum; return ~sum;
} }
void dump_dev(openair0_device *device) {
void dump_dev(openair0_device *device)
{
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
printf("Ethernet device interface %i configuration:\n" ,device->openair0_cfg->Mod_id); printf("Ethernet device interface %i configuration:\n" ,device->openair0_cfg->Mod_id);
...@@ -511,21 +533,28 @@ void dump_dev(openair0_device *device) { ...@@ -511,21 +533,28 @@ void dump_dev(openair0_device *device) {
} }
void inline dump_txcounters(openair0_device *device) {
void inline dump_txcounters(openair0_device *device)
{
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
printf(" Ethernet device interface %i, tx counters:\n" ,device->openair0_cfg->Mod_id); printf(" Ethernet device interface %i, tx counters:\n" ,device->openair0_cfg->Mod_id);
printf(" Sent packets: %llu send errors: %i\n", (long long unsigned int)eth->tx_count, eth->num_tx_errors); printf(" Sent packets: %llu send errors: %i\n", (long long unsigned int)eth->tx_count, eth->num_tx_errors);
} }
void inline dump_rxcounters(openair0_device *device) {
void inline dump_rxcounters(openair0_device *device)
{
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
printf(" Ethernet device interface %i rx counters:\n" ,device->openair0_cfg->Mod_id); printf(" Ethernet device interface %i rx counters:\n" ,device->openair0_cfg->Mod_id);
printf(" Received packets: %llu missed packets errors: %i\n", (long long unsigned int)eth->rx_count, eth->num_underflows); printf(" Received packets: %llu missed packets errors: %i\n", (long long unsigned int)eth->rx_count, eth->num_underflows);
} }
void inline dump_buff(openair0_device *device, char *buff,unsigned int tx_rx_flag, int nsamps) {
void inline dump_buff(openair0_device *device,
char *buff,
unsigned int tx_rx_flag,
int nsamps)
{
char *strptr; char *strptr;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
/*need to add ts number of iqs in printf need to fix dump iqs call */ /*need to add ts number of iqs in printf need to fix dump iqs call */
...@@ -544,7 +573,10 @@ void inline dump_buff(openair0_device *device, char *buff,unsigned int tx_rx_fla ...@@ -544,7 +573,10 @@ void inline dump_buff(openair0_device *device, char *buff,unsigned int tx_rx_fla
} }
void dump_iqs(char * buff, int iq_cnt) {
void dump_iqs(char * buff,
int iq_cnt)
{
int i; int i;
for (i=0; i<iq_cnt; i++) { for (i=0; i<iq_cnt; i++) {
printf("s%02i: Q=%+ij I=%+i%s",i, printf("s%02i: Q=%+ij I=%+i%s",i,
......
...@@ -405,6 +405,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){ ...@@ -405,6 +405,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){
device->trx_stop_func = trx_lms_stop; device->trx_stop_func = trx_lms_stop;
device->trx_set_freq_func = trx_lms_set_freq; device->trx_set_freq_func = trx_lms_set_freq;
device->trx_set_gains_func = trx_lms_set_gains; device->trx_set_gains_func = trx_lms_set_gains;
device->uhd_set_thread_priority = NULL;
device->openair0_cfg = openair0_cfg; device->openair0_cfg = openair0_cfg;
......
...@@ -706,6 +706,7 @@ int openair0_dev_init_sodera(openair0_device* device, openair0_config_t *openair ...@@ -706,6 +706,7 @@ int openair0_dev_init_sodera(openair0_device* device, openair0_config_t *openair
device->trx_stop_func = trx_sodera_stop; device->trx_stop_func = trx_sodera_stop;
device->trx_set_freq_func = trx_sodera_set_freq; device->trx_set_freq_func = trx_sodera_set_freq;
device->trx_set_gains_func = trx_sodera_set_gains; device->trx_set_gains_func = trx_sodera_set_gains;
device->uhd_set_thread_priority = NULL;
s->sample_rate = openair0_cfg[0].sample_rate; s->sample_rate = openair0_cfg[0].sample_rate;
s->channelscount = openair0_cfg[0].rx_num_channels; s->channelscount = openair0_cfg[0].rx_num_channels;
......
...@@ -600,7 +600,15 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp ...@@ -600,7 +600,15 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
for (int j=0; j<nsamps2; j++) { for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__ #ifdef __AVX2__
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4); // FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2
if ((((uintptr_t) buff[i])&0x1F)==0) {
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
}
else {
((__m128i *)buff[i])[2*j] = _mm_srai_epi16(((__m128i*)buff_tmp[i])[j],4);
((__m128i *)buff[i])[2*j+1] = _mm_srai_epi16(((__m128i*)buff_tmp[i])[2*j+1],4);
}
#else #else
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4); ((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
#endif #endif
...@@ -852,6 +860,10 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_ ...@@ -852,6 +860,10 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
if (bw_gain_adjust==1) { if (bw_gain_adjust==1) {
switch ((int)openair0_cfg[0].sample_rate) { switch ((int)openair0_cfg[0].sample_rate) {
case 46080000:
break;
case 30720000: case 30720000:
break; break;
...@@ -877,7 +889,7 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_ ...@@ -877,7 +889,7 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
default: default:
LOG_E(PHY,"unknown sampling rate %d\n",(int)openair0_cfg[0].sample_rate); LOG_E(PHY,"unknown sampling rate %d\n",(int)openair0_cfg[0].sample_rate);
exit(-1); //exit(-1);
break; break;
} }
} }
...@@ -914,6 +926,12 @@ int trx_usrp_reset_stats(openair0_device *device) { ...@@ -914,6 +926,12 @@ int trx_usrp_reset_stats(openair0_device *device) {
return(0); return(0);
} }
/*! \brief Set uhd priority
*/
static void uhd_set_thread_priority(void) {
uhd::set_thread_priority_safe(1.0);
}
#if defined(USRP_REC_PLAY) #if defined(USRP_REC_PLAY)
extern "C" { extern "C" {
/*! \brief Initializer for USRP record/playback config /*! \brief Initializer for USRP record/playback config
...@@ -1047,6 +1065,7 @@ extern "C" { ...@@ -1047,6 +1065,7 @@ extern "C" {
device->trx_set_freq_func = trx_usrp_set_freq; device->trx_set_freq_func = trx_usrp_set_freq;
device->trx_set_gains_func = trx_usrp_set_gains; device->trx_set_gains_func = trx_usrp_set_gains;
device->openair0_cfg = openair0_cfg; device->openair0_cfg = openair0_cfg;
device->uhd_set_thread_priority = uhd_set_thread_priority;
std::cerr << "USRP device initialized in subframes replay mode for " << u_sf_loops << " loops. Use mmap=" std::cerr << "USRP device initialized in subframes replay mode for " << u_sf_loops << " loops. Use mmap="
<< use_mmap << std::endl; << use_mmap << std::endl;
} else { } else {
...@@ -1162,6 +1181,13 @@ extern "C" { ...@@ -1162,6 +1181,13 @@ extern "C" {
openair0_cfg[0].rx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6;
break; break;
case 46080000:
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 115;
openair0_cfg[0].tx_bw = 40e6;
openair0_cfg[0].rx_bw = 40e6;
break;
case 30720000: case 30720000:
// from usrp_time_offset // from usrp_time_offset
//openair0_cfg[0].samples_per_packet = 2048; //openair0_cfg[0].samples_per_packet = 2048;
...@@ -1214,7 +1240,15 @@ extern "C" { ...@@ -1214,7 +1240,15 @@ extern "C" {
} }
switch ((int)openair0_cfg[0].sample_rate) { switch ((int)openair0_cfg[0].sample_rate) {
case 30720000: case 46080000:
s->usrp->set_master_clock_rate(46.08e6);
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 115;
openair0_cfg[0].tx_bw = 40e6;
openair0_cfg[0].rx_bw = 40e6;
break;
case 30720000:
s->usrp->set_master_clock_rate(30.72e6); s->usrp->set_master_clock_rate(30.72e6);
//openair0_cfg[0].samples_per_packet = 1024; //openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 115; openair0_cfg[0].tx_sample_advance = 115;
...@@ -1366,6 +1400,7 @@ extern "C" { ...@@ -1366,6 +1400,7 @@ extern "C" {
device->trx_set_freq_func = trx_usrp_set_freq; device->trx_set_freq_func = trx_usrp_set_freq;
device->trx_set_gains_func = trx_usrp_set_gains; device->trx_set_gains_func = trx_usrp_set_gains;
device->openair0_cfg = openair0_cfg; device->openair0_cfg = openair0_cfg;
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;
// TODO: // TODO:
...@@ -1468,9 +1503,6 @@ extern "C" { ...@@ -1468,9 +1503,6 @@ extern "C" {
return 0; return 0;
} }
void uhd_set_thread_priority(void) {
uhd::set_thread_priority_safe(1.0);
}
} }
/*@}*/ /*@}*/
...@@ -646,6 +646,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -646,6 +646,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device->trx_set_gains_func = rfsimulator_set_gains; device->trx_set_gains_func = rfsimulator_set_gains;
device->trx_write_func = rfsimulator_write; device->trx_write_func = rfsimulator_write;
device->trx_read_func = rfsimulator_read; device->trx_read_func = rfsimulator_read;
device->uhd_set_thread_priority = NULL;
/* let's pretend to be a b2x0 */ /* let's pretend to be a b2x0 */
device->type = USRP_B200_DEV; device->type = USRP_B200_DEV;
device->openair0_cfg=&openair0_cfg[0]; device->openair0_cfg=&openair0_cfg[0];
......
...@@ -267,6 +267,7 @@ int device_init(openair0_device* device, openair0_config_t *openair0_cfg) ...@@ -267,6 +267,7 @@ int device_init(openair0_device* device, openair0_config_t *openair0_cfg)
device->trx_set_gains_func = tcp_bridge_set_gains; device->trx_set_gains_func = tcp_bridge_set_gains;
device->trx_write_func = tcp_bridge_write; device->trx_write_func = tcp_bridge_write;
device->trx_read_func = tcp_bridge_read; device->trx_read_func = tcp_bridge_read;
device->uhd_set_thread_priority = NULL;
device->priv = tcp_bridge; device->priv = tcp_bridge;
......
...@@ -413,6 +413,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -413,6 +413,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device->trx_set_freq_func = tcp_bridge_set_freq; device->trx_set_freq_func = tcp_bridge_set_freq;
device->trx_set_gains_func = tcp_bridge_set_gains; device->trx_set_gains_func = tcp_bridge_set_gains;
device->trx_write_func = tcp_bridge_write; device->trx_write_func = tcp_bridge_write;
device->uhd_set_thread_priority = NULL;
if (tcp_bridge->is_enb) { if (tcp_bridge->is_enb) {
device->trx_read_func = tcp_bridge_read; device->trx_read_func = tcp_bridge_read;
......
...@@ -262,7 +262,7 @@ RUs = ( ...@@ -262,7 +262,7 @@ RUs = (
THREAD_STRUCT = ( THREAD_STRUCT = (
{ {
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD"; parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_DISABLE"; worker_config = "WORKER_DISABLE";
} }
......
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