Memory-mapped I/O
HarvOS uses a compact MMIO region at 0xffff0000. The CPU
accesses it through normal load/store instructions; MPU and SoC address
decode decide which block responds.
MMIO map
| Base | Block | Use |
0xffff0000 | Debug / kernel model | Debug PC, trap cause, entropy, boot status and DMA status. |
0xffff0030 | IMEM loader | Controlled code load into IMEM and lock. |
0xffff0040 | HNET | Packet-DMA network device for HarvTTP and HarvSQL. |
0xffff0080 | USB host | USB host controller, DMA and PHY/port control. |
0xffff00c0 | HPS block | MiSTer/HPS-compatible access to two block images. |
IMEM loader
| Offset | Name | Description |
0x00 | ID | Identification/status read path. |
0x04 | CTRL | Bits: WRITE, LOCK, CLEAR. |
0x08 | ADDR | Target IMEM address. |
0x0c | DATA | 32-bit instruction word. |
HNET packet-DMA NIC
| Register | Offset | Description |
CTRL | 0x04 | ENABLE, LOOPBACK, CLEAR, PROMISC, SIM_LINK. |
STATUS | 0x08 | LINK, BUSY, DONE, FAULT, IRQ, RX_OP, TX_READY, RX_VALID, RX_ERROR. |
IRQ_EN/IRQ_STAT | 0x0c/0x10 | RX_DONE, TX_DONE, FAULT and LINK events. |
RX_ADDR/RX_LEN | 0x14/0x18 | DMA target for incoming frames. |
TX_ADDR/TX_LEN | 0x20/0x24 | DMA source for outgoing frames. |
MAC_LO/MAC_HI | 0x28/0x2c | Virtual MAC address. |
FRAME_LEN | 0x30 | Actual RX frame length. |
USB host and HPS block bridge
The USB host block exposes registers for DMA address/length, command,
port control, frame, actual length, token, PHY, packet, retry and
engine status. The HPS block bridge is the current practical way to
pass the two USB images into the MiSTer/Verilator environment as block
devices.