laforge
/
openbts-osmo
Archived
1
0
Fork 0

Introduce gBTSL1 global and use it from the GSM L1

The purpose of this is to find a way how we can just configure the L1
without depending on the higher layers of the protocol stack.
master
Harald Welte 11 years ago
parent bc570dd885
commit efd2e6e25f
  1. 6
      public-trunk/GSM/GSMConfigL1.h
  2. 18
      public-trunk/GSM/GSML1FEC.cpp
  3. 10
      public-trunk/TRXManager/TRXManager.cpp
  4. 1
      public-trunk/apps/OpenBTS.cpp

@ -86,6 +86,12 @@ class GSMConfigL1 {
}; // GSM
/**@addtogroup Globals */
//@{
/** A single global GSMConfig object in the global namespace. */
extern GSM::GSMConfigL1 &gBTSL1;
//@}
#endif

@ -123,7 +123,7 @@ static const int powerCommand1900[32] =
const int* pickTable()
{
switch (gBTS.band()) {
switch (gBTSL1.band()) {
case GSM850:
case EGSM900:
return powerCommandLowBand;
@ -181,11 +181,11 @@ unsigned encodePower(int power)
L1Encoder::L1Encoder(unsigned wTN, const TDMAMapping& wMapping, L1FEC *wParent)
:mDownstream(NULL),
mMapping(wMapping),mTN(wTN),
mTSC(gBTS.BCC()), // Note that TSC is hardcoded to the BCC.
mTSC(gBTSL1.BCC()), // Note that TSC is hardcoded to the BCC.
mParent(wParent),
mTotalBursts(0),
mPrevWriteTime(gBTS.time().FN(),wTN),
mNextWriteTime(gBTS.time().FN(),wTN),
mPrevWriteTime(gBTSL1.time().FN(),wTN),
mNextWriteTime(gBTSL1.time().FN(),wTN),
mRunning(false),mActive(false)
{
assert(mMapping.allowedSlot(mTN));
@ -271,7 +271,7 @@ void L1Encoder::resync()
{
// If the encoder's clock is far from the current BTS clock,
// get it caught up to something reasonable.
Time now = gBTS.time();
Time now = gBTSL1.time();
int32_t delta = mNextWriteTime-now;
OBJLOG(DEEPDEBUG) << "L1Encoder next=" << mNextWriteTime << " now=" << now << " delta=" << delta;
if ((delta<0) || (delta>(51*26))) {
@ -287,7 +287,7 @@ void L1Encoder::waitToSend() const
{
// Block until the BTS clock catches up to the
// mostly recently transmitted burst.
gBTS.clock().wait(mPrevWriteTime);
gBTSL1.clock().wait(mPrevWriteTime);
}
@ -484,7 +484,7 @@ void RACHL1Decoder::writeLowSide(const RxBurst& burst)
unsigned sentParity = ~mU.peekField(8,6);
unsigned checkParity = mD.parity(mParity);
unsigned encodedBSIC = (sentParity ^ checkParity) & 0x03f;
if (encodedBSIC != gBTS.BSIC()) {
if (encodedBSIC != gBTSL1.BSIC()) {
countBadFrame();
return;
}
@ -938,7 +938,7 @@ void SCHL1Encoder::generate()
assert(mDownstream);
// Data, GSM 04.08 9.1.30
size_t wp=0;
mD.writeField(wp,gBTS.BSIC(),6);
mD.writeField(wp,gBTSL1.BSIC(),6);
mD.writeField(wp,mNextWriteTime.T1(),11);
mD.writeField(wp,mNextWriteTime.T2(),5);
mD.writeField(wp,mNextWriteTime.T3p(),3);
@ -1336,7 +1336,7 @@ void TCHFACCHL1Encoder::dispatch()
// from above. TCH/FACCH, however, must feed the interleaver on time.
if (!active()) {
mNextWriteTime += 26;
gBTS.clock().wait(mNextWriteTime);
gBTSL1.clock().wait(mNextWriteTime);
return;
}

@ -102,7 +102,7 @@ void TransceiverManager::clockHandler()
uint32_t FN;
sscanf(buffer,"IND CLOCK %u", &FN);
LOG(DEBUG) << "CLOCK indication, clock="<<FN;
gBTS.clock().set(FN);
gBTSL1.clock().set(FN);
mHaveClock = true;
return;
}
@ -171,7 +171,7 @@ void ::ARFCNManager::installDecoder(GSM::L1Decoder *wL1d)
void ::ARFCNManager::writeHighSide(const GSM::TxBurst& burst)
{
LOG(DEEPDEBUG) << "transmit at time " << gBTS.clock().get() << ": " << burst;
LOG(DEEPDEBUG) << "transmit at time " << gBTSL1.clock().get() << ": " << burst;
// format the transmission request message
static const int bufferSize = gSlotLen+1+4+1;
char buffer[bufferSize];
@ -340,8 +340,8 @@ int ::ARFCNManager::sendCommand(const char*command)
bool ::ARFCNManager::tune(int wARFCN)
{
// convert ARFCN number to a frequency
unsigned rxFreq = uplinkFreqKHz(gBTS.band(),wARFCN);
unsigned txFreq = downlinkFreqKHz(gBTS.band(),wARFCN);
unsigned rxFreq = uplinkFreqKHz(gBTSL1.band(),wARFCN);
unsigned txFreq = downlinkFreqKHz(gBTSL1.band(),wARFCN);
// tune rx
int status = sendCommand("RXTUNE",rxFreq);
if (status!=0) {
@ -364,7 +364,7 @@ bool ::ARFCNManager::tune(int wARFCN)
bool ::ARFCNManager::tuneLoopback(int wARFCN)
{
// convert ARFCN number to a frequency
unsigned txFreq = downlinkFreqKHz(gBTS.band(),wARFCN);
unsigned txFreq = downlinkFreqKHz(gBTSL1.band(),wARFCN);
// tune rx
int status = sendCommand("RXTUNE",txFreq);
if (status!=0) {

@ -116,6 +116,7 @@ SIP::SIPInterface gSIPInterface;
/// Configure the BTS object based on the config file.
/// So don't create this until AFTER loading the config file.
GSMConfig gBTS;
GSMConfigL1 &gBTSL1 = gBTS;
/// Our interface to the software-defined radio.
TransceiverManager gTRX(1, gConfig.getStr("TRX.IP"), gConfig.getNum("TRX.Port"));