Add support for custom peripherals #28
Merged
+179
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch implements a dynamic bus module, which can be used to register custom peripherals to the computer's bus.
The idea is that the standard configuration of the computer is statically described in the bus array in
bus.c.When a peripheral is not found in the main bus, then it is searched via the
ubus.cmodule.The
ubus.cmodule contains a small array where an user can register its own peripherals at runtime, by callingubus_register()and providing the necessary address range and callbacks for I/O.(Obviously this is not how it works on the real hardware, but it looks a reasonable way to implement user-built peripherals in the emulator, by separating the vanilla bus from the customized one)
Then, this branch also implements a
charmon.cfake write-only character based device: at the moment, it can be used by the emulated software to log data on the emulator's stdout, and also acts as an example of how to properly implement a custom peripheral module. (note the dynamic configuration via the user's conf file)Eventually, the
ubus.cmodule can also be used to implement the actual hardware mods that we are planning.