dm: add absolute timer mode
Allow specifying the initial expiration in absolute time. Tracked-On: #2319 Signed-off-by: Peter Fang <peter.fang@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
d1e1aa3077
commit
0f7535fdbe
|
@ -102,7 +102,7 @@ acrn_timer_deinit(struct acrn_timer *timer)
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
acrn_timer_settime(struct acrn_timer *timer, struct itimerspec *new_value)
|
acrn_timer_settime(struct acrn_timer *timer, const struct itimerspec *new_value)
|
||||||
{
|
{
|
||||||
if (timer == NULL) {
|
if (timer == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -111,6 +111,17 @@ acrn_timer_settime(struct acrn_timer *timer, struct itimerspec *new_value)
|
||||||
return timerfd_settime(timer->fd, 0, new_value, NULL);
|
return timerfd_settime(timer->fd, 0, new_value, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t
|
||||||
|
acrn_timer_settime_abs(struct acrn_timer *timer,
|
||||||
|
const struct itimerspec *new_value)
|
||||||
|
{
|
||||||
|
if (timer == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return timerfd_settime(timer->fd, TFD_TIMER_ABSTIME, new_value, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
acrn_timer_gettime(struct acrn_timer *timer, struct itimerspec *cur_value)
|
acrn_timer_gettime(struct acrn_timer *timer, struct itimerspec *cur_value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,10 @@ acrn_timer_init(struct acrn_timer *timer, void (*cb)(void *), void *param);
|
||||||
void
|
void
|
||||||
acrn_timer_deinit(struct acrn_timer *timer);
|
acrn_timer_deinit(struct acrn_timer *timer);
|
||||||
int32_t
|
int32_t
|
||||||
acrn_timer_settime(struct acrn_timer *timer, struct itimerspec *new_value);
|
acrn_timer_settime(struct acrn_timer *timer, const struct itimerspec *new_value);
|
||||||
|
int32_t
|
||||||
|
acrn_timer_settime_abs(struct acrn_timer *timer,
|
||||||
|
const struct itimerspec *new_value);
|
||||||
int32_t
|
int32_t
|
||||||
acrn_timer_gettime(struct acrn_timer *timer, struct itimerspec *cur_value);
|
acrn_timer_gettime(struct acrn_timer *timer, struct itimerspec *cur_value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue