avrora.sim.mcu
Class ATMega128L

java.lang.Object
  extended byavrora.sim.mcu.ATMegaFamily
      extended byavrora.sim.mcu.ATMega128L
All Implemented Interfaces:
Microcontroller, MicrocontrollerFactory, MicrocontrollerProperties

public class ATMega128L
extends ATMegaFamily
implements Microcontroller, MicrocontrollerFactory

The ATMega128L class represents the Microcontroller instance that has all the hardware parameters of the ATMega128L microcontroller as produced by Atmel Corporatation.


Nested Class Summary
static interface ATMega128L.ADCInput
          The ADCInput interface is used by inputs into the analog to digital converter.
protected static interface ATMega128L.Clock
          Interface for an alternate clock.
 class ATMega128L.SimImpl
           
static interface ATMega128L.SPIDevice
          Interface for devices that can connect to the SPI.
static interface ATMega128L.USARTDevice
          The USARTDevice interface describes USARTs and other serial devices which can be connected to the USART.
 
Nested classes inherited from class avrora.sim.mcu.ATMegaFamily
ATMegaFamily.FlagRegister, ATMegaFamily.MaskableInterrupt, ATMegaFamily.MaskRegister, ATMegaFamily.Pin
 
Nested classes inherited from class avrora.sim.mcu.Microcontroller
Microcontroller.Pin
 
Field Summary
protected  ATMega128L.SimImpl.ADC adc
           
static int ATMEGA128L_IOREG_SIZE
           
static int ATMEGA128L_IOREG_SIZE_103
           
static int ATMEGA128L_SRAM_SIZE
           
static int ATMEGA128L_SRAM_SIZE_103
           
protected static java.util.HashMap pinNumbers
           
protected  ATMega128L.SimImpl.PowerManagement pm
           
protected  Radio radio
          The Radio connected to this microcontroller.
protected  ATMega128L.SimImpl.SPI spi
           
 
Fields inherited from class avrora.sim.mcu.ATMegaFamily
clock, EEPROM_SIZE, FLASH_SIZE, HZ, interpreter, IOREG_SIZE, NUM_PINS, pinPrinter, pins, simulator, SRAM_SIZE
 
Constructor Summary
  ATMega128L(boolean compatibility)
          The constructor for the default instance.
protected ATMega128L(int id, InterpreterFactory f, Program p, boolean compatibility)
           
 
Method Summary
 void connectADCInput(ATMega128L.ADCInput d, int bit)
          Connect an instance of the ADCInput interface to the ADC of this microcontroller.
 void connectSPIDevice(ATMega128L.SPIDevice d)
          Connect an instance of the SPIDevice interface to the SPI of this microcontroller.
 byte getMode()
          get the current mode of the mcu
 java.lang.String getModeName()
          get the name of the current mode
 Microcontroller.Pin getPin(java.lang.String name)
          The getPin() method looks up the named pin and returns a reference to that pin.
 int getPinNumber(java.lang.String name)
          The getPinNumber() method looks up the named pin and returns its number.
 Radio getRadio()
           
 Simulator getSimulator()
          The getSimulator() method gets a simulator instance that is capable of emulating this hardware device.
protected  void installPins()
           
 boolean isSupported(InstrPrototype i)
          The isSupported() method allows a client to query whether a particular instruction is implemented on this hardware device.
 Microcontroller newMicrocontroller(int id, InterpreterFactory f, Program p)
          The newMicrocontroller() method is used to instantiate a microcontroller instance for the particular program.
 void setRadio(Radio radio)
           
 void sleep()
          send to mcu to sleep
 int wakeup()
          wake the mcu up
 
Methods inherited from class avrora.sim.mcu.ATMegaFamily
cyclesToMillis, getEEPromSize, getFlashSize, getHz, getIORegSize, getPin, getRamSize, millisToCycles
 
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
getPin
 
Methods inherited from interface avrora.sim.mcu.MicrocontrollerProperties
cyclesToMillis, getEEPromSize, getFlashSize, getHz, getIORegSize, getRamSize, millisToCycles
 

Field Detail

ATMEGA128L_IOREG_SIZE

public static final int ATMEGA128L_IOREG_SIZE
See Also:
Constant Field Values

ATMEGA128L_IOREG_SIZE_103

public static final int ATMEGA128L_IOREG_SIZE_103
See Also:
Constant Field Values

ATMEGA128L_SRAM_SIZE

public static final int ATMEGA128L_SRAM_SIZE
See Also:
Constant Field Values

ATMEGA128L_SRAM_SIZE_103

public static final int ATMEGA128L_SRAM_SIZE_103
See Also:
Constant Field Values

pinNumbers

protected static final java.util.HashMap pinNumbers

spi

protected ATMega128L.SimImpl.SPI spi

adc

protected ATMega128L.SimImpl.ADC adc

pm

protected ATMega128L.SimImpl.PowerManagement pm

radio

protected Radio radio
The Radio connected to this microcontroller.

Constructor Detail

ATMega128L

public ATMega128L(boolean compatibility)
The constructor for the default instance.


ATMega128L

protected ATMega128L(int id,
                     InterpreterFactory f,
                     Program p,
                     boolean compatibility)
Method Detail

installPins

protected void installPins()

isSupported

public boolean isSupported(InstrPrototype i)
The isSupported() method allows a client to query whether a particular instruction is implemented on this hardware device. Older implementations of the AVR instruction set preceded the introduction of certain instructions, and therefore did not support the new instructions.

Specified by:
isSupported in interface MicrocontrollerProperties
Parameters:
i - the instruction prototype of the instruction
Returns:
true if the specified instruction is supported on this device; false otherwise

getSimulator

public Simulator getSimulator()
The getSimulator() method gets a simulator instance that is capable of emulating this hardware device.

Specified by:
getSimulator in interface Microcontroller
Returns:
a Simulator instance corresponding to this device

getPinNumber

public int getPinNumber(java.lang.String name)
The getPinNumber() method looks up the named pin and returns its number. Names of pins should be UPPERCASE. The intended users of this method are external device implementors which connect their devices to the microcontroller through the pins.

Specified by:
getPinNumber in interface MicrocontrollerProperties
Parameters:
name - the name of the pin; for example "PA0" or "OC1A"
Returns:
the number of the pin if it exists; -1 otherwise

newMicrocontroller

public Microcontroller newMicrocontroller(int id,
                                          InterpreterFactory f,
                                          Program p)
The newMicrocontroller() method is used to instantiate a microcontroller instance for the particular program. It will construct an instance of the Simulator class that has all the properties of this hardware device and has been initialized with the specified program.

Specified by:
newMicrocontroller in interface MicrocontrollerFactory
Parameters:
p - the program to load onto the microcontroller
Returns:
a Microcontroller instance that represents the specific hardware device with the program loaded onto it

getPin

public Microcontroller.Pin getPin(java.lang.String name)
The getPin() method looks up the named pin and returns a reference to that pin. Names of pins should be UPPERCASE. The intended users of this method are external device implementors which connect their devices to the microcontroller through the pins.

Specified by:
getPin in interface Microcontroller
Parameters:
name - the name of the pin; for example "PA0" or "OC1A"
Returns:
a reference to the Pin object corresponding to the named pin if it exists; null otherwise

connectSPIDevice

public void connectSPIDevice(ATMega128L.SPIDevice d)
Connect an instance of the SPIDevice interface to the SPI of this microcontroller.


connectADCInput

public void connectADCInput(ATMega128L.ADCInput d,
                            int bit)
Connect an instance of the ADCInput interface to the ADC of this microcontroller. The ADC unit on the ATMega128L can support up to 8 ADC inputs, on bits 0 - 7.


setRadio

public void setRadio(Radio radio)
Specified by:
setRadio in interface Microcontroller

getRadio

public Radio getRadio()
Specified by:
getRadio in interface Microcontroller

sleep

public void sleep()
send to mcu to sleep

Specified by:
sleep in interface Microcontroller
See Also:
Microcontroller.sleep()

wakeup

public int wakeup()
wake the mcu up

Specified by:
wakeup in interface Microcontroller
Returns:
cycles it takes to wake up
See Also:
Microcontroller.wakeup()

getMode

public byte getMode()
get the current mode of the mcu

Specified by:
getMode in interface Microcontroller
Returns:
current mode
See Also:
Microcontroller.getMode()

getModeName

public java.lang.String getModeName()
get the name of the current mode

Specified by:
getModeName in interface Microcontroller
Returns:
name of the current mode