Commit 79c8d0e0 authored by Raymond Knopp's avatar Raymond Knopp

updates for IF4p5 to handle >1 nb_rx/nb_tx. Tested with 2x2

parent 49bb8b4c
......@@ -91,8 +91,8 @@ int phy_init_RU(RU_t *ru) {
}
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
"nb_antennas_rx too large");
//AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
//"nb_antennas_rx too large");
ru->prach_rxsigF = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
for (j=0;j<4;j++) ru->prach_rxsigF_br[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
......
......@@ -90,14 +90,18 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
AssertFatal(txdataF[0]!=NULL,"txdataF_BF[0] is null\n");
for (symbol_id=0; symbol_id<nsym; symbol_id++) {
for (int antenna_id=0; antenna_id<ru->nb_tx; antenna_id++) {
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &txdataF[0][blockoffsetF+element_id];
i = (uint16_t*) &txdataF[antenna_id][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw_if4p5[*i]) | (lin2alaw_if4p5[*(i+1)]<<8);
i = (uint16_t*) &txdataF[0][slotoffsetF+element_id];
i = (uint16_t*) &txdataF[antenna_id][slotoffsetF+element_id];
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw_if4p5[*i]) | (lin2alaw_if4p5[*(i+1)]<<8);
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 0 );
packet_header->frame_status &= ~(0x7);
packet_header->frame_status |= (ru->nb_tx-1);
packet_header->frame_status &= ~(0x000f<<26);
packet_header->frame_status |= (symbol_id&0x000f)<<26;
......@@ -105,7 +109,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
if ((ru->ifdevice.trx_write_func(&ru->ifdevice,
symbol_id,
&tx_buffer,
db_fulllength,
db_fulllength*ru->nb_tx,
1,
IF4p5_PDLFFT)) < 0) {
perror("ETHERNET write for IF4p5_PDLFFT\n");
......@@ -139,9 +143,10 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
if (packet_type == IF4p5_PULFFT) {
for (symbol_id=fp->symbols_per_tti-nsym; symbol_id<fp->symbols_per_tti; symbol_id++) {
for (int antenna_id=0;antenna_id<ru->nb_rx;antenna_id++) {
uint32_t *rx0 = (uint32_t*) &rxdataF[0][blockoffsetF];
uint32_t *rx1 = (uint32_t*) &rxdataF[0][slotoffsetF];
uint32_t *rx0 = (uint32_t*) &rxdataF[antenna_id][blockoffsetF];
uint32_t *rx1 = (uint32_t*) &rxdataF[antenna_id][slotoffsetF];
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL, symbol_id );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 1 );
......@@ -172,9 +177,11 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
d[7] = ((uint16_t) lin2alaw_if4p5[i[14]]) | ((uint16_t)(lin2alaw_if4p5[i[15]]<<8));
}
}
stop_meas(&ru->compression);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 0 );
packet_header->frame_status &= ~(0x07);
packet_header->frame_status |= ru->nb_rx-1;
packet_header->frame_status &= ~(0x000f<<26);
packet_header->frame_status |= (symbol_id&0x000f)<<26;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF, 1 );
......@@ -182,7 +189,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
if ((ru->ifdevice.trx_write_func(&ru->ifdevice,
symbol_id,
&tx_buffer,
db_fulllength,
db_fulllength*ru->nb_rx,
1,
IF4p5_PULFFT)) < 0) {
perror("ETHERNET write for IF4p5_PULFFT\n");
......@@ -221,28 +228,30 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
int16_t *rxF;
for (int antenna_id=0;antenna_id<ru->nb_rx;antenna_id++) {
#ifdef Rel14
if (packet_type > IF4p5_PRACH)
rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0];
else
#endif
rxF = &prach_rxsigF[0][0];
rxF = &prach_rxsigF[antenna_id][0];
AssertFatal(rxF!=NULL,"rxF is null\n");
if (eth->flags == ETH_RAW_IF4p5_MODE) {
memcpy((void *)(tx_buffer_prach + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t),
memcpy((void *)(tx_buffer_prach + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t+PRACH_BLOCK_SIZE_BYTES*antenna_id),
(void*)rxF,
PRACH_BLOCK_SIZE_BYTES);
} else {
memcpy((void *)(tx_buffer_prach + sizeof_IF4p5_header_t),
memcpy((void *)(tx_buffer_prach + sizeof_IF4p5_header_t + PRACH_BLOCK_SIZE_BYTES*antenna_id),
(void *)rxF,
PRACH_BLOCK_SIZE_BYTES);
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF, 1 );
if ((ru->ifdevice.trx_write_func(&ru->ifdevice,
symbol_id,
&tx_buffer_prach,
db_fulllength,
db_fulllength*ru->nb_rx,
1,
packet_type)) < 0) {
perror("ETHERNET write for IF4p5_PRACH\n");
......@@ -276,9 +285,9 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
if (ru->idx==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 );
if (ru->function == NGFI_RRU_IF4p5) {
db_fulllength = (12*fp->N_RB_DL);
db_fulllength = (12*fp->N_RB_DL)*ru->nb_tx;
} else { // This is not an RRU
db_fulllength = (12*fp->N_RB_UL);
db_fulllength = (12*fp->N_RB_UL)*ru->nb_rx;
}
db_halflength = db_fulllength>>1;
......@@ -317,6 +326,8 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
*packet_type = packet_header->sub_type;
LOG_D(PHY,"recv_IF4p5: Frame %d, Subframe %d: packet_type %x\n",*frame,*subframe,*packet_type);
if (*packet_type == IF4p5_PDLFFT) {
db_fulllength/=ru->nb_tx;
db_halflength/=ru->nb_tx;
*symbol_number = ((packet_header->frame_status)>>26)&0x000f;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RECV_IF4_SYMBOL, *symbol_number );
LOG_D(PHY,"DL_IF4p5: RU %d frame %d, subframe %d, symbol %d\n",ru->idx,*frame,*subframe,*symbol_number);
......@@ -325,17 +336,21 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 1 );
for (int antenna_id=0;antenna_id<ru->nb_tx;antenna_id++) {
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &txdataF[0][blockoffsetF+element_id];
i = (uint16_t*) &txdataF[antenna_id][blockoffsetF+element_id];
*i = alaw2lin_if4p5[ (data_block[element_id] & 0xff) ];
*(i+1) = alaw2lin_if4p5[ (data_block[element_id]>>8) ];
i = (uint16_t*) &txdataF[0][slotoffsetF+element_id];
i = (uint16_t*) &txdataF[antenna_id][slotoffsetF+element_id];
*i = alaw2lin_if4p5[ (data_block[element_id+db_halflength] & 0xff) ];
*(i+1) = alaw2lin_if4p5[ (data_block[element_id+db_halflength]>>8) ];
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );
} else if (*packet_type == IF4p5_PULFFT) {
db_fulllength/=ru->nb_rx;
db_halflength/=ru->nb_rx;
*symbol_number = ((packet_header->frame_status)>>26)&0x000f;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RECV_IF4_SYMBOL, *symbol_number );
......@@ -345,32 +360,35 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size);
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 1 );
for (int antenna_id=0;antenna_id<ru->nb_rx;antenna_id++) {
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
i = (uint16_t*) &rxdataF[antenna_id][blockoffsetF+element_id];
*i = alaw2lin_if4p5[ (data_block[element_id] & 0xff) ];
*(i+1) = alaw2lin_if4p5[ (data_block[element_id]>>8) ];
i = (uint16_t*) &rxdataF[0][slotoffsetF+element_id];
i = (uint16_t*) &rxdataF[antenna_id][slotoffsetF+element_id];
*i = alaw2lin_if4p5[ (data_block[element_id+db_halflength] & 0xff) ];
*(i+1) = alaw2lin_if4p5[ (data_block[element_id+db_halflength]>>8) ];
//if (element_id==0) LOG_I(PHY,"recv_if4p5: symbol %d rxdata0 = (%u,%u)\n",*symbol_number,*i,*(i+1));
}
LOG_D(PHY,"PULFFT_IF4p5: CC_id %d : frame %d, subframe %d (symbol %d)=> %d dB\n",ru->idx,*frame,*subframe,*symbol_number,
dB_fixed(signal_energy((int*)&rxdataF[0][slotoffsetF],db_halflength)+
signal_energy((int*)&rxdataF[0][blockoffsetF],db_halflength)));
dB_fixed(signal_energy((int*)&rxdataF[antenna_id][slotoffsetF],db_halflength)+
signal_energy((int*)&rxdataF[antenna_id][blockoffsetF],db_halflength)));
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );
} else if (*packet_type >= IF4p5_PRACH &&
*packet_type <= IF4p5_PRACH + 4) {
int16_t *rxF;
for (int antenna_id=0;antenna_id<ru->nb_rx;antenna_id++) {
#ifdef Rel14
if (*packet_type > IF4p5_PRACH)
rxF = &prach_rxsigF_br[*packet_type - IF4p5_PRACH - 1][0][0];
rxF = &prach_rxsigF_br[*packet_type - IF4p5_PRACH - 1][antenna_id][0];
else
#endif
rxF = &prach_rxsigF[0][0];
rxF = &prach_rxsigF[antenna_id][0];
// FIX: hard coded prach samples length
db_fulllength = PRACH_NUM_SAMPLES;
......@@ -379,14 +397,14 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
if (eth->flags == ETH_RAW_IF4p5_MODE) {
memcpy(rxF,
(int16_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES+sizeof_IF4p5_header_t),
(int16_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES+sizeof_IF4p5_header_t)+PRACH_BLOCK_SIZE_BYTES*antenna_id,
PRACH_BLOCK_SIZE_BYTES);
} else {
memcpy(rxF,
(int16_t*) (rx_buffer+sizeof_IF4p5_header_t),
(int16_t*) (rx_buffer+sizeof_IF4p5_header_t)+PRACH_BLOCK_SIZE_BYTES*antenna_id,
PRACH_BLOCK_SIZE_BYTES);
}
}
LOG_D(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d => %d dB\n",ru->idx,*frame,*subframe,
dB_fixed(signal_energy((int*)&prach_rxsigF[0][0],839)));
for (idx=0;idx<ru->num_eNB;idx++) ru->wakeup_prach_eNB(ru->eNB_list[idx],ru,*frame,*subframe);
......@@ -449,21 +467,21 @@ void malloc_IF4p5_buffer(RU_t *ru) {
if (eth->flags == ETH_RAW_IF4p5_MODE) {
for (i=0;i<10;i++) {
ru->ifbuffer.tx[i] = malloc(RAW_IF4p5_PRACH_SIZE_BYTES);
memset((void*)ru->ifbuffer.tx[i],0,RAW_IF4p5_PRACH_SIZE_BYTES);
ru->ifbuffer.tx[i] = malloc(RAW_IF4p5_PRACH_SIZE_BYTES*ru->nb_tx);
memset((void*)ru->ifbuffer.tx[i],0,RAW_IF4p5_PRACH_SIZE_BYTES*ru->nb_tx);
}
ru->ifbuffer.tx_prach = malloc(RAW_IF4p5_PRACH_SIZE_BYTES);
memset((void*)ru->ifbuffer.tx_prach,0,RAW_IF4p5_PRACH_SIZE_BYTES);
ru->ifbuffer.rx = malloc(RAW_IF4p5_PRACH_SIZE_BYTES);
memset((void*)ru->ifbuffer.rx,0,RAW_IF4p5_PRACH_SIZE_BYTES);
ru->ifbuffer.tx_prach = malloc(RAW_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
memset((void*)ru->ifbuffer.tx_prach,0,RAW_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
ru->ifbuffer.rx = malloc(RAW_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
memset((void*)ru->ifbuffer.rx,0,RAW_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
} else {
for (i=0;i<10;i++) {
ru->ifbuffer.tx[i] = malloc(UDP_IF4p5_PRACH_SIZE_BYTES);
memset((void*)ru->ifbuffer.tx[i],0,UDP_IF4p5_PRACH_SIZE_BYTES);
ru->ifbuffer.tx[i] = malloc(UDP_IF4p5_PRACH_SIZE_BYTES*ru->nb_tx);
memset((void*)ru->ifbuffer.tx[i],0,UDP_IF4p5_PRACH_SIZE_BYTES*ru->nb_tx);
}
ru->ifbuffer.tx_prach = malloc(UDP_IF4p5_PRACH_SIZE_BYTES);
memset((void*)ru->ifbuffer.tx_prach,0,UDP_IF4p5_PRACH_SIZE_BYTES);
ru->ifbuffer.rx = malloc(UDP_IF4p5_PRACH_SIZE_BYTES);
memset((void*)ru->ifbuffer.rx,0,UDP_IF4p5_PRACH_SIZE_BYTES);
ru->ifbuffer.tx_prach = malloc(UDP_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
memset((void*)ru->ifbuffer.tx_prach,0,UDP_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
ru->ifbuffer.rx = malloc(UDP_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
memset((void*)ru->ifbuffer.rx,0,UDP_IF4p5_PRACH_SIZE_BYTES*ru->nb_rx);
}
}
......@@ -74,9 +74,9 @@ eNBs =
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -96;
pusch_p0_Nominal = -104;
pusch_alpha = "AL1";
pucch_p0_Nominal = -104;
pucch_p0_Nominal = -108;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
......@@ -188,8 +188,8 @@ RUs = (
remote_portd = 50001;
local_rf = "no"
tr_preference = "udp_if4p5"
nb_tx = 1
nb_rx = 1
nb_tx = 2
nb_rx = 2
att_tx = 0
att_rx = 0;
eNB_instances = [0];
......
......@@ -1300,7 +1300,7 @@ void wakeup_eNBs(RU_t *ru) {
if (proc->RU_mask[ru->proc.subframe_rx] == (1<<eNB->num_RU)-1) {
proc->RU_mask[ru->proc.subframe_rx] = 0;
clock_gettime(CLOCK_MONOTONIC,&t);
AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+500000,
AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000,
"Time difference for subframe %d => %d > 5ms\n",
ru->proc.subframe_rx,t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec);
}
......
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