Commit 2e6c8c7c authored by yangjian's avatar yangjian

Update OXGRF(!3885)

- Remove the "oxgrf_tx_thread" flag. In the configuration file, only use "usrp_tx_thread", which serves as both the USRP flag and the OXGRF flag.
- Remove "oxgrf-args" and use "usrp-args" as the command-line parameter.
- Fix the build_helper.
- Remove the code that is commented out with "#if 0".
- Remove the unimplemented functions.
- Delete rf_helper.h and move the functions in this file to oxgrf_lib.c.
parent c9ebe6a1
......@@ -334,26 +334,23 @@ check_install_oxgrf_driver() {
if modinfo xdma > /dev/null 2>&1
then
echo_success "OXGRF driver has loaded."
else
git clone https://github.com/openxg-prog/oxgrf_driver /tmp/oxgrf_driver
if [ $? -ne 0 ]; then
echo_fatal "OXGRF driver download failed, please check your net connection."
else
cd /tmp/oxgrf_driver/XDMA/linux-kernel/xdma
make && $SUDO make install
echo_success "OXGRF driver install success, please restart your PC later."
fi
git clone -b 2505 https://github.com/openxg-prog/liboxgrf /tmp/liboxgrf
if [ $? -ne 0 ]; then
echo_fatal "OXGRF API download failed, please check your net connection."
else
cd /tmp/liboxgrf
cp oxgrf_api.h /usr/local/include/
cp liboxgrf.so /usr/local/lib/
$SUDO ldconfig
echo_success "OXGRF API install success, please restart your PC later."
fi
return
fi
git clone https://github.com/openxg-prog/oxgrf_driver /tmp/oxgrf_driver \
|| echo_fatal "OXGRF driver download failed, please check your net connection."
cd /tmp/oxgrf_driver/XDMA/linux-kernel/xdma
make && $SUDO make install
echo_success "OXGRF driver install success, please restart your PC later."
git clone -b 2505 https://github.com/openxg-prog/liboxgrf /tmp/liboxgrf \
|| echo_fatal "OXGRF API download failed, please check your net connection."
cd /tmp/liboxgrf
$SUDO cp oxgrf_api.h /usr/local/include/
$SUDO cp liboxgrf.so /usr/local/lib/
$SUDO cp liboxgrf_ss.so /usr/local/lib/
$SUDO ldconfig
echo_success "OXGRF API install success, please restart your PC later."
}
install_bladerf_driver_from_source(){
......
......@@ -765,7 +765,7 @@ void tx_rf(RU_t *ru,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0);
// AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen);
if (usrp_tx_thread == 0 && oxgrf_tx_thread == 0 && (txs != siglen + sf_extension)
if (usrp_tx_thread == 0 && (txs != siglen + sf_extension)
&& (late_control == STATE_BURST_NORMAL)) { /* add fail safe for late command */
late_control = STATE_BURST_TERMINATE;
LOG_E(PHY, "TX : Timeout (sent %d/%d) state =%d\n", txs, siglen, late_control);
......@@ -1588,7 +1588,7 @@ static void *ru_thread( void *param ) {
pthread_cond_signal(&proc->cond_FH1);
AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_FH1))==0,"mutex_unlock returns %d\n",ret);
if(usrp_tx_thread == 1 || oxgrf_tx_thread == 1){
if(usrp_tx_thread == 1){
if (ru->start_write_thread){
if(ru->start_write_thread(ru) != 0){
LOG_E(HW,"Could not start tx write thread\n");
......
......@@ -71,7 +71,6 @@
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
#define CONFIG_HLP_OXGRF_ARGS "set the arguments to identify OXGRF\n"
#define CONFIG_HLP_DMAMAP "use DMA memory mapping\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
......@@ -95,7 +94,6 @@
{"r" , CONFIG_HLP_PRB, 0, .u8ptr=&(frame_parms[0]->N_RB_DL), .defintval=25, TYPE_UINT8, 0}, \
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, .iptr=(int32_t *)&dlsch_demod_shift, .defintval=0, TYPE_INT, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, .strptr=&usrp_args, .defstrval="type=b200",TYPE_STRING, 0}, \
{"oxgrf-args", CONFIG_HLP_OXGRF_ARGS, 0, .strptr=&oxgrf_args, .defstrval="dev=pciex:0",TYPE_STRING, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, .uptr=&mmapped_dma, .defintval=0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, .iptr=&tddflag, .defintval=0, TYPE_INT, 0}, \
{"ue-idx-standalone", NULL, 0, .u16ptr=&ue_idx_standalone, .defuintval=0xFFFF, TYPE_UINT16, 0}, \
......@@ -131,7 +129,6 @@ extern double cpuf;
extern int numerology;
extern int usrp_tx_thread;
extern int oxgrf_tx_thread;
// In lte-enb.c
extern void stop_eNB(int);
......
......@@ -144,7 +144,6 @@ int transmission_mode=1;
char *usrp_args=NULL;
char *usrp_clksrc=NULL;
char *oxgrf_args=NULL;
THREAD_STRUCT thread_struct;
/* struct for ethernet specific parameters given in eNB conf file */
......@@ -408,7 +407,6 @@ static void init_openair0(LTE_DL_FRAME_PARMS *frame_parms, int rxgain)
}
if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args;
if (oxgrf_args) openair0_cfg[card].sdr_addrs = oxgrf_args;
}
}
......
......@@ -1121,7 +1121,7 @@ void *ru_thread(void *param)
LOG_I(PHY, "RU %d RF started cpu_meas_enabled %d\n", ru->idx, cpu_meas_enabled);
// start trx write thread
if (usrp_tx_thread == 1 || oxgrf_tx_thread == 1) {
if (usrp_tx_thread == 1) {
if (ru->start_write_thread) {
if (ru->start_write_thread(ru) != 0) {
LOG_E(HW, "Could not start tx write thread\n");
......
......@@ -137,6 +137,5 @@ extern double cpuf;
extern int numerology;
extern int usrp_tx_thread;
extern int oxgrf_tx_thread;
void wait_gNBs(void);
#endif
......@@ -25,7 +25,6 @@
{"T" , CONFIG_HLP_ULBW_PHYTEST, 0, .uptr=&target_ul_bw, .defintval=0, TYPE_UINT, 0}, \
{"D" , CONFIG_HLP_DLBM_PHYTEST, 0, .u64ptr=&dlsch_slot_bitmap, .defintval=0, TYPE_UINT64, 0}, \
{"U" , CONFIG_HLP_ULBM_PHYTEST, 0, .u64ptr=&ulsch_slot_bitmap, .defintval=0, TYPE_UINT64, 0}, \
{"sdr-tx-thread-config", CONFIG_HLP_OXGRF_THREAD, 0, .iptr=&oxgrf_tx_thread, .defstrval=0, TYPE_INT, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, .iptr=&usrp_tx_thread, .defstrval=0, TYPE_INT, 0}, \
{"uecap_file", CONFIG_HLP_UECAP_FILE, 0, .strptr=&uecap_file, .defstrval="./uecap_ports1.xml", TYPE_STRING, 0}, \
}
......
......@@ -925,7 +925,7 @@ void *UE_thread(void *arg)
UE->is_synchronized = 0;
int tmp2 = UE->rfdevice.trx_start_func(&UE->rfdevice);
AssertFatal(tmp2 == 0, "Could not start the device\n");
if (usrp_tx_thread == 1 || oxgrf_tx_thread == 1)
if (usrp_tx_thread == 1)
UE->rfdevice.trx_write_init(&UE->rfdevice);
InitSinLUT();
......
......@@ -279,8 +279,6 @@ void init_openair0(PHY_VARS_NR_UE *ue)
cfg->tx_subdev = get_nrUE_params()->tx_subdev;
if (get_nrUE_params()->rx_subdev)
cfg->rx_subdev = get_nrUE_params()->rx_subdev;
if (get_nrUE_params()->oxgrf_args)
cfg->sdr_addrs = get_nrUE_params()->oxgrf_args;
}
}
......
......@@ -46,7 +46,6 @@ extern uint16_t ue_id_g;
// clang-format off
#define CMDLINE_NRUEPARAMS_DESC { \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, .strptr=&nrUE_params.usrp_args, .defstrval="type=b200", TYPE_STRING, 0}, \
{"oxgrf-args", CONFIG_HLP_OXGRF_ARGS, 0, .strptr=&nrUE_params.oxgrf_args, .defstrval="dev=pciex:0", TYPE_STRING, 0}, \
{"tx_subdev", CONFIG_HLP_TX_SUBDEV, 0, .strptr=&nrUE_params.tx_subdev, .defstrval=NULL, TYPE_STRING, 0}, \
{"rx_subdev", CONFIG_HLP_RX_SUBDEV, 0, .strptr=&nrUE_params.rx_subdev, .defstrval=NULL, TYPE_STRING, 0}, \
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, .u8ptr=NULL, .defintval=0, TYPE_UINT8, 0}, \
......@@ -114,7 +113,6 @@ typedef struct {
int cont_fo_comp;
int agc;
char *usrp_args;
char *oxgrf_args;
char *tx_subdev;
char *rx_subdev;
char *reconfig_file;
......
......@@ -44,7 +44,6 @@
char *parallel_config=NULL;
char *worker_config=NULL;
int usrp_tx_thread = 0;
int oxgrf_tx_thread = 0;
uint8_t nfapi_mode=0;
static struct timespec start;
......
......@@ -144,7 +144,6 @@ extern "C"
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
extern int oxgrf_tx_thread;
extern int usrp_tx_thread;
// clang-format off
#define CMDLINE_PARAMS_DESC { \
......@@ -172,7 +171,6 @@ extern int usrp_tx_thread;
{"chest-time", CONFIG_HLP_CHESTTIME, 0, .iptr=&CHEST_TIME, .defintval=0, TYPE_INT, 0}, \
{"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, .iptr=&NSA, .defintval=0, TYPE_INT, 0}, \
{"node-number", NULL, 0, .u16ptr=&NODE_NUMBER, .defuintval=0, TYPE_UINT16, 0}, \
{"sdr-tx-thread-config", CONFIG_HLP_OXGRF_THREAD, 0, .iptr=&oxgrf_tx_thread, .defstrval=0, TYPE_INT, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, .iptr=&usrp_tx_thread, .defstrval=0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, .strptr=NULL, .defstrval="MONOLITHIC", TYPE_STRING, 0}, \
{"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, .iptr=&NON_STOP, .defintval=0, TYPE_INT, 0}, \
......@@ -215,7 +213,6 @@ extern int usrp_tx_thread;
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s3a = { config_checkstr_assign_integer, \
{"MONOLITHIC", "PNF", "VNF", "AERIAL","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \
{NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF, NFAPI_MODE_AERIAL,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \
......@@ -351,7 +348,6 @@ char *get_softmodem_function(void);
void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern int oxgrf_tx_thread;
extern int usrp_tx_thread;
extern int sf_ahead;
extern int oai_exit;
......
[[_TOC_]]
# OXGRF
[[_TOC_]]
## Build drivers
There are two methods to build OXGRF, as detailed below:
......@@ -68,7 +68,7 @@ sudo ./ran_build/build/nr-softmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/g
Use the following command to start the UE with OXGRF:
```bash
sudo ./ran_build/build/nr-uesoftmodem -C 3649380000 -r 273 --numerology 1 --ssb 1472 --oxgrf-args "dev=pciex:0,auxdac1=1620" -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf
sudo ./ran_build/build/nr-uesoftmodem -C 3649380000 -r 273 --numerology 1 --ssb 1472 --usrp-args "dev=pciex:0,auxdac1=1620" -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf
```
> When running the UE with OXGRF, the board's frequency offset value must be explicitly specified in the UE launch command via the `--oxgrf-args` parameter.
......
......@@ -29,8 +29,8 @@
#include "system.h"
#include <math.h>
#include "oxgrf_lib.h"
#include "rf_helper.h"
#include "common/utils/LOG/log.h"
#include "executables/softmodem-common.h"
/** @addtogroup _OXGRF_PHY_RF_INTERFACE_
* @{
......@@ -40,7 +40,6 @@
#include <simde/x86/avx512.h>
#endif
extern int oxgrf_tx_thread;
//! Number of OXGRF devices
int num_devices = 0;
......@@ -54,6 +53,32 @@ static uint32_t remain = 0;
static uint32_t RX_MTU = 30720;
static uint8_t shift = 2;
#define REMOVE_SUBSTRING_WITHCOMAS(S, TOREMOVE) \
remove_substring(S, TOREMOVE ","); \
remove_substring(S, TOREMOVE ", "); \
remove_substring(S, "," TOREMOVE); \
remove_substring(S, ", " TOREMOVE); \
remove_substring(S, TOREMOVE)
static inline void remove_substring(char* s, const char* toremove)
{
while ((s = strstr(s, toremove))) {
memmove(s, s + strlen(toremove), 1 + strlen(s + strlen(toremove)));
}
}
static inline void copy_subdev_string(char* dst, char* src)
{
int n = 0;
int len = (int)strlen(src);
/* Copy until end of string or comma */
while (n < len && src[n] != '\0' && src[n] != ',') {
dst[n] = src[n];
n++;
}
dst[n] = '\0';
}
static inline int channel_to_mask(int channel_count)
{
uint8_t ch_mask;
......@@ -204,7 +229,7 @@ static int trx_oxgrf_write(openair0_device *device,openair0_timestamp timestamp,
last_packet_state = true;
}
if (oxgrf_tx_thread == 0) {
if (usrp_tx_thread == 0) {
for(int i = 0; i < cc; i++) {
int len = nsamps * 2;
int16_t *iq = buff[i];
......@@ -561,7 +586,7 @@ void trx_oxgrf_end(openair0_device *device)
}
LOG_I(HW, "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
if (oxgrf_tx_thread != 0)
if (usrp_tx_thread != 0)
trx_oxgrf_write_reset(&device->write_thread);
oxgrf_close_device(oxgrf->dev);
......
......@@ -47,99 +47,6 @@ typedef enum {
UNKNOWN = -1,
} OXGRFBoardType;
#if 0
typedef struct {
OXGRFBoardType Model;
struct {
uint64_t sample_rate;
uint64_t bandwidth;
int8_t tx_adv;
} tables[16];
} oxgrf_cfg_table;
oxgrf_cfg_table TABLE_IQX8x00 = { // for IQX8200 & IQX8400 & IQX8800
.Model = IQX8800,
.tables = {
{491520000, 400000000, 151},
{245760000, 200000000, 126},
{122880000, 100000000, 111},
{61440000, 40000000, 172},
{30720000, 20000000, 169},
{15360000, 10000000, 110},
{7680000, 5000000, 110},
{3840000, 3000000, 110},
{1920000, 1400000, 110},
},
};
oxgrf_cfg_table TABLE_IQX7x00 = { // for IQX7100 & IQX7400
.Model = IQX7400,
.tables = {
{122880000, 100000000, 573},
{61440000, 40000000, 286},
{30720000, 20000000, 143},
{15360000, 10000000, 73},
{7680000, 5000000, 36},
{3840000, 3000000, 17},
{1920000, 1400000, 9},
},
};
oxgrf_cfg_table TABLE_IQX7200 = { // for IQX7200
.Model = IQX7200,
.tables = {
{245760000, 200000000, 612},
{122880000, 100000000, 306},
{61440000, 40000000, 152},
{30720000, 20000000, 76},
{15360000, 10000000, 38},
{7680000, 5000000, 19},
{3840000, 3000000, 10},
{1920000, 1400000, 5},
},
};
oxgrf_cfg_table TABLE_Y590 = { // for Y590neo
.Model = Y590,
.tables = {
{245760000, 200000000, 502},
{122880000, 100000000, 251},
{61440000, 40000000, 125},
{30720000, 20000000, 63},
{15360000, 10000000, 32},
{7680000, 5000000, 16},
{3840000, 3000000, 8},
{1920000, 1400000, 4},
},
};
oxgrf_cfg_table TABLE_Y790 = { // for Y790s New/Old Version & Y750s
.Model = Y790,
.tables = {
{491520000, 400000000, 149},
{245760000, 200000000, 125},
{122880000, 100000000, 110},
{61440000, 40000000, 172},
{30720000, 20000000, 168},
},
};
oxgrf_cfg_table TABLE_Y780 = { // for Y780s New Version
.Model = Y780,
.tables = {
{245760000, 200000000, 359},
{122880000, 100000000, 179},
{61440000, 40000000, 88},
{30720000, 20000000, 43},
{15360000, 10000000, 22},
{7680000, 5000000, 11},
{3840000, 3000000, 6},
{1920000, 1400000, 3},
},
};
#endif
/*! \brief OXGRF specific data structure */
typedef struct {
......@@ -184,9 +91,4 @@ typedef struct {
OXGRFBoardType BoardType;
} oxgrf_state_t;
/*! \brief get current timestamp
*\param device the hardware to use
*/
openair0_timestamp trx_get_timestamp(openair0_device *device);
/*@}*/
/*
* Copyright 2013-2020 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef OXGRF_RF_HELPER_H_
#define OXGRF_RF_HELPER_H_
// A bunch of helper functions to process device arguments
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define REMOVE_SUBSTRING_WITHCOMAS(S, TOREMOVE) \
remove_substring(S, TOREMOVE ","); \
remove_substring(S, TOREMOVE ", "); \
remove_substring(S, "," TOREMOVE); \
remove_substring(S, ", " TOREMOVE); \
remove_substring(S, TOREMOVE)
static inline void remove_substring(char* s, const char* toremove)
{
while ((s = strstr(s, toremove))) {
memmove(s, s + strlen(toremove), 1 + strlen(s + strlen(toremove)));
}
}
static inline void copy_subdev_string(char* dst, char* src)
{
int n = 0;
int len = (int)strlen(src);
/* Copy until end of string or comma */
while (n < len && src[n] != '\0' && src[n] != ',') {
dst[n] = src[n];
n++;
}
dst[n] = '\0';
}
#endif /* OXGRF_RF_HELPER_H_ */
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