Interfaces

temu_ARMCoProcessorIface

Include

#include "temu-c/Target/ARM.h"

Type

struct temu_ARMCoProcessorIface {
}

Description

Fields

Field Type Description

temu_ARMCpuIface

Include

#include "temu-c/Target/ARM.h"

Type

struct temu_ARMCpuIface {
}

Description

Fields

Field Type Description

temu_AhbIface

Include

#include "temu-c/Bus/Amba.h"

Type

struct temu_AhbIface {
}

Description

AHB bus plug and play interface

A device providing plug and play info for the AHB bridge, should implement this interface. The recommended way is to put a temu_AhbPnpInfo struct inside your model struct and then return a pointer to this one. This way the PNP info can be changed on a per object basis.

Fields

Field Type Description

temu_AnalogIface

Include

#include "temu-c/Bus/Analog.h"

Type

struct temu_AnalogIface {
}

Description

Analog signal interface NOTE THIS IS EXPERIMENTAL

Fields

Field Type Description

temu_ApbIface

Include

#include "temu-c/Bus/Amba.h"

Type

struct temu_ApbIface {
}

Description

APB bus plug and play interface

A device providing plug and play info for the APB bridge, should implement this interface. The recommended way is to put a temu_ApbPnpInfo struct inside your model struct and then return a pointer to this one. This way the PNP info can be changed on a per object basis.

Fields

Field Type Description

temu_BTIface

Include

#include "temu-c/EmulatorManager/BinaryTranslation.h"

Type

struct temu_BTIface {
}

Description

Fields

Field Type Description

temu_CacheCtrlIface

Include

#include "temu-c/Memory/Cache.h"

Type

struct temu_CacheCtrlIface {
}

Description

Fields

Field Type Description

temu_CacheIface

Include

#include "temu-c/Memory/Cache.h"

Type

struct temu_CacheIface {
}

Description

Fields

Field Type Description

temu_CanBusIface

Include

#include "temu-c/Bus/Can.h"

Type

struct temu_CanBusIface {
}

Description

Fields

Field Type Description

temu_CanDevIface

Include

#include "temu-c/Bus/Can.h"

Type

struct temu_CanDevIface {
}

Description

Fields

Field Type Description

temu_ClockIface

Include

#include "temu-c/Models/Clock.h"

Type

struct temu_ClockIface {
}

Description

Fields

Field Type Description

temu_CpuIface

Include

#include "temu-c/Target/Cpu.h"

Type

struct temu_CpuIface {
  int (*)(void *) wakeUp;
  void (*)(void *) forceEarlyExit;
}

Description

Common CPU interface.

The CPU interface provides common functionality that all processors must implement. This includes the reset and run methods. But also different register access functions. The register access functions are functions, because registers may be banked and we want some type of common interface that can access the current registers. Note that the interface currently only support 32 bit processors.

field reset The function executing a reset. It takes as parameter the reset type, which is 0 for a default cold reset.

field run Run the main emulator loop for a given number of cycles.

field runUntil Run the main emulator loop until its cycle counter reach the end cycles.

field step Run the given number of steps. A step is one instruction, completed or not. E.g. a trapping instruction does not complete but is counted as a step.

field stepUntil Step the emulator, but stop if the step exceeds a certain fixed time.

field raiseTrap Raises a trap on the CPU. THIS FUNCTION DOES NOT RETURN!!!

field enterIdleMode Will call longjmp and enter idle mode immediately, this is useful for devices that activates power down mode.

field exitEmuCore Will call longjmp to exit the emulator core. This can be used in certain cases where the other exit functions do not suite well. One being that a reset is called from an MMIO write or read, or from a watchdog event. The reset can otherwise be called when the emulator is not running, so in a model you can call reset and then exitEmuCore.

field getGpr Read the currently visible general purpose registers. For banked registers (e.g. SPARC reg windows), you should look at the arch specific interface instead.

field getFpr32 Read the currently visible floating point registers.

field setSpr Set special purpose registers. The indexes have been explicitly choosen to be equal to what is assumed by the GDB protocol, but re-based at zero.

field getSpr Read special purpose registers. The indexes have been explicitly choosen to be equal to what is assumed by GDB but rebased at zero.

field disassemble This function will disassemble an instruction. The function returns a heap-allocated string (allocated with malloc()). The caller is responsible for calling free() and managing the lifetime.

field invalidateAtc Invalidates the ATC cache for the given address range. Flags can be set to control the invalidation. Bit 0: don’t invalidate fetch. Bit 1: don’t Invalidate read, bit 2: don’t invalidate write, bit 3 don’t invalidate user, bit 4 don’t invalidate super.

field translateAddress Does a table walk and translates the virtual address to physical page address. For MMU free systems, the function returns the Va masked with ~(page size-1). Otherwise, the return is the translated page address and in the case of failure -1.

field raiseTrapNoJmp Raises a trap without longjmp to emulator core main loop. This can be used in e.g. timed event handlers and when the core isn’t running.

Fields

Field Type Description

wakeUp

int (*)(void *)

Wake up CPU if it is idling, return 1 if woken up 0 if no state change occurred

forceEarlyExit

void (*)(void *)

Force early return of core (after event cleanup), unless the core returns for normal reasons, the emulator will return teCER_Early after the current instruction.

temu_DeviceIdIface

Include

#include "temu-c/Models/IntegrationSupport.h"

Type

struct temu_DeviceIdIface {
}

Description

Fields

Field Type Description

temu_DeviceIdMemAccessIface

Include

#include "temu-c/Models/IntegrationSupport.h"

Type

struct temu_DeviceIdMemAccessIface {
}

Description

Fields

Field Type Description

temu_DeviceIface

Include

#include "temu-c/Models/Device.h"

Type

struct temu_DeviceIface {
}

Description

Fields

Field Type Description

temu_DynCallIface

Include

#include "temu-c/Bus/DynamicInvocation.h"

Type

struct temu_DynCallIface {
}

Description

Fields

Field Type Description

temu_DynamicResetAddressIface

Include

#include "temu-c/Target/Cpu.h"

Type

struct temu_DynamicResetAddressIface {
}

Description

Fields

Field Type Description

temu_EthernetIface

Include

#include "temu-c/Bus/Ethernet.h"

Type

struct temu_EthernetIface {
}

Description

Fields

Field Type Description

temu_EventIface

Include

#include "temu-c/Support/Events.h"

Type

struct temu_EventIface {
}

Description

Fields

Field Type Description

temu_GpioBusIface

Include

#include "temu-c/Bus/Gpio.h"

Type

struct temu_GpioBusIface {
  void (*)(void *, uint64_t, uint64_t) setGpioBits;
  uint64_t (*)(void *, uint64_t) getGpioBits;
}

Description

Interface implemented by the GPIO bus class.

Normally this does not have to be implemented yourself. It exist for the bus model only. In-case you need a separate bus model, you can implement this interface.

Note that this interface is deprecated for future models and it is expected that the signal interface is used instead.

Fields

Field Type Description

setGpioBits

void (*)(void *, uint64_t, uint64_t)

setGpioBits should set or clear the bits in Bits if they are set in Mask. Upon a set, the GPIO bus model should notify any connected GPIO clients about the changed bits. This is done using the temu_GpioClientIface. In the built in bus model, notifications are only delivered if any of the bits actually changed.

getGpioBits

uint64_t (*)(void *, uint64_t)

Get the gpio-bits currently on the bus. The bits in mask will be extracted from the bus and returned in the result.

temu_GpioClientIface

Include

#include "temu-c/Bus/Gpio.h"

Type

struct temu_GpioClientIface {
  void (*)(void *, uint64_t, uint64_t) gpioBitsChanged;
}

Description

Interface for GPIO clients.

A GPIO client is a device that interface with the GPIO bus. Such a client can poll using the GpioBusIface, but it is likely better to be lazily notified about changes to the bus values. Such notifications will be delivered to the GpioClientIface.

Note that this interface is deprecated for future models and it is expected that the signal interface is used instead.

Fields

Field Type Description

gpioBitsChanged

void (*)(void *, uint64_t, uint64_t)

Notification function. A client will always be notified about changed bus values. The Bus value is indicated in the Bits param, and the values that where changed are indicated in the Mask param.

temu_InstrumenterIface

Include

#include "temu-c/EmulatorManager/Instrumenter.h"

Type

struct temu_InstrumenterIface {
}

Description

Fields

Field Type Description

temu_IrqClientIface

Include

#include "temu-c/Models/IrqController.h"

Type

struct temu_IrqClientIface {
  void (*)(void *) updateInterrupts;
}

Description

Interface to be defined for classes that uses an IRQ controller object. An IRQ controller may acknowledge to the IRQ controller client, or it may notify the IrqClient that the underlying IRQ controller has been modified and any pending IRQs should be re-issued. Typically, an updateInterrupt call happens if the IRQ registers change in such a way that the IRQ controller does not know the next interrupt to be issued. E.g. On the sparc, the updateInterrupts function will be called on its IRQ controller whenever the ET or PIL field has changed. That is updateInterrupts are called by lazy IRQ controllers.

Fields

Field Type Description

updateInterrupts

void (*)(void *)

Called in case IRQ re-issuing is needed eg. when the IRQ controlling registers have been modified.

temu_IrqControllerIface

Include

#include "temu-c/Models/IrqController.h"

Type

struct temu_IrqControllerIface {
}

Description

Interrupt controller interface. An interrupt controller can raise and lower IRQ signals. For systems which has interrupts which can be configured to be active high, low or rising or falling, the raise and lower irq have different semantics. For rising edge triggering, the raiseInterrupt function should trigger the IRQ.

Fields

Field Type Description

temu_LineDataLoggerIface

Include

#include "temu-c/Models/LineDataLogger.h"

Type

struct temu_LineDataLoggerIface {
}

Description

Fields

Field Type Description

temu_MACIface

Include

#include "temu-c/Bus/Ethernet.h"

Type

struct temu_MACIface {
}

Description

Fields

Field Type Description

temu_MDIOIface

Include

#include "temu-c/Bus/Ethernet.h"

Type

struct temu_MDIOIface {
}

Description

Fields

Field Type Description

temu_MachineIface

Include

#include "temu-c/Models/Machine.h"

Type

struct temu_MachineIface {
}

Description

Fields

Field Type Description

temu_MemAccessIface

Include

#include "temu-c/Memory/Memory.h"

Type

struct temu_MemAccessIface {
  void (*)(void *, temu_MemTransaction *) fetch;
  void (*)(void *, temu_MemTransaction *) read;
  void (*)(void *, temu_MemTransaction *) write;
  void (*)(void *, temu_MemTransaction *) exchange;
  const temu_MemAccessCapabilities *(*)(void *) getCapabilities;
}

Description

Memory access interface implemented by all memory mapped devices Exposed to the emulator core by a memory object.

Fields

Field Type Description

fetch

void (*)(void *, temu_MemTransaction *)

Function called on fetches. The function can be null in case fetches are not allowed from the model.

read

void (*)(void *, temu_MemTransaction *)

Function called on reads.

write

void (*)(void *, temu_MemTransaction *)

Function called on writes.

exchange

void (*)(void *, temu_MemTransaction *)

Function called on atomic exchanges, by default if this is not defined, the memory space will call read followed by write in order.

getCapabilities

const temu_MemAccessCapabilities ()(void *)

Query for supported features Function is optional. By default the assumption is that the base capabilities are equal to R_ALL

temu_MemoryIface

Include

#include "temu-c/Memory/Memory.h"

Type

struct temu_MemoryIface {
}

Description

For objects which have actualm memory (not just registers) This is for the simulator (not the emu core). The procedures should write the data given in bytes to the given physical offset. The offset is a 64 bit uint to support 64 bit targets. The interface is used for example by DMA transactions.

The size argument is in bytes.

The swap argument is used to swap bytes to the host endianess. Specify the log size of the read data types. - 0: We are reading bytes (bytes will be in target memory order) - 1: We are reading half words (will be swapped to host order) - 2: We are reading words (will be swapped) - 3: We are reading double words (will be swapped) With 0 for swap, we are basically reading a byte array

readBytes and writeBytes should return the number of bytes read / written or negative on error.

Fields

Field Type Description

temu_MemorySpaceIface

Include

#include "temu-c/Support/Memory.h"

Type

struct temu_MemorySpaceIface {
}

Description

Fields

Field Type Description

temu_Mil1553BusIface

Include

#include "temu-c/Bus/MilStd1553.h"

Type

struct temu_Mil1553BusIface {
}

Description

Fields

Field Type Description

temu_Mil1553DevIface

Include

#include "temu-c/Bus/MilStd1553.h"

Type

struct temu_Mil1553DevIface {
  void (*)(void *, temu_Mil1553BusIfaceRef, int) connected;
  void (*)(void *, temu_Mil1553BusIfaceRef, int) disconnected;
  void (*)(void *, temu_Mil1553Msg *) receive;
  void (*)(void *, temu_Mil1553BusIdleInfo *) busEnteredIdle;
}

Description

Fields

Field Type Description

connected

void (*)(void *, temu_Mil1553BusIfaceRef, int)

Called after device is connected to bus

disconnected

void (*)(void *, temu_Mil1553BusIfaceRef, int)

Called after device is disconnected

receive

void (*)(void *, temu_Mil1553Msg *)

Receive of 1553 message

busEnteredIdle

void (*)(void *, temu_Mil1553BusIdleInfo *)

Notifies the bus controller the bus enters an idle

temu_ObjectIface

Include

#include "temu-c/Support/Objsys.h"

Type

struct temu_ObjectIface {
  void (*)(void *, const char *, void *) serialise;
  void (*)(void *, const char *, void *) deserialise;
  int (*)(void *, int) checkSanity;
  void (*)(void *) timeSourceSet;
  void (*)(void *) printObject;
}

Description

Generic object interface The object interface provides generic functionality such as serialisation and sanity checking support.

Fields

Field Type Description

serialise

void (*)(void *, const char *, void *)

Optional function Called after an object has been written to the snapshot, this function can write out additional properties to the snapshot and take other actions.

Note that with the pseudoproperties supporting snapshotting, this function is very rarely needed.

deserialise

void (*)(void *, const char *, void *)

Optional function Called after an object has been restored from a snapshot, this function can read additional properties to the snapshot and take other actions.

Note that with the pseudoproperties supporting snapshotting, this function is very rarely needed.

checkSanity

int (*)(void *, int)

Return zero if the object is connected as expected, return non-zero if the object is not fully connected the default check will ensure that all the Interface references are connected, but does not care about optional interfaces or

timeSourceSet

void (*)(void *)

Optional function

Called when the time source has been set on the object The function can for example post initial events.

printObject

void (*)(void *)

Optional function

Pretty prints the object to stdout, called by the object-print command.

temu_PCIBridgeIface

Include

#include "temu-c/Bus/PCI.h"

Type

struct temu_PCIBridgeIface {
}

Description

Fields

Field Type Description

temu_PCIBusIface

Include

#include "temu-c/Bus/PCI.h"

Type

struct temu_PCIBusIface {
}

Description

Fields

Field Type Description

temu_PCIDeviceIface

Include

#include "temu-c/Bus/PCI.h"

Type

struct temu_PCIDeviceIface {
}

Description

Fields

Field Type Description

temu_PCIExpressBridgeIface

Include

#include "temu-c/Bus/PCIExpress.h"

Type

struct temu_PCIExpressBridgeIface {
}

Description

Fields

Field Type Description

temu_PCIExpressBusIface

Include

#include "temu-c/Bus/PCIExpress.h"

Type

struct temu_PCIExpressBusIface {
}

Description

Fields

Field Type Description

temu_PCIExpressDeviceIface

Include

#include "temu-c/Bus/PCIExpress.h"

Type

struct temu_PCIExpressDeviceIface {
}

Description

Fields

Field Type Description

temu_PDCIface

Include

#include "temu-c/Support/Memory.h"

Type

struct temu_PDCIface {
}

Description

Fields

Field Type Description

temu_PHYIface

Include

#include "temu-c/Bus/Ethernet.h"

Type

struct temu_PHYIface {
}

Description

Fields

Field Type Description

temu_PowerIface

Include

#include "temu-c/Models/Power.h"

Type

struct temu_PowerIface {
}

Description

Fields

Field Type Description

temu_PowerLineIface

Include

#include "temu-c/Models/Power.h"

Type

struct temu_PowerLineIface {
}

Description

Fields

Field Type Description

temu_PowerPCIface

Include

#include "temu-c/Target/PowerPC.h"

Type

struct temu_PowerPCIface {
}

Description

Interface for PowerPC specific functionality

Fields

Field Type Description

temu_ResetIface

Include

#include "temu-c/Models/Reset.h"

Type

struct temu_ResetIface {
}

Description

Fields

Field Type Description

temu_SerialIface

Include

#include "temu-c/Bus/Serial.h"

Type

struct temu_SerialIface {
  void (*)(void *, uint8_t) write;
  void (*)(void *) cts;
}

Description

Serial communications interface

Fields

Field Type Description

write

void (*)(void *, uint8_t)

This function will be called when data is written on the serial bus

cts

void (*)(void *)

Clear to send. Experimental.

temu_SignalIface

Include

#include "temu-c/Bus/Signal.h"

Type

struct temu_SignalIface {
}

Description

Digital signal interface

Fields

Field Type Description

temu_SparcV8Iface

Include

#include "temu-c/Target/Sparc.h"

Type

struct temu_SparcV8Iface {
}

Description

Interface for SPARC specific functionality

Fields

Field Type Description

temu_SpiBusIface

Include

#include "temu-c/Bus/SPI.h"

Type

struct temu_SpiBusIface {
}

Description

Fields

Field Type Description

temu_SpiMasterDeviceIface

Include

#include "temu-c/Bus/SPI.h"

Type

struct temu_SpiMasterDeviceIface {
}

Description

Fields

Field Type Description

temu_SpiSlaveDeviceIface

Include

#include "temu-c/Bus/SPI.h"

Type

struct temu_SpiSlaveDeviceIface {
}

Description

Fields

Field Type Description

temu_SpwPortIface

Include

#include "temu-c/Bus/Spacewire.h"

Type

struct temu_SpwPortIface {
  void (*)(void *, void *, temu_SpwPacket *) receive;
  void (*)(void *, temu_SpwLinkState) signalLinkStateChange;
  temu_SpwLinkState (*)(void *) getOtherSideLinkState;
  void (*)(void *, temu_SpwPortIfaceRef) connect;
  void (*)(void *) disconnect;
  uint64_t (*)(void *, uint64_t) timeToSendPacketNs;
}

Description

SpaceWire port interface. A model must implement this interface for each SpaceWire port.

Fields

Field Type Description

receive

void (*)(void *, void *, temu_SpwPacket *)

Implement to receive and handle the SpaceWire packet. This will be called by the model on the other end that sends or forwards the packet.

signalLinkStateChange

void (*)(void *, temu_SpwLinkState)

The other end device (A) uses this to inform this device (B) about its (A) change of link state.

getOtherSideLinkState

temu_SpwLinkState (*)(void *)

Should return the link state of the device. Called by the other end device to handle connection.

connect

void (*)(void *, temu_SpwPortIfaceRef)

Connect a device to this port.

disconnect

void (*)(void *)

Disconnects the device currently connected to this port.

timeToSendPacketNs

uint64_t (*)(void *, uint64_t)

Return the amount of time required to send a packet through the port, in nano seconds.

temu_TargetExecutionIface

Include

#include "temu-c/Target/Cpu.h"

Type

struct temu_TargetExecutionIface {
}

Description

Fields

Field Type Description