aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/l1_if.c
AgeCommit message (Collapse)AuthorFilesLines
2014-08-24l1_if: pass private 'void *data' from call to callbackHarald Welte1-22/+30
When enqueueing a command towards the L1, we can now pass along a private data pointer, which then gets passed to the call-back upon completion.
2014-08-09sysmobts: Add a unit test that checks of the behaviorHolger Hans Peter Freyther1-0/+14
We need to build a lot more code to be able to test these two new routines. I didn't want to move the code to a utils file as the check is called from a hot path. Add accessors to the inlined variant to be used by the unit test. While writing the unit tests I noticed that a re-transmission of the ciphering command would lead to an attempt to enable ciphering again. I am not sure that this MphConfig is idempotent.
2014-08-09sysmobts: Deal with ciphering when we have a transport clashHolger Hans Peter Freyther1-12/+31
The network is configured with early classmark sending. This means that the phone might send a "classmark change" message at the same time we send a ciphering mode command. When we received the CM message we assumed we have just received the first ciphered message and enabled ciphering for tx as well. When we snoop the Ciphering Mode Command extract the N(S) variable and when we receive an I frame from the MS see if it handled our message by comparing the MS N(R) to BTS N(S) + 1.
2014-07-25sysmobts: Provide VTY routines to do clock calibrationsHolger Hans Peter Freyther1-2/+118
The sysmoBTS2050 does not have a OCXO and we should not rely on the GPS module to always have a fix. Instead use the TCXO by default and from time to time (and we know we have a fix calibrate the TCXO). This can be done by: trx 0 rf-clock-info reset wait... trx 0 rf-clock-info correct write The output is currently only written to the log as the VTY connection might go away during the operation. The reset will set the approriate reference clock and the correct will attempt to determine and apply the correction. The write terminal will make sure that next on start a known good value will be used.
2014-07-25sysmobts: Free the message on older firmware releasesHolger Hans Peter Freyther1-0/+1
Seen while implementing a new functionality in the code.
2014-05-22common: Remove unused gsm_time parameter from lchan_sacch_getHolger Hans Peter Freyther1-1/+1
2014-05-17sysmobts: Support DSP API >= 3.8.1 (u8MaxCellSize)Harald Welte1-0/+4
2014-05-15sysmobts: Fix compiler warning about missing declarationÁlvaro Neira Ayuso1-0/+1
Include utils.h to have a declaration of sysmobts_get_nominal_power, l1_if.c: In function 'l1if_activate_rf': l1_if.c:1144:6: warning: implicit declaration of function 'sysmobts_get_nominal_power' [-Wimplicit-function-declaration] Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-03-29sysmobts: Fix build for the v1 of the sysmobtsHolger Hans Peter Freyther1-0/+2
2014-03-26sysmobts: Honor power reduction on older sysmoBTSv2 hardwareHolger Hans Peter Freyther1-7/+23
Older hardware didn't have the external attentuator that was used to control the wanted output power. So starting from the git commit 3c8ff3c70bc52d0a1d75a1e6b87b0069d92f10f9 older hardware was always transmitting with 23 dBm regardless of the power reduction. Remember the hardware revision returned by the SystemInformation primitive, postpone the call to l1if_activate_rf until we know the board revision. Manually verified on BTS #1 and #57. On BTS#1 the external attenuator has not been configured and on BTS#57 it was.
2014-03-16sysmobts: Change the order to follow the RX handling codeHolger Hans Peter Freyther1-1/+1
2014-03-16sysmobts: Improve the log message and print the hLayer2 we don't knowHolger Hans Peter Freyther1-1/+3
2014-03-10sysmobts: Do a RF mute at initialization when the RC is lockedHolger Hans Peter Freyther1-2/+2
Currently a locked cell is actively broadcasting when it is being bootstrapped after the lock. This patch adds an initial update of the RF mute state when the TRX is initialized. Ticket: OW#1131 Sponsored-by: On-Waves ehf
2014-03-10handover,sysmobts: Handle handover in the sysmobts codeHolger Hans Peter Freyther1-0/+26
When the lchan was activated for handover configure it to wait for a RACH burst. On release make sure to always release the RACH SAPI (in case it has been allocated). On the first frame inform handover.c about it and forward the received access burst to the handover layer. Using an E71 it was possible to make a handover for SDCCH and TCH/F from a nanoBTS but also from itself to itself. The vty commands of OpenBSC and the silent-call have been used for that. I didn't verify audio handling so far.
2014-03-10handover,sysmobts: Handle idle needed for preparation of rach handlingHolger Hans Peter Freyther1-0/+3
2014-03-10handover,sysmobts: Refactor the parsing/handling of the access delayHolger Hans Peter Freyther1-5/+10
2014-03-03sysmobts: Do not generate RF Conn failure for CCCH and PDCHHolger Hans Peter Freyther1-0/+6
This could lead to a BSC attempting to release the BCCH or a PDCH. In the case of the BCCH this lead to a funny crash. Log: <0000> rsl.c:605 (bts=0,trx=0,ts=0,ss=4) Sending Connection Failure: cause = 0x01 <0000> rsl.c:1720 (bts=0,trx=0,ts=0,ss=0) Rx RSL DEACTIVATE_SACCH Backtrace: Program received signal SIGSEGV, Segmentation fault. msgb_dequeue (queue=0x4007d2d8) at msgb.c:102 102 llist_del(lh); (gdb) bt #0 msgb_dequeue (queue=0x4007d2d8) at msgb.c:102 #1 0x4002ed28 in lapd_dl_flush_tx (dl=0x4007d220) at lapd_core.c:173 #2 0x40030cb4 in lapd_dl_reset (dl=0x4007d220) at lapd_core.c:307 #3 0x40030d00 in lapd_dl_exit (dl=0x4007d220) at lapd_core.c:321 #4 0x40033d80 in lapdm_entity_exit (le=<optimized out>) at lapdm.c:169 #5 0x40033d9c in lapdm_channel_exit (lc=0x4007d214) at lapdm.c:180 #6 0x0001a334 in rsl_tx_rf_rel_ack (lchan=0x4007d180) at rsl.c:505 #7 0x0000e908 in lchan_deactivate_sapis (lchan=0x4007d180) at oml.c:1427 #8 sapi_queue_exeute (lchan=0x4007d180) at oml.c:547 #9 0x0000ead0 in sapi_queue_send (lchan=<optimized out>) at oml.c:571 #10 queue_sapi_command (lchan=<optimized out>, cmd=<optimized out>) at oml.c:609 #11 queue_sapi_command (lchan=0x4007d180, cmd=<optimized out>) at oml.c:601 #12 0x0000faf0 in enqueue_rel_marker (lchan=0x4007d180) at oml.c:1440 #13 lchan_deactivate (lchan=0x4007d180) at oml.c:1447 #14 0x0001004c in bts_model_rsl_chan_rel (lchan=<optimized out>) at oml.c:1647 #15 0x0001b948 in rsl_rx_rf_chan_rel (lchan=0x4007d180) at rsl.c:844 #16 rsl_rx_dchan (msg=0x75a88, trx=0x4007b038) at rsl.c:1727 #17 down_rsl (trx=0x4007b038, msg=0x75a88) at rsl.c:1853 #18 0x000154d4 in sign_link_cb (msg=<optimized out>) at abis.c:132 #19 0x400701c0 in ?? () from /usr/lib/libosmoabis.so.2 #20 0x400701c0 in ?? () from /usr/lib/libosmoabis.so.2 Backtrace stopped: previous frame identical to this frame (corrupt stack?) Fixes: OW#1133
2014-02-22agch/pch: Put CCCH message generation into commonJacob Erlbeck1-13/+4
This patch adds a common function bts_ccch_copy_msg() that provides and schedules AGCH and PCH messages. It is basically a frontend to paging_gen_msg() and bts_agch_dequeue() and contains refactored code from l1_if.c. Sponsored-by: On-Waves ehf
2014-02-22agch/rsl: Fix msgb handling for IMMEDIATE ASSIGNJacob Erlbeck1-1/+1
Currently, the msg->data pointer is just set to the IMMEDIATE ASSIGN message and the len is adjusted accordingly. Unfortunately, this leaves l2h (pointing to the RSL header) and l3h (pointing to the FULL_IMM_ASS_INFO IE) in an undefined state (outside of [data, tail]). The code in bts.c accesses the message via msg->data. This patch sets l3h and l2h correctly. msgb_l3() will point to the start of the IMM ASS message and should be used instead of msg->data. Sponsored-by: On-Waves ehf
2014-02-20sysmobts: Remove debug left over from the SACCH fixes we madeHolger Hans Peter Freyther1-1/+0
2014-01-27sysmobts: Add the requested TA to the field ACCH headerHolger Hans Peter Freyther1-0/+1
Write the requested timing advance into the header. We are currently using the u8AutoTA mode so the value will be overwritten by the DSP before the bursts are sent to the MS.
2014-01-27sysmobts: Correct sending of LAPDm frames on the SACCHHolger Hans Peter Freyther1-4/+7
When a frame is sent on the SACCH the LAPDm code will already prepend two bytes for the tx_power and the ta. In the BTS we want to use the values that were set by the BSC though. They currently come from the RSL CHAN ACT but could also be set through the RSL MS power control command. Update the comment as the space is not empty. At the 30C3 we had a NITB crash because of a RLL timeout on a TCH/F. Jacob analyzed the problem and tracked it down to the mismatch of LAPDm and the l1 interface to the DSP.
2014-01-21sysmobts: Specify TRX nominal maximum tx power as fMaxTxPowerHarald Welte1-0/+6
In the MPH ACTIVATE-RF.req, we need to specify the nominal maximum transmit power, i.e. >= what we later request during MPH-INIT.req. This field was first introduced in API version 2.2, but we never used it so far. It may help fixing a bug related to excessive power consumption of the sysmoBTS 2050.
2013-11-05sysmobts: Notify the BSC about all muted lchansJacob Erlbeck1-0/+30
Currently it takes some time (around 30s) until it is detected that the radio link is down after mute. Not till then the BSC is informed and the call terminated. This patch modifies this behaviour by sending a RSL_MT_CONN_FAIL message with cause RSL_ERR_RADIO_LINK_FAIL for each muted and active lchan immediately after the corresponding Change Administrative State Request has been acknowledged. Ticket: OW#976 Sponsored-by: On-Waves ehf
2013-11-05sysmobts: Use status flags instead of direct LED accessJacob Erlbeck1-3/+3
Currently the LEDs are being accessed directly from within the l1_if.c file. So the handling of rf mute and activate/deactivate both access LED_RF_ACTIVE directly. This may lead to an inconsistent LED status. This patch replaces these calls to sysmobts_led_set() by an abstract equivalent bts_update_status(), that uses a set of independant status ids. The associated values can than be combined into a visible LED status. Currently LED_RF_ACTIVE is on iff BTS_STATUS_RF_ACTIVE is set and BTS_STATUS_RF_MUTE is not set. Sponsored-by: On-Waves ehf
2013-11-05sysmobts: Add L1 support for the new RF mute requestJacob Erlbeck1-0/+50
This adds a new function l1if_mute_rf(femtol1_hdl, ch_mute[8]) to set the mute state for each radio channel. On completion and iff l1if_mute_rf() returned 0 the callback oml_mo_rf_lock_chg(mo, ch_mute_state[8], success) is invoked when the response from the superfemto DSP is received. Ticket: OW#976 Sponsored-by: On-Waves ehf
2013-10-10sysmobts: Attempt to fix the compilation for the v1 hardwareHolger Hans Peter Freyther1-0/+4
2013-10-09sysmobts: Don't use the clock calibration value on external clocksHarald Welte1-3/+21
If the clock is provided by an external (like GPS) clock, we should not use the calibration value. The latter is only used in context of the OCXO or VCTCXO.
2013-10-09sysmobts: Read supported bands from EEPROMHarald Welte1-2/+21
...rather than assuming that any v2 hardware supports all bands.
2013-10-04Use GPS as default clock source on sysmoBTS 2050Harald Welte1-2/+35
2013-07-16sysmobts: Set the clock calibration to the value read from the eepromNicolas J. Bouliane1-0/+1
By default read the clock calibration from the EEPROM. It is still possible to set it using the cli. Signed-off-by: Nicolas J. Bouliane <nicolas.bouliane@nutaq.com>
2013-06-24sysmobts: Fix potential memory leaks in the prim callback handlingHolger Hans Peter Freyther1-0/+2
Make sure the l1msg is always freed in the callback. There were several error conditions were the msgb would not have been freed, in the case of the calib data and the system information the message was not freed even in normal condition. I will modify this code to __use a msgb. This allows to re-use the allocated msgb across read operations.
2013-06-22calib: Fix for new EEPROM Mode; better log msgsHarald Welte1-4/+8
2013-06-22calib: Add fixup for incompatible calib data / firmware versionHarald Welte1-8/+8
For certain sysmoBTS units, a fixup to the calibration table is needed, if the firmware is >= 3.3.0.
2013-05-01sysmobts: Use msgb_free instead of talloc_free to free the messageHolger Hans Peter Freyther1-2/+2
Currently msgb_free is calling talloc_free but we might introduce a msgb pool in the future. So make sure to use the designated free method for the msgb.
2013-05-01sysmobts: Print the lchan name for the S counter.Holger Hans Peter Freyther1-5/+8
2013-03-24sysmobts: Prepare to address the documented limitation of this codeHolger Hans Peter Freyther1-3/+12
2013-03-17Add VTY option to define minimum C/I level for RACH and normal burstAndreas Eversberg1-3/+4
2013-03-17Get RSSI from received uplink data and send to PCUAndreas Eversberg1-2/+4
This bumps the PCU API version and thus requires a new version of the code on the sysmoBTS side!
2013-03-15Fix: Stop RADIO LINK TIMEOUT couter S from counting, if it has reached 0Andreas Eversberg1-19/+31
In case that the counter S reached 0, it will stay 0. Subsequent received good and bad SACCH frames must not cause to trigger radio link failure again. Once the BSC has been indicated about link failure, it will release channel. The counting of S has been moved to a seperate function. This patch will ensure that the link failure is indicated only once. But even if the link failure would be sent multiple times, the BSC should ignore it. The BSC releases the channel and may only reuse it after confirm from BTS. (There cannot be any link failure indications after confirm of channel release.) The allowed timeout value range is 4..64, as defined in TS 05.08, so if the BSC sends an attribute with value out of range or other failure criterion, the Set BTS Attributes message is NACKed.
2013-03-11Added radio link timeout procedure according to TS 05.08 Chapter 5.2Andreas Eversberg1-2/+25
Chapter 5.2 applies to MS procedure, but 5.3 (BSS procedure) defines no exact criterion, so I decided to use the procedure equivalent to MS. The criterion is based on a counter S, which is initialized to a preset RADIO_LINK_TIMEOUT, which can be configured via VTY. Whenever a received SACCH block is bad, S is counted down by one. If SACCH block is successfully decoded, S is counted up by two, but never above initial RADIO_LINK_TIMEOUT value. If S reaches 0, an RSL Connection Failure Indication with cause RF Radio Link Failure is sent to BSC, which then aborts channel. Use link timeout value from BSC via OML attribute. How to test: - Set "debug" for "meas" logging. - Start silent call to an attached mobile. - Remove battery from mobile or shield mobile. - Watch S count down.
2013-03-07l1_if: if ul_power_target==0, hard-code MS power to what RSL saysHarald Welte1-0/+4
RSL CHAN ACT contains a MS_POWER IE which is intended to be used as the initial power level for the MS, before the UL power control loop is starting. In our case, if ul_power_target != 0, then the DSP takes care of power control. If ul_power_target == 0, then we instruct the phone to constantly use the value specified by the BSC in the MS_POWER IE. FIXME: Actually implement a proper power control algoritihm inside osmo-bts so we don't have to rely on the DSP implementation.
2013-03-06gsmtap: Put the RxLevel and RxQual in uplink GSMTAPHarald Welte1-1/+3
2013-02-27calib: Use 2.4.0 as cut-off for the firmware, log errorsHolger Hans Peter Freyther1-1/+1
In case opening a calibration file is failing an error will will be logged, the caller and implementation were inconsistent about the API version that is supported for the calibration data, attempt to make the cut-off at 2.4.0.
2013-02-27sysmobts: Fix a memory leak when no callback is setHolger Hans Peter Freyther1-2/+6
The TxPower handled used to call the requestion function without a callback. In that case the msgb is leaked. The code still allows the callback to be NULL so we will just delete the message in that case.
2013-02-27sysmobts: Remove the is_system_primitive from l1if_req_complHolger Hans Peter Freyther1-6/+12
All users (but the gsm_compl) of the l1if_req_compl use it with is_system_primitive=1. We can now remove this parameter from the method. Introduce _l1if_req_compl that will insert the item into the queue for us.
2013-02-27sysmobts: We can now pass the trx to the callback change the signaturesHolger Hans Peter Freyther1-8/+5
2013-02-27sysmobts: Remove the trx parameter from the signatureHolger Hans Peter Freyther1-8/+8
l1if_gsm_req_compl everyone is passing the trx as data pointer right now, remove it from the request procedure right now as it can be deducted from the femtol1_hdl.
2013-02-27sysmobts: Use the hdl->priv in l1if_req_compl for all callersHolger Hans Peter Freyther1-9/+8
2013-02-27sysmobts: Remove the data parameter from the l1if_gsm_req_complHolger Hans Peter Freyther1-2/+2
Pass in the trx argument at the lower level as everyone is using the fl1h->priv now.