From patchwork Wed May 11 15:47:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: gerrit-no-reply@lists.osmocom.org X-Patchwork-Id: 621181 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3r4gVx2257z9t3n for ; Thu, 12 May 2016 01:47:53 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 581221C365; Wed, 11 May 2016 15:47:51 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from 127.0.1.12 (unknown [127.0.1.12]) by lists.osmocom.org (Postfix) with ESMTPA id E379D1C355 for ; Wed, 11 May 2016 15:47:49 +0000 (UTC) Date: Wed, 11 May 2016 15:47:49 +0000 From: gerrit-no-reply@lists.osmocom.org Message-ID: X-Gerrit-MessageType: newchange Subject: Change in libosmocore[master]: Add function to make Uplink Measurement X-Gerrit-Change-Id: Ib37107bcc9909e5105ea711de42d3fb1db7e8d9e X-Gerrit-ChangeURL: X-Gerrit-Commit: 45a300d11026f3d40abe4cd5ff531f9a297bbd0b MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.2 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: msuraev@sysmocom.de Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From Max : Max has uploaded a new change for review. https://gerrit.osmocom.org/44 Change subject: Add function to make Uplink Measurement ...................................................................... Add function to make Uplink Measurement It assembles RSL Uplink Measurement IE according to 3GPP TS 08.58 §9.3.25. The function is based on lchan_build_rsl_ul_meas() from OsmoBTS but optionally includes DTX information. Change-Id: Ib37107bcc9909e5105ea711de42d3fb1db7e8d9e --- M include/osmocom/gsm/meas_rep.h M src/gsm/gsm_utils.c M src/gsm/libosmogsm.map 3 files changed, 26 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/44/1 diff --git a/include/osmocom/gsm/meas_rep.h b/include/osmocom/gsm/meas_rep.h index 09c2c4f..4eaeb72 100644 --- a/include/osmocom/gsm/meas_rep.h +++ b/include/osmocom/gsm/meas_rep.h @@ -1,6 +1,7 @@ #pragma once #include +#include /* RX Level and RX Quality */ struct gsm_rx_lev_qual { @@ -24,3 +25,6 @@ MEAS_REP_UL_RXQUAL_FULL, MEAS_REP_UL_RXQUAL_SUB, }; + +size_t gsm0858_rsl_ul_meas(struct gsm_meas_rep_unidir *mru, bool dtxd_used, + uint8_t *buf); diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c index 5002947..665d4ef 100644 --- a/src/gsm/gsm_utils.c +++ b/src/gsm/gsm_utils.c @@ -66,11 +66,13 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -335,6 +337,24 @@ return y; } +/*! \brief Build the RSL uplink measurement IE (3GPP TS 08.58 § 9.3.25) + * \param[in] mru Unidirectional measumrement report structure + * \param[in] dtxd_used Indicates if DTXd was used during measurement report + * period + * \param[out] buf Pre-allocated bufer for storing IE + * \returns Number of bytes filled in buf + */ +size_t gsm0858_rsl_ul_meas(struct gsm_meas_rep_unidir *mru, bool dtxd_used, + uint8_t *buf) +{ + buf[0] = dtxd_used ? (1 << 6) : 0; + buf[0] |= (mru->full.rx_lev & 0x3f); + buf[1] = (mru->sub.rx_lev & 0x3f); + buf[2] = ((mru->full.rx_qual & 7) << 3) | (mru->sub.rx_qual & 7); + + return 3; +} + /* convert power class to dBm according to GSM TS 05.05 */ unsigned int ms_class_gmsk_dbm(enum gsm_band band, int class) { diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index e0d9dcb..4c0d054 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -92,6 +92,8 @@ gsm0808_create_sapi_reject; gsm0808_prepend_dtap_header; +gsm0858_rsl_ul_meas; + gsm338_get_sms_alphabet; gsm340_gen_oa;