From 8c10ae6de141649c401825192c7d4ea751898cd2 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Tue, 6 Feb 2018 15:13:06 +0100 Subject: Add skeleton for an acc ramp implementation. Change-Id: I49bd1bf6c0ef0441b6d5d3dec6b7c39545eedeec --- include/osmocom/bsc/acc_ramp.h | 5 +++++ src/libcommon/Makefile.am | 1 + src/libcommon/acc_ramp.c | 48 ++++++++++++++++++++++++++++++++++++++++++ src/libcommon/gsm_data.c | 3 +++ 4 files changed, 57 insertions(+) create mode 100644 src/libcommon/acc_ramp.c 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 +#include #include @@ -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 + * + * 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 . + * + */ + +#include + +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 #include #include +#include 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); -- cgit v1.2.3