diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2017-07-27 16:33:38 +0600 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2017-11-19 17:35:07 +0700 |
commit | 00bb1d5a79c48da0142590e519f6452e72fb5ac7 (patch) | |
tree | 4ea25631554611fd2cd021031d87fcf9cb448ee3 /src | |
parent | e6acd7bd075effc4906deb9b03b71a18a028da87 (diff) |
host/trxcon/scheduler: implement sched_clck_reset()
It's better to have the clock management API inside a single file.
Change-Id: I92772f3db404e70fdffd530779613196afec61c9
Diffstat (limited to 'src')
-rw-r--r-- | src/host/trxcon/sched_clck.c | 13 | ||||
-rw-r--r-- | src/host/trxcon/sched_trx.c | 13 | ||||
-rw-r--r-- | src/host/trxcon/scheduler.h | 1 |
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); |