TEMU
2
The Terma Emulator
|
#include <stdint.h>
#include "temu-c/Support/Attributes.h"
#include "temu-c/Support/Objsys.h"
#include "temu-c/Memory/Memory.h"
Go to the source code of this file.
Macros | |
#define | TEMU_FIELD_WR (1 << 0) |
#define | TEMU_FIELD_WARM_RESET (1 << 1) |
Typedefs | |
typedef struct temu_RegisterBank | temu_RegisterBank |
typedef struct temu_Register | temu_Register |
typedef struct temu_Field | temu_Field |
Functions | |
TEMU_API temu_RegisterBank * | temu_addRegisterBank (temu_Class *C, const char *Name, temu_MemAccessIface *MemAccessIface) |
temu_addRegisterBank Adds a register bank to a T-EMU class More... | |
TEMU_API const char * | temu_getRegisterBankName (temu_RegisterBank *Bank) |
temu_getRegisterBankName Retrieves the register bank name from its object More... | |
TEMU_API temu_Register * | temu_addRegister (temu_RegisterBank *Bank, const char *Name, int Offset, temu_Type Typ, int Count, temu_PropWriter Wr, temu_PropReader Rd, const char *Doc, uint32_t DeviceOffset, uint32_t Stride) |
TEMU_API void | temu_addField (temu_Register *R, const char *Name, uint64_t Mask, uint64_t ColdReset, uint64_t WarmReset, uint64_t Flags, const char *Doc) |
TEMU_API temu_RegisterBank * | temu_getRegisterBank (temu_Class *C, const char *Name) |
temu_getRegisterBank Get a register bank from a class by name More... | |
TEMU_API int | temu_getRegisterBanks (temu_Class *C, unsigned Idx, unsigned Length, temu_RegisterBank **Banks) |
temu_getRegisterBanks Get all register banks of a class More... | |
TEMU_API temu_Register * | temu_getRegister (temu_RegisterBank *Bank, const char *Name) |
temu_getRegister Get a register from a register bank by name More... | |
TEMU_API int | temu_getRegisters (temu_RegisterBank *Bank, unsigned Idx, unsigned Length, temu_Register **Regs) |
temu_getRegisters Get all or chunk of registers from a bank More... | |
TEMU_API const char * | temu_getRegisterName (temu_Register *R) |
temu_getRegisterName Retrieve register name from pointer More... | |
TEMU_API const char * | temu_getRegisterDocs (temu_Register *R) |
temu_getRegisterDocs Get the documentation of a register as a string More... | |
TEMU_API temu_Field * | temu_getField (temu_Register *R, const char *Name) |
temu_getField Get a field of a register More... | |
TEMU_API int | temu_getFields (temu_Register *R, unsigned Idx, unsigned Length, temu_Field **Fields) |
temu_getFields Get all fields of a register More... | |
TEMU_API const char * | temu_getFieldName (temu_Field *R) |
temu_getFieldName Get the name of a field from a field object More... | |
TEMU_API const char * | temu_getFieldDocs (temu_Field *R) |
temu_getFieldDocs Get the documentation of a field as a C-string More... | |
TEMU_API uint64_t | temu_getFieldMask (temu_Field *Field) |
temu_getFieldMask Get field mask More... | |
TEMU_API uint64_t | temu_getFieldValue (void *Obj, const char *RegName, const char *FieldName) |
temu_getFieldValue Retrieve the value of a field in a register More... | |
TEMU_API int | temu_setFieldValue (void *Obj, const char *RegName, const char *FieldName, uint64_t Value) |
temu_setFieldValue Set a field's value in a register More... | |
TEMU_API int | temu_writeFieldValue (void *Obj, const char *RegName, const char *FieldName, uint64_t Value) |
temu_writeFieldValue Set a field's value in a register with side-effects More... | |
TEMU_API uint64_t | temu_getRegisterColdResetValue (temu_Register *Reg) |
TEMU_API uint64_t | temu_getRegisterWarmResetValue (temu_Register *Reg) |
TEMU_API uint64_t | temu_getRegisterWriteMask (temu_Register *Reg) |
temu_getRegisterWriteMask Get the current write mask of a register More... | |
TEMU_API uint64_t | temu_getRegisterReadMask (temu_Register *Reg) |
temu_getRegisterReadMask Get the current read mask of a register More... | |
#define TEMU_FIELD_WARM_RESET (1 << 1) |
Definition at line 81 of file Register.h.
#define TEMU_FIELD_WR (1 << 0) |
Definition at line 80 of file Register.h.
typedef struct temu_Field temu_Field |
Definition at line 27 of file Register.h.
typedef struct temu_Register temu_Register |
Definition at line 26 of file Register.h.
typedef struct temu_RegisterBank temu_RegisterBank |
Definition at line 25 of file Register.h.
TEMU_API void temu_addField | ( | temu_Register * | R, |
const char * | Name, | ||
uint64_t | Mask, | ||
uint64_t | ColdReset, | ||
uint64_t | WarmReset, | ||
uint64_t | Flags, | ||
const char * | Doc | ||
) |
Add field to meta register
Adds a field to the meta register.
R | Meta register pointer. |
Name | Name of of field (must be a C-compatible identifier) |
Mask | Mask identifying the bits in the register corresponding to the field. Mask must contain consecutive bits only. |
ColdReset | Reset value used for a cold reset. |
WarmReset | Reset value used for a warm reset. |
Flags | Flags used: TEMU_FIELD_WR means field is writable, TEMU_FIELD_WARM_RESET means the field is subject to reset actions also on warm resets. |
Doc | Documentation string |
TEMU_API temu_Register* temu_addRegister | ( | temu_RegisterBank * | Bank, |
const char * | Name, | ||
int | Offset, | ||
temu_Type | Typ, | ||
int | Count, | ||
temu_PropWriter | Wr, | ||
temu_PropReader | Rd, | ||
const char * | Doc, | ||
uint32_t | DeviceOffset, | ||
uint32_t | Stride | ||
) |
Add register property to class
Adds a register with the given name to a class. It returns a reference to a meta register which can be used to add fields.
Bank | Register bank to add register to |
Name | Name of register (must be a valid C-identifier) |
Offset | Offset to storage element in the device struct. |
Typ | Type of register, note that registers are limited to unsigned integer types with fixed width. |
Count | Number of registers (normally 1) |
Wr | Register write function |
Rd | Register read function |
Doc | Documentation string for register. |
DeviceOffset | Offset of register in memory system. This is the same offset that is used in the memory transaction interface. |
Stride | In case the register is an array of registers, then the stride is used for the offset in physical address space between each register. |
TEMU_API temu_RegisterBank* temu_addRegisterBank | ( | temu_Class * | C, |
const char * | Name, | ||
temu_MemAccessIface * | MemAccessIface | ||
) |
temu_addRegisterBank Adds a register bank to a T-EMU class
C | Pointer to the T-EMU class |
Name | Name of the register |
MemAccessIface | Pointer to the register memory access interface |
TEMU_API temu_Field* temu_getField | ( | temu_Register * | R, |
const char * | Name | ||
) |
temu_getField Get a field of a register
R | Pointer to the register that contains the field |
Name | Name of the field in question |
TEMU_API const char* temu_getFieldDocs | ( | temu_Field * | R | ) |
temu_getFieldDocs Get the documentation of a field as a C-string
R | Pointer to the field object |
TEMU_API uint64_t temu_getFieldMask | ( | temu_Field * | Field | ) |
temu_getFieldMask Get field mask
Field | Pointer to the field object |
TEMU_API const char* temu_getFieldName | ( | temu_Field * | R | ) |
temu_getFieldName Get the name of a field from a field object
R | Pointer to the field object |
TEMU_API int temu_getFields | ( | temu_Register * | R, |
unsigned | Idx, | ||
unsigned | Length, | ||
temu_Field ** | Fields | ||
) |
temu_getFields Get all fields of a register
R | Pointer to the register that has the fields |
Idx | The starting index at which a field will be read in the full array |
Length | The length to be read |
Fields | Array of pointers to the fields objects, must be allocated with size "Length" |
TEMU_API uint64_t temu_getFieldValue | ( | void * | Obj, |
const char * | RegName, | ||
const char * | FieldName | ||
) |
temu_getFieldValue Retrieve the value of a field in a register
Obj | The object of the class the has the register |
RegName | Register name |
FieldName | Field name |
TEMU_API temu_Register* temu_getRegister | ( | temu_RegisterBank * | Bank, |
const char * | Name | ||
) |
temu_getRegister Get a register from a register bank by name
Bank | Pointer to the register bank object |
Name | Name of the register |
TEMU_API temu_RegisterBank* temu_getRegisterBank | ( | temu_Class * | C, |
const char * | Name | ||
) |
temu_getRegisterBank Get a register bank from a class by name
C | Pointer to the T-EMU class |
Name | Name of the register bank |
TEMU_API const char* temu_getRegisterBankName | ( | temu_RegisterBank * | Bank | ) |
temu_getRegisterBankName Retrieves the register bank name from its object
Bank | Pointer to the register bank name |
TEMU_API int temu_getRegisterBanks | ( | temu_Class * | C, |
unsigned | Idx, | ||
unsigned | Length, | ||
temu_RegisterBank ** | Banks | ||
) |
temu_getRegisterBanks Get all register banks of a class
C | Pointer to the T-EMU class |
Idx | The index, at which the reading of banks should start |
Length | The length to be read |
Banks | Array of pointers to the register banks, must be allocated with size "Length" |
TEMU_API uint64_t temu_getRegisterColdResetValue | ( | temu_Register * | Reg | ) |
Returns the cold reset value of the register (computed from the field info data). Cold reset is also known as a hard reset, and implies that the power has been off for some time.
Reg | Pointer to the register |
TEMU_API const char* temu_getRegisterDocs | ( | temu_Register * | R | ) |
temu_getRegisterDocs Get the documentation of a register as a string
R | Pointer to the register |
TEMU_API const char* temu_getRegisterName | ( | temu_Register * | R | ) |
temu_getRegisterName Retrieve register name from pointer
R | Pointer to the register |
TEMU_API uint64_t temu_getRegisterReadMask | ( | temu_Register * | Reg | ) |
temu_getRegisterReadMask Get the current read mask of a register
Reg | Pointer to the register |
TEMU_API int temu_getRegisters | ( | temu_RegisterBank * | Bank, |
unsigned | Idx, | ||
unsigned | Length, | ||
temu_Register ** | Regs | ||
) |
temu_getRegisters Get all or chunk of registers from a bank
Bank | Pointer to the register bank object |
Idx | The starting number of the register |
Length | The length of the |
Regs | Array of pointers to the registers to be allocated with size "Length" |
TEMU_API uint64_t temu_getRegisterWarmResetValue | ( | temu_Register * | Reg | ) |
Returns the warm reset value of the register
Reg | Pointer to the register |
TEMU_API uint64_t temu_getRegisterWriteMask | ( | temu_Register * | Reg | ) |
temu_getRegisterWriteMask Get the current write mask of a register
Reg | Pointer to the register |
TEMU_API int temu_setFieldValue | ( | void * | Obj, |
const char * | RegName, | ||
const char * | FieldName, | ||
uint64_t | Value | ||
) |
temu_setFieldValue Set a field's value in a register
Obj | The object that contains the register |
RegName | Register name |
FieldName | Field name |
Value | The value to be set |
TEMU_API int temu_writeFieldValue | ( | void * | Obj, |
const char * | RegName, | ||
const char * | FieldName, | ||
uint64_t | Value | ||
) |
temu_writeFieldValue Set a field's value in a register with side-effects
Obj | The object that contains the register |
RegName | Register name |
FieldName | Field name |
Value | The value to be set |