Commit bbaec98c authored by magounak's avatar magounak

received DMRS at RCC side from 2 RRUs

parent 2cb279d6
......@@ -79,6 +79,8 @@ typedef struct {
int *nb_L1_CC;
/// Number of RU instances in this node
int nb_RU;
/// Flag to start collecting channel estimates sent from the RRUs
int collect;
/// FlexRAN context variables
flexran_agent_info_t **flexran;
/// eNB context variables
......
......@@ -45,10 +45,22 @@ ID = ENB_PHY_INPUT_SIGNAL
DESC = eNodeB received signal in the time domain for a duration of 1ms
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
FORMAT = int,eNB_ID : int,frame : int,subframe : int,antenna : buffer,rxdata
ID = RAU_INPUT_SIGNAL
DESC = RAU received data from the RRUs
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
FORMAT = int,tag : int,frame : int,subframe : buffer,rxdataF
ID = RAU_INPUT_DMRS
DESC = RAU received DMRS from the RRUs
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
FORMAT = int,tag : int,frame : int,subframe : buffer,rxdataF_ext
ID = CALIBRATION_CHANNEL_ESTIMATES
DESC = RAU received DMRS estimates from the RRUs
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
FORMAT = int,tag : int,frame : int,subframe : int,symbol : buffer,calib_ch
ID = CALIBRATION_CHANNEL_ESTIMATES_TIME
DESC = RAU received DMRS estimates in the time domain from the RRUs
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
FORMAT = int,tag : int,frame : int,subframe : buffer,calib_ch_time
ID = ENB_PHY_OUTPUT_SIGNAL
DESC = eNodeB sent signal in the time domain for a duration of 1ms
GROUP = ALL:PHY:HEAVY:ENB
......
......@@ -117,6 +117,57 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
slotoffsetF += fp->ofdm_symbol_size;
blockoffsetF += fp->ofdm_symbol_size;
}
} else if (packet_type == IF4p5_PULCALIB) {
LOG_D(PHY,"send PULCALIB_IF4p5: RU %d frame %d, subframe %d\n",ru->idx,frame,subframe);
AssertFatal(subframe_select(fp,subframe)==SF_S, "calling PULCALIB in non-S subframe\n");
db_fulllength = 12*fp->N_RB_UL;
db_halflength = (db_fulllength)>>1;
slotoffsetF = 0;
blockoffsetF = (fp->ofdm_symbol_size)-db_halflength;
if (eth->flags == ETH_RAW_IF4p5_MODE) {
packet_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
} else {
packet_header = (IF4p5_header_t *)(tx_buffer);
data_block = (uint16_t*)(tx_buffer + sizeof_IF4p5_header_t);
}
gen_IF4p5_ul_header(packet_header, packet_type, frame, subframe);
AssertFatal(rxdataF[0]!=NULL,"rxdataF[0] is null\n");
for (symbol_id=0; symbol_id<11; symbol_id++) {
if (symbol_id==3 || symbol_id==10) {
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*) &rxdataF[antenna_id][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw_if4p5[*i]) | (lin2alaw_if4p5[*(i+1)]<<8);
i = (uint16_t*) &rxdataF[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_rx-1);
packet_header->frame_status &= ~(0x000f<<26);
packet_header->frame_status |= (symbol_id&0x000f)<<26;
if (ru->idx<=1) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0+ru->idx, 1 );
if ((ru->ifdevice.trx_write_func(&ru->ifdevice,
symbol_id,
&tx_buffer,
db_fulllength*ru->nb_rx,
1,
IF4p5_PULCALIB)) < 0) {
perror("ETHERNET write for IF4p5_PULCALIB\n");
}
if (ru->idx<=1) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0+ru->idx, 0 );
}
slotoffsetF += fp->ofdm_symbol_size;
blockoffsetF += fp->ofdm_symbol_size;
}
} else if ((packet_type == IF4p5_PULFFT)||
(packet_type == IF4p5_PULTICK)){
db_fulllength = 12*fp->N_RB_UL;
......@@ -388,6 +439,35 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
data_block+=db_fulllength;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );
} else if (*packet_type == IF4p5_PULCALIB) {
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 );
if (ru->idx==0) LOG_D(PHY,"UL_IF4p5: RU %d : frame %d, subframe %d, symbol %d\n",ru->idx,*frame,*subframe,*symbol_number);
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[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[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,"PULCALIB_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[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) {
......
......@@ -44,6 +44,7 @@
#define IF4p5_PRACH_BR_CE2 0x0024
#define IF4p5_PRACH_BR_CE3 0x0025
#define IF4p5_PULTICK 0x0026
#define IF4p5_PULCALIB 0x0027
struct IF4p5_header {
/// Type
......
......@@ -215,7 +215,9 @@ int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestam
} else if (flags == IF4p5_PULFFT) {
packet_size = RAW_IF4p5_PULFFT_SIZE_BYTES(nblocks);
} else if (flags == IF4p5_PULTICK) {
packet_size = RAW_IF4p5_PULTICK_SIZE_BYTES;
packet_size = RAW_IF4p5_PULTICK_SIZE_BYTES;
} else if (flags == IF4p5_PULCALIB) {
packet_size = RAW_IF4p5_PULCALIB_SIZE_BYTES(nblocks);
} else if (flags == IF5_MOBIPASS) {
packet_size = RAW_IF5_MOBIPASS_SIZE_BYTES;
} else {
......
......@@ -235,7 +235,9 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
} else if (flags == IF4p5_PULFFT) {
packet_size = UDP_IF4p5_PULFFT_SIZE_BYTES(nblocks);
} else if (flags == IF4p5_PULTICK) {
packet_size = UDP_IF4p5_PULTICK_SIZE_BYTES;
packet_size = UDP_IF4p5_PULTICK_SIZE_BYTES;
} else if (flags == IF4p5_PULCALIB) {
packet_size = UDP_IF4p5_PULCALIB_SIZE_BYTES(nblocks);
} else if ((flags >= IF4p5_PRACH)&&
(flags <= (IF4p5_PRACH+4))) {
packet_size = UDP_HEADER_SIZE_BYTES + IPV4_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + (nsamps<<1);
......
......@@ -75,10 +75,12 @@
#define RAW_IF4p5_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4p5_PULTICK_SIZE_BYTES (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t)
#define RAW_IF4p5_PRACH_SIZE_BYTES (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + PRACH_BLOCK_SIZE_BYTES)
#define RAW_IF4p5_PULCALIB_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define UDP_IF4p5_PDLFFT_SIZE_BYTES(nblocks) (UDP_HEADER_SIZE_BYTES + IPV4_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define UDP_IF4p5_PULFFT_SIZE_BYTES(nblocks) (UDP_HEADER_SIZE_BYTES + IPV4_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define UDP_IF4p5_PULTICK_SIZE_BYTES (UDP_HEADER_SIZE_BYTES + IPV4_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t)
#define UDP_IF4p5_PRACH_SIZE_BYTES (UDP_HEADER_SIZE_BYTES + IPV4_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + PRACH_BLOCK_SIZE_BYTES)
#define UDP_IF4p5_PULCALIB_SIZE_BYTES(nblocks) (UDP_HEADER_SIZE_BYTES + IPV4_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
// Mobipass packet sizes
#define RAW_IF5_MOBIPASS_BLOCK_SIZE_BYTES 1280
......
......@@ -201,25 +201,39 @@ void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) {
void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
RU_proc_t *proc = &ru->proc;
int f,sf;
int f,sf,Ns,l,u;
RU_CALIBRATION *calibration = &ru->calibration;
uint16_t packet_type;
uint32_t symbol_number=0;
uint32_t symbol_mask_full;
int pultick_received=0;
if (ru->is_slave==1 && ru->wait_cnt!=0) RC.collect = 0;
if ((fp->frame_type == TDD) && (subframe_select(fp,*subframe)==SF_S))
symbol_mask_full = (1<<fp->ul_symbols_in_S_subframe)-1;
else
if ((fp->frame_type == TDD) && (subframe_select(fp,*subframe)==SF_S)) {
if (*subframe == 1) {
symbol_mask_full = (1<<11)-1;
} else {
symbol_mask_full = (1<<fp->ul_symbols_in_S_subframe)-1;
}
} else {
symbol_mask_full = (1<<fp->symbols_per_tti)-1;
}
LOG_D(PHY,"fh_if4p5_south_in: RU %d, frame %d, subframe %d, ru %d, mask %x\n",ru->idx,*frame,*subframe,ru->idx,proc->symbol_mask[*subframe]);
if (proc->symbol_mask[*subframe] == symbol_mask_full) proc->symbol_mask[*subframe] = 0;
AssertFatal(proc->symbol_mask[*subframe]==0 || proc->symbol_mask[*subframe]==symbol_mask_full,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]);
if (proc->symbol_mask[*subframe]==0) { // this is normal case, if not true then we received a PULTICK before the previous subframe was finished
do {
recv_IF4p5(ru, &f, &sf, &packet_type, &symbol_number);
LOG_D(PHY,"fh_if4p5_south_in: RU %d, frame %d, subframe %d, f %d, sf %d\n",ru->idx,*frame,*subframe,f,sf);
if (oai_exit == 1 || ru->cmd== STOP_RU) break;
if (packet_type == IF4p5_PULFFT) proc->symbol_mask[sf] = proc->symbol_mask[sf] | (1<<symbol_number);
else if (packet_type == IF4p5_PULCALIB) {
proc->symbol_mask[sf] = (2<<symbol_number)-1;
LOG_I(PHY,"symbol_mask[%d] %d\n",sf,proc->symbol_mask[sf]);
}
else if (packet_type == IF4p5_PULTICK) {
proc->symbol_mask[sf] = symbol_mask_full;
pultick_received++;
......@@ -278,6 +292,70 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN_RU+ru->idx,f);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_IN_RU+ru->idx,sf);
if (ru->is_slave==1 && ru->wait_cnt==0) RC.collect = 1;
if (ru->wait_cnt==0 && packet_type == IF4p5_PULCALIB && RC.collect==1) {
T(T_RAU_INPUT_SIGNAL, T_INT(ru->idx), T_INT(f), T_INT(sf),
T_BUFFER(&ru->common.rxdataF[0][0],
fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t)));
// Estimate calibration channel estimates:
Ns = (ru->is_slave==0 ? 1 : 1);
l = (ru->is_slave==0 ? 10 : 10);
u = (ru->is_slave==0 ? 0 : 0);
ru->frame_parms.nb_antennas_rx = ru->nb_rx;
ulsch_extract_rbs_single(ru->common.rxdataF,
calibration->rxdataF_ext,
0,
fp->N_RB_DL,
3%(fp->symbols_per_tti/2),// l = symbol within slot
Ns,
fp);
// OR should I call just: lte_ul_channel_estimation();
/*lte_ul_channel_estimation((PHY_VARS_eNB *)NULL,
proc,
ru->idx,
3%(fp->symbols_per_tti/2),
Ns);
*/
lte_ul_channel_estimation_RRU(fp,
calibration->drs_ch_estimates,
calibration->drs_ch_estimates_time,
calibration->rxdataF_ext,
fp->N_RB_DL,
f,
sf,
u,
0,
0,
l,
0,
0);
T(T_CALIBRATION_CHANNEL_ESTIMATES, T_INT(ru->idx), T_INT(f), T_INT(sf),
T_INT(l),T_BUFFER(&calibration->drs_ch_estimates[0][l*12*fp->N_RB_UL],
12*fp->N_RB_UL*sizeof(int32_t)));
T(T_RAU_INPUT_DMRS, T_INT(ru->idx), T_INT(f), T_INT(sf),
T_BUFFER(&calibration->rxdataF_ext[0][l*12*fp->N_RB_UL],
12*fp->N_RB_UL*sizeof(int32_t)));
T(T_CALIBRATION_CHANNEL_ESTIMATES_TIME, T_INT(ru->idx), T_INT(f), T_INT(sf),
T_BUFFER(calibration->drs_ch_estimates_time[0],
fp->ofdm_symbol_size*sizeof(int32_t)));
/* if (f==251 && ru->idx==0) {
//LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][0], 14*12*(fp->N_RB_DL),1,1);
LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], fp->ofdm_symbol_size,1,1);
//exit(-1);
}*/
//}
}
proc->symbol_mask[sf] = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff );
LOG_D(PHY,"RU %d: fh_if4p5_south_in returning ...\n",ru->idx);
......@@ -500,7 +578,17 @@ void fh_if4p5_north_out(RU_t *ru) {
LOG_D(PHY,"fh_if4p5_north_out: Sending IF4p5_PULFFT SFN.SF %d.%d\n",proc->frame_rx,proc->subframe_rx);
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) {
/// **** in TDD during DL send_IF4 of ULTICK to RCC **** ///
send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULTICK);
if (subframe_select(fp,subframe)==SF_S && subframe==1 /*&& ru->state==RU_RUN*/) {
send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULCALIB);
LOG_D(PHY,"~~~~~~******* Sending PULCALIB frame %d, subframe %d\n",proc->frame_rx,proc->subframe_rx);
T(T_RAU_INPUT_DMRS, T_INT(ru->idx), T_INT(proc->frame_rx), T_INT(proc->subframe_rx),
T_BUFFER(&ru->common.rxdataF[0][proc->subframe_rx*fp->symbols_per_tti*fp->ofdm_symbol_size],
fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t)));
} else {
send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULTICK);
LOG_D(PHY,"~~~~~~******* Sending PULTICK frame %d, subframe %d\n",proc->frame_rx,proc->subframe_rx);
}
LOG_D(PHY,"fh_if4p5_north_out: Sending IF4p5_PULCALIB SFN.SF %d.%d\n",proc->frame_rx,proc->subframe_rx);
ru->north_out_cnt++;
return;
}
......@@ -724,7 +812,7 @@ void tx_rf(RU_t *ru) {
+ (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples)
+ ru->end_of_burst_delay;
if (ru->state==RU_RUN && proc->frame_tx%ru->p==ru->tag) {
siglen2 = fp->ofdm_symbol_size + fp->nb_prefix_samples; // length of symbol 10
siglen2 = fp->ofdm_symbol_size + fp->nb_prefix_samples + ru->end_of_burst_delay; // length of symbol 10
}
flags=3; // end of burst
}
......@@ -746,10 +834,10 @@ void tx_rf(RU_t *ru) {
sf_extension = (sf_extension)&0xfffffffc;
#endif
for (i=0; i<ru->nb_tx; i++)
for (i=0; i<ru->nb_tx; i++) {
txp[i] = (void *)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension];
txp1[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)+(sigoff2)-sf_extension]; // pointer to 1st sample of 10th symbol
}
/* add fail safe for late command */
if(late_control!=STATE_BURST_NORMAL) { //stop burst
......
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