XU XUv0.16.0

#core/fdt

import: #core/fdt

counts: 9 functions, 0 methods, 1 types, 6 constants, 0 method sets

Standard library package `#core/fdt`.

const FDT_MAGIC

XuAPI
pub const FDT_MAGIC = 0xD00DFEED

Purpose

Constant FDT_MAGIC, defining protocol or algorithm parameters.

const FDT_BEGIN_NODE

XuAPI
pub const FDT_BEGIN_NODE = 1

Purpose

Constant FDT_BEGIN_NODE, defining protocol or algorithm parameters.

const FDT_END_NODE

XuAPI
pub const FDT_END_NODE = 2

Purpose

Constant FDT_END_NODE, defining protocol or algorithm parameters.

const FDT_PROP

XuAPI
pub const FDT_PROP = 3

Purpose

Constant FDT_PROP, defining protocol or algorithm parameters.

const FDT_NOP

XuAPI
pub const FDT_NOP = 4

Purpose

Constant FDT_NOP, defining protocol or algorithm parameters.

const FDT_END

XuAPI
pub const FDT_END = 9

Purpose

Constant FDT_END, defining protocol or algorithm parameters.

struct FdtSummary

XuAPI
pub struct FdtSummary {
    pub total_size u32
    pub node_count int
    pub cpu_count int
    pub mem_base u64
    pub mem_size u64
    pub has_uart bool
    pub uart_base u64
    pub has_gic bool
    pub gic_dist_base u64
    pub has_plic bool
    pub plic_base u64
    pub has_clint bool
    pub clint_base u64
}

Purpose

Structure encapsulating total_size, node_count, cpu_count, mem_base, mem_size.

Public fields

total_size u32
field (u32)
node_count int
field (int)
cpu_count int
field (int)
mem_base u64
field (u64)
mem_size u64
field (u64)
has_uart bool
field (bool)
uart_base u64
field (u64)
has_gic bool
field (bool)
gic_dist_base u64
field (u64)
has_plic bool
field (bool)
plic_base u64
field (u64)
has_clint bool
field (bool)
clint_base u64
field (u64)

fdt_be32

XuAPI
pub fn fdt_be32(addr u64) u32

Purpose

Fdt be32.

Parameters

addr u64
address (u64)

Returns

u32 — a value of this type

fdt_be64

XuAPI
pub fn fdt_be64(addr u64) u64

Purpose

Fdt be64.

Parameters

addr u64
address (u64)

Returns

u64 — a value of this type

fdt_valid

XuAPI
pub fn fdt_valid(dtb_addr u64) bool

Purpose

Fdt valid.

Parameters

dtb_addr u64
dtb_addr (u64)

Returns

bool — true or false

fdt_total_size

XuAPI
pub fn fdt_total_size(dtb_addr u64) u32

Purpose

Fdt total size.

Parameters

dtb_addr u64
dtb_addr (u64)

Returns

u32 — a value of this type

fdt_parse_summary

XuAPI
pub fn fdt_parse_summary(dtb_addr u64, out *raw FdtSummary) bool

Purpose

Fdt parse summary.

Parameters

dtb_addr u64
dtb_addr (u64)
out *raw FdtSummary
out (*raw FdtSummary)

Returns

bool — true or false

fdt_find_node

XuAPI
pub fn fdt_find_node(dtb_addr u64, path &string) u64

Purpose

Find a DTB node by path (e.g. "/", "/soc", "/soc/uart" matching "uart@9000000"). Returns node_off as the byte offset from dtb_addr to the node's FDT_BEGIN_NODE token (>= 40 when valid), or 0 if not found.

Parameters

dtb_addr u64
dtb_addr (u64)
path &string
filesystem path (read-only borrow; caller keeps the original; type &string)

Returns

u64 — a value of this type

fdt_find_compatible

XuAPI
pub fn fdt_find_compatible(dtb_addr u64, compat &string, start_off u64) u64

Purpose

Find a DTB node whose "compatible" string-list property contains compat. If start_off == 0, starts scanning at off_dt_struct; otherwise starts at start_off and skips matching the node beginning right at start_off so callers can iterate matches. Returns node_off (byte offset from dtb_addr to FDT_BEGIN_NODE), or 0 if not found.

Parameters

dtb_addr u64
dtb_addr (u64)
compat &string
compat (read-only borrow; caller keeps the original; type &string)
start_off u64
start_off (u64)

Returns

u64 — a value of this type

fdt_get_prop

XuAPI
pub fn fdt_get_prop(dtb_addr u64, node_off u64, prop_name &string, out_len *raw u32) u64

Purpose

Look up a direct property on the node at node_off (byte offset from dtb_addr). Writes property byte length to out_len (when non-null) and returns dtb_addr + data_off, or 0 if not found.

Parameters

dtb_addr u64
dtb_addr (u64)
node_off u64
node_off (u64)
prop_name &string
prop_name (read-only borrow; caller keeps the original; type &string)
out_len *raw u32
out_len (*raw u32)

Returns

u64 — a value of this type

fdt_read_reg

XuAPI
pub fn fdt_read_reg(dtb_addr u64, node_off u64, index int, out_addr *raw u64, out_size *raw u64) bool

Purpose

Read the index-th (addr, size) pair from the node's "reg" property. Supports 64-bit (u64, u64) entries and single 32-bit (u32, u32) fallback when index == 0 and len == 8.

Parameters

dtb_addr u64
dtb_addr (u64)
node_off u64
node_off (u64)
index int
index (int)
out_addr *raw u64
out_addr (*raw u64)
out_size *raw u64
out_size (*raw u64)

Returns

bool — true or false