2
3
4
5
6
7
8
9
10
14#include "../types/evmu_peripheral.h"
15#include "../hw/evmu_sfr.h"
16#include "../types/evmu_imemory.h"
19
20
21
22#define EVMU_RAM_TYPE (GBL_TYPEID
(EvmuRam))
23#define EVMU_RAM(self) (GBL_CAST(EvmuRam, self))
28#define EVMU_RAM_NAME "memory"
30#define GBL_SELF_TYPE EvmuRam
34GBL_FORWARD_DECLARE_STRUCT(EvmuRam);
44
45
46
47
48
49
50
51
52
53
54GBL_CLASS_DERIVE_EMPTY(EvmuRam, EvmuPeripheral, EvmuIMemory)
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71GBL_INSTANCE_DERIVE(
EvmuRam, EvmuPeripheral)
77 (dataChanged, GBL_GENERIC, (READ, WRITE, OVERRIDE),
GBL_BOOL_TYPE),
85 (ramValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address), (GBL_ENUM_TYPE, bank)),
86 (ramBankChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_ENUM_TYPE, bank)),
87 (sfrValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address)),
88 (xramValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address), (GBL_ENUM_TYPE, bank)),
89 (xramBankChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_ENUM_TYPE, bank)),
90 (programSourceChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_BOOL_TYPE, flash)),
91 (stackPush, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT8_TYPE, value)),
92 (stackPop, (GBL_INSTANCE_TYPE, pReceiver))
100
101
102
103
109
110
111
112
126
127
128
129
141
142
143
144
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
EVMU_PROGRAM_SRC
Source memory space for program execution.
@ EVMU_PROGRAM_SRC_FLASH_BANK_1
Flash (Bank 1)
@ EVMU_PROGRAM_SRC_FLASH_BANK_0
Flash (Bank 0)
@ EVMU_PROGRAM_SRC_ROM
ROM.
GblType EvmuRam_type(void)
Returns the GblType UUID associated with EvmuRam.
#define EVMU_SFR_EXT_FLASH_BANK_1
#define EVMU_SFR_EXT_FLASH_BANK_0
uint8_t EvmuWord
Represents a single 8-bit CPU word.
uint32_t EvmuAddress
Represents a generic absolute address.
#define GBL_PROPERTIES(object,...)
GblInstance structure for EvmuPeripheral.
EvmuWord EvmuRam_viewStack(const EvmuRam *pSelf, size_t depth)
Returns the value at the given stack depth (0 is current stack location)
EVMU_PROGRAM_SRC EvmuRam_programSrc(const EvmuRam *pSelf)
Returns the current source memory chip for program data (ROM or Flash)
EVMU_RESULT EvmuRam_writeDataLatch(EvmuRam *pSelf, EvmuAddress addr, EvmuWord val)
Writes val to the latch located at the addr address in data memory.
EvmuWord EvmuRam_readDataLatch(const EvmuRam *pSelf, EvmuAddress addr)
Returns the latch value located in data memory at the address given by addr.
EVMU_RESULT EvmuRam_setProgramSrc(EvmuRam *pSelf, EVMU_PROGRAM_SRC src)
Sets the current source memory chip for program data to src (ROM or Flash)
int EvmuRam_stackDepth(const EvmuRam *pSelf)
Returns the current depth of the program stack.
EVMU_RESULT EvmuRam_pushStack(EvmuRam *pSelf, EvmuWord value)
Pushes value onto the top of the stack, updating the stack pointer.
EvmuWord EvmuRam_popStack(EvmuRam *pSelf)
Pops the value from the top of the stack, returning it and updating the stack pointer.
EVMU_RESULT EvmuRam_writeProgram(EvmuRam *pSelf, EvmuAddress addr, EvmuWord val)
Writes the val value to the location given by addr to program memory.
EvmuWord EvmuRam_viewData(const EvmuRam *pSelf, EvmuAddress addr)
Returns the register or port value located in data memory at the given address WITHOUT triggering rea...
EvmuAddress EvmuRam_indirectAddress(const EvmuRam *pSelf, size_t mode)
Returns the memory address pointed to by the given register indirect mode.
EvmuWord EvmuRam_readProgram(const EvmuRam *pSelf, EvmuAddress addr)
Returns the value located in program memory at the address given by addr.
EVMU_RESULT EvmuRam_writeData(EvmuRam *pSelf, EvmuAddress addr, EvmuWord val)
Writes val to the register or port at the addr address in data memory.
EvmuWord EvmuRam_readData(const EvmuRam *pSelf, EvmuAddress addr)
Returns the register or port value located in data memory at the address given by addr.
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)