aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-09-09 23:30:46 +0200
committerHarald Welte <laforge@gnumonks.org>2011-09-09 23:30:46 +0200
commit215d9eecddba2ef3a5fa850180fe866d82bdcb6a (patch)
treef435c2fc3630a32d790a2ed82186eef26aa92eee
parent06636b61559b5be5290315b81f2af08cce475548 (diff)
sysmobts: channel activation changes for v2.4 L1 DSP firmware
We now have to explicitly indicate the tchPlType at channel activation type, so L1 knows which channel decoder to use (FR, EFR, AMR, ...) Also, we properly implement the initial codec mode selection as per TS 05.09
-rw-r--r--src/osmo-bts-sysmo/oml.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 18ca6274..26c627e3 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -29,6 +29,7 @@
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/oml.h>
+#include <osmo-bts/amr.h>
#include "l1_if.h"
#include "femtobts.h"
@@ -466,33 +467,51 @@ static void alive_timer_cb(void *data)
osmo_timer_schedule(&fl1h->alive_timer, 5, 0);
}
+/* osmocom AMR mode: 0..7, L1: 1..8 */
+#define AMR_MODE_OSMO2L1(x) (x+1)
+
+static void clear_amr_params(GsmL1_LogChParam_t *lch_par)
+{
+ int j;
+ /* common for the SIGN, V1 and EFR: */
+ lch_par->tch.amrCmiPhase = GsmL1_AmrCmiPhase_NA;
+ lch_par->tch.amrInitCodecMode = GsmL1_AmrCodecMode_Unset;
+ for (j = 0; j < ARRAY_SIZE(lch_par->tch.amrActiveCodecSet); j++)
+ lch_par->tch.amrActiveCodecSet[j] = GsmL1_AmrCodec_Unset;
+}
static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
{
int j;
+ unsigned int osmo_amr_mode;
- LOGPC(DL1C, LOGL_INFO, "%s: %s tch_mode=0x%02x\n",
+ LOGP(DL1C, LOGL_INFO, "%s: %s tch_mode=0x%02x\n",
gsm_lchan_name(lchan), __FUNCTION__, lchan->tch_mode);
switch (lchan->tch_mode) {
case GSM48_CMODE_SIGN:
+ /* we have to set some TCH payload type even if we don't
+ * know yet what codec we will use later on */
+ if (lchan->type == GSM_LCHAN_TCH_F)
+ lch_par->tch.tchPlType = GsmL1_TchPlType_Fr;
+ else
+ lch_par->tch.tchPlType = GsmL1_TchPlType_Hr;
+ clear_amr_params(lch_par);
+ break;
case GSM48_CMODE_SPEECH_V1:
+ lch_par->tch.tchPlType = GsmL1_TchPlType_Fr;
+ clear_amr_params(lch_par);
+ break;
case GSM48_CMODE_SPEECH_EFR:
- if (lchan->tch_mode == GSM48_CMODE_SPEECH_V1)
- lch_par->tch.tchPlType = GsmL1_TchPlType_Fr;
- else if (lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)
- lch_par->tch.tchPlType = GsmL1_TchPlType_Efr;
- /* common for the SIGN, V1 and EFR: */
- lch_par->tch.amrCmiPhase = GsmL1_AmrCmiPhase_NA;
- lch_par->tch.amrInitCodecMode = GsmL1_AmrCodecMode_Unset;
- for (j = 0; j < ARRAY_SIZE(lch_par->tch.amrActiveCodecSet); j++)
- lch_par->tch.amrActiveCodecSet[j] = GsmL1_AmrCodec_Unset;
+ lch_par->tch.tchPlType = GsmL1_TchPlType_Efr;
+ clear_amr_params(lch_par);
break;
case GSM48_CMODE_SPEECH_AMR:
+ lch_par->tch.tchPlType = GsmL1_TchPlType_Amr;
+
lch_par->tch.amrCmiPhase = GsmL1_AmrCmiPhase_Odd; /* FIXME? */
- if (lchan->mr_conf.icmi)
- lch_par->tch.amrInitCodecMode = lchan->mr_conf.smod;
- /* else: FIXME (implicit rule by TS 05.09 ?!?) */
+ osmo_amr_mode = amr_get_initial_mode(lchan);
+ lch_par->tch.amrInitCodecMode = AMR_MODE_OSMO2L1(osmo_amr_mode);
/* initialize to clean state */
for (j = 0; j < ARRAY_SIZE(lch_par->tch.amrActiveCodecSet); j++)