mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
synced 2025-11-02 21:23:16 +00:00
Compare commits
12 Commits
achemeris/
...
fairwaves/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb8d46adaa | ||
|
|
20b388973c | ||
|
|
0d039e2676 | ||
|
|
ad669513d2 | ||
|
|
fd978b28bd | ||
|
|
1b6aaae3fa | ||
|
|
facdadc254 | ||
|
|
eefa8e58f7 | ||
|
|
3ac1cbf40e | ||
|
|
139c84564c | ||
|
|
2cb6070e09 | ||
|
|
f2bdd1a24c |
@@ -193,7 +193,7 @@ Log::~Log()
|
||||
if (mDummyInit) return;
|
||||
// Anything at or above LOG_CRIT is an "alarm".
|
||||
// Save alarms in the local list and echo them to stderr.
|
||||
if (mPriority <= LOG_CRIT) {
|
||||
if (mPriority <= LOG_ERR) {
|
||||
if (sLoggerInited) addAlarm(mStream.str().c_str());
|
||||
cerr << mStream.str() << endl;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iomanip> // std::setprecision
|
||||
#include <fstream>
|
||||
#include "Transceiver.h"
|
||||
#include <Logger.h>
|
||||
|
||||
@@ -151,10 +152,15 @@ Transceiver::Transceiver(int wBasePort,
|
||||
mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface),
|
||||
rssiOffset(wRssiOffset),
|
||||
mSPSTx(wSPS), mSPSRx(1), mChans(wChans), mOn(false),
|
||||
mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelay(0)
|
||||
mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelay(0), mWriteBurstToDiskMask(0)
|
||||
{
|
||||
txFullScale = mRadioInterface->fullScaleInputValue();
|
||||
rxFullScale = mRadioInterface->fullScaleOutputValue();
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < 8; j++)
|
||||
mHandover[i][j] = false;
|
||||
}
|
||||
}
|
||||
|
||||
Transceiver::~Transceiver()
|
||||
@@ -462,9 +468,15 @@ void Transceiver::setModulus(size_t timeslot, size_t chan)
|
||||
Transceiver::CorrType Transceiver::expectedCorrType(GSM::Time currTime,
|
||||
size_t chan)
|
||||
{
|
||||
static int tchh_subslot[26] = { 0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,1 };
|
||||
static int sdcch4_subslot[102] = { 3,3,3,3,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,
|
||||
3,3,3,3,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2 };
|
||||
static int sdcch8_subslot[102] = { 5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,
|
||||
1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4 };
|
||||
TransceiverState *state = &mStates[chan];
|
||||
unsigned burstTN = currTime.TN();
|
||||
unsigned burstFN = currTime.FN();
|
||||
int subch;
|
||||
|
||||
switch (state->chanType[burstTN]) {
|
||||
case NONE:
|
||||
@@ -474,16 +486,25 @@ Transceiver::CorrType Transceiver::expectedCorrType(GSM::Time currTime,
|
||||
return IDLE;
|
||||
break;
|
||||
case I:
|
||||
// TODO: Are we expecting RACH on an IDLE frame?
|
||||
/* if (burstFN % 26 == 25)
|
||||
return IDLE;*/
|
||||
if (mHandover[burstTN][0])
|
||||
return RACH;
|
||||
return TSC;
|
||||
/*if (burstFN % 26 == 25)
|
||||
return IDLE;
|
||||
else
|
||||
return TSC;*/
|
||||
break;
|
||||
case II:
|
||||
subch = tchh_subslot[burstFN % 26];
|
||||
if (subch == 1)
|
||||
return IDLE;
|
||||
if (mHandover[burstTN][0])
|
||||
return RACH;
|
||||
return TSC;
|
||||
break;
|
||||
case III:
|
||||
subch = tchh_subslot[burstFN % 26];
|
||||
if (mHandover[burstTN][subch])
|
||||
return RACH;
|
||||
return TSC;
|
||||
break;
|
||||
case IV:
|
||||
@@ -498,6 +519,8 @@ Transceiver::CorrType Transceiver::expectedCorrType(GSM::Time currTime,
|
||||
return RACH;
|
||||
else if ((mod51 == 45) || (mod51 == 46))
|
||||
return RACH;
|
||||
else if (mHandover[burstTN][sdcch4_subslot[burstFN % 102]])
|
||||
return RACH;
|
||||
else
|
||||
return TSC;
|
||||
break;
|
||||
@@ -505,6 +528,8 @@ Transceiver::CorrType Transceiver::expectedCorrType(GSM::Time currTime,
|
||||
case VII:
|
||||
if ((burstFN % 51 <= 14) && (burstFN % 51 >= 12))
|
||||
return IDLE;
|
||||
else if (mHandover[burstTN][sdcch8_subslot[burstFN % 102]])
|
||||
return RACH;
|
||||
else
|
||||
return TSC;
|
||||
break;
|
||||
@@ -616,6 +641,16 @@ SoftVector *Transceiver::demodulate(TransceiverState *state,
|
||||
return demodulateBurst(burst, mSPSRx, amp, toa);
|
||||
}
|
||||
|
||||
void writeToFile(radioVector *radio_burst, size_t chan)
|
||||
{
|
||||
GSM::Time time = radio_burst->getTime();
|
||||
std::ostringstream fname;
|
||||
fname << chan << "_" << time.FN() << "_" << time.TN() << ".fc";
|
||||
std::ofstream outfile (fname.str().c_str(), std::ofstream::binary);
|
||||
outfile.write((char*)radio_burst->getVector()->begin(), radio_burst->getVector()->size() * 2 * sizeof(float));
|
||||
outfile.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* Pull bursts from the FIFO and handle according to the slot
|
||||
* and burst correlation type. Equalzation is currently disabled.
|
||||
@@ -643,6 +678,12 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI, bool &i
|
||||
GSM::Time time = radio_burst->getTime();
|
||||
CorrType type = expectedCorrType(time, chan);
|
||||
|
||||
/* Debug: dump bursts to disk */
|
||||
/* bits 0-7 - chan 0 timeslots
|
||||
* bits 8-15 - chan 1 timeslots */
|
||||
if (mWriteBurstToDiskMask & ((1<<time.TN()) << (8*chan)))
|
||||
writeToFile(radio_burst, chan);
|
||||
|
||||
/* No processing if the timeslot is off.
|
||||
* Not even power level or noise calculation. */
|
||||
if (type == OFF) {
|
||||
@@ -765,6 +806,24 @@ void Transceiver::driveControl(size_t chan)
|
||||
sprintf(response,"RSP POWERON 1");
|
||||
else
|
||||
sprintf(response,"RSP POWERON 0");
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < 8; j++)
|
||||
mHandover[i][j] = false;
|
||||
}
|
||||
}
|
||||
else if (strcmp(command,"HANDOVER")==0){
|
||||
int ts=0,ss=0;
|
||||
sscanf(buffer,"%3s %s %d %d",cmdcheck,command,&ts,&ss);
|
||||
mHandover[ts][ss] = true;
|
||||
LOG(WARNING) << "HANDOVER RACH at timeslot " << ts << " subslot " << ss;
|
||||
sprintf(response,"RSP HANDOVER 0 %d %d",ts,ss);
|
||||
}
|
||||
else if (strcmp(command,"NOHANDOVER")==0){
|
||||
int ts=0,ss=0;
|
||||
sscanf(buffer,"%3s %s %d %d",cmdcheck,command,&ts,&ss);
|
||||
mHandover[ts][ss] = false;
|
||||
LOG(WARNING) << "NOHANDOVER at timeslot " << ts << " subslot " << ss;
|
||||
sprintf(response,"RSP NOHANDOVER 0 %d %d",ts,ss);
|
||||
}
|
||||
else if (strcmp(command,"SETMAXDLY")==0) {
|
||||
//set expected maximum time-of-arrival
|
||||
@@ -858,6 +917,14 @@ void Transceiver::driveControl(size_t chan)
|
||||
sprintf(response,"RSP SETSLOT 0 %d %d",timeslot,corrCode);
|
||||
|
||||
}
|
||||
else if (strcmp(command,"_SETBURSTTODISKMASK")==0) {
|
||||
// debug command! may change or disapear without notice
|
||||
// set a mask which bursts to dump to disk
|
||||
int mask;
|
||||
sscanf(buffer,"%3s %s %d",cmdcheck,command,&mask);
|
||||
mWriteBurstToDiskMask = mask;
|
||||
sprintf(response,"RSP _SETBURSTTODISKMASK 0 %d",mask);
|
||||
}
|
||||
else {
|
||||
LOG(WARNING) << "bogus command " << command << " on control interface.";
|
||||
sprintf(response,"RSP ERR 1");
|
||||
|
||||
@@ -227,11 +227,13 @@ private:
|
||||
int mSPSRx; ///< number of samples per Rx symbol
|
||||
size_t mChans;
|
||||
|
||||
bool mOn; ///< flag to indicate that transceiver is powered on
|
||||
bool mOn; ///< flag to indicate that transceiver is powered on
|
||||
bool mHandover[8][8]; ///< expect handover to the timeslot/subslot
|
||||
double mTxFreq; ///< the transmit frequency
|
||||
double mRxFreq; ///< the receive frequency
|
||||
unsigned mTSC; ///< the midamble sequence code
|
||||
unsigned mMaxExpectedDelay; ///< maximum expected time-of-arrival offset in GSM symbols
|
||||
unsigned mMaxExpectedDelay; ///< maximum expected time-of-arrival offset in GSM symbols
|
||||
unsigned mWriteBurstToDiskMask; ///< debug: bitmask to indicate which timeslots to dump to disk
|
||||
|
||||
std::vector<TransceiverState> mStates;
|
||||
|
||||
|
||||
@@ -472,18 +472,24 @@ void uhd_device::init_gains()
|
||||
tx_gain_min = range.start();
|
||||
tx_gain_max = range.stop();
|
||||
}
|
||||
LOG(INFO) << "Supported Tx gain range [" << tx_gain_min << "; " << tx_gain_max << "]";
|
||||
|
||||
range = usrp_dev->get_rx_gain_range();
|
||||
rx_gain_min = range.start();
|
||||
rx_gain_max = range.stop();
|
||||
LOG(INFO) << "Supported Rx gain range [" << rx_gain_min << "; " << rx_gain_max << "]";
|
||||
|
||||
for (size_t i = 0; i < tx_gains.size(); i++) {
|
||||
usrp_dev->set_tx_gain((tx_gain_min + tx_gain_max) / 2, i);
|
||||
double gain = (tx_gain_min + tx_gain_max) / 2;
|
||||
LOG(INFO) << "Default setting Tx gain for channel " << i << " to " << gain;
|
||||
usrp_dev->set_tx_gain(gain, i);
|
||||
tx_gains[i] = usrp_dev->get_tx_gain(i);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < rx_gains.size(); i++) {
|
||||
usrp_dev->set_rx_gain((rx_gain_min + rx_gain_max) / 2, i);
|
||||
double gain = (rx_gain_min + rx_gain_max) / 2;
|
||||
LOG(INFO) << "Default setting Rx gain for channel " << i << " to " << gain;
|
||||
usrp_dev->set_rx_gain(gain, i);
|
||||
rx_gains[i] = usrp_dev->get_rx_gain(i);
|
||||
}
|
||||
|
||||
@@ -581,7 +587,7 @@ double uhd_device::setTxGain(double db, size_t chan)
|
||||
|
||||
tx_gains[chan] = usrp_dev->get_tx_gain(chan);
|
||||
|
||||
LOG(INFO) << "Set TX gain to " << tx_gains[chan] << "dB";
|
||||
LOG(INFO) << "Set TX gain to " << tx_gains[chan] << "dB (asked for " << db << "dB)";
|
||||
|
||||
return tx_gains[chan];
|
||||
}
|
||||
@@ -596,7 +602,7 @@ double uhd_device::setRxGain(double db, size_t chan)
|
||||
usrp_dev->set_rx_gain(db, chan);
|
||||
rx_gains[chan] = usrp_dev->get_rx_gain(chan);
|
||||
|
||||
LOG(INFO) << "Set RX gain to " << rx_gains[chan] << "dB";
|
||||
LOG(INFO) << "Set RX gain to " << rx_gains[chan] << "dB (asked for " << db << "dB)";
|
||||
|
||||
return rx_gains[chan];
|
||||
}
|
||||
@@ -1114,7 +1120,7 @@ uhd::tune_request_t uhd_device::select_freq(double freq, size_t chan, bool tx)
|
||||
uhd::tune_request_t treq(freq);
|
||||
|
||||
if (dev_type == UMTRX) {
|
||||
if (offset > 0.0)
|
||||
if (offset != 0.0)
|
||||
return uhd::tune_request_t(freq, offset);
|
||||
|
||||
// Don't use DSP tuning, because LMS6002D PLL steps are small enough.
|
||||
@@ -1125,6 +1131,7 @@ uhd::tune_request_t uhd_device::select_freq(double freq, size_t chan, bool tx)
|
||||
treq.rf_freq = freq;
|
||||
treq.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
|
||||
treq.dsp_freq = 0.0;
|
||||
return treq;
|
||||
} else if (chans == 1) {
|
||||
if (offset == 0.0)
|
||||
return treq;
|
||||
|
||||
11
debian/changelog
vendored
Normal file
11
debian/changelog
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
osmo-trx (0.1.9) trusty; urgency=medium
|
||||
|
||||
* Ask Ivan, really
|
||||
|
||||
-- Kirill Zakharenko <earwin@gmail.com> Thu, 16 Jul 2015 12:13:46 +0000
|
||||
|
||||
osmo-trx (0.1.8) precise; urgency=low
|
||||
|
||||
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP
|
||||
|
||||
-- Ivan Klyuchnikov <Ivan.Kluchnikov@fairwaves.ru> Sun, 9 Mar 2014 14:10:10 +0400
|
||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
||||
9
|
||||
24
debian/control
vendored
Normal file
24
debian/control
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Source: osmo-trx
|
||||
Maintainer: Ivan Klyuchnikov <ivan.kluchnikov@fairwaves.ru>
|
||||
Section: net
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.3
|
||||
Build-Depends: debhelper (>= 9), autotools-dev, libdbd-sqlite3, pkg-config, dh-autoreconf, uhd, umtrx-uhd, libusb-1.0-0-dev, libboost-all-dev, hardening-wrapper
|
||||
Homepage: http://openbsc.osmocom.org/trac/wiki/OsmoTRX
|
||||
Vcs-Git: git://git.osmocom.org/osmo-trx
|
||||
Vcs-Browser: http://cgit.osmocom.org/osmo-trx
|
||||
|
||||
Package: osmo-trx
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libdbd-sqlite3
|
||||
Description: OsmoTRX is a software-defined radio transceiver that implements the Layer 1 physical layer of a BTS
|
||||
|
||||
Package: osmo-trx-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Depends: osmo-trx (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Debug symbols for the osmo-trx
|
||||
Make debugging possible
|
||||
|
||||
|
||||
25
debian/copyright
vendored
Normal file
25
debian/copyright
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
The Debian packaging is:
|
||||
|
||||
Copyright (C) 2014 Max <max.suraev@fairwaves.ru>
|
||||
|
||||
It was downloaded from:
|
||||
|
||||
git://git.osmocom.org/osmo-trx
|
||||
|
||||
Upstream Authors:
|
||||
|
||||
Thomas Tsou <tom@tsou.cc>
|
||||
David A. Burgess <dburgess@kestrelsp.com>
|
||||
Harvind S. Samra <hssamra@kestrelsp.com>
|
||||
Raffi Sevlian <raffisev@gmail.com>
|
||||
|
||||
Copyright:
|
||||
|
||||
Copyright (C) 2012-2013 Thomas Tsou <tom@tsou.cc>
|
||||
Copyright (C) 2011 Range Networks, Inc.
|
||||
Copyright (C) 2008-2011 Free Software Foundation, Inc.
|
||||
|
||||
License:
|
||||
|
||||
GNU Affero General Public License, Version 3
|
||||
|
||||
1
debian/osmo-trx.install
vendored
Normal file
1
debian/osmo-trx.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/usr/bin/osmo-trx
|
||||
15
debian/rules
vendored
Executable file
15
debian/rules
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export DEB_BUILD_HARDENING=1
|
||||
|
||||
CFLAGS+="-march=atom -mtune=atom -O2"
|
||||
CPPFLAGS+="-march=atom -mtune=atom -O2"
|
||||
|
||||
%:
|
||||
dh $@ --with autoreconf
|
||||
|
||||
override_dh_shlibdeps:
|
||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package=osmo-trx-dbg
|
||||
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@@ -0,0 +1 @@
|
||||
3.0 (native)
|
||||
Reference in New Issue
Block a user