Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/10275


Change subject: move caching of FAACH data to common BTS code
......................................................................

move caching of FAACH data to common BTS code

Move caching of FAACH data to the common BTS code to reduce
duplicatation between sysmobts and litecell5.

Change-Id: I252679206235c538335626d8075d003c0a27316f
Related: OS#1950
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
3 files changed, 27 insertions(+), 26 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/75/10275/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 8936674..cddba47 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -778,6 +778,31 @@
                        }
                        msgb_free(pp.oph.msg);
                }
+
+               if (dtx_dl_amr_enabled(lchan)) {
+                        switch (lchan->tch.dtx.dl_amr_fsm->state) {
+                        case ST_ONSET_F:
+                        case ST_U_INH_F:
+                        case ST_F1_INH_F:
+                               if (L1SAP_IS_CHAN_TCHH(chan_nr) || 
L1SAP_IS_CHAN_TCHF(chan_nr) ||
+                                   (L1SAP_IS_CHAN_PDCH(chan_nr) && 
!ts_is_pdch(&trx->ts[tn]))) {
+                                       /* FACCH interruption of DTX silence */
+                                       /* cache FACCH data */
+                                       memcpy(lchan->tch.dtx.facch, msg->l2h, 
msgb_l2len(msg));
+                                       /* update FN so it can be checked by 
TCH silence
+                                          resume handler */
+                                       lchan->tch.dtx.fn = LCHAN_FN_DUMMY;
+                               }
+                               break;
+                       case ST_FACCH:
+                               /* update FN so it can be checked by TCH silence
+                                  resume handler */
+                               lchan->tch.dtx.fn = LCHAN_FN_DUMMY;
+                               break;
+                       default:
+                               break;
+                       }
+               }
        } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
                p = msgb_put(msg, GSM_MACBLOCK_LEN);
                rc = bts_ccch_copy_msg(trx->bts, p, &g_time,
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index e6cdfd4..b734942 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -422,9 +422,6 @@
                        }
                        if (sapi == GsmL1_Sapi_TchH || sapi == GsmL1_Sapi_TchF) 
{
                                /* FACCH interruption of DTX silence */
-                               /* cache FACCH data */
-                               memcpy(lchan->tch.dtx.facch, msg->l2h,
-                                      msgb_l2len(msg));
                                /* prepare ONSET or INH message */
                                if(lchan->tch.dtx.dl_amr_fsm->state == 
ST_ONSET_F)
                                        
l1p->u.phDataReq.msgUnitParam.u8Buffer[0] =
@@ -441,17 +438,8 @@
                                /* update length */
                                data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi,
                                                    subCh, u8BlockNbr, 3);
-                               /* update FN so it can be checked by TCH silence
-                                  resume handler */
-                               lchan->tch.dtx.fn = LCHAN_FN_DUMMY;
                        }
-               } else if (dtx_dl_amr_enabled(lchan) &&
-                          lchan->tch.dtx.dl_amr_fsm->state == ST_FACCH) {
-                       /* update FN so it can be checked by TCH silence
-                          resume handler */
-                       lchan->tch.dtx.fn = LCHAN_FN_DUMMY;
-               }
-               else {
+               } else {
                        OSMO_ASSERT(msgb_l2len(msg) <= 
sizeof(l1p->u.phDataReq.msgUnitParam.u8Buffer));
                        memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer, msg->l2h,
                               msgb_l2len(msg));
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 3adb442..18fc9b8 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -419,9 +419,6 @@
                        }
                        if (sapi == GsmL1_Sapi_TchH || sapi == GsmL1_Sapi_TchF) 
{
                                /* FACCH interruption of DTX silence */
-                               /* cache FACCH data */
-                               memcpy(lchan->tch.dtx.facch, msg->l2h,
-                                      msgb_l2len(msg));
                                /* prepare ONSET or INH message */
                                if(lchan->tch.dtx.dl_amr_fsm->state == 
ST_ONSET_F)
                                        
l1p->u.phDataReq.msgUnitParam.u8Buffer[0] =
@@ -438,17 +435,8 @@
                                /* update length */
                                data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi,
                                                    subCh, u8BlockNbr, 3);
-                               /* update FN so it can be checked by TCH silence
-                                  resume handler */
-                               lchan->tch.dtx.fn = LCHAN_FN_DUMMY;
                        }
-               } else if (dtx_dl_amr_enabled(lchan) &&
-                          lchan->tch.dtx.dl_amr_fsm->state == ST_FACCH) {
-                       /* update FN so it can be checked by TCH silence
-                          resume handler */
-                       lchan->tch.dtx.fn = LCHAN_FN_DUMMY;
-               }
-               else {
+               } else {
                        OSMO_ASSERT(msgb_l2len(msg) <= 
sizeof(l1p->u.phDataReq.msgUnitParam.u8Buffer));
                        memcpy(l1p->u.phDataReq.msgUnitParam.u8Buffer, msg->l2h,
                               msgb_l2len(msg));

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I252679206235c538335626d8075d003c0a27316f
Gerrit-Change-Number: 10275
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <[email protected]>

Reply via email to