std1.0.0-beta-7 SafeC docs

std :: dma

Struct std::DmaChannel

#include <std/dma.h> source

generic<T> struct DmaChannel {
    unsigned int id;
    int busy;
    fn int(?&T, unsigned long, unsigned long, unsigned long) start_fn;
    fn int(?&T) poll_fn;
    int has_poll;
    ?&T ctx;
}

A DMA channel descriptor, generic over the driver context type T its callbacks take. One driver owns a channel for its whole lifetime, so the context can be pinned to one T per channel; it is '?&T' because a driver with no per-transfer state passes none.

Fields

§unsigned int idsource

A DMA channel descriptor, generic over the driver context type T its callbacks take. One driver owns a channel for its whole lifetime, so the context can be pinned to one T per channel; it is '?&T' because a driver with no per-transfer state passes none.

§int busysource
§fn int(?&T, unsigned long, unsigned long, unsigned long) start_fnsource

(ctx, src, dst, len) → 0 on success

§fn int(?&T) poll_fnsource

(ctx) → 1 when complete, 0 while busy

§int has_pollsource

0: wait() returns at once (synchronous engines)

§?&T ctxsource

Methods

§int start(unsigned long src_phys, unsigned long dst_phys, unsigned long len)source · definition

Start a memory-to-memory DMA transfer.

§int wait(unsigned int max_polls)source · definition

Poll until the channel is idle. Returns 0 on success, -1 on timeout.

§int is_busy() constsource · definition

Is this channel currently busy?

§static struct DmaChannel<T> new( unsigned int id, fn int(?&T, unsigned long, unsigned long, unsigned long) start_fn, fn int(?&T) poll_fn, ?&T ctx, )source · definition

A channel driven by start_fn/poll_fn on 'ctx' (T inferred from them).