This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: gsmtap_util: Add chantype_gsmtap2rsl() as inverse of chantype_rsl2gsmtap() ...................................................................... gsmtap_util: Add chantype_gsmtap2rsl() as inverse of chantype_rsl2gsmtap() Change-Id: Ie1bc00670887064da0fea61c3dab036c23ceea25 --- M include/osmocom/core/gsmtap_util.h M src/gsmtap_util.c 2 files changed, 41 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/gsmtap_util.h b/include/osmocom/core/gsmtap_util.h index 59b81e5..5c5e3fd 100644 --- a/include/osmocom/core/gsmtap_util.h +++ b/include/osmocom/core/gsmtap_util.h @@ -9,6 +9,7 @@ * \file gsmtap_util.h */ uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id); +void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype, uint8_t *link_id); struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 561cdb3..26720b6 100644 --- a/src/gsmtap_util.c +++ b/src/gsmtap_util.c @@ -1,7 +1,7 @@ /*! \file gsmtap_util.c * GSMTAP support code in libosmocore. */ /* - * (C) 2010-2011 by Harald Welte <laforge at gnumonks.org> + * (C) 2010-2017 by Harald Welte <laforge at gnumonks.org> * * All Rights Reserved * @@ -89,6 +89,45 @@ return ret; } +/*! convert GSMTAP channel type to RSL channel number + Link ID + * \param[in] gsmtap_chantype GSMTAP channel type + * \param[out] rsl_chantype RSL channel mumber + * \param[out] link_id RSL link identifier + */ +void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype, + uint8_t *link_id) +{ + switch (gsmtap_chantype & ~GSMTAP_CHANNEL_ACCH & 0xff) { + case GSMTAP_CHANNEL_TCH_F: // TCH/F, FACCH/F + *rsl_chantype = RSL_CHAN_Bm_ACCHs; + break; + case GSMTAP_CHANNEL_TCH_H: // TCH/H, FACCH/H + *rsl_chantype = RSL_CHAN_Lm_ACCHs; + break; + case GSMTAP_CHANNEL_SDCCH4: // SDCCH/4 + *rsl_chantype = RSL_CHAN_SDCCH4_ACCH; + break; + case GSMTAP_CHANNEL_SDCCH8: // SDCCH/8 + *rsl_chantype = RSL_CHAN_SDCCH8_ACCH; + break; + case GSMTAP_CHANNEL_BCCH: // BCCH + *rsl_chantype = RSL_CHAN_BCCH; + break; + case GSMTAP_CHANNEL_RACH: // RACH + *rsl_chantype = RSL_CHAN_RACH; + break; + case GSMTAP_CHANNEL_PCH: // PCH + case GSMTAP_CHANNEL_AGCH: // AGCH + *rsl_chantype = RSL_CHAN_PCH_AGCH; + break; + case GSMTAP_CHANNEL_PDCH: + *rsl_chantype = GSMTAP_CHANNEL_PDCH; + break; + } + + *link_id = gsmtap_chantype & GSMTAP_CHANNEL_ACCH ? 0x40 : 0x00; +} + /*! create an arbitrary type GSMTAP message * \param[in] type The GSMTAP_TYPE_xxx constant of the message to create * \param[in] arfcn GSM ARFCN (Channel Number) -- To view, visit https://gerrit.osmocom.org/3223 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie1bc00670887064da0fea61c3dab036c23ceea25 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder