Commit b7908ec2 authored by laurent's avatar laurent

bug fixies

parent edb74831
......@@ -183,8 +183,8 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
#########################
# set a flag for changes in the source code
# these changes are related to hardcoded path to include .h files
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2")
set(GIT_BRANCH "UNKNOWN")
......
......@@ -105,7 +105,7 @@ int lte_segmentation(unsigned char *input_buffer,
#endif
*Kminus = (*Kplus - 64);
} else {
printf("lte_segmentation.c: Illegal codeword size !!!\n");
LOG_E(PHY,"lte_segmentation.c: Illegal codeword size !!!\n");
return(-1);
}
......
......@@ -49,7 +49,9 @@ int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_
else if ((eNB->uci_vars[i].active == 0) && (first_free_index==-1)) first_free_index=i;
}
if (type == SEARCH_EXIST) return(-1);
else return(first_free_index);
if (first_free_index==-1)
LOG_E(MAC,"UCI table is full\n");
return(first_free_index);
}
......
......@@ -584,8 +584,7 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
printf("Rate Matching Segment %u (coded bits (G) %d,unpunctured/repeated bits %u, Q_m %d, nb_rb %d, Nl %d)...\n",
r, G,
Kr*3,
Q_m,
nb_rb,
ulsch_harq->Qm,
ulsch_harq->Nl);
#endif
start_meas(&eNB->ulsch_rate_unmatching_stats);
......
......@@ -590,10 +590,10 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) {
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",ue->Mod_id,ue->measurements.rx_power_avg_dB[0] );
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM )
if (IS_SOFTMODEM_BASICSIM )
phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0);
} else {
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM )
if (IS_SOFTMODEM_BASICSIM )
phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0);
}
......
......@@ -80,7 +80,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
int i, prach_len;
uint16_t first_nonzero_root_idx=0;
if ( !(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) {
if ( !(IS_SOFTMODEM_BASICSIM ) ) {
prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset);
#ifdef PRACH_DEBUG
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
......@@ -473,7 +473,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
AssertFatal(prach_fmt<4,
"prach_fmt4 not fully implemented" );
if (!(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) {
if (!(IS_SOFTMODEM_BASICSIM ) ) {
int j;
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti;
LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
......
......@@ -166,13 +166,16 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb
int gain_dB;
double gain_lin;
if (power_dBm<=power_max_dBm)
if ( (power_dBm<=power_max_dBm) && ! IS_SOFTMODEM_RFSIM)
gain_dB = power_dBm - power_max_dBm;
else
gain_dB = 0;
gain_lin = pow(10,.1*gain_dB);
AssertFatal((nb_rb >0) && (nb_rb <= N_RB_UL),"Illegal nb_rb/N_RB_UL combination (%d/%d)\n",nb_rb,N_RB_UL);
LOG_D(PHY," tx gain: %d = %d * sqrt ( pow(10, 0.1*max(0,%d-%d)) * %d/%d ) (gain lin=%f (dB=%d))\n",
(int)(AMP*sqrt(gain_lin*N_RB_UL/(double)nb_rb)),
AMP, power_dBm, power_max_dBm, N_RB_UL, nb_rb, gain_lin, gain_dB);
return((int)(AMP*sqrt(gain_lin*N_RB_UL/(double)nb_rb)));
}
......@@ -1099,7 +1102,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
if (!(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) {
if (!IS_SOFTMODEM_BASICSIM) {
ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-
ue->hw_timing_advance-
ue->timing_advance-
......@@ -1130,7 +1133,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
}
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
int *Buff = (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ? &ue->common_vars.txdata[aa][ulsch_start] :dummy_tx_buffer;
int *Buff = IS_SOFTMODEM_BASICSIM ? &ue->common_vars.txdata[aa][ulsch_start] :dummy_tx_buffer;
if (frame_parms->Ncp == 1) {
PHY_ofdm_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
......@@ -1151,7 +1154,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
&ue->frame_parms);
}
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) {
if (IS_SOFTMODEM_BASICSIM ) {
apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],0);
apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],1);
} else {
......@@ -1159,7 +1162,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
apply_7_5_kHz(ue,dummy_tx_buffer,1);
}
if (!(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) {
if (!(IS_SOFTMODEM_BASICSIM ) ) {
overflow = ulsch_start - 9*frame_parms->samples_per_tti;
for (k=ulsch_start,l=0; k<cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++,l++) {
......@@ -1259,7 +1262,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->prach_resources[eNB_id]->ra_RNTI);
ue->tx_total_RE[subframe_tx] = 96;
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) {
if (IS_SOFTMODEM_BASICSIM ) {
ue->prach_vars[eNB_id]->amp = get_tx_amp(ue->tx_power_dBm[subframe_tx],
ue->tx_power_max_dBm,
ue->frame_parms.N_RB_UL,
......@@ -1630,7 +1633,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
ue->tx_total_RE[subframe_tx] = nb_rb*12;
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) {
if (IS_SOFTMODEM_BASICSIM ) {
tx_amp = AMP;
} else {
tx_amp = get_tx_amp(ue->tx_power_dBm[subframe_tx],
......@@ -1704,7 +1707,7 @@ void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8
Po_SRS = ue->tx_power_max_dBm;
}
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) {
if (IS_SOFTMODEM_BASICSIM) {
tx_amp = AMP;
} else {
if (ue->mac_enabled==1) {
......@@ -1942,7 +1945,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
ue->tx_total_RE[subframe_tx] = 12;
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) {
if (IS_SOFTMODEM_BASICSIM ) {
tx_amp = AMP;
} else {
tx_amp = get_tx_amp(Po_PUCCH,
......@@ -2023,7 +2026,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->tx_power_dBm[subframe_tx] = Po_PUCCH;
ue->tx_total_RE[subframe_tx] = 12;
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) {
if (IS_SOFTMODEM_BASICSIM ) {
tx_amp = AMP;
} else {
tx_amp = get_tx_amp(Po_PUCCH,
......@@ -2269,7 +2272,7 @@ void ue_measurement_procedures(
// AGC
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_IN);
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM )
if (IS_SOFTMODEM_BASICSIM )
phy_adjust_gain (ue,dB_fixed(ue->measurements.rssi),0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT);
......
......@@ -1506,7 +1506,7 @@ schedule_ue_spec(module_id_t module_idP,
tpc = 1; //0
}
LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d\n",
LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d (normal case)\n",
module_idP,
frameP,
subframeP,
......
......@@ -2836,7 +2836,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
}
if (tpc!=1) {
LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
LOG_D(MAC,"[eNB %d] ULSCH schedulerRR: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n",
module_idP,frameP,subframeP,harq_pid,tpc,
tpc_accumulated,snr,target_snr);
}
......
......@@ -388,10 +388,10 @@ static void dump_ul(UL_IND_t *u) {
A("XXXX crc_ind %d\n", u->crc_ind.crc_indication_body.number_of_crcs);
A("XXXX sr_ind %d\n", u->sr_ind.sr_indication_body.number_of_srs);
A("XXXX cqi_ind %d\n", u->cqi_ind.number_of_cqis);
A("XXXX cqi_ind %d\n", u->cqi_ind.cqi_indication_body.number_of_cqis);
for (i = 0; i < u->cqi_ind.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *v = &u->cqi_ind.cqi_pdu_list[i];
for (i = 0; i < u->cqi_ind.cqi_indication_body.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *v = &u->cqi_ind.cqi_indication_body.cqi_pdu_list[i];
A("XXXX cqi ind %d\n", i);
A("XXXX cqi ul_cqi %d channel %d\n", v->ul_cqi_information.ul_cqi,
v->ul_cqi_information.channel);
......
......@@ -396,11 +396,15 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
MAC_Context_Info_t pdu_context;
int radioType=FDD_RADIO;
if (RC.eNB[0][0]!=NULL)
if (RC.eNB && RC.eNB[0][0]!=NULL)
radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
if (PHY_vars_UE_g[0][0] != NULL)
else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL)
radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
else {
LOG_E(OPT,"not a eNB neither a UE!!! \n");
return;
}
switch (opt_type) {
case OPT_WIRESHARK :
......
......@@ -430,7 +430,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout) {
b->circularBuf[(index*nbAnt+a)%CirSize].i=0;
}
}
if ( abs(b->th.timestamp-b->lastReceivedTS) > 50 )
LOG_W(HW,"gap of: %ld in reception\n", b->th.timestamp-b->lastReceivedTS );
}
......
......@@ -7,6 +7,21 @@
volatile int oai_exit = 0;
int fullread(int fd, void *_buf, int count)
{
char *buf = _buf;
int ret = 0;
int l;
while (count) {
l = read(fd, buf, count);
if (l <= 0) return -1;
count -= l;
buf += l;
ret += l;
}
return ret;
}
void fullwrite(int fd, void *_buf, int count) {
char *buf = _buf;
int l;
......@@ -63,10 +78,10 @@ sin_addr:
bool connected=false;
while(!connected) {
LOG_I(HW,"rfsimulator: trying to connect to %s:%d\n", IP, port);
//LOG_I(HW,"rfsimulator: trying to connect to %s:%d\n", IP, port);
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
LOG_I(HW,"rfsimulator: connection established\n");
//LOG_I(HW,"rfsimulator: connection established\n");
connected=true;
}
......@@ -108,12 +123,13 @@ int main(int argc, char *argv[]) {
if (strcmp(argv[2],"server")==0) {
serviceSock=server_start(atoi(argv[3]));
} else {
client_start(argv[2],atoi(argv[3]));
serviceSock=client_start(argv[2],atoi(argv[3]));
}
samplesBlockHeader_t header;
int bufSize=100000;
void *buff=malloc(bufSize);
uint64_t readTS=0;
while (1) {
//Rewind the file to loop on the samples
......@@ -125,6 +141,7 @@ int main(int argc, char *argv[]) {
AssertFatal(read(fd,&header,sizeof(header)), "");
fullwrite(serviceSock, &header, sizeof(header));
int dataSize=sizeof(int32_t)*header.size*header.nbAnt;
uint64_t wroteTS=header.timestamp;
if (dataSize>bufSize) {
void * new_buff = realloc(buff, dataSize);
......@@ -139,9 +156,16 @@ int main(int argc, char *argv[]) {
AssertFatal(read(fd,buff,dataSize) == dataSize, "");
fullwrite(serviceSock, buff, dataSize);
// Purge incoming samples
setblocking(serviceSock, notBlocking);
while(recv(serviceSock,buff, bufSize, MSG_DONTWAIT) > 0) {
setblocking(serviceSock, blocking);
while(readTS < wroteTS) {
if ( fullread(serviceSock, &header,sizeof(header)) != sizeof(header) ||
fullread(serviceSock, buff, sizeof(int32_t)*header.size*header.nbAnt) !=
sizeof(int32_t)*header.size*header.nbAnt
) {
printf("error: %s\n", strerror(errno));
exit(1);
}
readTS=header.timestamp;
}
}
......
......@@ -1202,7 +1202,8 @@ void wakeup_L1s(RU_t *ru) {
ru->proc.emulate_rf_busy = 0;
}
inline int wakeup_prach_ru(RU_t *ru) {
void wakeup_prach_ru(RU_t *ru) {
int ret;
struct timespec wait;
int time_ns = 5000000L;
......@@ -1234,11 +1235,10 @@ inline int wakeup_prach_ru(RU_t *ru) {
} else LOG_W(PHY,"RU prach thread busy, skipping\n");
AssertFatal((ret=pthread_mutex_unlock( &ru->proc.mutex_prach ))==0,"mutex_unlock returns %d\n",ret);
return(0);
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
inline int wakeup_prach_ru_br(RU_t *ru) {
void wakeup_prach_ru_br(RU_t *ru) {
int ret;
struct timespec wait;
int time_ns = 5000000L;
......@@ -1264,7 +1264,6 @@ inline int wakeup_prach_ru_br(RU_t *ru) {
} else LOG_W(PHY,"RU prach thread busy, skipping\n");
AssertFatal((ret=pthread_mutex_unlock( &ru->proc.mutex_prach_br ))==0,"mutex_unlock returns %d\n",ret);
return(0);
}
#endif
......
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