Adding New DevicesMicrocontroller programs often interact with devices that are both present on the microcontroller itself, such as timers, as well as devices that are off-chip and connected to the microcontroller through a serial interface or the general purpose IO pins. Avrora has a flexible framework for device implementation that allows software models of hardware devices to be connected to the simulation through IO registers and through pins on the microcontroller.
Implementing Onchip DevicesAvrora supports most of the devices present on the ATMega128L chip, with the exception of the watchdog timer. In Avrora, the job of implementing a device is greatly simplified. The asynchronous programming model for time-triggered devices provides a convenient interface to the execution engine. The other part of interfacing with the execution engine are IO Registers, which represent memory-mapped control and data registers for onchip devices.
IO registers are used to configure devices like the timer, the direction of pins, and
input and output from devices like SPI and the UART. In Avrora, these IO registers
are modelled with an interface called
For more information and an example of a device implementation, see the source code
for the
Implementing Offchip DevicesIn addition to emulating the onchip devices provided by a particular microcontroller implementation, Avrora also offers an interface to implement devices that are wired to the microcontroller such as LEDs and sensors. EachMicrocontroller exposes
an interface that allows an instance of Platform to connect devices to
the IO ports of the chip. This is done through a Microcontroller.Pin
interface. For more information on how this is done. See the JavaDoc API
and consult the source of avrora.sim.platform.Mica .
|