modifications for EXMIMO2 targets
This commit is contained in:
@@ -43,10 +43,6 @@
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef EXMIMO
|
||||
extern openair0_rf_map rf_map[MAX_NUM_CCs];
|
||||
#endif
|
||||
|
||||
extern uint16_t prach_root_sequence_map0_3[838];
|
||||
extern uint16_t prach_root_sequence_map4[138];
|
||||
uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10};
|
||||
@@ -672,7 +668,7 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
|
||||
int CC_id)
|
||||
{
|
||||
|
||||
//PHY_VARS_eNB *eNB = PHY_vars_eNB_g[Mod_id][CC_id];
|
||||
|
||||
uint8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][0]);
|
||||
struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10;
|
||||
//struct RadioResourceConfigCommonSCell_r10 *physicalConfigCommonSCell_r10 = sCellToAddMod_r10->radioResourceConfigCommonSCell_r10;
|
||||
@@ -682,13 +678,14 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
|
||||
|
||||
#ifdef EXMIMO
|
||||
#ifdef DRIVER2013
|
||||
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[rf_map[CC_id].card].exmimo_config_ptr;
|
||||
// exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[rf_map[CC_id].card].exmimo_config_ptr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) {
|
||||
carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
|
||||
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,/*eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
|
||||
/*
|
||||
#ifdef EXMIMO
|
||||
#ifdef DRIVER2013
|
||||
//carrier_freq[CC_id] = carrier_freq_local;
|
||||
@@ -700,11 +697,12 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
|
||||
p_exmimo_config->rf.rf_local[rf_map[CC_id].chain] = 8255063; //this should be taken form calibration file
|
||||
p_exmimo_config->rf.rffe_band_mode[rf_map[CC_id].chain] = B19G_TDD;
|
||||
#endif
|
||||
#endif
|
||||
#endif*/
|
||||
} else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) {
|
||||
carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
|
||||
// this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
|
||||
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,/*eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
|
||||
/*
|
||||
#ifdef EXMIMO
|
||||
#ifdef DRIVER2013
|
||||
//carrier_freq[CC_id] = carrier_freq_local;
|
||||
@@ -717,6 +715,7 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
|
||||
p_exmimo_config->rf.rffe_band_mode[rf_map[CC_id].chain] = DD_TDD;
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
} else {
|
||||
LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %d of SCell %d for UE %d not supported\n",Mod_id,/*eNB->frame*/0,dl_CarrierFreq_r10,CC_id,UE_id);
|
||||
}
|
||||
|
||||
@@ -363,6 +363,7 @@ typedef struct PHY_VARS_eNB_s {
|
||||
eNB_proc_t proc;
|
||||
eNB_func_t node_function;
|
||||
eNB_timing_t node_timing;
|
||||
openair0_rf_map rf_map;
|
||||
int abstraction_flag;
|
||||
void (*do_prach)(struct PHY_VARS_eNB_s *eNB);
|
||||
void (*fep)(struct PHY_VARS_eNB_s *eNB);
|
||||
@@ -579,6 +580,8 @@ typedef struct {
|
||||
uint8_t Mod_id;
|
||||
/// \brief Component carrier ID for this PHY instance
|
||||
uint8_t CC_id;
|
||||
/// \brief Mapping of CC_id antennas to cards
|
||||
openair0_rf_map rf_map;
|
||||
//uint8_t local_flag;
|
||||
/// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach)
|
||||
runmode_t mode;
|
||||
|
||||
@@ -1107,6 +1107,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
|
||||
uint8_t smbv_alloc_cnt = 1;
|
||||
#endif
|
||||
|
||||
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_DL)) return;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(subframe&1),1);
|
||||
start_meas(&eNB->phy_proc_tx);
|
||||
|
||||
@@ -2582,11 +2584,14 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){
|
||||
|
||||
|
||||
eNB_proc_t *proc = &eNB->proc;
|
||||
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
||||
|
||||
const int subframe = proc->subframe_rx;
|
||||
const int frame = proc->frame_rx;
|
||||
|
||||
|
||||
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_COMMON+(subframe&1), 1 );
|
||||
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
@@ -2620,6 +2625,8 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
|
||||
const int subframe = proc->subframe_rx;
|
||||
const int frame = proc->frame_rx;
|
||||
|
||||
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC+(subframe&1), 1 );
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
|
||||
@@ -501,6 +501,7 @@ int trx_exmimo_start(openair0_device *device) {
|
||||
printf("Starting ...\n");
|
||||
openair0_config(device->openair0_cfg,0);
|
||||
openair0_start_rt_acquisition(0);
|
||||
printf("Setting state to running\n");
|
||||
exm->daq_state = running;
|
||||
exm->wait_first_read = 1;
|
||||
return(0);
|
||||
@@ -508,7 +509,8 @@ int trx_exmimo_start(openair0_device *device) {
|
||||
|
||||
int trx_exmimo_write(openair0_device *device,openair0_timestamp ptimestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
|
||||
return(0);
|
||||
|
||||
return(nsamps);
|
||||
}
|
||||
|
||||
|
||||
@@ -521,12 +523,12 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
|
||||
struct timespec sleep_time;
|
||||
unsigned long tv_nsec;
|
||||
int i;
|
||||
struct timespec wait;
|
||||
int n,n1,n2,ntot,first_len;
|
||||
int ret;
|
||||
|
||||
wait.tv_sec=0;
|
||||
wait.tv_nsec=50000000L;
|
||||
// struct timespec wait;
|
||||
// wait.tv_sec=0;
|
||||
// wait.tv_nsec=50000000L;
|
||||
|
||||
if (exm->watchdog_exit == 1)
|
||||
return(0);
|
||||
@@ -535,7 +537,6 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
|
||||
tv_nsec=(unsigned long)((double)(nsamps)*1e9/cfg->sample_rate);
|
||||
return(0);
|
||||
}
|
||||
ret = pthread_mutex_timedlock(&exm->watchdog_mutex,&wait);
|
||||
|
||||
|
||||
switch (ret) {
|
||||
@@ -564,6 +565,9 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
|
||||
return(0);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = pthread_mutex_lock(&exm->watchdog_mutex);
|
||||
|
||||
ts = exm->ts;
|
||||
if (exm->wait_first_read==1) {
|
||||
exm->wait_first_read=0;
|
||||
@@ -603,7 +607,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
|
||||
printf("back\n");
|
||||
#endif
|
||||
// get new timestamp, in case we have to sleep again
|
||||
pthread_mutex_timedlock(&exm->watchdog_mutex,&wait);
|
||||
pthread_mutex_lock(&exm->watchdog_mutex);
|
||||
ts = exm->ts;
|
||||
pthread_mutex_unlock(&exm->watchdog_mutex);
|
||||
if (old_ts == ts) {
|
||||
@@ -638,7 +642,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_timedlock(&exm->watchdog_mutex,&wait);
|
||||
pthread_mutex_lock(&exm->watchdog_mutex);
|
||||
exm->last_ts_rx += n;
|
||||
pthread_mutex_unlock(&exm->watchdog_mutex);
|
||||
if (n==n1) {
|
||||
@@ -712,6 +716,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
exmimo_id_t *p_exmimo_id;
|
||||
int ret;
|
||||
exmimo_state_t *exm = (exmimo_state_t *)malloc(sizeof(exmimo_state_t));
|
||||
int card,ant;
|
||||
|
||||
ret = openair0_open();
|
||||
|
||||
@@ -763,6 +768,13 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
device->priv = (void *)exm;
|
||||
|
||||
|
||||
printf("EXMIMO2: Getting addresses for memory-mapped DMA\n");
|
||||
for (card=0; card<openair0_num_detected_cards; card++) {
|
||||
for (ant=0; ant<4; ant++) {
|
||||
openair0_cfg[card].rxbase[ant] = (int32_t*)openair0_exmimo_pci[card].adc_head[ant];
|
||||
openair0_cfg[card].txbase[ant] = (int32_t*)openair0_exmimo_pci[card].dac_head[ant];
|
||||
}
|
||||
}
|
||||
|
||||
create_watchdog(device);
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ eNBs =
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
node_function = "eNodeB_3GPP";
|
||||
node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0;
|
||||
frame_type = "TDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
@@ -35,8 +38,8 @@ eNBs =
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 10; //25;
|
||||
rx_gain = 10; //20;
|
||||
tx_gain = 25;
|
||||
rx_gain = 120;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
|
||||
@@ -23,6 +23,9 @@ eNBs =
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
node_function = "eNodeB_3GPP";
|
||||
node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0;
|
||||
frame_type = "FDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
|
||||
@@ -998,12 +998,12 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
|
||||
|
||||
if (proc->first_rx == 0) {
|
||||
if (proc->subframe_rx != *subframe){
|
||||
LOG_E(PHY,"Received Timestamp doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d)\n",proc->subframe_rx,subframe);
|
||||
LOG_E(PHY,"Received Timestamp doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d)\n",proc->subframe_rx,*subframe);
|
||||
exit_fun("Exiting");
|
||||
}
|
||||
|
||||
if (proc->frame_rx != *frame) {
|
||||
LOG_E(PHY,"Received Timestamp doesn't correspond to the time we think it is (proc->frame_rx %d frame %d)\n",proc->frame_rx,frame);
|
||||
LOG_E(PHY,"Received Timestamp doesn't correspond to the time we think it is (proc->frame_rx %d frame %d)\n",proc->frame_rx,*frame);
|
||||
exit_fun("Exiting");
|
||||
}
|
||||
} else {
|
||||
@@ -1740,7 +1740,7 @@ void kill_eNB_proc(int inst) {
|
||||
Each rf chain is is addressed by the card number and the chain on the card. The
|
||||
rf_map specifies for each CC, on which rf chain the mapping should start. Multiple
|
||||
antennas are mapped to successive RF chains on the same card. */
|
||||
int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]) {
|
||||
int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg) {
|
||||
|
||||
int i, CC_id;
|
||||
int j;
|
||||
@@ -1808,17 +1808,17 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_rx; i++) {
|
||||
free(phy_vars_eNB[CC_id]->common_vars.rxdata[0][i]);
|
||||
rxdata[i] = (int32_t*)(32 + malloc16(32+openair0_cfg[rf_map[CC_id].card].samples_per_frame*sizeof(int32_t))); // FIXME broken memory allocation
|
||||
rxdata[i] = (int32_t*)(32 + malloc16(32+openair0_cfg[phy_vars_eNB[CC_id]->rf_map.card].samples_per_frame*sizeof(int32_t))); // FIXME broken memory allocation
|
||||
phy_vars_eNB[CC_id]->common_vars.rxdata[0][i] = rxdata[i]-N_TA_offset; // N_TA offset for TDD FIXME! N_TA_offset > 16 => access of unallocated memory
|
||||
memset(rxdata[i], 0, openair0_cfg[rf_map[CC_id].card].samples_per_frame*sizeof(int32_t));
|
||||
memset(rxdata[i], 0, openair0_cfg[phy_vars_eNB[CC_id]->rf_map.card].samples_per_frame*sizeof(int32_t));
|
||||
printf("rxdata[%d] @ %p (%p) (N_TA_OFFSET %d)\n", i, phy_vars_eNB[CC_id]->common_vars.rxdata[0][i],rxdata[i],N_TA_offset);
|
||||
}
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
|
||||
free(phy_vars_eNB[CC_id]->common_vars.txdata[0][i]);
|
||||
txdata[i] = (int32_t*)(32 + malloc16(32 + openair0_cfg[rf_map[CC_id].card].samples_per_frame*sizeof(int32_t))); // FIXME broken memory allocation
|
||||
txdata[i] = (int32_t*)(32 + malloc16(32 + openair0_cfg[phy_vars_eNB[CC_id]->rf_map.card].samples_per_frame*sizeof(int32_t))); // FIXME broken memory allocation
|
||||
phy_vars_eNB[CC_id]->common_vars.txdata[0][i] = txdata[i];
|
||||
memset(txdata[i],0, openair0_cfg[rf_map[CC_id].card].samples_per_frame*sizeof(int32_t));
|
||||
memset(txdata[i],0, openair0_cfg[phy_vars_eNB[CC_id]->rf_map.card].samples_per_frame*sizeof(int32_t));
|
||||
printf("txdata[%d] @ %p\n", i, phy_vars_eNB[CC_id]->common_vars.txdata[0][i]);
|
||||
}
|
||||
}
|
||||
@@ -2018,6 +2018,11 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
|
||||
}
|
||||
}
|
||||
|
||||
if (setup_eNB_buffers(PHY_vars_eNB_g[inst],&openair0_cfg[inst])!=0) {
|
||||
printf("Exiting, cannot initialize eNodeB Buffers\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
init_eNB_proc(inst);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,13 +118,13 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#endif
|
||||
|
||||
// In lte-enb.c
|
||||
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
|
||||
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg);
|
||||
extern void init_eNB(eNB_func_t *, eNB_timing_t *,int,eth_params_t *);
|
||||
extern void stop_eNB(int);
|
||||
extern void kill_eNB_proc(void);
|
||||
|
||||
// In lte-ue.c
|
||||
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
|
||||
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||
extern void fill_ue_band_info(void);
|
||||
extern void init_UE(int);
|
||||
|
||||
@@ -177,7 +177,6 @@ static char threequarter_fs=0;
|
||||
uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
openair0_rf_map rf_map[MAX_NUM_CCs];
|
||||
|
||||
static char *conf_config_file_name = NULL;
|
||||
#if defined(ENABLE_ITTI)
|
||||
@@ -272,10 +271,10 @@ int16_t osa_log_verbosity = LOG_MED;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ETHERNET
|
||||
|
||||
char *rrh_UE_ip = "127.0.0.1";
|
||||
int rrh_UE_port = 51000;
|
||||
#endif
|
||||
|
||||
|
||||
/* flag set by eNB conf file to specify if the radio head is local or remote (default option is local) */
|
||||
uint8_t local_remote_radio = BBU_LOCAL_RADIO_HEAD;
|
||||
@@ -1704,60 +1703,7 @@ int main( int argc, char **argv )
|
||||
mac_xface->mrbch_phy_sync_failure (0, 0, 0);
|
||||
}
|
||||
|
||||
number_of_cards = 1;
|
||||
|
||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
rf_map[CC_id].card=0;
|
||||
rf_map[CC_id].chain=CC_id+chain_offset;
|
||||
}
|
||||
|
||||
// connect the TX/RX buffers
|
||||
if (UE_flag==1) {
|
||||
|
||||
for (CC_id=0;CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
|
||||
#ifdef OAI_USRP
|
||||
UE[CC_id]->hw_timing_advance = timing_advance;
|
||||
#else
|
||||
UE[CC_id]->hw_timing_advance = 160;
|
||||
#endif
|
||||
}
|
||||
if (setup_ue_buffers(UE,&openair0_cfg[0],rf_map)!=0) {
|
||||
printf("Error setting up eNB buffer\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (input_fd) {
|
||||
printf("Reading in from file to antenna buffer %d\n",0);
|
||||
if (fread(UE[0]->common_vars.rxdata[0],
|
||||
sizeof(int32_t),
|
||||
frame_parms[0]->samples_per_tti*10,
|
||||
input_fd) != frame_parms[0]->samples_per_tti*10)
|
||||
printf("error reading from file\n");
|
||||
}
|
||||
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
if (setup_eNB_buffers(PHY_vars_eNB_g[0],&openair0_cfg[0],rf_map)!=0) {
|
||||
printf("Error setting up eNB buffer\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
printf("Setting eNB buffer to all-RX\n");
|
||||
|
||||
// Set LSBs for antenna switch (ExpressMIMO)
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
PHY_vars_eNB_g[0][CC_id]->hw_timing_advance = 0;
|
||||
for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++)
|
||||
for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
|
||||
PHY_vars_eNB_g[0][CC_id]->common_vars.txdata[0][aa][i] = 0x00010001;
|
||||
}
|
||||
}
|
||||
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
|
||||
@@ -1829,6 +1775,58 @@ int main( int argc, char **argv )
|
||||
if (UE_flag == 1) init_UE(1);
|
||||
else init_eNB(node_function,node_timing,1,eth_params);
|
||||
// Sleep to allow all threads to setup
|
||||
|
||||
number_of_cards = 1;
|
||||
|
||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
PHY_vars_eNB_g[0][CC_id]->rf_map.card=0;
|
||||
PHY_vars_eNB_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
|
||||
}
|
||||
|
||||
// connect the TX/RX buffers
|
||||
if (UE_flag==1) {
|
||||
|
||||
for (CC_id=0;CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
|
||||
#ifdef OAI_USRP
|
||||
UE[CC_id]->hw_timing_advance = timing_advance;
|
||||
#else
|
||||
UE[CC_id]->hw_timing_advance = 160;
|
||||
#endif
|
||||
}
|
||||
if (setup_ue_buffers(UE,&openair0_cfg[0])!=0) {
|
||||
printf("Error setting up eNB buffer\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (input_fd) {
|
||||
printf("Reading in from file to antenna buffer %d\n",0);
|
||||
if (fread(UE[0]->common_vars.rxdata[0],
|
||||
sizeof(int32_t),
|
||||
frame_parms[0]->samples_per_tti*10,
|
||||
input_fd) != frame_parms[0]->samples_per_tti*10)
|
||||
printf("error reading from file\n");
|
||||
}
|
||||
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
printf("Setting eNB buffer to all-RX\n");
|
||||
|
||||
// Set LSBs for antenna switch (ExpressMIMO)
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
PHY_vars_eNB_g[0][CC_id]->hw_timing_advance = 0;
|
||||
for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++)
|
||||
for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
|
||||
PHY_vars_eNB_g[0][CC_id]->common_vars.txdata[0][aa][i] = 0x00010001;
|
||||
}
|
||||
}
|
||||
sleep(3);
|
||||
|
||||
|
||||
|
||||
+41
-39
@@ -104,7 +104,6 @@ extern int sync_var;
|
||||
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
extern openair0_rf_map rf_map[MAX_NUM_CCs];
|
||||
extern int oai_exit;
|
||||
|
||||
extern int32_t **rxdata;
|
||||
@@ -1559,56 +1558,59 @@ void fill_ue_band_info(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs])
|
||||
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
|
||||
int i, CC_id;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
if (phy_vars_ue[CC_id]) {
|
||||
frame_parms = &(phy_vars_ue[CC_id]->frame_parms);
|
||||
} else {
|
||||
printf("phy_vars_UE[%d] not initialized\n", CC_id);
|
||||
return(-1);
|
||||
}
|
||||
openair0_rf_map *rf_map;
|
||||
|
||||
/*
|
||||
if (frame_parms->frame_type == TDD) {
|
||||
if (frame_parms->N_RB_DL == 100)
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
rf_map = &phy_vars_ue[CC_id]->rf_map;
|
||||
|
||||
if (phy_vars_ue[CC_id]) {
|
||||
frame_parms = &(phy_vars_ue[CC_id]->frame_parms);
|
||||
} else {
|
||||
printf("phy_vars_UE[%d] not initialized\n", CC_id);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
if (frame_parms->frame_type == TDD) {
|
||||
if (frame_parms->N_RB_DL == 100)
|
||||
N_TA_offset = 624;
|
||||
else if (frame_parms->N_RB_DL == 50)
|
||||
N_TA_offset = 624/2;
|
||||
N_TA_offset = 624/2;
|
||||
else if (frame_parms->N_RB_DL == 25)
|
||||
N_TA_offset = 624/4;
|
||||
}
|
||||
*/
|
||||
|
||||
N_TA_offset = 624/4;
|
||||
}
|
||||
*/
|
||||
|
||||
// replace RX signal buffers with mmaped HW versions
|
||||
rxdata = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
|
||||
txdata = (int32_t**)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t*) );
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_rx; i++) {
|
||||
printf( "Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map[CC_id].card, rf_map[CC_id].chain+i );
|
||||
free( phy_vars_ue[CC_id]->common_vars.rxdata[i] );
|
||||
rxdata = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
|
||||
txdata = (int32_t**)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t*) );
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_rx; i++) {
|
||||
printf( "Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map->card, rf_map->chain+i );
|
||||
free( phy_vars_ue[CC_id]->common_vars.rxdata[i] );
|
||||
rxdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
|
||||
phy_vars_ue[CC_id]->common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD
|
||||
printf("rxdata[%d] : %p\n",i,rxdata[i]);
|
||||
}
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
|
||||
printf( "Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map[CC_id].card, rf_map[CC_id].chain+i );
|
||||
free( phy_vars_ue[CC_id]->common_vars.txdata[i] );
|
||||
txdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
|
||||
phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i];
|
||||
printf("txdata[%d] : %p\n",i,txdata[i]);
|
||||
}
|
||||
|
||||
// rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.rxdata[x]
|
||||
// txdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.txdata[x]
|
||||
// be careful when releasing memory!
|
||||
// because no "release_ue_buffers"-function is available, at least rxdata and txdata memory will leak (only some bytes)
|
||||
|
||||
}
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
|
||||
printf( "Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map->card, rf_map->chain+i );
|
||||
free( phy_vars_ue[CC_id]->common_vars.txdata[i] );
|
||||
txdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
|
||||
phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i];
|
||||
printf("txdata[%d] : %p\n",i,txdata[i]);
|
||||
}
|
||||
|
||||
// rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.rxdata[x]
|
||||
// txdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.txdata[x]
|
||||
// be careful when releasing memory!
|
||||
// because no "release_ue_buffers"-function is available, at least rxdata and txdata memory will leak (only some bytes)
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user