Skip to main content

Vi

Struct Vi 

Source
pub struct Vi { /* private fields */ }
Expand description

The Video Interface register file (the 0x0440_0000 block).

Implementations§

Source§

impl Vi

Source

pub const fn new() -> Self

Construct at power-on: every register zero, so VI_CTRL.TYPE == 0 (the VI is off) — the correct cold-boot state.

Source

pub const fn reset_scan(&mut self)

Rebase the scan timeline to a fresh master_ticks == 0 (a warm reset), clearing the accumulated position and the delta baseline without touching the programmed registers. Without this, prev_ticks would keep the pre-reset value and every post-reset delta would saturate to 0 until the new run caught up — suppressing the VI interrupt across a reset.

Source

pub fn tick(&mut self, master_ticks: u64) -> bool

Advance the scan position by the master ticks elapsed since the last call and report whether the VI interrupt should fire.

VI_V_CURRENT advances one half-line every ticks_per_halfline master ticks (accumulating the fractional remainder), wrapping at VI_V_TOTAL + 1. The interrupt fires when the position lands on VI_V_INTR — the per-half-line step means no crossing is skipped even when a call spans many half-lines — and only while the VI is on (VI_CTRL.TYPE != 0; N64brew Video Interface §VI_V_INTR). A VI_V_INTR beyond the field (>= VI_V_TOTAL + 1) is unreachable, so it never fires. The position is kept relative, so a mid-run VI_V_TOTAL change re-bases without a scale jump. The scheduler calls this each RCP step and raises MI_INTR.vi on a true return.

Source

pub const fn read(&self, word_offset: u32) -> u32

Read a VI register by word offset within the block (mirrored to 16). VI_V_CURRENT reads back the scan position advanced by Vi::tick.

Source

pub const fn write(&mut self, word_offset: u32, value: u32) -> bool

Write a VI register by word offset. Returns true iff this write should acknowledge the VI interrupt — a write to VI_V_CURRENT, which the caller turns into MI_INTR.vi = false.

VI_V_CURRENT is not otherwise latched here: its value reflects the scan position, which the scheduler will drive; a software write only clears the interrupt.

Trait Implementations§

Source§

impl Clone for Vi

Source§

fn clone(&self) -> Vi

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Vi

Source§

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

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

impl Default for Vi

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Vi

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Vi

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Vi

§

impl RefUnwindSafe for Vi

§

impl Send for Vi

§

impl Sync for Vi

§

impl Unpin for Vi

§

impl UnsafeUnpin for Vi

§

impl UnwindSafe for Vi

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,