aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-02-06 15:13:06 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-02-06 15:13:06 +0100
commit8c10ae6de141649c401825192c7d4ea751898cd2 (patch)
treec6857e19bd28317738c4eeb70d94365b5a99d4ce
parent98c8f0a2f3ce41283d404bb89c74f95d21ba5ce8 (diff)
Add skeleton for an acc ramp implementation.
-rw-r--r--include/osmocom/bsc/acc_ramp.h5
-rw-r--r--src/libcommon/Makefile.am1
-rw-r--r--src/libcommon/acc_ramp.c48
-rw-r--r--src/libcommon/gsm_data.c3
4 files changed, 57 insertions, 0 deletions
diff --git a/include/osmocom/bsc/acc_ramp.h b/include/osmocom/bsc/acc_ramp.h
index 73bd2cc17..ad31f8f56 100644
--- a/include/osmocom/bsc/acc_ramp.h
+++ b/include/osmocom/bsc/acc_ramp.h
@@ -21,6 +21,7 @@
#define _ACC_RAMP_H_
#include <stdbool.h>
+#include <stdint.h>
#include <osmocom/core/timer.h>
@@ -73,4 +74,8 @@ struct acc_ramp {
struct osmo_timer_list step_timer;
};
+void acc_ramp_init(struct acc_ramp *acc_ramp);
+void acc_ramp_start(struct acc_ramp *acc_ramp);
+void acc_ramp_stop(struct acc_ramp *acc_ramp);
+
#endif /* _ACC_RAMP_H_ */
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 9f7e7b9e9..05784a0b6 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,6 +20,7 @@ noinst_LIBRARIES = \
$(NULL)
libcommon_a_SOURCES = \
+ acc_ramp.c \
bsc_version.c \
common_vty.c \
debug.c \
diff --git a/src/libcommon/acc_ramp.c b/src/libcommon/acc_ramp.c
new file mode 100644
index 000000000..c8574be2a
--- /dev/null
+++ b/src/libcommon/acc_ramp.c
@@ -0,0 +1,48 @@
+/* (C) 2018 Stefan Sperling <ssperling@sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <osmocom/bsc/acc_ramp.h>
+
+static void acc_ramp_timer_step(void *data)
+{
+ struct acc_ramp *acc_ramp = data;
+}
+
+void acc_ramp_init(struct acc_ramp *acc_ramp)
+{
+ acc_ramp->barred_t2 = 0x03; /* AC8, AC9 barred */
+ acc_ramp->barred_t3 = 0xff; /* AC0 - AC7 barred */
+
+ acc_ramp->step_size = ACC_RAMP_STEP_SIZE_DEFAULT;
+ acc_ramp->step_interval_sec = ACC_RAMP_STEP_INTERVAL_DEFAULT;
+ acc_ramp->step_interval_is_fixed = false;
+ osmo_timer_setup(&acc_ramp->step_timer, acc_ramp_timer_step, acc_ramp);
+}
+
+void acc_ramp_start(struct acc_ramp *acc_ramp)
+{
+ acc_ramp_stop(acc_ramp);
+ osmo_timer_schedule(&acc_ramp->step_timer, acc_ramp->step_interval_sec, 0);
+}
+
+void acc_ramp_stop(struct acc_ramp *acc_ramp)
+{
+ if (osmo_timer_pending(&acc_ramp->step_timer))
+ osmo_timer_del(&acc_ramp->step_timer);
+}
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index 92ebbfe0c..443481b54 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -38,6 +38,7 @@
#include <osmocom/bsc/bsc_msc_data.h>
#include <osmocom/bsc/abis_nm.h>
#include <osmocom/bsc/handover_cfg.h>
+#include <osmocom/bsc/acc_ramp.h>
void *tall_bsc_ctx;
@@ -260,6 +261,8 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ
bts->si_common.chan_desc.t3212 = net->t3212; /* Use network's current value */
gsm_bts_set_radio_link_timeout(bts, 32); /* Use RADIO LINK TIMEOUT of 32 */
+ acc_ramp_init(&bts->acc_ramp);
+
llist_add_tail(&bts->list, &net->bts_list);
INIT_LLIST_HEAD(&bts->abis_queue);