Skip to content
Snippets Groups Projects
Commit 2d73a4a3 authored by Florian Kaltenberger's avatar Florian Kaltenberger
Browse files

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
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,10 @@ typedef struct openair0_device_t openair0_device;
/* structrue holds the parameters to configure USRP devices
*/
#ifdef USRP
#define MAX_CARDS 1
#endif
typedef enum {
max_gain=0,med_gain,byp_gain
} rx_gain_t;
......@@ -68,6 +72,15 @@ typedef struct {
double tx_bw;
} openair0_config_t;
typedef struct {
/* card id */
int card;
/* rf chain id */
int chain;
} openair0_rf_map;
struct openair0_device_t {
/* USRP RF frontend parameters set by application */
openair0_config_t openair0_cfg;
......
......@@ -80,7 +80,6 @@ int openair0_open(void)
int card;
int ant;
int openair0_num_antennas[4];
PAGE_SHIFT = log2_int( sysconf( _SC_PAGESIZE ) );
......@@ -220,10 +219,12 @@ int openair0_close(void)
return 0;
}
/*
int openair0_dump_config(int card)
{
return ioctl(openair0_fd, openair_DUMP_CONFIG, card);
}
*/
int openair0_get_frame(int card)
{
......@@ -245,18 +246,15 @@ int openair0_stop_without_reset(int 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 RF_MODE_BASE (LNA1ON +LNAMax + RFBBNORM)
int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
// Initialize card
exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
int ret;
int ant;
int resampling_factor=2;
int rx_filter=RXLPF25, tx_filter=TXLPF25;
ret = openair0_open();
......@@ -271,115 +269,141 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
return(ret);
}
printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[0]);
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]);
}
p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[0].exmimo_id_ptr;
printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", 0, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
// check if the software matches firmware
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);
exit(-1);
}
if (!openair0_cfg) {
printf("Error, openair0_cfg is null!!\n");
return(-1);
}
if (p_exmimo_id->board_swrev>=9)
p_exmimo_config->framing.eNB_flag = 0;
else
p_exmimo_config->framing.eNB_flag = 1;//!UE_flag;
return(0);
}
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
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;
if (openair0_cfg->sample_rate==30.72e6) {
resampling_factor = 0;
rx_filter = RXLPF10;
tx_filter = TXLPF10;
}
else if (openair0_cfg->sample_rate==15.36e6) {
resampling_factor = 1;
rx_filter = RXLPF5;
tx_filter = TXLPF5;
}
else if (openair0_cfg->sample_rate==7.68e6) {
resampling_factor = 2;
rx_filter = RXLPF25;
tx_filter = TXLPF25;
}
else {
printf("Sampling rate not supported, using default 7.68MHz");
resampling_factor = 2;
rx_filter = RXLPF25;
tx_filter = TXLPF25;
exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
if (!openair0_cfg) {
printf("Error, openair0_cfg is null!!\n");
return(-1);
}
#if (BOARD_SWREV_CNTL2>=0x0A)
for (ant=0; ant<4; ant++)
p_exmimo_config->framing.resampling_factor[ant] = resampling_factor;
#else
p_exmimo_config->framing.resampling_factor = resampling_factor;
#endif
for (card=0; card<openair0_num_detected_cards; card++) {
for (ant=0;ant<max(openair0_cfg->tx_num_channels,openair0_cfg->rx_num_channels);ant++)
p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE;
for (ant=0;ant<openair0_cfg->tx_num_channels;ant++)
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_mode[ant] += (RXEN + DMAMODE_RX + RXLPFNORM + RXLPFEN + rx_filter);
switch (openair0_cfg->rxg_mode[ant]) {
default:
case max_gain:
p_exmimo_config->rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMax;
break;
case med_gain:
p_exmimo_config->rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMed;
break;
case byp_gain:
p_exmimo_config->rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAByp;
break;
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)
p_exmimo_config->framing.eNB_flag = 0;
else
p_exmimo_config->framing.eNB_flag = !UE_flag;
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
if (openair0_cfg[card].sample_rate==30.72e6) {
resampling_factor = 0;
rx_filter = RXLPF10;
tx_filter = TXLPF10;
}
}
for (ant=max(openair0_cfg->tx_num_channels,openair0_cfg->rx_num_channels);ant<4;ant++) {
p_exmimo_config->rf.rf_mode[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_rxdc[ant] = rf_rxdc[ant];
if (( p_exmimo_config->rf.rf_freq_tx[ant] >= 850000000) && ( p_exmimo_config->rf.rf_freq_tx[ant] <= 865000000)) {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal_850[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD;
else if (openair0_cfg[card].sample_rate==15.36e6) {
resampling_factor = 1;
rx_filter = RXLPF5;
tx_filter = TXLPF5;
}
else if (( p_exmimo_config->rf.rf_freq_tx[ant] >= 1900000000) && ( p_exmimo_config->rf.rf_freq_tx[ant] <= 2000000000)) {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD;
else if (openair0_cfg[card].sample_rate==7.68e6) {
resampling_factor = 2;
rx_filter = RXLPF25;
tx_filter = TXLPF25;
}
else {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = 0;
printf("Sampling rate not supported, using default 7.68MHz");
resampling_factor = 2;
rx_filter = RXLPF25;
tx_filter = TXLPF25;
}
#if (BOARD_SWREV_CNTL2>=0x0A)
for (ant=0; ant<4; ant++)
p_exmimo_config->framing.resampling_factor[ant] = resampling_factor;
#else
p_exmimo_config->framing.resampling_factor = resampling_factor;
#endif
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.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_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_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:
case max_gain:
p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMax;
break;
case med_gain:
p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAMed;
break;
case byp_gain:
p_exmimo_config[card].rf.rf_mode[ant] = (p_exmimo_config->rf.rf_mode[ant]&(~LNAGAINMASK))|LNAByp;
break;
}
}
else {
p_exmimo_config->rf.rf_mode[ant] = 0;
p_exmimo_config->rf.do_autocal[ant] = 0;
}
p_exmimo_config->rf.rf_local[ant] = rf_local[ant];
p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant];
if (( p_exmimo_config->rf.rf_freq_tx[ant] >= 850000000) && ( p_exmimo_config->rf.rf_freq_tx[ant] <= 865000000)) {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal_850[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD;
}
else if (( p_exmimo_config->rf.rf_freq_tx[ant] >= 1900000000) && ( p_exmimo_config->rf.rf_freq_tx[ant] <= 2000000000)) {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD;
}
else {
p_exmimo_config->rf.rf_vcocal[ant] = rf_vcocal[ant];
p_exmimo_config->rf.rffe_band_mode[ant] = 0;
}
}
ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card);
if (ret!=0)
return(-1);
}
return(0);
......
......@@ -63,7 +63,8 @@ int openair0_close(void);
// trigger config update on card
// 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
// 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
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
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
#EXMIMO2 card 5
#UE0:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907597240 -V;sleep 1;popall:control_c
#EXMIMO2 card 5
#UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907598252 -V;sleep 1;popall:control_c
#EXMIMO2 card 24
#UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907595776 -V;sleep 1;popall:control_c
#EXMIMO2 card 5?
UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907598252 -V;sleep 1;popall:control_c
#EXMIMO2 card 38
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
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
......@@ -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
#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 -d -O../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.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
eNB2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907600000 -F ue2 -d;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 2680000000 -r 50 -d -V;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_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
......
......@@ -132,7 +132,8 @@ OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
endif
RTAI_OBJ += $(UTILS_OBJS)
#RTAI_
OBJ += $(UTILS_OBJS)
......
This diff is collapsed.
......@@ -104,8 +104,8 @@ static void * dlsch_thread(void *param) {
char task_name[8];
#endif
int eNB_id = 0, UE_id = 0;
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[UE_id];
int eNB_id = 0, UE_id = 0, CC_id=0;
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[UE_id][CC_id];
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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment