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_BinaryTranslationControlIface

Include

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

Type

struct temu_BinaryTranslationControlIface {
  void (*)(void *) enableBinaryTranslator;
  void (*)(void *) disableBinaryTranslator;
  void (*)(void *, unsigned int) setThreshold;
  int (*)(void *, uint64_t, uint64_t, unsigned int) translateInstructions;
  int (*)(void *, uint64_t, uint64_t) translateBlock;
  int (*)(void *, uint64_t, uint64_t) translateFunc;
  int (*)(void *, uint64_t, uint64_t, int) chainBlocks;
  const char *(*)(void *, uint64_t) disassembleBlock;
  int (*)(void *, uint64_t) clearBlock;
  int (*)(void *, uint64_t) clearBlocksOnPage;
  void (*)(void *, temu_BTStatID) enableStatistics;
  void (*)(void *, temu_BTStatID) disableStatistics;
  uint64_t (*)(void *, temu_BTStatID) getStatistics;
  void (*)(void *, temu_BTStatID) clearStatistics;
}

Description

Fields

Field Type Description

enableBinaryTranslator

void (*)(void *)

Enable translator for processor

disableBinaryTranslator

void (*)(void *)

Disable translator for processor

setThreshold

void (*)(void *, unsigned int)

Set threshold (of call target execution) for triggering translation

translateInstructions

int (*)(void *, uint64_t, uint64_t, unsigned int)

Translate specific instruction range

translateBlock

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

Translate block (terminating with a branch, or end of page (special rules for delay slots apply)).

translateFunc

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

Translate a complete function (determined to be statically reachable from the PA on this page).

chainBlocks

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

Manually chain blocks.

disassembleBlock

const char ()(void *, uint64_t)

Disassemble block (using the host assembler)

clearBlock

int (*)(void *, uint64_t)

Remove a specific block and unlink incoming/outgoing chains

clearBlocksOnPage

int (*)(void *, uint64_t)

Remove all translated blocks on a specific physical page

enableStatistics

void (*)(void *, temu_BTStatID)

Enable collection of statistic in translated code

disableStatistics

void (*)(void *, temu_BTStatID)

Disable collection of statistic in translated code

getStatistics

uint64_t (*)(void *, temu_BTStatID)

Get statistic

clearStatistics

void (*)(void *, temu_BTStatID)

Reset statistics

temu_BlockDisassemblerIface

Include

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

Type

struct temu_BlockDisassemblerIface {
}

Description

Block disassembler disassembles data blocks of code.

The main purpose is to disassemble host code, however the interface is genericly named so it could be used for other purposes in the future.

The disassemble method is supposed to return a thread local C-string, that is valid until the next call of the function. Consequently, you do not need to free or in other ways worry of the string.

field disassemble Disassembly function.

Fields

Field Type Description

temu_CacheCtrlIface

Include

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

Type

struct temu_CacheCtrlIface {
  void (*)(void *) evictionInProgress;
  void (*)(void *) evictionCompleted;
}

Description

The cache control interface can be implemented by a cache controller. Which may be embedded in a CPU or device model. Typically, the assumption is that the cache controller will turn on and off the cache and that it may need to be notified on global eviction operations, which may or may not be reflected in the cache controllers status registers.

Fields

Field Type Description

evictionInProgress

void (*)(void *)

Global evict operation ongoing

evictionCompleted

void (*)(void *)

Global evict operation completed

temu_CacheIface

Include

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

Type

struct temu_CacheIface {
  void (*)(void *) enable;
  void (*)(void *) disable;
  void (*)(void *) freeze;
  void (*)(void *, uint64_t) lockLine;
  void (*)(void *, uint64_t) unlockLine;
  void (*)(void *) invalidateAll;
  void (*)(void *, uint64_t) invalidateLine;
  void (*)(void *) evictAll;
  void (*)(void *, uint64_t) evictLine;
  uint32_t (*)(void *) getReplacementPolicy;
  uint32_t (*)(void *) getSets;
  uint32_t (*)(void *) getWays;
  uint32_t (*)(void *) getLineSize;
  int (*)(void *, uint64_t) isValid;
  uint64_t (*)(void *, uint64_t) readFlags;
  void (*)(void *, uint64_t, uint64_t) writeFlags;
  uint64_t (*)(void *, uint64_t) readData;
  int (*)(void *, uint64_t, uint64_t) writeData;
}

Description

Invalidation: cache line will be tagged as invalid (i.e. flushed) Eviction: cache line will be invalidated and in writeBack caches the content will be written back to memory.

Fields

Field Type Description

enable

void (*)(void *)

Enable cache

disable

void (*)(void *)

Disable cache

freeze

void (*)(void *)

Freeze cache

lockLine

void (*)(void *, uint64_t)

Lock line for addr

unlockLine

void (*)(void *, uint64_t)

Unlock line

invalidateAll

void (*)(void *)

Invalidate entire cache

invalidateLine

void (*)(void *, uint64_t)

Invalidate single line

evictAll

void (*)(void *)

Evict all (i.e. spill to memory)

evictLine

void (*)(void *, uint64_t)

Evict line

getReplacementPolicy

uint32_t (*)(void *)

Interrogation of cache properties - A directly mapped cache has 1 way, but typically several sets - A fully associative cache has 1 set, but typically several ways - Total cache size in bytes is sets * ways * linesize

getSets

uint32_t (*)(void *)

Get number of sets

getWays

uint32_t (*)(void *)

Get number of ways

getLineSize

uint32_t (*)(void *)

Get line size in bytes

isValid

int (*)(void *, uint64_t)

Check if an address belong to a cached line

readFlags

uint64_t (*)(void *, uint64_t)

Access the flags data, the format is cache model specific and can for specific models include also the tag. Typically, this is used for diagnostic access for more accurate cache models. Note that addr is not a physical address, but rather an address interpreted differently for different caches. I.e. the address is in a cache local address space.

writeFlags

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

Write flags data

readData

uint64_t (*)(void *, uint64_t)

Get cached data for the given address. The data returned comes from RAM using a normal memory transaction in case the cache is modelled for timing only, otherwise it comes from the cache model. Addr is a cache local address space, which depends on the cache implementation. The functions are intended for diagnostic cache access which is implemented in some systems. Note that on writes, the data will NOT be written to memory except in the case the cache line would be evicted in an accurate cache model. All reads from valid addresses succeed, other addresses are undefined. writeData returns non-zero on failure (e.g. invalid address).

writeData

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

Write data in cache

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_CodePatternIface

Include

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

Type

struct temu_CodePatternIface {
}

Description

Fields

Field Type Description

temu_CpuIface

Include

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

Type

struct temu_CpuIface {
  const char *(*)(void *, int) getTrapName;
  const temu_CpuInfo *(*)(void *) getCPUInfo;
  int (*)(void *) wakeUp;
  void (*)(void *) forceEarlyExit;
  void *(*)(void *, uint64_t) translateIRAddress;
  void (*)(void *) enableModeSwitchEvents;
  void (*)(void *) disableModeSwitchEvents;
  void (*)(void *) enableProfiling;
  void (*)(void *) disableProfiling;
  void (*)(void *) flushProfileCaches;
  int64_t (*)(void *) getIdleSteps;
  int64_t (*)(void *) getIdleCycles;
  void (*)(void *) enterHaltedMode;
  void (*)(void *, temu_CpuExitReason) forceSpecificExit;
  void (*)(void *) purgeDirtyPages;
  void (*)(void *) invalidateFetchAtc;
  int (*)(void *, uint64_t, uint32_t *, uint64_t, uint64_t *) translateAddressWithRoot;
  temu_CpuExitReason (*)(void *, uint64_t) synchronizingRun;
  temu_CpuExitReason (*)(void *, uint64_t) synchronizingRunUntil;
  temu_CpuExitReason (*)(void *, uint64_t) synchronizingStep;
  temu_CpuExitReason (*)(void *, uint64_t, uint64_t) synchronizingStepUntil;
}

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

getTrapName

const char ()(void *, int)

Get name for trap

getCPUInfo

const temu_CpuInfo ()(void *)

Experimental

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.

translateIRAddress

void ()(void *, uint64_t)

Calculate IR pointer from virtual address

enableModeSwitchEvents

void (*)(void *)

Enable events when switching CPU mode (e.g. user to supervisor)

disableModeSwitchEvents

void (*)(void *)

Disable events when switching CPU mode (e.g. user to supervisor)

enableProfiling

void (*)(void *)

Enable profiling mode

disableProfiling

void (*)(void *)

Disable profiling mode

flushProfileCaches

void (*)(void *)

Flush profile caches

getIdleSteps

int64_t (*)(void *)

Get the number of idle steps

getIdleCycles

int64_t (*)(void *)

Get the number of idle cycles

enterHaltedMode

void (*)(void *)

Make the processor enter halted mode using a stack posted event.

forceSpecificExit

void (*)(void *, temu_CpuExitReason)

Force specific CPU exit

purgeDirtyPages

void (*)(void *)

Purge all dirty memory pages

invalidateFetchAtc

void (*)(void *)

Invalidate ATC for fetches

translateAddressWithRoot

int (*)(void *, uint64_t, uint32_t *, uint64_t, uint64_t *)

MMU translation with a specific ROOT pointer

synchronizingRun

temu_CpuExitReason (*)(void *, uint64_t)

Run function for use by scheduler, do not call directly.

synchronizingRunUntil

temu_CpuExitReason (*)(void *, uint64_t)

Run function for use by scheduler, do not call directly.

synchronizingStep

temu_CpuExitReason (*)(void *, uint64_t)

Step function for use by scheduler, do not call directly.

synchronizingStepUntil

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

Step function for use by scheduler, do not call directly.

temu_DebuggerIface

Include

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

Type

struct temu_DebuggerIface {
}

Description

Fields

Field Type Description

temu_DeviceIdIface

Include

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

Type

struct temu_DeviceIdIface {
  void (*)(void *, uint32_t, void *, temu_DeviceIdMemAccessIface *) attach;
}

Description

Device ID Interface

This interface enables an external simulator to attach a device ID handler in the DeviceIdIntegrator.

Fields

Field Type Description

attach

void (*)(void *, uint32_t, void *, temu_DeviceIdMemAccessIface *)

Attach external device

temu_DeviceIdMemAccessIface

Include

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

Type

struct temu_DeviceIdMemAccessIface {
  void (*)(void *, uint32_t, temu_MemTransaction *) fetch;
  void (*)(void *, uint32_t, temu_MemTransaction *) read;
  void (*)(void *, uint32_t, temu_MemTransaction *) write;
}

Description

Device ID Memory Access Interface

This interface mirrors the memory access interface, but takes an additional device id parameter to be filled in by the DeviceIdIntegrator class.

Fields

Field Type Description

fetch

void (*)(void *, uint32_t, temu_MemTransaction *)

Called when fetching an instruction

read

void (*)(void *, uint32_t, temu_MemTransaction *)

Called when reading data

write

void (*)(void *, uint32_t, temu_MemTransaction *)

Called when writing data

temu_DeviceIface

Include

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

Type

struct temu_DeviceIface {
}

Description

Standard device interface

field reset Called when the device is reset.

field mapDevice If defined, called when a device is mapped.

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 {
  void (*)(void *, uint64_t) setResetAddress;
  uint64_t (*)(void *) getResetAddress;
}

Description

Interface for controlling the reset address used in a processor.

Processors may in some cases have their reset addresses set dynamically. This interface expose such functionality to peripherals.

Fields

Field Type Description

setResetAddress

void (*)(void *, uint64_t)

Update reset address in processor

getResetAddress

uint64_t (*)(void *)

Get reset address in processor, optional method

temu_E500MMUIface

Include

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

Type

struct temu_E500MMUIface {
}

Description

Fields

Field Type Description

temu_EthDelayIface

Include

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

Type

struct temu_EthDelayIface {
}

Description

Fields

Field Type Description

temu_EthernetIface

Include

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

Type

struct temu_EthernetIface {
}

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 {
  int (*)(void *, uint64_t, uint64_t) beginBlock;
  int (*)(void *, uint64_t, uint64_t) endBlock;
  int (*)(void *, uint64_t, uint64_t, uint32_t, uint32_t) beginInstr;
  int (*)(void *, uint64_t, uint64_t, uint32_t, uint32_t, int) endInstr;
}

Description

Binary translation instrumentation interface

Fields

Field Type Description

beginBlock

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

Called on start of a block

endBlock

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

Called at the end of a block

beginInstr

int (*)(void *, uint64_t, uint64_t, uint32_t, uint32_t)

Called when instruction is started

endInstr

int (*)(void *, uint64_t, uint64_t, uint32_t, uint32_t, int)

Called when instruction is finished. Arm: 0 = normal / not taken branch. 1 = taken conditional instruction.

temu_IrqClientIface

Include

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

Type

struct temu_IrqClientIface {
  void (*)(void *, uint8_t) ackInterrupt;
  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

ackInterrupt

void (*)(void *, uint8_t)

Acknowledge interrupt (IRQ controller should clear interrupt)

updateInterrupts

void (*)(void *)

Called in case IRQ re-issuing is needed eg. when the IRQ controlling registers have been modified. IRQ controller should reevaluate interrupts and reraise them upstream.

temu_IrqControllerIface

Include

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

Type

struct temu_IrqControllerIface {
  void (*)(void *, uint8_t) raiseInterrupt;
  void (*)(void *, uint8_t) lowerInterrupt;
}

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

raiseInterrupt

void (*)(void *, uint8_t)

Raise interrupt

lowerInterrupt

void (*)(void *, uint8_t)

Lower interrupt

temu_Leon5Iface

Include

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

Type

struct temu_Leon5Iface {
}

Description

Fields

Field Type Description

temu_LineDataLoggerIface

Include

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

Type

struct temu_LineDataLoggerIface {
  uint64_t (*)(void *) getLineCount;
  const char *(*)(void *, uint64_t) getLine;
}

Description

Simple interface to get recorded line data from e.g. the console model.

Fields

Field Type Description

getLineCount

uint64_t (*)(void *)

Get number of lines

getLine

const char ()(void *, uint64_t)

Get pointer to line string

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 {
  void (*)(void *, int) reset;
  temu_CpuExitReason (*)(void *, uint64_t) run;
  temu_CpuExitReason (*)(void *, int, uint64_t) step;
  temu_CpuIfaceRef (*)(void *) getCurrentCpu;
  temu_CpuIfaceRef (*)(void *, unsigned int) getCpu;
  int64_t (*)(void *) getTime;
  unsigned int (*)(void *) getCurrentCpuId;
  void (*)(void *) asyncStop;
}

Description

Standard machine interface

Fields

Field Type Description

reset

void (*)(void *, int)

Send reset to all processors in the machine

run

temu_CpuExitReason (*)(void *, uint64_t)

Run the machine for the given time

step

temu_CpuExitReason (*)(void *, int, uint64_t)

Step the given process a number of steps.

getCurrentCpu

temu_CpuIfaceRef (*)(void *)

Get current processor.

getCpu

temu_CpuIfaceRef (*)(void *, unsigned int)

Get processor by index.

getTime

int64_t (*)(void *)

Get machine time in nanoseconds.

getCurrentCpuId

unsigned int (*)(void *)

Return the current CPU number

asyncStop

void (*)(void *)

Async stop must be async safe, it can be used to tell the emulator to stop in an async safe way, e.g. from a signal handler.

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;
  void (*)(void *, uint64_t, uint64_t) mapped;
  const temu_MemAccessCapabilities *(*)(void *) getCapabilities;
  void (*)(void *, temu_MemTransaction *) probe;
}

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.

mapped

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

Optional method, called when interface is mapped

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

W_ALL, custom memories must explicitly register itself as fetchable memory. in addition, the default assumption is that the device does not support large transactions.

probe

void (*)(void *, temu_MemTransaction *)

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 {
  int (*)(void *, uint64_t, uint64_t, temu_Object *, uint32_t) mapDevice;
  void (*)(void *, uint64_t, uint64_t, temu_MemoryAttr) setAttr;
  void (*)(void *, uint64_t, uint64_t, temu_MemoryAttr) clearAttr;
  temu_MemoryAttrs (*)(void *, uint64_t) getAttrs;
  int (*)(void *, uint64_t, uint64_t, temu_Object *, const char *, uint32_t) mapDeviceWithNamedIface;
  int (*)(void *, uint64_t, uint64_t) unmapRange;
  int (*)(void *, uint64_t, uint64_t, temu_Object *, temu_MemAccessIface *, uint32_t) mapDeviceWithIface;
}

Description

Fields

Field Type Description

mapDevice

int (*)(void *, uint64_t, uint64_t, temu_Object *, uint32_t)

Map device (using the default MemAccessIface interface)

setAttr

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

Set attribute bit

clearAttr

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

Clear attribute bit

getAttrs

temu_MemoryAttrs (*)(void *, uint64_t)

Get attributes for address

mapDeviceWithNamedIface

int (*)(void *, uint64_t, uint64_t, temu_Object *, const char *, uint32_t)

Map device with named interface

unmapRange

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

Unmap devices in range

mapDeviceWithIface

int (*)(void *, uint64_t, uint64_t, temu_Object *, temu_MemAccessIface *, uint32_t)

Map device with interface pointer

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_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 {
  void (*)(void *) powerOn;
  void (*)(void *) powerOff;
  temu_PowerState (*)(void *) getPowerState;
}

Description

Power interface

Fields

Field Type Description

powerOn

void (*)(void *)

Power on device

powerOff

void (*)(void *)

Power off device

getPowerState

temu_PowerState (*)(void *)

Get current power state

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 {
  uint64_t (*)(const void *) getXER;
  void (*)(void *, uint64_t) setXER;
  uint32_t (*)(const void *) getCR;
  void (*)(void *, uint32_t) setCR;
  uint64_t (*)(const void *) getMSR;
  void (*)(void *, uint64_t) setMSR;
  uint32_t (*)(const void *) getCTR;
  void (*)(void *, uint32_t) setCTR;
  uint64_t (*)(const void *) getLR;
  void (*)(void *, uint64_t) setLR;
  uint32_t (*)(const void *) getFPSCR;
  void (*)(void *, uint32_t) setFPSCR;
}

Description

Interface for PowerPC specific functionality

Fields

Field Type Description

getXER

uint64_t (*)(const void *)

Get XER register

setXER

void (*)(void *, uint64_t)

Set XER register

getCR

uint32_t (*)(const void *)

Get CR register

setCR

void (*)(void *, uint32_t)

Set XER register

getMSR

uint64_t (*)(const void *)

Get MSR register

setMSR

void (*)(void *, uint64_t)

Set MSR register

getCTR

uint32_t (*)(const void *)

Get CTR register

setCTR

void (*)(void *, uint32_t)

Set CTR register

getLR

uint64_t (*)(const void *)

Get LR register

setLR

void (*)(void *, uint64_t)

Set LR register

getFPSCR

uint32_t (*)(const void *)

Get FPSCR register

setFPSCR

void (*)(void *, uint32_t)

Set FPSCR register

temu_ResetIface

Include

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

Type

struct temu_ResetIface {
  void (*)(void *, int) reset;
}

Description

Reset interface

Alternative to the reset function in the device interface.

Fields

Field Type Description

reset

void (*)(void *, int)

Reset device

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_SpiRomIface

Include

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

Type

struct temu_SpiRomIface {
}

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_StringBreakpointIface

Include

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

Type

struct temu_StringBreakpointIface {
  void (*)(temu_Object *) printBreakpointList;
  void (*)(temu_Object *, const char *) addBreakpoint;
  void (*)(temu_Object *, int) deleteBreakpoint;
}

Description

Simple interface to get recorded line data from e.g. the console model.

Fields

Field Type Description

printBreakpointList

void (*)(temu_Object *)

print all breakpoints with their indexes

addBreakpoint

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

add log line to use for break

deleteBreakpoint

void (*)(temu_Object *, int)

delete breakpoint with index = idx, if idx = -1 deleate all

temu_TargetExecutionIface

Include

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

Type

struct temu_TargetExecutionIface {
  void (*)(void *, uint64_t) profileCounterOverflow;
  void (*)(void *, uint64_t, uint64_t) wrotePage;
  void *(*)(void *) getRawRuntime;
}

Description

Internal interface for binary translator

Fields

Field Type Description

profileCounterOverflow

void (*)(void *, uint64_t)

Profile counter overflow handler

wrotePage

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

Page written (for flushing caches)

getRawRuntime

void ()(void *)

Internal usage