From patchwork Wed Aug 27 21:54:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Welte X-Patchwork-Id: 383581 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3B994140129 for ; Thu, 28 Aug 2014 08:05:38 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1XMlLO-0006EM-NT; Thu, 28 Aug 2014 00:05:30 +0200 Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.72) (envelope-from ) id 1XMlBp-0004La-73; Wed, 27 Aug 2014 23:55:37 +0200 Received: from laforge by localhost.localdomain with local (Exim 4.84) (envelope-from ) id 1XMlBH-0003VX-JV; Wed, 27 Aug 2014 23:55:03 +0200 From: Harald Welte To: openbsc@lists.osmocom.org Subject: [PATCH 12/33] Add PCH/AGCH message to PH-/MPH-/TCH-SAP interface Date: Wed, 27 Aug 2014 23:54:31 +0200 Message-Id: <1409176492-13269-13-git-send-email-laforge@gnumonks.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1409176492-13269-1-git-send-email-laforge@gnumonks.org> References: <1409176492-13269-1-git-send-email-laforge@gnumonks.org> Cc: Andreas Eversberg X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org From: Andreas Eversberg This part moves PCH and AGCH message primitives from osmo-bts-sysmo to common part. --- src/common/l1sap.c | 8 ++++++++ src/osmo-bts-sysmo/l1_if.c | 19 ++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 2dedf02..da4cc48 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -79,6 +79,7 @@ static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx, uint8_t tn; uint32_t fn; uint8_t *p, *si; + int rc; chan_nr = rts_ind->chan_nr; link_id = rts_ind->link_id; @@ -109,6 +110,13 @@ static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx, memcpy(p, si, GSM_MACBLOCK_LEN); else memcpy(p, fill_frame, GSM_MACBLOCK_LEN); + } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) { + p = msgb_put(msg, GSM_MACBLOCK_LEN); + /* if CCCH block is 0, it is AGCH */ + rc = bts_ccch_copy_msg(trx->bts, p, &g_time, + (L1SAP_FN2CCCHBLOCK(fn) < 1)); + if (rc <= 0) + memcpy(p, fill_frame, GSM_MACBLOCK_LEN); } DEBUGP(DL1P, "Tx PH-DATA.req %02u/%02u/%02u chan_nr=%d link_id=%d\n", diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index d169b27..a3fd64e 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -468,6 +468,14 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, subCh = 0x1f; if (L1SAP_IS_CHAN_BCCH(chan_nr)) { sapi = GsmL1_Sapi_Bcch; + } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) { + /* The sapi depends on DSP configuration, not + * on the actual SYSTEM INFORMATION 3. */ + u8BlockNbr = L1SAP_FN2CCCHBLOCK(u32Fn); + if (u8BlockNbr >= 1) + sapi = GsmL1_Sapi_Pch; + else + sapi = GsmL1_Sapi_Agch; } else { LOGP(DL1C, LOGL_NOTICE, "unknown prim %d op %d " "chan_nr %d link_id %d\n", l1sap->oph.primitive, @@ -544,6 +552,10 @@ static uint8_t chan_nr_by_sapi(enum gsm_phys_chan_config pchan, case GsmL1_Sapi_Bcch: cbits = 0x10; break; + case GsmL1_Sapi_Agch: + case GsmL1_Sapi_Pch: + cbits = 0x12; + break; default: return 0; } @@ -707,13 +719,6 @@ static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1, msgb_free(pp.oph.msg); } break; - case GsmL1_Sapi_Agch: - case GsmL1_Sapi_Pch: - rc = bts_ccch_copy_msg(bts, msu_param->u8Buffer, &g_time, - rts_ind->sapi == GsmL1_Sapi_Agch); - if (rc <= 0) - memcpy(msu_param->u8Buffer, fill_frame, GSM_MACBLOCK_LEN); - break; case GsmL1_Sapi_TchF: case GsmL1_Sapi_TchH: /* only hit in case we have a RTP underflow, as real TCH