summaryrefslogtreecommitdiffstats
path: root/src/gsm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsm')
-rw-r--r--src/gsm/gsm0808_utils.c41
-rw-r--r--src/gsm/libosmogsm.map1
2 files changed, 42 insertions, 0 deletions
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 0d6938ef..886f546a 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -1204,6 +1204,47 @@ uint16_t gsm0808_sc_cfg_from_gsm48_mr_cfg(const struct gsm48_multi_rate_conf *cf
return s15_s0;
}
+/*! Determine a GSM 04.08 AMR configuration struct from a set of speech codec
+ * configuration bits (S0-S15)
+ * \param[out] cfg AMR configuration in GSM 04.08 format.
+ * \param[in] s15_s0 configuration bits (S0-S15). */
+void gsm48_mr_cfg_from_gsm0808_sc_cfg(struct gsm48_multi_rate_conf *cfg,
+ uint16_t s15_s0)
+{
+ memset(cfg, 0, sizeof(*cfg));
+
+ /* Strip option bits */
+ s15_s0 &= 0x00ff;
+
+ /* Rate 5,15k must always be present */
+ cfg->m5_15 = 1;
+
+ if ((s15_s0 & GSM0808_SC_CFG_DEFAULT_AMR_4_75 & 0xff) ==
+ (GSM0808_SC_CFG_DEFAULT_AMR_4_75 & 0xff))
+ cfg->m4_75 = 1;
+ if ((s15_s0 & GSM0808_SC_CFG_DEFAULT_AMR_5_90 & 0xff) ==
+ (GSM0808_SC_CFG_DEFAULT_AMR_5_90 & 0xff))
+ cfg->m5_90 = 1;
+ if ((s15_s0 & GSM0808_SC_CFG_DEFAULT_AMR_6_70 & 0xff) ==
+ (GSM0808_SC_CFG_DEFAULT_AMR_6_70 & 0xff))
+ cfg->m6_70 = 1;
+ if ((s15_s0 & GSM0808_SC_CFG_DEFAULT_AMR_7_40 & 0xff) ==
+ (GSM0808_SC_CFG_DEFAULT_AMR_7_40 & 0xff))
+ cfg->m7_40 = 1;
+ if ((s15_s0 & GSM0808_SC_CFG_DEFAULT_AMR_7_95 & 0xff) ==
+ (GSM0808_SC_CFG_DEFAULT_AMR_7_95 & 0xff))
+ cfg->m7_95 = 1;
+ if ((s15_s0 & GSM0808_SC_CFG_DEFAULT_AMR_10_2 & 0xff) ==
+ (GSM0808_SC_CFG_DEFAULT_AMR_10_2 & 0xff))
+ cfg->m10_2 = 1;
+ if ((s15_s0 & GSM0808_SC_CFG_DEFAULT_AMR_12_2 & 0xff) ==
+ (GSM0808_SC_CFG_DEFAULT_AMR_12_2 & 0xff))
+ cfg->m12_2 = 1;
+
+ cfg->ver = 1;
+ cfg->icmi = 1;
+}
+
/*! Print a human readable name of the cell identifier to the char buffer.
* This is useful both for struct gsm0808_cell_id and struct gsm0808_cell_id_list2.
* See also gsm0808_cell_id_name() and gsm0808_cell_id_list_name().
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 3d08232c..dcc491d7 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -206,6 +206,7 @@ gsm0808_cell_id_u_name;
gsm0808_chan_type_to_speech_codec;
gsm0808_speech_codec_from_chan_type;
gsm0808_sc_cfg_from_gsm48_mr_cfg;
+gsm48_mr_cfg_from_gsm0808_sc_cfg;
gsm0808_speech_codec_type_names;
gsm0808_permitted_speech_names;
gsm0808_chosen_enc_alg_names;