Move enums required by VTY to a separate header

This patch is a preparation for next patches, which add full VTY cfg
support.

Change-Id: I3d5b0576aa96869756f1629a40306c0043b6304b
This commit is contained in:
Pau Espin 2018-02-21 14:59:19 +01:00
parent 0bbd8922ea
commit efac20b6bb
6 changed files with 56 additions and 41 deletions

View File

@ -52,4 +52,5 @@ noinst_HEADERS = \
Vector.h \
Logger.h \
trx_vty.h \
debug.h
debug.h \
config_defs.h

20
CommonLibs/config_defs.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
/*
* This file contains structures used by both VTY (C, dir CommonLibs) and
* osmo-trx (CXX, dir Transceiver52)
*/
enum FillerType {
FILLER_DUMMY,
FILLER_ZERO,
FILLER_NORM_RAND,
FILLER_EDGE_RAND,
FILLER_ACCESS_RAND,
};
enum ReferenceType {
REF_INTERNAL,
REF_EXTERNAL,
REF_GPS,
};

View File

@ -71,7 +71,7 @@ TransceiverState::~TransceiverState()
}
}
bool TransceiverState::init(int filler, size_t sps, float scale, size_t rtsc, unsigned rach_delay)
bool TransceiverState::init(FillerType filler, size_t sps, float scale, size_t rtsc, unsigned rach_delay)
{
signalVector *burst;
@ -81,19 +81,19 @@ bool TransceiverState::init(int filler, size_t sps, float scale, size_t rtsc, un
for (size_t n = 0; n < 8; n++) {
for (size_t i = 0; i < 102; i++) {
switch (filler) {
case Transceiver::FILLER_DUMMY:
case FILLER_DUMMY:
burst = generateDummyBurst(sps, n);
break;
case Transceiver::FILLER_NORM_RAND:
case FILLER_NORM_RAND:
burst = genRandNormalBurst(rtsc, sps, n);
break;
case Transceiver::FILLER_EDGE_RAND:
case FILLER_EDGE_RAND:
burst = generateEdgeBurst(rtsc);
break;
case Transceiver::FILLER_ACCESS_RAND:
case FILLER_ACCESS_RAND:
burst = genRandAccessBurst(rach_delay, sps, n);
break;
case Transceiver::FILLER_ZERO:
case FILLER_ZERO:
default:
burst = generateEmptyBurst(sps, n);
}
@ -102,8 +102,8 @@ bool TransceiverState::init(int filler, size_t sps, float scale, size_t rtsc, un
fillerTable[i][n] = burst;
}
if ((filler == Transceiver::FILLER_NORM_RAND) ||
(filler == Transceiver::FILLER_EDGE_RAND)) {
if ((filler == FILLER_NORM_RAND) ||
(filler == FILLER_EDGE_RAND)) {
chanType[n] = TSC;
}
}
@ -161,7 +161,7 @@ Transceiver::~Transceiver()
* are still expected to report clock indications through control channel
* activity.
*/
bool Transceiver::init(int filler, size_t rtsc, unsigned rach_delay, bool edge)
bool Transceiver::init(FillerType filler, size_t rtsc, unsigned rach_delay, bool edge)
{
int d_srcport, d_dstport, c_srcport, c_dstport;

View File

@ -30,6 +30,10 @@
#include <sys/types.h>
#include <sys/socket.h>
extern "C" {
#include "config_defs.h"
}
class Transceiver;
/** Channel descriptor for transceiver object and channel number pair */
@ -54,7 +58,7 @@ struct TransceiverState {
~TransceiverState();
/* Initialize a multiframe slot in the filler table */
bool init(int filler, size_t sps, float scale, size_t rtsc, unsigned rach_delay);
bool init(FillerType filler, size_t sps, float scale, size_t rtsc, unsigned rach_delay);
int chanType[8];
@ -109,7 +113,7 @@ public:
~Transceiver();
/** Start the control loop */
bool init(int filler, size_t rtsc, unsigned rach_delay, bool edge);
bool init(FillerType filler, size_t rtsc, unsigned rach_delay, bool edge);
/** attach the radioInterface receive FIFO */
bool receiveFIFO(VectorFIFO *wFIFO, size_t chan)
@ -144,14 +148,6 @@ public:
LOOPBACK ///< similar go VII, used in loopback testing
} ChannelCombination;
enum FillerType {
FILLER_DUMMY,
FILLER_ZERO,
FILLER_NORM_RAND,
FILLER_EDGE_RAND,
FILLER_ACCESS_RAND,
};
private:
int mBasePort;
std::string mLocalAddr;

View File

@ -91,7 +91,7 @@ struct trx_config {
unsigned rach_delay;
bool extref;
bool gpsref;
Transceiver::FillerType filler;
FillerType filler;
bool mcbts;
double offset;
double rssi_offset;
@ -140,19 +140,19 @@ bool trx_setup_config(struct trx_config *config)
refstr = "Internal";
switch (config->filler) {
case Transceiver::FILLER_DUMMY:
case FILLER_DUMMY:
fillstr = "Dummy bursts";
break;
case Transceiver::FILLER_ZERO:
case FILLER_ZERO:
fillstr = "Disabled";
break;
case Transceiver::FILLER_NORM_RAND:
case FILLER_NORM_RAND:
fillstr = "Normal busrts with random payload";
break;
case Transceiver::FILLER_EDGE_RAND:
case FILLER_EDGE_RAND:
fillstr = "EDGE busrts with random payload";
break;
case Transceiver::FILLER_ACCESS_RAND:
case FILLER_ACCESS_RAND:
fillstr = "Access busrts with random payload";
break;
}
@ -348,7 +348,7 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
config->rach_delay = 0;
config->extref = false;
config->gpsref = false;
config->filler = Transceiver::FILLER_ZERO;
config->filler = FILLER_ZERO;
config->mcbts = false;
config->offset = 0.0;
config->rssi_offset = 0.0;
@ -389,7 +389,7 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
config->gpsref = true;
break;
case 'f':
config->filler = Transceiver::FILLER_DUMMY;
config->filler = FILLER_DUMMY;
break;
case 'o':
config->offset = atof(optarg);
@ -402,11 +402,11 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
break;
case 'r':
config->rtsc = atoi(optarg);
config->filler = Transceiver::FILLER_NORM_RAND;
config->filler = FILLER_NORM_RAND;
break;
case 'A':
config->rach_delay = atoi(optarg);
config->filler = Transceiver::FILLER_ACCESS_RAND;
config->filler = FILLER_ACCESS_RAND;
break;
case 'R':
config->rssi_offset = atof(optarg);
@ -448,8 +448,8 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
goto bad_config;
}
if (config->edge && (config->filler == Transceiver::FILLER_NORM_RAND))
config->filler = Transceiver::FILLER_EDGE_RAND;
if (config->edge && (config->filler == FILLER_NORM_RAND))
config->filler = FILLER_EDGE_RAND;
if ((config->tx_sps != 1) && (config->tx_sps != 4) &&
(config->rx_sps != 1) && (config->rx_sps != 4)) {
@ -521,11 +521,11 @@ static int trx_start(struct trx_config *config)
iface = RadioDevice::MULTI_ARFCN;
if (config->extref)
ref = RadioDevice::REF_EXTERNAL;
ref = REF_EXTERNAL;
else if (config->gpsref)
ref = RadioDevice::REF_GPS;
ref = REF_GPS;
else
ref = RadioDevice::REF_INTERNAL;
ref = REF_INTERNAL;
usrp = RadioDevice::make(config->tx_sps, config->rx_sps, iface,
config->chans, config->offset, config->tx_paths, config->rx_paths);

View File

@ -18,6 +18,10 @@
#include <string>
#include <vector>
extern "C" {
#include "config_defs.h"
}
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -43,12 +47,6 @@ class RadioDevice {
MULTI_ARFCN,
};
enum ReferenceType {
REF_INTERNAL,
REF_EXTERNAL,
REF_GPS,
};
static RadioDevice *make(size_t tx_sps, size_t rx_sps, InterfaceType type,
size_t chans = 1, double offset = 0.0,
const std::vector<std::string>& tx_paths = std::vector<std::string>(1, ""),