layer2: Rename layer2.[ch] to l1ctl.[ch] as they only remote-control L1

This commit is contained in:
Harald Welte 2010-03-03 14:22:04 +01:00
parent 3a4148d7b8
commit 9c64d2869f
10 changed files with 66 additions and 31 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -20,7 +20,6 @@
*
*/
#include <osmocom/layer2.h>
#include <osmocom/osmocom_data.h>
#include <osmocom/debug.h>
#include <osmocore/protocol/gsm_04_08.h>

View File

@ -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;

View File

@ -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>

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)
{