libsidplayfp  1.8.3
Public Member Functions | List of all members
EventContext Class Referenceabstract

#include <event.h>

Inheritance diagram for EventContext:
EventScheduler

Public Member Functions

virtual void cancel (Event &event)=0
 
virtual void schedule (Event &event, unsigned int cycles, event_phase_t phase)=0
 
virtual void schedule (Event &event, unsigned int cycles)=0
 
virtual bool isPending (Event &event) const =0
 
virtual event_clock_t getTime (event_phase_t phase) const =0
 
virtual event_clock_t getTime (event_clock_t clock, event_phase_t phase) const =0
 
virtual event_phase_t phase () const =0
 

Detailed Description

Fast EventScheduler, which maintains a linked list of Events. This scheduler takes neglible time even when it is used to schedule events for nearly every clock.

Events occur on an internal clock which is 2x the visible clock. The visible clock is divided to two phases called phi1 and phi2.

The phi1 clocks are used by VIC and CIA chips, phi2 clocks by CPU.

Scheduling an event for a phi1 clock when system is in phi2 causes the event to be moved to the next phi1 cycle. Correspondingly, requesting a phi1 time when system is in phi2 returns the value of the next phi1.

Author
Antti S. Lankila

Member Function Documentation

virtual void EventContext::cancel ( Event event)
pure virtual

Cancel the specified event.

Parameters
eventthe event to cancel

Implemented in EventScheduler.

virtual event_clock_t EventContext::getTime ( event_phase_t  phase) const
pure virtual

Get time with respect to a specific clock phase.

Parameters
phasethe phase
Returns
the time according to specified phase.

Implemented in EventScheduler.

virtual event_clock_t EventContext::getTime ( event_clock_t  clock,
event_phase_t  phase 
) const
pure virtual

Get clocks since specified clock in given phase.

Parameters
clockthe time to compare to
phasethe phase to comapre to
Returns
the time between specified clock and now

Implemented in EventScheduler.

virtual bool EventContext::isPending ( Event event) const
pure virtual

Is the event pending in this scheduler?

Parameters
eventthe event
Returns
true when pending

Implemented in EventScheduler.

virtual event_phase_t EventContext::phase ( ) const
pure virtual

Return current clock phase.

Returns
The current phase

Implemented in EventScheduler.

virtual void EventContext::schedule ( Event event,
unsigned int  cycles,
event_phase_t  phase 
)
pure virtual

Add event to pending queue.

At PHI2, specify cycles=0 and Phase=PHI1 to fire on the very next PHI1.

Parameters
eventthe event to add
cycleshow many cycles from now to fire
phasethe phase when to fire the event

Implemented in EventScheduler.

virtual void EventContext::schedule ( Event event,
unsigned int  cycles 
)
pure virtual

Add event to pending queue in the same phase as current event.

Parameters
eventthe event to add
cycleshow many cycles from now to fire

Implemented in EventScheduler.


The documentation for this class was generated from the following file: