2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
32#include "../types/evmu_peripheral.h"
33#include "../types/evmu_imemory.h"
36
37
38
39#define EVMU_FLASH_TYPE (GBL_TYPEID
(EvmuFlash))
40#define EVMU_FLASH(self) (GBL_CAST(EvmuFlash, self))
42#define EVMU_FLASH_GET_CLASS(self) (GBL_CLASSOF(EvmuFlash, self))
46
47
48
49#define EVMU_FLASH_BANK_SIZE 65536
50#define EVMU_FLASH_BANKS 2
55
56
57
58#define EVMU_FLASH_PROGRAM_BYTE_COUNT 128
59#define EVMU_FLASH_PROGRAM_STATE_0_ADDRESS 0x5555
60#define EVMU_FLASH_PROGRAM_STATE_0_VALUE 0xaa
61#define EVMU_FLASH_PROGRAM_STATE_1_ADDRESS 0x2aaa
62#define EVMU_FLASH_PROGRAM_STATE_1_VALUE 0x55
63#define EVMU_FLASH_PROGRAM_STATE_2_ADDRESS 0x5555
64#define EVMU_FLASH_PROGRAM_STATE_2_VALUE 0xa0
67#define GBL_SELF_TYPE EvmuFlash
71GBL_DECLARE_STRUCT(EvmuFlash);
79} EVMU_FLASH_PROGRAM_STATE;
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97GBL_CLASS_DERIVE_EMPTY(EvmuFlash, EvmuPeripheral, EvmuIMemory)
100
101
102
103
104
105
106
107
108
109
117 (dataChanged, GBL_GENERIC, (READ, WRITE, OVERRIDE),
GBL_BOOL_TYPE),
118 (programUnlocked, GBL_GENERIC, (READ, WRITE ),
GBL_BOOL_TYPE),
124GBL_SIGNALS(EvmuFlash,
125 (dataChanged, (GBL_UINT32_TYPE, baseAddress), (GBL_SIZE_TYPE, bytes), (GBL_POINTER_TYPE, value))
130
131
132
142
143
144
145
158
159
160
161
169 size_t* pBytes) GBL_NOEXCEPT;
178 size_t* pBytes) GBL_NOEXCEPT;
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
GblType EvmuFlash_type(void)
Returns the GblType UUID associated with EvmuFlash, for use with the libGimbal type system.
EvmuWord EvmuFlash_programValue(EVMU_FLASH_PROGRAM_STATE state)
Returns the target value corresponding to the given state in the flash programming sequence.
EvmuAddress EvmuFlash_programAddress(EVMU_FLASH_PROGRAM_STATE state)
Returns the target address corresponding to the given state in the flash programming sequence.
EVMU_FLASH_PROGRAM_STATE
Current state in the flash programming sequence to unlock writing.
@ EVMU_FLASH_PROGRAM_STATE_1
Second state.
@ EVMU_FLASH_PROGRAM_STATE_0
First state.
@ EVMU_FLASH_PROGRAM_STATE_2
Third state.
@ EVMU_FLASH_PROGRAM_STATE_COUNT
Number of states.
#define EVMU_FLASH_BANKS
Number of flash banks.
#define EVMU_FLASH_BANK_SIZE
Size of a single flash bank.
uint8_t EvmuWord
Represents a single 8-bit CPU word.
uint32_t EvmuAddress
Represents a generic absolute address.
#define GBL_PROPERTIES(object,...)
EvmuFlash offers the lowest, hardware-level access to the VMU's flash storage.
EvmuWord EvmuFlash_readByte(const EvmuFlash *pSelf, EvmuAddress address)
Reads a value from flash at the given address and returns its value.
size_t EvmuFlash_programBytes(const EvmuFlash *pSelf)
Returns the number of bytes remaining that can be written before reprogramming.
EVMU_RESULT EvmuFlash_writeBytes(EvmuFlash *pSelf, EvmuAddress base, const void *pData, size_t *pBytes)
Writes the given buffer to flash, returning nubmer of bytes written (bypassing unlock sequence)
GblBool EvmuFlash_unlocked(const EvmuFlash *pSelf)
Returns whether or not flash is currently unlocked for writing.
EVMU_RESULT EvmuFlash_writeByte(EvmuFlash *pSelf, EvmuAddress address, EvmuWord value)
Writes a value to flash at the given address (bypassing unlock sequence)
EvmuAddress EvmuFlash_targetAddress(const EvmuFlash *pSelf)
Returns the current target address of the next LDF or STF flash instruction.
GblBool dataChanged
User toggle: will be set after a flash value changes, you can reset and poll for changes.
EVMU_FLASH_PROGRAM_STATE EvmuFlash_programState(const EvmuFlash *pSelf)
Returns the current state of the flash programming sequence for unlocking writes.
EVMU_RESULT EvmuFlash_readBytes(const EvmuFlash *pSelf, EvmuAddress base, void *pData, size_t *pBytes)
Reads the given number of bytes from flash into the buffer, returning the number successfully read.
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)