#[repr(C)]pub struct retro_memory_descriptor {
pub flags: u64,
pub ptr: *mut c_void,
pub offset: size_t,
pub start: size_t,
pub select: size_t,
pub disconnect: size_t,
pub len: size_t,
pub addrspace: *const c_char,
}Fields
flags: u64ptr: *mut c_voidPointer 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: size_tstart: size_tThis is the location in the emulated address space where the mapping starts.
select: size_tWhich 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: size_tIf this is nonzero, the set bits are assumed not connected to the memory chip’s address pins.
len: size_tThis 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_charThe 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
sourceimpl Clone for retro_memory_descriptor
impl Clone for retro_memory_descriptor
sourcefn clone(&self) -> retro_memory_descriptor
fn clone(&self) -> retro_memory_descriptor
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for retro_memory_descriptor
impl Debug for retro_memory_descriptor
impl Copy for retro_memory_descriptor
Auto Trait Implementations
impl RefUnwindSafe for retro_memory_descriptor
impl !Send for retro_memory_descriptor
impl !Sync for retro_memory_descriptor
impl Unpin for retro_memory_descriptor
impl UnwindSafe for retro_memory_descriptor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
