Commit 21e1580b authored by laurent's avatar laurent

critical compilation warnings

parent 38f68522
...@@ -919,7 +919,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) { ...@@ -919,7 +919,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) {
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) { for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
for (j=0; j<2; j++) { for (j=0; j<2; j++) {
for (k=0; k<2; k++) { for (k=0; k<RX_NB_TH_MAX; k++) {
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n"); AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]); LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]);
......
...@@ -421,6 +421,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, ...@@ -421,6 +421,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
#ifdef NR_PDCCH_DCI_DEBUG #ifdef NR_PDCCH_DCI_DEBUG
printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> c_rb=%d\n",c_rb); printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> c_rb=%d\n",c_rb);
#endif #endif
rxF=NULL;
// first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start) // first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start)
if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
//if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case
......
...@@ -516,7 +516,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -516,7 +516,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
p_nrLDPC_procBuf[r], p_nrLDPC_procBuf[r],
p_procTime); p_procTime);
if (check_crc(llrProcBuf,harq_process->B,harq_process->F,crc_type)) { // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if (check_crc((uint8_t*)llrProcBuf,harq_process->B,harq_process->F,crc_type)) {
printf("CRC OK\n"); printf("CRC OK\n");
ret = 2; ret = 2;
} }
......
...@@ -1350,7 +1350,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, ...@@ -1350,7 +1350,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
unsigned char aatx,aarx,pilots=0; unsigned char aatx,aarx,pilots=0;
__m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
QAM_amp128b = _mm_setzero_si128();
if (symbol == 2){ if (symbol == 2){
pilots=1; pilots=1;
......
...@@ -577,7 +577,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe, ...@@ -577,7 +577,7 @@ int32_t generate_nr_prach( PHY_VARS_NR_UE *ue, uint8_t eNB_id, uint8_t subframe,
uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex; uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex;
//uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index; //uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index;
int16_t *prachF = ue->prach_vars[eNB_id]->prachF; int16_t *prachF = ue->prach_vars[eNB_id]->prachF;
static int16_t prach_tmp[45600*2] __attribute__((aligned(32))); static int16_t prach_tmp[45600*4] __attribute__((aligned(32)));
int16_t *prach = prach_tmp; int16_t *prach = prach_tmp;
int16_t *prach2; int16_t *prach2;
int16_t amp = ue->prach_vars[eNB_id]->amp; int16_t amp = ue->prach_vars[eNB_id]->amp;
......
...@@ -1595,22 +1595,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8 ...@@ -1595,22 +1595,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8
int harq_pid; int harq_pid;
int frame_tx=proc->frame_tx; int frame_tx=proc->frame_tx;
int nr_tti_tx=proc->nr_tti_tx; int nr_tti_tx=proc->nr_tti_tx;
int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id;
uint8_t Msg3_flag=0;
uint16_t first_rb, nb_rb;
unsigned int input_buffer_length; unsigned int input_buffer_length;
int i; int i;
int aa; int aa;
int tx_amp; int tx_amp;
uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32)));
uint8_t access_mode;
uint8_t Nbundled=0;
uint8_t NbundledCw1=0;
uint8_t ack_status_cw0=0;
uint8_t ack_status_cw1=0;
uint8_t cqi_status = 0;
uint8_t ri_status = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN);
/* reset harq for tx of current rx slot because it is sure that transmission has already been achieved for this slot */ /* reset harq for tx of current rx slot because it is sure that transmission has already been achieved for this slot */
...@@ -1621,6 +1609,18 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8 ...@@ -1621,6 +1609,18 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8
#if 0 #if 0
int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id;
uint8_t Msg3_flag=0;
uint16_t first_rb, nb_rb;
uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32)));
uint8_t access_mode;
uint8_t Nbundled=0;
uint8_t NbundledCw1=0;
uint8_t ack_status_cw0=0;
uint8_t ack_status_cw1=0;
uint8_t cqi_status = 0;
uint8_t ri_status = 0;
if (ue->mac_enabled == 1) { if (ue->mac_enabled == 1) {
if ((ue->ulsch_Msg3_active[eNB_id] == 1) && if ((ue->ulsch_Msg3_active[eNB_id] == 1) &&
(ue->ulsch_Msg3_frame[eNB_id] == frame_tx) && (ue->ulsch_Msg3_frame[eNB_id] == frame_tx) &&
...@@ -3079,7 +3079,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -3079,7 +3079,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
int nb_searchspace_total = pdcch_vars2->nb_search_space; int nb_searchspace_total = pdcch_vars2->nb_search_space;
uint16_t c_rnti=pdcch_vars[eNB_id]->crnti; uint16_t c_rnti=pdcch_vars[eNB_id]->crnti;
uint16_t cs_rnti,new_rnti,tc_rnti; uint16_t cs_rnti=0,new_rnti=0,tc_rnti;
uint16_t p_rnti=P_RNTI; uint16_t p_rnti=P_RNTI;
uint16_t si_rnti=SI_RNTI; uint16_t si_rnti=SI_RNTI;
uint16_t ra_rnti=99; uint16_t ra_rnti=99;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "PHY/NR_REFSIG/ss_pbch_nr.h" #include "PHY/NR_REFSIG/ss_pbch_nr.h"
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include <openair1/SCHED/sched_common.h>
#ifndef NO_RAT_NR #ifndef NO_RAT_NR
...@@ -278,7 +279,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -278,7 +279,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
/* Part - III */ /* Part - III */
/* Choice PUCCH format and its related parameters */ /* Choice PUCCH format and its related parameters */
pucch_format_nr_t format = pucch_format0_nr; pucch_format_nr_t format = pucch_format0_nr;
uint8_t starting_symbol_index; uint8_t starting_symbol_index=0;
uint8_t nb_symbols_total = 0; uint8_t nb_symbols_total = 0;
uint8_t nb_symbols = 0; uint8_t nb_symbols = 0;
uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */ uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */
...@@ -729,7 +730,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t ...@@ -729,7 +730,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
} }
} }
if (do_reset == TRUE) { if (do_reset == TRUE) {
init_downlink_harq_status(&ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid]); init_downlink_harq_status(ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][gNB_id][code_word]->harq_processes[dl_harq_pid]);
} }
} }
} }
......
...@@ -322,10 +322,10 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) ...@@ -322,10 +322,10 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
// if contention resolution fails, go back to PRACH // if contention resolution fails, go back to PRACH
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH; PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH;
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti_is_temporary = 0; for (int i=0; i <RX_NB_TH_MAX; i++ ) {
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti = 0; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[i][eNB_index]->crnti_is_temporary = 0;
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_index]->crnti_is_temporary = 0; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[i][eNB_index]->crnti = 0;
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_index]->crnti = 0; }
LOG_E(PHY,"[UE %d] Random-access procedure fails, going back to PRACH, setting SIStatus = 0, discard temporary C-RNTI and State RRC_IDLE\n",Mod_id); LOG_E(PHY,"[UE %d] Random-access procedure fails, going back to PRACH, setting SIStatus = 0, discard temporary C-RNTI and State RRC_IDLE\n",Mod_id);
} }
...@@ -336,16 +336,18 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) ...@@ -336,16 +336,18 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
LOG_I(PHY,"[UE %d][RAPROC] Random-access procedure succeeded. Set C-RNTI = Temporary C-RNTI\n",Mod_id); LOG_I(PHY,"[UE %d][RAPROC] Random-access procedure succeeded. Set C-RNTI = Temporary C-RNTI\n",Mod_id);
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti_is_temporary = 0; for (int i=0; i <RX_NB_TH_MAX; i++ ) {
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_index]->crnti_is_temporary = 0; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[i][eNB_index]->crnti_is_temporary = 0;
}
PHY_vars_UE_g[Mod_id][CC_id]->ulsch_Msg3_active[eNB_index] = 0; PHY_vars_UE_g[Mod_id][CC_id]->ulsch_Msg3_active[eNB_index] = 0;
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH; PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH;
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
if (PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]) { if (PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]) {
PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->status=SCH_IDLE; PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->status=SCH_IDLE;
PHY_vars_UE_g[Mod_id][CC_id]->dlsch[0][eNB_index][0]->harq_processes[i]->round=0; for (int i=0; i <RX_NB_TH_MAX; i++ ) {
PHY_vars_UE_g[Mod_id][CC_id]->dlsch[1][eNB_index][0]->harq_processes[i]->round=0; PHY_vars_UE_g[Mod_id][CC_id]->dlsch[i][eNB_index][0]->harq_processes[i]->round=0;
}
PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->subframe_scheduling_flag=0; PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->subframe_scheduling_flag=0;
} }
} }
......
...@@ -65,7 +65,7 @@ typedef struct { ...@@ -65,7 +65,7 @@ typedef struct {
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG; } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG;
typedef struct { typedef struct {
uint8_t LCID:5; // octet 1 [5:0] uint8_t LCID:6; // octet 1 [5:0]
uint8_t R:2; // octet 1 [7:6] uint8_t R:2; // octet 1 [7:6]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
......
...@@ -74,7 +74,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n ...@@ -74,7 +74,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n
return nr_ue_process_dlsch( module_id, return nr_ue_process_dlsch( module_id,
cc_id, cc_id,
gNB_index, gNB_index,
&dci_ind, dci_ind,
pduP, pduP,
pdu_len); pdu_len);
...@@ -308,4 +308,5 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) { ...@@ -308,4 +308,5 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) {
dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.N_RB_BWP = 106; dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15.N_RB_BWP = 106;
return 0;
} }
...@@ -39,7 +39,7 @@ typedef struct { ...@@ -39,7 +39,7 @@ typedef struct {
typedef struct buffer_s { typedef struct buffer_s {
int conn_sock; int conn_sock;
bool alreadyWrote; bool alreadyRead;
uint64_t lastReceivedTS; uint64_t lastReceivedTS;
bool headerMode; bool headerMode;
transferHeader th; transferHeader th;
...@@ -49,7 +49,6 @@ typedef struct buffer_s { ...@@ -49,7 +49,6 @@ typedef struct buffer_s {
sample_t *circularBuf; sample_t *circularBuf;
} buffer_t; } buffer_t;
typedef struct { typedef struct {
int listen_sock, epollfd; int listen_sock, epollfd;
uint64_t nextTimestamp; uint64_t nextTimestamp;
...@@ -90,17 +89,41 @@ For this, export RFSIMULATOR=enb (eNB case) or \n\ ...@@ -90,17 +89,41 @@ For this, export RFSIMULATOR=enb (eNB case) or \n\
RFSIMULATOR=<an ip address> (UE case)\n\ RFSIMULATOR=<an ip address> (UE case)\n\
\x1b[m" \x1b[m"
int fullwrite(int fd, void *_buf, int count) { enum blocking_t {
notBlocking,
blocking
};
void setblocking(int sock, enum blocking_t active) {
int opts;
AssertFatal( (opts = fcntl(sock, F_GETFL)) >= 0,"");
if (active==blocking)
opts = opts & ~O_NONBLOCK;
else
opts = opts | O_NONBLOCK;
AssertFatal(fcntl(sock, F_SETFL, opts) >= 0, "");
}
static bool flushInput(rfsimulator_state_t *t);
int fullwrite(int fd, void *_buf, int count, rfsimulator_state_t *t) {
char *buf = _buf; char *buf = _buf;
int ret = 0; int ret = 0;
int l; int l;
setblocking(fd, notBlocking);
while (count) { while (count) {
l = write(fd, buf, count); l = write(fd, buf, count);
if (l <= 0) { if (l <= 0) {
if(errno==EAGAIN || errno==EINTR) if (errno==EINTR)
continue; continue;
if(errno==EAGAIN) {
flushInput(t);
continue;
}
else else
return -1; return -1;
} }
...@@ -113,23 +136,6 @@ int fullwrite(int fd, void *_buf, int count) { ...@@ -113,23 +136,6 @@ int fullwrite(int fd, void *_buf, int count) {
return ret; return ret;
} }
enum blocking_t {
blocking,
notBlocking
};
void setblocking(int sock, enum blocking_t active) {
int opts;
AssertFatal( (opts = fcntl(sock, F_GETFL)) >= 0,"");
if (active==blocking)
opts = opts & ~O_NONBLOCK;
else
opts = opts | O_NONBLOCK;
AssertFatal(fcntl(sock, F_SETFL, opts) >= 0, "");
}
int server_start(openair0_device *device) { int server_start(openair0_device *device) {
rfsimulator_state_t *t = (rfsimulator_state_t *) device->priv; rfsimulator_state_t *t = (rfsimulator_state_t *) device->priv;
t->typeStamp=MAGICeNB; t->typeStamp=MAGICeNB;
...@@ -177,7 +183,7 @@ int start_ue(openair0_device *device) { ...@@ -177,7 +183,7 @@ int start_ue(openair0_device *device) {
setblocking(sock, notBlocking); setblocking(sock, notBlocking);
allocCirBuf(t, sock); allocCirBuf(t, sock);
t->buf[sock].alreadyWrote=true; //+=t->initialAhead; // UE is slave t->buf[sock].alreadyRead=true; // UE will start blocking on read
return 0; return 0;
} }
...@@ -188,10 +194,9 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -188,10 +194,9 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi
buffer_t *ptr=&t->buf[i]; buffer_t *ptr=&t->buf[i];
if (ptr->conn_sock >= 0 ) { if (ptr->conn_sock >= 0 ) {
setblocking(ptr->conn_sock, blocking);
transferHeader header= {t->typeStamp, nsamps, nbAnt, timestamp}; transferHeader header= {t->typeStamp, nsamps, nbAnt, timestamp};
int n=-1; int n=-1;
AssertFatal( fullwrite(ptr->conn_sock,&header, sizeof(header)) == sizeof(header), ""); AssertFatal( fullwrite(ptr->conn_sock,&header, sizeof(header), t) == sizeof(header), "");
sample_t tmpSamples[nsamps][nbAnt]; sample_t tmpSamples[nsamps][nbAnt];
for(int a=0; a<nbAnt; a++) { for(int a=0; a<nbAnt; a++) {
...@@ -201,15 +206,13 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -201,15 +206,13 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi
tmpSamples[s][a]=in[s]; tmpSamples[s][a]=in[s];
} }
n = fullwrite(ptr->conn_sock, (void *)tmpSamples, sampleToByte(nsamps,nbAnt)); n = fullwrite(ptr->conn_sock, (void *)tmpSamples, sampleToByte(nsamps,nbAnt), t);
if (n != sampleToByte(nsamps,nbAnt) ) { if (n != sampleToByte(nsamps,nbAnt) ) {
LOG_E(HW,"rfsimulator: write error ret %d (wanted %ld) error %s\n", n, sampleToByte(nsamps,nbAnt), strerror(errno)); LOG_E(HW,"rfsimulator: write error ret %d (wanted %ld) error %s\n", n, sampleToByte(nsamps,nbAnt), strerror(errno));
abort(); abort();
} }
ptr->alreadyWrote=true; //+=nsamps;
setblocking(ptr->conn_sock, notBlocking);
} }
} }
...@@ -218,7 +221,7 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -218,7 +221,7 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi
return nsamps; return nsamps;
} }
bool flushInput(rfsimulator_state_t *t) { static bool flushInput(rfsimulator_state_t *t) {
// Process all incoming events on sockets // Process all incoming events on sockets
// store the data in lists // store the data in lists
struct epoll_event events[FD_SETSIZE]= {0}; struct epoll_event events[FD_SETSIZE]= {0};
...@@ -237,6 +240,8 @@ bool flushInput(rfsimulator_state_t *t) { ...@@ -237,6 +240,8 @@ bool flushInput(rfsimulator_state_t *t) {
if (events[nbEv].events & EPOLLIN && fd == t->listen_sock) { if (events[nbEv].events & EPOLLIN && fd == t->listen_sock) {
int conn_sock; int conn_sock;
AssertFatal( (conn_sock = accept(t->listen_sock,NULL,NULL)) != -1, ""); AssertFatal( (conn_sock = accept(t->listen_sock,NULL,NULL)) != -1, "");
setblocking(conn_sock, notBlocking);
allocCirBuf(t, conn_sock); allocCirBuf(t, conn_sock);
LOG_I(HW,"A ue connected\n"); LOG_I(HW,"A ue connected\n");
} else { } else {
...@@ -287,7 +292,7 @@ bool flushInput(rfsimulator_state_t *t) { ...@@ -287,7 +292,7 @@ bool flushInput(rfsimulator_state_t *t) {
AssertFatal( (t->typeStamp == MAGICUE && b->th.magic==MAGICeNB) || AssertFatal( (t->typeStamp == MAGICUE && b->th.magic==MAGICeNB) ||
(t->typeStamp == MAGICeNB && b->th.magic==MAGICUE), "Socket Error in protocol"); (t->typeStamp == MAGICeNB && b->th.magic==MAGICUE), "Socket Error in protocol");
b->headerMode=false; b->headerMode=false;
b->alreadyRead=true;
if ( b->lastReceivedTS != b->th.timestamp) { if ( b->lastReceivedTS != b->th.timestamp) {
int nbAnt= b->th.nbAnt; int nbAnt= b->th.nbAnt;
...@@ -347,13 +352,6 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ...@@ -347,13 +352,6 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
t->nextTimestamp+=nsamps; t->nextTimestamp+=nsamps;
LOG_W(HW,"Generated void samples for Rx: %ld\n", t->nextTimestamp); LOG_W(HW,"Generated void samples for Rx: %ld\n", t->nextTimestamp);
for (int a=0; a<nbAnt; a++) {
sample_t *out=(sample_t *)samplesVoid[a];
for ( int i=0; i < nsamps; i++ )
out[i]=0;
}
*ptimestamp = t->nextTimestamp-nsamps; *ptimestamp = t->nextTimestamp-nsamps;
return nsamps; return nsamps;
} }
...@@ -365,7 +363,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ...@@ -365,7 +363,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
for ( int sock=0; sock<FD_SETSIZE; sock++) for ( int sock=0; sock<FD_SETSIZE; sock++)
if ( t->buf[sock].circularBuf && if ( t->buf[sock].circularBuf &&
t->buf[sock].alreadyWrote && //>= t->initialAhead && t->buf[sock].alreadyRead && //>= t->initialAhead &&
(t->nextTimestamp+nsamps) > t->buf[sock].lastReceivedTS ) { (t->nextTimestamp+nsamps) > t->buf[sock].lastReceivedTS ) {
have_to_wait=true; have_to_wait=true;
break; break;
...@@ -381,18 +379,14 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ...@@ -381,18 +379,14 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
} }
// Clear the output buffer // Clear the output buffer
for (int a=0; a<nbAnt; a++) { for (int a=0; a<nbAnt; a++)
sample_t *out=(sample_t *)samplesVoid[a]; memset(samplesVoid[a],0,sampleToByte(nsamps,1));
for ( int i=0; i < nsamps; i++ )
out[i]=0;
}
// Add all input signal in the output buffer // Add all input signal in the output buffer
for (int sock=0; sock<FD_SETSIZE; sock++) { for (int sock=0; sock<FD_SETSIZE; sock++) {
buffer_t *ptr=&t->buf[sock]; buffer_t *ptr=&t->buf[sock];
if ( ptr->circularBuf && ptr->alreadyWrote ) { if ( ptr->circularBuf && ptr->alreadyRead ) {
for (int a=0; a<nbAnt; a++) { for (int a=0; a<nbAnt; a++) {
sample_t *out=(sample_t *)samplesVoid[a]; sample_t *out=(sample_t *)samplesVoid[a];
...@@ -440,8 +434,7 @@ int rfsimulator_set_gains(openair0_device *device, openair0_config_t *openair0_c ...@@ -440,8 +434,7 @@ int rfsimulator_set_gains(openair0_device *device, openair0_config_t *openair0_c
__attribute__((__visibility__("default"))) __attribute__((__visibility__("default")))
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
set_log(HW,OAILOG_DEBUG); //set_log(HW,OAILOG_DEBUG);
set_log(PHY,OAILOG_DEBUG);
rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1); rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1);
if ((rfsimulator->ip=getenv("RFSIMULATOR")) == NULL ) { if ((rfsimulator->ip=getenv("RFSIMULATOR")) == NULL ) {
......
...@@ -785,9 +785,8 @@ void *UE_thread(void *arg) { ...@@ -785,9 +785,8 @@ void *UE_thread(void *arg) {
int i; int i;
char threadname[128]; char threadname[128];
int th_id; int th_id;
UE->proc.proc_rxtx[0].counter_decoder = 0; for (int i=0; i< RX_NB_TH_MAX; i++ )
UE->proc.proc_rxtx[1].counter_decoder = 0; UE->proc.proc_rxtx[i].counter_decoder = 0;
UE->proc.proc_rxtx[2].counter_decoder = 0;
static uint8_t thread_idx = 0; static uint8_t thread_idx = 0;
...@@ -827,7 +826,7 @@ void *UE_thread(void *arg) { ...@@ -827,7 +826,7 @@ void *UE_thread(void *arg) {
usleep(500*1000); usleep(500*1000);
} }
#endif #endif
LOG_W(PHY,"is_synchro %d\n" , is_synchronized );
if (instance_cnt_synch < 0) { // we can invoke the synch if (instance_cnt_synch < 0) { // we can invoke the synch
// grab 10 ms of signal and wakeup synch thread // grab 10 ms of signal and wakeup synch thread
if (UE->mode != loop_through_memory) { if (UE->mode != loop_through_memory) {
...@@ -843,14 +842,6 @@ void *UE_thread(void *arg) { ...@@ -843,14 +842,6 @@ void *UE_thread(void *arg) {
rxp, rxp,
UE->frame_parms.samples_per_subframe, UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_rx), ""); UE->frame_parms.nb_antennas_rx), "");
AssertFatal( UE->frame_parms.samples_per_subframe ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+(2*UE->frame_parms.samples_per_subframe) -
openair0_cfg[0].tx_sample_advance,
dummy_tx,
UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_tx,
1),"");
} }
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]); free(dummy_tx[i]);
...@@ -875,15 +866,7 @@ void *UE_thread(void *arg) { ...@@ -875,15 +866,7 @@ void *UE_thread(void *arg) {
dummy_rx, dummy_rx,
UE->frame_parms.samples_per_subframe, UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_rx); UE->frame_parms.nb_antennas_rx);
AssertFatal( UE->frame_parms.samples_per_subframe == usleep(500); // this sleep improves in the case of simulated RF and doesn't harm with true radio
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+(2*UE->frame_parms.samples_per_subframe) -
openair0_cfg[0].tx_sample_advance,
dummy_tx,
UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_tx,
1),"");
usleep(9000); // this sleep improves in the case of simulated RF and doesn't harm with true radio
} }
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
...@@ -911,14 +894,6 @@ void *UE_thread(void *arg) { ...@@ -911,14 +894,6 @@ void *UE_thread(void *arg) {
(void**)UE->common_vars.rxdata, (void**)UE->common_vars.rxdata,
unitTransfer, unitTransfer,
UE->frame_parms.nb_antennas_rx),""); UE->frame_parms.nb_antennas_rx),"");
AssertFatal( unitTransfer ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+(2*UE->frame_parms.samples_per_subframe) -
openair0_cfg[0].tx_sample_advance,
dummy_tx,
unitTransfer,
UE->frame_parms.nb_antennas_tx,
1),"");
} }
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]); free(dummy_tx[i]);
...@@ -995,9 +970,13 @@ void *UE_thread(void *arg) { ...@@ -995,9 +970,13 @@ void *UE_thread(void *arg) {
UE->rx_offset < 10*UE->frame_parms.samples_per_subframe ) UE->rx_offset < 10*UE->frame_parms.samples_per_subframe )
UE->rx_offset_diff = 1; UE->rx_offset_diff = 1;
LOG_E(PHY,"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,subframe_nr,UE->rx_offset_diff,UE->rx_offset);
if ( getenv("RFSIMULATOR") != 0)
UE->rx_offset_diff=0; if ( getenv("RFSIMULATOR") != 0) {
LOG_E(PHY,"AbsSubframe %d.%d TTI SET rx_off_diff to %d rx_offset %d \n",
proc->frame_rx,subframe_nr,UE->rx_offset_diff,UE->rx_offset);
//UE->rx_offset_diff=0;
}
readBlockSize=UE->frame_parms.samples_per_subframe - readBlockSize=UE->frame_parms.samples_per_subframe -
UE->frame_parms.ofdm_symbol_size - UE->frame_parms.ofdm_symbol_size -
UE->frame_parms.nb_prefix_samples0 - UE->frame_parms.nb_prefix_samples0 -
......
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