Change in osmocom-bb[master]: layer23/common: merge l1ctl_ph_prim_cb() to L23SAP

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sat Oct 6 09:44:59 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/11249


Change subject: layer23/common: merge l1ctl_ph_prim_cb() to L23SAP
......................................................................

layer23/common: merge l1ctl_ph_prim_cb() to L23SAP

Change-Id: Ic852b2b7f5a651b7a4debc83778ae24c687e85f8
---
M src/host/layer23/include/osmocom/bb/common/l1ctl.h
M src/host/layer23/include/osmocom/bb/common/l23sap.h
M src/host/layer23/src/common/Makefile.am
D src/host/layer23/src/common/l1ctl_lapdm_glue.c
M src/host/layer23/src/common/l23sap.c
M src/host/layer23/src/common/main.c
M src/host/layer23/src/mobile/app_mobile.c
7 files changed, 40 insertions(+), 69 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/49/11249/1

diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
index e4dbded..e9d5be5 100644
--- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h
+++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
@@ -67,9 +67,6 @@
 int l1ctl_tx_traffic_req(struct osmocom_ms *ms, struct msgb *msg,
 			uint8_t chan_nr, uint8_t link_id);
 
-/* LAPDm wants to send a PH-* primitive to the physical layer (L1) */
-int l1ctl_ph_prim_cb(struct osmo_prim_hdr *oph, void *ctx);
-
 /* Transmit L1CTL_NEIGH_PM_REQ */
 int l1ctl_tx_neigh_pm_req(struct osmocom_ms *ms, int num, uint16_t *arfcn);
 
diff --git a/src/host/layer23/include/osmocom/bb/common/l23sap.h b/src/host/layer23/include/osmocom/bb/common/l23sap.h
index eaa62c1..ede5620 100644
--- a/src/host/layer23/include/osmocom/bb/common/l23sap.h
+++ b/src/host/layer23/include/osmocom/bb/common/l23sap.h
@@ -10,6 +10,8 @@
 #define CHAN_IS_SACCH(link_id) \
 	((link_id & 0xc0) == LID_SACCH)
 
+int l23sap_lapdm_ph_prim_cb(struct osmo_prim_hdr *oph, void *ctx);
+
 int l23sap_gsmtap_data_ind(struct osmocom_ms *ms, struct msgb *msg);
 int l23sap_gsmtap_data_req(struct osmocom_ms *ms, struct msgb *msg);
 
diff --git a/src/host/layer23/src/common/Makefile.am b/src/host/layer23/src/common/Makefile.am
index e1b7b44..2d26b49 100644
--- a/src/host/layer23/src/common/Makefile.am
+++ b/src/host/layer23/src/common/Makefile.am
@@ -3,4 +3,4 @@
 
 noinst_LIBRARIES = liblayer23.a
 liblayer23_a_SOURCES = l1ctl.c l1l2_interface.c sap_interface.c \
-	logging.c networks.c sim.c sysinfo.c gps.c l1ctl_lapdm_glue.c utils.c l23sap.c
+	logging.c networks.c sim.c sysinfo.c gps.c utils.c l23sap.c
diff --git a/src/host/layer23/src/common/l1ctl_lapdm_glue.c b/src/host/layer23/src/common/l1ctl_lapdm_glue.c
deleted file mode 100644
index 0b2a8ed..0000000
--- a/src/host/layer23/src/common/l1ctl_lapdm_glue.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Glue code between L1CTL and LAPDm */
-
-/* (C) 2011 by Harald Welte <laforge at gnumonks.org>
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#include <stdint.h>
-
-#include <l1ctl_proto.h>
-
-#include <osmocom/gsm/prim.h>
-
-#include <osmocom/bb/common/l1ctl.h>
-#include <osmocom/gsm/lapdm.h>
-
-/* LAPDm wants to send a PH-* primitive to the physical layer (L1) */
-int l1ctl_ph_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
-{
-	struct osmocom_ms *ms = ctx;
-	struct osmo_phsap_prim *pp = (struct osmo_phsap_prim *) oph;
-	int rc = 0;
-
-	if (oph->sap != SAP_GSM_PH)
-		return -ENODEV;
-
-	if (oph->operation != PRIM_OP_REQUEST)
-		return -EINVAL;
-
-	switch (oph->primitive) {
-	case PRIM_PH_DATA:
-		rc = l1ctl_tx_data_req(ms, oph->msg, pp->u.data.chan_nr,
-					pp->u.data.link_id);
-		break;
-	case PRIM_PH_RACH:
-		l1ctl_tx_param_req(ms, pp->u.rach_req.ta,
-				   pp->u.rach_req.tx_power);
-		rc = l1ctl_tx_rach_req(ms, pp->u.rach_req.ra,
-				       pp->u.rach_req.offset,
-				       pp->u.rach_req.is_combined_ccch);
-		break;
-	default:
-		rc = -EINVAL;
-	}
-
-	return rc;
-}
diff --git a/src/host/layer23/src/common/l23sap.c b/src/host/layer23/src/common/l23sap.c
index d034b27..a34f515 100644
--- a/src/host/layer23/src/common/l23sap.c
+++ b/src/host/layer23/src/common/l23sap.c
@@ -42,6 +42,7 @@
 
 #include <osmocom/bb/common/osmocom_data.h>
 #include <osmocom/bb/common/logging.h>
+#include <osmocom/bb/common/l1ctl.h>
 #include <osmocom/bb/common/l23sap.h>
 
 extern struct gsmtap_inst *gsmtap_inst;
@@ -155,3 +156,35 @@
 	return lapdm_phsap_up(&pp.oph,
 		&ms->lapdm_channel.lapdm_dcch);
 }
+
+/* LAPDm wants to send a PH-* primitive to the PHY (L1) */
+int l23sap_lapdm_ph_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
+{
+	struct osmocom_ms *ms = ctx;
+	struct osmo_phsap_prim *pp = (struct osmo_phsap_prim *) oph;
+	int rc = 0;
+
+	if (oph->sap != SAP_GSM_PH)
+		return -ENODEV;
+
+	if (oph->operation != PRIM_OP_REQUEST)
+		return -EINVAL;
+
+	switch (oph->primitive) {
+	case PRIM_PH_DATA:
+		rc = l1ctl_tx_data_req(ms, oph->msg, pp->u.data.chan_nr,
+					pp->u.data.link_id);
+		break;
+	case PRIM_PH_RACH:
+		l1ctl_tx_param_req(ms, pp->u.rach_req.ta,
+				   pp->u.rach_req.tx_power);
+		rc = l1ctl_tx_rach_req(ms, pp->u.rach_req.ra,
+				       pp->u.rach_req.offset,
+				       pp->u.rach_req.is_combined_ccch);
+		break;
+	default:
+		rc = -EINVAL;
+	}
+
+	return rc;
+}
diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c
index 693b10e..c3c7992 100644
--- a/src/host/layer23/src/common/main.c
+++ b/src/host/layer23/src/common/main.c
@@ -22,7 +22,7 @@
  */
 
 #include <osmocom/bb/common/osmocom_data.h>
-#include <osmocom/bb/common/l1ctl.h>
+#include <osmocom/bb/common/l23sap.h>
 #include <osmocom/bb/common/l1l2_interface.h>
 #include <osmocom/bb/common/sap_interface.h>
 #include <osmocom/bb/misc/layer3.h>
@@ -266,7 +266,7 @@
 	ms->lapdm_channel.lapdm_acch.l1_ctx = ms;
 	ms->lapdm_channel.lapdm_acch.l3_ctx = ms;
 	lapdm_channel_init(&ms->lapdm_channel, LAPDM_MODE_MS);
-	lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms);
+	lapdm_channel_set_l1(&ms->lapdm_channel, l23sap_lapdm_ph_prim_cb, ms);
 
 	rc = l23_app_init(ms);
 	if (rc < 0)
diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c
index b0e2a13..f420530 100644
--- a/src/host/layer23/src/mobile/app_mobile.c
+++ b/src/host/layer23/src/mobile/app_mobile.c
@@ -28,6 +28,7 @@
 #include <osmocom/bb/common/osmocom_data.h>
 #include <osmocom/bb/common/l1l2_interface.h>
 #include <osmocom/bb/common/l1ctl.h>
+#include <osmocom/bb/common/l23sap.h>
 #include <osmocom/bb/common/logging.h>
 #include <osmocom/bb/common/gps.h>
 #include <osmocom/bb/mobile/gsm48_rr.h>
@@ -195,7 +196,7 @@
 	ms->lapdm_channel.lapdm_acch.datalink[DL_SAPI3].dl.t200_sec =
 		T200_ACCH;
 	ms->lapdm_channel.lapdm_acch.datalink[DL_SAPI3].dl.t200_usec = 0;
-	lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms);
+	lapdm_channel_set_l1(&ms->lapdm_channel, l23sap_lapdm_ph_prim_cb, ms);
 
 	/* init SAP client before SIM card starts up */
 	osmosap_init(ms);

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic852b2b7f5a651b7a4debc83778ae24c687e85f8
Gerrit-Change-Number: 11249
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181006/eb3c4a0f/attachment.htm>


More information about the gerrit-log mailing list