Commit 082dff13 authored by navid's avatar navid

* add RF interface to the rrh gateway

* update the openair0_init for all targets
* add a tuning function for the ethernet



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7830 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 471efb41
......@@ -392,7 +392,7 @@ elseif (${RF_BOARD} STREQUAL "ETHERNET")
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
)
set(LOWLATENCY False)
set(LOWLATENCY True)
elseif (${RF_BOARD} STREQUAL "CPRIGW")
set(HW_SOURCE ${HW_SOURCE}
......@@ -1558,6 +1558,7 @@ add_executable(lte-softmodem
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIRCN_DIR}/NAS/UE/nas_ue_task.c
${GTPU_need_ITTI}
......@@ -1591,6 +1592,7 @@ add_executable(lte-softmodem-nos1
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
#${OPENAIR2_DIR}/RRC/NAS/nas_config.c # enable if you want rrc to mount ip interface
#${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
......@@ -1726,6 +1728,7 @@ add_executable(rrh_gw
${OPENAIR_TARGETS}/RT/USER/eNB_transport_IQ.c
${OPENAIR_TARGETS}/RT/USER/UE_transport_IQ.c
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
${HW_SOURCE}
)
......
......@@ -92,6 +92,8 @@ const char* eurecomVariablesNames[] = {
"diff2",
"hw_subframe",
"hw_frame",
"hw_subframe_rx",
"hw_frame_rx",
"txcnt",
"rxcnt",
"trx_ts",
......@@ -103,6 +105,8 @@ const char* eurecomVariablesNames[] = {
"hw_cnt_tx",
"lhw_cnt_tx",
"pck_rx",
"pck_tx",
"cnt",
"dummy_dump",
"itti_send_msg",
"itti_poll_msg",
......@@ -150,6 +154,8 @@ const char* eurecomFunctionsNames[] = {
"eNB_rx_sleep",
"eNB_tx_sleep",
"eNB_proc_sleep",
"trx_read_rf",
"trx_write_rf",
/* PHY signals */
"ue_synch",
......
......@@ -64,6 +64,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_DIFF,
VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME,
VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME,
VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME_RX,
VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME_RX,
VCD_SIGNAL_DUMPER_VARIABLES_TXCNT,
VCD_SIGNAL_DUMPER_VARIABLES_RXCNT,
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS,
......@@ -75,6 +77,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_TX_HWCNT,
VCD_SIGNAL_DUMPER_VARIABLES_TX_LHWCNT,
VCD_SIGNAL_DUMPER_VARIABLES_RX_PCK,
VCD_SIGNAL_DUMPER_VARIABLES_TX_PCK,
VCD_SIGNAL_DUMPER_VARIABLES_CNT,
VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
......@@ -117,7 +121,6 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX,
/* RRH signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TRX,
......@@ -125,6 +128,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX_SLEEP,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX_SLEEP,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_SLEEP,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_RF,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_RF,
/* PHY signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,
......
......@@ -185,7 +185,7 @@ int trx_brf_set_gains(openair0_device* device) {
}
int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openair0_cfg) {
int status;
int card=0;
......
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface 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 OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file common_lib.c
* \brief common APIs for different RF frontend device
* \author HongliangXU, Navid Nikaein
* \date 2015
* \version 0.2
* \company Eurecom
* \maintainer: navid.nikaein@eurecom.fr
* \note
* \warning
*/
#include <stdio.h>
#include "common_lib.h"
int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
#ifdef ETHERNET
device->type=ETH_IF;
device->func_type = BBU_FUNC;
openair0_dev_init_eth(device, openair0_cfg);
printf(" openair0_dev_init_eth ...\n");
#elif EXMIMO
device->type=EXMIMO_IF;
openair0_dev_init_exmimo(device, openair0_cfg);
printf("openair0_dev_init_exmimo...\n");
#elif OAI_USRP
device->type=USRP_IF;
openair0_dev_init_usrp(device, openair0_cfg);
printf("openair0_dev_init_usrp ...\n");
#elif OAI_BLADERF
device->type=BLADERF_IF;
openair0_dev_init_bladerf(device, openair0_cfg);
printf(" openair0_dev_init_bladerf ...\n");
#endif
}
......@@ -134,7 +134,13 @@ typedef struct {
/*!\brief device type */
/*!\brief interface types that apply to modules (RRH_BBU/RRH_UE) created in RRH (rrh_gw.c)
and are defined with respect to the RF device that is present in RRH
-RRH_BBU modules have two devices, one is by default ETHERNET (will have ETH_IF) and the other one is a
RF device (EXMIMO,USRP,BLADERF) or no device (NONE_IF).
-RRH_UE modules have two devices one is by default ETHERNET (will have ETH_IF)
and the other one by default not present so it will have NONE_IF
*/
typedef enum {
MIN_DEV_TYPE = 0,
/*!\brief device is ETH */
......@@ -152,7 +158,7 @@ typedef enum {
} dev_type_t;
/*!\brief type */
/*!\brief openair0 device host type */
typedef enum {
MIN_FUNC_TYPE = 0,
/*!\brief device functions within a BBU */
......@@ -264,23 +270,20 @@ extern "C"
#endif
/*! \brief Initialize Openair RF target. It returns 0 if OK */
int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg);
//int openair0_stop(int card);
//ETHERNET
/*! \brief Initialize Openair ETHERNET target. It returns 0 if OK */
int openair0_dev_init_eth(openair0_device *device, openair0_config_t *openair0_cfg);
//int openair0_stop_eth(int card);
//int openair0_set_gains_eth(openair0_device* device, openair0_config_t *openair0_cfg);
//int openair0_set_frequencies_eth(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config);
int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg);
//USPRP
//USRP
/*! \brief Get the current timestamp of USRP */
openair0_timestamp get_usrp_time(openair0_device *device);
openair0_timestamp get_usrp_time(openair0_device *device);
/*! \brief Set the RX frequency of USRP RF TARGET */
int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg);
int openair0_set_rx_frequencies(openair0_device* device, openair0_config_t *openair0_cfg);
//extern
/*! \brief Initialize Openair ETHERNET target. It returns 0 if OK */
int openair0_dev_init_eth(openair0_device *device, openair0_config_t *openair0_cfg);
int openair0_dev_init_bladerf(openair0_device *device, openair0_config_t *openair0_cfg);
int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_cfg);
int openair0_dev_init_exmimo(openair0_device *device, openair0_config_t *openair0_cfg);
/*@}*/
#ifdef __cplusplus
......
......@@ -48,7 +48,7 @@
#include <netinet/ether.h>
#define MAX_INST 4
#define DEFAULT_IF "eth0"
#define DEFAULT_IF "lo"
#define BUF_SIZ 8960 /*Jumbo frame size*/
typedef struct {
......@@ -103,21 +103,51 @@ struct eth_meta_data{
};
/*!\brief packet header */
typedef struct {
/* packet's timestamp */
/*!\brief packet's timestamp */
openair0_timestamp timestamp;
/* variable declared for alignment purposes (sample size=32 bit) */
/*!\brief variable declared for alignment purposes (sample size=32 bit) */
int16_t not_used;
/* antenna port used to resynchronize*/
/*!\brief antenna port used to resynchronize */
int16_t antenna_id;
} header_t;
int ethernet_socket_init(openair0_device *device);
int ethernet_write_data(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int antenna_id);
int ethernet_read_data(openair0_device *device,openair0_timestamp *timestamp,void **buff, int nsamps,int antenna_id);
void ethernet_socket_opt (openair0_device *device);
/*!\brief different options for ethernet tuning in socket and driver level */
typedef enum {
MIN_OPT = 0,
/*!\brief socket send buffer size in bytes */
SND_BUF_SIZE,
/*!\brief socket receive buffer size in bytes */
RCV_BUF_SIZE,
/*!\brief receiving timeout */
RCV_TIMEOUT,
/*!\brief sending timeout */
SND_TIMEOUT,
/*!\brief maximun transmission unit size in bytes */
MTU_SIZE,
/*!\brief TX queue length */
TX_Q_LEN,
/*!\brief RX/TX ring parameters of ethernet device */
RING_PAR,
/*!\brief interruptions coalesence mechanism of ethernet device */
COALESCE_PAR,
/*!\brief pause parameters of ethernet device */
PAUSE_PAR,
MAX_OPT
} eth_opt_t;
/*! \fn int ethernet_tune (openair0_device *device, eth_opt_t option)
* \brief this function allows you to configure certain ethernet parameters in socket or device level
* \param[in] openair0 device which bears the socket
* \param[in] name of parameter to configure
* \return 0 on success, otherwise -1
* \note
* @ingroup _oai
*/
int ethernet_tune (openair0_device *device, eth_opt_t option);
int ethernet_write_data(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc) ;
int ethernet_read_data(openair0_device *device,openair0_timestamp *timestamp,void **buff, int nsamps,int cc);
......@@ -247,7 +247,7 @@ int openair0_stop_without_reset(int card)
#define MY_RF_MODE (RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX)
#define RF_MODE_BASE (LNA1ON + RFBBNORM)
int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
int openair0_dev_init_exmimo(openair0_device *device, openair0_config_t *openair0_cfg) {
// Initialize card
// exmimo_config_t *p_exmimo_config;
......
......@@ -154,7 +154,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
usrp_state_t *s = (usrp_state_t*)device->priv;
int samples_received=0,i,j;
int nsamps2; // aligned to upper 32 or 16 byte boundary
......@@ -188,25 +187,20 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
#else
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
#endif
#elif defined(__arm__)
((int16x8_t*)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
#endif
}
}
if (samples_received < nsamps) {
printf("[recv] received %d samples out of %d\n",samples_received,nsamps);
}
//handle the error code
switch(s->rx_md.error_code){
case uhd::rx_metadata_t::ERROR_CODE_NONE:
......@@ -225,6 +219,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
s->rx_count += nsamps;
s->rx_timestamp = s->rx_md.time_spec.to_ticks(s->sample_rate);
*ptimestamp = s->rx_timestamp;
return samples_received;
}
......@@ -334,7 +329,7 @@ int trx_usrp_reset_stats(openair0_device* device) {
}
int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cfg)
int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_cfg)
{
uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t*)malloc(sizeof(usrp_state_t));
......@@ -499,6 +494,5 @@ int openair0_device_init(openair0_device* device, openair0_config_t *openair0_cf
s->tx_forward_nsamps = 90;
if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50;
return 0;
}
......@@ -89,15 +89,8 @@ void *rrh_UE_thread_status;
void *rx_ue[2]; // FIXME hard coded array size; indexed by lte_frame_parms.nb_antennas_rx
void *tx_ue[2]; // FIXME hard coded array size; indexed by lte_frame_parms.nb_antennas_tx
/*! \fn void create_UE_trx_threads( openair0_device *dev_ue, uint8_t RT_flag,uint8_t NRT_flag)
* \brief this function
* \param[in]
* \param[out]
* \return
* \note
* @ingroup _oai
*/
void create_UE_trx_threads( rrh_module_t *dev_ue, uint8_t RT_flag,uint8_t NRT_flag) {
void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag,uint8_t NRT_flag) {
int i;
int error_code_UE, error_code_proc_UE;
......
This diff is collapsed.
......@@ -2992,22 +2992,6 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0.func_type = BBU_FUNC;
openair0_cfg[0].log_level = glog_level;
#ifdef ETHERNET
openair0.type=ETH_IF; // not used for the moment
openair0.func_type = BBU_FUNC;
openair0_dev_init_eth(&openair0, &openair0_cfg[0]);
#else
#ifdef EXMIMO
openair0.type=EXMIMO_IF;
printf("Setting the HW to EXMIMO and initializing openair0 ...\n");
#elif OAI_USRP
openair0.type=USRP_IF;
printf("Setting the HW to USRP and initializing openair0 ...\n");
#elif OAI_BLADERF
openair0.type=BLADERF_IF;
printf("Setting the HW to BLADERF and initializing openair0 ...\n");
#endif
if ((mode!=loop_through_memory) &&
(openair0_device_init(&openair0, &openair0_cfg[0]) <0)) {
printf("Exiting, cannot initialize device\n");
......@@ -3015,7 +2999,6 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
}
else if (mode==loop_through_memory) {
}
#endif
printf("Done\n");
......
......@@ -58,8 +58,8 @@
#define RRH_UE_PORT 51000
#define RRH_UE_DEST_IP "127.0.0.1"
#define FRAME_MAX_SIZE 307200
#define DEFAULT_PERIOD_NS 133333
#define FRAME_MAX_SIZE 307200//76800
#define DEFAULT_PERIOD_NS 133333//200000
#define START_CMD 1
#define PRINTF_PERIOD 3750
......
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Thu Jul 9 09:53:25 2015
[*] Thu Sep 17 14:23:43 2015
[*]
[dumpfile] "/tmp/openair_dump_rrh.vcd"
[dumpfile_mtime] "Thu Jul 9 09:52:29 2015"
[dumpfile_size] 170586112
[savefile] "/home/sud/openair4G/targets/RT/USER/eNB2.gtkw"
[timestart] 16177999000
[size] 1535 876
[dumpfile_mtime] "Thu Sep 17 14:21:43 2015"
[dumpfile_size] 636509125
[savefile] "/home/guepe/openair4G/targets/RT/USER/rrh.gtkw"
[timestart] 17746655400
[size] 1855 1056
[pos] -1 -1
*-17.749426 16178576148 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
*-15.826077 17746846200 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[sst_width] 224
[signals_width] 230
[sst_expanded] 1
[sst_vpaned_height] 230
[sst_vpaned_height] 287
@24
[color] 1
variables.hw_frame_rx[63:0]
[color] 1
variables.hw_subframe_rx[63:0]
@28
[color] 1
functions.eNB_rx
functions.eNB_rx_sleep
[color] 7
functions.trx_write
functions.trx_write_rf
@c00024
variables.rxcnt[63:0]
@28
......@@ -89,23 +93,27 @@ variables.rxcnt[63:0]
(63)variables.rxcnt[63:0]
@1401200
-group_end
@24
variables.pck_rx[63:0]
variables.hw_frame[63:0]
variables.hw_subframe[63:0]
@28
[color] 1
functions.eNB_tx
functions.eNB_tx_sleep
functions.trx_read_rf
[color] 7
functions.trx_write
[color] 7
functions.trx_read
@24
variables.txcnt[63:0]
variables.rx_ts[63:0]
variables.tx_ts[63:0]
variables.pck_rx[63:0]
variables.hw_cnt_rx[63:0]
variables.lhw_cnt_rx[63:0]
variables.hw_frame[63:0]
@28
functions.eNB_tm
@29
functions.eNB_trx
@25
[color] 3
variables.cnt[63:0]
[pattern_trace] 1
[pattern_trace] 0
This diff is collapsed.
......@@ -45,41 +45,68 @@
#include "vcd_signal_dumper.h"
#include "assertions.h"
#define DEFAULT_PERIOD_NS 200000
#define DEFAULT_PERIOD_NS 200000 /* default value is calculated for 25 PRB */
#define RRH_UE_PORT 51000
#define RRH_UE_DEST_IP "127.0.0.1"
/*! \brief RRH supports two types of modules: eNB and UE
each module is associated a device of type ETH_IF
and optionally with an RF device (USRP/BLADERF/EXMIMO) */
each module is associated with an ethernet device (device of ETH_IF)
and optionally with a RF device (device type can be USRP_IF/BLADERF_IF/EXMIMO_IF/NONE_IF)
UE modules will always have RF device type NONE_IF */
typedef struct {
//! module id
/*! \brief module id */
uint8_t id;
//! loopback flag
uint8_t loopback;
//! measurement flag
uint8_t measurements;
//! module's ethernet device
openair0_device eth_dev;
//! pointer to RF module's device (pointer->since its optional)
openair0_device *devs;
/*! \brief! loopback flag */
uint8_t loopback;
/*! \brief measurement flag */
uint8_t measurements;
/*! \brief module's ethernet device */
openair0_device eth_dev;
/*! \brief pointer to RF module's device (pointer->since it's optional) */
openair0_device *devs;
}rrh_module_t;
/******************************************************************************
** FUNCTION PROTOTYPES **
******************************************************************************/
void signal_handler(int sig);
/*! \fn void timer_signal_handler(int sig)
* \brief this function
* \param[in] signal type
* \return none
* \note
* @ingroup _oai
*/
void timer_signal_handler(int);
/*! \fn void *timer_proc(void *arg)
* \brief this function
* \param[in]
* \param[out]
* \return
* \note
* @ingroup _oai
*/
void *timer_proc(void *);
void create_timer_thread(void);
/*! \fn void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag,uint8_t NRT_flag)
* \brief receive and apply configuration to modules' optional device
* \param[in] *mod_enb pointer to module
* \param[in] RT_flag real time flag
* \return none
* \note
* @ingroup _oai
*/
void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag);
/*! \fn void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag,uint8_t NRT_flag)
* \brief this function
* \param[in] *mod_ue pointer to module
* \param[in]
* \return none
* \note
* @ingroup _oai
*/
void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag, uint8_t NRT_flag);
/******************************************************************************
** FUNCTION PROTOTYPES **
******************************************************************************/
void create_UE_trx_threads( rrh_module_t *dev_ue, uint8_t RT_flag, uint8_t NRT_flag);
void create_eNB_trx_threads( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag);
void signal_handler(int sig);
#endif
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