diff --git a/src/host/layer2/include/osmocom/Makefile.am b/src/host/layer2/include/osmocom/Makefile.am index 30c989671..6014195c5 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 000000000..0d5cba683 --- /dev/null +++ b/src/host/layer2/include/osmocom/l1ctl.h @@ -0,0 +1,25 @@ +#ifndef osmocom_l1ctl_h +#define osmocom_l1ctl_h + +#include +#include + +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 97bd9e159..000000000 --- a/src/host/layer2/include/osmocom/layer2.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef osmocom_layer2_h -#define osmocom_layer2_h - -#include - -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 6fa4a3d93..d1f7f129a 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 7aef3ac8b..0254c188e 100644 --- a/src/host/layer2/src/gsmtap_util.c +++ b/src/host/layer2/src/gsmtap_util.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/src/host/layer2/src/layer2.c b/src/host/layer2/src/l1ctl.c similarity index 93% rename from src/host/layer2/src/layer2.c rename to src/host/layer2/src/l1ctl.c index 7c03fbb58..b8c636ab3 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 +/* Layer1 control code, talking L1CTL protocol with L1 on the phone */ + +/* (C) 2010 by Holger Hans Peter Freyther * (C) 2010 by Harald Welte * * All Rights Reserved @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -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 06f01c554..bdf2c2afc 100644 --- a/src/host/layer2/src/lapdm.c +++ b/src/host/layer2/src/lapdm.c @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include diff --git a/src/host/layer2/src/layer2_main.c b/src/host/layer2/src/layer2_main.c index 415a895ab..453fe6d7d 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 * @@ -21,7 +22,7 @@ */ #include -#include +#include #include #include @@ -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 158636aba..ea6491e69 100644 --- a/src/host/layer2/src/layer3.c +++ b/src/host/layer2/src/layer3.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include 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 317988c61..f45602955 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 + * + * 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 #include @@ -12,7 +33,7 @@ #include #include #include -#include +#include int rsl_dec_chan_nr(uint8_t chan_nr, uint8_t *type, uint8_t *subch, uint8_t *timeslot) {