API referencestd/embedded

std/embedded/peripheral/esp_uhci

Public declarations, types, methods, and source contracts for std/embedded/peripheral/esp_uhci.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/embedded/peripheral/esp_uhci"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
esp_gdma std/embedded/chip/esp_gdma esp_uhci.dodo
esp_uart std/embedded/peripheral/esp_uart esp_uhci.dodo
hal std/embedded/hal esp_uhci.dodo
io std/io esp_uhci.dodo
serial std/embedded/hal/serial esp_uhci.dodo

UHCI0_BASE

Constant · Source

pub const UHCI0_BASE: usize = 0x6000_5000

IDLE_BITS

Constant · Source

pub const IDLE_BITS: u32 = 30

RING_PARTS

Constant · Source

The parts of the receive ring: the chip package’s descriptor storage holds this many.

pub const RING_PARTS: usize = 32

MIN_RING

Constant · Source

The smallest ring buffer: a word per part.

pub const MIN_RING: usize = 4 * RING_PARTS + 3

DmaPort

Struct · Source

A serial port that receives into a ring buffer by DMA through UHCI0, from open. It implements the std/io Reader and Writer protocols, serial.Port, and serial.PollPort like esp_uart.Controller; see above for how input reaches the ring. Dropping it stops the channel and disconnects UHCI0 from the UART; input still in the ring is lost.

pub struct DmaPort<R: hal.Registers>: serial.Port + serial.PollPort {
    // Private implementation fields omitted.
}

DmaPort.open

Function · Source

Take over UART number (0 or 1) with registers at uart, through UHCI0 at uhci: receive into ring by GDMA channel rx, whose descriptors (3 words each, RING_PARTS of them) are descriptors. crlf, poll_limit, and read_poll_limit carry over the port’s settings (esp_uart.Controller.dma_settings). The caller has claimed UHCI0 and the channel, started UHCI0’s clock, and checked that the ring is in SRAM. InvalidInput for another UART, a ring buffer shorter than MIN_RING, or too few descriptors.

pub fn open(bus: R, uart: usize, uhci: usize, number: u32, rx: u32, descriptors: &mut[u32], ring: &mut[u8], crlf: bool, poll_limit: u32, read_poll_limit: u32) -> DmaPort<R>!hal.Error from(descriptors, ring)

DmaPort.ring_size

Function · Source

The ring’s size in bytes: how much input waits for the program.

pub fn ring_size(&self) -> usize

DmaPort.available

Function · Source

The bytes received and readable now, up to the ring’s size.

pub fn available(&mut self) -> usize

DmaPort.read

Function · Source

Wait for the first byte, then return what has arrived, up to buffer.len; errors as for poll_read. The read poll limit bounds the wait as on esp_uart.Controller.

pub fn read(&mut self, buffer: &mut[u8]) -> usize!io.Error

DmaPort.poll_read

Function · Source

Return what the ring holds, up to buffer.len, without waiting: Pending, with nothing, while it is empty. An error has kind Other and the bits of esp_uart.FRAMING_ERROR, PARITY_ERROR, BREAK, and OVERRUN in its code, after the bytes before it in buffer[..transferred]; OVERRUN here means the ring filled up and later bytes were lost.

pub fn poll_read(&mut self, buffer: &mut[u8]) -> io.Poll!io.Error

DmaPort.write

Function · Source

Send bytes through the transmit FIFO, waiting while it is full; returns once the last byte is queued, and flush waits until it has left. TimedOut, with the bytes queued before it, if the FIFO stays full for the poll limit.

pub fn write(&mut self, bytes: &[u8]) -> usize!io.Error

DmaPort.poll_write

Function · Source

Queue as much of bytes as the transmit FIFO has room for, without waiting; Pending, with what was queued, once it is full.

pub fn poll_write(&mut self, bytes: &[u8]) -> io.Poll!io.Error

DmaPort.poll_flush

Function · Source

flush without waiting: true once everything written has left the UART, stop bits included.

pub fn poll_flush(&mut self) -> bool!io.Error

DmaPort.flush

Function · Source

Wait until everything written has left; TimedOut after the poll limit, as on esp_uart.Controller.

pub fn flush(&mut self) -> void!io.Error

DmaPort.set_crlf

Function · Source

Translate newlines, as esp_uart.Controller.set_crlf does.

pub fn set_crlf(&mut self, on: bool)

DmaPort.set_poll_limit

Function · Source

pub fn set_poll_limit(&mut self, polls: u32)

DmaPort.set_read_poll_limit

Function · Source

pub fn set_read_poll_limit(&mut self, polls: u32)

DmaPort.listen

Function · Source

The UART’s interrupts, as on esp_uart.Controller. The receive FIFO levels stay low while UHCI empties the FIFO; RX_TIMEOUT_INTERRUPT still marks a pause in the input.

pub fn listen(&mut self, sources: u32)

DmaPort.ignore

Function · Source

pub fn ignore(&mut self, sources: u32)

DmaPort.pending_interrupts

Function · Source

pub fn pending_interrupts(&mut self) -> u32

DmaPort.clear_interrupts

Function · Source

pub fn clear_interrupts(&mut self, sources: u32)

DmaPort.stop

Function · Source

Stop the channel, disconnect UHCI0 from the UART, and put the UART’s idle threshold back; the port no longer receives. Dropping the port does this too.

pub fn stop(&mut self)

Search every guide, reference page, and API declaration.