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.
This commit is contained in:
parent
bc570dd885
commit
efd2e6e25f
|
@ -86,6 +86,12 @@ class GSMConfigL1 {
|
||||||
|
|
||||||
}; // GSM
|
}; // GSM
|
||||||
|
|
||||||
|
/**@addtogroup Globals */
|
||||||
|
//@{
|
||||||
|
/** A single global GSMConfig object in the global namespace. */
|
||||||
|
extern GSM::GSMConfigL1 &gBTSL1;
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ static const int powerCommand1900[32] =
|
||||||
|
|
||||||
const int* pickTable()
|
const int* pickTable()
|
||||||
{
|
{
|
||||||
switch (gBTS.band()) {
|
switch (gBTSL1.band()) {
|
||||||
case GSM850:
|
case GSM850:
|
||||||
case EGSM900:
|
case EGSM900:
|
||||||
return powerCommandLowBand;
|
return powerCommandLowBand;
|
||||||
|
@ -181,11 +181,11 @@ unsigned encodePower(int power)
|
||||||
L1Encoder::L1Encoder(unsigned wTN, const TDMAMapping& wMapping, L1FEC *wParent)
|
L1Encoder::L1Encoder(unsigned wTN, const TDMAMapping& wMapping, L1FEC *wParent)
|
||||||
:mDownstream(NULL),
|
:mDownstream(NULL),
|
||||||
mMapping(wMapping),mTN(wTN),
|
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),
|
mParent(wParent),
|
||||||
mTotalBursts(0),
|
mTotalBursts(0),
|
||||||
mPrevWriteTime(gBTS.time().FN(),wTN),
|
mPrevWriteTime(gBTSL1.time().FN(),wTN),
|
||||||
mNextWriteTime(gBTS.time().FN(),wTN),
|
mNextWriteTime(gBTSL1.time().FN(),wTN),
|
||||||
mRunning(false),mActive(false)
|
mRunning(false),mActive(false)
|
||||||
{
|
{
|
||||||
assert(mMapping.allowedSlot(mTN));
|
assert(mMapping.allowedSlot(mTN));
|
||||||
|
@ -271,7 +271,7 @@ void L1Encoder::resync()
|
||||||
{
|
{
|
||||||
// If the encoder's clock is far from the current BTS clock,
|
// If the encoder's clock is far from the current BTS clock,
|
||||||
// get it caught up to something reasonable.
|
// get it caught up to something reasonable.
|
||||||
Time now = gBTS.time();
|
Time now = gBTSL1.time();
|
||||||
int32_t delta = mNextWriteTime-now;
|
int32_t delta = mNextWriteTime-now;
|
||||||
OBJLOG(DEEPDEBUG) << "L1Encoder next=" << mNextWriteTime << " now=" << now << " delta=" << delta;
|
OBJLOG(DEEPDEBUG) << "L1Encoder next=" << mNextWriteTime << " now=" << now << " delta=" << delta;
|
||||||
if ((delta<0) || (delta>(51*26))) {
|
if ((delta<0) || (delta>(51*26))) {
|
||||||
|
@ -287,7 +287,7 @@ void L1Encoder::waitToSend() const
|
||||||
{
|
{
|
||||||
// Block until the BTS clock catches up to the
|
// Block until the BTS clock catches up to the
|
||||||
// mostly recently transmitted burst.
|
// 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 sentParity = ~mU.peekField(8,6);
|
||||||
unsigned checkParity = mD.parity(mParity);
|
unsigned checkParity = mD.parity(mParity);
|
||||||
unsigned encodedBSIC = (sentParity ^ checkParity) & 0x03f;
|
unsigned encodedBSIC = (sentParity ^ checkParity) & 0x03f;
|
||||||
if (encodedBSIC != gBTS.BSIC()) {
|
if (encodedBSIC != gBTSL1.BSIC()) {
|
||||||
countBadFrame();
|
countBadFrame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -938,7 +938,7 @@ void SCHL1Encoder::generate()
|
||||||
assert(mDownstream);
|
assert(mDownstream);
|
||||||
// Data, GSM 04.08 9.1.30
|
// Data, GSM 04.08 9.1.30
|
||||||
size_t wp=0;
|
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.T1(),11);
|
||||||
mD.writeField(wp,mNextWriteTime.T2(),5);
|
mD.writeField(wp,mNextWriteTime.T2(),5);
|
||||||
mD.writeField(wp,mNextWriteTime.T3p(),3);
|
mD.writeField(wp,mNextWriteTime.T3p(),3);
|
||||||
|
@ -1336,7 +1336,7 @@ void TCHFACCHL1Encoder::dispatch()
|
||||||
// from above. TCH/FACCH, however, must feed the interleaver on time.
|
// from above. TCH/FACCH, however, must feed the interleaver on time.
|
||||||
if (!active()) {
|
if (!active()) {
|
||||||
mNextWriteTime += 26;
|
mNextWriteTime += 26;
|
||||||
gBTS.clock().wait(mNextWriteTime);
|
gBTSL1.clock().wait(mNextWriteTime);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ void TransceiverManager::clockHandler()
|
||||||
uint32_t FN;
|
uint32_t FN;
|
||||||
sscanf(buffer,"IND CLOCK %u", &FN);
|
sscanf(buffer,"IND CLOCK %u", &FN);
|
||||||
LOG(DEBUG) << "CLOCK indication, clock="<<FN;
|
LOG(DEBUG) << "CLOCK indication, clock="<<FN;
|
||||||
gBTS.clock().set(FN);
|
gBTSL1.clock().set(FN);
|
||||||
mHaveClock = true;
|
mHaveClock = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ void ::ARFCNManager::installDecoder(GSM::L1Decoder *wL1d)
|
||||||
|
|
||||||
void ::ARFCNManager::writeHighSide(const GSM::TxBurst& burst)
|
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
|
// format the transmission request message
|
||||||
static const int bufferSize = gSlotLen+1+4+1;
|
static const int bufferSize = gSlotLen+1+4+1;
|
||||||
char buffer[bufferSize];
|
char buffer[bufferSize];
|
||||||
|
@ -340,8 +340,8 @@ int ::ARFCNManager::sendCommand(const char*command)
|
||||||
bool ::ARFCNManager::tune(int wARFCN)
|
bool ::ARFCNManager::tune(int wARFCN)
|
||||||
{
|
{
|
||||||
// convert ARFCN number to a frequency
|
// convert ARFCN number to a frequency
|
||||||
unsigned rxFreq = uplinkFreqKHz(gBTS.band(),wARFCN);
|
unsigned rxFreq = uplinkFreqKHz(gBTSL1.band(),wARFCN);
|
||||||
unsigned txFreq = downlinkFreqKHz(gBTS.band(),wARFCN);
|
unsigned txFreq = downlinkFreqKHz(gBTSL1.band(),wARFCN);
|
||||||
// tune rx
|
// tune rx
|
||||||
int status = sendCommand("RXTUNE",rxFreq);
|
int status = sendCommand("RXTUNE",rxFreq);
|
||||||
if (status!=0) {
|
if (status!=0) {
|
||||||
|
@ -364,7 +364,7 @@ bool ::ARFCNManager::tune(int wARFCN)
|
||||||
bool ::ARFCNManager::tuneLoopback(int wARFCN)
|
bool ::ARFCNManager::tuneLoopback(int wARFCN)
|
||||||
{
|
{
|
||||||
// convert ARFCN number to a frequency
|
// convert ARFCN number to a frequency
|
||||||
unsigned txFreq = downlinkFreqKHz(gBTS.band(),wARFCN);
|
unsigned txFreq = downlinkFreqKHz(gBTSL1.band(),wARFCN);
|
||||||
// tune rx
|
// tune rx
|
||||||
int status = sendCommand("RXTUNE",txFreq);
|
int status = sendCommand("RXTUNE",txFreq);
|
||||||
if (status!=0) {
|
if (status!=0) {
|
||||||
|
|
|
@ -116,6 +116,7 @@ SIP::SIPInterface gSIPInterface;
|
||||||
/// Configure the BTS object based on the config file.
|
/// Configure the BTS object based on the config file.
|
||||||
/// So don't create this until AFTER loading the config file.
|
/// So don't create this until AFTER loading the config file.
|
||||||
GSMConfig gBTS;
|
GSMConfig gBTS;
|
||||||
|
GSMConfigL1 &gBTSL1 = gBTS;
|
||||||
|
|
||||||
/// Our interface to the software-defined radio.
|
/// Our interface to the software-defined radio.
|
||||||
TransceiverManager gTRX(1, gConfig.getStr("TRX.IP"), gConfig.getNum("TRX.Port"));
|
TransceiverManager gTRX(1, gConfig.getStr("TRX.IP"), gConfig.getNum("TRX.Port"));
|
||||||
|
|
Reference in New Issue