/* signal attached hardware */
for (i = 0; i < vm->hw_table_entries_; i++) {
TRACE("%s>> notifying %s", __func__, vm->hw_table_[i].name_);
- vm->hw_table_[i].cycle(vm, vm->hw_table_[i].data);
+ vm->hw_table_[i].cycle(vm, &vm->hw_table_[i]);
}
}
}
dcpu16_cycle_inc(vm, 4);
if (vm->hw_table_[*a].hwi)
- vm->hw_table_[*a].hwi(vm, vm->hw_table_[*a].data);
+ vm->hw_table_[*a].hwi(vm, &vm->hw_table_[*a]);
else
WARN("hardware 0x%04x has no interrupt handler", *a);
}
/* dcpu16_hw_add
* registers new 'hardware' device with system
*/
-int dcpu16_hw_add(struct dcpu16 *vm, struct dcpu16_hw *hw) {
+int dcpu16_hw_attach(struct dcpu16 *vm, struct dcpu16_hw *hw) {
if (!vm || !hw)
return -1;
/* signal attached hardware */
for (i = 0; i < vm->hw_table_entries_; i++) {
if (vm->hw_table_[i].reset)
- vm->hw_table_[i].reset(vm, vm->hw_table_[i].data);
+ vm->hw_table_[i].reset(vm, &vm->hw_table_[i]);
}
memset(vm->reg, 0, sizeof vm->reg);