aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcommon/acc_ramp.c
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 /src/libcommon/acc_ramp.c
parent98c8f0a2f3ce41283d404bb89c74f95d21ba5ce8 (diff)
Add skeleton for an acc ramp implementation.
Diffstat (limited to 'src/libcommon/acc_ramp.c')
-rw-r--r--src/libcommon/acc_ramp.c48
1 files changed, 48 insertions, 0 deletions
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);
+}