Skip to content

Conversation

@giomba
Copy link
Collaborator

@giomba giomba commented Aug 22, 2025

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.c module.
The ubus.c module contains a small array where an user can register its own peripherals at runtime, by calling ubus_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.c fake 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.c module can also be used to implement the actual hardware mods that we are planning.

@giomba giomba force-pushed the giomba/custom-peripheral-support branch from 0cc9132 to 2ff1a50 Compare August 22, 2025 19:20
@giomba giomba requested a review from giuliof August 22, 2025 19:24
@giomba giomba self-assigned this Aug 22, 2025
This fake peripheral can be used to print to the emulator's stdout from
the emulated software.
@giomba giomba force-pushed the giomba/custom-peripheral-support branch from 2ff1a50 to 6aa3423 Compare August 23, 2025 19:33
Copy link
Contributor

@giuliof giuliof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, just added a note related to logging

giomba added 3 commits August 24, 2025 23:03
This new module allows the connection of custom peripherals to the
computer bus. This module can be used to implement user's mods.
@giomba giomba force-pushed the giomba/custom-peripheral-support branch from 6aa3423 to 5acad2c Compare August 24, 2025 21:04
Copy link
Contributor

@giuliof giuliof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one more note

@giomba giomba force-pushed the giomba/custom-peripheral-support branch from 0341b76 to 3206f2c Compare August 25, 2025 19:22
@giomba giomba merged commit ac82f9b into main Aug 29, 2025
1 check passed
@giomba giomba deleted the giomba/custom-peripheral-support branch August 29, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants