#[repr(C)]
pub struct retro_memory_descriptor { pub flags: u64, pub ptr: *mut c_void, pub offset: usize, pub start: usize, pub select: usize, pub disconnect: usize, pub len: usize, pub addrspace: *const c_char, }

Fields§

§flags: u64§ptr: *mut c_void

Pointer to the start of the relevant ROM or RAM chip. It’s strongly recommended to use ‘offset’ if possible, rather than doing math on the pointer.

If the same byte is mapped my multiple descriptors, their descriptors must have the same pointer. If ‘start’ does not point to the first byte in the pointer, put the difference in ‘offset’ instead.

May be NULL if there’s nothing usable here (e.g. hardware registers and open bus). No flags should be set if the pointer is NULL. It’s recommended to minimize the number of descriptors if possible, but not mandatory.

§offset: usize§start: usize

This is the location in the emulated address space where the mapping starts.

§select: usize

Which bits must be same as in ‘start’ for this mapping to apply. The first memory descriptor to claim a certain byte is the one that applies. A bit which is set in ‘start’ must also be set in this. Can be zero, in which case each byte is assumed mapped exactly once. In this case, ‘len’ must be a power of two.

§disconnect: usize

If this is nonzero, the set bits are assumed not connected to the memory chip’s address pins.

§len: usize

This one tells the size of the current memory area. If, after start+disconnect are applied, the address is higher than this, the highest bit of the address is cleared.

If the address is still too high, the next highest bit is cleared. Can be zero, in which case it’s assumed to be infinite (as limited by ‘select’ and ‘disconnect’).

§addrspace: *const c_char

The address space name must consist of only a-zA-Z0-9_-, should be as short as feasible (maximum length is 8 plus the NUL), and may not be any other address space plus one or more 0-9A-F at the end. However, multiple memory descriptors for the same address space is allowed, and the address space name can be empty. NULL is treated as empty.

Address space names are case sensitive, but avoid lowercase if possible. The same pointer may exist in multiple address spaces.

Examples: blank+blank - valid (multiple things may be mapped in the same namespace) ‘Sp’+‘Sp’ - valid (multiple things may be mapped in the same namespace) ‘A’+‘B’ - valid (neither is a prefix of each other) ‘S’+blank - valid (‘S’ is not in 0-9A-F) ‘a’+blank - valid (‘a’ is not in 0-9A-F) ‘a’+‘A’ - valid (neither is a prefix of each other) ‘AR’+blank - valid (‘R’ is not in 0-9A-F) ‘ARB’+blank - valid (the B can’t be part of the address either, because there is no namespace ‘AR’) blank+‘B’ - not valid, because it’s ambigous which address space B1234 would refer to. The length can’t be used for that purpose; the frontend may want to append arbitrary data to an address, without a separator.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.