Commit 4451d9a0 authored by Raymond Knopp's avatar Raymond Knopp

modifications for EXMIMO2 targets

parent 269bf61f
...@@ -43,10 +43,6 @@ ...@@ -43,10 +43,6 @@
#include "assertions.h" #include "assertions.h"
#include <math.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_map0_3[838];
extern uint16_t prach_root_sequence_map4[138]; extern uint16_t prach_root_sequence_map4[138];
uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10}; 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, ...@@ -672,7 +668,7 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
int CC_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]); 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 PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10;
//struct RadioResourceConfigCommonSCell_r10 *physicalConfigCommonSCell_r10 = sCellToAddMod_r10->radioResourceConfigCommonSCell_r10; //struct RadioResourceConfigCommonSCell_r10 *physicalConfigCommonSCell_r10 = sCellToAddMod_r10->radioResourceConfigCommonSCell_r10;
...@@ -682,13 +678,14 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id, ...@@ -682,13 +678,14 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
#ifdef EXMIMO #ifdef EXMIMO
#ifdef DRIVER2013 #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
#endif #endif
if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) { 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 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); 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 EXMIMO
#ifdef DRIVER2013 #ifdef DRIVER2013
//carrier_freq[CC_id] = carrier_freq_local; //carrier_freq[CC_id] = carrier_freq_local;
...@@ -700,11 +697,12 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id, ...@@ -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.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; p_exmimo_config->rf.rffe_band_mode[rf_map[CC_id].chain] = B19G_TDD;
#endif #endif
#endif #endif*/
} else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) { } 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 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 // 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); 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 EXMIMO
#ifdef DRIVER2013 #ifdef DRIVER2013
//carrier_freq[CC_id] = carrier_freq_local; //carrier_freq[CC_id] = carrier_freq_local;
...@@ -717,6 +715,7 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id, ...@@ -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; p_exmimo_config->rf.rffe_band_mode[rf_map[CC_id].chain] = DD_TDD;
#endif #endif
#endif #endif
*/
} else { } 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); 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 { ...@@ -363,6 +363,7 @@ typedef struct PHY_VARS_eNB_s {
eNB_proc_t proc; eNB_proc_t proc;
eNB_func_t node_function; eNB_func_t node_function;
eNB_timing_t node_timing; eNB_timing_t node_timing;
openair0_rf_map rf_map;
int abstraction_flag; int abstraction_flag;
void (*do_prach)(struct PHY_VARS_eNB_s *eNB); void (*do_prach)(struct PHY_VARS_eNB_s *eNB);
void (*fep)(struct PHY_VARS_eNB_s *eNB); void (*fep)(struct PHY_VARS_eNB_s *eNB);
...@@ -579,6 +580,8 @@ typedef struct { ...@@ -579,6 +580,8 @@ typedef struct {
uint8_t Mod_id; uint8_t Mod_id;
/// \brief Component carrier ID for this PHY instance /// \brief Component carrier ID for this PHY instance
uint8_t CC_id; uint8_t CC_id;
/// \brief Mapping of CC_id antennas to cards
openair0_rf_map rf_map;
//uint8_t local_flag; //uint8_t local_flag;
/// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach) /// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach)
runmode_t mode; runmode_t mode;
......
...@@ -1107,6 +1107,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1107,6 +1107,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
uint8_t smbv_alloc_cnt = 1; uint8_t smbv_alloc_cnt = 1;
#endif #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); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(subframe&1),1);
start_meas(&eNB->phy_proc_tx); start_meas(&eNB->phy_proc_tx);
...@@ -2582,11 +2584,14 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){ ...@@ -2582,11 +2584,14 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){
eNB_proc_t *proc = &eNB->proc; eNB_proc_t *proc = &eNB->proc;
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;
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 ); 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); 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 ...@@ -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 subframe = proc->subframe_rx;
const int frame = proc->frame_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 ); 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); start_meas(&eNB->phy_proc_rx);
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
......
...@@ -501,6 +501,7 @@ int trx_exmimo_start(openair0_device *device) { ...@@ -501,6 +501,7 @@ int trx_exmimo_start(openair0_device *device) {
printf("Starting ...\n"); printf("Starting ...\n");
openair0_config(device->openair0_cfg,0); openair0_config(device->openair0_cfg,0);
openair0_start_rt_acquisition(0); openair0_start_rt_acquisition(0);
printf("Setting state to running\n");
exm->daq_state = running; exm->daq_state = running;
exm->wait_first_read = 1; exm->wait_first_read = 1;
return(0); return(0);
...@@ -508,7 +509,8 @@ int trx_exmimo_start(openair0_device *device) { ...@@ -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) { 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 ...@@ -521,12 +523,12 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
struct timespec sleep_time; struct timespec sleep_time;
unsigned long tv_nsec; unsigned long tv_nsec;
int i; int i;
struct timespec wait;
int n,n1,n2,ntot,first_len; int n,n1,n2,ntot,first_len;
int ret; int ret;
wait.tv_sec=0; // struct timespec wait;
wait.tv_nsec=50000000L; // wait.tv_sec=0;
// wait.tv_nsec=50000000L;
if (exm->watchdog_exit == 1) if (exm->watchdog_exit == 1)
return(0); return(0);
...@@ -535,7 +537,6 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi ...@@ -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); tv_nsec=(unsigned long)((double)(nsamps)*1e9/cfg->sample_rate);
return(0); return(0);
} }
ret = pthread_mutex_timedlock(&exm->watchdog_mutex,&wait);
switch (ret) { switch (ret) {
...@@ -564,6 +565,9 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi ...@@ -564,6 +565,9 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
return(0); return(0);
break; break;
} }
ret = pthread_mutex_lock(&exm->watchdog_mutex);
ts = exm->ts; ts = exm->ts;
if (exm->wait_first_read==1) { if (exm->wait_first_read==1) {
exm->wait_first_read=0; exm->wait_first_read=0;
...@@ -603,7 +607,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi ...@@ -603,7 +607,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi
printf("back\n"); printf("back\n");
#endif #endif
// get new timestamp, in case we have to sleep again // 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; ts = exm->ts;
pthread_mutex_unlock(&exm->watchdog_mutex); pthread_mutex_unlock(&exm->watchdog_mutex);
if (old_ts == ts) { if (old_ts == ts) {
...@@ -638,7 +642,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi ...@@ -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; exm->last_ts_rx += n;
pthread_mutex_unlock(&exm->watchdog_mutex); pthread_mutex_unlock(&exm->watchdog_mutex);
if (n==n1) { if (n==n1) {
...@@ -712,6 +716,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -712,6 +716,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
exmimo_id_t *p_exmimo_id; exmimo_id_t *p_exmimo_id;
int ret; int ret;
exmimo_state_t *exm = (exmimo_state_t *)malloc(sizeof(exmimo_state_t)); exmimo_state_t *exm = (exmimo_state_t *)malloc(sizeof(exmimo_state_t));
int card,ant;
ret = openair0_open(); ret = openair0_open();
...@@ -763,6 +768,13 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -763,6 +768,13 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device->priv = (void *)exm; 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); create_watchdog(device);
......
...@@ -23,6 +23,9 @@ eNBs = ...@@ -23,6 +23,9 @@ eNBs =
component_carriers = ( component_carriers = (
{ {
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "TDD"; frame_type = "TDD";
tdd_config = 3; tdd_config = 3;
tdd_config_s = 0; tdd_config_s = 0;
...@@ -35,8 +38,8 @@ eNBs = ...@@ -35,8 +38,8 @@ eNBs =
Nid_cell_mbsfn = 0; Nid_cell_mbsfn = 0;
nb_antennas_tx = 1; nb_antennas_tx = 1;
nb_antennas_rx = 1; nb_antennas_rx = 1;
tx_gain = 10; //25; tx_gain = 25;
rx_gain = 10; //20; rx_gain = 120;
prach_root = 0; prach_root = 0;
prach_config_index = 0; prach_config_index = 0;
prach_high_speed = "DISABLE"; prach_high_speed = "DISABLE";
......
...@@ -23,6 +23,9 @@ eNBs = ...@@ -23,6 +23,9 @@ eNBs =
component_carriers = ( component_carriers = (
{ {
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD"; frame_type = "FDD";
tdd_config = 3; tdd_config = 3;
tdd_config_s = 0; tdd_config_s = 0;
......
...@@ -998,12 +998,12 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { ...@@ -998,12 +998,12 @@ void rx_rf(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,"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"); exit_fun("Exiting");
} }
if (proc->frame_rx != *frame) { 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"); exit_fun("Exiting");
} }
} else { } else {
...@@ -1740,7 +1740,7 @@ void kill_eNB_proc(int inst) { ...@@ -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 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 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. */ 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 i, CC_id;
int j; int j;
...@@ -1808,17 +1808,17 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c ...@@ -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++) { for (i=0; i<frame_parms->nb_antennas_rx; i++) {
free(phy_vars_eNB[CC_id]->common_vars.rxdata[0][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 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); 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++) { for (i=0; i<frame_parms->nb_antennas_tx; i++) {
free(phy_vars_eNB[CC_id]->common_vars.txdata[0][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]; 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]); 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 ...@@ -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); init_eNB_proc(inst);
} }
......
...@@ -118,13 +118,13 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -118,13 +118,13 @@ unsigned short config_frames[4] = {2,9,11,13};
#endif #endif
// In lte-enb.c // 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 init_eNB(eNB_func_t *, eNB_timing_t *,int,eth_params_t *);
extern void stop_eNB(int); extern void stop_eNB(int);
extern void kill_eNB_proc(void); extern void kill_eNB_proc(void);
// In lte-ue.c // 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 fill_ue_band_info(void);
extern void init_UE(int); extern void init_UE(int);
...@@ -177,7 +177,6 @@ static char threequarter_fs=0; ...@@ -177,7 +177,6 @@ static char threequarter_fs=0;
uint32_t downlink_frequency[MAX_NUM_CCs][4]; uint32_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[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; static char *conf_config_file_name = NULL;
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
...@@ -272,10 +271,10 @@ int16_t osa_log_verbosity = LOG_MED; ...@@ -272,10 +271,10 @@ int16_t osa_log_verbosity = LOG_MED;
#endif #endif
#ifdef ETHERNET
char *rrh_UE_ip = "127.0.0.1"; char *rrh_UE_ip = "127.0.0.1";
int rrh_UE_port = 51000; 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) */ /* 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; uint8_t local_remote_radio = BBU_LOCAL_RADIO_HEAD;
...@@ -1704,61 +1703,8 @@ int main( int argc, char **argv ) ...@@ -1704,61 +1703,8 @@ int main( int argc, char **argv )
mac_xface->mrbch_phy_sync_failure (0, 0, 0); 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); mlockall(MCL_CURRENT | MCL_FUTURE);
pthread_cond_init(&sync_cond,NULL); pthread_cond_init(&sync_cond,NULL);
...@@ -1829,6 +1775,58 @@ int main( int argc, char **argv ) ...@@ -1829,6 +1775,58 @@ int main( int argc, char **argv )
if (UE_flag == 1) init_UE(1); if (UE_flag == 1) init_UE(1);
else init_eNB(node_function,node_timing,1,eth_params); else init_eNB(node_function,node_timing,1,eth_params);
// Sleep to allow all threads to setup // 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); sleep(3);
......
...@@ -104,7 +104,6 @@ extern int sync_var; ...@@ -104,7 +104,6 @@ extern int sync_var;
extern openair0_config_t openair0_cfg[MAX_CARDS]; extern openair0_config_t openair0_cfg[MAX_CARDS];
extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[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 int oai_exit;
extern int32_t **rxdata; extern int32_t **rxdata;
...@@ -1559,56 +1558,59 @@ void fill_ue_band_info(void) ...@@ -1559,56 +1558,59 @@ void fill_ue_band_info(void)
} }
#endif #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; int i, CC_id;
LTE_DL_FRAME_PARMS *frame_parms; LTE_DL_FRAME_PARMS *frame_parms;
openair0_rf_map *rf_map;
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);
}
/* for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (frame_parms->frame_type == TDD) { rf_map = &phy_vars_ue[CC_id]->rf_map;
if (frame_parms->N_RB_DL == 100)
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; N_TA_offset = 624;
else if (frame_parms->N_RB_DL == 50) 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) 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 // replace RX signal buffers with mmaped HW versions
rxdata = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); rxdata = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
txdata = (int32_t**)malloc16( frame_parms->nb_antennas_tx*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++) { 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 ); 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] ); free( phy_vars_ue[CC_id]->common_vars.rxdata[i] );
rxdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); 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 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]); printf("rxdata[%d] : %p\n",i,rxdata[i]);
} }
for (i=0; i<frame_parms->nb_antennas_tx; 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 ); 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] ); free( phy_vars_ue[CC_id]->common_vars.txdata[i] );
txdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); txdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i]; phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i];
printf("txdata[%d] : %p\n",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] // 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] // txdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.txdata[x]
// be careful when releasing memory! // be careful when releasing memory!
// because no "release_ue_buffers"-function is available, at least rxdata and txdata memory will leak (only some bytes) // because no "release_ue_buffers"-function is available, at least rxdata and txdata memory will leak (only some bytes)
} }
return 0; return 0;
......
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