2000-08-15 Dave Brolley <brolley@redhat.com>
[deliverable/binutils-gdb.git] / sim / common / sim-events.h
index dd69f0a05aa2eea09794a4e035f301948871e98f..55b2b740c918d334651747d21df071880840fbbe 100644 (file)
@@ -19,8 +19,8 @@
     */
 
 
-#ifndef _SIM_EVENTS_H_
-#define _SIM_EVENTS_H_
+#ifndef SIM_EVENTS_H
+#define SIM_EVENTS_H
 
 
 /* Notes:
@@ -89,7 +89,8 @@ struct _sim_events {
   sim_event *held;
   volatile int nr_held;
   /* timekeeping */
-  SIM_ELAPSED_TIME initial_wallclock;
+  unsigned long elapsed_wallclock;
+  SIM_ELAPSED_TIME resume_wallclock;
   signed64 time_of_event;
   int time_from_event;
   int trace;
@@ -99,54 +100,49 @@ struct _sim_events {
 
 /* Install the "events" module.  */
 
-EXTERN_SIM_EVENTS\
-(SIM_RC) sim_events_install (SIM_DESC sd);
+extern SIM_RC sim_events_install (SIM_DESC sd);
 
 
-/* Uninstall the "events" subsystem.  */
-
-EXTERN_SIM_EVENTS\
-(void)
-sim_events_uninstall (SIM_DESC sd);
-
-
-
-/* Initialization */
-
-EXTERN_SIM_EVENTS\
-(SIM_RC) sim_events_init (SIM_DESC sd);
-
-
-/* Set Tracing Level */
+/* Schedule an event DELTA_TIME ticks into the future */
 
-EXTERN_SIM_EVENTS\
-(void) sim_events_set_trace
+extern sim_event *sim_events_schedule
 (SIM_DESC sd,
- int level);
-
+ signed64 delta_time,
+ sim_event_handler *handler,
+ void *data);
 
-/* Schedule an event DELTA_TIME ticks into the future */
+extern sim_event *sim_events_schedule_tracef
+(SIM_DESC sd,
+ signed64 delta_time,
+ sim_event_handler *handler,
+ void *data,
+ const char *fmt,
+ ...) __attribute__ ((format (printf, 5, 6)));
 
-EXTERN_SIM_EVENTS\
-(sim_event *) sim_events_schedule
+extern sim_event *sim_events_schedule_vtracef
 (SIM_DESC sd,
  signed64 delta_time,
  sim_event_handler *handler,
- void *data);
+ void *data,
+ const char *fmt,
+ va_list ap);
 
-EXTERN_SIM_EVENTS\
-(void) sim_events_schedule_after_signal
+
+extern void sim_events_schedule_after_signal
 (SIM_DESC sd,
  signed64 delta_time,
  sim_event_handler *handler,
  void *data);
 
+/* NB: signal level events can't have trace strings as malloc isn't
+   available */
+
+
 
 /* Schedule an event milli-seconds from NOW.  The exact interpretation
    of wallclock is host dependant. */
 
-EXTERN_SIM_EVENTS\
-(sim_event *) sim_events_watch_clock
+extern sim_event *sim_events_watch_clock
 (SIM_DESC sd,
  unsigned delta_ms_time,
  sim_event_handler *handler,
@@ -160,8 +156,7 @@ EXTERN_SIM_EVENTS\
    HOST_ADDR: pointer into the host address space.
    BYTE_ORDER: 0 - host endian; BIG_ENDIAN; LITTLE_ENDIAN */
 
-EXTERN_SIM_EVENTS\
-(sim_event*) sim_events_watch_sim
+extern sim_event *sim_events_watch_sim
 (SIM_DESC sd,
  void *host_addr,
  int nr_bytes,
@@ -180,11 +175,10 @@ EXTERN_SIM_EVENTS\
    CORE_ADDR/MAP: pointer into the target address space.
    BYTE_ORDER: 0 - current target endian; BIG_ENDIAN; LITTLE_ENDIAN */
 
-EXTERN_SIM_EVENTS\
-(sim_event*) sim_events_watch_core
+extern sim_event *sim_events_watch_core
 (SIM_DESC sd,
  address_word core_addr,
sim_core_maps core_map,
unsigned map,
  int nr_bytes,
  int byte_order,
  int is_within,
@@ -195,8 +189,7 @@ EXTERN_SIM_EVENTS\
 
 /* Deschedule the specified event */
 
-EXTERN_SIM_EVENTS\
-(void) sim_events_deschedule
+extern void sim_events_deschedule
 (SIM_DESC sd,
  sim_event *event_to_remove);
 
@@ -205,7 +198,7 @@ EXTERN_SIM_EVENTS\
    is not event processing.
 
    If the simulator halted part way through event processing then both
-   EVENTS_WERE_LAST and EVENTS_WERE_FIRST shall be true.
+   EVENTS_WERE_LAST and EVENTS_WERE_NEXT shall be true.
 
    If the simulator halted after processing the last cpu, then only
    EVENTS_WERE_NEXT shall be true. */
@@ -217,10 +210,16 @@ INLINE_SIM_EVENTS\
  int events_were_next);
 
 
-/* Progress time - separated into two parts so that the main loop can
-   save its context before the event queue is processed.
+/* Progress time.
+
+   Separated into two parts so that the main loop can save its context
+   before the event queue is processed.  When sim_events_tick*()
+   returns true, any simulation context should be saved and
+   sim_events_process() called.
+
+   SIM_EVENTS_TICK advances the clock by 1 cycle.
 
-   sim_events_tickn advances the clock by N cycles (1..MAXINT) */
+   SIM_EVENTS_TICKN advances the clock by N cycles (1..MAXINT). */
 
 INLINE_SIM_EVENTS\
 (int) sim_events_tick
@@ -236,6 +235,16 @@ INLINE_SIM_EVENTS\
 (SIM_DESC sd);
 
 
+/* Advance the clock by an additional SLIP cycles at the next call to
+   sim_events_tick*().  For multiple calls, the effect is
+   accumulative. */
+
+INLINE_SIM_EVENTS\
+(void) sim_events_slip
+(SIM_DESC sd,
+ int slip);
+
+
 /* Progress time such that an event shall occure upon the next call to
    sim_events tick */
 
@@ -246,11 +255,23 @@ INLINE_SIM_EVENTS\
 #endif
 
 
-/* local concept of time */
+/* local concept of elapsed target time */
 
 INLINE_SIM_EVENTS\
 (signed64) sim_events_time
 (SIM_DESC sd);
 
 
+/* local concept of elapsed host time (milliseconds) */
+
+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
This page took 0.024855 seconds and 4 git commands to generate.