Commit 3e838ca6 authored by Raymond Knopp's avatar Raymond Knopp

temporary commit for testing 2 RRU case as TM2 (distributed antennas)

parent 63c68100
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/TOOLS/alaw_lut.h" #include "PHY/TOOLS/alaw_lut.h"
#include "PHY/extern.h"
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" //#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
...@@ -47,7 +48,7 @@ ...@@ -47,7 +48,7 @@
void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type, int k) { void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type, int k) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
int32_t **txdataF = eNB->common_vars.txdataF[0]; int32_t **txdataF = (eNB->CC_id==0) ? eNB->common_vars.txdataF[0] : PHY_vars_eNB_g[0][0]->common_vars.txdataF[0];
int32_t **rxdataF = eNB->common_vars.rxdataF[0]; int32_t **rxdataF = eNB->common_vars.rxdataF[0];
int16_t **rxsigF = eNB->prach_vars.rxsigF; int16_t **rxsigF = eNB->prach_vars.rxsigF;
void *tx_buffer = eNB->ifbuffer.tx; void *tx_buffer = eNB->ifbuffer.tx;
...@@ -61,7 +62,8 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type ...@@ -61,7 +62,8 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type
IF4p5_header_t *packet_header=NULL; IF4p5_header_t *packet_header=NULL;
eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv); eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 );
if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 );
if (packet_type == IF4p5_PDLFFT) { if (packet_type == IF4p5_PDLFFT) {
db_fulllength = 12*fp->N_RB_DL; db_fulllength = 12*fp->N_RB_DL;
...@@ -81,10 +83,10 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type ...@@ -81,10 +83,10 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type
for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) { for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) {
for (element_id=0; element_id<db_halflength; element_id++) { for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &txdataF[0][blockoffsetF+element_id]; i = (uint16_t*) &txdataF[eNB->CC_id][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8); data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
i = (uint16_t*) &txdataF[0][slotoffsetF+element_id]; i = (uint16_t*) &txdataF[eNB->CC_id][slotoffsetF+element_id];
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8); data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
} }
...@@ -177,7 +179,7 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type ...@@ -177,7 +179,7 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type
AssertFatal(1==0, "send_IF4p5 - Unknown packet_type %x", packet_type); AssertFatal(1==0, "send_IF4p5 - Unknown packet_type %x", packet_type);
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 0 ); if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 0 );
return; return;
} }
...@@ -194,7 +196,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t ...@@ -194,7 +196,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t
int slotoffsetF=0, blockoffsetF=0; int slotoffsetF=0, blockoffsetF=0;
eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv); eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 ); if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 );
if (eNB->node_function == NGFI_RRU_IF4p5) { if (eNB->node_function == NGFI_RRU_IF4p5) {
db_fulllength = (12*fp->N_RB_DL); db_fulllength = (12*fp->N_RB_DL);
...@@ -281,7 +283,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t ...@@ -281,7 +283,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t
AssertFatal(1==0, "recv_IF4p5 - Unknown packet_type %x", *packet_type); AssertFatal(1==0, "recv_IF4p5 - Unknown packet_type %x", *packet_type);
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 0 ); if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 0 );
return; return;
} }
......
...@@ -242,6 +242,8 @@ typedef struct eNB_proc_t_s { ...@@ -242,6 +242,8 @@ typedef struct eNB_proc_t_s {
int subframe_prach; int subframe_prach;
/// frame to act upon for reception /// frame to act upon for reception
int frame_rx; int frame_rx;
/// frame offset for secondary eNBs (to correct for frame asynchronism at startup)
int frame_offset;
/// frame to act upon for PRACH /// frame to act upon for PRACH
int frame_prach; int frame_prach;
/// \internal This variable is protected by \ref mutex_fep. /// \internal This variable is protected by \ref mutex_fep.
......
...@@ -1103,7 +1103,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1103,7 +1103,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
DCI_ALLOC_t *dci_alloc=(DCI_ALLOC_t *)NULL; DCI_ALLOC_t *dci_alloc=(DCI_ALLOC_t *)NULL;
int offset = proc == &eNB->proc.proc_rxtx[0] ? 0 : 1; int offset = eNB->CC_id;//proc == &eNB->proc.proc_rxtx[0] ? 0 : 1;
#if defined(SMBV) #if defined(SMBV)
// counts number of allocations in subframe // counts number of allocations in subframe
...@@ -2741,7 +2741,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){ ...@@ -2741,7 +2741,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
const int subframe = proc->subframe_rx; const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx; const int frame = proc->frame_rx;
int offset = (eNB->single_thread_flag==1) ? 0 : (subframe&1); int offset = eNB->CC_id;//(eNB->single_thread_flag==1) ? 0 : (subframe&1);
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return; if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return;
...@@ -2775,7 +2775,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const ...@@ -2775,7 +2775,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
const int subframe = proc->subframe_rx; const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx; const int frame = proc->frame_rx;
int offset = (proc == &eNB->proc.proc_rxtx[0]) ? 0 : 1; int offset = eNB->CC_id;//(proc == &eNB->proc.proc_rxtx[0]) ? 0 : 1;
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return; if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return;
......
...@@ -419,7 +419,7 @@ void tx_fh_if5_mobipass(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -419,7 +419,7 @@ void tx_fh_if5_mobipass(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
} }
void tx_fh_if4p5(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { void tx_fh_if4p5(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
send_IF4p5(eNB,proc->frame_tx, proc->subframe_tx, IF4p5_PDLFFT, 0); send_IF4p5(eNB,proc->frame_tx,proc->subframe_tx, IF4p5_PDLFFT, 0);
} }
void proc_tx_high0(PHY_VARS_eNB *eNB, void proc_tx_high0(PHY_VARS_eNB *eNB,
...@@ -427,7 +427,7 @@ void proc_tx_high0(PHY_VARS_eNB *eNB, ...@@ -427,7 +427,7 @@ void proc_tx_high0(PHY_VARS_eNB *eNB,
relaying_type_t r_type, relaying_type_t r_type,
PHY_VARS_RN *rn) { PHY_VARS_RN *rn) {
int offset = proc == &eNB->proc.proc_rxtx[0] ? 0 : 1; int offset = eNB->CC_id;//proc == &eNB->proc.proc_rxtx[0] ? 0 : 1;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB+offset, proc->frame_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB+offset, proc->frame_tx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB+offset, proc->subframe_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB+offset, proc->subframe_tx );
...@@ -604,7 +604,8 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -604,7 +604,8 @@ static void* eNB_thread_rxtx( void* param ) {
if (oai_exit) break; if (oai_exit) break;
if (rxtx(eNB,proc,thread_name) < 0) break; if (eNB->CC_id==0)
if (rxtx(eNB,proc,thread_name) < 0) break;
} // while !oai_exit } // while !oai_exit
...@@ -854,7 +855,7 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -854,7 +855,7 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
// prepare tx buffer pointers // prepare tx buffer pointers
for (i=0; i<fp->nb_antennas_tx; i++) for (i=0; i<fp->nb_antennas_tx; i++)
txp[i] = (void*)&eNB->common_vars.txdata[0][i][((proc->subframe_rx+tx_sfoffset)%10)*fp->samples_per_tti]; txp[i] = (void*)&eNB->common_vars.txdata[0][i][((proc->subframe_rx+tx_sfoffset)%10)*fp->samples_per_tti];
txs = eNB->rfdevice.trx_write_func(&eNB->rfdevice, txs = eNB->rfdevice.trx_write_func(&eNB->rfdevice,
proc->timestamp_rx+(tx_sfoffset*fp->samples_per_tti)-openair0_cfg[0].tx_sample_advance, proc->timestamp_rx+(tx_sfoffset*fp->samples_per_tti)-openair0_cfg[0].tx_sample_advance,
...@@ -981,6 +982,7 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -981,6 +982,7 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
do { // Blocking, we need a timeout on this !!!!!!!!!!!!!!!!!!!!!!! do { // Blocking, we need a timeout on this !!!!!!!!!!!!!!!!!!!!!!!
recv_IF4p5(eNB, &proc->frame_rx, &proc->subframe_rx, &packet_type, &symbol_number); recv_IF4p5(eNB, &proc->frame_rx, &proc->subframe_rx, &packet_type, &symbol_number);
proc->frame_rx = (proc->frame_rx + proc->frame_offset)&1023;
if (packet_type == IF4p5_PULFFT) { if (packet_type == IF4p5_PULFFT) {
symbol_mask = symbol_mask | (1<<symbol_number); symbol_mask = symbol_mask | (1<<symbol_number);
...@@ -998,7 +1000,15 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -998,7 +1000,15 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
if (proc->first_rx == 0) { if (proc->first_rx == 0) {
if (proc->subframe_rx != *subframe){ if (proc->subframe_rx != *subframe){
LOG_E(PHY,"rx_fh_if4p5: Received Timestamp doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d,CCid %d)\n",proc->subframe_rx,*subframe,eNB->CC_id); LOG_E(PHY,"rx_fh_if4p5, CC_id %d: Received Timestamp doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d,CCid %d)\n",eNB->CC_id,proc->subframe_rx,*subframe,eNB->CC_id);
/*
if (proc->subframe_rx> *subframe) {
LOG_E(PHY,"rx_fh_if4p5, CC_id %d: this is ahead of time, so adjusting\n",eNB->CC_id);
*subframe = proc->subframe_rx;
}
else {
LOG_E(PHY,"rx_fh_ip4p5, CC_id %d: this is behind time, dropping\n");
}*/
exit_fun("Exiting"); exit_fun("Exiting");
} }
if (proc->frame_rx != *frame) { if (proc->frame_rx != *frame) {
...@@ -1007,7 +1017,12 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -1007,7 +1017,12 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
} }
} else { } else {
proc->first_rx = 0; proc->first_rx = 0;
*frame = proc->frame_rx; if (eNB->CC_id==0)
proc->frame_offset = 0;
else
proc->frame_offset = PHY_vars_eNB_g[0][0]->proc.frame_rx;
*frame = (proc->frame_rx + proc->frame_offset)&1023;
*subframe = proc->subframe_rx; *subframe = proc->subframe_rx;
} }
...@@ -1452,7 +1467,7 @@ static void* eNB_thread_single( void* param ) { ...@@ -1452,7 +1467,7 @@ static void* eNB_thread_single( void* param ) {
eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq1; eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq1;
eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq2; eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq2;
} }
eNB->rfdevice.trx_set_freq_func(&eNB->rfdevice,eNB->rfdevice.openair0_cfg,0); eNB->rfdevice.trx_set_freq_func(&eNB->rfdevice,eNB->rfdevice.openair0_cfg,1);
} // if RRU and slave } // if RRU and slave
...@@ -1528,6 +1543,7 @@ void init_eNB_proc(int inst) { ...@@ -1528,6 +1543,7 @@ void init_eNB_proc(int inst) {
proc->first_rx=1; proc->first_rx=1;
proc->first_tx=1; proc->first_tx=1;
proc->frame_offset = 0;
pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL); pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL);
pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL); pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);
......
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