# Buses, DMA and interrupts (Holly's system side) Holly is the system ASIC: besides the PowerVR2 (holly-pvr2.md) it arbitrates the SH-4's bus to RAM and VRAM, owns the G1 and G2 buses, runs four kinds of DMA and gathers every interrupt into the SH-4's IRL lines. Facts here are from KOS (`asic.h`, `g1ata.*`, `g2bus.*`, `g2dma.c`, `pvr_dma.c`, `maple.h`), Comstedt (*maplebus*, *memory*) and MAME's logs (OBSERVED). No tier-2 document for Holly was used (sources.md). ## The buses | Bus | Reaches | What we know | | --- | --- | --- | | SH-4 external bus (the BSC's) | system RAM (SDRAM), Holly, area 4 (TA), area 1 (VRAM through Holly) | the BSC's settings are the boot ROM's (sh4-python mame-oracle.md lists them: BCR1 A3020008, WCR1 01110111, WCR2 618066D8, MCR C00A0E24) | | G1 | boot ROM, flash, the GD-ROM's ATA registers and its DMA | KOS `g1ata.c`: "the GD-ROM drive is actually just an ATA device that implements a different packet command set than the normal ATAPI set", two devices possible on the channel; a "bus protection" gate (005F74E4/74EC) and a DMA protection register (005F74B8) | | G2 | AICA registers, sound RAM, AICA RTC, modem/expansion | MAME's `sb_g2if` runs at 25 MHz (OBSERVED); KOS `g2bus.h` suspends G2 DMA around CPU accesses and serialises accesses through a FIFO (its `g2_lock`/FIFO-wait helpers: to read before writing the board's G2 timing) | | Maple | four ports, frames by DMA | 2 Mbit/s by default; 1, 4, 8 Mbit/s settable (KOS `maple.h` `MAPLE_SPEED_*`), a timeout field | ## DMA engines | Engine | From -> to | Started by | Ends with | | --- | --- | --- | --- | | SH-4 DMAC channel 2 + Holly "PVR DMA" (005F6800) | system RAM -> TA FIFO, texture memory or YUV converter | software (the SH-4 DMAC's DREQ/DACK with Holly) | `ASIC_EVT_PVR_DMA` (event 0013h) | | G1 DMA (GD-ROM) | drive -> system RAM | the BIOS's GD-ROM driver after a packet command | `ASIC_EVT_GD_DMA` (000Eh); errors 020Ch (illegal address), 020Dh (overrun) | | G2 DMA, 4 channels | system RAM <-> sound RAM (channel 0), BBA (1), 2, 3 | software (KOS `g2dma.c`) | `ASIC_EVT_G2_DMA0`-`3` (000Fh-0012h) | | Maple DMA | system RAM descriptor list -> ports -> responses in RAM | software sets the address and the enable bit (Comstedt *maplebus*: "Set the ENA bit to 1 to start Maple DMA. When the DMA is completed, ENA..." clears) | `ASIC_EVT_MAPLE_DMA` (000Ch); 000Dh error | Each engine reads and writes system RAM behind the SH-4's operand cache, with no coherency (sh4-python mmu-caches-sq.md). Their bandwidth and their arbitration against the CPU are not documented in anything we hold (U3): one FITTED table. ## Interrupts (KOS `asic.h`) Holly keeps three event registers: **A (normal)** at 005F6900, **B (external)** at 6904, **C (errors)** at 6908; an event code's high byte names the register (0, 1, 2) and its low byte the bit. Each event can be routed to one of three IRL levels by three mask registers per level: **IRQ13 (IRQD)** at 6910-6918, **IRQ11 (IRQB)** at 6920-6928, **IRQ9** at 6930-6938. Holly drives the SH-4's IRL3-0 with the highest pending level. | Register A (normal) bits, from KOS | Event | | --- | --- | | 0, 1, 2 | render done: video, ISP, TSP | | 3, 4, 5 | V-blank in, V-blank out, H-blank in | | 6 | YUV conversion done | | 7, 8, 9, 10 | TA list done: opaque, opaque modifier, translucent, translucent modifier | | 12 (0Ch), 13 | Maple DMA done, Maple error | | 14 (0Eh) | GD-ROM DMA done | | 15-18 (0Fh-12h) | G2 DMA channels 0-3 done (channel 0 is the AICA's) | | 19 (13h) | PVR (channel 2) DMA done | | 21 (15h) | TA punch-through list done | Register B (external): 0100h GD-ROM command status, 0101h AICA (SPU) interrupt, 0102h modem/LAN, 0103h BBA. Register C (errors): 0200h ISP out of memory, 0201h strip-buffer halt, 0202h parameter out of memory, 0203h object pointer buffer overrun, 0204h TA input error, 0205h TA input overflow, 020Ch/020Dh GD DMA errors. What the board must still settle (U4): the exact cycle each event is raised (render-done depends on the renderer's time: FITTED), whether events are edge- or level-held, how acknowledge works per register (KOS writes the bit back to clear: `ASIC_ACK_*`).