Exemplo n.º 1
0
void GSMConfig::createCombinationI(TransceiverManager& TRX, unsigned CN, unsigned TN)
{
    LOG_ASSERT((CN!=0)||(TN!=0));
    LOG(NOTICE) << "Configuring combination I on C" << CN << "T" << TN;
    ARFCNManager *radio = TRX.ARFCN(CN);
    radio->setSlot(TN,1);	// (pat) 1 => Transciever.h enum ChannelCombination = I
    TCHFACCHLogicalChannel* chan = new TCHFACCHLogicalChannel(CN,TN,gTCHF_T[TN]);
    chan->downstream(radio);
    Thread* thread = new Thread;
    thread->start((void*(*)(void*))Control::DCCHDispatcher,dynamic_cast<L3LogicalChannel*>(chan));
    chan->lcinit();
    if (CN == 0 && !testStart) chan->lcstart();	// Everything on C0 must broadcast continually.
    gBTS.addTCH(chan);
}
Exemplo n.º 2
0
// 6-2014 pat: The channel is now returned with T3101 running but un-started, which means it is not yet transmitting.
// The caller is responsible for setting the Timing Advance and then starting it.
TCHFACCHLogicalChannel *GSMConfig::getTCH(
    bool forGPRS,	// If true, allocate the channel to gprs, else to RR use.
    bool onlyCN0)	// If true, allocate only channels on the lowest ARFCN.
{
    LOG(DEBUG);
    ScopedLock lock(mLock);
    //if (GPRS::GPRSDebug) {
    //	const unsigned sz = mTCHPool.size();
    //	char buf[300];  int n = 0;
    //	for (unsigned i=0; i<sz; i++) {
    //		TCHFACCHLogicalChannel *chan = mTCHPool[i];
    //		n += sprintf(&buf[n],"ch=%d:%d,g=%d,r=%d ",chan->CN(),chan->TN(),
    //				chan->inUseByGPRS(),chan->recyclable());
    //	}
    //	LOG(WARNING)<<"getTCH list:"<<buf;
    //}
    TCHFACCHLogicalChannel *chan = getChan<TCHFACCHLogicalChannel>(mTCHPool,forGPRS);
    // (pat) We have to open it or set gprs mode before returning to avoid a race.
    if (chan) {
        // The channels are searched in order from low to high, so if the first channel
        // found is not on CN0, we have failed.
        //LOG(DEBUG)<<"getTCH returns"<<LOGVAR2("chan->CN",chan->CN());
        if (onlyCN0 && chan->CN()) {
            return NULL;
        }
        if (forGPRS) {
            // (pat) Reserves channel for GPRS, but does not start delivering bursts yet.
            chan->lcGetL1()->setGPRS(true,NULL);
            return chan;
        }
        gReports.incr("OpenBTS.GSM.RR.ChannelAssignment");
        chan->lcinit();
    } else {
        //LOG(DEBUG)<<"getTCH returns NULL";
    }
    LOG(DEBUG);
    return chan;
}