Skip to main content

Hal

Trait Hal 

Source
pub trait Hal {
    // Required methods
    fn dma_alloc(pages: usize) -> usize;
    fn dma_dealloc(paddr: usize, pages: usize) -> i32;
    fn phys_to_virt(paddr: usize) -> usize;
    fn virt_to_phys(vaddr: usize) -> usize;
}
Expand description

The interface which a particular hardware implementation must implement.

Required Methods§

Source

fn dma_alloc(pages: usize) -> usize

Allocates the given number of contiguous physical pages of DMA memory for virtio use.

Source

fn dma_dealloc(paddr: usize, pages: usize) -> i32

Deallocates the given contiguous physical DMA memory pages.

Source

fn phys_to_virt(paddr: usize) -> usize

Converts a physical address used for virtio to a virtual address which the program can access.

Source

fn virt_to_phys(vaddr: usize) -> usize

Converts a virtual address which the program can access to the corresponding physical address to use for virtio.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§