aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-17 17:01:54 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-30 21:20:45 +0100
commit67ed34eedb59320095396ff2f65f360c046d88c5 (patch)
treebcc95a63d7e70f22d4a9dd48f9e9b6dbd438d756
parent1b33361bab43835b69c3422f7de24a70ba8a13b5 (diff)
bts: Move struct gprs_rlcmac_bts and other structs into a bts.h
Begin to make the BTS a real C++ object with real responsibilities. The biggest issue will be the pcu_vty.c that might not like C++ at all.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/bts.h83
-rw-r--r--src/gprs_bssgp_pcu.cpp1
-rw-r--r--src/gprs_bssgp_pcu.h2
-rw-r--r--src/gprs_rlcmac.cpp1
-rw-r--r--src/gprs_rlcmac.h49
-rw-r--r--src/gprs_rlcmac_data.cpp1
-rw-r--r--src/gprs_rlcmac_sched.cpp1
-rw-r--r--src/pcu_l1_if.cpp1
-rw-r--r--src/pcu_main.cpp1
-rw-r--r--src/pcu_vty.c1
-rw-r--r--src/tbf.cpp1
-rw-r--r--src/tbf.h1
-rw-r--r--tests/emu/pcu_emu.cpp1
14 files changed, 97 insertions, 50 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e1b9ac69..f0fb7bd6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,7 +75,8 @@ noinst_HEADERS = \
pcu_vty.h \
sysmo_l1_if.h \
femtobts.h \
- tbf.h
+ tbf.h \
+ bts.h
osmo_pcu_SOURCES = pcu_main.cpp
diff --git a/src/bts.h b/src/bts.h
new file mode 100644
index 00000000..f17b3b72
--- /dev/null
+++ b/src/bts.h
@@ -0,0 +1,83 @@
+/* bts.h
+ *
+ * Copyright (C) 2012 Ivan Klyuchnikov
+ * Copyright (C) 2013 by Holger Hans Peter Freyther
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+
+#ifdef __cplusplus
+extern "C" {
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/timer.h>
+}
+#endif
+
+#include <stdint.h>
+
+struct gprs_rlcmac_tbf;
+
+/*
+ * PDCH instance
+ */
+struct gprs_rlcmac_pdch {
+ uint8_t enable; /* TS is enabled */
+ uint8_t tsc; /* TSC of this slot */
+ uint8_t next_ul_tfi; /* next uplink TBF/TFI to schedule (0..31) */
+ uint8_t next_dl_tfi; /* next downlink TBF/TFI to schedule (0..31) */
+ struct gprs_rlcmac_tbf *ul_tbf[32]; /* array of UL TBF, by UL TFI */
+ struct gprs_rlcmac_tbf *dl_tbf[32]; /* array of DL TBF, by DL TFI */
+ struct llist_head paging_list; /* list of paging messages */
+ uint32_t last_rts_fn; /* store last frame number of RTS */
+};
+
+struct gprs_rlcmac_trx {
+ void *fl1h;
+ uint16_t arfcn;
+ struct gprs_rlcmac_pdch pdch[8];
+ struct gprs_rlcmac_tbf *ul_tbf[32]; /* array of UL TBF, by UL TFI */
+ struct gprs_rlcmac_tbf *dl_tbf[32]; /* array of DL TBF, by DL TFI */
+};
+
+
+struct gprs_rlcmac_bts {
+ uint8_t bsic;
+ uint8_t fc_interval;
+ uint8_t cs1;
+ uint8_t cs2;
+ uint8_t cs3;
+ uint8_t cs4;
+ uint8_t initial_cs_dl, initial_cs_ul;
+ uint8_t force_cs; /* 0=use from BTS 1=use from VTY */
+ uint16_t force_llc_lifetime; /* overrides lifetime from SGSN */
+ uint8_t t3142;
+ uint8_t t3169;
+ uint8_t t3191;
+ uint16_t t3193_msec;
+ uint8_t t3195;
+ uint8_t n3101;
+ uint8_t n3103;
+ uint8_t n3105;
+ struct gprs_rlcmac_trx trx[8];
+ int (*alloc_algorithm)(struct gprs_rlcmac_bts *bts,
+ struct gprs_rlcmac_tbf *old_tbf,
+ struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single);
+ uint32_t alloc_algorithm_curst; /* options to customize algorithm */
+ uint8_t force_two_phase;
+ uint8_t alpha, gamma;
+};
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 3432bca8..d8ba09c7 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -21,6 +21,7 @@
#include <gprs_rlcmac.h>
#include <gprs_bssgp_pcu.h>
#include <pcu_l1_if.h>
+#include <bts.h>
#include <tbf.h>
static struct gprs_bssgp_pcu the_pcu = { 0, };
diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h
index 7156bf08..aedcfc00 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -42,6 +42,8 @@ struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei);
#define NS_HDR_LEN 4
#define IE_LLC_PDU 14
+struct gprs_rlcmac_bts;
+
struct gprs_bssgp_pcu {
struct gprs_nsvc *nsvc;
struct bssgp_bvc_ctx *bctx;
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 2de2dda5..77264816 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -22,6 +22,7 @@
#include <gprs_bssgp_pcu.h>
#include <pcu_l1_if.h>
#include <gprs_rlcmac.h>
+#include <bts.h>
#include <tbf.h>
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index a9c5b3db..2bc88cb1 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -41,58 +41,9 @@ extern "C" {
*/
//#define DEBUG_DL_ASS_IDLE
-/*
- * PDCH instanc
- */
struct gprs_rlcmac_tbf;
-struct gprs_rlcmac_pdch {
- uint8_t enable; /* TS is enabled */
- uint8_t tsc; /* TSC of this slot */
- uint8_t next_ul_tfi; /* next uplink TBF/TFI to schedule (0..31) */
- uint8_t next_dl_tfi; /* next downlink TBF/TFI to schedule (0..31) */
- struct gprs_rlcmac_tbf *ul_tbf[32]; /* array of UL TBF, by UL TFI */
- struct gprs_rlcmac_tbf *dl_tbf[32]; /* array of DL TBF, by DL TFI */
- struct llist_head paging_list; /* list of paging messages */
- uint32_t last_rts_fn; /* store last frame number of RTS */
-};
-
-struct gprs_rlcmac_trx {
- void *fl1h;
- uint16_t arfcn;
- struct gprs_rlcmac_pdch pdch[8];
- struct gprs_rlcmac_tbf *ul_tbf[32]; /* array of UL TBF, by UL TFI */
- struct gprs_rlcmac_tbf *dl_tbf[32]; /* array of DL TBF, by DL TFI */
-};
-
-struct gprs_rlcmac_bts {
- uint8_t bsic;
- uint8_t fc_interval;
- uint8_t cs1;
- uint8_t cs2;
- uint8_t cs3;
- uint8_t cs4;
- uint8_t initial_cs_dl, initial_cs_ul;
- uint8_t force_cs; /* 0=use from BTS 1=use from VTY */
- uint16_t force_llc_lifetime; /* overrides lifetime from SGSN */
- uint8_t t3142;
- uint8_t t3169;
- uint8_t t3191;
- uint16_t t3193_msec;
- uint8_t t3195;
- uint8_t n3101;
- uint8_t n3103;
- uint8_t n3105;
- struct gprs_rlcmac_trx trx[8];
- int (*alloc_algorithm)(struct gprs_rlcmac_bts *bts,
- struct gprs_rlcmac_tbf *old_tbf,
- struct gprs_rlcmac_tbf *tbf, uint32_t cust, uint8_t single);
- uint32_t alloc_algorithm_curst; /* options to customize algorithm */
- uint8_t force_two_phase;
- uint8_t alpha, gamma;
-};
-
extern struct gprs_rlcmac_bts *gprs_rlcmac_bts;
#ifdef __cplusplus
diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp
index 9f6651ce..bb268717 100644
--- a/src/gprs_rlcmac_data.cpp
+++ b/src/gprs_rlcmac_data.cpp
@@ -21,6 +21,7 @@
#include <gprs_bssgp_pcu.h>
#include <gprs_rlcmac.h>
#include <pcu_l1_if.h>
+#include <bts.h>
#include <tbf.h>
extern void *tall_pcu_ctx;
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index a7c2581d..67946df6 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -20,6 +20,7 @@
#include <gprs_bssgp_pcu.h>
#include <gprs_rlcmac.h>
#include <pcu_l1_if.h>
+#include <bts.h>
#include <tbf.h>
static uint32_t sched_poll(uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr,
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 26564bec..e70de556 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -37,6 +37,7 @@ extern "C" {
#include <gprs_debug.h>
#include <gprs_bssgp_pcu.h>
#include <pcuif_proto.h>
+#include <bts.h>
#include <tbf.h>
// FIXME: move this, when changed from c++ to c.
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index 754043f9..4ea42529 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -27,6 +27,7 @@
#include <getopt.h>
#include <signal.h>
#include <sched.h>
+#include <bts.h>
extern "C" {
#include "pcu_vty.h"
#include <osmocom/vty/telnet_interface.h>
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 3ab6865c..cdf808f0 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -6,6 +6,7 @@
#include <osmocom/core/linuxlist.h>
#include "pcu_vty.h"
#include "gprs_rlcmac.h"
+#include "bts.h"
enum node_type pcu_vty_go_parent(struct vty *vty)
{
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 3f6b92f1..27532604 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -19,6 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <bts.h>
#include <tbf.h>
#include <gprs_rlcmac.h>
#include <gprs_debug.h>
diff --git a/src/tbf.h b/src/tbf.h
index 9a8ff9a5..5464dd4f 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -19,6 +19,7 @@
#pragma once
#include "gprs_rlcmac.h"
+#include "bts.h"
#include <stdint.h>
diff --git a/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp
index b68b856c..4b58a8b8 100644
--- a/tests/emu/pcu_emu.cpp
+++ b/tests/emu/pcu_emu.cpp
@@ -29,6 +29,7 @@ extern "C" {
#include <gprs_bssgp_pcu.h>
#include <gprs_rlcmac.h>
+#include <bts.h>
#include <stdlib.h>
#include <sys/types.h>