Commit 263571b0 authored by ghaddab's avatar ghaddab

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5720 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 337df938
sh /opt/XIO2000/xio_script.sh
cd ../USERSPACE_TOOLS/OPENAIR_RF
./openair_rf_cbmimo1_lte 0 4 1
rmmod -f openair_rf
cd ../..
make install_cbmimo1_softmodem_lte_emos_l2
cd LAUNCH_SCRIPTS
#!/bin/sh
echo "start setting up eNB interface"
cd $OPENAIR2_DIR
sudo rmmod nasmesh
#make nasmesh_netlink_address_fix.ko
#make nasmesh_netlink.ko
#make nasmesh.ko
#make rb_tool
#route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
cd -
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 3
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i0 -z0 -s 10.0.1.1 -t 10.0.1.3 -r 11
echo "end setting up NAS interface"
#!/bin/sh
echo "setting up UE NAS interface"
cd $OPENAIR2_DIR
sudo rmmod nasmesh
#make nasmesh_netlink_address_fix.ko
#make nasmesh_netlink.ko
#make nasmesh.ko
#make rb_tool
#route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
cd -
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
sudo ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 3
echo "end setting up NAS interface"
#!/bin/sh
echo "setting up UE NAS interface"
cd $OPENAIR2_DIR
sudo rmmod nasmesh
#make nasmesh_netlink_address_fix.ko
#make nasmesh_netlink.ko
#make nasmesh.ko
#make rb_tool
#route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
cd -
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
sudo ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.3 -t 10.0.1.1 -r 3
echo "end setting up NAS interface"
sudo sh $OPENAIR1_DIR/xio_script.sh
sh stop_rf.sh
sh start_rf.sh
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 0 0 1 # dump Config
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 6 110 110 100 100 #Set TX gains
#$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 2 26 100 #Card v2_10 synched to v2_19
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 14 0 #SET RX RF Mode
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 32 1 #Set DLSCH Transmission Mod
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 1 0 0 #Start Primary Clusterhead
#$OPENAIR1_DIR/USERSPACE_TOOLS/SCOPE/lte_scope_ul 0 0 &
#$OPENAIR1_DIR/USERSPACE_TOOLS/SCOPE/lte_scope_ul 0 1 &
\ No newline at end of file
sudo sh $OPENAIR1_DIR/xio_script.sh
sh stop_rf.sh
sh start_rf.sh
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 0 1 1
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 6 110 110 100 100
#$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 2 26 100 #Card v2_10 synched to v2_19
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 14 0
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 32 2
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 1 1 0
cd USERSPACE_TOOLS/OPENAIR_RF
./openair_rf_cbmimo1_lte 0 4 1
rmmod -f openair_rf
cd ../..
make install_cbmimo1_softmodem_lte_emos_l2
cd USERSPACE_TOOLS/OPENAIR_RF
./openair_rf_cbmimo1_lte 0 0 1 1
./openair_rf_cbmimo1_lte 0 6 137 137 140 140
./openair_rf_cbmimo1_lte 0 14 2
./openair_rf_cbmimo1_lte 0 32 6
source /opt/XIO2000/xio_script.sh
./openair_rf_cbmimo1_lte 0 1 1 0
cd ../..
gpsd /dev/ttyUSB0
cd USERSPACE_TOOLS/OPENAIR_RF
./openair_rf_cbmimo1_lte 0 4 1
rmmod -f openair_rf
cd ../..
make install_cbmimo1_softmodem_lte_emos_l2
cd EMOS/LTE/GUI
./emos_gui &
sudo insmod $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_msg_kern.ko
sudo insmod $OPENAIR1_DIR/ARCH/CBMIMO1/DEVICE_DRIVER/openair_rf_softmodem.ko
\ No newline at end of file
sh $OPENAIR1_DIR/xio_script.sh
cd ../USERSPACE_TOOLS/OPENAIR_RF
./openair_rf_cbmimo1_lte 0 4 1
rmmod -f openair_rf
cd ../..
make install_cbmimo1_softmodem
cd USERSPACE_TOOLS/OPENAIR_RF
./openair_rf_cbmimo1_lte 0 0 1 1
./openair_rf_cbmimo1_lte 0 26 100
./openair_rf_cbmimo1_lte 0 6 150 150 140 140
./openair_rf_cbmimo1_lte 0 14 0
./openair_rf_cbmimo1_lte 0 8 1
cd ../../LAUNCH_SCRIPTS
sudo sh $OPENAIR1_DIR/xio_script.sh
sh stop_rf.sh
sh start_rf.sh
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 0 0 1 # dump config
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 6 100 100 100 100 #Set TX gains
#./openair_rf_cbmimo1_lte 0 25 0
#./openair_rf_cbmimo1_lte 0 15 101 # Card v15 synched to card v38
#./openair_rf_cbmimo1_lte 0 15 117 # Card v15 synched to card v5
#./openair_rf_cbmimo1_lte 0 15 135 # Card v37 synched to card v5
#$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 15 89 # Card v42 synched to card v43
#$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 15 85 # Card v47 synched to card v43
#./openair_rf_cbmimo1_lte 0 26 400
#$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 15 103 # Card v47 synched to card v42
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 15 110 # Card v42 synched to card v47
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 14 0 #RF mode 0 = mixer low gain, lna off
#./openair_rf_cbmimo1_lte 0 14 1 #RF mode 1 = mixer low gain, lna on
#./openair_rf_cbmimo1_lte 0 14 2 #RF mode 2 = mixer high gain, lna on
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 3 1 0 #Start Node - param 0/1
sudo sh $OPENAIR1_DIR/xio_script.sh
sh stop_rf.sh
sh start_rf.sh
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 0 0 1
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 6 100 100 100 100
#./openair_rf_cbmimo1_lte 0 25 0
#./openair_rf_cbmimo1_lte 0 15 101 # Card v15 synched to card v38
#./openair_rf_cbmimo1_lte 0 15 117 # Card v15 synched to card v5
#./openair_rf_cbmimo1_lte 0 15 135 # Card v37 synched to card v5
#./openair_rf_cbmimo1_lte 0 26 400
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 14 0 #RF mode 0 = mixer low gain, lna off
#./openair_rf_cbmimo1_lte 0 14 1 #RF mode 1 = mixer low gain, lna on
#./openair_rf_cbmimo1_lte 0 14 2 #RF mode 2 = mixer high gain, lna on
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 3 1 1
killall lte_scope
killall lte_scope_ul
$OPENAIR1_DIR/USERSPACE_TOOLS/OPENAIR_RF/openair_rf_cbmimo1_lte 0 4 1
sudo rmmod -f nasmesh
sudo rmmod -f openair_rf
sudo rmmod -f asn1_msg_kern
# command line flags are automatically exported and thus passed down to any sub-make.
# here we set the default flags in case on command line flags are provided
# these flags have to be explicitely exported so that the sub-make is aware of them
ifndef OPENAIR_LTE
export OPENAIR_LTE=1
export OPENAIR_EMU=0
endif
ifndef OPENAIR1
export OPENAIR1=0
endif
ifndef OPENAIR2
export OPENAIR2=0
endif
ifndef OPENAIR3
export OPENAIR3=0
endif
ifndef EMOS
export EMOS=0
endif
ifndef rrc_cellular
export rrc_cellular = 0
export rrc_cellular_eNB = 0
export rrc_cellular_UE = 0
else
export rrc_cellular = 1
ifeq ($(eNB_flag),1)
export rrc_cellular_eNB=1
endif
ifeq ($(UE_flag),1)
export rrc_cellular_UE=1
endif
endif
all: openair_rf_cbmimo1_softmodem.ko asn1_msg_kern.ko nasmesh.ko rb_tool openair_rf scope
openair_rf_cbmimo1_softmodem.ko:
(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C /usr/src/linux V=1 M=`pwd` RTAI=1 CBMIMO1=1 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
oai_user_cbmimo1.ko:
(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C /usr/src/linux V=1 M=`pwd` RTAI=1 CBMIMO1=1 BIT8_TX=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
oai_user_exmimo.ko:
(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C /usr/src/linux V=1 M=`pwd` RTAI=1 CBMIMO1=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
asn1_msg_kern.ko:
(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) -C /usr/src/linux V=0 M=`pwd` RTAI=1 -j2 && mv asn1_msg_kern.ko $(CURDIR)/asn1_msg_kern.ko)
nasmesh.ko:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH && $(MAKE) V=1 -C /usr/src/linux M=`pwd` && mv nasmesh.ko $(CURDIR)/nasmesh.ko)
rb_tool:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
openair_rf:
(cd $(OPENAIR1_DIR)/USERSPACE_TOOLS/OPENAIR_RF && $(MAKE) clean CBMIMO1=1 && $(MAKE) all CBMIMO1=1 && $(MAKE) clean CBMIMO1=1)
scope:
(cd $(OPENAIR1_DIR)/USERSPACE_TOOLS/SCOPE && $(MAKE) clean && $(MAKE) all && $(MAKE) clean )
#Remove all but source files
cleanall:
(cd $(OPENAIR1_DIR) && $(MAKE) cleanall)
(cd $(OPENAIR2_DIR) && $(MAKE) cleanall)
fifos:
@for i in `seq 0 64`;\
do \
have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
if [ "$$have_rtfX" -eq 0 ] ;then \
mknod -m 666 /dev/rtf$$i c 150 $$i; \
fi;\
done
openair0:
mknod /dev/openair0 c 127 0
chmod a+rw /dev/openair0
install_oai_user:
make fifos
insmod openair_rf_softmodem.ko
updatefw:
$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0
boot_exmimo:
sudo make install_oai_user
$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0
sleep 1
sudo rmmod openair_rf
sudo make install_oai_user
reboot_exmimo:
$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 -b
sudo rmmod openair_rf
sudo make install_oai_user
install_softmodem:
make fifos
ifeq ($(OPENAIR2),1)
insmod asn1_msg_kern.ko
endif
insmod openair_rf_softmodem.ko
remove:
rmmod openair_rf
ifeq ($(OPENAIR2),1)
rmmod asn1_msg_kern
endif
test:
(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) test RTAI=1 CBMIMO1=1)
(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) test)
clean:
(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) clean RTAI=1 CBMIMO1=1)
(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) clean)
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
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
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 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
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 730000000; 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
UE0calib:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1912600000 --calib-ue-rx -70 ;sleep 1;popall:control_c
UE0calibmed:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1912600000 --calib-ue-rx-med -70 ;sleep 1;popall:control_c
UE0calibbyp:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1912600000 --calib-ue-rx-byp -70 ;sleep 1;popall:control_c
UE0prach:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1912606900 -F ue1 --debug-ue-prach;sleep 1;popall:control_c
UE1:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue1 ;sleep 1;popall:control_c
UE1prach:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue1 --debug-ue-prach;sleep 1;popall:control_c
UE1noL2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue1 --no-L2-connect;sleep 1;popall:control_c
UE2:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue2;sleep 1;popall:control_c
UE2prach:lxrt+sem+mbx+msg+fifos:!sudo ./lte-softmodem -U -d -C 1907600000 -F ue2 --debug-ue-prach;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 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
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
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 -d -V;sleep 1;popall:control_c
This diff is collapsed.
include $(OPENAIR_TARGETS)/Makerules
include $(OPENAIR_TARGETS)/Makefile.common
GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g')
ifeq "$(GCCVERSION)" "4.4.3"
CFLAGS += -Wno-packed-bitfield-compat
endif
ifeq "$(GCCVERSION)" "4.5.2"
CFLAGS += -Wno-packed-bitfield-compat
endif
ifeq "$(GCCVERSION)" "4.6.1"
CFLAGS += -Wno-packed-bitfield-compat
endif
CFLAGS += -O2
# Debug
CFLAGS += -g -ggdb
CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO -DEXMIMO_IOT
SRC = lte-enb.c
ifndef RTAI
RTAI=1
endif
ifeq ($(RTAI),1)
CFLAGS += -DENABLE_RTAI_CLOCK -DRTAI
RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-enb.o rt_wrapper.o
else
OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-enb.o rt_wrapper.o
CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
endif
OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o
TOP_DIR = $(OPENAIR1_DIR)
include $(OPENAIR1_DIR)/PHY/Makefile.inc
include $(OPENAIR1_DIR)/SCHED/Makefile.inc
OBJ += $(PHY_OBJS)
ifeq ($(RTAI),1)
RTAI_OBJ += $(SCHED_OBJS)
else
OBJ += $(SCHED_OBJS)
endif
#ifndef rrc_cellular
ifeq ($(rrc_cellular),0)
rrc_cellular = 0
rrc_cellular_eNB = 0
rrc_cellular_UE = 0
else
ifeq ($(eNB_flag),1)
rrc_cellular_eNB=1
endif
ifeq ($(UE_flag),1)
rrc_cellular_UE=1
endif
endif
export rrc_cellular
OPENAIR2_TOP = $(OPENAIR2_DIR)
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
ifeq ($(RTAI),1)
LOG_OBJS=
RTAI_OBJ+=$(LOG_DIR)/vcd_signal_dumper.o
RTAI_OBJ+=$(LOG_DIR)/log.o
endif
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
OBJ += $(LOG_OBJS)
ifndef OPENAIR2
OPENAIR2=1
endif
ifeq ($(OPENAIR2),1)
ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
OBJ += $(L2_OBJS) $(LIST_OBJ) $(TIMER_OBJ) $(MEM_OBJ) $(OTG_OBJS) $(MATH_OBJS)
OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
OBJ += $(PDCP_DIR)/pdcp_thread.o
CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
endif
CFLAGS += $(L2_incl) $(UTIL_incl) $(UTILS_incl)
CFLAGS += -I$(OPENAIR1_DIR) -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES #-I$(OPENAIR3_DIR)/MESH -I$(OPENAIR3_DIR)/MESH/RRM
CFLAGS += -DNEW_FFT -DLOG_NO_THREAD
ifeq ($(XFORMS),1)
CFLAGS += -DXFORMS -I/usr/include/X11
LDFLAGS += -lforms
OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
OBJ += stats.o
endif
ifdef SMBV
CFLAGS += -DSMBV
endif
#CPUFLAGS = -mmmx -msse -msse2 -m32 -mssse3 -msse4.1
CPUFLAGS = -mmmx -msse -msse2 -mssse3 -msse4.1
#CFLAGS += -fno-common -mpreferred-stack-boundary=4
CFLAGS += -Wall -fno-strict-aliasing -DPHYSIM -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 -rdynamic $(CPUFLAGS) # -Wno-packed-bitfield-compat
CFLAGS += -DOPENAIR_LTE -DENABLE_FXP -DOPENAIR1 -DDLSCH_THREAD #-DULSCH_THREAD
#only for CBMIMO1
ifdef CBMIMO1
CFLAGS += -DFW2011 -DBIT8_TX -DCBMIMO1
else
#only for EXPRESS MIMO
CFLAGS += -DEXMIMO
#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=138 #this is for ExpressMIMO 1
#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=45 #this is for ExpressMIMO 2
endif
ifndef HARD_RT
HARD_RT=1
endif
ifeq ($(HARD_RT),1)
CFLAGS += -DHARD_RT
endif
ifeq ($(EMOS),1)
CFLAGS += -DEMOS -DEMOS_CHANNEL
LDFLAGS += -lgps
endif
ifndef NAS
NAS=1
endif
ifeq ($(NAS),1)
CFLAGS += -DNAS_NETLINK -DLINUX
OBJ += $(NAS_OBJS)
endif
RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags)
CFLAGS += -I/usr/realtime/include -DRTAI
LDFLAGS += -lpthread -lm -lforms
ifeq ($(RTAI),1)
LDFLAGS += $(shell rtai-config --lxrt-ldflags)
else
LDFLAGS += -lrt
endif
#ifndef USE_MME
# USE_MME=R8
#endif
ifdef USE_MME
include $(OPENAIR2_DIR)/S1AP/Makefile.inc
include $(OPENAIR2_DIR)/S1AP/MESSAGES/Makefile.inc
CFLAGS += -DENABLE_USE_MME -DENB_MODE
LDFLAGS += -lsctp
CFLAGS_S1AP += -DENB_MODE -DENABLE_USE_MME -DEMIT_ASN_DEBUG=1 -DUSER_MODE
S1AP_BUILT_OBJS += $(S1AP_OBJS) $(addprefix $(OPENAIR2_DIR)/S1AP/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
S1AP_BUILT_OBJS += $(OPENAIR3_DIR)/OPENAIRMME/SCTP/sctp_primitives_client.o
endif
ASN1RELDIR=R9.8
ifeq ($(USE_MME), R8)
ASN1RELDIR=R8.10
else
CFLAGS_S1AP += -DUPDATE_RELEASE_9
endif
S1AP_DIR=$(OPENAIR2_DIR)/S1AP
ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES
ASN1DIR=$(ASN1MESSAGESDIR)/ASN1
all: lte-enb
$(LFDS_DIR)/bin/liblfds611.a:
$(MAKE) -C $(LFDS_DIR) -f makefile.linux
$(RTAI_OBJ): %.o : %.c
@echo Compiling $< ...
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
@echo Compiling $< ...
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
$(S1AP_BUILT_OBJS): %.o : %.c
@echo Compiling $<
@$(CC) -Wall -c $(CFLAGS_S1AP) $(S1AP_Incl) $(UTIL_incl) -o $@ $<
$(ASN1MESSAGESDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
echo Timestamp > $@
(cd $(ASN1DIR) && python $(ASN1DIR)/asn1tostruct.py -f$<)
$(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU.asn
echo Timestamp > $@
(cd $(ASN1MESSAGESDIR) && asn1c -gen-PER -fnative-types -fskeletons-copy $^)
$(S1AP_DIR)/libs1ap.a: $(ASN1MESSAGESDIR)/s1ap_ieregen.stamp $(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp $(S1AP_BUILT_OBJS)
@echo Creating $@
$(AR) rcs $@ $^
$(LFDS_DIR)/bin/liblfds611.a:
$(MAKE) -C $(LFDS_DIR) -f makefile.linux
ifdef USE_MME
lte-enb: $(OBJ) $(S1AP_DIR)/libs1ap.a $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(LFDS_DIR)/bin/liblfds611.a
else
lte-enb: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(LFDS_DIR)/bin/liblfds611.a
endif
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-enb $(LDFLAGS) $(LFDS_DIR)/bin/liblfds611.a
nasmesh:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
(cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink.ko)
(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
rb_tool:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
nasmesh_install:
(sudo rmmod nasmesh)
(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
clean:
rm -rf $(OBJ) $(RTAI_OBJ)
rm -f $(S1AP_BUILT_OBJS)
rm -f $(ASN1MESSAGESDIR)/libs1ap.a
cleanasn1:
rm -f $(ASN1_MSG_OBJS1)
$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d )
rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8
rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10
cleanall: clean cleanasn1
rm -rf condtest synctest lte-softmodem
rm -rf synctest_eNB synctest_UE
show:
@echo $(CFLAGS)
@echo $(EXTRA_CFLAGS)
@echo $(OBJ) $(RTAI_OBJ)
@echo rrc_cellular variable is $(rrc_cellular)
@echo eNB_flag is $(eNB_flag)
@echo UE_flag is $(UE_flag)
@echo IS_REL8 is $(IS_REL8)
@echo IS_REL10 is $(IS_REL10)
beautiful:
astyle --style=gnu -s2 $(SRC)
CFLAGS = $(shell rtai-config --lxrt-cflags)
LDFLAGS = $(shell rtai-config --lxrt-ldflags) -lpthread -llxrt -lm
CFLAGS += -D__IN_RTAI__ -Wall -O2 -I.
OBJS = msg_many.o msg_helper.o
all: msg_many
msg_many: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS)
$(OBJS): msg_many.h
run: msg_many
rtai-load msg_many --verbose
.PHONY: clean
clean:
rm -f msg_many $(OBJS)
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <sched.h>
#include "thread_ipc.h"
g_thread_ipc_t thread_ipc = {0};
void loop_buffer_reset(buffer_t *loop_buf)
{
int i;
for (i = 0; i < BUFFERMAX; i++) {
loop_buf[i].subframe_num = -1;
}
return;
}
static void loop_buffer_init(loop_buffer_op_t *loop_buffer)
{
loop_buffer->packet_num = 0;
loop_buffer->isfull = 0;
loop_buffer->isempty = 1;
pthread_mutex_init(&loop_buffer->buffer_mutex, NULL);
pthread_cond_init(&loop_buffer->full_cond, NULL);
pthread_cond_init(&loop_buffer->empty_cond, NULL);
loop_buffer_reset(loop_buffer->loop_buf);
return;
}
static void sync_buffer_init(sync_buffer_t *sync_buffer)
{
sync_buffer->decoding_subframe_num = 0;
pthread_mutex_init(&sync_buffer->buffer_mutex, NULL);
return;
}
int thread_ipc_init(void)
{
//printf("recv %d\n", thread_ipc.sync_buffer.decoding_subframe_num);
thread_ipc.ue_sync_state = 0;
thread_ipc.rx_timestamp = 0;
thread_ipc.tx_timestamp = 0;
thread_ipc.current_subframe = 0;
pthread_mutex_init(&thread_ipc.dl_decode_mutex, NULL);
pthread_mutex_lock(&thread_ipc.dl_decode_mutex);
pthread_mutex_init(&thread_ipc.ul_send_mutex, NULL);
pthread_mutex_lock(&thread_ipc.ul_send_mutex);
pthread_mutex_init(&thread_ipc.sync_mutex, NULL);
pthread_mutex_lock(&thread_ipc.sync_mutex);
loop_buffer_init(&thread_ipc.loop_buffer);
sync_buffer_init(&thread_ipc.sync_buffer);
return 0;
}
int thread_ipc_deinit(void)
{
pthread_mutex_destroy(&thread_ipc.ul_send_mutex);
pthread_mutex_destroy(&thread_ipc.sync_mutex);
pthread_mutex_destroy(&thread_ipc.dl_decode_mutex);
pthread_mutex_destroy(&thread_ipc.loop_buffer.buffer_mutex);
pthread_cond_destroy(&thread_ipc.loop_buffer.full_cond);
pthread_cond_destroy(&thread_ipc.loop_buffer.empty_cond);
pthread_mutex_destroy(&thread_ipc.sync_buffer.buffer_mutex);
return 0;
}
int set_thread_attr(pthread_attr_t *attr, int policy, int priority, int cpuid)
{
struct sched_param param;
cpu_set_t cpu_info;
pthread_attr_init(attr);
if (pthread_attr_setschedpolicy(attr, policy) != 0) {
perror("pthread_attr_setschedpolicy");
return -1;
}
param.sched_priority = priority;
if (pthread_attr_setschedparam(attr, &param) != 0) {
perror("pthread_attr_setschedparam");
return -1;
}
CPU_ZERO(&cpu_info);
CPU_SET(cpuid, &cpu_info);
if (pthread_attr_setaffinity_np(attr,sizeof(cpu_set_t),&cpu_info)) {
perror("pthread_attr_setaffinity_np");
return -1;
}
if (pthread_attr_setinheritsched(attr, PTHREAD_EXPLICIT_SCHED) != 0) {
perror("pthread_attr_setinheritsched");
return -1;
}
return 0;
}
int find_subframe_num(unsigned long long current_subframe_num, buffer_t *buf, int *flag)
{
long long tmp;
int i;
tmp = current_subframe_num;
for ( i = 0; i < HIGHBUFFER + 1; i++)
{
if(tmp == buf[i].subframe_num)
{
return i;
} else if (tmp < buf[i].subframe_num) {
*flag = 1;
}
}
return -1;
}
int ue_unsync_thread_ipc_reset(void)
{
thread_ipc.ue_sync_state = 0;
pthread_mutex_lock(&thread_ipc.loop_buffer.buffer_mutex);
if (thread_ipc.loop_buffer.isempty) {
pthread_cond_signal(&thread_ipc.loop_buffer.empty_cond);
}
if (thread_ipc.loop_buffer.isfull) {
pthread_cond_signal(&thread_ipc.loop_buffer.full_cond);
}
thread_ipc.loop_buffer.packet_num = 0;
thread_ipc.loop_buffer.isfull = 0;
thread_ipc.loop_buffer.isempty = 1;
loop_buffer_reset(thread_ipc.loop_buffer.loop_buf);
pthread_mutex_unlock(&thread_ipc.loop_buffer.buffer_mutex);
thread_ipc.current_subframe = 0;
return 0;
}
void bind_thread2kernel(int cpu_id)
{
cpu_set_t mask;
cpu_set_t get;
int i;
int num = sysconf(_SC_NPROCESSORS_CONF);
//printf("system has %d processor(s) by super\n", num);
CPU_ZERO(&mask);
CPU_SET(cpu_id, &mask);
if (pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) < 0) {
fprintf(stderr, "set thread affinity failed\n");
}
/*CPU_ZERO(&get);
if (pthread_getaffinity_np(pthread_self(), sizeof(get), &get) < 0) {
fprintf(stderr, "get thread affinity failed\n");
}
for (i = 0; i < num; i++) {
if (CPU_ISSET(i, &get)) {
printf("thread %d is running in processor %d\n", (int)pthread_self(), i);
}
}
if (CPU_ISSET(cpu_id, &get)) {
printf("thread %d is running in processor %d by super\n", (int)pthread_self(), cpu_id);
}*/
}
void get_thread2kernel(void)
{
cpu_set_t get;
int i;
int num = sysconf(_SC_NPROCESSORS_CONF);
printf("system has %d processor(s) by super\n", num);
CPU_ZERO(&get);
if (pthread_getaffinity_np(pthread_self(), sizeof(get), &get) < 0) {
fprintf(stderr, "get thread affinity failed\n");
}
for (i = 0; i < num; i++) {
if (CPU_ISSET(i, &get)) {
printf("The thread %d is running in processor %d by super\n", (int)pthread_self(), i);
}
}
}
#ifndef __THREAD_IPC_H__
#define __THREAD_IPC_H__
#define SUB_FRAME_LENGTH 7680
#define FRAME_LENGTH 76800
#define UE_UL_DELAY 6 /*设置上行组帧在同步时钟基础上的延时(子帧个数)*/
#define UE_UL_SEND_DELAY 6 /*上行发送子帧号在接收子帧时间戳上的延时(子帧个数)*/
#define BUFFERMAX 5 /*环形缓冲区个数*/
#define LOWBUFFER 3 /*环形缓冲区下限, 不能为0*/
#define HIGHBUFFER 4 /*环形缓冲区上限*/
typedef struct {
long long subframe_num; /*子帧编号*/
int buffer[SUB_FRAME_LENGTH * 2]; /*一子帧数据*/
}buffer_t;
typedef struct {
int packet_num; /*环形缓冲区数据包计数器,表示环形缓冲区有效数据包个数*/
int isfull; /*标记环形缓冲区有效数据包是否达到上限标志*/
int isempty; /*标记环形缓冲区有效数据包是否达到下限标志*/
pthread_mutex_t buffer_mutex; /*环形缓冲区操作保护锁*/
pthread_cond_t full_cond; /*环形缓冲区上限条件变量,配合isfull使用 */
pthread_cond_t empty_cond; /*环形缓冲区下限条件变量,配合isempty使用*/
buffer_t loop_buf[BUFFERMAX]; /*环形缓冲区*/
}loop_buffer_op_t;
typedef struct {
int decoding_subframe_num; /*待解码子帧的编号*/
pthread_mutex_t buffer_mutex; /*对sync_buffer临界区的保护锁*/
int sync_buffer[SUB_FRAME_LENGTH * 10]; /*同步线程与下行解码线程数据共享缓冲区*/
}sync_buffer_t;
typedef struct {
unsigned int rx_timestamp; /*接收数据包第一个sample时间戳*/
unsigned int tx_timestamp; /*待发送数据包的时间戳*/
unsigned long long current_subframe; /*当前子帧编号*/
int ue_sync_state; /*表示UE是否在同步状态,0表示失同步,1表示同步*/
pthread_mutex_t sync_mutex; /*根据ue_sync_state标志,唤醒组帧线程*/
pthread_mutex_t ul_send_mutex; /*用于sync线程唤醒发送线程发送数据*/
pthread_mutex_t dl_decode_mutex;/*下行解码保护锁,用于sync线程唤醒解码线程解码*/
loop_buffer_op_t loop_buffer;
sync_buffer_t sync_buffer;
}g_thread_ipc_t;
void loop_buffer_reset(buffer_t *loop_buf);
int thread_ipc_init(void);
int thread_ipc_deinit(void);
int set_thread_attr(pthread_attr_t *attr, int policy, int priority, int cpuid);
int find_subframe_num(unsigned long long current_subframe_num, buffer_t *buf, int *flag);
int ue_unsync_thread_ipc_reset(void);
extern g_thread_ipc_t thread_ipc;
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sched.h>
#include <rtai_lxrt.h>
#include <rtai_sem.h>
#include <rtai_msg.h>
#define PERIOD 100000000
#define THRESHOLD 1
static SEM *mutex;
static CND *cond;
static int thread0;
static int thread1;
static int instance_cnt=-1; //0 means worker is busy, -1 means its free
static void *fun0(void *arg)
{
RT_TASK *task;
int done1=0, cnt1=0;
RTIME right_now;
int ret;
task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
mlockall(MCL_CURRENT | MCL_FUTURE);
rt_make_hard_real_time();
while (cnt1 < THRESHOLD)
{
rt_sem_wait(mutex);
rt_printk("fun0: Hello World %d, instance_cnt %d!\n",cnt1,instance_cnt);
while (instance_cnt<0)
{
ret = rt_cond_wait(cond, mutex);
if (ret != 0)
{
rt_printk("error in rt_cond_wait, code %d\n",ret);
switch (ret)
{
case RTE_PERM:
rt_printk("error RTE_PERM %d\n",ret);
break;
case RTE_UNBLKD:
rt_printk("error RTE_UNBLKD %d\n",ret);
break;
case RTE_OBJREM:
rt_printk("error RTE_OBJREM %d\n",ret);
break;
default:
rt_printk("unknown error code %d\n",ret);
break;
}
break;
}
}
rt_sem_signal(mutex);
// do some work here
cnt1++;
rt_sem_wait(mutex);
instance_cnt--;
rt_sem_signal(mutex);
}
// makes task soft real time
rt_make_soft_real_time();
printf("Back to soft RT\n");
// clean task
rt_task_delete(task);
printf("Task deleted. returning\n");
return 0;
}
int main(void)
{
RT_TASK *task;
RTIME now;
int cnt=0;
// make main thread LXRT soft realtime
task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
mlockall(MCL_CURRENT | MCL_FUTURE);
// start realtime timer and scheduler
//rt_set_oneshot_mode();
rt_set_periodic_mode();
start_rt_timer(0);
now = rt_get_time() + 10*PERIOD;
rt_task_make_periodic(task, now, PERIOD);
printf("Init mutex and cond.\n");
mutex = rt_sem_init(nam2num("MUTEX"), 1);
if (mutex==0)
printf("Error init mutex\n");
cond = rt_cond_init(nam2num("CONDITION"));
if (cond==0)
printf("Error init cond\n");
thread0 = rt_thread_create(fun0, NULL, 10000);
//thread1 = rt_thread_create(fun1, NULL, 20000);
//rt_sleep(PERIOD);
while (cnt < THRESHOLD)
{
rt_task_wait_period();
rt_printk("main: Hello World %d!\n",cnt);
rt_sem_wait(mutex); //now the mutex should have value 0
if (instance_cnt==0)
{
rt_sem_signal(mutex); //now the mutex should have vaule 1
rt_printk("worker thread busy!\n");
}
else
{
instance_cnt++;
rt_cond_signal(cond);
rt_sem_signal(mutex); //now the mutex should have vaule 1
rt_printk("signaling worker thread to start!\n");
}
cnt++;
}
// wait for end of program
printf("TYPE <ENTER> TO TERMINATE\n");
getchar();
// cleanup
stop_rt_timer();
return 0;
}
This diff is collapsed.
This diff is collapsed.
8254992 8254992 8257340 8257340
\ No newline at end of file
8254744 8255063 8257340 8257340
# this file contains the calibration values to compute the RSSI
# we can use three different gain stages (high, low, med) as well as a gain factor for fine tuning
# the three lines in this file gives the total rx gain in dB for the three gain stages if the rx gain is set to 30dB
# high gain
138 138 138 138
# med gain
129 129 129 129
# low gain
120 120 120 120
# For the TX, we need to set the tx gain values such that the transmitted power on all antennas is the same
# tx gain (dB)
25 19 25 25
# total tx power (dBm)
17
8255067 8254810 8257340 8257340
133 133 133 133
127 127 127 127
120 120 120 120
8256036 8256804 8257340 8257340
# this file contains the calibration values to compute the RSSI
# we can use three different gain stages (high, low, med) as well as a gain factor for fine tuning
# the three lines in this file gives the total rx gain in dB for the three gain stages if the rx gain is set to 30dB
# this is for Express MIMO2 without any additional RF frontend
# high gain
124 124 124 124
# med gain
118 118 118 118
# low gain (byp)
109 109 109 109
# For the TX, we need to set the tx gain values such that the transmitted power on all antennas is the same
# tx gain (dB)
# 25 19 25 25
10 10 10 10
# total tx power (dBm)
17
8254212 8256991 8257340 8257340
# this file contains the calibration values to compute the RSSI
# we can use three different gain stages (high, low, med) as well as a gain factor for fine tuning
# the three lines in this file gives the total rx gain in dB for the three gain stages if the rx gain is set to 30dB
# this is for Express MIMO2 without any additional RF frontend
# high gain
124 124 124 124
# med gain
118 118 118 118
# low gain (byp)
109 109 109 109
# For the TX, we need to set the tx gain values such that the transmitted power on all antennas is the same
# tx gain (dB)
# 25 19 25 25
0 0 0 0
# total tx power (dBm)
17
/******************************************************************************
*
* Copyright(c) EURECOM / Thales Communications & Security
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* Thales Communications & Security <philippe.agostini@thalesgroup.com>
*
*****************************************************************************/
/******************************************************************************
*
* Includes
*
*****************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "ieee80211p-netlinkapi.h"
#include "phy/DOT11/defs.h"
#include "PHY/TOOLS/defs.h"
#include <stdint.h>
#include <string.h>
#include <pthread.h>
#include <rtai_lxrt.h>
#include <rtai_sem.h>
#include <rtai_msg.h>
/******************************************************************************
*
* Definitions
*
*****************************************************************************/
enum nl80211_band {
NL80211_BAND_2GHZ,
NL80211_BAND_5GHZ,
NL80211_BAND_5_9GHZ,
NL80211_BAND_0_8GHZ,
};
enum ieee80211_band {
IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
IEEE80211_BAND_5_9GHZ = NL80211_BAND_5_9GHZ,
IEEE80211_BAND_0_8GHZ = NL80211_BAND_0_8GHZ,
};
struct ieee80211p_rx_status {
short data_len; //frame data length in bytes
char rssi; //received power in dBm
char rate; //reveived data rate in units of 100 kbps
enum ieee80211_band band;
char flags; //RX flags
}; /* struct ieee80211p_rx_status */
extern uint32_t *txdata[2],*rxdata[2];
//CHANNEL_STATUS_t dot11_state = IDLE;
extern int oai_exit;
extern unsigned int *DAQ_MBOX;
extern int Ndbps[8];
extern int32_t rxDATA_F_comp_aggreg2[48*1024];
extern int32_t rxDATA_F_comp_aggreg3[48*1024];
extern uint32_t rxgain[4];
extern uint32_t rxg_max[4], rxg_med[4], rxg_byp[4];
#define FRAME_LENGTH_SAMPLES 76800
#define RX_THRES 60
#define SLOT_DURATION_5MHz 105
#define RX_THRES_dB 40
int tx_sdu_active = 0;
int tx_sdu_length = 0;
char rxsdu[2000];
void *tx_thread(void *arg) {
int fd=*((int*)arg);
RT_TASK *task;
int ret;
int i;
char dummy_data[10];
if (fd > 0) {
ret = netlink_send(fd,NLCMD_INIT,10,&dummy_data[0]);
printf("tx_thread starting, fd %d\n",fd);
task = rt_task_init_schmod(nam2num("TASK1"), 0, 0, 0, SCHED_FIFO, 0xF);
mlockall(MCL_CURRENT | MCL_FUTURE);
// rt_make_hard_real_time();
while (!oai_exit) {
if (tx_sdu_active == 1)
printf("tx_thread: waiting (MBOX %d)\n",((unsigned int*)DAQ_MBOX)[0]);
while(((volatile int)tx_sdu_active) != 0) {
rt_sleep(nano2count(66666));
}
printf("tx_thread: calling netlink\n");
ret = netlink_recv(fd,rxsdu);
tx_sdu_active = 1;
tx_sdu_length = ret;
/*
if (ret > 0) {
printf("received TX SDU: ");
for (i=0;i<ret;i++) {
printf("%02hhx ",rxsdu[i]);
}
printf("\n");
}
*/
}
}
else {
printf("tx_thread: no netlink\n");
}
printf("tx_thread exiting\n");
return(0);
}
/******************************************************************************
*
* Main
*
*****************************************************************************/
/*
int dot11_netlink_init() {
int fd;
int ret;
int i;
char txdata[10];
fd = netlink_init();
if (fd < 0) {
return -1;
}
ret = netlink_send(fd,NLCMD_INIT,10,&txdata[0]);
return(fd);
}
*/
sudo rmmod openair_rf
sudo insmod $OPENAIR1_DIR/ARCH/CBMIMO1/DEVICE_DRIVER/openair_rf_softmodem.ko
sudo mknod /dev/openair0 c 127 0
sudo chmod a+rw /dev/openair0
$OPENAIR1_DIR/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $OPENAIR1_DIR/USERSPACE_TOOLS/OAI_FW_INIT/main -s 0x43fffff0
sudo rmmod openair_rf
sudo insmod $OPENAIR1_DIR/ARCH/CBMIMO1/DEVICE_DRIVER/openair_rf_softmodem.ko
sudo rmmod nasmesh
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
#!/bin/bash
PCI=`lspci -m | grep Xilinx`
if [ -z "$PCI" ]; then
echo "No card found. Stopping!"
return
fi
## This part corrects the wrong configuration of the endpoint done by the bios in some machines
echo "$PCI" | while read config_reg; do
SLOT_NUMBER=`echo $config_reg | awk -F\" '{print $1}'`
sudo setpci -s $SLOT_NUMBER 60.b=10
done
sudo rmmod openair_rf
sudo insmod $OPENAIR_TARGETS/ARCH/EXMIMO/DRIVER/eurecom/openair_rf.ko
sleep 1
if [ ! -e /dev/openair0 ]; then
sudo mknod /dev/openair0 c 127 0
sudo chmod a+rw /dev/openair0
fi
DEVICE=`echo $PCI | awk -F\" '{print $(NF-1)}' | awk '{print $2}'`
if [ $DEVICE == '2208' ]; then
echo "Using firmware version 8"
$OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw -s 0x43fffff0 -b -f $OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2
else
if [ $DEVICE == '2209' ]; then
echo "Using firmware version 9"
#$OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw -s 0x43fffff0 -b -f $OPENAIR0_DIR/express-mimo/software/sdr/exmimo2/sdr_expressmimo2
$OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw -s 0x43fffff0 -b -f $OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v9
else
if [ $DEVICE == '220a' ]; then
echo "Using firware version 10"
$OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw -s 0x43fffff0 -b -f $OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10
else
echo 'No corresponding firmware found'
return
fi
fi
fi
sudo rmmod nasmesh
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
if [ "$1" = "eNB" ]; then
echo "bring up oai0 interface for enb"
sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.9 -r 3
else
if [ "$1" = "UE" ]; then
echo "bring up oai0 interface for UE"
sudo ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.9 -t 10.0.1.1 -r 3
fi
fi
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Form definition file generated by fdesign */
#include <stdlib.h>
#include "lte_scope.h"
/***************************************
***************************************/
FD_lte_scope *
create_form_lte_scope( void )
{
FL_OBJECT *obj;
FD_lte_scope *fdui = fl_malloc( sizeof *fdui );
fdui->vdata = fdui->cdata = NULL;
fdui->ldata = 0;
fdui->lte_scope = fl_bgn_form( FL_NO_BOX, 780, 723 );
obj = fl_add_box( FL_ROUNDED_BOX, 0, 0, 780, 723, "" );
fl_set_object_color( obj, FL_BLACK, FL_BLUE );
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_color( obj, FL_BLACK, FL_BLUE );
fl_set_object_lcolor( obj, FL_WHITE );
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_color( obj, FL_BLACK, FL_BLUE );
fl_set_object_lcolor( obj, FL_WHITE );
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_color( obj, FL_BLACK, FL_RED );
fl_set_object_lcolor( obj, FL_WHITE );
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_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 );
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_color( obj, FL_BLACK, FL_GREEN );
fl_set_object_lcolor( obj, FL_WHITE );
fdui->scatter_plot2 = obj = fl_add_xyplot( FL_POINTS_XYPLOT, 600, 440, 160, 190, "PDSCH/PUSCH Scatter Plot" );
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->scatter_plot1 = obj = fl_add_xyplot( FL_POINTS_XYPLOT, 600, 20, 160, 190, "PDCCH Scatter Plot" );
fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
fl_set_object_color( obj, FL_BLACK, FL_CYAN );
fl_set_object_lcolor( obj, FL_WHITE );
fdui->ia_receiver_button = obj = fl_add_button( FL_PUSH_BUTTON, 620, 660, 130, 40, "IA receiver OFF" );
fl_set_object_lalign( obj, FL_ALIGN_CENTER );
fl_set_object_color( obj, FL_RED, FL_RED);
fl_set_object_callback( obj, ia_receiver_on_off, 0 );
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_color( obj, FL_BLACK, FL_WHITE );
fl_set_object_lcolor( obj, FL_WHITE );
*/
fl_end_form( );
fdui->lte_scope->fdui = fdui;
return fdui;
}
Magic: 14000
Internal Form Definition File
(do not change)
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
Name: lte_scope
Width: 780
Height: 723
Number of Objects: 11
--------------------
class: FL_BOX
type: ROUNDED_BOX
box: 0 0 780 723
boxtype: FL_ROUNDED_BOX
colors: FL_BLACK FL_BLUE
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_XYPLOT
type: NORMAL_XYPLOT
box: 20 20 280 100
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_BLUE
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: Received Signal (Time-Domain, dB)
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: channel_t_re
callback:
argument:
--------------------
class: FL_XYPLOT
type: POINTS_XYPLOT
box: 600 230 160 190
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_GREEN
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: PBCH Scatter Plot
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: scatter_plot
callback:
argument:
--------------------
class: FL_XYPLOT
type: IMPULSE_XYPLOT
box: 20 140 570 90
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_RED
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: Frequency Domain Channel Estimate
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: channel_f
callback:
argument:
--------------------
class: FL_XYPLOT
type: NORMAL_XYPLOT
box: 310 20 280 100
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_BLUE
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: Time-Domain Channel Estimate
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: channel_t_im
callback:
argument:
--------------------
class: FL_XYPLOT
type: POINTS_XYPLOT
box: 20 250 570 130
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_GREEN
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: PBCH Decoder Input
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: decoder_input
callback:
argument:
--------------------
class: FL_XYPLOT
type: POINTS_XYPLOT
box: 600 440 160 190
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: PDSCH/PUSCH Scatter Plot
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: scatter_plot2
callback:
argument:
--------------------
class: FL_XYPLOT
type: POINTS_XYPLOT
box: 600 20 160 190
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_CYAN
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: PDCCH Scatter Plot
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: scatter_plot1
callback:
argument:
--------------------
class: FL_BUTTON
type: PUSH_BUTTON
box: 620 660 130 40
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: IA receiver OFF
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: ia_receiver_button
callback: ia_receiver_on_off
argument: 0
--------------------
class: FL_XYPLOT
type: POINTS_XYPLOT
box: 20 400 570 140
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: PDSCH/PUSCH Decoder Input
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: demod_out
callback:
argument:
--------------------
class: FL_XYPLOT
type: NORMAL_XYPLOT
box: 20 560 570 140
boxtype: FL_EMBOSSED_BOX
colors: FL_BLACK FL_WHITE
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_WHITE
label: Throughput [kbits/s]
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: tput
callback:
argument:
==============================
create_the_forms
/* Header file generated by fdesign on Tue Nov 13 09:42:50 2012 */
#ifndef FD_lte_scope_h_
#define FD_lte_scope_h_
#include <forms.h>
/* Callbacks, globals and object handlers */
extern void ia_receiver_on_off( FL_OBJECT *, long );
/* Forms and Objects */
typedef struct {
FL_FORM * lte_scope;
void * vdata;
char * cdata;
long ldata;
FL_OBJECT * channel_t_re[4];
FL_OBJECT * channel_t_im[4];
/*
FL_OBJECT * scatter_plot;
FL_OBJECT * channel_f;
FL_OBJECT * decoder_input;
FL_OBJECT * scatter_plot2;
FL_OBJECT * scatter_plot1;
FL_OBJECT * ia_receiver_button;
FL_OBJECT * demod_out;
FL_OBJECT * tput;
*/
} FD_lte_scope;
extern FD_lte_scope * create_form_lte_scope( void );
#endif /* FD_lte_scope_h_ */
#!/bin/bash
############### make nasmesh.ko ###############
sudo rmmod nasmesh
#cd ${OPENAIR2_DIR} && make nasmesh_netlink.ko
#cd ${OPENAIR2_DIR}/NAS/DRIVER/MESH/RB_TOOL/ && make
#make all
sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
############## Ethernet config ####################
sudo ifconfig eth0 mtu 4000
sudo sysctl -w net.core.wmem_max=1048576
sudo sysctl -w net.core.rmem_max=50000000
############## rtai modules ###################
if test \! -c /dev/rtai_shm; then
sudo mknod -m 666 /dev/rtai_shm c 10 254
fi
for n in `seq 0 9`; do
f=/dev/rtf$n
if test \! -c $f; then
sudo mknod -m 666 $f c 150 $n
fi
done
sudo modprobe rtai_hal
sudo modprobe rtai_sched
sudo modprobe rtai_fifos
sudo modprobe rtai_sem
sudo modprobe rtai_mbx
sudo modprobe rtai_msg
############## make ###################
make lte-softmodem-usrp NAS=1 USRP=1 XFORMS=1 RTAI=1 HARD_RT=1 #DRIVER2013=1
#make lte-softmodem NAS=1 XFORMS=1 USRP=0 RTAI=1 DRIVER2013=1
echo DONE!
exit 0
#include <rtai_sem.h>
#include "msg_many.h"
/*
* Add a task task to ri->worker.
* Return the used index in ri->worker on success
* Return -TM_WORKER_FULL_ERROR if ri->worker full
* Return -TM_WORKER_ERROR else
*/
int tm_add_task(RT_TASK *task, run_info_t *ri)
{
if(ri->used >= NUM_THREADS)
return -TM_WORKER_FULL_ERROR;
rt_sem_wait(ri->update_sem);
(*ri->worker)[ri->used] = task;
ri->used++;
rt_sem_signal(ri->update_sem);
return ri->used - 1;
}
/*
* Remove the a hole in worker at index index by
* shift the next slots by one.
* This function assume that update_sem are locked.
* Return the new used counter.
*/
int _tm_clean_worker(RT_TASK *(*worker)[], int index, int used)
{
int i;
for(i = index; i < used; i++)
(*worker)[i] = (*worker)[i + 1];
return used - 1;
}
/*
* Remove a task from ri->worker a index task_index
* Return 0 on success
* Return -TM_WORKER_ERROR else
*/
int tm_del_task(int task_index, run_info_t *ri)
{
rt_sem_wait(ri->update_sem);
ri->used = _tm_clean_worker(ri->worker, task_index, ri->used);
rt_sem_signal(ri->update_sem);
return 0;
}
/*
* Return next index to use on ri->worker.
* It depends on the old_index and ri->used.
* Return -TM_WORKER_ERROR if ri->used == 0.
*/
inline int tm_get_next_task_index(int old_index, run_info_t *ri)
{
if(ri->used == 0)
return -TM_WORKER_ERROR;
return (old_index + 1) % ri->used;
}
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sched.h>
#include <rtai_lxrt.h>
#include <rtai_sem.h>
#include <rtai_msg.h>
#include "msg_many.h"
static void *msg_test_thread(void *arg)
{
RT_TASK *self;
RT_TASK *sender_task;
thread_info_t *ti = (thread_info_t *)arg;
run_info_t *ri = ti->ri;
unsigned int msg;
int counter = 0;
char name[6];
int task_index;
/* Build custom task name for each thread */
snprintf(name, 6, "%s%03i", THREAD_NAME_PREFIX, ti->thread_num);
self = rt_task_init_schmod(nam2num(name), 0, 0, 0, SCHED_FIFO, 0xF);
mlockall(MCL_CURRENT | MCL_FUTURE);
rt_make_hard_real_time();
task_index = tm_add_task(self, ri);
if(task_index != -TM_WORKER_FULL_ERROR)
{
while (*(ri->exit_condition) == 0)
{
// wait only one PERIOD to avoid wait for ever
sender_task = rt_receive_timed(ri->sender, &msg, ri->period);
//sender_task = rt_receive(0, &msg);
if(sender_task == ri->sender)
counter++;
}
rt_printk("%s: counter == %i\n", name, counter);
tm_del_task(task_index, ri);
} else {
rt_printk("%s: Worker array full!\n", name);
}
rt_make_soft_real_time();
rt_task_delete(self);
free((void *) ti);
return 0;
}
int main(void)
{
RT_TASK *self;
RT_TASK *tmp_worker_task;
RT_TASK *worker_tasks[NUM_THREADS];
int worker_threads[NUM_THREADS];
RTIME now;
unsigned int i, ii;
run_info_t ri;
thread_info_t *ti;
uint8_t exit_condition = 0;
int fail_count = 0;
int old_index = 0;
uint8_t lost;
// make main thread LXRT soft realtime
self = rt_task_init_schmod(nam2num("MAINTK"), 10, 0, 0, SCHED_FIFO, 0xF);
mlockall(MCL_CURRENT | MCL_FUTURE);
rt_make_hard_real_time();
rt_set_periodic_mode();
start_rt_timer(0);
/* Build all information need to run in main and the thread */
ri.sender = self;
ri.exit_condition = &exit_condition;
ri.period = nano2count(PERIOD);
ri.update_sem = rt_sem_init(nam2num("MUTEX"), 1);
if(ri.update_sem == 0)
exit(-1);
ri.used = 0;
ri.worker = &worker_tasks;
now = rt_get_time() + ri.period;
rt_task_make_periodic(self, now, ri.period);
/* start all threads */
for(i = 0; i < NUM_THREADS; i++)
{
ti = (thread_info_t *)malloc(sizeof(thread_info_t));
if(ti == NULL)
{
rt_printk("MAINTK: can't get memory!\n");
exit(-1);
}
ti->ri = &ri;
ti->thread_num = i;
worker_threads[i] = rt_thread_create(msg_test_thread, ti , 10000);
}
rt_sleep(NUM_THREADS * ri.period);
rt_printk("start\n");
for(i = 0; i < THRESHOLD; i++)
{
rt_task_wait_period();
lost = 1;
for(ii = 0; ii < ri.used; ii++)
{
old_index = tm_get_next_task_index(old_index, &ri);
if(old_index == -TM_WORKER_ERROR)
{
rt_printk("MAINTK: No Tasks!\n");
break;
}
tmp_worker_task = rt_send_if(worker_tasks[old_index], i);
if(tmp_worker_task == worker_tasks[old_index])
{
lost = 0;
break;
}
}
if(lost)
fail_count++;
}
rt_printk("fail_count == %i\n", fail_count);
// cleanup
exit_condition = 1;
rt_make_soft_real_time();
rt_task_delete(self);
/* wait for the worker threadss */
for(ii = 0; ii < ri.used; ii++)
{
rt_thread_join(worker_threads[ii]);
}
stop_rt_timer();
return 0;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Header file generated by fdesign on Thu Jun 14 17:53:15 2012 */
#ifndef FD_stats_form_h_
#define FD_stats_form_h_
#include <forms.h>
/* Callbacks, globals and object handlers */
/* Forms and Objects */
typedef struct {
FL_FORM * stats_form;
void * vdata;
char * cdata;
long ldata;
FL_OBJECT * stats_text;
} FD_stats_form;
extern FD_stats_form * create_form_stats_form( void );
#endif /* FD_stats_form_h_ */
This diff is collapsed.
8254752 8254752 8254752 8254752
This diff is collapsed.
This diff is collapsed.
8254871 8255752 8257340 8257340
This diff is collapsed.
This diff is collapsed.
8255000 8255000 8255000 8255000
This diff is collapsed.
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