Commit d1b3f983 authored by Florian Kaltenberger's avatar Florian Kaltenberger

removed FRAME_LENGTH_COMPLEX_SAMPLES from pcie_interface.h and adapted...

removed FRAME_LENGTH_COMPLEX_SAMPLES from pcie_interface.h and adapted functions that were still using it
added gain control (only used by emos-raw at the moment)
emos-raw now supports multiple cards and has a scope


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5122 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 30b4c553
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
#define MAX_FIRMWARE_BLOCK_SIZE_B 262144 #define MAX_FIRMWARE_BLOCK_SIZE_B 262144
#define MAX_PRINTK_BUFFER_B 1024 #define MAX_PRINTK_BUFFER_B 1024
#define FRAME_LENGTH_COMPLEX_SAMPLES 76800 // #define FRAME_LENGTH_COMPLEX_SAMPLES 76800
// Buffer size per channel: FRAME_LENGTH_COMPLEX_SAMPLES+2048 smp/frame: LTE frame+tail, *4 (7.68*4 MsmpPS), *4 Bytes/smp // Buffer size per channel: FRAME_LENGTH_COMPLEX_SAMPLES+2048 smp/frame: LTE frame+tail, *4 (7.68*4 MsmpPS), *4 Bytes/smp
#define ADAC_BUFFERSZ_PERCHAN_B ((FRAME_LENGTH_COMPLEX_SAMPLES+2048)*4*4) #define ADAC_BUFFERSZ_PERCHAN_B ((76800+2048)*4*4)
#define BIGSHM_SIZE_PAGES ((( MAX_FIRMWARE_BLOCK_SIZE_B + \ #define BIGSHM_SIZE_PAGES ((( MAX_FIRMWARE_BLOCK_SIZE_B + \
MAX_PRINTK_BUFFER_B + \ MAX_PRINTK_BUFFER_B + \
...@@ -305,6 +305,12 @@ typedef struct ...@@ -305,6 +305,12 @@ typedef struct
#define TEST_ADACLOOP_MASK (1<<4) #define TEST_ADACLOOP_MASK (1<<4)
#define TEST_ADACLOOP_EN (1<<4) #define TEST_ADACLOOP_EN (1<<4)
typedef enum {
BW5,
BW10,
BW20
} exmimo_bw_t;
typedef struct typedef struct
{ {
uint32_t multicard_syncmode; uint32_t multicard_syncmode;
......
#include "openair0_lib.h"
#include "gain_control.h"
//#define DEBUG_PHY
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
void gain_control_all (unsigned int rx_power_fil_dB, unsigned int card) {
unsigned int ant;
for (ant=0;ant<4;ant++)
gain_control (rx_power_fil_dB,ant,card);
}
void gain_control (unsigned int rx_power_fil_dB, unsigned int ant, unsigned int card) {
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
unsigned int rf_mode, rx_gain, LNA;
rx_gain = p_exmimo_config->rf.rx_gain[ant][0];
rf_mode = p_exmimo_config->rf.rf_mode[ant];
LNA = rf_mode & LNAGAINMASK;
// Gain control with hysterisis
if (rx_power_fil_dB < TARGET_RX_POWER_MIN) { //increase gain
switch (LNA) {
case LNAByp:
p_exmimo_config->rf.rf_mode[ant] = (rf_mode & (~LNAGAINMASK)) | LNAMed;
break;
case LNAMed:
p_exmimo_config->rf.rf_mode[ant] = (rf_mode & (~LNAGAINMASK)) | LNAMax;
break;
case LNAMax:
p_exmimo_config->rf.rx_gain[ant][0] = min(30,rx_gain+5);
break;
default:
break;
}
}
else if (rx_power_fil_dB > TARGET_RX_POWER_MAX) { //decrease gain
if (rx_gain==0) {
switch (LNA) {
case LNAMax:
p_exmimo_config->rf.rf_mode[ant] = (rf_mode & (~LNAGAINMASK)) | LNAMed;
break;
case LNAMed:
p_exmimo_config->rf.rf_mode[ant] = (rf_mode & (~LNAGAINMASK)) | LNAByp;
break;
case LNAByp:
break;
default:
break;
}
}
else {
p_exmimo_config->rf.rx_gain[ant][0] = max(0,(int)rx_gain-5);
}
}
#ifdef DEBUG_PHY
LOG_D(PHY,"AGC for chain %d: rx_power_fil_dB=%d, rx_gain=%d, LNA=%d (1=Byp,2=Med,3=Max)\n",ant,rx_power_fil_dB,p_exmimo_config->rf.rx_gain[ant][0],(p_exmimo_config->rf.rf_mode&LNAGAINMASK)>>14);
#endif //DEBUG_PHY
}
#define TARGET_RX_POWER 55 // Target digital power for the AGC
#define TARGET_RX_POWER_MAX 55 // Maximum digital power for AGC
#define TARGET_RX_POWER_MIN 50 // Minimum digital power for AGC
void gain_control_all (unsigned int rx_power_fil_dB, unsigned int card);
void gain_control (unsigned int rx_power_fil_dB, unsigned int ant, unsigned int card);
...@@ -19,6 +19,8 @@ extern "C" { ...@@ -19,6 +19,8 @@ extern "C" {
#define TRACE 1 #define TRACE 1
#define FRAME_LENGTH_COMPLEX_SAMPLES 76800
static bool any_bad_argument(const octave_value_list &args) static bool any_bad_argument(const octave_value_list &args)
{ {
octave_value v; octave_value v;
......
...@@ -24,7 +24,7 @@ static bool any_bad_argument(const octave_value_list &args) ...@@ -24,7 +24,7 @@ static bool any_bad_argument(const octave_value_list &args)
if (args.length()!=3) if (args.length()!=3)
{ {
error(FCNNAME); error(FCNNAME);
error("syntax: oarf_send_frame(card,sig,nbits)\n card (starting from 0), sig is a 2D or 4D vector (depending on no. of antennas), nbits is number of bits to quantize the signal to."); error("syntax: oarf_send_frame(card,sig,nbits)\n card (starting from 0), sig is a 2D array (size depends on no. of antennas and resampling factor), nbits is number of bits to quantize the signal to.");
return true; return true;
} }
...@@ -38,15 +38,16 @@ static bool any_bad_argument(const octave_value_list &args) ...@@ -38,15 +38,16 @@ static bool any_bad_argument(const octave_value_list &args)
v=args(1); v=args(1);
printf("signal: R %d, C %d\n",v.rows(),v.columns()); printf("signal: R %d, C %d\n",v.rows(),v.columns());
return false;
v=args(2); v=args(2);
if ((!v.is_real_scalar()) || (v.scalar_value()!=8) || (v.scalar_value()!=16)) if ((!v.is_real_scalar()) && (v.scalar_value()!=8) && (v.scalar_value()!=16))
{ {
error(FCNNAME); error(FCNNAME);
error("nbits must be either 8 (CBMIMO) or 16 (ExpressMIMO)bits."); error("nbits must be either 8 (CBMIMO) or 16 (ExpressMIMO)bits.");
return true; return true;
} }
return false;
} }
...@@ -60,9 +61,8 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame") ...@@ -60,9 +61,8 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame")
octave_value returnvalue; octave_value returnvalue;
int i, ret; int i, ret;
unsigned int length,aa,nbits, numcols; unsigned int length,aa,nbits,numcols;
unsigned int resampling_factor[4]; unsigned int resampling_factor[4];
int dummy=0;
ret = openair0_open(); ret = openair0_open();
if ( ret != 0 ) if ( ret != 0 )
...@@ -84,17 +84,19 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame") ...@@ -84,17 +84,19 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame")
numcols = args(1).columns(); numcols = args(1).columns();
printf("colums = %d, rows = %d\n\n\n", numcols, args(1).rows()); //printf("colums = %d, rows = %d\n\n\n", numcols, args(1).rows());
if ( numcols<1 || (numcols > openair0_num_antennas[card])) if ( numcols<1 || (numcols > openair0_num_antennas[card]))
{ {
error(FCNNAME); error(FCNNAME);
error("input array must be of column size 1..%d.", openair0_num_antennas[card]); error("input array must be of column size %d.", openair0_num_antennas[card]);
return octave_value_list(); return octave_value_list();
} }
for (i=0;i<4;i++) for (i=0;i<4;i++) {
resampling_factor[i] = (openair0_exmimo_pci[card].exmimo_config_ptr)->framing.resampling_factor[i]; resampling_factor[i] = (openair0_exmimo_pci[card].exmimo_config_ptr)->framing.resampling_factor[i];
printf("card %d, ant %d, resampling %d\n",card,i,resampling_factor[i]);
}
for (i=0;i<numcols;i++){ for (i=0;i<numcols;i++){
if (args(1).rows()<(76800*(1 << (2-resampling_factor[i])))) if (args(1).rows()<(76800*(1 << (2-resampling_factor[i]))))
...@@ -117,8 +119,7 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame") ...@@ -117,8 +119,7 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame")
{ {
for (i=0;i<(76800*(1 << (2-resampling_factor[aa])));i++) for (i=0;i<(76800*(1 << (2-resampling_factor[aa])));i++)
{ {
if (i<64) //if (i<64) printf("%d: %d,%d\n",i,(short)real(dx(i,aa)),(short)imag(dx(i,aa)));
printf("%d: %d,%d\n",i,(short)real(dx(i,aa)),(short)imag(dx(i,aa)));
((short*) openair0_exmimo_pci[card].dac_head[aa])[2*i] = (short)(real(dx(i,aa))); ((short*) openair0_exmimo_pci[card].dac_head[aa])[2*i] = (short)(real(dx(i,aa)));
((short*) openair0_exmimo_pci[card].dac_head[aa])[1+(2*i)] = (short)(imag(dx(i,aa))); ((short*) openair0_exmimo_pci[card].dac_head[aa])[1+(2*i)] = (short)(imag(dx(i,aa)));
} }
...@@ -127,8 +128,7 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame") ...@@ -127,8 +128,7 @@ DEFUN_DLD (oarf_send_frame, args, nargout,"Send frame")
{ {
for (i=0;i<(76800*(1 << (2-resampling_factor[aa])));i++) for (i=0;i<(76800*(1 << (2-resampling_factor[aa])));i++)
{ {
if (i<64) //if (i<64) printf("%d: %d,%d\n",i,char(real(dx(i,aa))),char(imag(dx(i,aa))));
printf("%d: %d,%d\n",i,char(real(dx(i,aa))),char(imag(dx(i,aa))));
((char*) openair0_exmimo_pci[card].dac_head[aa])[2*i] = char(real(dx(i,aa))); ((char*) openair0_exmimo_pci[card].dac_head[aa])[2*i] = char(real(dx(i,aa)));
((char*) openair0_exmimo_pci[card].dac_head[aa])[1+(2*i)] = char(imag(dx(i,aa))); ((char*) openair0_exmimo_pci[card].dac_head[aa])[1+(2*i)] = char(imag(dx(i,aa)));
} }
......
synctest:lxrt+sem+mbx+msg+fifos:!./synctest ;sleep 1;popall:control_c sleeptest:lxrt+sem+mbx+msg+fifos:!./sleeptest;sleep 1;popall:control_c
synctest:lxrt+sem+mbx+msg+fifos:!./synctest -V;sleep 1;popall:control_c
condtest:lxrt+sem+mbx+msg+fifos:!sudo ./condtest;sleep 1;popall:control_c condtest:lxrt+sem+mbx+msg+fifos:!sudo ./condtest;sleep 1;popall:control_c
msg_test:lxrt+sem+mbx+msg+fifos:!sudo ./msg_test;sleep 1;popall:control_c msg_test:lxrt+sem+mbx+msg+fifos:!sudo ./msg_test;sleep 1;popall:control_c
msg_many:lxrt+sem+mbx+msg+fifos:!sudo ./msg_test;sleep 1;popall:control_c msg_many:lxrt+sem+mbx+msg+fifos:!sudo ./msg_test;sleep 1;popall:control_c
...@@ -11,6 +12,9 @@ UE:lxrt+sem+mbx+msg+fifos:!sudo ./synctest -U -d -T 108;sleep 1;popall:control_c ...@@ -11,6 +12,9 @@ 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 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:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907597240 -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 UE0_smbv:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907598252 -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
...@@ -27,10 +31,11 @@ UE2prach:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue2 ...@@ -27,10 +31,11 @@ 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.pft.sud.conf -V -K /tmp/itti_eNB0.log;sleep 1;popall:control_ceNB1:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907600000 -F ex2_2 -d;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 eNB2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -C 1907600000 -F ue2 -d;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
eNB2_1900:lxrt+sem+mbx+msg+fifos:!sudo ./synctest_eNB -C 19076000000 -F enb1tx_1900 -d;sleep 1;popall:control_c eNB2_1900:lxrt+sem+mbx+msg+fifos:!sudo ./synctest_eNB -C 19076000000 -F enb1tx_1900 -d;sleep 1;popall:control_c
emos-raw:lxrt+sem+mbx+msg+fifos:!sudo ./emos-raw -C 1907600000;sleep 1;popall:control_c emos-raw:lxrt+sem+mbx+msg+fifos:!sudo ./emos-raw -d -V;sleep 1;popall:control_c
...@@ -17,7 +17,7 @@ ifeq "$(GCCVERSION)" "4.6.1" ...@@ -17,7 +17,7 @@ ifeq "$(GCCVERSION)" "4.6.1"
CFLAGS += -Wno-packed-bitfield-compat CFLAGS += -Wno-packed-bitfield-compat
endif endif
CFLAGS += -O2 CFLAGS += -O2
CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO
ifdef DEBUG ifdef DEBUG
CFLAGS += -g -ggdb CFLAGS += -g -ggdb
...@@ -42,32 +42,22 @@ CFLAGS += -DCONFIG_RTAI_LXRT_INLINE #remend the RTAI warning ...@@ -42,32 +42,22 @@ CFLAGS += -DCONFIG_RTAI_LXRT_INLINE #remend the RTAI warning
RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o
ifeq ($(USRP),1) ifeq ($(USRP),1)
RTAI_OBJ += lte-softmodem-usrp.o RTAI_OBJ += lte-softmodem-usrp.o
else
# RTAI_OBJ += lte-softmodem.o
# RTAI_OBJ += lte-enb.o
# RTAI_OBJ += lte-softmodem-enb.o
# RTAI_OBJ += lte-softmodem-ue.o
endif endif
else else #RTAI
CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
OBJ += sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o OBJ += sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o rt_wrapper.o
ifeq ($(USRP),1) ifeq ($(USRP),1)
OBJ += lte-softmodem-usrp.o OBJ += lte-softmodem-usrp.o
else
# OBJ += lte-softmodem.o
# OBJ += lte-enb.o
# OBJ += lte-softmodem-enb.o
# OBJ += lte-softmodem-ue.o
endif endif
CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
endif endif
OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o #$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o #$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o
ifeq ($(USRP),1) ifeq ($(USRP),1)
include $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/Makefile.inc include $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/Makefile.inc
endif endif
OBJ += $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o OBJ += $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/gain_control.o
CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO
TOP_DIR = $(OPENAIR1_DIR) TOP_DIR = $(OPENAIR1_DIR)
...@@ -156,7 +146,7 @@ CFLAGS += -DHARD_RT ...@@ -156,7 +146,7 @@ CFLAGS += -DHARD_RT
endif endif
ifeq ($(EMOS),1) ifeq ($(EMOS),1)
CFLAGS += -DEMOS #-DEMOS_CHANNEL CFLAGS += -D_FILE_OFFSET_BITS=64 -DEMOS #-DEMOS_CHANNEL
LDFLAGS += -lgps LDFLAGS += -lgps
endif endif
...@@ -165,9 +155,9 @@ CFLAGS += -DNAS_NETLINK -DLINUX ...@@ -165,9 +155,9 @@ CFLAGS += -DNAS_NETLINK -DLINUX
OBJ += $(NAS_OBJS) OBJ += $(NAS_OBJS)
endif endif
RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags) -DRTAI
LDFLAGS += -lpthread -lm -lforms -lconfig LDFLAGS += -lpthread -lm -lforms -lconfig
ifeq ($(RTAI),1) ifeq ($(RTAI),1)
RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags) -DRTAI
LDFLAGS += $(shell rtai-config --lxrt-ldflags) LDFLAGS += $(shell rtai-config --lxrt-ldflags)
ifdef ENABLE_ITTI ifdef ENABLE_ITTI
LDFLAGS += -lrt LDFLAGS += -lrt
...@@ -221,6 +211,7 @@ $(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c ...@@ -221,6 +211,7 @@ $(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
else else
$(OBJ) $(ASN1_MSG_OBJS1) lte-enb.o lte-softmodem.o: %.o : %.c $(OBJ) $(ASN1_MSG_OBJS1) lte-enb.o lte-softmodem.o: %.o : %.c
endif endif
@echo Compiling $< ... @echo Compiling $< ...
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $< @$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d @$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d
...@@ -230,6 +221,11 @@ endif ...@@ -230,6 +221,11 @@ endif
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp @rm -f $*.d.tmp
OBJ_EMOS = $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/gain_control.o rt_wrapper.o $(OPENAIR2_DIR)/UTIL/LOG/log.o $(OPENAIR2_DIR)/UTIL/LOG/vcd_signal_dumper.o $(OPENAIR1_DIR)/PHY/TOOLS/signal_energy.o $(OPENAIR1_DIR)/PHY/TOOLS/dB_routines.o
ifeq ($(XFORMS),1)
OBJ_EMOS+=lte_scope.o
endif
$(USRP_OBJ):$(USRP_FILE_OBJ) $(USRP_OBJ):$(USRP_FILE_OBJ)
@echo Compiling openair_usrp.cpp @echo Compiling openair_usrp.cpp
@$(CXX) -c $(USRP_CFLAGS) $(USRP_FILE_OBJ) -o $(USRP_OBJ) @$(CXX) -c $(USRP_CFLAGS) $(USRP_FILE_OBJ) -o $(USRP_OBJ)
...@@ -238,7 +234,10 @@ condtest: condtest.c ...@@ -238,7 +234,10 @@ condtest: condtest.c
$(CC) $(CFLAGS) $(LDFLAGS) condtest.c -o condtest $(CC) $(CFLAGS) $(LDFLAGS) condtest.c -o condtest
synctest: $(OBJ_SYNC) $(SHARED_DEPENDENCIES) synctest.c synctest: $(OBJ_SYNC) $(SHARED_DEPENDENCIES) synctest.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_EMOS) -o synctest synctest.c $(LDFLAGS) $(LIBS) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_SYNC) -o synctest synctest.c $(LDFLAGS) $(LIBS)
sleeptest: rt_wrapper.o sleeptest.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) rt_wrapper.o -o sleeptest sleeptest.c $(LDFLAGS)
lte-softmodem: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-softmodem.o $(SHARED_DEPENDENCIES) lte-softmodem: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-softmodem.o $(SHARED_DEPENDENCIES)
@echo Linking $@ @echo Linking $@
...@@ -252,7 +251,6 @@ lte-softmodem-usrp: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(USRP_OBJ) $(SHARED_DE ...@@ -252,7 +251,6 @@ lte-softmodem-usrp: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(USRP_OBJ) $(SHARED_DE
@echo Linking $@ @echo Linking $@
@$(CC) $(USRP_OBJ) $(CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-softmodem-usrp $(LDFLAGS) $(LIBS) @$(CC) $(USRP_OBJ) $(CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-softmodem-usrp $(LDFLAGS) $(LIBS)
OBJ_EMOS = $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o rt_wrapper.o $(OPENAIR2_DIR)/UTIL/LOG/log.o $(OPENAIR2_DIR)/UTIL/LOG/vcd_signal_dumper.o
emos-raw: $(SHARED_DEPENDENCIES) $(OBJ_EMOS) emos-raw.c emos-raw: $(SHARED_DEPENDENCIES) $(OBJ_EMOS) emos-raw.c
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_EMOS) -o emos-raw emos-raw.c $(LDFLAGS) $(LIBS) @$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_EMOS) -o emos-raw emos-raw.c $(LDFLAGS) $(LIBS)
...@@ -336,10 +334,11 @@ run_eNB2: ...@@ -336,10 +334,11 @@ run_eNB2:
rtai-load eNB2 --verbose rtai-load eNB2 --verbose
clean: common-clean clean: common-clean
@$(RM_F_V) $(OBJ) $(RTAI_OBJ) @$(RM_F_V) $(OBJ) $(RTAI_OBJ) $(OBJ_EMOS) $(OBJ_SYNC)
@$(RM_F_V) $(OBJ:.o=.d) $(RTAI_OBJ:.o=.d) @$(RM_F_V) $(OBJ:.o=.d) $(RTAI_OBJ:.o=.d) $(OBJ_EMOS:.o=.d) $(OBJ_SYNC:.o=.d)
@$(RM_F_V) $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.o $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.d @$(RM_F_V) $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.o $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.d
@$(RM_F_V) lte-enb.o lte-enb.d lte-softmodem.o lte-softmodem.d @$(RM_F_V) lte-enb.o lte-enb.d lte-softmodem.o lte-softmodem.d
@$(RM_F_V) lte-enb.o lte-softmodem.o
cleanasn1: cleanasn1:
rm -f $(ASN1_MSG_OBJS1) rm -f $(ASN1_MSG_OBJS1)
......
...@@ -54,12 +54,14 @@ ...@@ -54,12 +54,14 @@
#include "rt_wrapper.h" #include "rt_wrapper.h"
#include "PHY/types.h" #include "PHY/types.h"
//#include "PHY/defs.h" #include "PHY/TOOLS/defs.h"
#include "openair0_lib.h" #include "openair0_lib.h"
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
#include "gain_control.h"
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# include "intertask_interface_init.h" # include "intertask_interface_init.h"
# include "timer.h" # include "timer.h"
...@@ -69,7 +71,11 @@ ...@@ -69,7 +71,11 @@
# endif # endif
#endif #endif
#define OPENAIR_THREAD_PRIORITY 255
#define OPENAIR_THREAD_STACK_SIZE 8192
#ifdef XFORMS #ifdef XFORMS
/*
#include "PHY/TOOLS/lte_phy_scope.h" #include "PHY/TOOLS/lte_phy_scope.h"
#include "stats.h" #include "stats.h"
// 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)
...@@ -79,15 +85,22 @@ FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX]; ...@@ -79,15 +85,22 @@ FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
FD_stats_form *form_stats=NULL; FD_stats_form *form_stats=NULL;
char title[255]; char title[255];
unsigned char scope_enb_num_ue = 1; unsigned char scope_enb_num_ue = 1;
*/
#include "lte_scope.h"
FD_lte_scope *form_lte;
char title[255];
#endif //XFORMS #endif //XFORMS
#ifdef EMOS #ifdef EMOS
#include <gps.h> #include <gps.h>
#ifdef RTAI
#include <rtai_fifos.h> #include <rtai_fifos.h>
#endif
//#define CHANSOUNDER_FIFO_SIZE 10485760 // 10 Mbytes FIFO //#define CHANSOUNDER_FIFO_SIZE 10485760 // 10 Mbytes FIFO
//#define CHANSOUNDER_FIFO_SIZE 20971520 // 20 Mbytes FIFO #define CHANSOUNDER_FIFO_SIZE 20971520 // 20 Mbytes FIFO
#define CHANSOUNDER_FIFO_SIZE 104857600 // 100 Mbytes FIFO //#define CHANSOUNDER_FIFO_SIZE 52428800 // 50 Mbytes FIFO
//#define CHANSOUNDER_FIFO_SIZE 104857600 // 100 Mbytes FIFO
#define CHANSOUNDER_FIFO_MINOR 4 // minor of the FIFO device - this is /dev/rtf3 #define CHANSOUNDER_FIFO_MINOR 4 // minor of the FIFO device - this is /dev/rtf3
#define CHANSOUNDER_FIFO_DEV "/dev/rtf4" #define CHANSOUNDER_FIFO_DEV "/dev/rtf4"
#endif #endif
...@@ -95,17 +108,18 @@ unsigned char scope_enb_num_ue = 1; ...@@ -95,17 +108,18 @@ unsigned char scope_enb_num_ue = 1;
#define FRAME_PERIOD 100000000ULL #define FRAME_PERIOD 100000000ULL
#define DAQ_PERIOD 66667ULL #define DAQ_PERIOD 66667ULL
#define LTE_SLOTS_PER_FRAME 20 #define LTE_SLOTS_PER_FRAME 20
#define RESAMPLING_FACTOR 0 //#define RESAMPLING_FACTOR 0
#define SAMPLES_PER_SLOT (15360/(1<<RESAMPLING_FACTOR)) #define SAMPLES_PER_SLOT 15360
#define FRAME_LENGTH_COMPLEX_SAMPLES (SAMPLES_PER_SLOT*LTE_SLOTS_PER_FRAME)
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
#ifdef RTAI #ifdef RTAI
static SEM *mutex; static SEM *mutex;
//static CND *cond; //static CND *cond;
static int thread0; static long int thread0;
static int thread1; static long int thread1;
//static int sync_thread; //static long int sync_thread;
#else #else
pthread_t thread0; pthread_t thread0;
//pthread_t thread1; //pthread_t thread1;
...@@ -115,6 +129,7 @@ struct sched_param sched_param_dlsch; ...@@ -115,6 +129,7 @@ struct sched_param sched_param_dlsch;
pthread_t thread2; //xforms pthread_t thread2; //xforms
pthread_t thread3; //emos pthread_t thread3; //emos
pthread_t thread4; //GPS
/* /*
static int instance_cnt=-1; //0 means worker is busy, -1 means its free static int instance_cnt=-1; //0 means worker is busy, -1 means its free
...@@ -124,7 +139,7 @@ int pci_interface_ptr_kern; ...@@ -124,7 +139,7 @@ int pci_interface_ptr_kern;
//extern unsigned int bigphys_top; //extern unsigned int bigphys_top;
//extern unsigned int mem_base; //extern unsigned int mem_base;
int card = 0; int number_of_cards = 1;
exmimo_config_t *p_exmimo_config; exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id; exmimo_id_t *p_exmimo_id;
volatile unsigned int *DAQ_MBOX; volatile unsigned int *DAQ_MBOX;
...@@ -139,10 +154,14 @@ int fs4_test=0; ...@@ -139,10 +154,14 @@ int fs4_test=0;
char UE_flag=0; char UE_flag=0;
u8 eNB_id=0,UE_id=0; u8 eNB_id=0,UE_id=0;
u32 carrier_freq[4]= {1907600000,1907600000,1907600000,1907600000}; //u32 carrier_freq[4]= {1907600000,1907600000,1907600000,1907600000};
u32 carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0},{0,0,0,0}};
exmimo_bw_t bandwidth[MAX_CARDS] = {BW20,BW10,BW5,BW5};
char *conf_config_file_name = NULL; char *conf_config_file_name = NULL;
unsigned int lost_bytes=0; unsigned int lost_bytes=0;
int rssi_lin,rssi_lin_avg;
u8 rssi_avg_dB;
struct timing_info_t { struct timing_info_t {
//unsigned int frame, hw_slot, last_slot, next_slot; //unsigned int frame, hw_slot, last_slot, next_slot;
...@@ -161,7 +180,6 @@ extern int otg_enabled; ...@@ -161,7 +180,6 @@ extern int otg_enabled;
#else #else
int otg_enabled; int otg_enabled;
#endif #endif
int number_of_cards = 1;
int mbox_bounds[20] = {8,16,24,30,38,46,54,60,68,76,84,90,98,106,114,120,128,136,144, 0}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers int mbox_bounds[20] = {8,16,24,30,38,46,54,60,68,76,84,90,98,106,114,120,128,136,144, 0}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
//int mbox_bounds[20] = {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers //int mbox_bounds[20] = {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
...@@ -219,12 +237,18 @@ void exit_fun(const char* s) ...@@ -219,12 +237,18 @@ void exit_fun(const char* s)
} }
#ifdef XFORMS #ifdef XFORMS
extern void ia_receiver_on_off( FL_OBJECT * form, long arg) {}
void *scope_thread(void *arg) { void *scope_thread(void *arg) {
s16 prach_corr[1024], i; s16 prach_corr[1024];
char stats_buffer[16384]; char stats_buffer[16384];
//FILE *UE_stats, *eNB_stats; //FILE *UE_stats, *eNB_stats;
int len=0; int i,len=0;
float rxsig_t_dB[4][FRAME_LENGTH_COMPLEX_SAMPLES];
float time[FRAME_LENGTH_COMPLEX_SAMPLES];
struct sched_param sched_param; struct sched_param sched_param;
int card,ant,idx;
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
sched_setscheduler(0, SCHED_FIFO,&sched_param); sched_setscheduler(0, SCHED_FIFO,&sched_param);
...@@ -239,6 +263,7 @@ void *scope_thread(void *arg) { ...@@ -239,6 +263,7 @@ void *scope_thread(void *arg) {
*/ */
while (!oai_exit) { while (!oai_exit) {
/*
if (UE_flag==1) { if (UE_flag==1) {
len = dump_ue_stats (PHY_vars_UE_g[0], stats_buffer, 0, mode,rx_input_level_dBm); len = dump_ue_stats (PHY_vars_UE_g[0], stats_buffer, 0, mode,rx_input_level_dBm);
fl_set_object_label(form_stats->stats_text, stats_buffer); fl_set_object_label(form_stats->stats_text, stats_buffer);
...@@ -262,8 +287,28 @@ void *scope_thread(void *arg) { ...@@ -262,8 +287,28 @@ void *scope_thread(void *arg) {
} }
} }
//printf("doing forms\n"); */
usleep(100000); // 100 ms
idx = 0;
for (card=0;card<number_of_cards;card++) {
for (ant=0;ant<4;ant++) {
if (carrier_freq[card][ant] != 0) {
len = FRAME_LENGTH_COMPLEX_SAMPLES/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[ant]);
for (i=0; i<len; i++) {
//rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((((s16*) openair0_exmimo_pci[card].adc_head[0])[2*i])*(((s16*) openair0_exmimo_pci[card].adc_head[0])[2*i])+(((s16*) openair0_exmimo_pci[card].adc_head[0])[2*i+1])*(((s16*) openair0_exmimo_pci[card].adc_head[0])[2*i+1])));
rxsig_t_dB[0][i] = (float) ((((s16*) openair0_exmimo_pci[card].adc_head[ant])[2*i]));
rxsig_t_dB[1][i] = (float) ((((s16*) openair0_exmimo_pci[card].adc_head[ant])[2*i+1]));
time[i] = (float) i;
}
fl_set_xyplot_data(form_lte->channel_t_re[idx],time,rxsig_t_dB[0],len,"","","");
fl_set_xyplot_data(form_lte->channel_t_im[idx],time,rxsig_t_dB[1],len,"","","");
idx++;
}
}
}
//printf("doing forms\n");
usleep(100000);
} }
//fclose (UE_stats); //fclose (UE_stats);
...@@ -279,38 +324,20 @@ int dummy_tx_buffer[3840*4] __attribute__((aligned(16))); ...@@ -279,38 +324,20 @@ int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
#define NO_ESTIMATES_DISK 20 //No. of estimates that are aquired before dumped to disk #define NO_ESTIMATES_DISK 20 //No. of estimates that are aquired before dumped to disk
int channel_buffer_size = SAMPLES_PER_SLOT*4; //one slot, 4 byte per sample int channel_buffer_size = SAMPLES_PER_SLOT*4; //one slot, 4 byte per sample
void* gps_thread (void *arg)
void *emos_thread (void *arg)
{ {
char c;
char *fifo2file_buffer, *fifo2file_ptr;
int fifo, counter=0, bytes;
long long unsigned int total_bytes=0;
FILE *dumpfile_id;
char dumpfile_name[1024];
time_t starttime_tmp;
struct tm starttime;
time_t timer;
struct tm *now;
struct gps_data_t *gps_data = NULL; struct gps_data_t *gps_data = NULL;
struct gps_fix_t dummy_gps_data; struct gps_fix_t dummy_gps_data;
struct sched_param sched_param; struct sched_param sched_param;
int ret; int ret;
sched_param.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
sched_setscheduler(0, SCHED_FIFO,&sched_param); sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("EMOS thread has priority %d\n",sched_param.sched_priority); printf("GPS thread has priority %d\n",sched_param.sched_priority);
timer = time(NULL);
now = localtime(&timer);
memset(&dummy_gps_data,1,sizeof(struct gps_fix_t)); memset(&dummy_gps_data,0,sizeof(struct gps_fix_t));
#if GPSD_API_MAJOR_VERSION>=5 #if GPSD_API_MAJOR_VERSION>=5
ret = gps_open("127.0.0.1","2947",gps_data); ret = gps_open("127.0.0.1","2947",gps_data);
...@@ -321,7 +348,7 @@ void *emos_thread (void *arg) ...@@ -321,7 +348,7 @@ void *emos_thread (void *arg)
#endif #endif
{ {
printf("[EMOS] Could not open GPS\n"); printf("[EMOS] Could not open GPS\n");
//exit(-1); pthread_exit((void*)arg);
} }
#if GPSD_API_MAJOR_VERSION>=4 #if GPSD_API_MAJOR_VERSION>=4
else if (gps_stream(gps_data, WATCH_ENABLE,NULL) != 0) else if (gps_stream(gps_data, WATCH_ENABLE,NULL) != 0)
...@@ -329,13 +356,67 @@ void *emos_thread (void *arg) ...@@ -329,13 +356,67 @@ void *emos_thread (void *arg)
else if (gps_query(gps_data, "w+x") != 0) else if (gps_query(gps_data, "w+x") != 0)
#endif #endif
{ {
//sprintf(tmptxt,"Error sending command to GPS, gps_data = %x", gps_data);
printf("[EMOS] Error sending command to GPS\n"); printf("[EMOS] Error sending command to GPS\n");
//exit(-1); pthread_exit((void*) arg);
} }
else else
printf("[EMOS] Opened GPS, gps_data=%p\n", gps_data); printf("[EMOS] Opened GPS, gps_data=%p\n", gps_data);
while (!oai_exit)
{
printf("[EMOS] polling data from gps\n");
#if GPSD_API_MAJOR_VERSION>=5
if (gps_waiting(gps_data,500)) {
if (gps_read(gps_data) != 0) {
#else
if (gps_waiting(gps_data)) {
if (gps_poll(gps_data) != 0) {
#endif
printf("[EMOS] problem polling data from gps\n");
}
else {
memcpy(&dummy_gps_data,gps_data,sizeof(struct gps_fix_t));
printf("[EMOS] lat %g, lon %g\n",gps_data->fix.latitude,gps_data->fix.longitude);
}
} //gps_waiting
else {
printf("[EMOS] WARNING: No GPS data available, storing dummy packet\n");
}
rt_sleep_ns(1000000000LL);
} //oai_exit
pthread_exit((void*) arg);
}
void *emos_thread (void *arg)
{
char c;
char *fifo2file_buffer, *fifo2file_ptr;
int fifo, counter=0, bytes;
long long unsigned int total_bytes=0;
FILE *dumpfile_id;
char dumpfile_name[1024];
time_t starttime_tmp;
struct tm starttime;
time_t timer;
struct tm *now;
struct sched_param sched_param;
int ret;
sched_param.sched_priority = sched_get_priority_max(SCHED_FIFO)-1;
sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("EMOS thread has priority %d\n",sched_param.sched_priority);
timer = time(NULL);
now = localtime(&timer);
/* /*
if (UE_flag==0) if (UE_flag==0)
channel_buffer_size = sizeof(fifo_dump_emos_eNB); channel_buffer_size = sizeof(fifo_dump_emos_eNB);
...@@ -403,36 +484,15 @@ void *emos_thread (void *arg) ...@@ -403,36 +484,15 @@ void *emos_thread (void *arg)
fprintf(stderr, "[EMOS] Error writing to dumpfile\n"); fprintf(stderr, "[EMOS] Error writing to dumpfile\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/*
if (gps_data)
{
if (gps_poll(gps_data) != 0) {
printf("[EMOS] problem polling data from gps\n");
}
else {
printf("[EMOS] lat %g, lon %g\n",gps_data->fix.latitude,gps_data->fix.longitude);
}
if (fwrite(&(gps_data->fix), sizeof(char), sizeof(struct gps_fix_t), dumpfile_id) != sizeof(struct gps_fix_t))
{
printf("[EMOS] Error writing to dumpfile, stopping recording\n");
exit(EXIT_FAILURE);
}
}
else
{
printf("[EMOS] WARNING: No GPS data available, storing dummy packet\n");
if (fwrite(&(dummy_gps_data), sizeof(char), sizeof(struct gps_fix_t), dumpfile_id) != sizeof(struct gps_fix_t))
{
printf("[EMOS] Error writing to dumpfile, stopping recording\n");
exit(EXIT_FAILURE);
}
}
*/
} }
if ((counter%2000)==0) { if ((counter%2000)==0) {
time(&starttime_tmp); time(&starttime_tmp);
localtime_r(&starttime_tmp,&starttime); localtime_r(&starttime_tmp,&starttime);
printf("[EMOS] %02d:%02d:%02d, frame %d, total bytes wrote %llu, bytes lost %d\n", starttime.tm_hour, starttime.tm_min, starttime.tm_sec, counter/20, total_bytes,lost_bytes); printf("[EMOS] %02d:%02d:%02d, frame %d, total bytes wrote %llu, bytes lost %d\n", starttime.tm_hour, starttime.tm_min, starttime.tm_sec, counter/20, total_bytes,lost_bytes);
printf("[EMOS] %02d:%02d:%02d, frame %d, rssi_lin %d, rssi_lin_avg %d, rssi_avg_dB %d, rx_gain %d, LNA %d\n", starttime.tm_hour, starttime.tm_min, starttime.tm_sec, counter/20, rssi_lin, rssi_lin_avg, rssi_avg_dB, p_exmimo_config->rf.rx_gain[0][0], (p_exmimo_config->rf.rf_mode[0] & LNAGAINMASK) >> 14);
//printf("[EMOS] %02d:%02d:%02d, frame %d, GPS time %e, GPS mode %d, lat %e, lon %e, alt %e, speed %e\n", starttime.tm_hour, starttime.tm_min, starttime.tm_sec, counter/20, dummy_gps_data.time, dummy_gps_data.mode, dummy_gps_data.latitude, dummy_gps_data.longitude, dummy_gps_data.altitude, dummy_gps_data.speed);
} }
} }
...@@ -462,6 +522,9 @@ static void *eNB_thread(void *arg) ...@@ -462,6 +522,9 @@ static void *eNB_thread(void *arg)
int i,ret; int i,ret;
int tx_offset; int tx_offset;
int bytes; int bytes;
long long int k1=1000;
long long int k2=1024-k1;
int len,card = 0;
#ifdef RTAI #ifdef RTAI
task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF); task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
...@@ -557,7 +620,22 @@ static void *eNB_thread(void *arg) ...@@ -557,7 +620,22 @@ static void *eNB_thread(void *arg)
} }
timing_info.n_samples++; timing_info.n_samples++;
// do measurements for rssi
if (last_slot==0) {
for (card=0;card<number_of_cards;card++) {
len = SAMPLES_PER_SLOT/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[0]);
rssi_lin = signal_energy(&(((s32*) openair0_exmimo_pci[card].adc_head[0])[last_slot*len]), len);
rssi_lin_avg = (int) ((k1*((long long int)(rssi_lin_avg)) + (k2*((long long int)(rssi_lin))))>>10);
rssi_avg_dB = dB_fixed(rssi_lin_avg);
if (frame%100==0) {
gain_control_all(rssi_avg_dB,card);
printf("AGC for card %d: rx_power_fil_dB=%d, rx_gain=%d, LNA=%d (1=Byp,2=Med,3=Max)\n",card,rssi_avg_dB,openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0],(openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0]&LNAGAINMASK)>>14);
}
}
}
#ifdef EMOS
// save raw samples here // save raw samples here
/* /*
bytes = rtf_put(CHANSOUNDER_FIFO_MINOR, &(((s32*) openair0_exmimo_pci[card].adc_head[0])[last_slot*SAMPLES_PER_SLOT]), channel_buffer_size/2); bytes = rtf_put(CHANSOUNDER_FIFO_MINOR, &(((s32*) openair0_exmimo_pci[card].adc_head[0])[last_slot*SAMPLES_PER_SLOT]), channel_buffer_size/2);
...@@ -579,6 +657,7 @@ static void *eNB_thread(void *arg) ...@@ -579,6 +657,7 @@ static void *eNB_thread(void *arg)
frame, last_slot, bytes); frame, last_slot, bytes);
} }
} }
#endif
} }
slot++; slot++;
...@@ -613,8 +692,9 @@ int main(int argc, char **argv) { ...@@ -613,8 +692,9 @@ int main(int argc, char **argv) {
#endif #endif
int i,j,aa; int i,j,aa;
void *status; void *status;
int card = 0;
u32 rf_mode_base = TXLPFNORM + TXLPFEN + TXLPF10 + RXLPFNORM + RXLPFEN + RXLPF10 + LNA1ON +LNAMax + RFBBNORM; u32 rf_mode_base = TXLPFNORM + TXLPFEN + RXLPFNORM + RXLPFEN + LNA1ON +LNAMax + RFBBNORM;
u32 rf_local[4] = {8255000,8255000,8255000,8255000}; // UE zepto u32 rf_local[4] = {8255000,8255000,8255000,8255000}; // UE zepto
//{8254617, 8254617, 8254617, 8254617}; //eNB khalifa //{8254617, 8254617, 8254617, 8254617}; //eNB khalifa
//{8255067,8254810,8257340,8257340}; // eNB PETRONAS //{8255067,8254810,8257340,8257340}; // eNB PETRONAS
...@@ -681,10 +761,12 @@ int main(int argc, char **argv) { ...@@ -681,10 +761,12 @@ int main(int argc, char **argv) {
UE_flag = 1; UE_flag = 1;
break; break;
case 'C': case 'C':
carrier_freq[0] = atoi(optarg); for (card=0;card<MAX_CARDS;card++) {
carrier_freq[1] = atoi(optarg); carrier_freq[card][0] = atof(optarg);
carrier_freq[2] = atoi(optarg); carrier_freq[card][1] = atof(optarg);
carrier_freq[3] = atoi(optarg); carrier_freq[card][2] = atof(optarg);
carrier_freq[card][3] = atof(optarg);
}
break; break;
case 'S': case 'S':
fs4_test=1; fs4_test=1;
...@@ -875,111 +957,134 @@ int main(int argc, char **argv) { ...@@ -875,111 +957,134 @@ int main(int argc, char **argv) {
return(ret); return(ret);
} }
printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[card]); number_of_cards = openair0_num_detected_cards;
for (card=0; card<number_of_cards; card++) {
printf ("Configuring card %d of %d (number of antennas %d).\n", card, openair0_num_detected_cards, openair0_num_antennas[card]);
p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr; p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr; p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr;
printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev); printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2) if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2)
p_exmimo_config->framing.eNB_flag = 0; p_exmimo_config->framing.eNB_flag = 0;
else else
p_exmimo_config->framing.eNB_flag = !UE_flag; p_exmimo_config->framing.eNB_flag = !UE_flag;
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB; //p_exmimo_config->framing.multicard_syncmode = SYNCMODE_FREE;
for (ant=0; ant<4; ant++) if (card==0)
p_exmimo_config->framing.resampling_factor[ant] = RESAMPLING_FACTOR; p_exmimo_config->framing.multicard_syncmode = SYNCMODE_MASTER;
else
/* p_exmimo_config->framing.multicard_syncmode = SYNCMODE_SLAVE;
for (ant=0;ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant++)
p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
for (ant=0;ant<frame_parms->nb_antennas_tx;ant++)
p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
for (ant=0;ant<frame_parms->nb_antennas_rx;ant++)
p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant<4;ant++) {
p_exmimo_config->rf.rf_mode[ant] = 0;
carrier_freq[ant] = 0; //this turns off all other LIMEs
}
*/
ant_offset = 0; p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_TESTRX; //TXRXSWITCH_LSB;
for (ant=0; ant<4; ant++) {
if (ant==ant_offset) { /*
//if (1) { for (ant=0;ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant++)
p_exmimo_config->rf.rf_mode[ant] = rf_mode_base; p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
//p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX); for (ant=0;ant<frame_parms->nb_antennas_tx;ant++)
p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
for (ant=0;ant<frame_parms->nb_antennas_rx;ant++)
p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX); p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
} for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant<4;ant++) {
else {
p_exmimo_config->rf.rf_mode[ant] = 0; p_exmimo_config->rf.rf_mode[ant] = 0;
carrier_freq[ant] = 0; //this turns off all other LIMEs carrier_freq[ant] = 0; //this turns off all other LIMEs
} }
}
for (ant = 0; ant<4; ant++) {
p_exmimo_config->rf.do_autocal[ant] = 1;
p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[ant];
p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[ant];
p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant];
p_exmimo_config->rf.tx_gain[ant][0] = txgain[ant];
p_exmimo_config->rf.rf_local[ant] = rf_local[ant];
p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant];
if ((carrier_freq[ant] >= 850000000) && (carrier_freq[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 ((carrier_freq[ant] >= 1900000000) && (carrier_freq[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;
}
p_exmimo_config->rf.rffe_gain_txlow[ant] = 31;
p_exmimo_config->rf.rffe_gain_txhigh[ant] = 31;
p_exmimo_config->rf.rffe_gain_rxfinal[ant] = 52;
p_exmimo_config->rf.rffe_gain_rxlow[ant] = 31;
}
number_of_cards = openair0_num_detected_cards;
/*
if (p_exmimo_id->board_exmimoversion==1) //ExpressMIMO1
openair_daq_vars.timing_advance = 138;
else //ExpressMIMO2
openair_daq_vars.timing_advance = 0;
*/ */
openair0_dump_config(card); for (ant=0; ant<4; ant++) {
if (carrier_freq[card][ant] != 0) {
printf("EXMIMO_CONFIG: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n", p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
p_exmimo_config->rf.rf_mode[0], switch (bandwidth[card]) {
p_exmimo_config->rf.rf_mode[1], case BW20:
p_exmimo_config->rf.rf_mode[2], p_exmimo_config->framing.resampling_factor[ant] = 0;
p_exmimo_config->rf.rf_mode[3], p_exmimo_config->rf.rf_mode[ant] += RXLPF10 + TXLPF10;
(p_exmimo_config->rf.rf_mode[0]&3), // RXen+TXen break;
(p_exmimo_config->rf.rf_mode[0]&4)>>2, //TXLPFen case BW10:
(p_exmimo_config->rf.rf_mode[0]&TXLPFMASK)>>3, //TXLPF p_exmimo_config->framing.resampling_factor[ant] = 1;
(p_exmimo_config->rf.rf_mode[0]&128)>>7, //RXLPFen p_exmimo_config->rf.rf_mode[ant] += RXLPF5 + TXLPF5;
(p_exmimo_config->rf.rf_mode[0]&RXLPFMASK)>>8, //TXLPF break;
(p_exmimo_config->rf.rf_mode[0]&RFBBMASK)>>16, // RFBB mode case BW5:
(p_exmimo_config->rf.rf_mode[0]&LNAMASK)>>12, // RFBB mode p_exmimo_config->framing.resampling_factor[ant] = 2;
(p_exmimo_config->rf.rf_mode[0]&LNAGAINMASK)>>14, // RFBB mode p_exmimo_config->rf.rf_mode[ant] += RXLPF25 + TXLPF25;
(p_exmimo_config->rf.rf_mode[0]&RXLPFMODEMASK)>>19, // RXLPF mode break;
(p_exmimo_config->framing.tdd_config&TXRXSWITCH_MASK)>>1, // Switch mode }
p_exmimo_config->rf.rf_rxdc[0], //p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
p_exmimo_config->rf.rf_local[0], p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
p_exmimo_config->rf.rf_vcocal[0]); }
else {
for (ant=0;ant<4;ant++) p_exmimo_config->rf.rf_mode[ant] = 0;
p_exmimo_config->rf.do_autocal[ant] = 0; }
}
for (ant = 0; ant<4; ant++) {
p_exmimo_config->rf.do_autocal[ant] = 1;
p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[card][ant];
p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[card][ant];
p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant];
p_exmimo_config->rf.tx_gain[ant][0] = txgain[ant];
p_exmimo_config->rf.rf_local[ant] = rf_local[ant];
p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant];
if ((carrier_freq[card][ant] >= 850000000) && (carrier_freq[card][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 ((carrier_freq[card][ant] >= 1900000000) && (carrier_freq[card][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;
}
p_exmimo_config->rf.rffe_gain_txlow[ant] = 31;
p_exmimo_config->rf.rffe_gain_txhigh[ant] = 31;
p_exmimo_config->rf.rffe_gain_rxfinal[ant] = 52;
p_exmimo_config->rf.rffe_gain_rxlow[ant] = 31;
}
openair0_dump_config(card);
printf("EXMIMO_CONFIG card %d: freq0..3 %u %u %u %u Hz, freqtx0..1 %u %u Hz, RX gain0..1 %d %d dB\n",
card,
p_exmimo_config->rf.rf_freq_rx[0],
p_exmimo_config->rf.rf_freq_rx[1],
p_exmimo_config->rf.rf_freq_rx[2],
p_exmimo_config->rf.rf_freq_rx[3],
p_exmimo_config->rf.rf_freq_tx[0],
p_exmimo_config->rf.rf_freq_tx[1],
p_exmimo_config->rf.rx_gain[0][0],
p_exmimo_config->rf.rx_gain[1][0]);
printf("EXMIMO_CONFIG card %d: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n",
card,
p_exmimo_config->rf.rf_mode[0],
p_exmimo_config->rf.rf_mode[1],
p_exmimo_config->rf.rf_mode[2],
p_exmimo_config->rf.rf_mode[3],
(p_exmimo_config->rf.rf_mode[0]&3), // RXen+TXen
(p_exmimo_config->rf.rf_mode[0]&4)>>2, //TXLPFen
(p_exmimo_config->rf.rf_mode[0]&TXLPFMASK)>>3, //TXLPF
(p_exmimo_config->rf.rf_mode[0]&128)>>7, //RXLPFen
(p_exmimo_config->rf.rf_mode[0]&RXLPFMASK)>>8, //TXLPF
(p_exmimo_config->rf.rf_mode[0]&RFBBMASK)>>16, // RFBB mode
(p_exmimo_config->rf.rf_mode[0]&LNAMASK)>>12, // RFBB mode
(p_exmimo_config->rf.rf_mode[0]&LNAGAINMASK)>>14, // RFBB mode
(p_exmimo_config->rf.rf_mode[0]&RXLPFMODEMASK)>>19, // RXLPF mode
(p_exmimo_config->framing.tdd_config&TXRXSWITCH_MASK)>>1, // Switch mode
p_exmimo_config->rf.rf_rxdc[0],
p_exmimo_config->rf.rf_local[0],
p_exmimo_config->rf.rf_vcocal[0]);
for (ant=0;ant<4;ant++)
p_exmimo_config->rf.do_autocal[ant] = 0;
} //card
card=0;
#ifdef EMOS #ifdef EMOS
error_code = rtf_create(CHANSOUNDER_FIFO_MINOR,CHANSOUNDER_FIFO_SIZE); error_code = rtf_create(CHANSOUNDER_FIFO_MINOR,CHANSOUNDER_FIFO_SIZE);
if (error_code==0) if (error_code==0)
...@@ -1022,12 +1127,14 @@ int main(int argc, char **argv) { ...@@ -1022,12 +1127,14 @@ int main(int argc, char **argv) {
// this starts the DMA transfers // this starts the DMA transfers
if (UE_flag!=1) if (UE_flag!=1)
for (card=0;card<number_of_cards;card++)
openair0_start_rt_acquisition(card); openair0_start_rt_acquisition(card);
#ifdef XFORMS #ifdef XFORMS
if (do_forms==1) { if (do_forms==1) {
fl_initialize (&argc, argv, NULL, 0, 0); fl_initialize (&argc, argv, NULL, 0, 0);
/*
form_stats = create_form_stats_form(); form_stats = create_form_stats_form();
if (UE_flag==1) { if (UE_flag==1) {
form_ue[UE_id] = create_lte_phy_scope_ue(); form_ue[UE_id] = create_lte_phy_scope_ue();
...@@ -1063,6 +1170,9 @@ int main(int argc, char **argv) { ...@@ -1063,6 +1170,9 @@ int main(int argc, char **argv) {
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
} }
} }
*/
form_lte = create_form_lte_scope();
fl_show_form (form_lte->lte_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "Scope");
ret = pthread_create(&thread2, NULL, scope_thread, NULL); ret = pthread_create(&thread2, NULL, scope_thread, NULL);
printf("Scope thread created, ret=%d\n",ret); printf("Scope thread created, ret=%d\n",ret);
...@@ -1072,6 +1182,8 @@ int main(int argc, char **argv) { ...@@ -1072,6 +1182,8 @@ int main(int argc, char **argv) {
#ifdef EMOS #ifdef EMOS
ret = pthread_create(&thread3, NULL, emos_thread, NULL); ret = pthread_create(&thread3, NULL, emos_thread, NULL);
printf("EMOS thread created, ret=%d\n",ret); printf("EMOS thread created, ret=%d\n",ret);
ret = pthread_create(&thread4, NULL, gps_thread, NULL);
printf("GPS thread created, ret=%d\n",ret);
#endif #endif
rt_sleep_ns(10*FRAME_PERIOD); rt_sleep_ns(10*FRAME_PERIOD);
...@@ -1140,6 +1252,7 @@ int main(int argc, char **argv) { ...@@ -1140,6 +1252,7 @@ int main(int argc, char **argv) {
if (do_forms==1) if (do_forms==1)
{ {
pthread_join(thread2,&status); pthread_join(thread2,&status);
/*
fl_hide_form(form_stats->stats_form); fl_hide_form(form_stats->stats_form);
fl_free_form(form_stats->stats_form); fl_free_form(form_stats->stats_form);
if (UE_flag==1) { if (UE_flag==1) {
...@@ -1151,6 +1264,9 @@ int main(int argc, char **argv) { ...@@ -1151,6 +1264,9 @@ int main(int argc, char **argv) {
fl_free_form(form_enb[UE_id]->lte_phy_scope_enb); fl_free_form(form_enb[UE_id]->lte_phy_scope_enb);
} }
} }
*/
fl_hide_form(form_lte->lte_scope);
fl_free_form(form_lte->lte_scope);
} }
#endif #endif
...@@ -1189,7 +1305,8 @@ int main(int argc, char **argv) { ...@@ -1189,7 +1305,8 @@ int main(int argc, char **argv) {
#endif #endif
printf("stopping card\n"); printf("stopping card\n");
openair0_stop(card); for (card=0;card<number_of_cards;card++)
openair0_stop(card);
printf("closing openair0_lib\n"); printf("closing openair0_lib\n");
openair0_close(); openair0_close();
...@@ -1197,6 +1314,9 @@ int main(int argc, char **argv) { ...@@ -1197,6 +1314,9 @@ int main(int argc, char **argv) {
printf("waiting for EMOS thread\n"); printf("waiting for EMOS thread\n");
pthread_cancel(thread3); pthread_cancel(thread3);
pthread_join(thread3,&status); pthread_join(thread3,&status);
printf("waiting for GPS thread\n");
pthread_cancel(thread4);
pthread_join(thread4,&status);
#endif #endif
#ifdef EMOS #ifdef EMOS
......
...@@ -21,27 +21,38 @@ create_form_lte_scope( void ) ...@@ -21,27 +21,38 @@ create_form_lte_scope( void )
obj = fl_add_box( FL_ROUNDED_BOX, 0, 0, 780, 723, "" ); obj = fl_add_box( FL_ROUNDED_BOX, 0, 0, 780, 723, "" );
fl_set_object_color( obj, FL_BLACK, FL_BLUE ); fl_set_object_color( obj, FL_BLACK, FL_BLUE );
fdui->channel_t_re = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 280, 100, "Received Signal (Time-Domain, dB)" ); fdui->channel_t_re[0] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 280, 100, "Real(RX0)" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX ); fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_BLUE ); fl_set_object_color( obj, FL_BLACK, FL_BLUE );
fl_set_object_lcolor( obj, FL_WHITE ); fl_set_object_lcolor( obj, FL_WHITE );
fdui->scatter_plot = obj = fl_add_xyplot( FL_POINTS_XYPLOT, 600, 230, 160, 190, "PBCH Scatter Plot" ); fdui->channel_t_im[0] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 310, 20, 280, 100, "Imag(RX0)" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX ); fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_GREEN ); fl_set_object_color( obj, FL_BLACK, FL_BLUE );
fl_set_object_lcolor( obj, FL_WHITE ); fl_set_object_lcolor( obj, FL_WHITE );
fdui->channel_f = obj = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 570, 90, "Frequency Domain Channel Estimate" ); fdui->channel_t_re[1] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 140, 280, 100, "Real(RX1)" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX ); fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_RED ); fl_set_object_color( obj, FL_BLACK, FL_RED );
fl_set_object_lcolor( obj, FL_WHITE ); fl_set_object_lcolor( obj, FL_WHITE );
fdui->channel_t_im = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 310, 20, 280, 100, "Time-Domain Channel Estimate" ); fdui->channel_t_im[1] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 310, 140, 280, 100, "Imag(RX1)" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX ); fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_BLUE ); fl_set_object_color( obj, FL_BLACK, FL_RED );
fl_set_object_lcolor( obj, FL_WHITE );
fdui->channel_t_re[2] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 260, 280, 100, "Real(RX2)" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_GREEN );
fl_set_object_lcolor( obj, FL_WHITE ); fl_set_object_lcolor( obj, FL_WHITE );
fdui->decoder_input = obj = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 250, 570, 130, "PBCH Decoder Input" ); fdui->channel_t_im[2] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 310, 260, 280, 100, "Imag(RX2)" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_GREEN );
fl_set_object_lcolor( obj, FL_WHITE );
/*
fdui->scatter_plot = obj = fl_add_xyplot( FL_POINTS_XYPLOT, 600, 230, 160, 190, "PBCH Scatter Plot" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX ); fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_GREEN ); fl_set_object_color( obj, FL_BLACK, FL_GREEN );
fl_set_object_lcolor( obj, FL_WHITE ); fl_set_object_lcolor( obj, FL_WHITE );
...@@ -61,15 +72,11 @@ create_form_lte_scope( void ) ...@@ -61,15 +72,11 @@ create_form_lte_scope( void )
fl_set_object_color( obj, FL_RED, FL_RED); fl_set_object_color( obj, FL_RED, FL_RED);
fl_set_object_callback( obj, ia_receiver_on_off, 0 ); fl_set_object_callback( obj, ia_receiver_on_off, 0 );
fdui->demod_out = obj = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 400, 570, 140, "PDSCH/PUSCH Decoder Input" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_YELLOW );
fl_set_object_lcolor( obj, FL_WHITE );
fdui->tput = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 560, 570, 140, "Throughput [kbits/s]" ); fdui->tput = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 560, 570, 140, "Throughput [kbits/s]" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX ); fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_WHITE ); fl_set_object_color( obj, FL_BLACK, FL_WHITE );
fl_set_object_lcolor( obj, FL_WHITE ); fl_set_object_lcolor( obj, FL_WHITE );
*/
fl_end_form( ); fl_end_form( );
......
...@@ -17,16 +17,18 @@ typedef struct { ...@@ -17,16 +17,18 @@ typedef struct {
void * vdata; void * vdata;
char * cdata; char * cdata;
long ldata; long ldata;
FL_OBJECT * channel_t_re; FL_OBJECT * channel_t_re[4];
FL_OBJECT * channel_t_im[4];
/*
FL_OBJECT * scatter_plot; FL_OBJECT * scatter_plot;
FL_OBJECT * channel_f; FL_OBJECT * channel_f;
FL_OBJECT * channel_t_im;
FL_OBJECT * decoder_input; FL_OBJECT * decoder_input;
FL_OBJECT * scatter_plot2; FL_OBJECT * scatter_plot2;
FL_OBJECT * scatter_plot1; FL_OBJECT * scatter_plot1;
FL_OBJECT * ia_receiver_button; FL_OBJECT * ia_receiver_button;
FL_OBJECT * demod_out; FL_OBJECT * demod_out;
FL_OBJECT * tput; FL_OBJECT * tput;
*/
} FD_lte_scope; } FD_lte_scope;
extern FD_lte_scope * create_form_lte_scope( void ); extern FD_lte_scope * create_form_lte_scope( void );
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <pthread.h>
#define RTIME long long int #define RTIME long long int
......
...@@ -262,7 +262,7 @@ void *scope_thread(void *arg) { ...@@ -262,7 +262,7 @@ void *scope_thread(void *arg) {
} }
//printf("doing forms\n"); //printf("doing forms\n");
sleep(0.1); usleep(100000);
} }
//fclose (UE_stats); //fclose (UE_stats);
......
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