mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 06:29:38 +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/nvram.h>
|
||||
#include <devices/deviceregistry.h>
|
||||
|
||||
#include <cinttypes>
|
||||
#include <cstring>
|
||||
@ -93,3 +94,9 @@ void NVram::save() {
|
||||
|
||||
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 <cinttypes>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
/** @file Non-volatile RAM emulation.
|
||||
@ -38,6 +39,10 @@ public:
|
||||
NVram(std::string file_name = "nvram.bin", uint32_t ram_size = 8192);
|
||||
~NVram();
|
||||
|
||||
static std::unique_ptr<HWComponent> create() {
|
||||
return std::unique_ptr<NVram>(new NVram());
|
||||
}
|
||||
|
||||
uint8_t read_byte(uint32_t offset);
|
||||
void write_byte(uint32_t offset, uint8_t value);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user