TEMU  4.4
The Terma Emulator
Machine.h
Go to the documentation of this file.
1 //===------------------------------------------------------------*- C++ -*-===//
2 //
3 // TEMU: The Terma Emulator
4 // (c) Terma 2015, 2016
5 // Authors: Mattias Holm <maho (at) terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef TEMU_MACHINE_H
10 #define TEMU_MACHINE_H
11 
12 #include "temu-c/Support/Cpu.h"
13 #include "temu-c/Target/Cpu.h"
14 #include <stdint.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /*!
21  Standard machine interface
22  */
23 typedef struct temu_MachineIface {
24  //! Send reset to all processors in the machine
25  void (*reset)(void *Obj, int ResetType);
26  //! Run the machine for the given time
28 
29  //! Step the given process a number of steps.
31  //! Get current processor.
33  //! Get processor by index.
34  temu_CpuIfaceRef (*getCpu)(void *Obj, unsigned Idx);
35  //! Get machine time in nanoseconds.
36  int64_t (*getTime)(void *Machine);
37 
38  //! Return the current CPU number
39  unsigned (*getCurrentCpuId)(void *Obj);
40 
41  //! Async stop must be async safe, it can be used to tell the
42  //! emulator to stop in an async safe way, e.g. from a signal
43  //! handler.
44  void (*asyncStop)(void *Obj);
45 } temu_MachineIface;
46 #define TEMU_MACHINE_IFACE_TYPE "MachineIface"
47 TEMU_IFACE_REFERENCE_TYPE(temu_Machine);
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 #endif /* ! TEMU_DEVICE_H */
temu_MachineIface::getCurrentCpuId
unsigned(* getCurrentCpuId)(void *Obj)
Return the current CPU number.
Definition: Machine.h:39
temu_MachineIface::asyncStop
void(* asyncStop)(void *Obj)
Definition: Machine.h:44
temu_MachineIface::reset
void(* reset)(void *Obj, int ResetType)
Send reset to all processors in the machine.
Definition: Machine.h:25
temu_MachineIface::getCpu
temu_CpuIfaceRef(* getCpu)(void *Obj, unsigned Idx)
Get processor by index.
Definition: Machine.h:34