LIVM/devices.c
Ærþ d02a5d3dfd
Console Device is ready to use
+ started doing clock devices
+ console device is now located at devices[1], devices[0] is clock
2022-02-19 13:10:48 +07:00

25 lines
No EOL
462 B
C

/*
(C) M. Ærþ.
*/
#define DEV_C 2
#include "device/clock.c"
#include "device/console.c"
void dev_init(struct VMinst* vm) {
vm->devices = (struct IODevice*)malloc(sizeof(struct IODevice) * DEV_C);
setup_clock(vm);
setup_console(vm);
#ifdef LIVMDEBUG
puts("dev_init");
#endif
}
void dev_delete(struct VMinst* vm) {
for (uint64_t d = 0; d < DEV_C; d++) vm->devices[d].poweroff(vm);
free(vm->devices);
#ifdef LIVMDEBUG
puts("dev_delete");
#endif
}