summaryrefslogtreecommitdiffstats
path: root/src/host/layer2
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/layer2')
-rw-r--r--src/host/layer2/include/osmocom/Makefile.am2
-rw-r--r--src/host/layer2/include/osmocom/l1ctl.h25
-rw-r--r--src/host/layer2/include/osmocom/layer2.h16
-rw-r--r--src/host/layer2/src/Makefile.am2
-rw-r--r--src/host/layer2/src/gsmtap_util.c1
-rw-r--r--src/host/layer2/src/l1ctl.c (renamed from src/host/layer2/src/layer2.c)17
-rw-r--r--src/host/layer2/src/lapdm.c2
-rw-r--r--src/host/layer2/src/layer2_main.c7
-rw-r--r--src/host/layer2/src/layer3.c2
-rw-r--r--src/host/layer2/src/rslms.c23
10 files changed, 66 insertions, 31 deletions
diff --git a/src/host/layer2/include/osmocom/Makefile.am b/src/host/layer2/include/osmocom/Makefile.am
index 30c9896..6014195 100644
--- a/src/host/layer2/include/osmocom/Makefile.am
+++ b/src/host/layer2/include/osmocom/Makefile.am
@@ -1,3 +1,3 @@
# headers from OpenBSC
noinst_HEADERS = debug.h
-noinst_HEADERS += layer2.h osmocom_data.h lapdm.h rslms.h layer3.h
+noinst_HEADERS += l1ctl.h osmocom_data.h lapdm.h rslms.h layer3.h
diff --git a/src/host/layer2/include/osmocom/l1ctl.h b/src/host/layer2/include/osmocom/l1ctl.h
new file mode 100644
index 0000000..0d5cba6
--- /dev/null
+++ b/src/host/layer2/include/osmocom/l1ctl.h
@@ -0,0 +1,25 @@
+#ifndef osmocom_l1ctl_h
+#define osmocom_l1ctl_h
+
+#include <osmocore/msgb.h>
+#include <osmocom/osmocom_data.h>
+
+struct osmocom_ms;
+
+/* Receive incoming data from L1 using L1CTL format */
+int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg);
+
+/* Transmit L1CTL_DATA_REQ */
+int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg,
+ uint8_t chan_nr, uint8_t link_id);
+
+/* Transmit L1CTL_RACH_REQ */
+int tx_ph_rach_req(struct osmocom_ms *ms);
+
+/* Transmit L1CTL_DM_EST_REQ */
+int tx_ph_dm_est_req(struct osmocom_ms *ms, uint16_t band_arfcn, uint8_t chan_nr);
+
+extern int osmo_send_l1(struct osmocom_ms *ms, struct msgb *msg);
+
+
+#endif
diff --git a/src/host/layer2/include/osmocom/layer2.h b/src/host/layer2/include/osmocom/layer2.h
deleted file mode 100644
index 97bd9e1..0000000
--- a/src/host/layer2/include/osmocom/layer2.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef osmocom_layer2_h
-#define osmocom_layer2_h
-
-#include <osmocore/msgb.h>
-
-struct osmocom_ms;
-
-int osmo_recv(struct osmocom_ms *ms, struct msgb *msg);
-
-int tx_ph_rach_req(struct osmocom_ms *ms);
-int tx_ph_dm_est_req(struct osmocom_ms *ms, uint16_t band_arfcn, uint8_t chan_nr);
-
-extern int osmo_send_l1(struct osmocom_ms *ms, struct msgb *msg);
-
-
-#endif
diff --git a/src/host/layer2/src/Makefile.am b/src/host/layer2/src/Makefile.am
index 6fa4a3d..d1f7f12 100644
--- a/src/host/layer2/src/Makefile.am
+++ b/src/host/layer2/src/Makefile.am
@@ -5,5 +5,5 @@ noinst_LIBRARIES = libosmocom.a
libosmocom_a_SOURCES = libosmocom/debug.c
sbin_PROGRAMS = layer2
-layer2_SOURCES = layer2_main.c layer2.c gsmtap_util.c lapdm.c rslms.c layer3.c
+layer2_SOURCES = layer2_main.c l1ctl.c gsmtap_util.c lapdm.c rslms.c layer3.c
layer2_LDADD = libosmocom.a $(LIBOSMOCORE_LIBS)
diff --git a/src/host/layer2/src/gsmtap_util.c b/src/host/layer2/src/gsmtap_util.c
index 7aef3ac..0254c18 100644
--- a/src/host/layer2/src/gsmtap_util.c
+++ b/src/host/layer2/src/gsmtap_util.c
@@ -20,7 +20,6 @@
*
*/
-#include <osmocom/layer2.h>
#include <osmocom/osmocom_data.h>
#include <osmocom/debug.h>
#include <osmocore/protocol/gsm_04_08.h>
diff --git a/src/host/layer2/src/layer2.c b/src/host/layer2/src/l1ctl.c
index 7c03fbb..b8c636a 100644
--- a/src/host/layer2/src/layer2.c
+++ b/src/host/layer2/src/l1ctl.c
@@ -1,6 +1,6 @@
-/* Layer2 handling code... LAPD and stuff
- *
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
+/* Layer1 control code, talking L1CTL protocol with L1 on the phone */
+
+/* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
@@ -33,7 +33,7 @@
#include <osmocore/protocol/gsm_04_08.h>
#include <osmocore/protocol/gsm_08_58.h>
-#include <osmocom/layer2.h>
+#include <osmocom/l1ctl.h>
#include <osmocom/osmocom_data.h>
#include <osmocom/lapdm.h>
#include <osmocom/debug.h>
@@ -110,7 +110,7 @@ char *chan_nr2string(uint8_t chan_nr)
return str;
}
-/* Data Indication from L1 */
+/* Receive L1CTL_DATA_IND (Data Indication from L1) */
static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
{
struct l1ctl_info_dl *dl, dl_cpy;
@@ -150,6 +150,7 @@ static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
return 0;
}
+/* Transmit L1CTL_DATA_REQ */
int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg,
uint8_t chan_nr, uint8_t link_id)
{
@@ -180,6 +181,7 @@ int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg,
return osmo_send_l1(ms, msg);
}
+/* Receive L1CTL_RESET */
static int rx_l1_reset(struct osmocom_ms *ms)
{
struct msgb *msg;
@@ -196,6 +198,7 @@ static int rx_l1_reset(struct osmocom_ms *ms)
return osmo_send_l1(ms, msg);
}
+/* Transmit L1CTL_RACH_REQ */
int tx_ph_rach_req(struct osmocom_ms *ms)
{
struct msgb *msg;
@@ -213,6 +216,7 @@ int tx_ph_rach_req(struct osmocom_ms *ms)
return osmo_send_l1(ms, msg);
}
+/* Transmit L1CTL_DM_EST_REQ */
int tx_ph_dm_est_req(struct osmocom_ms *ms, uint16_t band_arfcn, uint8_t chan_nr)
{
struct msgb *msg;
@@ -236,7 +240,8 @@ int tx_ph_dm_est_req(struct osmocom_ms *ms, uint16_t band_arfcn, uint8_t chan_nr
}
-int osmo_recv(struct osmocom_ms *ms, struct msgb *msg)
+/* Receive incoming data from L1 using L1CTL format */
+int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
{
int rc = 0;
struct l1ctl_info_dl *dl;
diff --git a/src/host/layer2/src/lapdm.c b/src/host/layer2/src/lapdm.c
index 06f01c5..bdf2c2a 100644
--- a/src/host/layer2/src/lapdm.c
+++ b/src/host/layer2/src/lapdm.c
@@ -34,7 +34,7 @@
#include <osmocom/debug.h>
#include <osmocom/osmocom_data.h>
-#include <osmocom/layer2.h>
+#include <osmocom/l1ctl.h>
#include <osmocom/lapdm.h>
#include <l1a_l23_interface.h>
diff --git a/src/host/layer2/src/layer2_main.c b/src/host/layer2/src/layer2_main.c
index 415a895..453fe6d 100644
--- a/src/host/layer2/src/layer2_main.c
+++ b/src/host/layer2/src/layer2_main.c
@@ -1,4 +1,5 @@
-/* Main method of the layer2 stack */
+/* Main method of the layer2/3 stack */
+
/* (C) 2010 by Holger Hans Peter Freyther
* (C) 2010 by Harald Welte <laforge@gnumonks.org>
*
@@ -21,7 +22,7 @@
*/
#include <osmocom/osmocom_data.h>
-#include <osmocom/layer2.h>
+#include <osmocom/l1ctl.h>
#include <osmocom/lapdm.h>
#include <osmocom/debug.h>
@@ -84,7 +85,7 @@ static int layer2_read(struct bsc_fd *fd, unsigned int flags)
return -1;
}
- osmo_recv((struct osmocom_ms *) fd->data, msg);
+ l1ctl_recv((struct osmocom_ms *) fd->data, msg);
msgb_free(msg);
return 0;
}
diff --git a/src/host/layer2/src/layer3.c b/src/host/layer2/src/layer3.c
index 158636a..ea6491e 100644
--- a/src/host/layer2/src/layer3.c
+++ b/src/host/layer2/src/layer3.c
@@ -11,7 +11,7 @@
#include <osmocom/rslms.h>
#include <osmocom/layer3.h>
#include <osmocom/osmocom_data.h>
-#include <osmocom/layer2.h>
+#include <osmocom/l1ctl.h>
static void dump_bcch(uint8_t tc, const uint8_t *data)
{
diff --git a/src/host/layer2/src/rslms.c b/src/host/layer2/src/rslms.c
index 317988c..f456029 100644
--- a/src/host/layer2/src/rslms.c
+++ b/src/host/layer2/src/rslms.c
@@ -1,3 +1,24 @@
+/* RSLms - GSM 08.58 like protocol between L2 and L3 of GSM Um interface */
+
+/* (C) 2010 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 <errno.h>
@@ -12,7 +33,7 @@
#include <osmocom/rslms.h>
#include <osmocom/layer3.h>
#include <osmocom/osmocom_data.h>
-#include <osmocom/layer2.h>
+#include <osmocom/l1ctl.h>
int rsl_dec_chan_nr(uint8_t chan_nr, uint8_t *type, uint8_t *subch, uint8_t *timeslot)
{