MMIO: Add a function to check if a given address refers to MMIO registers.

This commit is contained in:
Pierre Bourdon 2014-02-16 22:32:36 +01:00
parent 886060aaf7
commit 6b645f5cac
1 changed files with 13 additions and 0 deletions

View File

@ -31,6 +31,19 @@ enum Block
const u32 BLOCK_SIZE = 0x10000;
const u32 NUM_MMIOS = NUM_BLOCKS * BLOCK_SIZE;
// Checks if a given physical memory address refers to the MMIO address range.
// In practice, most games use a virtual memory mapping (via BATs set in the
// IPL) that matches the physical memory mapping for MMIOs.
//
// We have a special exception here for FIFO writes: these are handled via a
// different mechanism and should not go through the normal MMIO access
// interface.
inline bool IsMMIOAddress(u32 address)
{
return ((address & 0xE0000000) == 0xC0000000) &&
((address & 0x0000FFFF) != 0x00008000);
}
// Compute the internal unique ID for a given MMIO address. This ID is computed
// from a very simple formula: (block_id << 16) | lower_16_bits(address).
//