#[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>
impl<T: LinkedListItem, const N: usize> Table<T, N>
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub fn transfer_count(&self) -> usize
pub fn transfer_count(&self) -> usize
The total transfer count of the table in number of words.
Sourcepub fn link_indices(&mut self, first: usize, second: usize)
pub fn link_indices(&mut self, first: usize, second: usize)
Link items of given indices together: first -> second.
Sourcepub fn link_sequential(&mut self)
pub fn link_sequential(&mut self)
Link items sequentially.
Sourcepub fn link_repeat(&mut self)
pub fn link_repeat(&mut self)
Link last to first item.
Sourcepub fn base_address(&self) -> u16
pub fn base_address(&self) -> u16
Linked list base address (upper 16 address bits).
Sourcepub fn offset_address(&self, index: usize) -> u16
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.