Commit 2d73a4a3 authored by Florian Kaltenberger's avatar Florian Kaltenberger

added functionality to map UEs and eNBs to different cards and RF chains

moved some functionality from device_init to dump_config in openair0 library


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5744 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 111c43ac
...@@ -40,6 +40,10 @@ typedef struct openair0_device_t openair0_device; ...@@ -40,6 +40,10 @@ typedef struct openair0_device_t openair0_device;
/* structrue holds the parameters to configure USRP devices /* structrue holds the parameters to configure USRP devices
*/ */
#ifdef USRP
#define MAX_CARDS 1
#endif
typedef enum { typedef enum {
max_gain=0,med_gain,byp_gain max_gain=0,med_gain,byp_gain
} rx_gain_t; } rx_gain_t;
...@@ -68,6 +72,15 @@ typedef struct { ...@@ -68,6 +72,15 @@ typedef struct {
double tx_bw; double tx_bw;
} openair0_config_t; } openair0_config_t;
typedef struct {
/* card id */
int card;
/* rf chain id */
int chain;
} openair0_rf_map;
struct openair0_device_t { struct openair0_device_t {
/* USRP RF frontend parameters set by application */ /* USRP RF frontend parameters set by application */
openair0_config_t openair0_cfg; openair0_config_t openair0_cfg;
......
...@@ -80,7 +80,6 @@ int openair0_open(void) ...@@ -80,7 +80,6 @@ int openair0_open(void)
int card; int card;
int ant; int ant;
int openair0_num_antennas[4];
PAGE_SHIFT = log2_int( sysconf( _SC_PAGESIZE ) ); PAGE_SHIFT = log2_int( sysconf( _SC_PAGESIZE ) );
...@@ -220,10 +219,12 @@ int openair0_close(void) ...@@ -220,10 +219,12 @@ int openair0_close(void)
return 0; return 0;
} }
/*
int openair0_dump_config(int card) int openair0_dump_config(int card)
{ {
return ioctl(openair0_fd, openair_DUMP_CONFIG, card); return ioctl(openair0_fd, openair_DUMP_CONFIG, card);
} }
*/
int openair0_get_frame(int card) int openair0_get_frame(int card)
{ {
...@@ -245,18 +246,15 @@ int openair0_stop_without_reset(int card) ...@@ -245,18 +246,15 @@ int openair0_stop_without_reset(int card)
return ioctl(openair0_fd, openair_STOP_WITHOUT_RESET, card); return ioctl(openair0_fd, openair_STOP_WITHOUT_RESET, card);
} }
static exmimo_config_t *p_exmimo_config;
static exmimo_id_t *p_exmimo_id;
#define MY_RF_MODE (RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX) #define MY_RF_MODE (RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX)
#define RF_MODE_BASE (LNA1ON +LNAMax + RFBBNORM) #define RF_MODE_BASE (LNA1ON +LNAMax + RFBBNORM)
int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) { int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
// Initialize card // Initialize card
exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
int ret; int ret;
int ant;
int resampling_factor=2;
int rx_filter=RXLPF25, tx_filter=TXLPF25;
ret = openair0_open(); ret = openair0_open();
...@@ -271,7 +269,12 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf ...@@ -271,7 +269,12 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
return(ret); return(ret);
} }
if (openair0_num_detected_cards>MAX_CARDS) {
printf ("Detected %d number of cards, but MAX_CARDS=%d\n", openair0_num_detected_cards, MAX_CARDS);
}
else {
printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[0]); printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[0]);
}
p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr; p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[0].exmimo_id_ptr; p_exmimo_id = openair0_exmimo_pci[0].exmimo_id_ptr;
...@@ -281,32 +284,50 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf ...@@ -281,32 +284,50 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
// check if the software matches firmware // check if the software matches firmware
if (p_exmimo_id->board_swrev!=BOARD_SWREV_CNTL2) { if (p_exmimo_id->board_swrev!=BOARD_SWREV_CNTL2) {
printf("Software revision %d and firmware revision %d do not match. Please update either the firmware or the software!\n",BOARD_SWREV_CNTL2,p_exmimo_id->board_swrev); printf("Software revision %d and firmware revision %d do not match. Please update either the firmware or the software!\n",BOARD_SWREV_CNTL2,p_exmimo_id->board_swrev);
exit(-1); return(-1);
} }
return(0);
}
int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag)
{
int ret;
int ant, card;
int resampling_factor=2;
int rx_filter=RXLPF25, tx_filter=TXLPF25;
exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
if (!openair0_cfg) { if (!openair0_cfg) {
printf("Error, openair0_cfg is null!!\n"); printf("Error, openair0_cfg is null!!\n");
return(-1); return(-1);
} }
for (card=0; card<openair0_num_detected_cards; card++) {
p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr;
if (p_exmimo_id->board_swrev>=9) if (p_exmimo_id->board_swrev>=9)
p_exmimo_config->framing.eNB_flag = 0; p_exmimo_config->framing.eNB_flag = 0;
else else
p_exmimo_config->framing.eNB_flag = 1;//!UE_flag; p_exmimo_config->framing.eNB_flag = !UE_flag;
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB; p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
if (openair0_cfg->sample_rate==30.72e6) { if (openair0_cfg[card].sample_rate==30.72e6) {
resampling_factor = 0; resampling_factor = 0;
rx_filter = RXLPF10; rx_filter = RXLPF10;
tx_filter = TXLPF10; tx_filter = TXLPF10;
} }
else if (openair0_cfg->sample_rate==15.36e6) { else if (openair0_cfg[card].sample_rate==15.36e6) {
resampling_factor = 1; resampling_factor = 1;
rx_filter = RXLPF5; rx_filter = RXLPF5;
tx_filter = TXLPF5; tx_filter = TXLPF5;
} }
else if (openair0_cfg->sample_rate==7.68e6) { else if (openair0_cfg[card].sample_rate==7.68e6) {
resampling_factor = 2; resampling_factor = 2;
rx_filter = RXLPF25; rx_filter = RXLPF25;
tx_filter = TXLPF25; tx_filter = TXLPF25;
...@@ -326,45 +347,42 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf ...@@ -326,45 +347,42 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
p_exmimo_config->framing.resampling_factor = resampling_factor; p_exmimo_config->framing.resampling_factor = resampling_factor;
#endif #endif
for (ant=0;ant<max(openair0_cfg->tx_num_channels,openair0_cfg->rx_num_channels);ant++) for (ant=0;ant<4;ant++) {
if (openair0_cfg[card].rx_freq[ant] || openair0_cfg[card].tx_freq[ant]) {
p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE; p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE;
for (ant=0;ant<openair0_cfg->tx_num_channels;ant++) p_exmimo_config->rf.do_autocal[ant] = 1;
}
if (openair0_cfg[card].tx_freq[ant]) {
p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX + TXLPFNORM + TXLPFEN + tx_filter); p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX + TXLPFNORM + TXLPFEN + tx_filter);
for (ant=0;ant<openair0_cfg->rx_num_channels;ant++) { p_exmimo_config->rf.rf_freq_tx[ant] = (unsigned int)openair0_cfg[card].tx_freq[ant];
p_exmimo_config->rf.tx_gain[ant][0] = (unsigned int)openair0_cfg[card].tx_gain[ant];
printf("openair0 : programming TX antenna %d (freq %u, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_tx[ant],p_exmimo_config->rf.tx_gain[ant][0]);
}
if (openair0_cfg[card].rx_freq[ant]) {
p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX + RXLPFNORM + RXLPFEN + rx_filter); p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX + RXLPFNORM + RXLPFEN + rx_filter);
switch (openair0_cfg->rxg_mode[ant]) {
p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant];
p_exmimo_config->rf.rx_gain[ant][0] = (unsigned int)openair0_cfg[card].rx_gain[ant];
printf("openair0 : programming RX antenna %d (freq %u, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_rx[ant],p_exmimo_config->rf.rx_gain[ant][0]);
switch (openair0_cfg[card].rxg_mode[ant]) {
default: default:
case max_gain: case max_gain:
p_exmimo_config->rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMax; p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMax;
break; break;
case med_gain: case med_gain:
p_exmimo_config->rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMed; p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMed;
break; break;
case byp_gain: case byp_gain:
p_exmimo_config->rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAByp; p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAByp;
break; break;
} }
} }
for (ant=max(openair0_cfg->tx_num_channels,openair0_cfg->rx_num_channels);ant<4;ant++) { else {
p_exmimo_config->rf.rf_mode[ant] = 0; p_exmimo_config->rf.rf_mode[ant] = 0;
p_exmimo_config->rf.do_autocal[ant] = 0;
} }
for (ant = 0; ant<openair0_cfg->rx_num_channels; ant++) {
p_exmimo_config->rf.do_autocal[ant] = 1;
p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg->rx_freq[ant];
p_exmimo_config->rf.rx_gain[ant][0] = (unsigned int)openair0_cfg->rx_gain[ant];
printf("openair0 : programming RX antenna %d (freq %d, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_rx[ant],p_exmimo_config->rf.rx_gain[ant][0]);
}
for (ant = 0; ant<openair0_cfg->tx_num_channels; ant++) {
p_exmimo_config->rf.rf_freq_tx[ant] = (unsigned int)openair0_cfg->tx_freq[ant];
p_exmimo_config->rf.tx_gain[ant][0] = (unsigned int)openair0_cfg->tx_gain[ant];
printf("openair0 : programming TX antenna %d (freq %d, gain %d)\n",ant,p_exmimo_config->rf.rf_freq_tx[ant],p_exmimo_config->rf.tx_gain[ant][0]);
}
p_exmimo_config->rf.rf_local[ant] = rf_local[ant];
p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant];
for (ant=0;ant<4;ant++) {
p_exmimo_config->rf.rf_local[ant] = rf_local[ant]; p_exmimo_config->rf.rf_local[ant] = rf_local[ant];
p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant]; p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant];
...@@ -382,6 +400,12 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf ...@@ -382,6 +400,12 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
} }
} }
ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card);
if (ret!=0)
return(-1);
}
return(0); return(0);
} }
......
...@@ -63,7 +63,8 @@ int openair0_close(void); ...@@ -63,7 +63,8 @@ int openair0_close(void);
// trigger config update on card // trigger config update on card
// return 0 on success // return 0 on success
int openair0_dump_config(int card); int openair0_dump_config(openair0_config_t *openair0_cfg, int UE_flag);
//int openair0_dump_config(int card);
// triggers recording of exactly 1 frame // triggers recording of exactly 1 frame
// in case of synchronized multiple cards, send this only to the master card // in case of synchronized multiple cards, send this only to the master card
......
...@@ -6,16 +6,13 @@ msg_many:lxrt+sem+mbx+msg+fifos:!sudo ./msg_test;sleep 1;popall:control_c ...@@ -6,16 +6,13 @@ msg_many:lxrt+sem+mbx+msg+fifos:!sudo ./msg_test;sleep 1;popall:control_c
eNB:lxrt+sem+mbx+msg+fifos:!sudo ./synctest;sleep 1;popall:control_c eNB:lxrt+sem+mbx+msg+fifos:!sudo ./synctest;sleep 1;popall:control_c
eNB_test:lxrt+sem+mbx+msg+smi:!sudo ./lte-softmodem -S -F enb2tx;sleep 1;popall:control_c eNB_test:lxrt+sem+mbx+msg+smi:!sudo ./lte-softmodem -S -F enb2tx;sleep 1;popall:control_c
UE:lxrt+sem+mbx+msg+fifos:!sudo ./synctest -U -d -T 108;sleep 1;popall:control_c UE:lxrt+sem+mbx+msg+fifos:!sudo ./synctest -U -d -T 108;sleep 1;popall:control_c
#UE0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907602944 -V;sleep 1;popall:control_c
#EXMIMO2 card 1
#UE0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600480 -V;sleep 1;popall:control_c
UE0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600480 -V -K /tmp/itti_UE0.log;sleep 1;popall:control_c UE0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600480 -V -K /tmp/itti_UE0.log;sleep 1;popall:control_c
#EXMIMO2 card 5 #EXMIMO2 card 5
#UE0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907597240 -V;sleep 1;popall:control_c #UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907598252 -V;sleep 1;popall:control_c
#EXMIMO2 card 24 #EXMIMO2 card 24
#UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907595776 -V;sleep 1;popall:control_c #UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907595776 -V;sleep 1;popall:control_c
#EXMIMO2 card 5? #EXMIMO2 card 38
UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907598252 -V;sleep 1;popall:control_c UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907592704 -V;sleep 1;popall:control_c
UE850:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 859498000 -F ex2_850;sleep 1;popall:control_c UE850:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 859498000 -F ex2_850;sleep 1;popall:control_c
eNB850:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -d -C 859500000 -F ex2_850;sleep 1;popall:control_c eNB850:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -d -C 859500000 -F ex2_850;sleep 1;popall:control_c
UE0noL2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600480 --no-L2-connect;sleep 1;popall:control_c UE0noL2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600480 --no-L2-connect;sleep 1;popall:control_c
...@@ -31,9 +28,9 @@ UE2prach:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue2 ...@@ -31,9 +28,9 @@ UE2prach:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue2
UE2noL2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue2 --no-L2-connect;sleep 1;popall:control_c UE2noL2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue2 --no-L2-connect;sleep 1;popall:control_c
#eNB0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907600000 -d -V;sleep 1;popall:control_c #eNB0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907600000 -d -V;sleep 1;popall:control_c
#eNB0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907598252 -d -V;sleep 1;popall:control_c #eNB0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907598252 -d -V;sleep 1;popall:control_c
eNB0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -d -O../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf -V -K /tmp/itti_eNB0.log;sleep 1;popall:control_c eNB0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -d -O../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.conf -V -K /tmp/itti_eNB0.log;sleep 1;popall:control_c
eNB1:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907600000 -F ex2_2 -d;sleep 1;popall:control_c eNB1:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 2680000000 -r 50 -d -V;sleep 1;popall:control_c
eNB2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907600000 -F ue2 -d;sleep 1;popall:control_c eNB2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 2680000000 -r 100 -d -V;sleep 1;popall:control_c
dot11:lxrt+sem+mbx+msg+fifos:!sudo ./dot11 -C 1907600000 -d;sleep 1;popall:control_c dot11:lxrt+sem+mbx+msg+fifos:!sudo ./dot11 -C 1907600000 -d;sleep 1;popall:control_c
dot11_tx_test: lxrt+sem+mbx+msg+fifos:!sudo ./dot11 -C 1907600000 -d -t;sleep 1;popall:control_c dot11_tx_test: lxrt+sem+mbx+msg+fifos:!sudo ./dot11 -C 1907600000 -d -t;sleep 1;popall:control_c
eNB2_750:lxrt+sem+mbx+msg+fifos:!sudo ./synctest_eNB -C 746000000 -F enb1tx_750 -d;sleep 1;popall:control_c eNB2_750:lxrt+sem+mbx+msg+fifos:!sudo ./synctest_eNB -C 746000000 -F enb1tx_750 -d;sleep 1;popall:control_c
......
...@@ -132,7 +132,8 @@ OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o ...@@ -132,7 +132,8 @@ OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1 CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
endif endif
RTAI_OBJ += $(UTILS_OBJS) #RTAI_
OBJ += $(UTILS_OBJS)
......
...@@ -146,11 +146,12 @@ void cleanup_dlsch_threads(void); ...@@ -146,11 +146,12 @@ void cleanup_dlsch_threads(void);
int32_t init_rx_pdsch_thread(void); int32_t init_rx_pdsch_thread(void);
void cleanup_rx_pdsch_thread(void); void cleanup_rx_pdsch_thread(void);
openair0_config_t openair0_cfg[MAX_CARDS];
int32_t *rxdata; int32_t *rxdata;
int32_t *txdata; int32_t *txdata;
void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier); int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier); int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
#ifdef XFORMS #ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
...@@ -223,9 +224,9 @@ static int time_offset[4] = {0,0,0,0}; ...@@ -223,9 +224,9 @@ static int time_offset[4] = {0,0,0,0};
static char UE_flag=0; static char UE_flag=0;
static uint8_t eNB_id=0,UE_id=0; static uint8_t eNB_id=0,UE_id=0;
uint32_t carrier_freq[4] = {1907600000,1907600000,1907600000,1907600000}; /* For UE! */ uint32_t carrier_freq[MAX_NUM_CCs][4] = {{1907600000,1907600000,1907600000,1907600000}}; /* For UE! */
static uint32_t downlink_frequency[4] = {1907600000,1907600000,1907600000,1907600000}; static uint32_t downlink_frequency[MAX_NUM_CCs][4] = {{1907600000,1907600000,1907600000,1907600000}};
static int32_t uplink_frequency_offset[4]= {-120000000,-120000000,-120000000,-120000000}; static int32_t uplink_frequency_offset[MAX_NUM_CCs][4]= {{-120000000,-120000000,-120000000,-120000000}};
static char *conf_config_file_name = NULL; static char *conf_config_file_name = NULL;
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
...@@ -1025,7 +1026,7 @@ static void * eNB_thread_rx(void *param) { ...@@ -1025,7 +1026,7 @@ static void * eNB_thread_rx(void *param) {
void init_eNB_proc() { void init_eNB_proc(void) {
int i; int i;
int CC_id; int CC_id;
...@@ -1085,7 +1086,7 @@ void init_eNB_proc() { ...@@ -1085,7 +1086,7 @@ void init_eNB_proc() {
} }
} }
void kill_eNB_proc() { void kill_eNB_proc(void) {
int i; int i;
int *status_tx,*status_rx; int *status_tx,*status_rx;
...@@ -1491,7 +1492,7 @@ static void *UE_thread(void *arg) { ...@@ -1491,7 +1492,7 @@ static void *UE_thread(void *arg) {
int i, ret; int i, ret;
volatile unsigned int *DAQ_MBOX = openair0_daq_cnt(); volatile unsigned int *DAQ_MBOX = openair0_daq_cnt();
#ifndef USRP #ifndef USRP
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;; //exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;;
#endif #endif
...@@ -1657,14 +1658,14 @@ static void *UE_thread(void *arg) { ...@@ -1657,14 +1658,14 @@ static void *UE_thread(void *arg) {
else { else {
LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",openair_daq_vars.freq_offset); LOG_I(PHY,"[initial_sync] trying carrier off %d Hz\n",openair_daq_vars.freq_offset);
#ifndef USRP #ifndef USRP
for (i=0; i<4; i++) { for (card=0;card<MAX_CARDS;card++) {
if (p_exmimo_config->rf.rf_freq_rx[i]) for (i=0; i<openair0_cfg[card].rx_num_channels; i++) {
p_exmimo_config->rf.rf_freq_rx[i] = carrier_freq[i]+openair_daq_vars.freq_offset; openair0_cfg[card].rx_freq[i] = carrier_freq[card][i]+openair_daq_vars.freq_offset;
if (p_exmimo_config->rf.rf_freq_tx[i]) openair0_cfg[card].tx_freq[i] = carrier_freq[card][i]+openair_daq_vars.freq_offset;
p_exmimo_config->rf.rf_freq_tx[i] = carrier_freq[i]+openair_daq_vars.freq_offset; }
} }
openair0_dump_config(&openair0_cfg[0],UE_flag);
#endif #endif
openair0_dump_config(card);
rt_sleep_ns(FRAME_PERIOD); rt_sleep_ns(FRAME_PERIOD);
} }
} }
...@@ -1772,15 +1773,17 @@ static void get_options (int argc, char **argv) { ...@@ -1772,15 +1773,17 @@ static void get_options (int argc, char **argv) {
multi_thread=0; multi_thread=0;
break; break;
case 'C': case 'C':
downlink_frequency[0] = atof(optarg); // Use float to avoid issue with frequency over 2^31. for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
downlink_frequency[1] = downlink_frequency[0]; downlink_frequency[CC_id][0] = atof(optarg); // Use float to avoid issue with frequency over 2^31.
downlink_frequency[2] = downlink_frequency[0]; downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
downlink_frequency[3] = downlink_frequency[0]; downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
carrier_freq[0] = downlink_frequency[0]; downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
carrier_freq[1] = downlink_frequency[1]; carrier_freq[CC_id][0] = downlink_frequency[CC_id][0];
carrier_freq[2] = downlink_frequency[2]; carrier_freq[CC_id][1] = downlink_frequency[CC_id][1];
carrier_freq[3] = downlink_frequency[3]; carrier_freq[CC_id][2] = downlink_frequency[CC_id][2];
printf("Downlink frequency set to %u\n", downlink_frequency[0]); carrier_freq[CC_id][3] = downlink_frequency[CC_id][3];
}
printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
break; break;
case 'd': case 'd':
...@@ -1909,12 +1912,15 @@ static void get_options (int argc, char **argv) { ...@@ -1909,12 +1912,15 @@ static void get_options (int argc, char **argv) {
// adjust the log // adjust the log
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (k = 0 ; k < (sizeof(downlink_frequency) / sizeof (downlink_frequency[0])); k++) { for (k = 0 ; k < 4; k++) {
downlink_frequency[k] = enb_properties->properties[i]->downlink_frequency[0]; downlink_frequency[CC_id][k] = enb_properties->properties[i]->downlink_frequency[CC_id];
printf("Downlink frequency set to %u\n", downlink_frequency[k]); uplink_frequency_offset[CC_id][k] = enb_properties->properties[i]->uplink_frequency_offset[CC_id];
uplink_frequency_offset[k] = enb_properties->properties[i]->uplink_frequency_offset[0]; }
} // k printf("Downlink frequency/ uplink offset of CC_id %d set to %llu/%d\n", CC_id,
enb_properties->properties[i]->downlink_frequency[CC_id],
enb_properties->properties[i]->uplink_frequency_offset[CC_id]);
} // CC_id
}// i }// i
} }
} }
...@@ -1954,7 +1960,8 @@ int main(int argc, char **argv) { ...@@ -1954,7 +1960,8 @@ int main(int argc, char **argv) {
#if defined (EMOS) || (! defined (RTAI)) #if defined (EMOS) || (! defined (RTAI))
int error_code; int error_code;
#endif #endif
openair0_config_t openair0_cfg;
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
set_latency_target(); set_latency_target();
...@@ -2159,17 +2166,17 @@ int main(int argc, char **argv) { ...@@ -2159,17 +2166,17 @@ int main(int argc, char **argv) {
if ((mode == normal_txrx) || (mode == rx_calib_ue) || (mode == no_L2_connect) || (mode == debug_prach)) { if ((mode == normal_txrx) || (mode == rx_calib_ue) || (mode == no_L2_connect) || (mode == debug_prach)) {
for (i=0;i<4;i++) for (i=0;i<4;i++)
openair0_cfg.rxg_mode[i] = max_gain; openair0_cfg[CC_id].rxg_mode[i] = max_gain;
PHY_vars_UE_g[CC_id][0]->rx_total_gain_dB = PHY_vars_UE_g[CC_id][0]->rx_gain_max[0] + (int)rx_gain - 30; //-30 because it was calibrated with a 30dB gain PHY_vars_UE_g[CC_id][0]->rx_total_gain_dB = PHY_vars_UE_g[CC_id][0]->rx_gain_max[0] + (int)rx_gain - 30; //-30 because it was calibrated with a 30dB gain
} }
else if ((mode == rx_calib_ue_med)) { else if ((mode == rx_calib_ue_med)) {
for (i=0;i<4;i++) for (i=0;i<4;i++)
openair0_cfg.rxg_mode[i] = med_gain; openair0_cfg[CC_id].rxg_mode[i] = med_gain;
PHY_vars_UE_g[CC_id][0]->rx_total_gain_dB = PHY_vars_UE_g[CC_id][0]->rx_gain_med[0] + (int)rx_gain - 30; //-30 because it was calibrated with a 30dB gain; PHY_vars_UE_g[CC_id][0]->rx_total_gain_dB = PHY_vars_UE_g[CC_id][0]->rx_gain_med[0] + (int)rx_gain - 30; //-30 because it was calibrated with a 30dB gain;
} }
else if ((mode == rx_calib_ue_byp)) { else if ((mode == rx_calib_ue_byp)) {
for (i=0;i<4;i++) for (i=0;i<4;i++)
openair0_cfg.rxg_mode[i] = byp_gain; openair0_cfg[CC_id].rxg_mode[i] = byp_gain;
PHY_vars_UE_g[CC_id][0]->rx_total_gain_dB = PHY_vars_UE_g[CC_id][0]->rx_gain_byp[0] + (int)rx_gain - 30; //-30 because it was calibrated with a 30dB gain; PHY_vars_UE_g[CC_id][0]->rx_total_gain_dB = PHY_vars_UE_g[CC_id][0]->rx_gain_byp[0] + (int)rx_gain - 30; //-30 because it was calibrated with a 30dB gain;
} }
...@@ -2214,6 +2221,9 @@ int main(int argc, char **argv) { ...@@ -2214,6 +2221,9 @@ int main(int argc, char **argv) {
PHY_vars_eNB_g[0][CC_id]->rx_total_gain_eNB_dB = rxg_max[0] + (int)rx_gain - 30; //was measured at rxgain=30; PHY_vars_eNB_g[0][CC_id]->rx_total_gain_eNB_dB = rxg_max[0] + (int)rx_gain - 30; //was measured at rxgain=30;
// set eNB to max gain
for (i=0;i<4;i++)
openair0_cfg[CC_id].rxg_mode[i] = max_gain;
} }
NB_eNB_INST=1; NB_eNB_INST=1;
NB_INST=1; NB_INST=1;
...@@ -2223,9 +2233,6 @@ int main(int argc, char **argv) { ...@@ -2223,9 +2233,6 @@ int main(int argc, char **argv) {
openair_daq_vars.ue_ul_nb_rb=6; openair_daq_vars.ue_ul_nb_rb=6;
openair_daq_vars.target_ue_ul_mcs=6; openair_daq_vars.target_ue_ul_mcs=6;
// set eNB to max gain
for (i=0;i<4;i++)
openair0_cfg.rxg_mode[i] = max_gain;
} }
...@@ -2267,34 +2274,25 @@ int main(int argc, char **argv) { ...@@ -2267,34 +2274,25 @@ int main(int argc, char **argv) {
#endif #endif
} }
mac_xface = malloc(sizeof(MAC_xface));
openair0_cfg.sample_rate = sample_rate;
openair0_cfg.tx_num_channels = frame_parms[0]->nb_antennas_tx;
openair0_cfg.rx_num_channels = frame_parms[0]->nb_antennas_rx;
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
openair0_cfg[CC_id].sample_rate = sample_rate;
openair0_cfg[CC_id].tx_bw = bw;
openair0_cfg[CC_id].rx_bw = bw;
for (i=0;i<4;i++) { for (i=0;i<4;i++) {
if (UE_flag==1) { openair0_cfg[CC_id].tx_gain[i] = tx_gain;
openair0_cfg.tx_freq[i] = downlink_frequency[i]+uplink_frequency_offset[i]; openair0_cfg[CC_id].rx_gain[i] = rx_gain;
openair0_cfg.rx_freq[i] = downlink_frequency[i];
}
else {
openair0_cfg.rx_freq[i] = downlink_frequency[i]+uplink_frequency_offset[i];
openair0_cfg.tx_freq[i] = downlink_frequency[i];
}
} }
openair0_cfg.tx_bw = bw;
openair0_cfg.rx_bw = bw;
for (i=0;i<4;i++) {
openair0_cfg.tx_gain[i] = tx_gain;
openair0_cfg.rx_gain[i] = rx_gain;
} }
if (openair0_device_init(&openair0, &openair0_cfg) <0) { if (openair0_device_init(&openair0, &openair0_cfg[0]) <0) {
printf("Exiting, cannot initialize device\n"); printf("Exiting, cannot initialize device\n");
exit(-1); exit(-1);
} }
mac_xface = malloc(sizeof(MAC_xface));
#ifdef OPENAIR2 #ifdef OPENAIR2
int eMBMS_active=0; int eMBMS_active=0;
...@@ -2338,30 +2336,37 @@ int main(int argc, char **argv) { ...@@ -2338,30 +2336,37 @@ int main(int argc, char **argv) {
openair_daq_vars.timing_advance = 0; openair_daq_vars.timing_advance = 0;
openair0_rf_map rf_map[MAX_NUM_CCs];
rf_map[0].card=0;
rf_map[0].chain=1;
// connect the TX/RX buffers // connect the TX/RX buffers
if (UE_flag==1) { if (UE_flag==1) {
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) { setup_ue_buffers(PHY_vars_UE_g[0],&openair0_cfg[0],rf_map);
setup_ue_buffers(PHY_vars_UE_g[CC_id][0],frame_parms[CC_id],ant_offset);
printf("Setting UE buffer to all-RX\n"); printf("Setting UE buffer to all-RX\n");
// Set LSBs for antenna switch (ExpressMIMO) // Set LSBs for antenna switch (ExpressMIMO)
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++) 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++) for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
PHY_vars_UE_g[CC_id][0]->lte_ue_common_vars.txdata[aa][i] = 0x00010001; PHY_vars_UE_g[0][CC_id]->lte_ue_common_vars.txdata[aa][i] = 0x00010001;
} }
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX; //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
} }
else { else {
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) { if (setup_eNB_buffers(PHY_vars_eNB_g[0],&openair0_cfg[0],rf_map)!=0) {
setup_eNB_buffers(PHY_vars_eNB_g[CC_id][0],frame_parms[CC_id],ant_offset); printf("Error setting up eNB buffer\n");
exit(-1);
}
printf("Setting eNB buffer to all-RX\n"); printf("Setting eNB buffer to all-RX\n");
// Set LSBs for antenna switch (ExpressMIMO) // Set LSBs for antenna switch (ExpressMIMO)
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++) 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++) for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
PHY_vars_eNB_g[CC_id][0]->lte_eNB_common_vars.txdata[0][aa][i] = 0x00010001; PHY_vars_eNB_g[0][CC_id]->lte_eNB_common_vars.txdata[0][aa][i] = 0x00010001;
} }
} }
#ifndef USRP #ifndef USRP
openair0_dump_config(card); openair0_dump_config(&openair0_cfg[0],UE_flag);
#endif #endif
/* /*
...@@ -2652,109 +2657,158 @@ int main(int argc, char **argv) { ...@@ -2652,109 +2657,158 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier) { int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs])
{
int i;
#ifndef USRP #ifndef USRP
if (phy_vars_ue) { int i, CC_id;
if ((frame_parms[0]->nb_antennas_rx>1) && (carrier>0)) { LTE_DL_FRAME_PARMS *frame_parms;
printf("RX antennas > 1 and carrier > 0 not possible\n"); for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
exit(-1); if (phy_vars_ue[CC_id]) {
frame_parms = &(phy_vars_ue[CC_id]->lte_frame_parms);
} }
else {
if ((frame_parms[0]->nb_antennas_tx>1) && (carrier>0)) { printf("phy_vars_eNB[%d] not initialized\n", CC_id);
printf("TX antennas > 1 and carrier > 0 not possible\n"); return(-1);
exit(-1);
} }
// replace RX signal buffers with mmaped HW versions openair0_cfg[CC_id].tx_num_channels = 0;
for (i=0;i<frame_parms[0]->nb_antennas_rx;i++) { openair0_cfg[CC_id].rx_num_channels = 0;
free(phy_vars_ue->lte_ue_common_vars.rxdata[i]);
phy_vars_ue->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
// replace RX signal buffers with mmaped HW versions
for (i=0;i<frame_parms->nb_antennas_rx;i++) {
printf("Mapping eNB 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]->lte_ue_common_vars.rxdata[i]);
phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].adc_head[rf_map[CC_id].chain+i];
if (openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i]) {
printf("Error with rf_map! A channel has already been allocated!\n");
return(-1);
}
else {
openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i];
openair0_cfg[rf_map[CC_id].card].rx_num_channels++;
}
printf("rxdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.rxdata[i]); printf("rxdata[%d] @ %p\n",i,phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i]);
}
for (i=0;i<frame_parms->nb_antennas_tx;i++) {
printf("Mapping eNB 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]->lte_ue_common_vars.txdata[i]);
phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].dac_head[rf_map[CC_id].chain+i];
if (openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i]) {
printf("Error with rf_map! A channel has already been allocated!\n");
return(-1);
}
else {
openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i];
openair0_cfg[rf_map[CC_id].card].tx_num_channels++;
} }
for (i=0;i<frame_parms[0]->nb_antennas_tx;i++) {
free(phy_vars_ue->lte_ue_common_vars.txdata[i]);
phy_vars_ue->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
printf("txdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.txdata[i]); printf("txdata[%d] @ %p\n",i,phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i]);
} }
} }
return(0);
#else #else
printf("USRP not supported for UE yet!"); printf("USRP not supported for UE yet!");
return(-1);
#endif #endif
} }
void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier) { /* this function maps the phy_vars_eNB tx and rx buffers to the available rf chains.
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 i; int i, CC_id;
#ifdef USRP #ifdef USRP
uint16_t N_TA_offset = 0; uint16_t N_TA_offset = 0;
#else #else
int j; int j;
#endif #endif
LTE_DL_FRAME_PARMS *frame_parms;
if (phy_vars_eNB) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if ((frame_parms[0].nb_antennas_rx>1) && (carrier>0)) { if (phy_vars_eNB[CC_id]) {
printf("RX antennas > 1 and carrier > 0 not possible\n"); frame_parms = &(phy_vars_eNB[CC_id]->lte_frame_parms);
exit(-1);
} }
else {
if ((frame_parms[0].nb_antennas_tx>1) && (carrier>0)) { printf("phy_vars_eNB[%d] not initialized\n", CC_id);
printf("TX antennas > 1 and carrier > 0 not possible\n"); return(-1);
exit(-1);
} }
#ifdef USRP #ifdef USRP
if (frame_parms[0].frame_type == TDD) { if (frame_parms->frame_type == TDD) {
if (phy_vars_eNB->lte_frame_parms.N_RB_DL == 100) if (frame_parms->N_RB_DL == 100)
N_TA_offset = 624; N_TA_offset = 624;
else if (phy_vars_eNB->lte_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 (phy_vars_eNB->lte_frame_parms.N_RB_DL == 25) else if (frame_parms->N_RB_DL == 25)
N_TA_offset = 624/4; N_TA_offset = 624/4;
} }
#endif #endif
openair0_cfg[CC_id].tx_num_channels = 0;
openair0_cfg[CC_id].rx_num_channels = 0;
// replace RX signal buffers with mmaped HW versions // replace RX signal buffers with mmaped HW versions
#ifndef USRP #ifndef USRP
for (i=0;i<frame_parms[0]->nb_antennas_rx;i++) { for (i=0;i<frame_parms->nb_antennas_rx;i++) {
free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]); printf("Mapping eNB CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i);
phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier]; free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]);
phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].adc_head[rf_map[CC_id].chain+i];
printf("rxdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]); if (openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i]) {
printf("Error with rf_map! A channel has already been allocated!\n");
return(-1);
}
else {
openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i];
openair0_cfg[rf_map[CC_id].card].rx_num_channels++;
}
printf("rxdata[%d] @ %p\n",i,phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]);
for (j=0;j<16;j++) { for (j=0;j<16;j++) {
printf("rxbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j]); printf("rxbuffer %d: %x\n",j,phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i][j]);
phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j] = 16-j; phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i][j] = 16-j;
} }
} }
for (i=0;i<frame_parms[0]->nb_antennas_tx;i++) { for (i=0;i<frame_parms->nb_antennas_tx;i++) {
free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]); printf("Mapping eNB 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);
phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier]; free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]);
phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].dac_head[rf_map[CC_id].chain+i];
if (openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i]) {
printf("Error with rf_map! A channel has already been allocated!\n");
return(-1);
}
else {
openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i];
openair0_cfg[rf_map[CC_id].card].tx_num_channels++;
}
printf("txdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]); printf("txdata[%d] @ %p\n",i,phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]);
for (j=0;j<16;j++) { for (j=0;j<16;j++) {
printf("txbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j]); printf("txbuffer %d: %x\n",j,phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i][j]);
phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j] = 16-j; phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i][j] = 16-j;
} }
} }
#else // USRP #else // USRP
for (i=0;i<frame_parms[0].nb_antennas_rx;i++) { for (i=0;i<frame_parms->nb_antennas_rx;i++) {
free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]); free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]);
rxdata = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t)); rxdata = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t));
phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = rxdata-N_TA_offset; // N_TA offset for TDD phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = rxdata-N_TA_offset; // N_TA offset for TDD
memset(rxdata, 0, samples_per_frame*sizeof(int32_t)); memset(rxdata, 0, samples_per_frame*sizeof(int32_t));
printf("rxdata[%d] @ %p (%p)\n", i, phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i],rxdata); printf("rxdata[%d] @ %p (%p)\n", i, phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i],rxdata);
} }
for (i=0;i<frame_parms[0].nb_antennas_tx;i++) { for (i=0;i<frame_parms->nb_antennas_tx;i++) {
free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]); free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]);
txdata = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t)); txdata = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t));
phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = txdata; phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i] = txdata;
memset(txdata, 0, samples_per_frame*sizeof(int32_t)); memset(txdata, 0, samples_per_frame*sizeof(int32_t));
printf("txdata[%d] @ %p\n", i, phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]); printf("txdata[%d] @ %p\n", i, phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]);
} }
#endif #endif
} }
return(0);
} }
...@@ -104,8 +104,8 @@ static void * dlsch_thread(void *param) { ...@@ -104,8 +104,8 @@ static void * dlsch_thread(void *param) {
char task_name[8]; char task_name[8];
#endif #endif
int eNB_id = 0, UE_id = 0; int eNB_id = 0, UE_id = 0, CC_id=0;
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[UE_id]; PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[UE_id][CC_id];
if ((dlsch_thread_index <0) || (dlsch_thread_index>7)) { if ((dlsch_thread_index <0) || (dlsch_thread_index>7)) {
LOG_E(PHY,"[SCHED][DLSCH] Illegal dlsch_thread_index %d (%p)!!!!\n",dlsch_thread_index,param); LOG_E(PHY,"[SCHED][DLSCH] Illegal dlsch_thread_index %d (%p)!!!!\n",dlsch_thread_index,param);
......
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