diff --git a/mvm/core/rom.c b/mvm/core/rom.c new file mode 100644 index 0000000..17940a5 --- /dev/null +++ b/mvm/core/rom.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2026 Mirocom Laboratories and MSP engineers. + * All Rights Reserved. + */ + +#include +#include +#include +#include "mvm/rom.h" + +int +mvm_rom_init(struct mvm_rom *rom, size_t cap) +{ + if (rom == NULL) { + return -1; + } + + if (balloon_init(&rom->data, cap) < 0) { + return -1; + } + + return 0; +} + +void +mvm_rom_free(struct mvm_rom *rom) +{ + if (rom == NULL) { + return; + } + + balloon_free(&rom->data); +} diff --git a/mvm/include/mvm/rom.h b/mvm/include/mvm/rom.h new file mode 100644 index 0000000..d14e0e2 --- /dev/null +++ b/mvm/include/mvm/rom.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2026 Mirocom Laboratories and MSP engineers. + * All Rights Reserved. + */ + +#ifndef MVM_ROM_H +#define MVM_ROM_H 1 + +#include +#include +#include "mvm/balloon.h" + +/* + * Represents a ROM + * + * @data: ROM data + */ +struct mvm_rom { + struct mvm_balloon data; +}; + +/* + * Initialize the ROM + * + * @rom: ROM to initialize + * + * Returns zero on success + */ +int mvm_rom_init(struct mvm_rom *rom, size_t cap); + +/* + * Free a ROM and its associated resources from memory + * + * @rom: ROM to free + */ +void mvm_rom_free(struct mvm_rom *rom); + +#endif /* !MVM_ROM_H */