X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=hw_clock.c;h=ebd58fde5568cdf4367503336acc65e869cdb638;hb=8265806f12a2ae59501cdcf2300b42d4d1c3a120;hp=f70dcf4c3d368f634f12435d62ab5cd4ea2c1f37;hpb=8b552fe61db48874f043bccfb589e5444509444c;p=dcpu16 diff --git a/hw_clock.c b/hw_clock.c index f70dcf4..ebd58fd 100644 --- a/hw_clock.c +++ b/hw_clock.c @@ -39,7 +39,7 @@ void clock_cycle_(struct dcpu16 *vm, struct dcpu16_hw *hw) { if (clock->interrupt_message) { if (dcpu16_interrupt(vm, clock->interrupt_message)) - vm->warn_cb_("%s: could not send interrupt", hw->name_); + vm->msg_cb_(MSG_ERROR, "%s: could not send interrupt", hw->mod->name_); } } } @@ -71,7 +71,7 @@ int clock_data_init_(struct dcpu16_hw *hw, void *data) { hw->data = calloc(1, sizeof(struct clock_)); if (hw->data == NULL) { - hw->vm->warn_cb_("%s():%s", "calloc", strerror(errno)); + hw->vm->msg_cb_(MSG_ERROR, "%s():%s", "calloc", strerror(errno)); return -1; } return 0; @@ -87,8 +87,10 @@ void clock_data_free_(struct dcpu16_hw *hw) { } } -static struct dcpu16_hw hw_ = { + +struct dcpu16_hw_module dcpu16_hw_module_clock = { .name_ = "Generic Clock (compatible)", + .id_l = 0xb402, .id_h = 0x12d0, .ver = 0x0001, @@ -97,11 +99,9 @@ static struct dcpu16_hw hw_ = { .hwi = clock_hwi_, .cycle = clock_cycle_, .reset = clock_reset_, - .data = (struct clock_ *)NULL -}; -struct dcpu16_hw_module dcpu16_hw_module_clock = { - .template = &hw_, .data_init = clock_data_init_, .data_free = clock_data_free_, + .ctl = NULL, + .ctl_cmd = NULL, };