From 38e64f358e2894319381e195c699c337b6dbb29d Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 27 Jul 2000 11:37:34 +0000 Subject: [PATCH] 2000-06-25 Stephane Carrez * sim-events.c (sim_events_remain_time): New function returning the time that remains before the event is raised. * hw-events.c (hw_event_remain_time): Likewise. * sim-events.h (sim_events_remain_time): Declare. * hw-events.h (hw_event_remain_time): Declare. --- sim/common/ChangeLog | 7 +++++++ sim/common/hw-events.c | 9 +++++++++ sim/common/hw-events.h | 4 ++++ sim/common/sim-events.c | 13 +++++++++++++ sim/common/sim-events.h | 6 ++++++ 5 files changed, 39 insertions(+) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 1a12066058..eb07b9204b 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,12 @@ Thu Jul 27 20:37:47 2000 Andrew Cagney + From 2000-06-25 Stephane Carrez : + * sim-events.c (sim_events_remain_time): New function returning + the time that remains before the event is raised. + * hw-events.c (hw_event_remain_time): Likewise. + * sim-events.h (sim_events_remain_time): Declare. + * hw-events.h (hw_event_remain_time): Declare. + From 2000-06-25 Stephane Carrez : * sim-hw.c: Use instead of (OPTION_HW_LIST): New option --hw-list to list the devices. diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c index 31c5a4026a..f60dfa32e6 100644 --- a/sim/common/hw-events.c +++ b/sim/common/hw-events.c @@ -164,6 +164,15 @@ hw_event_queue_time (struct hw *me) return sim_events_time (hw_system (me)); } +/* Returns the time that remains before the event is raised. */ +signed64 +hw_event_remain_time (struct hw *me, struct hw_event *event) +{ + signed64 t; + + t = sim_events_remain_time (hw_system (me), event->real); + return t; +} /* Only worry about this compling on ANSI systems. Build with `make test-hw-events' in sim/ directory*/ diff --git a/sim/common/hw-events.h b/sim/common/hw-events.h index a9b6f8b5dc..29e10fac08 100644 --- a/sim/common/hw-events.h +++ b/sim/common/hw-events.h @@ -58,4 +58,8 @@ void hw_event_queue_deschedule signed64 hw_event_queue_time (struct hw *me); +/* Returns the time that remains before the event is raised. */ +signed64 hw_event_remain_time +(struct hw *me, struct hw_event *event); + #endif diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c index fa294a7e14..1866b2dccd 100644 --- a/sim/common/sim-events.c +++ b/sim/common/sim-events.c @@ -379,6 +379,19 @@ sim_events_elapsed_time (SIM_DESC sd) } +/* Returns the time that remains before the event is raised. */ +INLINE_SIM_EVENTS\ +(signed64) +sim_events_remain_time (SIM_DESC sd, sim_event *event) +{ + if (event == 0) + return 0; + + return (event->time_of_event - sim_events_time (sd)); +} + + + STATIC_INLINE_SIM_EVENTS\ (void) update_time_from_event (SIM_DESC sd) diff --git a/sim/common/sim-events.h b/sim/common/sim-events.h index 3bae3dfbde..55b2b740c9 100644 --- a/sim/common/sim-events.h +++ b/sim/common/sim-events.h @@ -268,4 +268,10 @@ INLINE_SIM_EVENTS\ (unsigned long) sim_events_elapsed_time (SIM_DESC sd); +/* Returns the time that remains before the event is raised. */ +INLINE_SIM_EVENTS\ +(signed64) sim_events_remain_time +(SIM_DESC sd, sim_event *event); + + #endif