mirror of
https://github.com/RangeNetworks/openbts.git
synced 2025-10-23 07:42:01 +00:00
Patching cleaning up rotted code. Now able to select device to run for both 52M and RAD1 from a config variable. Also fixed RAD1 not listening to TRX.Port or TRX.IP.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@6757 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
@@ -47,8 +47,10 @@
|
||||
*/
|
||||
#define SPS 4
|
||||
|
||||
ConfigurationKeyMap getConfigurationKeys();
|
||||
ConfigurationTable gConfig(CONFIGDB, 0, getConfigurationKeys());
|
||||
std::vector<std::string> configurationCrossCheck(const std::string& key);
|
||||
static const char *cOpenBTSConfigEnv = "OpenBTSConfigFile";
|
||||
// Load configuration from a file.
|
||||
ConfigurationTable gConfig(getenv(cOpenBTSConfigEnv)?getenv(cOpenBTSConfigEnv):CONFIGDB,"OpenBTS", getConfigurationKeys());
|
||||
|
||||
volatile bool gbShutdown = false;
|
||||
|
||||
@@ -131,7 +133,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Configure logger.
|
||||
if (testConfig(CONFIGDB) < 0) {
|
||||
if (testConfig(getenv(cOpenBTSConfigEnv)?getenv(cOpenBTSConfigEnv):CONFIGDB) < 0) {
|
||||
std::cerr << "Config: Database failure" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@@ -151,10 +151,10 @@ unsigned int FactoryCalibration::getValue(std::string name) {
|
||||
}
|
||||
}
|
||||
|
||||
void FactoryCalibration::readEEPROM() {
|
||||
void FactoryCalibration::readEEPROM(int deviceID) {
|
||||
|
||||
core = new rnrad1Core(
|
||||
0,
|
||||
deviceID,
|
||||
RAD1_CMD_INTERFACE,
|
||||
RAD1_CMD_ALTINTERFACE,
|
||||
"fpga.rbf",
|
||||
|
@@ -41,5 +41,5 @@ class FactoryCalibration {
|
||||
public:
|
||||
|
||||
unsigned int getValue(std::string name);
|
||||
void readEEPROM();
|
||||
void readEEPROM(int deviceID);
|
||||
};
|
||||
|
@@ -180,7 +180,7 @@ RAD1Device::RAD1Device (double _desiredSampleRate)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RAD1Device::make(bool wSkipRx)
|
||||
bool RAD1Device::make(bool wSkipRx, int devID)
|
||||
{
|
||||
skipRx = wSkipRx;
|
||||
|
||||
@@ -192,7 +192,7 @@ bool RAD1Device::make(bool wSkipRx)
|
||||
//string rbf = "inband_1rxhb_1tx.rbf";
|
||||
if (!skipRx) {
|
||||
try {
|
||||
m_uRx = rnrad1Rx::make(0,decimRate,
|
||||
m_uRx = rnrad1Rx::make(devID,decimRate,
|
||||
rbf,"ezusb.ihx");
|
||||
m_uRx->setFpgaMasterClockFreq(masterClockRate);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ bool RAD1Device::make(bool wSkipRx)
|
||||
}
|
||||
|
||||
try {
|
||||
m_uTx = rnrad1Tx::make(0,decimRate*2,
|
||||
m_uTx = rnrad1Tx::make(devID,decimRate*2,
|
||||
rbf,"ezusb.ihx");
|
||||
m_uTx->setFpgaMasterClockFreq(masterClockRate);
|
||||
}
|
||||
|
@@ -168,7 +168,7 @@ private:
|
||||
RAD1Device (double _desiredSampleRate);
|
||||
|
||||
/** Instantiate the USRP */
|
||||
bool make(bool skipRx = false);
|
||||
bool make(bool skipRx, int devID);
|
||||
|
||||
/** Start the USRP */
|
||||
bool start();
|
||||
|
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
RAD1Device *usrp = new RAD1Device(52.0e6/192.0);
|
||||
|
||||
usrp->make();
|
||||
usrp->make(false, 0);
|
||||
|
||||
double freqkHz = 0.0;
|
||||
if (argc > 2) freqkHz = (double) atoi(argv[2]);
|
||||
|
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
RAD1Device *usrp = new RAD1Device(52.0e6/192.0);
|
||||
|
||||
usrp->make();
|
||||
usrp->make(false, 0);
|
||||
|
||||
double startFreqkHz = 0.0;
|
||||
double endFreqkHz = 0.0;
|
||||
|
@@ -40,6 +40,9 @@ int main(int argc, char *argv[]) {
|
||||
if (argc>1) gLogInit(argv[1]);
|
||||
else gLogInit("DEBUG");
|
||||
|
||||
int deviceID = 0;
|
||||
if (argc>2) deviceID = atoi(argv[2]);
|
||||
|
||||
gLogInit("openbts",argv[1],LOG_LOCAL7);
|
||||
|
||||
|
||||
@@ -47,7 +50,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
RAD1Device *usrp = new RAD1Device(52.0e6/192.0);
|
||||
|
||||
usrp->make();
|
||||
usrp->make(false, deviceID);
|
||||
|
||||
TIMESTAMP timestamp;
|
||||
|
||||
|
@@ -30,8 +30,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
ConfigurationKeyMap getConfigurationKeys();
|
||||
ConfigurationTable gConfig("/etc/OpenBTS/OpenBTS.db", 0, getConfigurationKeys());
|
||||
std::vector<std::string> configurationCrossCheck(const std::string& key);
|
||||
static const char *cOpenBTSConfigEnv = "OpenBTSConfigFile";
|
||||
// Load configuration from a file.
|
||||
ConfigurationTable gConfig(getenv(cOpenBTSConfigEnv)?getenv(cOpenBTSConfigEnv):"/etc/OpenBTS/OpenBTS.db","OpenBTS", getConfigurationKeys());
|
||||
FactoryCalibration gFactoryCalibration;
|
||||
|
||||
volatile bool gbShutdown = false;
|
||||
@@ -58,14 +60,14 @@ int main(int argc, char *argv[])
|
||||
// Configure logger.
|
||||
gLogInit("transceiver",gConfig.getStr("Log.Level").c_str(),LOG_LOCAL7);
|
||||
|
||||
gFactoryCalibration.readEEPROM();
|
||||
|
||||
int numARFCN=1;
|
||||
if (argc>1) numARFCN = atoi(argv[1]);
|
||||
|
||||
#ifdef SINGLEARFCN
|
||||
numARFCN=1;
|
||||
#endif
|
||||
int deviceID = 0;
|
||||
if (argc>2) deviceID = atoi(argv[2]);
|
||||
|
||||
gFactoryCalibration.readEEPROM(deviceID);
|
||||
|
||||
|
||||
srandom(time(NULL));
|
||||
|
||||
@@ -95,10 +97,10 @@ int main(int argc, char *argv[])
|
||||
//if ((numARFCN > 1) && (mOversamplingRate % 2)) mOversamplingRate++;
|
||||
RAD1Device *usrp = new RAD1Device(mOversamplingRate*1625.0e3/6.0);
|
||||
//DummyLoad *usrp = new DummyLoad(mOversamplingRate*1625.0e3/6.0);
|
||||
usrp->make();
|
||||
usrp->make(false, deviceID);
|
||||
|
||||
RadioInterface* radio = new RadioInterface(usrp,3,SAMPSPERSYM,mOversamplingRate,false,numARFCN);
|
||||
Transceiver *trx = new Transceiver(5700,"127.0.0.1",SAMPSPERSYM,GSM::Time(2,0),radio,
|
||||
Transceiver *trx = new Transceiver(gConfig.getNum("TRX.Port"),gConfig.getStr("TRX.IP").c_str(),SAMPSPERSYM,GSM::Time(2,0),radio,
|
||||
numARFCN,mOversamplingRate,false);
|
||||
trx->receiveFIFO(radio->receiveFIFO());
|
||||
|
||||
|
@@ -2713,6 +2713,18 @@ ConfigurationKeyMap getConfigurationKeys()
|
||||
map[tmp->getName()] = *tmp;
|
||||
delete tmp;
|
||||
|
||||
//kurtis
|
||||
tmp = new ConfigurationKey("TRX.Args","",
|
||||
"",
|
||||
ConfigurationKey::CUSTOMER,
|
||||
ConfigurationKey::STRING,
|
||||
"",
|
||||
false,
|
||||
"Extra arguments for the Transceiver"
|
||||
);
|
||||
map[tmp->getName()] = *tmp;
|
||||
delete tmp;
|
||||
|
||||
tmp = new ConfigurationKey("Test.GSM.SimulatedFER.Downlink","0",
|
||||
"probability in %",
|
||||
ConfigurationKey::DEVELOPER,
|
||||
|
@@ -131,18 +131,20 @@ pid_t gTransceiverPid = 0;
|
||||
void startTransceiver()
|
||||
{
|
||||
// kill any stray transceiver process
|
||||
//don't do this if we want to run two of them -kurtis
|
||||
if (system("killall transceiver 2>/dev/null")) {}
|
||||
|
||||
// Start the transceiver binary, if the path is defined.
|
||||
// If the path is not defined, the transceiver must be started by some other process.
|
||||
char TRXnumARFCN[4];
|
||||
sprintf(TRXnumARFCN,"%1d",(int)gConfig.getNum("GSM.Radio.ARFCNs"));
|
||||
LOG(NOTICE) << "starting transceiver " << transceiverPath << " " << TRXnumARFCN;
|
||||
std::string extra_args = gConfig.getStr("TRX.Args");
|
||||
LOG(NOTICE) << "starting transceiver " << transceiverPath << " w/ " << TRXnumARFCN << " ARFCNs and Args:" << extra_args;
|
||||
gTransceiverPid = vfork();
|
||||
LOG_ASSERT(gTransceiverPid>=0);
|
||||
if (gTransceiverPid==0) {
|
||||
// Pid==0 means this is the process that starts the transceiver.
|
||||
execlp(transceiverPath,transceiverPath,TRXnumARFCN,(void*)NULL);
|
||||
execlp(transceiverPath,transceiverPath,TRXnumARFCN,extra_args.c_str(),(void*)NULL);
|
||||
LOG(EMERG) << "cannot find " << transceiverPath;
|
||||
_exit(1);
|
||||
} else {
|
||||
|
@@ -225,6 +225,7 @@ INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.RadioFrequencyOffset','128',1,0,'Fine
|
||||
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.Timeout.Clock','10',0,0,'How long to wait during a read operation from the transceiver before giving up.');
|
||||
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.Timeout.Start','2',0,0,'How long to wait during system startup before checking to see if the transceiver can be reached.');
|
||||
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.TxAttenOffset','0',1,0,'Hardware-specific gain adjustment for transmitter, matched to the power amplifier, expessed as an attenuationi in dB. Set at the factory. Do not adjust without proper calibration. Static.');
|
||||
INSERT OR IGNORE INTO "CONFIG" VALUES('TRX.Args','',1,0,'Extra arguments for the Transceiver');
|
||||
INSERT OR IGNORE INTO "CONFIG" VALUES('Test.GSM.SimulatedFER.Downlink','0',1,0,'Probability (0-100) of dropping any downlink frame to test robustness. Static.');
|
||||
INSERT OR IGNORE INTO "CONFIG" VALUES('Test.GSM.SimulatedFER.Uplink','0',1,0,'Probability (0-100) of dropping any uplink frame to test robustness. Static.');
|
||||
INSERT OR IGNORE INTO "CONFIG" VALUES('Test.GSM.UplinkFuzzingRate','0',1,0,'Probability (0-100) of flipping a bit in any uplink frame to test robustness. Static.');
|
||||
|
Reference in New Issue
Block a user