[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10029 - in openbts/trunk: . CommonLibs Control GSM SI
From: |
dburgess00 |
Subject: |
[Commit-gnuradio] r10029 - in openbts/trunk: . CommonLibs Control GSM SIP Transceiver apps |
Date: |
Fri, 21 Nov 2008 15:45:01 -0700 (MST) |
Author: dburgess00
Date: 2008-11-21 15:45:00 -0700 (Fri, 21 Nov 2008)
New Revision: 10029
Added:
openbts/trunk/apps/OpenBTS850.cpp
Modified:
openbts/trunk/CommonLibs/Makefile
openbts/trunk/CommonLibs/Threads.cpp
openbts/trunk/CommonLibs/Timeval.cpp
openbts/trunk/CommonLibs/Timeval.h
openbts/trunk/Control/CallControl.cpp
openbts/trunk/Control/ControlCommon.cpp
openbts/trunk/Control/ControlCommon.h
openbts/trunk/Control/RadioResource.cpp
openbts/trunk/GSM/GSML3RRMessages.cpp
openbts/trunk/Makefile
openbts/trunk/Makefile.include
openbts/trunk/README
openbts/trunk/SIP/SIPInterface.cpp
openbts/trunk/Transceiver/Makefile
openbts/trunk/Transceiver/Transceiver.cpp
openbts/trunk/Transceiver/Transceiver.h
openbts/trunk/Transceiver/USRPDevice.cpp
openbts/trunk/Transceiver/USRPDevice.h
openbts/trunk/Transceiver/radioInterface.cpp
openbts/trunk/Transceiver/sigProcLib.cpp
openbts/trunk/apps/Makefile
openbts/trunk/apps/OpenBTS900.cpp
Log:
Merging changes from dburgess00 development branch, r9993:10028.
Includes fixes to mitigate tracker items #315, #319, #317.
Modified: openbts/trunk/CommonLibs/Makefile
===================================================================
--- openbts/trunk/CommonLibs/Makefile 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/CommonLibs/Makefile 2008-11-21 22:45:00 UTC (rev 10029)
@@ -30,7 +30,7 @@
BitVector.o: BitVector.cpp BitVector.h Vector.h
- $(COMPILE) -o $@ $<
+ $(COMPILE) -O3 -o $@ $<
BitVectorTest: BitVectorTest.cpp Vector.h BitVector.o
$(BUILD) -o $@ $< BitVector.o
Modified: openbts/trunk/CommonLibs/Threads.cpp
===================================================================
--- openbts/trunk/CommonLibs/Threads.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/CommonLibs/Threads.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -88,6 +88,7 @@
void Signal::wait(Mutex& wMutex, unsigned timeout) const
{
struct timespec waitTime = Timeval(timeout).timespec();
+ // FIXME -- With -O3 optimzation in OS X this doesn't block. See bug
#320.
pthread_cond_timedwait(&mSignal,&wMutex.mMutex,&waitTime);
}
Modified: openbts/trunk/CommonLibs/Timeval.cpp
===================================================================
--- openbts/trunk/CommonLibs/Timeval.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/CommonLibs/Timeval.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -82,5 +82,12 @@
}
+ostream& operator<<(ostream& os, const struct timespec& ts)
+{
+ os << ts.tv_sec << "," << ts.tv_nsec;
+ return os;
+}
+
+
// vim: ts=4 sw=4
Modified: openbts/trunk/CommonLibs/Timeval.h
===================================================================
--- openbts/trunk/CommonLibs/Timeval.h 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/CommonLibs/Timeval.h 2008-11-21 22:45:00 UTC (rev 10029)
@@ -87,8 +87,10 @@
};
-std::ostream& operator<<(std::ostream& os, const Timeval& tv);
+std::ostream& operator<<(std::ostream& os, const Timeval&);
+std::ostream& operator<<(std::ostream& os, const struct timespec&);
+
#endif
// vim: ts=4 sw=4
Modified: openbts/trunk/Control/CallControl.cpp
===================================================================
--- openbts/trunk/Control/CallControl.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Control/CallControl.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -212,6 +212,8 @@
// Call clearing steps.
// Good diagrams in GSM 04.08 7.3.4
+ // FIXME -- We should be checking TI values against the transaction
object.
+
// Disconnect (1st step of MOD)
// GSM 04.08 5.4.3.2
if (const L3Disconnect* disconnect = dynamic_cast<const
L3Disconnect*>(message)) {
@@ -389,7 +391,6 @@
bool SIPCleared = (engine.state()==SIP::Cleared);
return GSMCleared && SIPCleared;
-
}
@@ -526,9 +527,10 @@
setup->calledPartyBCDNumber());
transaction.SIP().User(IMSI);
transaction.Q931State(TransactionEntry::MOCInitiated);
- unsigned transactionID = gTransactionTable.add(transaction);
- SDCCH->transactionID(transactionID);
- TCH->transactionID(transactionID);
+ SDCCH->transactionID(transaction.ID());
+ TCH->transactionID(transaction.ID());
+ CLDCOUT("MOC: transaction: " << transaction);
+ gTransactionTable.add(transaction);
// At this point, we have enough information start the SIP call setup.
// We have 2 seconds to repsond to the MS. ITU-T Q.931 Table 9-1, T303.
@@ -547,6 +549,7 @@
// The transaction is moving on to the MOCController.
gTransactionTable.update(transaction);
+ CLDCOUT("MOC: transaction: " << transaction);
// This call also opens the TCH.
assignTCHF(SDCCH,TCH);
}
@@ -560,7 +563,7 @@
*/
void Control::MOCController(TransactionEntry& transaction,
TCHFACCHLogicalChannel* TCH)
{
- CLDCOUT("MOC: transaction ID " << transaction.ID());
+ CLDCOUT("MOC: transaction: " << transaction);
unsigned L3TI = transaction.TIValue();
// Once we can start SIP call setup, send Call Proceeding.
@@ -655,7 +658,6 @@
// Let the phone know the call is connected.
CLDCOUT("MOC: sending Connect to handset");
- msleep(1000); // HACK to prevent a race condition
TCH->send(L3Connect(1,L3TI));
transaction.T313().set();
transaction.Q931State(TransactionEntry::ConnectIndication);
@@ -694,16 +696,14 @@
// Find the transction table entry that was created when the phone was
paged.
CLDCOUT("MTC: find TransactionEntry for " << resp->mobileIdentity());
TransactionEntry transaction;
- unsigned transactionID =
gTransactionTable.findByMobileID(resp->mobileIdentity(),transaction);
- if (transactionID==0) {
+ if
(!gTransactionTable.findByMobileID(resp->mobileIdentity(),transaction)) {
CLDCOUT("WARNING -- MTC attempt with no transaction record");
return;
}
- unsigned L3TI = transactionID % 7;
- CLDCOUT("MTC: transactionID="<<transactionID)
- transaction.TIValue(L3TI);
- TCH->transactionID(transactionID);
- SDCCH->transactionID(transactionID);
+ CLDCOUT("MTC: transaction: "<< transaction);
+ TCH->transactionID(transaction.ID());
+ SDCCH->transactionID(transaction.ID());
+ unsigned L3TI = transaction.TIValue();
// GSM 04.08 5.2.2.1
CLDCOUT("MTC: sending GSM Setup");
@@ -734,6 +734,7 @@
// The transaction is moving to the MTCController.
gTransactionTable.update(transaction);
+ CLDCOUT("MTC: transaction: " << transaction);
assignTCHF(SDCCH,TCH);
}
@@ -744,7 +745,7 @@
// Early Assignment Mobile Terminated Call.
// Transaction table in 04.08 7.3.3 figure 7.10a
- CLDCOUT("MTC:, transaction ID " << transaction.ID());
+ CLDCOUT("MTC: transaction: " << transaction);
unsigned L3TI = transaction.TIValue();
// Get the alerting message.
@@ -778,7 +779,6 @@
state =
transaction.SIP().MTCSendOK(RTPPorts,SIP::RTPGSM610);
break;
case SIP::Connecting:
- //msleep(1000);
break;
default:
CLDCOUT("MTC: SIP unexpected state " << state);
@@ -826,7 +826,7 @@
sleep(1);
TLMessage * msg = tl_proc.mUplinkFIFO.read();
- DCOUT(" ControlLayer SMS = "<<*msg)
+ CLDCOUT(" ControlLayer SMS = "<<*msg)
sleep(1);
tl_proc.writeHighSide( SubmitReport("08162312394401"), SM_RL_REPORT_REQ
);
Modified: openbts/trunk/Control/ControlCommon.cpp
===================================================================
--- openbts/trunk/Control/ControlCommon.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Control/ControlCommon.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -46,6 +46,67 @@
TransactionTable gTransactionTable;
+
+
+
+TransactionEntry::TransactionEntry()
+ :mID(gTransactionTable.newID()),
+ mQ931State(NullState),
+ mT301(T301ms), mT302(T302ms), mT303(T303ms),
+ mT304(T304ms), mT305(T305ms), mT308(T308ms),
+ mT310(T310ms), mT313(T313ms),
+ mT3113(GSM::T3113ms)
+{}
+
+TransactionEntry::TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
+ const GSM::L3CMServiceType& wService,
+ const GSM::L3CallingPartyBCDNumber& wCalling)
+ :mID(gTransactionTable.newID()),
+ mSubscriber(wSubscriber),mService(wService),
+ mTIFlag(1), mTIValue(0),
+ mCalling(wCalling),
+ mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
+ mQ931State(NullState),
+ mT301(T301ms), mT302(T302ms), mT303(T303ms),
+ mT304(T304ms), mT305(T305ms), mT308(T308ms),
+ mT310(T310ms), mT313(T313ms),
+ mT3113(GSM::T3113ms)
+{}
+
+TransactionEntry::TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
+ const GSM::L3CMServiceType& wService,
+ unsigned wTIValue,
+ const GSM::L3CalledPartyBCDNumber& wCalled)
+ :mID(gTransactionTable.newID()),
+ mSubscriber(wSubscriber),mService(wService),
+ mTIFlag(0), mTIValue(wTIValue),
+ mCalled(wCalled),
+ mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
+ mQ931State(NullState),
+ mT301(T301ms), mT302(T302ms), mT303(T303ms),
+ mT304(T304ms), mT305(T305ms), mT308(T308ms),
+ mT310(T310ms), mT313(T313ms),
+ mT3113(GSM::T3113ms)
+{}
+
+
+TransactionEntry::TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
+ const GSM::L3CMServiceType& wService,
+ unsigned wTIValue,
+ const GSM::L3CallingPartyBCDNumber& wCalling)
+ :mID(gTransactionTable.newID()),
+ mSubscriber(wSubscriber),mService(wService),
+ mTIValue(wTIValue),mCalling(wCalling),
+ mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
+ mQ931State(NullState),
+ mT301(T301ms), mT302(T302ms), mT303(T303ms),
+ mT304(T304ms), mT305(T305ms), mT308(T308ms),
+ mT310(T310ms), mT313(T313ms),
+ mT3113(GSM::T3113ms)
+{}
+
+
+
bool TransactionEntry::timerExpired() const
{
if (mT301.expired()) {
@@ -101,7 +162,7 @@
{
switch (state) {
case TransactionEntry::NullState: os << "null"; break;
- case TransactionEntry::Paging: os << "paging"; break;
+ case TransactionEntry::Paging: os << "MTC paging"; break;
case TransactionEntry::MOCInitiated: os << "MOC initiated";
break;
case TransactionEntry::MOCProceeding: os << "MOC proceeding";
break;
case TransactionEntry::MTCConfirmed: os << "MTC confirmed";
break;
@@ -116,24 +177,45 @@
return os;
}
+ostream& Control::operator<<(ostream& os, const TransactionEntry& entry)
+{
+ os << "ID=" << entry.ID();
+ os << " TI=(" << entry.TIFlag() << "," << entry.TIValue() << ")";
+ os << " Q.931State=" << entry.Q931State();
+ return os;
+}
-unsigned TransactionTable::add(TransactionEntry& value)
+
+unsigned TransactionTable::newID()
{
+ mLock.lock();
+ unsigned ID = mIDCounter++;
+ mLock.unlock();
+ return ID;
+}
+
+
+void TransactionTable::add(const TransactionEntry& value)
+{
clearDeadEntries();
mLock.lock();
- unsigned key = mIDCounter++;
- value.ID(key);
- mTable[key]=value;
+ mTable[value.ID()]=value;
mLock.unlock();
- return key;
}
void TransactionTable::update(const TransactionEntry& value)
{
+ // ID==0 is a non-valid special case.
assert(value.ID());
mLock.lock();
- mTable[value.ID()]=value;
+ TransactionMap::iterator iter = mTable.find(value.ID());
+ if (iter==mTable.end()) {
+ mLock.unlock();
+ CERR("WARNING -- attempt to update non-existent transaction
entry with key " << value.ID());
+ return;
+ }
+ iter->second = value;
mLock.unlock();
}
@@ -154,6 +236,8 @@
return retVal;
}
+
+
bool TransactionTable::remove(unsigned key)
{
assert(key);
@@ -163,6 +247,8 @@
return retVal;
}
+
+
void TransactionTable::clearDeadEntries()
{
mLock.lock();
@@ -185,25 +271,26 @@
mLock.unlock();
}
-unsigned TransactionTable::findByMobileID(const L3MobileIdentity& mobileID,
TransactionEntry& target) const
+
+
+bool TransactionTable::findByMobileID(const L3MobileIdentity& mobileID,
TransactionEntry& target) const
{
// FIXME -- If we were smart, we'd organize the table for a log-time
search.
- // Also removes "dead" entries.
- unsigned retVal = 0;
+ bool foundIt = false;
mLock.lock();
// brute force search
TransactionMap::const_iterator itr = mTable.begin();
while (itr!=mTable.end()) {
const TransactionEntry& transaction = itr->second;
if (transaction.subscriber()==mobileID) {
- retVal = itr->first;
+ foundIt = true;
target = transaction;
break;
}
++itr;
}
mLock.unlock();
- return retVal;
+ return foundIt;
}
@@ -253,7 +340,7 @@
L3Message* Control::getMessage(LogicalChannel *LCH)
{
- unsigned timeout_ms = LCH->N200() * T200ms;
+ //unsigned timeout_ms = LCH->N200() * T200ms;
L3Frame *rcv = LCH->recv(LCH->N200() * T200ms);
if (rcv==NULL) {
CERR("NOTICE -- getMessage timed out");
@@ -328,7 +415,7 @@
*/
void Control::abortCall(TransactionEntry& transaction, LogicalChannel *LCH,
const L3Cause& cause)
{
- CLDCOUT("abortCall");
+ CLDCOUT("abortCall transction: " << transaction);
forceGSMClearing(transaction,LCH,cause);
forceSIPClearing(transaction);
gTransactionTable.update(transaction);
Modified: openbts/trunk/Control/ControlCommon.h
===================================================================
--- openbts/trunk/Control/ControlCommon.h 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Control/ControlCommon.h 2008-11-21 22:45:00 UTC (rev
10029)
@@ -198,6 +198,7 @@
private:
+ // FIXME -- We need to support channel type. See tracker item #316.
GSM::L3MobileIdentity mID; ///< The mobile ID.
Timeval mExpiration; ///< The expiration time for
this entry.
@@ -302,12 +303,12 @@
private:
- unsigned mID;
///< the internal transaction ID, assigned by a TransactionTable
+ unsigned mID; ///<
the internal transaction ID, assigned by a TransactionTable
GSM::L3MobileIdentity mSubscriber; ///< some kind of
subscriber ID, preferably IMSI
GSM::L3CMServiceType mService; ///< the associated
service type
- unsigned mTIFlag;
///< "0" for originating party ,"1" for terminating
- unsigned mTIValue;
///< the L3 short transaction ID set by the MS
+ unsigned mTIFlag; ///<
"0" for originating party ,"1" for terminating
+ unsigned mTIValue; ///<
the L3 short transaction ID set by the MS
GSM::L3CalledPartyBCDNumber mCalled; ///< the associated called
party number, if known
GSM::L3CallingPartyBCDNumber mCalling; ///< the associated calling
party number, if known
@@ -331,59 +332,23 @@
public:
- TransactionEntry()
- :mID(0),mQ931State(NullState),
- mT301(T301ms), mT302(T302ms), mT303(T303ms),
- mT304(T304ms), mT305(T305ms), mT308(T308ms),
- mT310(T310ms), mT313(T313ms),
- mT3113(GSM::T3113ms)
- {}
+ TransactionEntry();
/** This form is used for MTC. */
TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
const GSM::L3CMServiceType& wService,
- const GSM::L3CallingPartyBCDNumber& wCalling)
- :mID(0),mSubscriber(wSubscriber),mService(wService),
- // TIValue=7 means non-valid TI.
- mTIFlag(1), mTIValue(7),
- mCalling(wCalling),
- mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
- mQ931State(NullState),
- mT301(T301ms), mT302(T302ms), mT303(T303ms),
- mT304(T304ms), mT305(T305ms), mT308(T308ms),
- mT310(T310ms), mT313(T313ms),
- mT3113(GSM::T3113ms)
- {}
+ const GSM::L3CallingPartyBCDNumber& wCalling);
/** This form is used for MOC. */
TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
const GSM::L3CMServiceType& wService,
unsigned wTIValue,
- const GSM::L3CalledPartyBCDNumber& wCalled)
- :mID(0),mSubscriber(wSubscriber),mService(wService),
- mTIFlag(0), mTIValue(wTIValue),
- mCalled(wCalled),
- mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
- mQ931State(NullState),
- mT301(T301ms), mT302(T302ms), mT303(T303ms),
- mT304(T304ms), mT305(T305ms), mT308(T308ms),
- mT310(T310ms), mT313(T313ms),
- mT3113(GSM::T3113ms)
- {}
+ const GSM::L3CalledPartyBCDNumber& wCalled);
TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
const GSM::L3CMServiceType& wService,
unsigned wTIValue,
- const GSM::L3CallingPartyBCDNumber& wCalling)
- :mID(0),mSubscriber(wSubscriber),mService(wService),
- mTIValue(wTIValue),mCalling(wCalling),
- mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
- mQ931State(NullState),
- mT301(T301ms), mT302(T302ms), mT303(T303ms),
- mT304(T304ms), mT305(T305ms), mT308(T308ms),
- mT310(T310ms), mT313(T313ms),
- mT3113(GSM::T3113ms)
- {}
+ const GSM::L3CallingPartyBCDNumber& wCalling);
/address@hidden Accessors. */
//@{
@@ -444,6 +409,7 @@
};
+std::ostream& operator<<(std::ostream& os, const TransactionEntry&);
std::ostream& operator<<(std::ostream& os, TransactionEntry::Q931CallState);
@@ -472,12 +438,15 @@
}
/**
+ Return a new ID for use in the table.
+ */
+ unsigned newID();
+
+ /**
Insert a new entry into the table.
- Also assigns a transaction ID to the argument.
@param value The entry to copy into the table.
- @return The assigned transaction ID.
*/
- unsigned add(TransactionEntry& value);
+ void add(const TransactionEntry& value);
/**
Update a transaction in the table.
@@ -505,18 +474,21 @@
Find an entry by its mobile ID.
@param mobileID The mobile at to search for.
@param target A TransactionEntry to accept the found record.
- @return Entry transaction ID or 0 on failure.
+ @return true is the mobile ID was foind.
*/
- unsigned findByMobileID(const GSM::L3MobileIdentity& mobileID,
TransactionEntry& target) const;
+ bool findByMobileID(const GSM::L3MobileIdentity& mobileID,
TransactionEntry& target) const;
/**
Remove "dead" entries from the table.
+ A "dead" entry is a transaction that is no longer active.
*/
void clearDeadEntries();
};
+
+
/address@hidden Control-layer exceptions. */
//@{
@@ -583,11 +555,10 @@
//@}
-
-
} //Control
+
/address@hidden Globals */
//@{
/** A single global transaction table in the global namespace. */
@@ -596,6 +567,7 @@
+
#endif
// vim: ts=4 sw=4
Modified: openbts/trunk/Control/RadioResource.cpp
===================================================================
--- openbts/trunk/Control/RadioResource.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Control/RadioResource.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -82,6 +82,7 @@
// GSM 04.08 3.3.1.1.3.
// Given a request reference, try to allocate a channel
// and send the assignment to the handset on the CCCH.
+ // Papa Legba, open that door...
CLDCOUT("AccessGrantResponder RA=" << RA << " when=" << when);
@@ -98,6 +99,9 @@
CCCHLogicalChannel *AGCH = gBTS.getAGCH();
assert(AGCH);
+ // FIXME -- We are ASSUMING that SDCCH is OK.
+ // The truth is that we should decode according GSM 04.08 9.1.8, Table
9.9a.
+
// Get an SDCCH to assign to.
SDCCHLogicalChannel *SDCCH = gBTS.getSDCCH();
@@ -107,7 +111,7 @@
// Emergency calls are not subject to T3122 hold-off.
// They are not handled as a special case because the
// MS will ignore the T3122 setting.
- CERR("NOTICE -- SDCCH CONGESTION");
+ CERR("NOTICE -- Access Grant CONGESTION");
unsigned waitTime = curT3122()/1000;
CLDCOUT("AccessGrantResponder: assginment reject, wait time "
<< waitTime);
const L3ImmediateAssignmentReject
reject(L3RequestReference(RA,when),waitTime);
Modified: openbts/trunk/GSM/GSML3RRMessages.cpp
===================================================================
--- openbts/trunk/GSM/GSML3RRMessages.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/GSM/GSML3RRMessages.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -158,8 +158,10 @@
{
int sz = mMobileIDs.size();
assert(sz<=2);
+ // Remember for reverse orders of 1/2-octet fields.
+ // Because GSM transmits LSB-first within each byte.
+ dest.writeField(wp,0x0,4); // "any channel", GSM 04.08
Table 10.5.29
dest.writeField(wp,0x0,4); // "normal paging", GSM 04.08
Table 10.5.63
- dest.writeField(wp,0x0,4); // "any channel", GSM 04.08
Table 10.5.29
mMobileIDs[0].writeLV(dest,wp);
if (sz>1) mMobileIDs[1].writeTLV(0x17,dest,wp);
}
Modified: openbts/trunk/Makefile
===================================================================
--- openbts/trunk/Makefile 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/Makefile 2008-11-21 22:45:00 UTC (rev 10029)
@@ -68,6 +68,7 @@
- $(MAKE) -C $(SIP) clean
- $(MAKE) -C $(SMS) clean
- $(MAKE) -C $(APPS) clean
+ - $(MAKE) -C $(TESTS) clean
Modified: openbts/trunk/Makefile.include
===================================================================
--- openbts/trunk/Makefile.include 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/Makefile.include 2008-11-21 22:45:00 UTC (rev 10029)
@@ -37,7 +37,8 @@
TRANSCEIVER = $(ROOT)/Transceiver
SIP = $(ROOT)/SIP
SMS = $(ROOT)/SMS
-APPS = $(ROOT)/APPS
+APPS = $(ROOT)/apps
+TESTS = $(ROOT)/tests
# Paths
Modified: openbts/trunk/README
===================================================================
--- openbts/trunk/README 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/README 2008-11-21 22:45:00 UTC (rev 10029)
@@ -9,10 +9,10 @@
GSM The GSM stack.
RFHardware Design documents for RF hardware components.
SIP Components of the SIP state machines ued by the control layer.
-SMS The SMS stack.
+SMS The SMS stack (incomplete).
TRXManager The interface between the GSM stack and the radio.
-Transceiver The software transceiver.
+Transceiver The software transceiver and specific installation tests.
apss OpenBTS application binaries.
doc Project documentation.
-tests Test fixture for subsets of OpenBTS components.
+tests Test fixtures for subsets of OpenBTS components.
Modified: openbts/trunk/SIP/SIPInterface.cpp
===================================================================
--- openbts/trunk/SIP/SIPInterface.cpp 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/SIP/SIPInterface.cpp 2008-11-21 22:45:00 UTC (rev 10029)
@@ -214,8 +214,7 @@
// Check SIP map. Repeated entry? Page again.
if (mSIPMap.map().readNoBlock(call_id_string) != NULL) {
TransactionEntry transaction;
- unsigned ID =
gTransactionTable.findByMobileID(mobile_id,transaction);
- if (ID==0) {
+ if (!gTransactionTable.findByMobileID(mobile_id,transaction)) {
CERR("WARNING -- repeated INVITE with no transaction
record");
return false;
}
@@ -249,8 +248,8 @@
transaction.Q931State(TransactionEntry::Paging);
transaction.SIP().User( call_id_num, to_sip_uri);
transaction.SIP().saveINVITE(msg);
- unsigned newID = gTransactionTable.add(transaction);
- DCOUT("SIPInterface::checkInvite: making transaction and add to
transaction table ID= "<<newID)
+ gTransactionTable.add(transaction);
+ DCOUT("SIPInterface::checkInvite: making transaction and add to
transaction table ID= "<< transaction.ID());
DCOUT("SIPInterface::checkInvite: adding mobile ID "<<mobile_id)
// Add to paging list.
Modified: openbts/trunk/Transceiver/Makefile
===================================================================
--- openbts/trunk/Transceiver/Makefile 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/Transceiver/Makefile 2008-11-21 22:45:00 UTC (rev 10029)
@@ -1,5 +1,8 @@
ROOT = ..
include $(ROOT)/Makefile.include
+
+all: transceiver
+
include $(ROOT)/Makefile.targets
#=================================================================
@@ -7,7 +10,7 @@
#=================================================================
TESTS = USRPping \
- runTransceiver
+ transceiver
GSMOBJS = $(GSM)/GSMCommon.o
@@ -56,15 +59,15 @@
testRadio: testRadio.cpp $(TRANSCEIVEROBJS) $(TESTRADIOOBJS)
$(BUILD) -I .. $(BUILDOPTS) -o $@ $< $(TRANSCEIVEROBJS) $(TESTRADIOOBJS
$(USRPLIBS))
-# runTransceiver
-runTransceiver: runTransceiver.cpp $(TRANSCEIVEROBJS) $(GSMOBJS) $(COMMONOBJS)
+# transceiver
+transceiver: runTransceiver.cpp $(TRANSCEIVEROBJS) $(GSMOBJS) $(COMMONOBJS)
$(BUILD) -I .. $(BUILDOPTS) -o $@ $< $(TRANSCEIVEROBJS) $(GSMOBJS)
$(COMMONOBJS) $(USRPLIBS)
TRANSCEIVERLOGGINGOBJS = $(TRANSCEIVER)/USRPDevice.o
$(TRANSCEIVER)/sigProcLib.o $(TRANSCEIVER)/radioInterface.o TransceiverLogging.o
-runTransceiverLogging: runTransceiver.cpp $(TRANSCEIVERLOGGINGOBJS) $(GSMOBJS)
$(COMMONOBJS)
+transceiverLogging: runTransceiver.cpp $(TRANSCEIVERLOGGINGOBJS) $(GSMOBJS)
$(COMMONOBJS)
$(BUILD) -I .. $(BUILDOPTS) -o $@ $< $(TRANSCEIVERLOGGINGOBJS)
$(GSMOBJS) $(COMMONOBJS) $(USRPLIBS)
TRANSCEIVERLOGGINGOBJS = $(TRANSCEIVER)/USRPDevice.o
$(TRANSCEIVER)/sigProcLib.o $(TRANSCEIVER)/radioInterface.o
TransceiverLogging1.o
-runTransceiverLogging1: runTransceiver.cpp $(TRANSCEIVERLOGGINGOBJS)
$(GSMOBJS) $(COMMONOBJS)
+transceiverLogging1: runTransceiver.cpp $(TRANSCEIVERLOGGINGOBJS) $(GSMOBJS)
$(COMMONOBJS)
$(BUILD) -I .. $(BUILDOPTS) -o $@ $< $(TRANSCEIVERLOGGINGOBJS)
$(GSMOBJS) $(COMMONOBJS) $(USRPLIBS)
Modified: openbts/trunk/Transceiver/Transceiver.cpp
===================================================================
--- openbts/trunk/Transceiver/Transceiver.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Transceiver/Transceiver.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -26,9 +26,9 @@
*/
+#define NDEBUG
#include "Transceiver.h"
-#define NDEBUG
Transceiver::Transceiver(int wBasePort,
@@ -48,7 +48,7 @@
// generate pulse and setup up signal processing library
gsmPulse = generateGSMPulse(2,mSamplesPerSymbol);
- COUT("gsmPulse: " << *gsmPulse);
+ DCOUT("gsmPulse: " << *gsmPulse);
sigProcLibSetup(mSamplesPerSymbol);
// initialize filler tables with dummy bursts, initialize other per-timeslot
variables
@@ -107,7 +107,7 @@
*gsmPulse,
mSamplesPerSymbol,
1.0,0.0);
- COUT("LOGGED BURST: " << *burst);
+ DCOUT("LOGGED BURST: " << *burst);
/*
unsigned char burstStr[gSlotLen+1];
@@ -117,7 +117,7 @@
burstStr[i] = (unsigned char) ((*burstItr++)*255.0);
}
burstStr[gSlotLen]='\0';
- COUT("LOGGED BURST: " << burstStr);
+ DCOUT("LOGGED BURST: " << burstStr);
*/
delete burst;
}
@@ -127,8 +127,10 @@
{
// dump stale bursts, if any
while ((mTransmitPriorityQueue.size() > 0) &&
- (mTransmitPriorityQueue.nextTime() < nowTime))
+ (mTransmitPriorityQueue.nextTime() < nowTime)) {
+ CERR("WARNING -- dumping STALE burst in TRX->USRP interface");
delete mTransmitPriorityQueue.read();
+ }
int TN = nowTime.TN();
int modFN = nowTime.FN() % fillerModulus[nowTime.TN()];
@@ -142,7 +144,6 @@
mTransmitFIFO->write(next);
#ifdef TRANSMIT_LOGGING
if (nowTime.TN()==TRANSMIT_LOGGING) {
- COUT("unmodulating time: " << nowTime);
unModulateVector(fillerTable[modFN][TN]);
}
#endif
@@ -313,24 +314,24 @@
&channelResp,
&chanOffset);
if (success) {
- COUT("FOUND TSC!!!!!! " << amplitude << " " << TOA);
+ DCOUT("FOUND TSC!!!!!! " << amplitude << " " << TOA);
mEnergyThreshold -= 1.0F;
if (mEnergyThreshold < 0.0) mEnergyThreshold = 0.0;
SNRestimate[timeslot] =
amplitude.norm2()/(mEnergyThreshold*mEnergyThreshold+1.0); // this is not
highly accurate
if (estimateChannel) {
- COUT("estimating channel...");
+ DCOUT("estimating channel...");
channelResponse[timeslot] = channelResp;
chanRespOffset[timeslot] = chanOffset;
chanRespAmplitude[timeslot] = amplitude;
scaleVector(*channelResp, complex(1.0,0.0)/amplitude);
designDFE(*channelResp, SNRestimate[timeslot], 7,
&DFEForward[timeslot], &DFEFeedback[timeslot]);
channelEstimateTime[timeslot] = rxBurst->time();
- COUT("SNR: " << SNRestimate[timeslot] << ", DFE forward: " <<
*DFEForward[timeslot] << ", DFE backward: " << *DFEFeedback[timeslot]);
+ DCOUT("SNR: " << SNRestimate[timeslot] << ", DFE forward: " <<
*DFEForward[timeslot] << ", DFE backward: " << *DFEFeedback[timeslot]);
}
}
else {
double framesElapsed = rxBurst->time()-prevFalseDetectionTime;
- COUT("wTime: " << rxBurst->time() << ", pTime: " <<
prevFalseDetectionTime << ", fElapsed: " << framesElapsed);
+ DCOUT("wTime: " << rxBurst->time() << ", pTime: " <<
prevFalseDetectionTime << ", fElapsed: " << framesElapsed);
mEnergyThreshold += 10.0F*exp(-framesElapsed);
prevFalseDetectionTime = rxBurst->time();
channelResponse[timeslot] = NULL;
@@ -344,7 +345,7 @@
&litude,
&TOA);
if (success) {
- COUT("FOUND RACH!!!!!! " << amplitude << " " << TOA);
+ DCOUT("FOUND RACH!!!!!! " << amplitude << " " << TOA);
mEnergyThreshold -= 1.0F;
if (mEnergyThreshold < 0.0) mEnergyThreshold = 0.0;
channelResponse[timeslot] = NULL;
@@ -355,7 +356,7 @@
prevFalseDetectionTime = rxBurst->time();
}
}
- COUT("energy Threshold = " << mEnergyThreshold);
+ DCOUT("energy Threshold = " << mEnergyThreshold);
// demodulate burst
SoftVector *burst = NULL;
@@ -377,11 +378,11 @@
wTime = rxBurst->time();
// FIXME: what is full scale for the USRP? we get more that 12 bits of
resolution...
RSSI = (int) floor(20.0*log10(9450.0/amplitude.abs()));
- COUT("RSSI: " << RSSI );
+ DCOUT("RSSI: " << RSSI );
timingOffset = (int) round(TOA*256.0/mSamplesPerSymbol);
}
- //if (burst) COUT("burst: " << *burst << '\n');
+ //if (burst) DCOUT("burst: " << *burst << '\n');
delete rxBurst;
@@ -558,7 +559,7 @@
mLock.unlock();
}
-void Transceiver::driveTransmitPriorityQueue()
+bool Transceiver::driveTransmitPriorityQueue()
{
char buffer[gSlotLen+50];
@@ -567,7 +568,8 @@
size_t msgLen = mDataSocket.read(buffer);
if (msgLen!=gSlotLen+1+4+1) {
- return;
+ CERR("WARNING -- badly formatted packet on GSM->TRX interface");
+ return false;
}
int timeSlot = (int) buffer[0];
@@ -584,9 +586,8 @@
if (GSM::Time(frameNum,timeSlot) < mTransmitDeadlineClock) {
// stale burst from GSM core
- DCOUT("STALE! "<< GSM::Time(frameNum,timeSlot));
- writeClockInterface();
- return;
+ CERR("WARNING -- STALE packet on GSM->TRX interface at time "<<
GSM::Time(frameNum,timeSlot));
+ return false;
}
//DCOUT("rcvd. burst at: " << GSM::Time(frameNum,timeSlot));
@@ -604,7 +605,9 @@
DCOUT("added burst - time: " << currTime << ", RSSI: " << RSSI); // << ",
data: " << newBurst);
+ return true;
+
}
void Transceiver::driveReceiveFIFO()
@@ -671,7 +674,7 @@
// only do latency update every 10 frames, so we don't over update
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(10,0)) {
mTransmitLatency = mTransmitLatency + GSM::Time(1,0);
- COUT("new latency: " << mTransmitLatency);
+ DCOUT("new latency: " << mTransmitLatency);
mLatencyUpdateTime = radioClock->get();
}
}
@@ -681,7 +684,7 @@
if (mTransmitLatency > GSM::Time(1,1)) {
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(216,0)) {
mTransmitLatency.decTN();
- COUT("reduced latency: " << mTransmitLatency);
+ DCOUT("reduced latency: " << mTransmitLatency);
mLatencyUpdateTime = radioClock->get();
}
}
@@ -699,7 +702,9 @@
void Transceiver::writeClockInterface()
{
char command[50];
- sprintf(command,"IND CLOCK %llu",(unsigned long long)
(mTransmitDeadlineClock.FN()+10));
+ // FIME -- See tracker #315.
+ //sprintf(command,"IND CLOCK %llu",(unsigned long long)
(mTransmitDeadlineClock.FN()+10));
+ sprintf(command,"IND CLOCK %llu",(unsigned long long)
(mTransmitDeadlineClock.FN()+20));
DCOUT("ClockInterface: sending " << command);
@@ -740,7 +745,15 @@
void *TransmitPriorityQueueServiceLoopAdapter(Transceiver *transceiver)
{
while (1) {
- transceiver->driveTransmitPriorityQueue();
+ bool stale = false;
+ // Flush the UDP packets until a successful transfer.
+ while (!transceiver->driveTransmitPriorityQueue()) {
+ stale = true;
+ }
+ if (stale) {
+ // If a packet was stale, remind the GSM stack of the clock.
+ transceiver->writeClockInterface();
+ }
pthread_testcancel();
}
return NULL;
Modified: openbts/trunk/Transceiver/Transceiver.h
===================================================================
--- openbts/trunk/Transceiver/Transceiver.h 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Transceiver/Transceiver.h 2008-11-21 22:45:00 UTC (rev
10029)
@@ -177,8 +177,11 @@
/** drive handling of control messages from GSM core */
void driveControl();
- /** drive modulation and sorting of GSM bursts from GSM core */
- void driveTransmitPriorityQueue();
+ /**
+ drive modulation and sorting of GSM bursts from GSM core
+ @return true if a burst was transferred successfully
+ */
+ bool driveTransmitPriorityQueue();
friend void *TransmitFIFOServiceLoopAdapter(Transceiver *);
Modified: openbts/trunk/Transceiver/USRPDevice.cpp
===================================================================
--- openbts/trunk/Transceiver/USRPDevice.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Transceiver/USRPDevice.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -27,12 +27,13 @@
*/
+#define NDEBUG
#include <string.h>
#include <stdlib.h>
#include "Threads.h"
#include "USRPDevice.h"
-#define DEBUG 0
+
using namespace std;
string write_it(unsigned v) {
@@ -235,7 +236,7 @@
m_uRx->write_aux_dac(1,0,(int) ceil(0.2*4096.0/3.3)); // set to maximum
gain
}
- currData = (short *) malloc(200000*sizeof(short));
+ currData = new short[currDataSize];
currTimestamp = 0;
currLen = 0;
timestampOffset = 0;
@@ -263,7 +264,7 @@
m_uTx->write_io(0,(~POWER_UP|RX_TXN),(POWER_UP|RX_TXN|ENABLE));
m_uRx->write_io(1,~POWER_UP,(POWER_UP|ENABLE));
- delete currData;
+ delete[] currData;
started = !(m_uRx->stop() && m_uTx->stop());
return !started;
@@ -321,7 +322,7 @@
if ((word2 >> 16) == ((0x01 << 8) | 0x02)) {
timestamp -= timestampOffset;
timestampOffset = pktTimestamp - pingTimestamp + PINGOFFSET;
- COUT("updating timestamp offset to: " << timestampOffset);
+ DCOUT("updating timestamp offset to: " << timestampOffset);
timestamp += timestampOffset;
}
continue;
@@ -332,7 +333,7 @@
}
if ((word0 >> 28) & 0x04) {
if (underrun) *underrun = true;
- CERR("UNDERRUN!");
+ CERR("WARNING -- UNDERRUN in TRX->USRP interface");
}
if (RSSI) *RSSI = (word0 >> 21) & 0x3f;
if (!currLen && (pktTimestamp + payloadSz/2/sizeof(short) > timestamp +
10000))
@@ -346,10 +347,11 @@
}
if (!currLen) currTimestamp = pktTimestamp;
if (currTimestamp+currLen < pktTimestamp) {
- COUT("Missing packet, compensating...")
+ DCOUT("Missing packet, compensating...")
currLen = pktTimestamp - currTimestamp;
}
- memcpy(currData+currLen*2,tmpBuf+2,payloadSz);
+ // currLen counts complex short samples. currData is *short, tmpBuf is
*unint_32.
+ if ((currLen*2+payloadSz)<=currDataSize)
memcpy(currData+currLen*2,tmpBuf+2,payloadSz);
currLen += (payloadSz/2/sizeof(short));
}
if (currTimestamp + currLen > timestamp + len) break;
@@ -367,7 +369,8 @@
// remove copied data from out local buffer
currTimestamp = timestamp + len;
- memcpy(currData,newDataPtr,sizeof(short)*(currLen*2 -
(newDataPtr-currData)));
+ unsigned copySize = sizeof(short)*(currLen*2 - (newDataPtr-currData));
+ if (copySize<currDataSize) memcpy(currData,newDataPtr,copySize);
currLen -= (newDataPtr-currData)/2;
return len;
Modified: openbts/trunk/Transceiver/USRPDevice.h
===================================================================
--- openbts/trunk/Transceiver/USRPDevice.h 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Transceiver/USRPDevice.h 2008-11-21 22:45:00 UTC (rev
10029)
@@ -51,6 +51,7 @@
bool started; ///< flag indicates USRP has started
bool skipRx; ///< set if USRP is transmit-only.
+ static const unsigned currDataSize = 200000;
short *currData; ///< internal data buffer when reading from USRP
TIMESTAMP currTimestamp; ///< timestamp of internal data buffer
unsigned currLen; ///< size of internal data buffer
Modified: openbts/trunk/Transceiver/radioInterface.cpp
===================================================================
--- openbts/trunk/Transceiver/radioInterface.cpp 2008-11-21 22:32:03 UTC
(rev 10028)
+++ openbts/trunk/Transceiver/radioInterface.cpp 2008-11-21 22:45:00 UTC
(rev 10029)
@@ -21,8 +21,8 @@
#include "radioInterface.h"
+#define NDEBUG
-#define DEBUG 0
GSM::Time VectorQueue::nextTime() const
{
Modified: openbts/trunk/Transceiver/sigProcLib.cpp
===================================================================
--- openbts/trunk/Transceiver/sigProcLib.cpp 2008-11-21 22:32:03 UTC (rev
10028)
+++ openbts/trunk/Transceiver/sigProcLib.cpp 2008-11-21 22:45:00 UTC (rev
10029)
@@ -896,14 +896,14 @@
float RMS = sqrtf(valleyPower/(float) numSamples)+0.00001;
float peakToMean = peakAmpl.abs()/RMS;
- COUT("RACH peakAmpl=" << peakAmpl << " RMS=" << RMS << " peakToMean=" <<
peakToMean);
+ DCOUT("RACH peakAmpl=" << peakAmpl << " RMS=" << RMS << " peakToMean=" <<
peakToMean);
*amplitude = peakAmpl/(gRACHSequence->gain);
*TOA = (*TOA) - gRACHSequence->TOA - 8*samplesPerSymbol;
delete correlatedRACH;
- COUT("RACH thresh: " << peakToMean);
+ DCOUT("RACH thresh: " << peakToMean);
return (peakToMean > detectThreshold);
}
@@ -994,7 +994,7 @@
*TOA = (*TOA)-gMidambles[TSC]->TOA;
(*TOA) = (*TOA) - (66-56)*samplesPerSymbol;
- COUT("TCH peakAmpl=" << amplitude->abs() << " RMS=" << RMS << " peakToMean="
<< peakToMean << " TOA=" << *TOA);
+ DCOUT("TCH peakAmpl=" << amplitude->abs() << " RMS=" << RMS << "
peakToMean=" << peakToMean << " TOA=" << *TOA);
DCOUT("autocorr: " << *correlatedBurst);
@@ -1019,7 +1019,7 @@
*channelResponse = new signalVector(channelVector.size());
correlatedBurst->segmentCopyTo(**channelResponse,(int)
floor(TOAoffset+(maxI-5)*samplesPerSymbol),(*channelResponse)->size());
scaleVector(**channelResponse,complex(1.0,0.0)/gMidambles[TSC]->gain);
- COUT("channelResponse: " << **channelResponse);
+ DCOUT("channelResponse: " << **channelResponse);
if (channelResponseOffset)
*channelResponseOffset = 5*samplesPerSymbol-maxI;
Modified: openbts/trunk/apps/Makefile
===================================================================
--- openbts/trunk/apps/Makefile 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/apps/Makefile 2008-11-21 22:45:00 UTC (rev 10029)
@@ -2,7 +2,7 @@
include $(ROOT)/Makefile.include
-APPS = OpenBTS900 transceiver
+APPS = OpenBTS900 OpenBTS850 transceiver
.PHONY: apps
apps:
$(MAKE) $(APPS)
@@ -15,10 +15,13 @@
$(GSMOBJS) $(CONTROLOBJS) $(SIPOBJS)
OpenBTS900: OpenBTS900.cpp $(COMMONINCS) $(OPENBTSOBJS)
$(BUILD) -o $@ $< $(OPENBTSOBJS) $(STDLIBS) $(SIPLIBS)
+OpenBTS850: OpenBTS850.cpp $(COMMONINCS) $(OPENBTSOBJS)
+ $(BUILD) -o $@ $< $(OPENBTSOBJS) $(STDLIBS) $(SIPLIBS)
transceiver:
- $(MAKE) -C $(ROOT)/Transceiver runTransceiver
- - ln -s $(ROOT)/Transceiver/runTransceiver ./transceiver
+ $(MAKE) -C $(ROOT)/Transceiver transceiver
+ $(RM) ./transceiver
+ - ln -s $(ROOT)/Transceiver/transceiver ./transceiver
.PHONY: clean
Copied: openbts/trunk/apps/OpenBTS850.cpp (from rev 10026,
openbts/branches/developers/dburgess00/trunk/apps/OpenBTS850.cpp)
===================================================================
--- openbts/trunk/apps/OpenBTS850.cpp (rev 0)
+++ openbts/trunk/apps/OpenBTS850.cpp 2008-11-21 22:45:00 UTC (rev 10029)
@@ -0,0 +1,153 @@
+/*
+* Copyright 2008 Free Software Foundation, Inc.
+*
+* This software is distributed under the terms of the GNU Public License.
+* See the COPYING file in the main directory for details.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+
+#include "TRXManager.h"
+#include "GSML1FEC.h"
+#include "GSMConfig.h"
+#include "GSMSAPMux.h"
+#include "GSML3RRMessages.h"
+#include "GSMLogicalChannel.h"
+
+#include "SIPInterface.h"
+
+using namespace GSM;
+
+
+// Example BTS configuration:
+// 0 -- network color code
+// 0 -- basestation color code
+// GSM850 -- the operating band
+// LAI: 901 -- mobile country code
+// LAI: 55 -- mobile network code
+// LAI: 667 -- location area code ("the neighbors of the beast")
+// OpenBTS -- network "short name", displayed on nicer/newer phones
+GSMConfig
gBTS(0,0,GSM850,L3LocationAreaIdentity("901","55",667),L3CellIdentity(0x0),"OpenBTS");
+// ARFCN is set with the ARFCNManager::tune method after the BTS is running.
+const unsigned ARFCN=200;
+
+TransceiverManager gTRX(1, "127.0.0.1", 5700);
+
+// Set interface with local ip and port=SIP_UDP_PORT. Asterisk port=5060
+SIP::SIPInterface gSIPInterface(SIP_UDP_PORT, "127.0.0.1", 5060);
+
+
+
+
+
+int main(int argc, char *argv[])
+{
+ gSIPInterface.start();
+ gTRX.start();
+
+ // Set up the interface to the radio.
+ ARFCNManager* radio = gTRX.ARFCN(0);
+ // Get a handle to the C0 transceiver interface.
+ radio->tune(ARFCN);
+ // C-V on C0T0
+ radio->setSlot(0,5);
+ // C-I on C0T1-C0T7
+ for (unsigned i=1; i<8; i++) radio->setSlot(i,1);
+ radio->setTSC(gBTS.BCC());
+ radio->setPower(0);
+
+ // set up a combination V beacon set
+
+ // SCH
+ SCHL1FEC SCH;
+ SCH.downstream(radio);
+ SCH.open();
+ // FCCH
+ FCCHL1FEC FCCH;
+ FCCH.downstream(radio);
+ FCCH.open();
+ // BCCH
+ BCCHL1FEC BCCH;
+ BCCH.downstream(radio);
+ BCCH.open();
+ // RACH
+ RACHL1FEC RACH(gRACHC5Mapping);
+ RACH.downstream(radio);
+ RACH.open();
+ // CCCHs
+ CCCHLogicalChannel CCCH0(gCCCH_0Mapping);
+ CCCH0.downstream(radio);
+ CCCH0.open();
+ CCCHLogicalChannel CCCH1(gCCCH_1Mapping);
+ CCCH1.downstream(radio);
+ CCCH1.open();
+ CCCHLogicalChannel CCCH2(gCCCH_2Mapping);
+ CCCH2.downstream(radio);
+ CCCH2.open();
+ // use CCCHs as AGCHs
+ gBTS.addAGCH(&CCCH0);
+ gBTS.addAGCH(&CCCH1);
+ gBTS.addAGCH(&CCCH2);
+
+
+ // SDCCHs
+ SDCCHLogicalChannel SDCCH[4] = {
+ SDCCHLogicalChannel(0,gSDCCH_4_0),
+ SDCCHLogicalChannel(0,gSDCCH_4_1),
+ SDCCHLogicalChannel(0,gSDCCH_4_2),
+ SDCCHLogicalChannel(0,gSDCCH_4_3)
+ };
+ Thread SDCCHControlThread[4];
+ for (int i=0; i<4; i++) {
+ SDCCH[i].downstream(radio);
+ SDCCH[i].open();
+ gBTS.addSDCCH(&SDCCH[i]);
+
SDCCHControlThread[i].start((void*(*)(void*))Control::SDCCHDispatcher,&SDCCH[i]);
+ }
+
+ // TCHs
+ TCHFACCHLogicalChannel TCH[7] = {
+ TCHFACCHLogicalChannel(1,gTCHF_T1),
+ TCHFACCHLogicalChannel(2,gTCHF_T2),
+ TCHFACCHLogicalChannel(3,gTCHF_T3),
+ TCHFACCHLogicalChannel(4,gTCHF_T4),
+ TCHFACCHLogicalChannel(5,gTCHF_T5),
+ TCHFACCHLogicalChannel(6,gTCHF_T6),
+ TCHFACCHLogicalChannel(7,gTCHF_T7)
+ };
+ Thread TCHControlThread[7];
+ for (int i=0; i<7; i++) {
+ TCH[i].downstream(radio);
+ TCH[i].open();
+ gBTS.addTCH(&TCH[i]);
+
TCHControlThread[i].start((void*(*)(void*))Control::FACCHDispatcher,&TCH[i]);
+ }
+
+ // Set up the pager.
+ // Set up paging channels.
+ gBTS.addPCH(&CCCH0);
+ gBTS.addPCH(&CCCH1);
+ gBTS.addPCH(&CCCH2);
+ // Start the paging generator
+ // Don't start the pager until some PCHs exist!!
+ gBTS.pager().start();
+
+ // Just sleep now.
+ while (1) {
+ sleep(1);
+ }
+}
Modified: openbts/trunk/apps/OpenBTS900.cpp
===================================================================
--- openbts/trunk/apps/OpenBTS900.cpp 2008-11-21 22:32:03 UTC (rev 10028)
+++ openbts/trunk/apps/OpenBTS900.cpp 2008-11-21 22:45:00 UTC (rev 10029)
@@ -40,9 +40,8 @@
// LAI: 901 -- mobile country code
// LAI: 55 -- mobile network code
// LAI: 667 -- location area code ("the neighbors of the beast")
-// WASTE -- network "short name", displayed on nicer/newer phones
-// ("We Await Silent Trystro's Empire.")
-GSMConfig
gBTS(0,0,EGSM900,L3LocationAreaIdentity("901","55",667),L3CellIdentity(0x0),"WASTE");
+// OpenBTS -- network "short name", displayed on nicer/newer phones
+GSMConfig
gBTS(0,0,EGSM900,L3LocationAreaIdentity("901","55",667),L3CellIdentity(0x0),"OpenBTS");
// ARFCN is set with the ARFCNManager::tune method after the BTS is running.
const unsigned ARFCN=29;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10029 - in openbts/trunk: . CommonLibs Control GSM SIP Transceiver apps,
dburgess00 <=