summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-27 16:33:38 +0600
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commit205d500008411e356e8e56a7f9ff20f0a62efd5f (patch)
treeb8b0cd7528d6e9c3acf98e9e5ecac48b9fd107d5
parente466974627f9483434f1314eff3e6f210f8389dd (diff)
host/trxcon/scheduler: implement sched_clck_reset()
It's better to have the clock management API inside a single file. Change-Id: I92772f3db404e70fdffd530779613196afec61c9
-rw-r--r--src/host/trxcon/sched_clck.c13
-rw-r--r--src/host/trxcon/sched_trx.c13
-rw-r--r--src/host/trxcon/scheduler.h1
3 files changed, 16 insertions, 11 deletions
diff --git a/src/host/trxcon/sched_clck.c b/src/host/trxcon/sched_clck.c
index 9c1edc5b..d57d07e1 100644
--- a/src/host/trxcon/sched_clck.c
+++ b/src/host/trxcon/sched_clck.c
@@ -198,3 +198,16 @@ int sched_clck_handle(struct trx_sched *sched, uint32_t fn)
return 0;
}
+
+void sched_clck_reset(struct trx_sched *sched)
+{
+ /* Reset internal state */
+ sched->state = SCH_CLCK_STATE_WAIT;
+
+ /* Stop clock timer */
+ osmo_timer_del(&sched->clock_timer);
+
+ /* Flush counters */
+ sched->fn_counter_proc = 0;
+ sched->fn_counter_lost = 0;
+}
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index cc9b1ce6..04fc5cf1 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -130,7 +130,6 @@ int sched_trx_shutdown(struct trx_instance *trx)
int sched_trx_reset(struct trx_instance *trx)
{
- struct trx_sched *sched;
int i;
if (!trx)
@@ -144,16 +143,8 @@ int sched_trx_reset(struct trx_instance *trx)
INIT_LLIST_HEAD(&trx->ts_list);
- /* Obtain a scheduler instance from TRX */
- sched = &trx->sched;
-
- /* Reset clock counter */
- osmo_timer_del(&sched->clock_timer);
- sched->fn_counter_proc = 0;
- sched->fn_counter_lost = 0;
-
- /* Reset internal state */
- sched->state = SCH_CLCK_STATE_WAIT;
+ /* Stop and reset clock counter */
+ sched_clck_reset(&trx->sched);
return 0;
}
diff --git a/src/host/trxcon/scheduler.h b/src/host/trxcon/scheduler.h
index 0783e40a..b025d918 100644
--- a/src/host/trxcon/scheduler.h
+++ b/src/host/trxcon/scheduler.h
@@ -35,3 +35,4 @@ struct trx_sched {
};
int sched_clck_handle(struct trx_sched *sched, uint32_t fn);
+void sched_clck_reset(struct trx_sched *sched);