Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/10853


Change subject: Introduce gsm48_lchan2chan_desc_as_configured()
......................................................................

Introduce gsm48_lchan2chan_desc_as_configured()

gsm48_lchan2chan_desc_as_configured() is similar to gsm48_lchan2chan_desc(),
but uses the *configured* channel combination, rather than the currently
active one.

Change-Id: Id4043218fb770e8420f19a4ef9428680ecdfd286
Related: OS#3532
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/gsm_data.c
2 files changed, 20 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/53/10853/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 68f888f..e408ff9 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1200,6 +1200,7 @@

 void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
                           const struct gsm_lchan *lchan);
+void gsm48_lchan2chan_desc_as_configured(struct gsm48_chan_desc *cd, const 
struct gsm_lchan *lchan);

 /* return the gsm_lchan for the CBCH (if it exists at all) */
 struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts);
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index ac965e2..12ab66e 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -1329,13 +1329,10 @@
                gsm_trx_all_ts_dispatch(trx, ts_ev, data);
 }

-void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
-                          const struct gsm_lchan *lchan)
+static void _chan_desc_fill_tail(struct gsm48_chan_desc *cd, const struct 
gsm_lchan *lchan)
 {
-       uint16_t arfcn = lchan->ts->trx->arfcn & 0x3ff;
-
-       cd->chan_nr = gsm_lchan2chan_nr(lchan);
        if (!lchan->ts->hopping.enabled) {
+               uint16_t arfcn = lchan->ts->trx->arfcn & 0x3ff;
                cd->h0.tsc = gsm_ts_tsc(lchan->ts);
                cd->h0.h = 0;
                cd->h0.arfcn_high = arfcn >> 8;
@@ -1349,6 +1346,23 @@
        }
 }

+void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
+                          const struct gsm_lchan *lchan)
+{
+       cd->chan_nr = gsm_lchan2chan_nr(lchan);
+       _chan_desc_fill_tail(cd, lchan);
+}
+
+/* like gsm48_lchan2chan_desc() above, but use ts->pchan_from_config to
+ * return a channel description based on what is configured, rather than
+ * what the current state of the pchan type is */
+void gsm48_lchan2chan_desc_as_configured(struct gsm48_chan_desc *cd,
+                                        const struct gsm_lchan *lchan)
+{
+       cd->chan_nr = gsm_pchan2chan_nr(lchan->ts->pchan_from_config, 
lchan->ts->nr, lchan->nr);
+       _chan_desc_fill_tail(cd, lchan);
+}
+
 bool nm_is_running(const struct gsm_nm_state *s) {
        return (s->operational == NM_OPSTATE_ENABLED) && (
                (s->availability == NM_AVSTATE_OK) ||

--
To view, visit https://gerrit.osmocom.org/10853
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4043218fb770e8420f19a4ef9428680ecdfd286
Gerrit-Change-Number: 10853
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to