diff options
Diffstat (limited to 'Transceiver52M/Transceiver.h')
-rw-r--r-- | Transceiver52M/Transceiver.h | 84 |
1 files changed, 49 insertions, 35 deletions
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index ed063dd..babe420 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -33,11 +33,14 @@ extern "C" { #include <osmocom/core/signal.h> +#include <osmocom/core/select.h> #include "config_defs.h" } class Transceiver; +extern Transceiver *transceiver; + /** Channel descriptor for transceiver object and channel number pair */ struct TrxChanThParams { Transceiver *trx; @@ -60,6 +63,7 @@ struct TransceiverState { /* The filler table */ signalVector *fillerTable[102][8]; int fillerModulus[8]; + FillerType mFiller; bool mRetrans; /* Most recent channel estimate of all timeslots */ @@ -76,37 +80,39 @@ struct TransceiverState { /* Received noise energy levels */ float mNoiseLev; - noiseVector mNoises; + avgVector mNoises; /* Shadowed downlink attenuation */ int mPower; + + /* RF emission and reception disabled, as per NM Administrative State Locked */ + bool mMuted; + + /* counters */ + struct trx_counters ctrs; + + /* Used to keep track of lost and out of order frames */ + bool first_dl_fn_rcv[8]; + GSM::Time last_dl_time_rcv[8]; }; /** The Transceiver class, responsible for physical layer of basestation */ class Transceiver { public: /** Transceiver constructor - @param wBasePort base port number of UDP sockets - @param TRXAddress IP address of the TRX, as a string - @param GSMcoreAddress IP address of the GSM core, as a string - @param wSPS number of samples per GSM symbol + @param cfg VTY populated config @param wTransmitLatency initial setting of transmit latency @param radioInterface associated radioInterface object */ - Transceiver(int wBasePort, - const char *TRXAddress, - const char *GSMcoreAddress, - size_t tx_sps, size_t rx_sps, size_t chans, + Transceiver(const struct trx_cfg *cfg, GSM::Time wTransmitLatency, - RadioInterface *wRadioInterface, - double wRssiOffset, int stackSize); + RadioInterface *wRadioInterface); /** Destructor */ ~Transceiver(); /** Start the control loop */ - bool init(FillerType filler, size_t rtsc, unsigned rach_delay, - bool edge, bool ext_rach); + bool init(void); /** attach the radioInterface receive FIFO */ bool receiveFIFO(VectorFIFO *wFIFO, size_t chan) @@ -119,7 +125,7 @@ public: } /** accessor for number of channels */ - size_t numChans() const { return mChans; }; + size_t numChans() const { return cfg->num_chans; }; /** Codes for channel combinations */ typedef enum { @@ -142,12 +148,30 @@ public: } ChannelCombination; private: - int mBasePort; - std::string mLocalAddr; - std::string mRemoteAddr; + size_t mChans; +struct ctrl_msg { + char data[101]; + ctrl_msg() {}; +}; + +struct ctrl_sock_state { + osmo_fd conn_bfd; + std::deque<ctrl_msg> txmsgqueue; + ctrl_sock_state() { + conn_bfd.fd = -1; + } + ~ctrl_sock_state() { + if(conn_bfd.fd >= 0) { + osmo_fd_unregister(&conn_bfd); + close(conn_bfd.fd); + conn_bfd.fd = -1; + } + } +}; + const struct trx_cfg *cfg; ///< VTY populated config std::vector<int> mDataSockets; ///< socket for writing to/reading from GSM core - std::vector<int> mCtrlSockets; ///< socket for writing/reading control commands from GSM core + std::vector<ctrl_sock_state> mCtrlSockets; ///< socket for writing/reading control commands from GSM core int mClockSocket; ///< socket for writing clock updates to GSM core std::vector<VectorQueue> mTxPriorityQueues; ///< priority queue of transmit bursts received from GSM core @@ -156,7 +180,6 @@ private: std::vector<Thread *> mRxServiceLoopThreads; ///< thread to pull bursts into receive FIFO Thread *mRxLowerLoopThread; ///< thread to pull bursts into receive FIFO Thread *mTxLowerLoopThread; ///< thread to push bursts into transmit FIFO - std::vector<Thread *> mControlServiceLoopThreads; ///< thread to process control messages from GSM core std::vector<Thread *> mTxPriorityQueueServiceLoopThreads; ///< thread to process transmit bursts from GSM core GSM::Time mTransmitLatency; ///< latency between basestation clock and transmit deadline clock @@ -168,9 +191,6 @@ private: double txFullScale; ///< full scale input to radio double rxFullScale; ///< full scale output to radio - double rssiOffset; ///< RSSI to dBm conversion offset - int stackSize; ///< stack size for threads, 0 = OS default - /** modulate and add a burst to the transmit queue */ void addRadioVector(size_t chan, BitVector &bits, int RSSI, GSM::Time &wTime); @@ -193,12 +213,13 @@ private: /** send messages over the clock socket */ bool writeClockInterface(void); - int mSPSTx; ///< number of samples per Tx symbol - int mSPSRx; ///< number of samples per Rx symbol - size_t mChans; + static int ctrl_sock_cb(struct osmo_fd *bfd, unsigned int flags); + int ctrl_sock_write(int chan); + void ctrl_sock_send(ctrl_msg& m, int chan); + /** drive handling of control messages from GSM core */ + int ctrl_sock_handle_rx(int chan); + - bool mExtRACH; - bool mEdge; bool mOn; ///< flag to indicate that transceiver is powered on bool mForceClockInterface; ///< flag to indicate whether IND CLOCK shall be sent unconditionally after transceiver is started bool mHandover[8][8]; ///< expect handover to the timeslot/subslot @@ -229,9 +250,6 @@ protected: /** drive transmission of GSM bursts */ void driveTxFIFO(); - /** drive handling of control messages from GSM core */ - bool driveControl(size_t chan); - /** drive modulation and sorting of GSM bursts from GSM core @return true if a burst was transferred successfully @@ -242,9 +260,8 @@ protected: friend void *TxUpperLoopAdapter(TrxChanThParams *params); friend void *RxLowerLoopAdapter(Transceiver *transceiver); friend void *TxLowerLoopAdapter(Transceiver *transceiver); - friend void *ControlServiceLoopAdapter(TrxChanThParams *params); - + double rssiOffset(size_t chan); void reset(); void logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi); @@ -256,8 +273,5 @@ void *RxUpperLoopAdapter(TrxChanThParams *params); void *RxLowerLoopAdapter(Transceiver *transceiver); void *TxLowerLoopAdapter(Transceiver *transceiver); -/** control message handler thread loop */ -void *ControlServiceLoopAdapter(TrxChanThParams *params); - /** transmit queueing thread loop */ void *TxUpperLoopAdapter(TrxChanThParams *params); |