Struct retro_memory_descriptor

Source
#[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§

Source§

impl Clone for retro_memory_descriptor

Source§

fn clone(&self) -> retro_memory_descriptor

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for retro_memory_descriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for retro_memory_descriptor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.