Commit 1f7abbc0 authored by knopp's avatar knopp
Browse files

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5952 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 7785b5aa
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 1
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 1
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->channel_t_re[3] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 380, 280, 100, "Real(RX3)" );
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->channel_t_im[3] = obj = fl_add_xyplot( FL_NORMAL_XYPLOT, 310, 380, 280, 100, "Imag(RX3)" );
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_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_ */