Commit 34ae1022 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Merge branch 'develop' into ulsch_decode_mthread

parents 77dc7daf bdc1fa4e
......@@ -71,6 +71,12 @@ gNBs =
initialDLBWPmappingType_2 = 0;
#this is SS=1,L=12
initialDLBWPstartSymbolAndLength_2 = 54;
initialDLBWPk0_3 = 0;
initialDLBWPmappingType_3 = 0;
#this is SS=1,L=4
initialDLBWPstartSymbolAndLength_3 = 57;
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 78;
......@@ -105,8 +111,8 @@ gNBs =
#1,2,4,8,10,20,40,80
ra_ResponseWindow = 4;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
#oneHalf (0..15) 4,8,12,16,...60,64
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15;
#ra_ContentionResolutionTimer
......@@ -114,8 +120,8 @@ gNBs =
ra_ContentionResolutionTimer = 7;
rsrp_ThresholdSSB = 19;
#prach-RootSequenceIndex_PR
#0 = 839, 1 = 139
prach_RootSequenceIndex_PR = 1;
#1 = 839, 2 = 139
prach_RootSequenceIndex_PR = 2;
prach_RootSequenceIndex = 1;
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
#
......@@ -135,7 +141,11 @@ gNBs =
# this is SS=0 L=12
initialULBWPstartSymbolAndLength_1 = 69;
initialULBWPk2_2 = 7;
initialULBWPmappingType_2 = 1;
# this is SS=10 L=4
initialULBWPstartSymbolAndLength_2 = 52;
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
......@@ -235,8 +245,10 @@ RUs = (
att_rx = 0;
bands = [7];
max_pdschReferenceSignalPower = -27;
max_rxgain = 114;
max_rxgain = 75;
eNB_instances = [0];
#beamforming 1x4 matrix:
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2";
clock_src = "external";
}
......
......@@ -52,7 +52,7 @@
<testCase id="090102">
<class>Initialize_OAI_UE</class>
<desc>Initialize NR UE USRP</desc>
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --threadoffset 16 --rrc_config_path .</Initialize_OAI_UE_args>
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --threadoffset 16 --rrc_config_path .</Initialize_OAI_UE_args>
<air_interface>NR</air_interface>
</testCase>
......
......@@ -52,7 +52,7 @@
<testCase id="090104">
<class>Initialize_OAI_UE</class>
<desc>Initialize NR UE USRP</desc>
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --threadoffset 16 --rrc_config_path .</Initialize_OAI_UE_args>
<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --threadoffset 16 --rrc_config_path .</Initialize_OAI_UE_args>
<air_interface>NR</air_interface>
</testCase>
......
......@@ -763,6 +763,42 @@ set(HWLIB_TCP_BRIDGE_OAI_SOURCE
add_library(tcp_bridge_oai MODULE ${HWLIB_TCP_BRIDGE_OAI_SOURCE} )
set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
# Benetel 4G library
######################################################################
set(HWLIB_BENETEL_4G_SOURCE
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/benetel.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/shared_buffers.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/low.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/low_dpdk.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/dpdk_driver.c
)
add_library(benetel_4g MODULE ${HWLIB_BENETEL_4G_SOURCE} )
set_target_properties(benetel_4g PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -march=native -I$ENV{RTE_SDK}/$ENV{RTE_TARGET}/include")
SET(DPDK_LIBS "-Wl,-rpath,$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -Wl,--whole-archive -L$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -ldpdk -Wl,--no-whole-archive")
TARGET_LINK_LIBRARIES(benetel_4g ${DPDK_LIBS})
TARGET_LINK_LIBRARIES(benetel_4g pthread dl rt m numa)
# Benetel 5G library
######################################################################
set(HWLIB_BENETEL_5G_SOURCE
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/5g/benetel.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/5g/shared_buffers.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/5g/low.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/5g/low_dpdk.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/5g/dpdk_driver.c
)
add_library(benetel_5g MODULE ${HWLIB_BENETEL_5G_SOURCE} )
set_target_properties(benetel_5g PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -march=native -I$ENV{RTE_SDK}/$ENV{RTE_TARGET}/include")
SET(DPDK_LIBS "-Wl,-rpath,$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -Wl,--whole-archive -L$ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib -ldpdk -Wl,--no-whole-archive")
TARGET_LINK_LIBRARIES(benetel_5g ${DPDK_LIBS})
TARGET_LINK_LIBRARIES(benetel_5g pthread dl rt m numa)
##########################################################
include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
......
......@@ -33,7 +33,7 @@ The main oai binaries, which are tested by the Continuous Integration process ar
Running the [build_oai](../cmake_targets/build_oai) script also generates some utilities required to build and/or run the oai softmodem binaries:
- `con2uedata`: a binary used to build the UE data from a configuration file. The created file emulates the sim card of a 3GPP compliant phone.
- `conf2uedata`: a binary used to build the UE data from a configuration file. The created file emulates the sim card of a 3GPP compliant phone.
- `nvram`: a binary used to build UE (IMEI...) and EMM (IMSI, registered PLMN) non volatile data.
- `rb_tool`: radio bearer utility
- `genids` T Tracer utility, used at build time to generate T_IDs.h include file. This binary is located in the [T Tracer source file directory](../common/utils/T) .
......
......@@ -194,7 +194,7 @@ The order to run the different components is important:
1- first, CN
2- then, eNB
3- then, gNB
4- finally, switch UE from airplane mode OFF to ON
4- finally, switch UE from airplane mode ON to OFF (ie Radio from OFF to ON)
It is recommended to redirect the run commands to the same log file (fur further analysis and debug), using ```| tee **YOUR_LOG_FILE**``` especially for eNB and gNB.
It is not very useful for the CN.
......
......@@ -917,7 +917,7 @@ void phy_procedures_eNB_TX_fromsplit(uint8_t *bufferZone, int nbBlocks, PHY_VARS
if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
if (is_pmch_subframe(frame,subframe,fp)) {
pmch_procedures(eNB,proc);
pmch_procedures(eNB,proc,0);
} else {
// this is not a pmch subframe, so generate PSS/SSS/PBCH
common_signal_procedures(eNB,frame, subframe);
......
......@@ -180,6 +180,17 @@ int attach_rru(RU_t *ru)
((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]);
AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),
"RU %d failed send configuration to remote radio\n",ru->idx);
if ((len = ru->ifdevice.trx_ctlrecv_func(&ru->ifdevice,
&rru_config_msg,
msg_len))<0) {
LOG_I(PHY,"Waiting for RRU %d\n",ru->idx);
} else if (rru_config_msg.type == RRU_config_ok) {
LOG_I(PHY, "RRU_config_ok received\n");
} else {
LOG_E(PHY,"Received incorrect message %d from RRU %d\n",rru_config_msg.type,ru->idx);
}
return 0;
}
......@@ -1442,6 +1453,8 @@ void *ru_thread( void *param ) {
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config));
if(emulate_rf) {
fill_rf_config(ru,ru->rf_config_file);
nr_init_frame_parms(&ru->config, fp);
......@@ -1464,8 +1477,6 @@ void *ru_thread( void *param ) {
AssertFatal(ret==0,"Cannot connect to remote radio\n");
}
memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config));
if (ru->if_south == LOCAL_RF) { // configure RF parameters only
nr_init_frame_parms(&ru->config, fp);
nr_dump_frame_parms(fp);
......@@ -1571,7 +1582,8 @@ void *ru_thread( void *param ) {
if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
//if (proc->tti_rx==8) {
if (ru->feprx) ru->feprx(ru,proc->tti_rx);
if (ru->feprx) {
ru->feprx(ru,proc->tti_rx);
//LOG_M("rxdata.m","rxs",ru->common.rxdata[0],1228800,1,1);
LOG_D(PHY,"RU proc: frame_rx = %d, tti_rx = %d\n", proc->frame_rx, proc->tti_rx);
......@@ -1591,6 +1603,7 @@ void *ru_thread( void *param ) {
proc->frame_rx,proc->tti_rx);
free_nr_ru_prach_entry(ru,prach_id);
}
}
}
// At this point, all information for subframe has been received on FH interface
......@@ -2131,26 +2144,29 @@ void set_function_spec_param(RU_t *ru) {
ru->fh_north_out = NULL; // no outgoing fronthaul to north
ru->nr_start_if = NULL; // no if interface
ru->rfdevice.host_type = RAU_HOST;
// FK this here looks messed up. The following lines should be part of the if (ru->function == gNodeB_3GPP), shouldn't they?
ru->fh_south_in = rx_rf; // local synchronous RF RX
ru->fh_south_out = tx_rf; // local synchronous RF TX
ru->start_rf = start_rf; // need to start the local RF interface
ru->stop_rf = stop_rf;
ru->start_write_thread = start_write_thread; // starting RF TX in different thread
printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf);
}
ru->fh_south_in = rx_rf; // local synchronous RF RX
ru->fh_south_out = tx_rf; // local synchronous RF TX
ru->start_rf = start_rf; // need to start the local RF interface
ru->stop_rf = stop_rf;
ru->start_write_thread = start_write_thread; // starting RF TX in different thread
printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf);
/*
if (ru->function == gNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
fill_rf_config(ru,rf_config_file);
init_frame_parms(&ru->frame_parms,1);
nr_phy_init_RU(ru);
}
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
}*/
printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf);
fill_rf_config(ru,rf_config_file);
init_frame_parms(&ru->frame_parms,1);
nr_phy_init_RU(ru);
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
}
*/
break;
case REMOTE_IF5: // the remote unit is IF5 RRU
......@@ -2203,6 +2219,15 @@ void set_function_spec_param(RU_t *ru) {
exit(-1);
}
if (ru->ifdevice.get_internal_parameter != NULL) {
void *t = ru->ifdevice.get_internal_parameter("fh_if4p5_south_in");
if (t != NULL)
ru->fh_south_in = t;
t = ru->ifdevice.get_internal_parameter("fh_if4p5_south_out");
if (t != NULL)
ru->fh_south_out = t;
}
malloc_IF4p5_buffer(ru);
break;
......
......@@ -471,21 +471,22 @@ void UE_processing(void *arg) {
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE;
uint8_t gNB_id = 0;
// params for UL time alignment procedure
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &UE->ul_time_alignment[gNB_id];
uint8_t numerology = UE->frame_parms.numerology_index;
uint16_t bwp_ul_NB_RB = UE->frame_parms.N_RB_UL;
int slot_tx = proc->nr_tti_tx;
int frame_tx = proc->frame_tx;
processSlotRX(UE, proc);
processSlotTX(UE, proc);
/* UL time alignment
// If the current tx frame and slot match the TA configuration in ul_time_alignment
// then timing advance is processed and set to be applied in the next UL transmission */
if (UE->mac_enabled == 1) {
uint8_t gNB_id = 0;
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &UE->ul_time_alignment[gNB_id];
int slot_tx = proc->nr_tti_tx;
int frame_tx = proc->frame_tx;
if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) {
uint8_t numerology = UE->frame_parms.numerology_index;
uint16_t bwp_ul_NB_RB = UE->frame_parms.N_RB_UL;
LOG_D(PHY,"Applying timing advance -- frame %d -- slot %d\n", frame_tx, slot_tx);
//if (nfapi_mode!=3){
......@@ -495,9 +496,6 @@ void UE_processing(void *arg) {
//}
}
}
processSlotRX(UE, proc);
processSlotTX(UE, proc);
}
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
......@@ -622,6 +620,7 @@ void *UE_thread(void *arg) {
notifiedFIFO_t freeBlocks;
initNotifiedFIFO_nothreadSafe(&freeBlocks);
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
int timing_advance = UE->timing_advance;
for (int i=0; i<RX_NB_TH+1; i++) // RX_NB_TH working + 1 we are making to be pushed
pushNotifiedFIFO_nothreadSafe(&freeBlocks,
......@@ -726,21 +725,26 @@ void *UE_thread(void *arg) {
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp(
((curMsg->proc.nr_tti_rx + DURATION_RX_TO_TX -2)%nb_slot_frame),&UE->frame_parms,0)];
((slot_nr + DURATION_RX_TO_TX - RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)];
int readBlockSize, writeBlockSize;
if (slot_nr<(nb_slot_frame - 1)) {
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms);
writeBlockSize=UE->frame_parms.get_samples_per_slot(curMsg->proc.nr_tti_tx,&UE->frame_parms);
writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms);
} else {
UE->rx_offset_diff = computeSamplesShift(UE);
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) -
UE->rx_offset_diff;
writeBlockSize=UE->frame_parms.get_samples_per_slot(curMsg->proc.nr_tti_tx,&UE->frame_parms) -
writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms)-
UE->rx_offset_diff;
}
if (UE->timing_advance != timing_advance) {
writeBlockSize -= UE->timing_advance - timing_advance;
timing_advance = UE->timing_advance;
}
AssertFatal(readBlockSize ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
......@@ -748,29 +752,19 @@ void *UE_thread(void *arg) {
readBlockSize,
UE->frame_parms.nb_antennas_rx),"");
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+
UE->frame_parms.get_samples_slot_timestamp(slot_nr,
&UE->frame_parms,DURATION_RX_TO_TX -2) - firstSymSamp -
openair0_cfg[0].tx_sample_advance,
txp,
writeBlockSize,
UE->frame_parms.nb_antennas_tx,
1),"");
if( slot_nr==(nb_slot_frame-1)) {
// read in first symbol of next frame and adjust for timing drift
int first_symbols=UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0; // first symbol of every frames
if ( first_symbols > 0 )
if ( first_symbols > 0 ) {
openair0_timestamp ignore_timestamp;
AssertFatal(first_symbols ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
&ignore_timestamp,
(void **)UE->common_vars.rxdata,
first_symbols,
UE->frame_parms.nb_antennas_rx),"");
else
} else
LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
}
......@@ -781,18 +775,15 @@ void *UE_thread(void *arg) {
notifiedFIFO_elt_t *res;
while (nbSlotProcessing >= RX_NB_TH) {
if ( (res=tryPullTpool(&nf, Tpool)) != NULL ) {
nbSlotProcessing--;
processingData_t *tmp=(processingData_t *)res->msgData;
if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
//decoded_frame_rx=tmp->proc.decoded_frame_rx;
res=pullTpool(&nf, Tpool);
nbSlotProcessing--;
processingData_t *tmp=(processingData_t *)res->msgData;
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
}
if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
//decoded_frame_rx=tmp->proc.decoded_frame_rx;
usleep(200);
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
}
if ( (decoded_frame_rx != curMsg->proc.frame_rx) &&
......@@ -801,6 +792,20 @@ void *UE_thread(void *arg) {
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
decoded_frame_rx, curMsg->proc.frame_rx );
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+
UE->frame_parms.get_samples_slot_timestamp(slot_nr,
&UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) - firstSymSamp -
openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - UE->timing_advance,
txp,
writeBlockSize,
UE->frame_parms.nb_antennas_tx,
1),"");
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
memset(txp[i], 0, writeBlockSize);
nbSlotProcessing++;
msgToPush->key=slot_nr;
pushTpool(Tpool, msgToPush);
......
......@@ -687,11 +687,12 @@ int main( int argc, char **argv ) {
nr_init_frame_parms_ue(frame_parms[CC_id],nrUE_config,NORMAL);
// Overwrite DL frequency (for FR2 testing)
if (downlink_frequency[0][0]!=0)
if (downlink_frequency[0][0]!=0) {
frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
init_symbol_rotation(frame_parms[CC_id],frame_parms[CC_id]->dl_CarrierFreq);
frame_parms[CC_id]->ul_CarrierFreq = downlink_frequency[0][0];
}
init_symbol_rotation(frame_parms[CC_id],frame_parms[CC_id]->dl_CarrierFreq);
init_nr_ue_vars(UE[CC_id],frame_parms[CC_id],0,abstraction_flag);
UE[CC_id]->mac_enabled = 1;
......@@ -768,13 +769,7 @@ int main( int argc, char **argv ) {
for(int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
#if defined(OAI_USRP) || defined(OAI_ADRV9371_ZC706)
PHY_vars_UE_g[0][CC_id]->hw_timing_advance = timing_advance;
PHY_vars_UE_g[0][CC_id]->timing_advance = timing_advance;
#else
PHY_vars_UE_g[0][CC_id]->hw_timing_advance = 160;
#endif
}
init_NR_UE_threads(1);
......
......@@ -236,13 +236,12 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
}
*/
int j2=0;
fp=f;
switch (Qm) {
case 2:
e0=e;
e1=e0+EQm;
for (int j = 0; j< EQm; j++,j2+=2){
for (int j = 0, j2 = 0; j< EQm; j++,j2+=2){
fp=&f[j2];
fp[0] = e0[j];
fp[1] = e1[j];
......@@ -253,7 +252,7 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
for (int j = 0; j< EQm; j++,j2+=4){
for (int j = 0, j2 = 0; j< EQm; j++,j2+=4){
fp=&f[j2];
fp[0] = e0[j];
fp[1] = e1[j];
......@@ -287,7 +286,7 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
e5=e4+EQm;
e6=e5+EQm;
e7=e6+EQm;
for (int j = 0; j< EQm; j++,j2+=8){
for (int j = 0, j2 = 0; j< EQm; j++,j2+=8){
fp=&f[j2];
fp[0] = e0[j];
fp[1] = e1[j];
......@@ -310,7 +309,6 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f)
{
int j2;
int16_t *e1,*e2,*e3,*e4,*e5,*e6,*e7;
switch(Qm) {
case 2:
......
......@@ -643,10 +643,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// create shortcuts
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
NR_UE_COMMON *const common_vars = &ue->common_vars;
NR_UE_PDSCH **const pdsch_vars_SI = ue->pdsch_vars_SI;
NR_UE_PDSCH **const pdsch_vars_ra = ue->pdsch_vars_ra;
NR_UE_PDSCH **const pdsch_vars_p = ue->pdsch_vars_p;
NR_UE_PDSCH **const pdsch_vars_mch = ue->pdsch_vars_MCH;
NR_UE_PBCH **const pbch_vars = ue->pbch_vars;
NR_UE_PRACH **const prach_vars = ue->prach_vars;
int i,j,k,l,slot,symb,q;
......@@ -799,10 +795,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
ue->pdcch_vars[th_id][eNB_id] = (NR_UE_PDCCH *)malloc16_clear(sizeof(NR_UE_PDCCH));
}
pdsch_vars_SI[eNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
pdsch_vars_ra[eNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
pdsch_vars_p[eNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
pdsch_vars_mch[eNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
prach_vars[eNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH));
pbch_vars[eNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH));
......@@ -864,11 +856,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
phy_init_nr_ue__PDSCH( pdsch_vars_SI[eNB_id], fp );
phy_init_nr_ue__PDSCH( pdsch_vars_ra[eNB_id], fp );
phy_init_nr_ue__PDSCH( pdsch_vars_p[eNB_id], fp );
phy_init_nr_ue__PDSCH( pdsch_vars_mch[eNB_id], fp );
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
ue->pdcch_vars[th_id][eNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
......@@ -932,10 +919,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
ue->pdsch_vars[th_id][eNB_id] = (NR_UE_PDSCH *)malloc16_clear( sizeof(NR_UE_PDSCH) );
}
pdsch_vars_SI[eNB_id] = (NR_UE_PDSCH *)malloc16_clear( sizeof(NR_UE_PDSCH) );
pdsch_vars_ra[eNB_id] = (NR_UE_PDSCH *)malloc16_clear( sizeof(NR_UE_PDSCH) );
pdsch_vars_p[eNB_id] = (NR_UE_PDSCH *)malloc16_clear( sizeof(NR_UE_PDSCH) );
if (abstraction_flag == 0) {
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
//phy_init_lte_ue__PDSCH( ue->pdsch_vars[th_id][eNB_id], fp );
......
......@@ -111,7 +111,6 @@ void nr_ulsch_unscrambling_optim(int16_t* llr,
uint32_t n_RNTI) {
#if defined(__x86_64__) || defined(__i386__)
uint8_t reset;
uint32_t x1, x2, s=0;
x2 = (n_RNTI<<15) + Nid;
......
......@@ -89,5 +89,5 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
void dump_pusch_stats(PHY_VARS_gNB *gNB);
void clear_pusch_stats(PHY_VARS_gNB *gNB);
void clear_pusch_stats(PHY_VARS_gNB *gNB);
......@@ -159,20 +159,17 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
switch (type) {
case SI_PDSCH:
pdsch_vars = ue->pdsch_vars_SI;
pdsch_vars = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]];
dlsch = &ue->dlsch_SI[eNB_id];
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
break;
case RA_PDSCH:
pdsch_vars = ue->pdsch_vars_ra;
pdsch_vars = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]];
dlsch = &ue->dlsch_ra[eNB_id];
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
// WIP TBR Hotfix
memcpy((void*)&pdsch_vars[eNB_id]->dl_ch_estimates[0][ue->frame_parms.ofdm_symbol_size*2], (void*)&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][0]->dl_ch_estimates[0][ue->frame_parms.ofdm_symbol_size*2], ue->frame_parms.ofdm_symbol_size*sizeof(int32_t));
break;
case PDSCH:
......@@ -189,7 +186,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
break;
}
if (dlsch1_harq){
if (dlsch0_harq && dlsch1_harq){
//printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n", frame, nr_tti_rx, symbol, harq_pid, dlsch0_harq->status, dlsch1_harq->status);
......
......@@ -71,7 +71,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
int16_t prach_tmp[98304*2*4] __attribute__((aligned(32)));
int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu;
int32_t Xu_re, Xu_im, samp_count;
int32_t Xu_re, Xu_im;
int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k;
//int restricted_Type;
......@@ -103,22 +103,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index,
ue->X_u);
if (mu == 0)
samp_count = fp->samples_per_subframe;
else
samp_count = (slot%(fp->slots_per_subframe/2)) ? fp->samples_per_slotN0 : fp->samples_per_slot0;
#ifdef OAI_USRP
prach_start = (ue->rx_offset + slot*samp_count - ue->hw_timing_advance - ue->N_TA_offset);
#else //normal case (simulation)
prach_start = slot*samp_count - ue->N_TA_offset;
#endif
if (prach_start<0)
prach_start += (fp->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME);
if (prach_start >= (fp->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME))
prach_start -= (fp->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME);
prach_start = fp->get_samples_slot_timestamp(slot, fp, 0);
// First compute physical root sequence
/************************************************************************
......@@ -796,40 +781,16 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
}
#ifdef NR_PRACH_DEBUG
LOG_I(PHY, "PRACH [UE %d] N_RB_UL %d prach_start %d, prach_len %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", Mod_id,
LOG_I(PHY, "PRACH [UE %d] N_RB_UL %d prach_start %d, prach_len %d\n", Mod_id,
fp->N_RB_UL,
prach_start,
prach_len,
ue->rx_offset,
ue->hw_timing_advance,
ue->N_TA_offset);
prach_len);
#endif
#if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
int j, overflow = prach_start + prach_len - NR_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_subframe;
#ifdef NR_PRACH_DEBUG
LOG_I( PHY, "PRACH [UE %d] overflow = %d\n", Mod_id, overflow);
#endif
// prach_start=414.730, overflow=-39470 prach_len=6600 fp->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME 460.800 prach_start+prach_len 421.330 fp->samples_per_subframe 46080
// from prach_start=414.730 to prach_start+prach_len 421.330
for (i = prach_start, j = 0; i < min(fp->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME, prach_start + prach_len); i++, j++) {
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j];
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1];
}
for (i = 0; i < overflow; i++,j++) {
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j];
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1];
}
#else // simulators
for (i=0; i<prach_len; i++) {
((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i];
((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1];
}
#endif
for (i=0; i<prach_len; i++) {
((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i];
((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1];
}
//printf("----------------------\n");
//for(int ii = prach_start; ii<2*(prach_start + prach_len); ii++){
......
......@@ -432,21 +432,11 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
int tx_offset, ap;
int32_t **txdata;
int32_t **txdataF;
int timing_advance;
/////////////////////////IFFT///////////////////////
///////////
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
timing_advance = UE->timing_advance;
#else
timing_advance = 0;
#endif
tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0) - timing_advance;
if (tx_offset < 0)
tx_offset += frame_parms->samples_per_frame;
tx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0);
// clear the transmit data array for the current subframe
/*for (int aa=0; aa<UE->frame_parms.nb_antennas_tx; aa++) {
......@@ -471,49 +461,19 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
}
}
if(UE->N_TA_offset > tx_offset) {
int32_t *tmp_idft_out = (int32_t*)malloc16(frame_parms->get_samples_per_slot(slot, frame_parms) * sizeof(int32_t));
for(ap = 0; ap < Nl; ap++) {
if (frame_parms->Ncp == 1) { // extended cyclic prefix
PHY_ofdm_mod(txdataF[ap],
tmp_idft_out,
frame_parms->ofdm_symbol_size,
12,
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
} else { // normal cyclic prefix
nr_normal_prefix_mod(txdataF[ap],
tmp_idft_out,
14,
frame_parms);
}
memcpy((void *) &txdata[ap][frame_parms->samples_per_frame - UE->N_TA_offset + tx_offset],
(void *) tmp_idft_out,
(UE->N_TA_offset - tx_offset) * sizeof(int32_t));
memcpy((void *) &txdata[ap][0],
(void *) &tmp_idft_out[UE->N_TA_offset - tx_offset],
(frame_parms->get_samples_per_slot(slot, frame_parms) - UE->N_TA_offset + tx_offset) * sizeof(int32_t));
}
free(tmp_idft_out);
} else { // UE->N_TA_offset <= tx_offset
for (ap = 0; ap < Nl; ap++) {
if (frame_parms->Ncp == 1) { // extended cyclic prefix
PHY_ofdm_mod(txdataF[ap],
&txdata[ap][tx_offset-UE->N_TA_offset],
frame_parms->ofdm_symbol_size,
12,
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
} else { // normal cyclic prefix
nr_normal_prefix_mod(txdataF[ap],
&txdata[ap][tx_offset-UE->N_TA_offset],
14,
frame_parms);
}
for (ap = 0; ap < Nl; ap++) {
if (frame_parms->Ncp == 1) { // extended cyclic prefix
PHY_ofdm_mod(txdataF[ap],
&txdata[ap][tx_offset],
frame_parms->ofdm_symbol_size,
12,
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
} else { // normal cyclic prefix
nr_normal_prefix_mod(txdataF[ap],
&txdata[ap][tx_offset],
14,
frame_parms);
}
}
......
......@@ -525,32 +525,25 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_
if (!phy_vars_ue->pdcch_vars[0][eNB_id]->llr)
return;
NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms;
uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx;
uint8_t nb_antennas_tx = frame_parms->nb_antennas_tx;
scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates;
int ind = 0;
float chest_f_abs[frame_parms->ofdm_symbol_size];
float freq[frame_parms->ofdm_symbol_size];
int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols
int Qm = 2;
int coded_bits_per_codeword = num_re*Qm;
localBuff(llr,coded_bits_per_codeword*RX_NB_TH_MAX);
localBuff(bit,coded_bits_per_codeword*RX_NB_TH_MAX);
int base=0;
for (int atx=0; atx<nb_antennas_tx; atx++) {
for (int arx=0; arx<nb_antennas_rx; arx++) {
if (chest_f[(atx<<1)+arx] != NULL) {
for (int k=0; k<frame_parms->ofdm_symbol_size; k++) {
freq[ind] = (float)ind;
chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k]));
ind++;
}
}
for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) {
int16_t *pdcch_llr = (int16_t *) phy_vars_ue->pdcch_vars[thr][eNB_id]->llr;
for (int i=0; i<coded_bits_per_codeword; i++) {
llr[base+i] = (float) pdcch_llr[i];
bit[base+i] = (float) base+i;
}
base+=coded_bits_per_codeword;
}
// tx antenna 0
//fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce);
//fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2);
// fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2);
//fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR);
oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10);
oai_xygraph(graph,bit,llr,base,0,10);
}
static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) {
......
......@@ -452,55 +452,6 @@ typedef struct {
uint32_t llr_length[14];
} LTE_UE_PDSCH;
typedef struct {
/// \brief Received frequency-domain signal after extraction.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
int32_t **rxdataF_ext;
/// \brief Received frequency-domain signal after extraction and channel compensation.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **rxdataF_comp;
/// \brief Downlink channel estimates extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
int32_t **dl_ch_estimates_ext;
/// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **dl_ch_rho_ext;
/// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
/// - first index: ressource block [0..N_RB_DL[
uint8_t *pmi_ext;
/// \brief Magnitude of Downlink Channel (16QAM level/First 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **dl_ch_mag;
/// \brief Magnitude of Downlink Channel (2nd 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **dl_ch_magb;
/// \brief Cross-correlation of two eNB signals.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: ? [0..]
double **rho;
/// never used... always send dl_ch_rho_ext instead...
double **rho_i;
/// \brief Pointers to llr vectors (2 TBs).
/// - first index: ? [0..1] (hard coded)
/// - second index: ? [0..1179743] (hard coded)
int16_t *llr[2];
/// \f$\log_2(\max|H_i|^2)\f$
uint8_t log2_maxh;
/// \brief Pointers to llr vectors (128-bit alignment).
/// - first index: ? [0..0] (hard coded)
/// - second index: ? [0..]
int16_t **llr128;
//uint32_t *rb_alloc;
//uint8_t Qm[2];
//MIMO_mode_t mimo_mode;
} LTE_UE_PDSCH_FLP;
typedef struct {
/// \brief Pointers to extracted PDCCH symbols in frequency-domain.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
......@@ -667,7 +618,6 @@ typedef struct {
uint8_t current_thread_id[10];
LTE_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads
LTE_UE_PDSCH_FLP *pdsch_vars_flp[NUMBER_OF_CONNECTED_eNB_MAX+1];
LTE_UE_PDSCH *pdsch_vars_SI[NUMBER_OF_CONNECTED_eNB_MAX+1];
LTE_UE_PDSCH *pdsch_vars_ra[NUMBER_OF_CONNECTED_eNB_MAX+1];
LTE_UE_PDSCH *pdsch_vars_p[NUMBER_OF_CONNECTED_eNB_MAX+1];
......
......@@ -416,55 +416,6 @@ typedef struct {
uint32_t llr_length[14];
} NR_UE_PDSCH;
typedef struct {
/// \brief Received frequency-domain signal after extraction.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
int32_t **rxdataF_ext;
/// \brief Received frequency-domain signal after extraction and channel compensation.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **rxdataF_comp;
/// \brief Downlink channel estimates extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
int32_t **dl_ch_estimates_ext;
/// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **dl_ch_rho_ext;
/// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
/// - first index: ressource block [0..N_RB_DL[
uint8_t *pmi_ext;
/// \brief Magnitude of Downlink Channel (16QAM level/First 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **dl_ch_mag;
/// \brief Magnitude of Downlink Channel (2nd 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..]
double **dl_ch_magb;
/// \brief Cross-correlation of two eNB signals.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: ? [0..]
double **rho;
/// never used... always send dl_ch_rho_ext instead...
double **rho_i;
/// \brief Pointers to llr vectors (2 TBs).
/// - first index: ? [0..1] (hard coded)
/// - second index: ? [0..1179743] (hard coded)
int16_t *llr[2];
/// \f$\log_2(\max|H_i|^2)\f$
uint8_t log2_maxh;
/// \brief Pointers to llr vectors (128-bit alignment).
/// - first index: ? [0..0] (hard coded)
/// - second index: ? [0..]
int16_t **llr128;
//uint32_t *rb_alloc;
//uint8_t Qm[2];
//MIMO_mode_t mimo_mode;
} NR_UE_PDSCH_FLP;
#define NR_PDCCH_DEFS_NR_UE
#define NR_NBR_CORESET_ACT_BWP 3 // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0)
#define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearchSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0)
......@@ -902,11 +853,6 @@ typedef struct {
t_nrPolar_params *polarList;
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads
NR_UE_PDSCH_FLP *pdsch_vars_flp[NUMBER_OF_CONNECTED_eNB_MAX+1];
NR_UE_PDSCH *pdsch_vars_SI[NUMBER_OF_CONNECTED_eNB_MAX+1];
NR_UE_PDSCH *pdsch_vars_ra[NUMBER_OF_CONNECTED_eNB_MAX+1];
NR_UE_PDSCH *pdsch_vars_p[NUMBER_OF_CONNECTED_eNB_MAX+1];
NR_UE_PDSCH *pdsch_vars_MCH[NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_eNB_MAX];
......@@ -1022,7 +968,6 @@ typedef struct {
/// Timing Advance updates variables
/// Timing advance update computed from the TA command signalled from gNB
int timing_advance;
int hw_timing_advance;
int N_TA_offset; ///timing offset used in TDD
NR_UL_TIME_ALIGNMENT_t ul_time_alignment[NUMBER_OF_CONNECTED_gNB_MAX];
......
......@@ -218,7 +218,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
break;
}
}
......
......@@ -304,7 +304,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
pusch_pdu->qam_mod_order,
pusch_pdu->nrOfLayers);
AssertFatal(G>0,"G is 0 : rb_size %d, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %d, nrOfLayer %d\n",
AssertFatal(G>0,"G is 0 : rb_size %u, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %u, nrOfLayer %u\n",
pusch_pdu->rb_size,
number_symbols,
nb_re_dmrs,
......
This diff is collapsed.
......@@ -501,7 +501,7 @@ int main(int argc, char **argv)
//printf("crc32: [0]->0x%08x\n",crc24c(test_input, 32));
// generate signal
if (input_fd == NULL) {
nr_dlsch_encoding(test_input, frame, slot, dlsch, frame_parms,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
}
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
......
......@@ -41,6 +41,7 @@
#include "PHY/MODULATION/nr_modulation.h"
#include "PHY/MODULATION/modulation_UE.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "SCHED_NR/fapi_nr_l1.h"
......
......@@ -604,7 +604,7 @@ int main(int argc, char **argv){
/* tx_lev_dB not used later, no need to set */
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
prach_start = subframe*frame_parms->samples_per_subframe-UE->N_TA_offset;
prach_start = subframe*frame_parms->samples_per_subframe;
#ifdef NR_PRACH_DEBUG
LOG_M("txsig0.m", "txs0", &txdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
......
......@@ -164,12 +164,12 @@ int main(int argc, char **argv)
int rv_index = 0;
float roundStats[50];
float effRate;
float eff_tp_check = 0.7;
//float eff_tp_check = 0.7;
uint8_t snrRun;
UE_nr_rxtx_proc_t UE_proc;
FILE *scg_fd=NULL;
int file_offset;
int file_offset = 0;
double DS_TDL = .03;
int pusch_tgt_snrx10 = 200;
......@@ -312,10 +312,12 @@ int main(int argc, char **argv)
snr0 = atof(optarg);
printf("Setting SNR0 to %f\n", snr0);
break;
/*
case 't':
eff_tp_check = (float)atoi(optarg)/100;
break;
*/
/*
case 'r':
ricean_factor = pow(10,-.1*atof(optarg));
......@@ -650,15 +652,9 @@ int main(int argc, char **argv)
//for (int i=0;i<16;i++) printf("%f\n",gaussdouble(0.0,1.0));
snrRun = 0;
int n_errs;
double factor = 1;
if (openair0_cfg[0].threequarter_fs== 1) factor =.75;
int ta_offset=1600;
if (N_RB_DL <217) ta_offset=800;
else if (N_RB_DL < 106) ta_offset = 400;
int n_errs = 0;
int slot_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);// - (int)(800*factor);
int slot_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
int slot_length = slot_offset - frame_parms->get_samples_slot_timestamp(slot-1,frame_parms,0);
if (input_fd != NULL) {
......@@ -666,8 +662,6 @@ int main(int argc, char **argv)
// 800 samples is N_TA_OFFSET for FR1 @ 30.72 Ms/s,
AssertFatal(frame_parms->subcarrier_spacing==30000,"only 30 kHz for file input for now (%d)\n",frame_parms->subcarrier_spacing);
// slot_offset -= (int)(800*factor);
fseek(input_fd,file_offset*((slot_length<<2)+4000+16),SEEK_SET);
fread((void*)&n_rnti,sizeof(int16_t),1,input_fd);
printf("rnti %x\n",n_rnti);
......@@ -996,7 +990,7 @@ int main(int argc, char **argv)
if (n_trials == 1 && errors_scrambling[0] > 0) {
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in unscrambling = %u\n" "\x1B[0m", frame, trial, errors_scrambling);
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in unscrambling = %u\n" "\x1B[0m", frame, trial, errors_scrambling[0]);
}
for (i = 0; i < TBS; i++) {
......@@ -1035,7 +1029,7 @@ int main(int argc, char **argv)
printf("*****************************************\n");
printf("SNR %f: n_errors (%d/%d,%d/%d,%d/%d,%d/%d) (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u,%u/%u,%u/%u,%u/%u\n", SNR, n_errors[0], round_trials[0],n_errors[1], round_trials[1],n_errors[2], round_trials[2],n_errors[3], round_trials[3], n_false_positive, n_trials, errors_scrambling[0],available_bits*n_trials,errors_scrambling[1],available_bits*n_trials,errors_scrambling[2],available_bits*n_trials,errors_scrambling[3],available_bits*n_trials);
printf("\n");
printf("SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n",
printf("SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n",
SNR,
(double)n_errors[0]/round_trials[0],
(double)n_errors[1]/round_trials[0],
......
......@@ -1151,7 +1151,7 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
if (NCS == 0) return nb_preambles;
else {
r = L_ra/NCS;
found_sequences = (nb_preambles/r) + (nb_preambles%r!=0); //ceil(nb_preambles/r)
found_sequences = (nb_preambles/r) + (nb_preambles%r!=0); //ceil(nb_preambles/r)
printf(" found_sequences %u\n", found_sequences);
return (found_sequences);
}
......@@ -1616,92 +1616,156 @@ uint16_t Table_61412[28][2] = {{2,30},{2,40},{2,50},{2,64},{2,78},{2,99},{2,120}
uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
case 0:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51311[Imcs][0]);
break;
case 1:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_51312[Imcs][0]);
break;
case 2:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51313[Imcs][0]);
break;
default:
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx);
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,2])\n", table_idx);
}
}
uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
case 0:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51311[Imcs][1]);
break;
case 1:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_51312[Imcs][1]);
break;
case 2:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51313[Imcs][1]);
break;
default:
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx);
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,2])\n", table_idx);
}
}
uint8_t nr_get_Qm_ul(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
case 0:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51311[Imcs][0]);
break;
case 1:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_51312[Imcs][0]);
break;
case 2:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51313[Imcs][0]);
break;
case 3:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 3 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_61411[Imcs][0]);
break;
case 4:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 4 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_61412[Imcs][0]);
break;
default:
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,2])\n", table_idx);
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,4])\n", table_idx);
}
}
uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
case 0:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 0 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51311[Imcs][1]);
break;
case 1:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 1 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_51312[Imcs][1]);
break;
case 2:
if (Imcs > 28) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 2 (expected range [0,28])\n", Imcs);
Imcs = 28;
}
return (Table_51313[Imcs][1]);
break;
case 3:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 3 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_61411[Imcs][1]);
break;
case 4:
if (Imcs > 27) {
LOG_E(MAC, "Invalid MCS index %d for MCS table 4 (expected range [0,27])\n", Imcs);
Imcs = 27;
}
return (Table_61412[Imcs][1]);
break;
default:
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,2])\n", table_idx);
AssertFatal(0, "Invalid MCS table index %d (expected in range [0,4])\n", table_idx);
}
}
......
......@@ -2342,7 +2342,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu_0_0,NULL,n_RB_ULBWP,0,dci->frequency_domain_assignment.val);
/* TIME_DOM_RESOURCE_ASSIGNMENT */
if (nr_ue_process_dci_time_dom_resource_assignment(mac,pusch_config_pdu_0_0,NULL,dci->time_domain_assignment.val) < 0)
break;
return -1;
/* FREQ_HOPPING_FLAG */
if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.resource_allocation != 0) &&
(mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.frequency_hopping !=0))
......@@ -2416,7 +2416,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu_0_1,NULL,n_RB_ULBWP,0,dci->frequency_domain_assignment.val);
/* TIME_DOM_RESOURCE_ASSIGNMENT */
if (nr_ue_process_dci_time_dom_resource_assignment(mac,pusch_config_pdu_0_1,NULL,dci->time_domain_assignment.val) < 0)
break;
return -1;
/* FREQ_HOPPING_FLAG */
if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.resource_allocation != 0) &&
(mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.frequency_hopping !=0))
......@@ -2747,7 +2747,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,n_RB_DLBWP,dci->frequency_domain_assignment.val);
/* TIME_DOM_RESOURCE_ASSIGNMENT */
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0)
break;
return -1;
/* dmrs symbol positions*/
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
mac->scc->dmrs_TypeA_Position,
......@@ -2872,7 +2872,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc
nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_1,0,n_RB_DLBWP,dci->frequency_domain_assignment.val);
/* TIME_DOM_RESOURCE_ASSIGNMENT */
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val) < 0)
break;
return -1;
/* dmrs symbol positions*/
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
mac->scc->dmrs_TypeA_Position,
......@@ -3801,9 +3801,8 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
}
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
if (pdu_len < 0) //AssertFatal(pdu_len >= 0, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!, mac_pdu_len %d, mac_sdu_len %d, mac_ce_len %d, mac_subheader_len %d\n",
LOG_E(MAC,"nr_ue_process_mac_pdu, residual mac pdu length %d < 0!, mac_pdu_len %d, mac_sdu_len %d, mac_ce_len %d, mac_subheader_len %d\n",
pdu_len,mac_pdu_len,mac_sdu_len,mac_ce_len,mac_sdu_len);
if (pdu_len < 0)
LOG_E(MAC, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", pdu_len);
}
}
......
......@@ -485,6 +485,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
*/
if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]);
// This schedules MIB
if((slot == 0) && (frame & 7) == 0){
schedule_nr_mib(module_idP, frame, slot);
......@@ -505,8 +506,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if (get_softmodem_params()->phy_test == 0) {
nr_schedule_RA(module_idP, frame, slot);
nr_schedule_reception_msg3(module_idP, 0, frame, slot);
}
else
} else
UE_list->fiveG_connected[UE_id] = true;
if (get_softmodem_params()->phy_test) {
......
......@@ -437,7 +437,10 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
NR_UE_list_t *UE_list = &mac->UE_list;
int UE_id = 0;
AssertFatal(ra->state != RA_IDLE, "RA is not active for RA %X\n", ra->rnti);
if (ra->state == RA_IDLE) {
LOG_W(MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti);
return;
}
LOG_D(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
......@@ -540,7 +543,7 @@ void nr_generate_Msg2(module_id_t module_idP,
sub_frame_t slotP){
int UE_id = 0, dci_formats[2], rnti_types[2], mcsIndex;
int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment;
int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment = 0;
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[0];
NR_RA_t *ra = &cc->ra[0];
......
......@@ -19,8 +19,8 @@
* contact@openairinterface.org
*/
#ifndef _ASN1_UTILS_H_
#define _ASN1_UTILS_H_
#ifndef _OPENAIR2_LAYER2_NR_RLC_ASN1_UTILS_H_
#define _OPENAIR2_LAYER2_NR_RLC_ASN1_UTILS_H_
int decode_t_reassembly(int v);
int decode_t_status_prohibit(int v);
......@@ -31,4 +31,4 @@ int decode_max_retx_threshold(int v);
int decode_sn_field_length_um(int v);
int decode_sn_field_length_am(int v);
#endif /* _ASN1_UTILS_H_ */
#endif /* _OPENAIR2_LAYER2_NR_RLC_ASN1_UTILS_H_ */
......@@ -19,8 +19,8 @@
* contact@openairinterface.org
*/
#ifndef _ASN1_UTILS_H_
#define _ASN1_UTILS_H_
#ifndef _OPENAIR2_LAYER2_RLC_V2_ASN1_UTILS_H_
#define _OPENAIR2_LAYER2_RLC_V2_ASN1_UTILS_H_
int decode_t_reordering(int v);
int decode_t_status_prohibit(int v);
......@@ -30,4 +30,4 @@ int decode_poll_byte(int v);
int decode_max_retx_threshold(int v);
int decode_sn_field_length(int v);
#endif /* _ASN1_UTILS_H_ */
#endif /* _OPENAIR2_LAYER2_RLC_V2_ASN1_UTILS_H_ */
......@@ -167,13 +167,16 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
for(i=0; i<dl_info->dci_ind->number_of_dcis; ++i){
LOG_D(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis);
ret_mask |= (handle_dci(dl_info->module_id,
int8_t ret = handle_dci(dl_info->module_id,
dl_info->cc_id,
dl_info->gNB_index,
dl_info->dci_ind->dci_list+i)<< FAPI_NR_DCI_IND);
dl_info->dci_ind->dci_list+i);
AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is void!\n" );
nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response);
ret_mask |= (ret << FAPI_NR_DCI_IND);
if (ret >= 0) {
AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is void!\n" );
nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response);
}
}
}
......
......@@ -9089,47 +9089,53 @@ void rrc_eNB_process_AdditionResponseInformation(const module_id_t enb_mod_idP,
return;
}
protocol_ctxt_t ctxt;
rrc_eNB_ue_context_t *ue_context;
unsigned char buffer[8192];
int size;
ue_context = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], m->rnti);
ue_context->ue_context.nb_of_modify_endc_e_rabs = m->nb_e_rabs_admitted_tobeadded;
int j=0;
while(j < m->nb_e_rabs_admitted_tobeadded) {
for (int e_rab_idx=0; e_rab_idx<ue_context->ue_context.setup_e_rabs; e_rab_idx++) {
//Update ue_context information with gNB's address and new GTP tunnel ID
if( ue_context->ue_context.e_rab[e_rab_idx].param.e_rab_id == m->e_rabs_admitted_tobeadded[j].e_rab_id) {
memcpy(ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].buffer,
m->e_rabs_admitted_tobeadded[j].gnb_addr.buffer,
m->e_rabs_admitted_tobeadded[j].gnb_addr.length);
ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].length = m->e_rabs_admitted_tobeadded[j].gnb_addr.length;
ue_context->ue_context.gnb_gtp_endc_teid[e_rab_idx] = m->e_rabs_admitted_tobeadded[j].gtp_teid;
ue_context->ue_context.e_rab[e_rab_idx].status = E_RAB_STATUS_TOMODIFY;
break;
protocol_ctxt_t ctxt;
rrc_eNB_ue_context_t *ue_context;
unsigned char buffer[8192];
int size;
ue_context = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], m->rnti);
if (ue_context) {
ue_context->ue_context.nb_of_modify_endc_e_rabs = m->nb_e_rabs_admitted_tobeadded;
int j=0;
while(j < m->nb_e_rabs_admitted_tobeadded){
for (int e_rab_idx=0; e_rab_idx<ue_context->ue_context.setup_e_rabs; e_rab_idx++){
//Update ue_context information with gNB's address and new GTP tunnel ID
if( ue_context->ue_context.e_rab[e_rab_idx].param.e_rab_id == m->e_rabs_admitted_tobeadded[j].e_rab_id){
memcpy(ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].buffer,
m->e_rabs_admitted_tobeadded[j].gnb_addr.buffer,
m->e_rabs_admitted_tobeadded[j].gnb_addr.length);
ue_context->ue_context.gnb_gtp_endc_addrs[e_rab_idx].length = m->e_rabs_admitted_tobeadded[j].gnb_addr.length;
ue_context->ue_context.gnb_gtp_endc_teid[e_rab_idx] = m->e_rabs_admitted_tobeadded[j].gtp_teid;
ue_context->ue_context.e_rab[e_rab_idx].status = E_RAB_STATUS_TOMODIFY;
break;
}
}
j++;
}
}
j++;
}
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
0,
ENB_FLAG_YES,
m->rnti,
0, 0);
size = rrc_eNB_generate_RRCConnectionReconfiguration_endc(&ctxt, ue_context, buffer, 8192, scg_CellGroupConfig, nr1_conf);
rrc_data_req(&ctxt,
DCCH,
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
} else {
LOG_E(F1AP, "no ue_context for RNTI %x, acknowledging release\n", m->rnti);
}
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
0,
ENB_FLAG_YES,
m->rnti,
0, 0);
size = rrc_eNB_generate_RRCConnectionReconfiguration_endc(&ctxt, ue_context, buffer, 8192, scg_CellGroupConfig, nr1_conf);
rrc_data_req(&ctxt,
DCCH,
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
//-----------------------------------------------------------------------------
void *rrc_enb_process_itti_msg(void *notUsed) {
MessageDef *msg_p;
......
......@@ -90,6 +90,8 @@ typedef enum {
USRP_B200_DEV,
/*!\brief device is USRP X300/X310*/
USRP_X300_DEV,
/*!\brief device is USRP N300/N310*/
USRP_N300_DEV,
/*!\brief device is BLADE RF*/
BLADERF_DEV,
/*!\brief device is LMSSDR (SoDeRa)*/
......@@ -104,7 +106,7 @@ typedef enum {
UEDv2_DEV,
MAX_RF_DEV_TYPE
} dev_type_t;
#define DEVTYPE_NAMES {"","EXMIMO","USRP B200","USRP X300","BLADERF","LMSSDR","IRIS","No HW","ADRV9371_ZC706","UEDv2"}
#define DEVTYPE_NAMES {"","EXMIMO","USRP B200","USRP X300","USRP N300","BLADERF","LMSSDR","IRIS","No HW","ADRV9371_ZC706","UEDv2"}
/*!\brief transport protocol types
*/
typedef enum {
......@@ -434,6 +436,11 @@ struct openair0_device_t {
* \param arg pointer to capabilities or configuration
*/
int (*trx_write_init)(openair0_device *device);
/* \brief Get internal parameter
* \param id parameter to get
* \return a pointer to the parameter
*/
void *(*get_internal_parameter)(char *id);
};
/* type of device init function, implemented in shared lib */
......
This diff is collapsed.
This diff is collapsed.
/*
* 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
*/
#include "low.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void store_ul(benetel_t *bs, ul_packet_t *ul)
{
/* only antenna 0 for the moment */
if (ul->antenna != 0)
return;
if (ul->subframe != bs->next_subframe ||
ul->symbol != bs->next_symbol) {
printf("%s: fatal, expected frame.sf.symbol %d.%d.%d, got %d.%d.%d\n",
__FUNCTION__,
bs->expected_benetel_frame, bs->next_subframe, bs->next_symbol,
ul->frame, ul->subframe, ul->symbol);
exit(1);
}
lock_ul_buffer(bs->buffers, bs->next_subframe);
if (bs->buffers->ul_busy[bs->next_subframe] & (1 << bs->next_symbol)) {
printf("%s: warning, UL overflow (sf.symbol %d.%d)\n", __FUNCTION__,
bs->next_subframe, bs->next_symbol);
}
memcpy(bs->buffers->ul[bs->next_subframe] + bs->next_symbol * 1200*4,
ul->iq, 1200*4);
bs->buffers->ul_busy[bs->next_subframe] |= (1 << bs->next_symbol);
signal_ul_buffer(bs->buffers, bs->next_subframe);
unlock_ul_buffer(bs->buffers, bs->next_subframe);
bs->next_symbol++;
if (bs->next_symbol == 14) {
bs->next_symbol = 0;
bs->next_subframe = (bs->next_subframe + 1) % 10;
if (bs->next_subframe == 0) {
bs->expected_benetel_frame++;
bs->expected_benetel_frame &= 255;
}
}
}
void store_prach(benetel_t *bs, int frame, int subframe, void *data)
{
static int last_frame = -1;
static int last_subframe = -1;
/* hack: antenna number is always 0, discard second packet with same f/sf */
if (frame == last_frame && subframe == last_subframe) return;
last_frame = frame;
last_subframe = subframe;
lock_ul_buffer(bs->buffers, subframe);
if (bs->buffers->prach_busy[subframe]) {
printf("store_prach: fatal: previous prach buffer not processed\n");
unlock_ul_buffer(bs->buffers, subframe);
return;
}
bs->buffers->prach_busy[subframe] = 1;
memcpy(bs->buffers->prach[subframe], data, 849*4);
signal_ul_buffer(bs->buffers, subframe);
unlock_ul_buffer(bs->buffers, subframe);
}
void *benetel_start_dpdk(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line);
void *benetel_start(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line)
{
if (!strcmp(ifname, "dpdk"))
return benetel_start_dpdk(ifname, buffers, dpdk_main_command_line);
printf("benetel: fatal: interface %s not supported, only dpdpk is supported\n", ifname);
exit(1);
}
/*
* 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
*/
#ifndef _BENETEL_4G_LOW_H_
#define _BENETEL_4G_LOW_H_
#include "shared_buffers.h"
typedef struct {
shared_buffers *buffers;
int next_subframe;
int next_symbol;
int expected_benetel_frame;
char *dpdk_main_command_line;
} benetel_t;
typedef struct {
int frame;
int subframe;
int slot;
int symbol;
int antenna;
unsigned char iq[4800];
} ul_packet_t;
void *benetel_start(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line);
void store_ul(benetel_t *bs, ul_packet_t *ul);
void store_prach(benetel_t *bs, int frame, int subframe, void *data);
#endif /* _BENETEL_4G_LOW_H_ */
/*
* 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
*/
/* those 2 lines for CPU_SET */
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "low.h"
int dpdk_main(int argc, char **argv, benetel_t *);
void *dpdk_thread(void *_bs)
{
benetel_t *bs = _bs;
int n = 0;
char **v = NULL; // { "softmodem", "-n", "2", "-l", "8", "--", "-p", "0x2" };
char *s = bs->dpdk_main_command_line;
char *tok;
while ((tok = strtok(s, " ")) != NULL) {
n++;
v = realloc(v, n * sizeof(char *));
if (v == NULL) {
printf("%s: out of memory\n", __FUNCTION__);
exit(1);
}
v[n-1] = tok;
s = NULL;
}
dpdk_main(n, v, bs);
exit(1);
return 0;
}
void *benetel_start_dpdk(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line)
{
benetel_t *bs;
bs = calloc(1, sizeof(benetel_t));
if (bs == NULL) {
printf("%s: out of memory\n", __FUNCTION__);
exit(1);
}
bs->buffers = buffers;
bs->expected_benetel_frame = 255;
bs->dpdk_main_command_line = dpdk_main_command_line;
pthread_attr_t attr;
if (pthread_attr_init(&attr) != 0) {
printf("pthread_attr_init failed\n");
exit(1);
}
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(12,&cpuset);
if (pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset) != 0) {
printf("pthread_attr_setaffinity_np failed\n");
exit(1);
}
if (pthread_attr_setschedpolicy(&attr, SCHED_FIFO) != 0) {
printf("pthread_attr_setschedpolicy failed\n");
exit(1);
}
struct sched_param params;
params.sched_priority = sched_get_priority_max(SCHED_FIFO);
if (sched_get_priority_max(SCHED_FIFO) == -1) {
printf("sched_get_priority_max failed\n");
exit(1);
}
if (pthread_attr_setschedparam(&attr, &params) != 0) {
printf("pthread_setschedparam failed\n");
exit(1);
}
pthread_t t;
if (pthread_create(&t, &attr, dpdk_thread, bs) != 0) {
printf("%s: thread creation failed\n", __FUNCTION__);
exit(1);
}
if (pthread_attr_destroy(&attr) != 0) {
printf("pthread_attr_init failed\n");
exit(1);
}
return bs;
}
/*
* 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
*/
#include "shared_buffers.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void init_buffers(shared_buffers *s)
{
int subframe;
memset(s, 0, sizeof(*s));
for (subframe = 0; subframe < 10; subframe++) {
if (pthread_mutex_init(&s->m_dl[subframe], NULL) != 0 ||
pthread_cond_init(&s->c_dl[subframe], NULL) != 0 ||
pthread_mutex_init(&s->m_ul[subframe], NULL) != 0 ||
pthread_cond_init(&s->c_ul[subframe], NULL) != 0) {
printf("%s: error initializing mutex/cond\n", __FUNCTION__);
exit(1);
}
}
/* in FDD the eNB's first transmitted DL subframe is 4 but the device
* needs to have subframes 1, 2 and 3 ready. Let's pretend there are ready.
*/
s->dl_busy[1] = 0x3fff;
s->dl_busy[2] = 0x3fff;
s->dl_busy[3] = 0x3fff;
}
void lock_dl_buffer(shared_buffers *s, int subframe)
{
if (pthread_mutex_lock(&s->m_dl[subframe]) != 0) {
printf("%s: fatal: lock fails\n", __FUNCTION__);
exit(1);
}
}
void unlock_dl_buffer(shared_buffers *s, int subframe)
{
if (pthread_mutex_unlock(&s->m_dl[subframe]) != 0) {
printf("%s: fatal: unlock fails\n", __FUNCTION__);
exit(1);
}
}
void wait_dl_buffer(shared_buffers *s, int subframe)
{
if (pthread_cond_wait(&s->c_dl[subframe], &s->m_dl[subframe]) != 0) {
printf("%s: fatal: cond_wait fails\n", __FUNCTION__);
exit(1);
}
}
void signal_dl_buffer(shared_buffers *s, int subframe)
{
if (pthread_cond_broadcast(&s->c_dl[subframe]) != 0) {
printf("%s: fatal: cond_broadcast fails\n", __FUNCTION__);
exit(1);
}
}
void lock_ul_buffer(shared_buffers *s, int subframe)
{
if (pthread_mutex_lock(&s->m_ul[subframe]) != 0) {
printf("%s: fatal: lock fails\n", __FUNCTION__);
exit(1);
}
}
void unlock_ul_buffer(shared_buffers *s, int subframe)
{
if (pthread_mutex_unlock(&s->m_ul[subframe]) != 0) {
printf("%s: fatal: unlock fails\n", __FUNCTION__);
exit(1);
}
}
void wait_ul_buffer(shared_buffers *s, int subframe)
{
if (pthread_cond_wait(&s->c_ul[subframe], &s->m_ul[subframe]) != 0) {
printf("%s: fatal: cond_wait fails\n", __FUNCTION__);
exit(1);
}
}
void signal_ul_buffer(shared_buffers *s, int subframe)
{
if (pthread_cond_broadcast(&s->c_ul[subframe]) != 0) {
printf("%s: fatal: cond_broadcast fails\n", __FUNCTION__);
exit(1);
}
}
/*
* 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
*/
#ifndef _BENETEL_4G_SHARED_BUFFERS_H_
#define _BENETEL_4G_SHARED_BUFFERS_H_
#include <pthread.h>
#include <stdint.h>
typedef struct {
unsigned char dl[10][14*1200*4];
unsigned char ul[10][14*1200*4];
uint16_t dl_busy[10];
uint16_t ul_busy[10];
pthread_mutex_t m_ul[10];
pthread_cond_t c_ul[10];
pthread_mutex_t m_dl[10];
pthread_cond_t c_dl[10];
unsigned char prach[10][849*4];
unsigned char prach_busy[10];
/* statistics/error counting */
int ul_overflow;
int dl_underflow;
} shared_buffers;
void init_buffers(shared_buffers *s);
void lock_dl_buffer(shared_buffers *s, int subframe);
void unlock_dl_buffer(shared_buffers *s, int subframe);
void wait_dl_buffer(shared_buffers *s, int subframe);
void signal_dl_buffer(shared_buffers *s, int subframe);
void lock_ul_buffer(shared_buffers *s, int subframe);
void unlock_ul_buffer(shared_buffers *s, int subframe);
void wait_ul_buffer(shared_buffers *s, int subframe);
void signal_ul_buffer(shared_buffers *s, int subframe);
#endif /* _BENETEL_4G_SHARED_BUFFERS_H_ */
This diff is collapsed.
This diff is collapsed.
/*
* 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
*/
#include "low.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void store_ul(benetel_t *bs, ul_packet_t *ul)
{
/* only antenna 0 for the moment */
if (ul->antenna != 0)
return;
if (ul->slot != bs->next_slot ||
ul->symbol != bs->next_symbol) {
printf("%s: fatal, expected frame.sl.symbol %d.%d.%d, got %d.%d.%d\n",
__FUNCTION__,
bs->expected_benetel_frame, bs->next_slot, bs->next_symbol,
ul->frame, ul->slot, ul->symbol);
exit(1);
}
lock_ul_buffer(bs->buffers, bs->next_slot);
if (bs->buffers->ul_busy[bs->next_slot] & (1 << bs->next_symbol)) {
printf("%s: warning, UL overflow (sl.symbol %d.%d)\n", __FUNCTION__,
bs->next_slot, bs->next_symbol);
}
memcpy(bs->buffers->ul[bs->next_slot] + bs->next_symbol * 1272*4,
ul->iq, 1272*4);
bs->buffers->ul_busy[bs->next_slot] |= (1 << bs->next_symbol);
signal_ul_buffer(bs->buffers, bs->next_slot);
unlock_ul_buffer(bs->buffers, bs->next_slot);
bs->next_symbol++;
if (bs->next_symbol == 14) {
bs->next_symbol = 0;
bs->next_slot = (bs->next_slot + 1) % 20;
if (bs->next_slot == 0) {
bs->expected_benetel_frame++;
bs->expected_benetel_frame &= 255;
}
}
}
void store_prach(benetel_t *bs, int frame, int slot, void *data)
{
static int last_frame = -1;
static int last_slot = -1;
/* hack: antenna number is always 0, discard second packet with same f/sf */
//if (frame == last_frame && slot == last_slot) return;
if (frame == last_frame && slot == last_slot) { printf("got f.sl %d.%d twice\n", frame, slot); return; }
last_frame = frame;
last_slot = slot;
lock_ul_buffer(bs->buffers, slot);
if (bs->buffers->prach_busy[slot]) {
printf("store_prach: fatal: previous prach buffer not processed\n");
unlock_ul_buffer(bs->buffers, slot);
return;
}
bs->buffers->prach_busy[slot] = 1;
memcpy(bs->buffers->prach[slot], data, 839*4);
signal_ul_buffer(bs->buffers, slot);
unlock_ul_buffer(bs->buffers, slot);
}
void *benetel_start_dpdk(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line);
void *benetel_start(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line)
{
if (!strcmp(ifname, "dpdk"))
return benetel_start_dpdk(ifname, buffers, dpdk_main_command_line);
printf("benetel: fatal: interface %s not supported, only dpdpk is supported\n", ifname);
exit(1);
}
/*
* 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
*/
#ifndef _BENETEL_5G_LOW_H_
#define _BENETEL_5G_LOW_H_
#include "shared_buffers.h"
typedef struct {
shared_buffers *buffers;
int next_slot;
int next_symbol;
int expected_benetel_frame;
char *dpdk_main_command_line;
} benetel_t;
typedef struct {
int frame;
int slot;
int symbol;
int antenna;
unsigned char iq[5088];
} ul_packet_t;
void *benetel_start(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line);
void store_ul(benetel_t *bs, ul_packet_t *ul);
void store_prach(benetel_t *bs, int frame, int slot, void *data);
#endif /* _BENETEL_5G_LOW_H_ */
/*
* 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
*/
/* those 2 lines for CPU_SET */
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "low.h"
int dpdk_main(int argc, char **argv, benetel_t *);
void *dpdk_thread(void *_bs)
{
benetel_t *bs = _bs;
int n = 0;
char **v = NULL; // = { "softmodem", "-n", "2", "--file-prefix", "pg2", "-l", "6", "--", "-p", "0x1" };
char *s = bs->dpdk_main_command_line;
char *tok;
while ((tok = strtok(s, " ")) != NULL) {
n++;
v = realloc(v, n * sizeof(char *));
if (v == NULL) {
printf("%s: out of memory\n", __FUNCTION__);
exit(1);
}
v[n-1] = tok;
s = NULL;
}
dpdk_main(n, v, bs);
exit(1);
return 0;
}
void *benetel_start_dpdk(char *ifname, shared_buffers *buffers, char *dpdk_main_command_line)
{
benetel_t *bs;
bs = calloc(1, sizeof(benetel_t));
if (bs == NULL) {
printf("%s: out of memory\n", __FUNCTION__);
exit(1);
}
bs->buffers = buffers;
bs->expected_benetel_frame = 255;
bs->dpdk_main_command_line = dpdk_main_command_line;
pthread_attr_t attr;
if (pthread_attr_init(&attr) != 0) {
printf("pthread_attr_init failed\n");
exit(1);
}
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(10,&cpuset);
if (pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset) != 0) {
printf("pthread_attr_setaffinity_np failed\n");
exit(1);
}
if (pthread_attr_setschedpolicy(&attr, SCHED_FIFO) != 0) {
printf("pthread_attr_setschedpolicy failed\n");
exit(1);
}
struct sched_param params;
params.sched_priority = sched_get_priority_max(SCHED_FIFO);
if (sched_get_priority_max(SCHED_FIFO) == -1) {
printf("sched_get_priority_max failed\n");
exit(1);
}
if (pthread_attr_setschedparam(&attr, &params) != 0) {
printf("pthread_setschedparam failed\n");
exit(1);
}
pthread_t t;
if (pthread_create(&t, &attr, dpdk_thread, bs) != 0) {
printf("%s: thread creation failed\n", __FUNCTION__);
exit(1);
}
if (pthread_attr_destroy(&attr) != 0) {
printf("pthread_attr_init failed\n");
exit(1);
}
return bs;
}
/*
* 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
*/
#include "shared_buffers.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void init_buffers(shared_buffers *s)
{
int slot;
memset(s, 0, sizeof(*s));
for (slot = 0; slot < 20; slot++) {
if (pthread_mutex_init(&s->m_dl[slot], NULL) != 0 ||
pthread_cond_init(&s->c_dl[slot], NULL) != 0 ||
pthread_mutex_init(&s->m_ul[slot], NULL) != 0 ||
pthread_cond_init(&s->c_ul[slot], NULL) != 0) {
printf("%s: error initializing mutex/cond\n", __FUNCTION__);
exit(1);
}
}
/* the gNB's first transmitted DL slot is 6 but the device
* needs to have slots 1, 2 and 3, 4 and 5 ready. Let's pretend
* they are ready.
*/
s->dl_busy[1] = 0x3fff;
s->dl_busy[2] = 0x3fff;
s->dl_busy[3] = 0x3fff;
s->dl_busy[4] = 0x3fff;
s->dl_busy[5] = 0x3fff;
}
void lock_dl_buffer(shared_buffers *s, int slot)
{
if (pthread_mutex_lock(&s->m_dl[slot]) != 0) {
printf("%s: fatal: lock fails\n", __FUNCTION__);
exit(1);
}
}
void unlock_dl_buffer(shared_buffers *s, int slot)
{
if (pthread_mutex_unlock(&s->m_dl[slot]) != 0) {
printf("%s: fatal: unlock fails\n", __FUNCTION__);
exit(1);
}
}
void wait_dl_buffer(shared_buffers *s, int slot)
{
if (pthread_cond_wait(&s->c_dl[slot], &s->m_dl[slot]) != 0) {
printf("%s: fatal: cond_wait fails\n", __FUNCTION__);
exit(1);
}
}
void signal_dl_buffer(shared_buffers *s, int slot)
{
if (pthread_cond_broadcast(&s->c_dl[slot]) != 0) {
printf("%s: fatal: cond_broadcast fails\n", __FUNCTION__);
exit(1);
}
}
void lock_ul_buffer(shared_buffers *s, int slot)
{
if (pthread_mutex_lock(&s->m_ul[slot]) != 0) {
printf("%s: fatal: lock fails\n", __FUNCTION__);
printf("%s: fatal: lock fails slot %d\n", __FUNCTION__, slot);
exit(1);
}
}
void unlock_ul_buffer(shared_buffers *s, int slot)
{
if (pthread_mutex_unlock(&s->m_ul[slot]) != 0) {
printf("%s: fatal: unlock fails\n", __FUNCTION__);
exit(1);
}
}
void wait_ul_buffer(shared_buffers *s, int slot)
{
if (pthread_cond_wait(&s->c_ul[slot], &s->m_ul[slot]) != 0) {
printf("%s: fatal: cond_wait fails\n", __FUNCTION__);
exit(1);
}
}
void signal_ul_buffer(shared_buffers *s, int slot)
{
if (pthread_cond_broadcast(&s->c_ul[slot]) != 0) {
printf("%s: fatal: cond_broadcast fails\n", __FUNCTION__);
exit(1);
}
}
This diff is collapsed.
......@@ -459,7 +459,7 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi
static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initial) {
// Process all incoming events on sockets
// store the data in lists
struct epoll_event events[FD_SETSIZE]= {0};
struct epoll_event events[FD_SETSIZE]= {{0}};
int nfds = epoll_wait(t->epollfd, events, FD_SETSIZE, timeout);
if ( nfds==-1 ) {
......
This diff is collapsed.
This diff is collapsed.
......@@ -235,7 +235,7 @@ RUs = (
att_rx = 0;
bands = [7];
max_pdschReferenceSignalPower = -27;
max_rxgain = 114;
max_rxgain = 75;
eNB_instances = [0];
sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2";
if_freq = 5300000000;
......
This diff is collapsed.
This diff is collapsed.
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