embassy-stm32

Crates

git

Versions

stm32wba52kg

Flavors

Skip to main content

Table

Struct Table 

Source
#[repr(C)]
pub struct Table<T: LinkedListItem, const N: usize> { pub items: [T; N], }
Expand description

A table of linked list items.

Fields§

§items: [T; N]

The items.

Implementations§

Source§

impl<T: LinkedListItem, const N: usize> Table<T, N>

Source

pub fn new(items: [T; N]) -> Self

Create a new table.

Source

pub unsafe fn new_circular<MW: Word, PW: Word>( request: Request, peri_addr: *mut PW, buffer: &mut [MW], direction: Dir, config: T::Config, ) -> Table<T, 1>

Create a single-LLI circular linked-list table.

Uses one linked-list item covering the entire buffer, linked to itself. This avoids multi-LLI race conditions in position tracking while still providing half-transfer and transfer-complete interrupts for wakeups.

Source

pub unsafe fn new_ping_pong<MW: Word, PW: Word>( request: Request, peri_addr: *mut PW, buffer: &mut [MW], direction: Dir, config: T::Config, ) -> Table<T, 2>

Create a ping-pong linked-list table.

This uses two linked-list items, one for each half of the buffer.

Link the table as given by the run mode.

Source

pub fn len(&self) -> usize

The number of linked list items.

Source

pub fn transfer_count(&self) -> usize

The total transfer count of the table in number of words.

Link items of given indices together: first -> second.

Link items sequentially.

Link last to first item.

Unlink all items.

Source

pub fn base_address(&self) -> u16

Linked list base address (upper 16 address bits).

Source

pub fn offset_address(&self, index: usize) -> u16

Linked list offset address (lower 16 address bits) at the selected index.

The channel takes the upper 16 bits of every item’s address from LBAR, which holds Self::base_address: all items must lie in the same 64 KiB as the first. Panics for an item outside it, which the channel would otherwise fetch from 64 KiB away. Aligning the table to a power of two no smaller than itself rules this out.

Auto Trait Implementations§

§

impl<T, const N: usize> Freeze for Table<T, N>
where [T; N]: Freeze,

§

impl<T, const N: usize> RefUnwindSafe for Table<T, N>

§

impl<T, const N: usize> Send for Table<T, N>
where [T; N]: Send,

§

impl<T, const N: usize> Sync for Table<T, N>
where [T; N]: Sync,

§

impl<T, const N: usize> Unpin for Table<T, N>
where [T; N]: Unpin,

§

impl<T, const N: usize> UnsafeUnpin for Table<T, N>

§

impl<T, const N: usize> UnwindSafe for Table<T, N>

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 = !

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.