avrora.sim.mcu
Class ATMegaFamily

java.lang.Object
  extended byavrora.sim.mcu.AtmelMicrocontroller
      extended byavrora.sim.mcu.ATMegaFamily
All Implemented Interfaces:
Microcontroller
Direct Known Subclasses:
ATMega128, ATMega16, ATMega32

public abstract class ATMegaFamily
extends AtmelMicrocontroller

The ATMegaFamily class encapsulates much of the common functionality among the ATMega family microcontrollers from Atmel.


Nested Class Summary
static class ATMegaFamily.DirectionRegister
          The DirectionRegister class implements an active register that sets the output direction of the general purpose IO pins which are present on the ATMega series.
static class ATMegaFamily.FlagBit
           
static class ATMegaFamily.FlagRegister
           
static class ATMegaFamily.MaskRegister
           
static class ATMegaFamily.PinRegister
          The PinRegister class implements an active register that acts as the read register (input register) for the general purpose IO pins.
static class ATMegaFamily.PortRegister
          The PortRegister class implements an active register that acts as the write register (output register) for the general purpose IO pins.
protected  class ATMegaFamily.Timer0
          Timer0 is the default 8-bit timer on the ATMega128.
protected  class ATMegaFamily.Timer1
          Timer1 is a 16-bit timer available on the ATMega128.
protected  class ATMegaFamily.Timer2
          Timer2 is an additional 8-bit timer on the ATMega128.
protected  class ATMegaFamily.Timer3
          Timer3 is an additional 16-bit timer available on the ATMega128, but not in ATMega103 compatability mode.
 
Nested classes inherited from class avrora.sim.mcu.AtmelMicrocontroller
AtmelMicrocontroller.Pin
 
Nested classes inherited from class avrora.sim.mcu.Microcontroller
Microcontroller.InputPin, Microcontroller.OutputPin
 
Field Summary
protected  ATMegaFamily.FlagRegister EIFR_reg
           
protected  ATMegaFamily.FlagRegister ETIFR_reg
           
protected  ATMegaFamily.MaskRegister ETIMSK_reg
           
protected static int[] periods0
           
protected static int[] periods1
           
protected static int[] periods2
           
protected static int[] periods3
           
protected  ATMegaFamily.FlagRegister TIFR_reg
           
protected  ATMegaFamily.MaskRegister TIMSK_reg
           
 
Fields inherited from class avrora.sim.mcu.AtmelMicrocontroller
clockDomain, devices, HZ, interpreter, mainClock, MODE_ACTIVE, pinPrinter, pins, platform, properties, registers, simulator, sleepState
 
Constructor Summary
protected ATMegaFamily(ClockDomain cd, MicrocontrollerProperties p, FiniteStateMachine fsm)
           
 
Method Summary
protected  ATMegaFamily.FlagRegister buildInterruptRange(boolean increasing, java.lang.String maskRegNum, java.lang.String flagRegNum, int baseVect, int numVects)
          The buildInterruptRange() method creates the IO registers and MaskableInterrupt instances corresponding to a complete range of interrupts.
protected  void buildPort(char p)
          The buildPort() method builds the IO registers corresponding to a general purpose IO port.
 ATMegaFamily.FlagRegister getEIFR_reg()
          The getEIFR_reg() method is used to access the external interrupt flag register.
 long getHZ()
          The getHZ() method returns the number of cycles per second at which this hardware device is designed to run.
 
Methods inherited from class avrora.sim.mcu.AtmelMicrocontroller
addDevice, addInterrupt, addPin, addPin, addPin, cyclesToMillis, getClock, getClockDomain, getDevice, getFSM, getIOReg, getMode, getModeName, getPin, getPin, getPinNumber, getPlatform, getProperties, getRegisterSet, getSimulator, getSleepMode, installIOReg, millisToCycles, setPlatform, sleep, wakeup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface avrora.sim.mcu.Microcontroller
isSupported
 

Field Detail

periods0

protected static final int[] periods0

periods2

protected static final int[] periods2

periods1

protected static final int[] periods1

periods3

protected static final int[] periods3

EIFR_reg

protected ATMegaFamily.FlagRegister EIFR_reg

TIFR_reg

protected ATMegaFamily.FlagRegister TIFR_reg

TIMSK_reg

protected ATMegaFamily.MaskRegister TIMSK_reg

ETIFR_reg

protected ATMegaFamily.FlagRegister ETIFR_reg

ETIMSK_reg

protected ATMegaFamily.MaskRegister ETIMSK_reg
Constructor Detail

ATMegaFamily

protected ATMegaFamily(ClockDomain cd,
                       MicrocontrollerProperties p,
                       FiniteStateMachine fsm)
Method Detail

getHZ

public long getHZ()
The getHZ() method returns the number of cycles per second at which this hardware device is designed to run.

Returns:
the number of cycles per second on this device

buildPort

protected void buildPort(char p)
The buildPort() method builds the IO registers corresponding to a general purpose IO port. These ports are named A-G, and each consist of a PORT register (for writing), a PIN register (for reading), and a direction register for setting whether each pin in the port is input or output. This method is a utility to build these registers for each port given the last character of the name (e.g. 'A' in PORTA).

Parameters:
p - the last character of the port name

buildInterruptRange

protected ATMegaFamily.FlagRegister buildInterruptRange(boolean increasing,
                                                        java.lang.String maskRegNum,
                                                        java.lang.String flagRegNum,
                                                        int baseVect,
                                                        int numVects)
The buildInterruptRange() method creates the IO registers and MaskableInterrupt instances corresponding to a complete range of interrupts.

Parameters:
increasing - a flag indicating that the vector numbers increase with bit number of the IO register
maskRegNum - the IO register number of the mask register
flagRegNum - the IO register number of the flag register
baseVect - the beginning vector of this range of interrupts
numVects - the number of vectors in this range
Returns:
a flag register that corresponds to the interrupt range

getEIFR_reg

public ATMegaFamily.FlagRegister getEIFR_reg()
The getEIFR_reg() method is used to access the external interrupt flag register.

Returns:
the ActiveRegister object corresponding to the EIFR IO register