aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/l1_if.c
AgeCommit message (Collapse)AuthorFilesLines
2016-06-23Make get_lchan_by_chan_nr globally availableMax1-11/+5
* Remove static qualifier * Remove duplicated code - use generic function instead Change-Id: I37a312648771f58d3087471083cfcebbd97ccf1d
2016-06-17dyn PDCH: chan_nr_by_sapi(): handle TCH/F_PDCH according to ts->flagsNeels Hofmeyr1-3/+15
According to the PDCH Active flag, handle a TS as TCH/F or PDCH. Change-Id: I06ca26a99f052c6a2ae953fe355fd1196f66e501
2016-06-15sysmo: add L3 handle to l1prim messagesNeels Hofmeyr1-2/+56
Place a layer 3 handle into GSM L1 messages to better match up confirmations to respective requests. This handle is a uint32_t transparently returned in the confirmation messages, so a match-up is easy to add. So far, a GSM L1 confirmation message received for a preceding L1 Request was matched only by the prim_id. That meant that only one instance of the same primitive could be waiting for a confirmation at any given time, or the responses would get mixed up: the struct wait_l1_conf instances entered into the fl1h->wlc_list queue would be returned to a possibly mismatching confirmation handler. (Seen during testing of dyn pdch switching.) Send the hLayer3 handle out via prim_init(), using new static functions to produce handles on different scopes: * l1p_handle_for_trx() * l1p_handle_for_ts() * l1p_handle_for_lchan() (These could possibly move to a more general .h/.c file later.) Remember the hLayer3 handle in * struct wait_l1_conf. Match the incoming confirmations' and stored hLayer3 handles up in, and remove a now obsolete comment from: * is_prim_compat() Since the hLayer3 members are at different byte offsets in GsmL1_Prim_t.u.*, use large switch statements to set/get the value: * In prim_init(), extend existing switch statement to set in GsmL1_Prim_t. * Add l1p_get_hLayer3() to retrieve from GsmL1_Prim_t (could possibly move to a more general .h/.c file later). Change-Id: Ie4533c6cbc160318917e7a672ab6f9a848f01d1b
2016-06-14DTXd: store/repeat last SIDMax1-1/+1
Store last SID received over RTP and repeat is if necessary (no new SID or SPEECH frames) according to codec-specific scheduling rules. Change-Id: I4d23846a27d3dbd2a6e75e481c1efcdb2a85f305 Related: OS#1563
2016-06-12Add DTXd support for sysmoBTS and LC15Max1-0/+2
* set/clear DTXd activity indicator for measurement reporting * set DTXd status based on information from RSL Related: OS#1563 Change-Id: I148a75725c4e5089b6f2da6e9adcbe94170d3257 Depends-On: I4a033b03fcd0deb4db7a38273b5407511dbf1d6c Reviewed-on: https://gerrit.osmocom.org/220 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-02-15declare pcu_direct in pcu_if.hHarald Welte1-2/+0
2016-02-15LC15/sysmobts: Don't try to refer to fl1h from PHY configHarald Welte1-11/+28
At the time the phy link / phy instance level VTY configuration commands are parsed, we did not yet call l1if_open() and thus pinst->u.{lc15,sysmobts}.hdl == NULL. PHY or PHY instance specific configuration must thus be stored inside the phy_link or phy_instance itself, and not inside the (not yet existing) handle. We solve this by moving around some parameters: * clk_use_eeprom/clk_cal/clk_src/calib_path get replicated in phy_instance * min_qual_{rach,norm} are moved into the generic part (which means that osmo-bts-octphy and osmo-bts-trx should also implement them)
2016-02-15sysmobts/LC15: Fix startup-time DSP trace flage configurationHarald Welte1-0/+1
Due to the changes introduced by the phy_link API, it's not easy to set the default DSP trace flags via a command line argument anymore. We now rather introduce a persitent VTY configuration command, by which the default DSP tracing configuration can be set (for each PHY). The persistent trace flags are stored in the phy_instance, while the current operational run-time flags are in fl1h->phy_instance.
2016-02-15port sysmobts to phy_link/phy_instance abstractionHarald Welte1-11/+48
2016-02-09fix migration of check_for_ciph_cmd() from sysmobts to l1sapHarald Welte1-45/+0
During the L1SAP related changes, somehow an old version of check_for_ciph_cmd() was re-introduced, which didn't store the N(s) as part of the lchan. To make things worse, the old code was still present in the sysmobts specific part, but never executed.
2016-01-08sysmobts: add missing break statement in l1if_handle_ind()Harald Welte1-0/+1
this was introduced in 21b020b33633683d7c785af15c773aab0f79d0de and luckily spotted by coverity (CID 1347446)
2016-01-04sysmobts: Clarify msgb ownership / fix memory leaksHarald Welte1-21/+30
2015-11-20sysmobts: Dont recycle PHY primitive for L1SAP in PH-DATA.indHarald Welte1-20/+14
2015-11-20sysmobts: fix ph_data_req() msgb handling + alignmentHarald Welte1-24/+16
The way we recycle the msgb with a l1sap header when transforming a PH-DATA.req L1SAP primitive into a PHY/L1 primitive was flawed in several ways: 1) the way the L1SAP header was stored in the buffer didn't provide sufficient tailroom for the L1 primitive 2) the alignment of the data in L1SAP is at a 32bit bounadry, but not in the L1 primitive, causing unaligned accesses.
2015-09-22Get RSSI from received uplink data and send to PCUAndreas Eversberg1-1/+4
2015-09-22move MS power control handling from sysmobts to common partHarald Welte1-79/+1
MS uplink power control is required in pretty much any BTS, and we cannot assume that they PHY / L1 will always take care of it by itself. So the correspondign code is moved to common/power_control.c and called from the generic part of L1SAP. The corresponding VTY paramter has been moved from the sysmobts-specific trx VTY node to the common BTS VTY node.
2015-09-22Move detection of handover frames from sysmo-bts code to common codeAndreas Eversberg1-13/+0
2015-09-22Remove obsolete gsmtap handling from osmo-bts-sysmo part.Andreas Eversberg1-101/+0
2015-09-22sysmobts: Clean up transitions for lchan cipher stateAndreas Eversberg1-1/+4
There are three transitions: 1. LCHAN_CIPH_NONE -> LCHAN_CIPH_RX_REQ -> LCHAN_CIPH_RX_CONF It is used to enable ciphering in RX (uplink) direction only. 2. LCHAN_CIPH_RX_CONF -> LCHAN_CIPH_RX_CONF_TX_REQ -> LCHAN_CIPH_RXTX_CONF It is used to additionally enable ciphering in TX (downlink) direction. 3. LCHAN_CIPH_NONE -> LCHAN_CIPH_RXTX_REQ -> LCHAN_CIPH_RX_CONF_TX_REQ -> LCHAN_CIPH_RXTX_CONF It is used to enable ciphering in both TX and RX directions. This is used when the channel is activated with encryption already enabled. (assignment or handover) In order to follow the order of these transitions, the RX direction must always be set before the TX direction. If no cipher key is set (A5/0), ciphering is set to ALG 0, but lchan cipher state remains at LCHAN_CIPH_NONE.
2015-09-22Add MEAS (MPH_INFO) IND message to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-13/+13
This part moves processing of measurement infos from osmo-bts-sysmo to common part.
2015-09-22l1sap: Port code to new ciphering handlingHarald Welte1-32/+0
... introduced in 2cc37035d73191b71b9ba9c0d559a0da6a5f35e5
2015-09-22sysmobts/l1_if: Sacch/Sdcc/Facch are handled in l1sap/coreHarald Welte1-56/+0
2015-09-22Add SDCCH/SACCH/FACCH messages to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-131/+88
This part moves control channel message primitives from osmo-bts-sysmo to common part. In order to control ciphering fo BTS model, CIPHER (MPH_INFO) messages are used.
2015-09-22l1sap: Avoid compiler warnings regarding uninitialized nmsgHarald Welte1-2/+2
2015-09-22l1sap: Use {data,empty}_req_from_l1sap() and avoid code duplicationHarald Welte1-21/+4
2015-09-22Add TCH messages to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-59/+110
This part moves TCH handling from osmo-bts-sysmo to common part. The RTP handling is done at the common part, so they can be used by other BTS models.
2015-09-22Move chan act/rel/modify from bts_model to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-0/+41
This part replaces channel activation/deactivation/modification routines by MPH_INFO messages.
2015-09-22Add TIME (MPH_INFO) IND messages to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-38/+27
This part moves GSM time handling from osmo-bts-sysmo part to common part.
2015-09-22l1sap: additional comments explaining l1sap changes in l1_if.cHarald Welte1-0/+4
2015-09-22Add PDCH messages to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-76/+84
This part moves PDTCH, PACCH and PTCCH message primitives from osmo-bts-sysmo to common part.
2015-09-22Add PCH/AGCH message to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-7/+12
This part moves PCH and AGCH message primitives from osmo-bts-sysmo to common part.
2015-09-22l1sap: sysmobts: remove obsolete get_lapdm_chan_by_hl2()Harald Welte1-13/+0
2015-09-22l1sap: correctly set chan_nr on PRIM_PH_RACH / INDICATIONHarald Welte1-0/+5
In case of a RACH INDICATION on CCCH, we need to set CHAN_NR to 0x88 (RSL_CHAN_RACH). In other cases, chan_nr needs to reflect the actual logical channel (TCH/SDCCH) on whcih the handover happened.
2015-09-22Add RACH message to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-65/+32
This part moves RACH message primitives from osmo-bts-sysmo to common part.
2015-09-22l1sap: Split ph_data_req() into smaller partsHarald Welte1-25/+47
... in an effort to avoid introducing new/more spaghetti code Also, use offsetof() instead of pointer calculation to determine the start of GsmL1_Prim_t.u.phDataReq.msgUnitParam.u8Buffer
2015-09-22Add BCCH message to PH-/MPH-/TCH-SAP interfaceAndreas Eversberg1-12/+155
This first part moves BCCH message primitives from osmo-bts-sysmo to common part. A new file "common/l1sap.c" is introduced to implement handling of layer 1 messages from/to BTS model.
2015-03-28write_queue: Check the result of osmo_wqueue_enqueue and freeHolger Hans Peter Freyther1-4/+20
The write_queue is designed to have a maximum amount of pending messages and will refuse to take new messages when it has been reached. The caller can decide if it wants to flush the queue and add the message again, create a log. But in all cases the ownership of the msgb has not been transferred. Fix the potential memory leak in the failure situation.
2015-02-05power/sysmobts: Add a manual ms power level controlHolger Hans Peter Freyther1-4/+80
Currently the DSP is instructed to achieve a given uplink power target but there are circumstances (e.g. EMV testing) where we need more control over it. The "manual/software/osmo" power control can only be implemented per TRX and not per lchan. Add a very very basic control that checks the MS Power used by the phone, the actual receive level and then adjust the power. The code doesn't take the history into account, if the phone can not reach the requested power level the code will be stuck (e.g. no timeout based on multiframes). It has a mode for a fixed power control but no way to set it yet. The change of the mode requires a restart of the software.
2014-12-30CBCH: Implement CBCH block segmentation and RSL_MT_SMS_BC_CMDHarald Welte1-0/+1
* CBCH load indications are not yet sent * The queue length is not yet limited!
2014-12-30Initial CBCH supportHarald Welte1-0/+4
This should handle OML channel combinations with CBCH and activate the CBCH SAPI towards the DSP correspondingly. What is still missing is sending any actual information over the CBCH in respons to the PH-RTS.ind coming up from L1.
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.