summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-10-06 16:16:09 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-11-21 11:03:10 +0700
commit1fd4105277ca20c759fa4efddfaee9694cced04a (patch)
treea4f874961138ecbaf06008ffc67e6cc6330e5a7c
parentbcb903b3fcfba31340b3b921f875e3025670b0f1 (diff)
layer23/common: merge l1ctl_ph_prim_cb() to L23SAP
-rw-r--r--src/host/layer23/include/osmocom/bb/common/l1ctl.h3
-rw-r--r--src/host/layer23/include/osmocom/bb/common/l23sap.h2
-rw-r--r--src/host/layer23/src/common/Makefile.am2
-rw-r--r--src/host/layer23/src/common/l1ctl_lapdm_glue.c62
-rw-r--r--src/host/layer23/src/common/l23sap.c33
-rw-r--r--src/host/layer23/src/common/main.c4
-rw-r--r--src/host/layer23/src/mobile/app_mobile.c3
7 files changed, 40 insertions, 69 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
index e4dbdedc..e9d5be57 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_sim_req(struct osmocom_ms *ms, uint8_t *data, uint16_t length);
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 eaa62c14..ede56203 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 e1b7b448..2d26b494 100644
--- a/src/host/layer23/src/common/Makefile.am
+++ b/src/host/layer23/src/common/Makefile.am
@@ -3,4 +3,4 @@ AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBGPS_CFLAGS)
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 0b2a8ed5..00000000
--- 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@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 d034b272..a34f5156 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 @@ int l23sap_rach_conf(struct osmocom_ms *ms, struct msgb *msg)
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 2920cd9e..a4577190 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>
@@ -267,7 +267,7 @@ int main(int argc, char **argv)
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 f53445a6..8885db7d 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 @@ static int mobile_init(struct osmocom_ms *ms)
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);