Struct LiteXEventManager

Source
pub struct LiteXEventManager<'a, T, S, P, E>
where T: UIntLike, S: Read<T>, P: ReadWrite<T>, E: ReadWrite<T>,
{ /* private fields */ }
Expand description

LiteX event manager abstraction

A LiteX event manager combines and manages event sources of a LiteX core / peripheral. The event manager itself is connected to an interrupt source in the CPU.

This is an abstraction over an instance of a LiteX EventManager, which is exposed to the operating system using three configuration status registers (LiteX CSRs), as part of the core’s / peripheral’s configuration status registers bank.

Implementations§

Source§

impl<'a, T, S, P, E> LiteXEventManager<'a, T, S, P, E>
where T: UIntLike, S: Read<T>, P: ReadWrite<T>, E: ReadWrite<T>,

Source

pub const fn new( status: &'a S, pending: &'a P, enable: &'a E, ) -> LiteXEventManager<'a, T, S, P, E>

Source

pub fn disable_all(&self)

Disable / suppress all event sources connected to the LiteX event manager.

This will prevent any of the event sources from asserting the event manager’s CPU interrupt.

Source

pub fn enable_all(&self)

Enable all event sources connected to the LiteX event manager.

This will make any asserted (pending) event source assert the event manager’s CPU interrupt.

Source

pub fn disable_event(&self, index: usize)

Disable / suppress an event source connected to the LiteX event manager.

This will prevent the specific event source from asserting the event manager’s CPU interrupt.

The event is addressed by its index in the event manager’s registers (starting at 0).

Source

pub fn enable_event(&self, index: usize)

Enable an event source connected to the LiteX event manager

This will assert the event manager’s CPU interrupt if this or any other event source is asserted (pending).

The event is addressed by its index in the event manager’s registers (starting at 0).

Source

pub fn event_enabled(&self, index: usize) -> bool

Check whether an event is enabled.

This checks whether an event source may assert the event manager’s CPU interrupt.

The event is addressed by its index in the event manager’s registers (starting at 0).

Source

pub fn events_enabled(&self) -> T

Get all enabled events.

The enabled events are encoded as bits in the returned integer type, starting from the least significant bit for the first event source (index 0), where a 1 means enabled and 0 means disabled (suppressed).

Source

pub fn event_source_input(&self, index: usize) -> bool

Get the input signal to an event source.

This returns whether an event source input is currently asserted. This is independent of whether the event is actually enabled or pending.

The event source is addressed by its index in the event manager’s registers (starting at 0).

Source

pub fn any_event_pending(&self) -> bool

Check whether any event source is pending.

This returns whether any event source is claiming to be pending. This is irrespective of whether an event source has a specific input or is enabled.

An example for an event source which can be pending irrespective of the current input is an “EventSourceProcess”, which triggers on a falling edge of the input and stays pending until cleared.

Source

pub fn event_pending(&self, index: usize) -> bool

Check whether an event source is pending.

This returns whether an event source is claiming to be pending. This is irrespective of whether an event source has a specific input or is enabled.

An example for an event source which can be pending irrespective of the current input is an “EventSourceProcess”, which triggers on a falling edge of the input and stays pending until cleared.

The event source is addressed by its index in the event manager’s registers (starting at 0).

Source

pub fn events_pending(&self) -> T

Get all pending events.

The pending events are encoded as bits in the returned integer type, starting from the least significant bit for the first event source (index 0), where a 1 means that the event source is pending.

Source

pub fn event_asserted(&self, index: usize) -> bool

Check whether an event source is asserting the event manager’s CPU interrupt (both enabled and pending).

The event source is addressed by its index in the event manager’s registers (starting at 0).

Source

pub fn next_asserted(&self) -> Option<usize>

Get the next asserted event, starting from 0.

If an asserted event was found, its index is returned. Otherwise, None is returned.

This method works by ANDing the enabled and pending bits and using the trailing_zeros intrinsic (of which there may be an optimized version with special instructions). Thus this is faster than a naive, loop-based version.

Source

pub fn clear_event(&self, index: usize)

Clear a pending event source.

This operation may have side effects in the device (for instance, acknowledge the reception of a UART data word).

It is not guaranteed that the event source will be no longer pending after clearing (for instance when used with FIFOs and pending data, or with an “EventSourceLevel” which can only be cleared by driving the input signal low).

Source

pub fn clear_all(&self)

Clear all pending event sources.

This operation may have side effects in the device (for instance, acknowledge the reception of a UART data word).

It is not guaranteed that the event sources will be no longer pending after clearing (for instance when used with FIFOs and pending data, or with an “EventSourceLevel” which can only be cleared by driving the input signal low).

Auto Trait Implementations§

§

impl<'a, T, S, P, E> Freeze for LiteXEventManager<'a, T, S, P, E>

§

impl<'a, T, S, P, E> RefUnwindSafe for LiteXEventManager<'a, T, S, P, E>

§

impl<'a, T, S, P, E> Send for LiteXEventManager<'a, T, S, P, E>
where S: Sync, P: Sync, E: Sync, T: Send,

§

impl<'a, T, S, P, E> Sync for LiteXEventManager<'a, T, S, P, E>
where S: Sync, P: Sync, E: Sync, T: Sync,

§

impl<'a, T, S, P, E> Unpin for LiteXEventManager<'a, T, S, P, E>
where T: Unpin,

§

impl<'a, T, S, P, E> UnwindSafe for LiteXEventManager<'a, T, S, P, E>

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> 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.