mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
hw/ptimer: Introduce timer policy feature
Some of the timer devices may behave differently from what ptimer provides. Introduce ptimer policy feature that allows ptimer users to change default and wrong timer behaviour, for example to continuously trigger periodic timer when load value is equal to "0". Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Message-id: 994cd608ec392da6e58f0643800dda595edb9d97.1473252818.git.digetx@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
780d23e54e
commit
e7ea81c37d
24 changed files with 57 additions and 31 deletions
|
@ -21,6 +21,7 @@ struct ptimer_state
|
|||
int64_t period;
|
||||
int64_t last_event;
|
||||
int64_t next_event;
|
||||
uint8_t policy_mask;
|
||||
QEMUBH *bh;
|
||||
QEMUTimer *timer;
|
||||
};
|
||||
|
@ -243,12 +244,13 @@ const VMStateDescription vmstate_ptimer = {
|
|||
}
|
||||
};
|
||||
|
||||
ptimer_state *ptimer_init(QEMUBH *bh)
|
||||
ptimer_state *ptimer_init(QEMUBH *bh, uint8_t policy_mask)
|
||||
{
|
||||
ptimer_state *s;
|
||||
|
||||
s = (ptimer_state *)g_malloc0(sizeof(ptimer_state));
|
||||
s->bh = bh;
|
||||
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ptimer_tick, s);
|
||||
s->policy_mask = policy_mask;
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue