diff options
author | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:34:07 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:34:07 +0000 |
commit | 071ea11e85eb9d529cc5eb3d35f6247466a21b99 (patch) | |
tree | 5deda65b8d7b04d1f4cbc534c3206d328e1267ec /sim/common/hw-events.c | |
parent | 1730ec6b1848f0f32154277f788fb29f88d8475b (diff) | |
download | gdb-071ea11e85eb9d529cc5eb3d35f6247466a21b99.zip gdb-071ea11e85eb9d529cc5eb3d35f6247466a21b99.tar.gz gdb-071ea11e85eb9d529cc5eb3d35f6247466a21b99.tar.bz2 |
Initial creation of sourceware repository
Diffstat (limited to 'sim/common/hw-events.c')
-rw-r--r-- | sim/common/hw-events.c | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c deleted file mode 100644 index ca6d441..0000000 --- a/sim/common/hw-events.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Hardware event manager. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB, the GNU debugger. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -#include "sim-main.h" -#include "hw-base.h" - -#include "sim-events.h" - - -/* The hw-events object is implemented using sim-events */ - -struct hw_event { - void *data; - struct hw *me; - hw_event_callback *callback; - sim_event *real; - struct hw_event_data *entry; -}; - -struct hw_event_data { - struct hw_event event; - struct hw_event_data *next; - struct hw_event_data **prev; -}; - -void -create_hw_event_data (struct hw *me) -{ - /* NOP */ -} - -void -delete_hw_event_data (struct hw *me) -{ - if (me->events_of_hw != NULL) - hw_abort (me, "stray events"); -} - - -static void -delete_hw_event (struct hw *me, - struct hw_event **event) -{ - struct hw_event_data *entry = (*event)->entry; - *(entry->prev) = entry->next; - entry->next->prev = entry->prev; - (*event) = NULL; -} - - -static void -create_hw_event (struct hw *me, - struct hw_event **event) -{ - struct hw_event_data *entry = HW_ZALLOC (me, struct hw_event_data); - entry->next = me->events_of_hw; - entry->prev = &me->events_of_hw; - me->events_of_hw->prev = &entry->next; - me->events_of_hw = entry; - (*event) = &entry->event; -} - - - -/* Pass the H/W event onto the real callback */ - -static void -bounce_hw_event (SIM_DESC sd, - void *data) -{ - /* save the data */ - struct hw_event *event = (struct hw_event*)data; - struct hw *me = event->me; - void *event_data = event->data; - hw_event_callback *callback = event->callback; - hw_free (me, data); - event = NULL; - callback (me, event_data); -} - - - -/* Map onto the event functions */ - -struct hw_event * -hw_event_queue_schedule (struct hw *me, - signed64 delta_time, - hw_event_callback *callback, - void *data) -{ - struct hw_event *event; - create_hw_event (me, &event); - /* fill it in */ - event->data = data; - event->callback = callback; - event->me = me; - event->real = sim_events_schedule (hw_system (me), - delta_time, - bounce_hw_event, - event); - return event; -} - - -void -hw_event_queue_deschedule (struct hw *me, - struct hw_event *event_to_remove) -{ - /* remove it from the event queue */ - sim_events_deschedule (hw_system (me), - event_to_remove->real); - delete_hw_event (me, &event_to_remove); -} - - -signed64 -hw_event_queue_time (struct hw *me) -{ - return sim_events_time (hw_system (me)); -} - - |