nl.kbna.dioscuri.module.pit
Class PIT

java.lang.Object
  extended by nl.kbna.dioscuri.module.Module
      extended by nl.kbna.dioscuri.module.ModuleDevice
          extended by nl.kbna.dioscuri.module.ModulePIT
              extended by nl.kbna.dioscuri.module.pit.PIT

public class PIT
extends ModulePIT

An implementation of a Programmable Interval Timer (PIT) module based on the Intel 82C54 PIT chip.

See Also:
ModuleDevice, Metadata module ******************************************** general.type : pit general.name : Programmable Interval Timer (PIT) based on Intel 82C54 PIT general.architecture : Von Neumann general.description : Implements the Intel 82C54 PIT extended with a system clock general.creator : Tessella Support Services, Koninklijke Bibliotheek, Nationaal Archief of the Netherlands general.version : 1.0 general.keywords : pit, timer, counter general.relations : motherboard, cpu general.yearOfIntroduction : 1994 general.yearOfEnding : general.ancestor : Intel 8253 general.successor : pit.numberOfCounters : 3 pit.numberOfModes : 6 pit.clockFrequency : 1193181 (ideally, but maybe not feasible in Java) Notes: This PIT is implemented to be as close as possible to the functional behaviour of an original Intel 82C54. However, not all logic has to be implemented. Not part of this implementation is: - Signal lines WR, RD, CD, A0 and A1. Normally counters 0,1,2 are defined to a particular task (RTC, etc.). In this implementation counter zero generates a IRQ 0 if the count becomes zero. Other counters are not assigned. In the original PIT, the clock signal is generated by a separate hardware component (crystal). In the emulated PIT, the clock signal is generated by a separate moduleClock (imitates the crystal, but may have a different frequency).

Field Summary
private  Counter[] counters
           
private  ModuleCPU cpu
           
private  boolean debugMode
           
private  Emulator emu
           
protected  int irqNumber
           
private  boolean isObserved
           
private static java.util.logging.Logger logger
           
static int MODULE_ID
           
static java.lang.String MODULE_NAME
           
static java.lang.String MODULE_TYPE
           
private  java.lang.String[] moduleConnections
           
protected  ModuleMotherboard motherboard
           
protected  ModulePIC pic
           
private static int PORT_KB_CTRL_B
           
private static int PORT_PIT_CONTROLWORD1
           
private static int PORT_PIT_CONTROLWORD2
           
private static int PORT_PIT_COUNTER0
           
private static int PORT_PIT_COUNTER1
           
private static int PORT_PIT_COUNTER2
           
private static int PORT_PIT_COUNTER3
           
private static int PORT_PIT_EISA
           
private static int PORT_PIT_EISA_PIT2A
           
private static int PORT_PIT_EISA_PIT2B
           
private static int PORT_PIT_TIMER2
           
private  int updateInterval
           
 
Constructor Summary
PIT(Emulator owner)
          Class constructor
 
Method Summary
 java.lang.String[] getConnection()
          Returns a String[] with all names of modules it needs to be connected to
 byte[] getData(Module requester)
          Returns data from this module
 boolean getDebugMode()
          Returns the status of the debug mode toggle
 java.lang.String getDump()
          Returns a dump of this module
 int getID()
          Returns the ID of the module
 byte getIOPortByte(int portAddress)
          Return a byte from I/O address space at given port
 byte[] getIOPortDoubleWord(int portAddress)
          Return a double word from I/O address space at given port
 byte[] getIOPortWord(int portAddress)
          Return a word from I/O address space at given port
 java.lang.String getName()
          Returns the name of the module
 java.lang.String getType()
          Returns the type of the module
 int getUpdateInterval()
          Retrieve the interval between subsequent updates
 boolean isConnected()
          Checks if this module is connected to operate normally
 boolean isObserved()
          Returns the status of observed toggle
protected  void lowerIRQ(Counter counter)
           
protected  void raiseIRQ(Counter counter)
          Sets the clock rate for this PIT
 boolean reset()
          Reset all parameters of module
 boolean setConnection(Module mod)
          Sets up a connection with another module
 boolean setData(byte[] data, Module sender)
          Set data for this module
 boolean setData(java.lang.String[] data, Module sender)
          Set String[] data for this module
 void setDebugMode(boolean status)
          Sets the debug mode toggle
 void setIOPortByte(int portAddress, byte data)
          Set a byte in I/O address space at given port
 void setIOPortDoubleWord(int portAddress, byte[] dataDoubleWord)
          Set a double word in I/O address space at given port
 void setIOPortWord(int portAddress, byte[] dataWord)
          Set a word in I/O address space at given port
 void setObserved(boolean status)
          Sets the observed toggle
 void setUpdateInterval(int interval)
          Defines the interval between subsequent updates
 void start()
          Starts the module
 void stop()
          Stops the module
 void update()
          Update device
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emu

private Emulator emu

moduleConnections

private java.lang.String[] moduleConnections

motherboard

protected ModuleMotherboard motherboard

cpu

private ModuleCPU cpu

pic

protected ModulePIC pic

counters

private Counter[] counters

isObserved

private boolean isObserved

debugMode

private boolean debugMode

irqNumber

protected int irqNumber

updateInterval

private int updateInterval

logger

private static java.util.logging.Logger logger

MODULE_ID

public static final int MODULE_ID
See Also:
Constant Field Values

MODULE_TYPE

public static final java.lang.String MODULE_TYPE
See Also:
Constant Field Values

MODULE_NAME

public static final java.lang.String MODULE_NAME
See Also:
Constant Field Values

PORT_PIT_COUNTER0

private static final int PORT_PIT_COUNTER0
See Also:
Constant Field Values

PORT_PIT_COUNTER1

private static final int PORT_PIT_COUNTER1
See Also:
Constant Field Values

PORT_PIT_COUNTER2

private static final int PORT_PIT_COUNTER2
See Also:
Constant Field Values

PORT_PIT_CONTROLWORD1

private static final int PORT_PIT_CONTROLWORD1
See Also:
Constant Field Values

PORT_PIT_COUNTER3

private static final int PORT_PIT_COUNTER3
See Also:
Constant Field Values

PORT_PIT_CONTROLWORD2

private static final int PORT_PIT_CONTROLWORD2
See Also:
Constant Field Values

PORT_PIT_EISA

private static final int PORT_PIT_EISA
See Also:
Constant Field Values

PORT_PIT_TIMER2

private static final int PORT_PIT_TIMER2
See Also:
Constant Field Values

PORT_PIT_EISA_PIT2A

private static final int PORT_PIT_EISA_PIT2A
See Also:
Constant Field Values

PORT_PIT_EISA_PIT2B

private static final int PORT_PIT_EISA_PIT2B
See Also:
Constant Field Values

PORT_KB_CTRL_B

private static final int PORT_KB_CTRL_B
See Also:
Constant Field Values
Constructor Detail

PIT

public PIT(Emulator owner)
Class constructor

Method Detail

getID

public int getID()
Returns the ID of the module

Specified by:
getID in class Module
Returns:
string containing the ID of module
See Also:
Module

getType

public java.lang.String getType()
Returns the type of the module

Specified by:
getType in class Module
Returns:
string containing the type of module
See Also:
Module

getName

public java.lang.String getName()
Returns the name of the module

Specified by:
getName in class Module
Returns:
string containing the name of module
See Also:
Module

getConnection

public java.lang.String[] getConnection()
Returns a String[] with all names of modules it needs to be connected to

Specified by:
getConnection in class Module
Returns:
String[] containing the names of modules, or null if no connections

setConnection

public boolean setConnection(Module mod)
Sets up a connection with another module

Specified by:
setConnection in class Module
Parameters:
mod - Module that is to be connected to this class
Returns:
true if connection has been established successfully, false otherwise
See Also:
Module

isConnected

public boolean isConnected()
Checks if this module is connected to operate normally

Specified by:
isConnected in class Module
Returns:
true if this module is connected successfully, false otherwise

reset

public boolean reset()
Reset all parameters of module

Specified by:
reset in class Module
Returns:
boolean true if module has been reset successfully, false otherwise

start

public void start()
Starts the module

Specified by:
start in class Module
See Also:
Module

stop

public void stop()
Stops the module

Specified by:
stop in class Module
See Also:
Module

isObserved

public boolean isObserved()
Returns the status of observed toggle

Specified by:
isObserved in class Module
Returns:
state of observed toggle
See Also:
Module

setObserved

public void setObserved(boolean status)
Sets the observed toggle

Specified by:
setObserved in class Module
Parameters:
status -
See Also:
Module

getDebugMode

public boolean getDebugMode()
Returns the status of the debug mode toggle

Specified by:
getDebugMode in class Module
Returns:
state of debug mode toggle
See Also:
Module

setDebugMode

public void setDebugMode(boolean status)
Sets the debug mode toggle

Specified by:
setDebugMode in class Module
Parameters:
status -
See Also:
Module

getData

public byte[] getData(Module requester)
Returns data from this module

Specified by:
getData in class Module
Parameters:
Module - requester, the requester of the data
Returns:
byte[] with data
See Also:
Module

setData

public boolean setData(byte[] data,
                       Module sender)
Set data for this module

Specified by:
setData in class Module
Parameters:
byte[] - data
Module - sender, the sender of the data
Returns:
boolean true if successful, false otherwise
See Also:
Module

setData

public boolean setData(java.lang.String[] data,
                       Module sender)
Set String[] data for this module

Specified by:
setData in class Module
Parameters:
String[] - data
Module - sender, the sender of the data
Returns:
boolean true is successful, false otherwise
See Also:
Module

getDump

public java.lang.String getDump()
Returns a dump of this module

Specified by:
getDump in class Module
Returns:
string
See Also:
Module

getUpdateInterval

public int getUpdateInterval()
Retrieve the interval between subsequent updates

Specified by:
getUpdateInterval in class ModuleDevice
Returns:
int interval in microseconds

setUpdateInterval

public void setUpdateInterval(int interval)
Defines the interval between subsequent updates

Specified by:
setUpdateInterval in class ModuleDevice
Parameters:
int - interval in microseconds

update

public void update()
Update device

Specified by:
update in class ModuleDevice

getIOPortByte

public byte getIOPortByte(int portAddress)
                   throws ModuleException,
                          ModuleUnknownPort
Return a byte from I/O address space at given port

Specified by:
getIOPortByte in class ModuleDevice
Parameters:
int - portAddress containing the address of the I/O port
Returns:
byte containing the data at given I/O address port
Throws:
ModuleException, - ModuleWriteOnlyPortException
ModuleException
ModuleUnknownPort

setIOPortByte

public void setIOPortByte(int portAddress,
                          byte data)
                   throws ModuleException,
                          ModuleUnknownPort
Set a byte in I/O address space at given port

Specified by:
setIOPortByte in class ModuleDevice
Parameters:
int - portAddress containing the address of the I/O port
byte - data
Throws:
ModuleException, - ModuleWriteOnlyPortException
ModuleException
ModuleUnknownPort

getIOPortWord

public byte[] getIOPortWord(int portAddress)
                     throws ModuleException,
                            ModuleWriteOnlyPortException
Description copied from class: ModuleDevice
Return a word from I/O address space at given port

Specified by:
getIOPortWord in class ModuleDevice
Returns:
byte[] containing the word at given I/O address port
Throws:
ModuleException
ModuleWriteOnlyPortException

setIOPortWord

public void setIOPortWord(int portAddress,
                          byte[] dataWord)
                   throws ModuleException
Description copied from class: ModuleDevice
Set a word in I/O address space at given port

Specified by:
setIOPortWord in class ModuleDevice
Throws:
ModuleException

getIOPortDoubleWord

public byte[] getIOPortDoubleWord(int portAddress)
                           throws ModuleException,
                                  ModuleWriteOnlyPortException
Description copied from class: ModuleDevice
Return a double word from I/O address space at given port

Specified by:
getIOPortDoubleWord in class ModuleDevice
Returns:
byte[] containing the double word at given I/O address port
Throws:
ModuleException
ModuleWriteOnlyPortException

setIOPortDoubleWord

public void setIOPortDoubleWord(int portAddress,
                                byte[] dataDoubleWord)
                         throws ModuleException
Description copied from class: ModuleDevice
Set a double word in I/O address space at given port

Specified by:
setIOPortDoubleWord in class ModuleDevice
Throws:
ModuleException

raiseIRQ

protected void raiseIRQ(Counter counter)
Sets the clock rate for this PIT

Parameters:
long - milliseconds, the time between two consequtive clock pulses

lowerIRQ

protected void lowerIRQ(Counter counter)