1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/eventq.h Thu Sep 20 08:37:19 2007 +0000
1.5 + * $Id: eventq.h,v 1.1 2007-01-06 04:06:36 nkeynes Exp $
1.7 + * Simple implementation of one-shot timers. Effectively this allows IO
1.8 + * devices to wait until a particular time before completing. We expect
1.9 + * there to be at least half a dozen or so continually scheduled events
1.10 + * (TMU and PVR2), peaking around 20+.
1.12 + * Copyright (c) 2005 Nathan Keynes.
1.14 + * This program is free software; you can redistribute it and/or modify
1.15 + * it under the terms of the GNU General Public License as published by
1.16 + * the Free Software Foundation; either version 2 of the License, or
1.17 + * (at your option) any later version.
1.19 + * This program is distributed in the hope that it will be useful,
1.20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.22 + * GNU General Public License for more details.
1.27 +#define NOT_SCHEDULED 0xFFFFFFFF /* Sentinel value */
1.30 +typedef void (*event_func_t)(int eventid);
1.33 + * Register the callback to be associated with the given event ID.
1.34 + * Note: These should be registered at init time and never changed.
1.36 +void register_event_callback( int eventid, event_func_t func );
1.39 + * Schedule a new pending event.
1.40 + * @param eventid Unique ID identifying the event in question (used to remove it
1.41 + * at a later time). If the eventid is scheduled more than once, only the lastest
1.42 + * schedule for that ID will be valid.
1.43 + * @param nanosecs Nanoseconds from the current SH4 time at which the event
1.46 +void event_schedule( int eventid, uint32_t nanosecs );
1.49 + * Schedule a long-duration pending event
1.51 +void event_schedule_long( int eventid, uint32_t seconds, uint32_t nanosecs );
1.54 + * Remove a previously created event without triggering it. This is usually
1.55 + * only used when an operation is aborted.
1.57 +void event_cancel( int eventid );
1.60 + * Return the slice cycle time of the next event, or NOT_SCHEDULED
1.61 + * if no events are scheduled for this time slice.
1.63 +uint32_t event_get_next_time();
1.66 + * Execute the event on the top of the queue, and remove it.
1.68 +void event_execute();
1.70 +#define MAX_EVENT_ID 128
1.72 +/* Events 1..96 are defined as the corresponding ASIC events. */