mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-25 18:29:49 +00:00
nvram: self-registration with the device registry.
This commit is contained in:
parent
5e6f3a51b5
commit
7db0a31cc5
@ -21,6 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include <devices/common/hwcomponent.h>
|
#include <devices/common/hwcomponent.h>
|
||||||
#include <devices/common/nvram.h>
|
#include <devices/common/nvram.h>
|
||||||
|
#include <devices/deviceregistry.h>
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -93,3 +94,9 @@ void NVram::save() {
|
|||||||
|
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const DeviceDescription Nvram_Descriptor = {
|
||||||
|
NVram::create, {}, {}
|
||||||
|
};
|
||||||
|
|
||||||
|
REGISTER_DEVICE(NVRAM, Nvram_Descriptor);
|
||||||
|
@ -25,6 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#include <devices/common/hwcomponent.h>
|
#include <devices/common/hwcomponent.h>
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/** @file Non-volatile RAM emulation.
|
/** @file Non-volatile RAM emulation.
|
||||||
@ -38,6 +39,10 @@ public:
|
|||||||
NVram(std::string file_name = "nvram.bin", uint32_t ram_size = 8192);
|
NVram(std::string file_name = "nvram.bin", uint32_t ram_size = 8192);
|
||||||
~NVram();
|
~NVram();
|
||||||
|
|
||||||
|
static std::unique_ptr<HWComponent> create() {
|
||||||
|
return std::unique_ptr<NVram>(new NVram());
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t read_byte(uint32_t offset);
|
uint8_t read_byte(uint32_t offset);
|
||||||
void write_byte(uint32_t offset, uint8_t value);
|
void write_byte(uint32_t offset, uint8_t value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user