DTX: wrap FSM signal dispatching

Make wrapper function which checks that DTX is enabled for lchan before
dispatching any events.

Change-Id: Id8b519c4af6d505ec9a4b9aadd5107bf7af53d66
This commit is contained in:
Max 2016-11-04 16:52:35 +01:00
parent 9f936344ea
commit 5ee3dba39f
3 changed files with 12 additions and 6 deletions

View File

@ -5,6 +5,7 @@
#pragma once
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/dtx_dl_amr_fsm.h>
#include <osmocom/codec/codec.h>
@ -27,6 +28,7 @@ enum {
void lchan_set_marker(bool t, struct gsm_lchan *lchan);
bool dtx_dl_amr_enabled(const struct gsm_lchan *lchan);
void dtx_dispatch(struct gsm_lchan *lchan, enum dtx_dl_amr_fsm_events e);
void dtx_cache_payload(struct gsm_lchan *lchan, const uint8_t *l1_payload,
size_t length, uint32_t fn, int update);
int dtx_dl_amr_fsm_step(struct gsm_lchan *lchan, const uint8_t *rtp_pl,

View File

@ -610,10 +610,8 @@ static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
memcpy(p, pp.oph.msg->data, GSM_MACBLOCK_LEN);
/* check if it is a RR CIPH MODE CMD. if yes, enable RX ciphering */
check_for_ciph_cmd(pp.oph.msg, lchan, chan_nr);
if (dtxd_facch && dtx_dl_amr_enabled(lchan))
osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm,
E_FACCH,
(void *)lchan);
if (dtxd_facch)
dtx_dispatch(lchan, E_FACCH);
}
msgb_free(pp.oph.msg);
}

View File

@ -151,8 +151,7 @@ int dtx_dl_amr_fsm_step(struct gsm_lchan *lchan, const uint8_t *rtp_pl,
if (rtp_pl == NULL) { /* SID-FIRST P1 -> P2 */
*len = 3;
memcpy(l1_payload, lchan->tch.dtx.cache, 2);
osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_COMPL,
(void *)lchan);
dtx_dispatch(lchan, E_COMPL);
return 0;
}
@ -307,6 +306,13 @@ bool dtx_dl_amr_enabled(const struct gsm_lchan *lchan)
return false;
}
void dtx_dispatch(struct gsm_lchan *lchan, enum dtx_dl_amr_fsm_events e)
{
if (dtx_dl_amr_enabled(lchan))
osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, e,
(void *)lchan);
}
/* repeat last SID if possible, returns SID length + 1 or 0 */
/*! \brief Repeat last SID if possible in case of DTX
* \param[in] lchan Logical channel on which we check scheduling