memory.hpp
1.29 KB
1
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (c) 2015-2016, Arkadiusz Materek (arekmat@poczta.fm)
*
* Licensed under GNU General Public License 3.0 or later.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef XMC_DALI_MEMORY_H_
#define XMC_DALI_MEMORY_H_
#include <dali/dali.hpp>
#include <xmc_flash.h>
#include <xmc1_flash.h>
namespace dali {
namespace xmc {
class Memory: public dali::IMemory {
public:
static Memory* getInstance();
size_t dataSize() override;
size_t dataWrite(uintptr_t addr, const uint8_t* data, size_t size) override;
const uint8_t* data(uintptr_t addr, size_t size) override;
size_t tempSize() override;
size_t tempWrite(uintptr_t addr, const uint8_t* data, size_t size) override;
const uint8_t* tempData(uintptr_t addr, size_t size) override;
static void synchronize(bool temp);
static void erase(bool temp);
private:
Memory(void* handle, size_t dataSize, uintptr_t tempAddr);
Memory(const Memory& other) = delete;
Memory& operator=(const Memory&) = delete;
const void* mHandle;
const uintptr_t mTempAddr;
};
} // namespace xmc
} // namespace dali
#endif // XMC_DALI_MEMORY_H_