aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/Transceiver.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-07-19Transceiver: Move out TRXD socket send code to prepare for TRXDv1Pau Espin Pedrol1-29/+13
Only old v0 is supported so far. TRXD protocol related data/logic is moved to its own file out of Transceiver class. Code is refactored so it can be re-used later by TRXDv1. Related: OS#4006 Change-Id: I5786dd44b076202c6f1a6e82405670e8605797ed
2019-07-19sigProcLib: detectAnyBurst() family: Use struct to gather all out paramsPau Espin Pedrol1-5/+5
Currently we have 2 out parameters, but in forthcoming commits will add a third one. All those functions already have too many parameters, so let's put together all the output params in a struct to pass them easily and make it easier to understand they are the estimated output values. Related: OS#4006 Change-Id: I05cfa0ceaa2e633a5e6e404e2eae497ff4442dea
2019-07-03Transceiver: Support pulling idle frames in pullRadioVector()Pau Espin Pedrol1-11/+19
This logic will be used once we support TRXDv1, where idle indications are sent through the socket. Related: OS#4006 Change-Id: I46404f6e4055b6d3af3afffb0dfe4a19502917aa
2019-07-03Transceiver: pullRadioVector(): Move initialization of var to start of functionPau Espin Pedrol1-2/+3
This will be needed upon forthcoming refactor to support idle frames, which will add a goto return. Otherwise compiler complains: error: jump to label ret_idle [-fpermissive] note: crosses initialization of unsigned int max_toa Change-Id: Icd2793adc7b73a795184639b95fb5da336909b59
2019-07-03Transceiver: Simplify code on early error return when calling detectAnyBurstPau Espin Pedrol1-8/+4
We get rid of one branch and simplify code logic. Change-Id: I026e35262bfe42c3d23ebdc06d84e4908a8380e2
2019-07-03Transceiver: Avoid noise calculation formula in 2 branches in pullRadioVectorPau Espin Pedrol1-6/+5
Makes code easier to follow and will help in forthcoming refactoring once idle frames are supported. Change-Id: I56c84e9684ca460efd6c983d7e95d8e455bcac69
2019-07-02Transceiver: replace UDPSocket with libosmocore socket APIPau Espin Pedrol1-14/+50
We have a good socket API in libosmocore, let's drop osmo-trx socket API and use libosmocore's one instead of maintaining the two of them. Change-Id: Ib19856a3e0a7607f63436c4a80b1381a3f318764
2019-07-02Transceiver: Get rid of SoftVector in struct trx_ul_burst_indPau Espin Pedrol1-7/+15
Make the interface using trx_ul_burst_ind more implementation agnostic as well as easier to use. For instance, we don't care about SoftVector size one returned from pullRadioVector(); we want to use nbits instead. As a result, we no longer spend time normalizing guard periods. While at it, change vectorSLicer to return void since it always returns true. Change-Id: I726e5a98a43367a22c9a4ca5cbd9eb87e6765c7a
2019-07-02Transceiver: Drop use of GSM::Time from trx_ul_burst_indPau Espin Pedrol1-6/+9
Use of that class is really not needed since we don't need to do any calculation with those values, so we can simply store the final values in the struct. Related: OS#4006 Change-Id: Iadf2683d7f52138a2248598641f3b702252f325d
2019-07-02Transceiver: Move soft bits normalization to pullRadioVector()Pau Espin Pedrol1-3/+3
That's where all the filling logic happens, while in driveReceiveFIFO we mostly want to take the burst, generate a message and sent it over the socket. Related: OS#4006 Change-Id: Ibfb48877af4ff5ef0f56390901669c8353beaf48
2019-07-02Transceiver: Move calculation of normalized values (rssiOffset) to ↵Pau Espin Pedrol1-12/+10
pullRadioVector() That's where all the filling logic happens, while in driveReceiveFIFO we mostly want to take the burst, generate a message and sent it over the socket. In pullRadioVector this way we always provide normalized values based on user configuration (VTY rssi-offset). Related: OS#4006 Change-Id: I1ee28daf21dc287bec564d45d58086d63655c0f6
2019-07-02Transceiver: Move nbits burst size calculation to pullRadioVector()Pau Espin Pedrol1-11/+10
That's where all the filling logic happens, while in driveReceiveFIFO we mostly want to take the burst, generate a message and sent it over the socket. Related: OS#4006 Change-Id: Ib1df10c40d737954904290f57d58b1c77d65f82e
2019-07-02Transceiver: Drop unused rssi_valid struct fieldPau Espin Pedrol1-4/+0
That field is actually never used. Furthermore, if pullRadioVector() returns false, then the caller should consider the 'trx_ul_burst_ind' structure as uninitialized. Moreover, RSSI is mandatory - we cannot send burst indications without it. Related: OS#4006 Change-Id: Ia109298aebe8ba4750a39338ba7962555903cd82
2019-07-01Transceiver: refactor: gather uplink burst parameters in structPau Espin Pedrol1-48/+37
A new struct trx_ul_burst_ind is introduced, which will handle information filled by lower layers upon decoding of uplink bursts. Methods pullRadioVector() and logRxBurst() are adapted to use that struct. This way it's easier to understand in/out parameters and it's also easier to add further parameters to be filled in in the future. Related: OS#4006 Change-Id: I7e590fb1c0901de627e782f183251c20f4f68d48
2019-07-01Introduce structs to encode TRXD packetsPau Espin Pedrol1-10/+15
This will ease adding new protocol versions in the future. Related: OS#4006 Change-Id: I67ffede171eddde436f9057191ed76015a8ea6eb
2019-06-17Add option to set stack size in config file, default == 0 == OS defaultEric Wild1-7/+7
Change-Id: Id752f6b5ce9a96a67cd1ff835687ce0e03d3a50d
2019-06-05Rename and move STOP signal from Transceiver to mainPau Espin Pedrol1-13/+2
The callback actually belongs there, since it's the code/thread in main the one actually in charge of stopping everything. It simplifies current code, and more important, allows for new clients of this signal to use it. This callback will also be used in forthcoming commits by code controlling rate_ctr thresholds to stop the process if the VTY configured threshold is used. Change-Id: Id4159e64225c6606fef34a74b24f37c3a071aceb
2019-05-06Introduce LOGCHAN macro to standarize logging channel infoPau Espin Pedrol1-3/+3
Change-Id: I67d869499aa16af58c863ca7b74c356bcd979936
2019-01-24VTY: add extended (11-bit) RACH detection toggleVadim Yanitskiy1-8/+12
Since I838c21db29c54f1924dd478c2b34b46b70aab2cd we have both TS1 and TS2 synch. sequences, in addition to "default" TS0. Let's finally introduce the VTY configuration parameter, that can be used to toggle optional detection of both TS1 and TS2. Note: we keep this optional because of potentially bad impact on performance. There's no point in paying the performance penalty unless upper levels (BTS, PCU) actually make use of it. Change-Id: I1aee998d83b06692d76a83f79748f9129a2547e8 Related: OS#3054
2019-01-11cosmetic: Don't call the SDR "USRP" in error messageHarald Welte1-1/+1
Transceiver.cpp is used for all SDR hardware we support, not just USRP. Change-Id: I9b7ddb0d679f111407704048ef3ddd964db49441
2018-12-07transceiver: Log TRXCTRL iface responses towards osmo-bts-trxPau Espin Pedrol1-1/+2
Change-Id: I8128c42e63ab1fcd2a58812f3b7cf94435b5bbd8
2018-12-07Add TRXCTRL log categoryPau Espin Pedrol1-7/+7
This log category is applied to messages related to TRX CTRL socket interface, and it's printed in yellow, same color used in osmo-bts-trx for TRX category (so same messages are printed with same color in both sides). Change-Id: I98ec5e416272783ad3fbadf70478a4e48ae64983
2018-12-05transceiver: log chan on CTRL command receivedPau Espin Pedrol1-1/+1
Change-Id: Ia3b2a35e03a8aaddd6efebc8db2ccca872f51f20
2018-10-02Transciever: Log values causing Tx underrunPau Espin Pedrol1-1/+2
Change-Id: I68e18075eade55034567d96fc774d00a794afeeb
2018-09-28Use pthread_setname_np to name threadsPau Espin Pedrol1-0/+16
osmo-trx can start a considerable amount of threads that can make debugging it challenging at least. By using phtread_setname_np, the system sets a meaningful name to the thread which can be seen while debugging with gdb or by printing /proc/$pid/task/$tid/comm. Now we also log system TID when setting the name so we can identify different tasks in /proc even if pthread_setname_np fails. Change-Id: I84711739c3e224cb383fd12b6db933785b28209e
2018-09-04osmo-trx: Add osmo_signal to stop whole transceiver chain correctly on errorPau Espin Pedrol1-2/+21
Transceiver::stop() can only be called from either CTRL iface thread or from main thread (running osmocom loop). That's because stop attempts to cancel and then join all the other threads, which would then lock if attempting to stop from some of them. As a result, the best option is to indicate to the user of the transceiver option (osmo-trx.cpp) to stop it in a correct fashion by destroying the object from the main thread. Change-Id: Iac1d2dbe2328e735db2d4b933cb67b1af1babca1
2018-04-25Transceiver: log timing info of stale burstsPau Espin Pedrol1-1/+2
Change-Id: I043fd8199253bdf3912c7aec2ccf98f8cbe54251
2018-04-24Transceiver: Move device specific code to radioDevice classPau Espin Pedrol1-7/+1
Change-Id: Ibcf258d8bf8595e286682e0bc59391b239ea7642
2018-03-14Transceiver.cpp: prevent out-of-range array accessVadim Yanitskiy1-8/+16
There was no a simple range check for both (NO)HANDOVER commands, so an out-of-range access was possible. For example, a command: CMD HANDOVER 0 -3 might enable EDGE at run-time, because: a[i] == *(a + i) Let's fix this. Change-Id: I24a5f70e8e8097f218d7cbdef8cb10df2c35416f
2018-03-14Transceiver.cpp: fix incorrect format string for SETTSCVadim Yanitskiy1-1/+1
Change-Id: If69a478121a31aa7df945548cc17271c476d6a6b
2018-03-14Transceiver.cpp: use pointer arithmetics for CMD parsingVadim Yanitskiy1-51/+64
It looks like the author of control command parsing code was not familar with simple pointer arithmetics, so excessive amount of memory and useless memcopying was used to parse a single command. Let's introduce two pointers, one of which will point to the beginning of a command, another to the beginning of its arguments. Also, let's simplify the command matching by using a separate function called 'MATCH_CMD'. Change-Id: I226ca0771e63228cf5e04ef9766057d4107fdd11
2018-03-14Transceiver.cpp: properly zero-terminate received commandsVadim Yanitskiy1-9/+9
Previously it was assumed that a sender should zero-terminate each command being sent. Otherwise, this could cause to printing garbage. Let's do this manually, using the length of received data as a position for '\0'. Change-Id: I69f413f33156c38a853efc5a8cdc66fbfb0ca6af
2018-03-14Transceiver.cpp: use a define for the MAX_PACKET_LENGTHVadim Yanitskiy1-2/+2
No need to keep this value on stack. Change-Id: If9ffb03b9e7b642f45732ba5938977bca271f1c7
2018-03-05Move enums required by VTY to a separate headerPau Espin Pedrol1-9/+9
This patch is a preparation for next patches, which add full VTY cfg support. Change-Id: I3d5b0576aa96869756f1629a40306c0043b6304b
2017-08-16Add -j option to bind to specific addressPau Espin Pedrol1-5/+6
Before this patch, the binding of the listening sockets was hardcoded to a local IP. Change-Id: I9ba184a1251c823e413a9230943ed263e52142ec
2017-07-04transceiver: Avoid sending clock indications when trx is not powered onPau Espin Pedrol1-8/+5
Stop calling writeClockInterface() when receiving commands in Transceiver::driveControl, otherwise it fools osmo-bts-trx clock skew check because it is always sending a clock indication with the same fn when it issues any commands during the time in between CMD POWEROFF and RSP POWERON, because fn is not increased during that period. Also use mForceClockInterface flag to delay delivery of first IND CLOCK until we start serving frames, otherwise the first one is sent and only after a long period of time the next clock indications are sent, when the radio starts to process bursts. That makes osmo-bts-trx unhappy because it expects to receive an IND CLOCK aprox at least every 400 frames. This way also we send the first IND CLOCK after the RSP POWERON 0 response. Change-Id: I91b81a4d7627cec39c1814a39ed4be306681b874
2017-07-04cosmetic: transciever: Remove trailing whitespacesPau Espin Pedrol1-9/+9
Change-Id: Ib3fbe768048b2a34a75ace9688e306720e67019a
2017-06-16transceiver: Fix POWEROFF crash on USRP2/N200/X300 devicesTom Tsou1-5/+4
Upon issuing POWEROFF command to a running transceiver, UHD interfacing thread state may become undefined if the device is stopped with I/O threads still active. Bad behavior is device dependent with only network based USRP devices affected. USB based device thread behavior stops and shutdowns as expected. Tested with N200, X300, and B210. Tested solutions include the following: 1. Set pthread_setcanceltype() with PTHREAD_CANCEL_ASYNCHRONOUS 2. Add sleep delay to allow I/O threads to timeout before stopping the device 3. Wait for I/O threads to join after cancellation before stopping the device This patch resolves the issue by with the third approach. Number 1 is not guaranteed to always work with UHD internals as driver code may explicitly set thread parameters. Using sleep calls to fix order-of-operation issues is almost never a good idea. Change-Id: Ib72ab98a27a02084b040319046c92d1c4157ae4c
2017-04-03Transceiver: Remove unsigned negative comparesTom Tsou1-2/+2
Change-Id: I49f30699786c52736ef334dae61f7bbd65d878d5 Fixes: Coverity CID 149353, 149356
2017-03-28Move Transceiver::demodulate() to sigProcLib to make it reusable.Alexander Chemeris1-13/+1
Change-Id: I2cad47160e53f65612bd1da8998c83a0a22bce9b
2017-03-28Move BURST_THRESH from Transceiver.cpp to sigProcLib.h to make it reusable.Alexander Chemeris1-9/+0
Change-Id: I5a888890e26858c0fbb2ddb7ef23cb0fd66a64b4
2017-03-24Move Transceiver::detectBurst() to sigProcLib to make it reusable.Alexander Chemeris1-33/+2
Change-Id: I3cbe8e6e4f39dde02c945e6c9086c040e276845c
2017-03-24Move CorrType type from Transceiver to sigProcLib.Alexander Chemeris1-3/+3
Required to move Transceiver::detectBurst to sigProcLib. Change-Id: I3e0e74a98bbca4d19657f50a5fb447f078663c9b
2017-03-22Call vectorSlicer() right before packing bits for transmission to osmo-bts.Alexander Chemeris1-0/+3
vectorSlicer() converts soft-bits from -1..+1 to 0..1 while we want to keep SoftVector in -1..+1 mode until the last minute, because at some point we'll want to transmit -1..+1 to osmo-bts instead of converting it from 0..1 back to -1..+1 on the osmo-bts side. Plus it removes code duplication - we call it once instead of twice. Change-Id: Idd6ddd7ac219afb0df055a692632678b66373764
2017-03-22sigProcLib: Rename demodulateBurst() to demodGmskBurst() for clarity.Alexander Chemeris1-1/+1
Change-Id: Ibcef8d7d4a2c06865bed7e4091ccc8dbbd494d77
2017-03-22sigProcLib: make energyDetect() simpler by returning actual energy.Alexander Chemeris1-2/+2
Change-Id: I9bf97f2dc03fea9bebcf43198dfb05f6e4694e9c
2016-10-25transceiver: Fix command build warningTom Tsou1-2/+3
Place conditional brackets on handover table reset. Reset table only on successful start or restart. Change-Id: I74032b49785bd68835a0a68cb0f14cdaab4fcd26
2016-07-19transceiver: Fix 4 SPS receive TOA valueTom Tsou1-1/+1
The time-of-arrival (TOA) value out of sigProc is specified in symbols or, equivalently, 1 sample per symbol and does not need to be normalized. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-19transceiver: Fix mixed GSMK / 8-PSK transmissionTom Tsou1-1/+1
Input burst construction was declared static causing the first downlink burst from upstream to determine subsequent burst size and modulation. Consequently, fixed sequence EGPRS tests would pass, however, switching between 8-PSK and GMSK bursts would fail with only one modulation type being transmitted. Internally generated test sequences '-r' option were not affected because the bursts are not received through the socket interface. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-08mcbts: Allow out of order channel setupTom Tsou1-2/+1
Previous checks on multi-channel TSC and ARFCN settings would fail if channels were initialized out of order. Namely, if channel 0 was not configured first, osmo-trx would error on the control interface leading osmo-bts to fail. Allow global TSC setting on all channels with added logging notice. Notify if channel frequency is unexpected - which may happen if channels are setup out of order - but do no report as error. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>