host/trxcon/scheduler: implement sched_clck_reset()

It's better to have the clock management API inside a single file.

Change-Id: I92772f3db404e70fdffd530779613196afec61c9
This commit is contained in:
Vadim Yanitskiy 2017-07-27 16:33:38 +06:00
parent e6acd7bd07
commit 00bb1d5a79
3 changed files with 16 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);