dioscuri.module.clock
Class Clock

java.lang.Object
  extended by dioscuri.module.AbstractModule
      extended by dioscuri.module.ModuleClock
          extended by dioscuri.module.clock.Clock
All Implemented Interfaces:
Module, java.lang.Runnable

public class Clock
extends ModuleClock
implements java.lang.Runnable

AbstractModule Clock This module implements a pulsing clock mechanism. Based on a user-defined sleepTime the clock sends a pulse to the PIT-counters after sleeping.

Note: - This clock imitates the crystal clock (crystal timer in hardware) - The (maximum) operating frequency of this clock should be 1193181 Hz (0.00083809581 ms/cycle). - This implementation can distinguish between real-time pulsing by host machine or CPU-pulsed by target machine. - The actual frequency in real-time pulsing is 1 pulse each millisecond - The actual frequency in CPU-triggered pulsing is 1 pulse each microsecond - By default the clock is CPU-triggered - Only 10 clock users can be registered at max


Nested Class Summary
 
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module
Module.Type
 
Field Summary
static int TIMER_ARRAY_SIZE
           
 
Fields inherited from class dioscuri.module.AbstractModule
type
 
Constructor Summary
Clock(Emulator owner)
          Constructor Clock
 
Method Summary
 java.lang.String getDump()
          Return a dump of module status
 void pulse()
          Triggers device's update if timer goes off
 boolean registerDevice(Updateable device, int intervalLength, boolean continuous)
          Register a device to clock and assign a timer to it
 boolean reset()
          Reset all parameters of module.
 boolean resetTimer(Updateable device, int updateInterval)
          Reset the timer of given device (if any)
 void run()
          Implements the run method of Runnable
protected  void setKeepRunning(boolean status)
          Sets the keepRunning toggle keepRunning states if the clock-thread should keep running or not
 boolean setTimerActiveState(Updateable device, boolean runState)
          Set a timer to start/stop running
 void stop()
          Stops the module from being active.
 
Methods inherited from class dioscuri.module.AbstractModule
getConnection, getConnections, getDebugMode, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIMER_ARRAY_SIZE

public static final int TIMER_ARRAY_SIZE
See Also:
Constant Field Values
Constructor Detail

Clock

public Clock(Emulator owner)
Constructor Clock

Parameters:
owner -
Method Detail

reset

public boolean reset()
Reset all parameters of module.

Specified by:
reset in interface Module
Specified by:
reset in class AbstractModule
Returns:
true iff the AbstractModule was reset properly.
See Also:
AbstractModule

stop

public void stop()
Stops the module from being active.

Provides an empty implementations since many of the subclasses of this abstract module class do not need a stop() implementation. The ones that do, can override this method.

Specified by:
stop in interface Module
Overrides:
stop in class AbstractModule
See Also:
Module

getDump

public java.lang.String getDump()
Return a dump of module status

Provides a dummy implementation since many of the subclasses of this abstract module class do not need or use a getDump() implementation. The ones that do, can override this method.

Specified by:
getDump in interface Module
Overrides:
getDump in class AbstractModule
Returns:
string containing a dump of this module
See Also:
AbstractModule

registerDevice

public boolean registerDevice(Updateable device,
                              int intervalLength,
                              boolean continuous)
Register a device to clock and assign a timer to it

Specified by:
registerDevice in class ModuleClock
Returns:
boolean true if timer assigned successfully, false otherwise
See Also:
ModuleClock

resetTimer

public boolean resetTimer(Updateable device,
                          int updateInterval)
Reset the timer of given device (if any)

Specified by:
resetTimer in class ModuleClock
Returns:
boolean true if timer is reset successfully, false otherwise
See Also:
ModuleClock

setTimerActiveState

public boolean setTimerActiveState(Updateable device,
                                   boolean runState)
Set a timer to start/stop running

Specified by:
setTimerActiveState in class ModuleClock
Returns:
boolean true if timer is reset successfully, false otherwise
See Also:
ModuleClock

pulse

public void pulse()
Triggers device's update if timer goes off

Specified by:
pulse in class ModuleClock
See Also:
ModuleClock

run

public void run()
Implements the run method of Runnable

Specified by:
run in interface java.lang.Runnable

setKeepRunning

protected void setKeepRunning(boolean status)
Sets the keepRunning toggle keepRunning states if the clock-thread should keep running or not

Parameters:
status -