RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
rtems-fdt.h File Reference

RTEMS Flattened Device Tree. More...

#include <rtems.h>
#include <rtems/chain.h>

Go to the source code of this file.

Data Structures

struct  rtems_fdt_handle
 
struct  rtems_fdt_address_map
 

Macros

#define RTEMS_FDT_ERR_NOTFOUND   1
 
#define RTEMS_FDT_ERR_EXISTS   2
 
#define RTEMS_FDT_ERR_NOSPACE   3
 
#define RTEMS_FDT_ERR_BADOFFSET   4
 
#define RTEMS_FDT_ERR_BADPATH   5
 
#define RTEMS_FDT_ERR_BADPHANDLE   6
 
#define RTEMS_FDT_ERR_BADSTATE   7
 
#define RTEMS_FDT_ERR_TRUNCATED   8
 
#define RTEMS_FDT_ERR_BADMAGIC   9
 
#define RTEMS_FDT_ERR_BADVERSION   10
 
#define RTEMS_FDT_ERR_BADSTRUCTURE   11
 
#define RTEMS_FDT_ERR_BADLAYOUT   12
 
#define RTEMS_FDT_ERR_INTERNAL   13
 
#define RTEMS_FDT_ERR_INVALID_HANDLE   100
 
#define RTEMS_FDT_ERR_NO_MEMORY   101
 
#define RTEMS_FDT_ERR_NOT_FOUND   102
 
#define RTEMS_FDT_ERR_READ_FAIL   103
 
#define RTEMS_FDT_ERR_REFERENCED   104
 
#define RTEMS_FDT_ERR_BADLENGTH   105
 
#define RTEMS_FDT_ERR_RTEMS_MIN   100
 
#define RTEMS_FDT_ERR_MAX   105
 

Typedefs

typedef struct rtems_fdt_blob rtems_fdt_blob
 

Functions

void rtems_fdt_init_handle (rtems_fdt_handle *handle)
 
void rtems_fdt_dup_handle (rtems_fdt_handle *from, rtems_fdt_handle *to)
 
void rtems_fdt_release_handle (rtems_fdt_handle *handle)
 
bool rtems_fdt_valid_handle (const rtems_fdt_handle *handle)
 
int rtems_fdt_find_path_offset (rtems_fdt_handle *handle, const char *path)
 
int rtems_fdt_load (const char *const filename, rtems_fdt_handle *handle)
 
int rtems_fdt_register (const void *blob, rtems_fdt_handle *handle)
 
int rtems_fdt_unload (rtems_fdt_handle *handle)
 
int rtems_fdt_num_mem_rsv (rtems_fdt_handle *handle)
 
int rtems_fdt_get_mem_rsv (rtems_fdt_handle *handle, int n, uint64_t *address, uint64_t *size)
 
int rtems_fdt_subnode_offset_namelen (rtems_fdt_handle *handle, int parentoffset, const char *const name, int namelen)
 
int rtems_fdt_subnode_offset (rtems_fdt_handle *handle, int parentoffset, const char *const name)
 
int rtems_fdt_path_offset (rtems_fdt_handle *handle, const char *path)
 
const char * rtems_fdt_get_name (rtems_fdt_handle *handle, int nodeoffset, int *length)
 
int rtems_fdt_first_prop_offset (rtems_fdt_handle *handle, int nodeoffset)
 
int rtems_fdt_next_prop_offset (rtems_fdt_handle *handle, int propoffset)
 
const void * rtems_fdt_getprop_by_offset (rtems_fdt_handle *handle, int propoffset, const char **name, int *length)
 
const void * rtems_fdt_getprop_namelen (rtems_fdt_handle *handle, int nodeoffset, const char *const name, int namelen, int *length)
 
const void * rtems_fdt_getprop (rtems_fdt_handle *handle, int nodeoffset, const char *const name, int *length)
 
uint32_t rtems_fdt_get_phandle (rtems_fdt_handle *handle, int nodeoffset)
 
const char * rtems_fdt_get_alias_namelen (rtems_fdt_handle *handle, const char *const name, int namelen)
 
const char * rtems_fdt_get_alias (rtems_fdt_handle *handle, const char *name)
 
int rtems_fdt_get_path (rtems_fdt_handle *handle, int nodeoffset, char *buf, int buflen)
 
int rtems_fdt_supernode_atdepth_offset (rtems_fdt_handle *handle, int nodeoffset, int supernodedepth, int *nodedepth)
 
int rtems_fdt_node_depth (rtems_fdt_handle *handle, int nodeoffset)
 
int rtems_fdt_parent_offset (rtems_fdt_handle *handle, int nodeoffset)
 
int rtems_fdt_node_offset_by_prop_value (rtems_fdt_handle *handle, int startoffset, const char *const propname, const void *propval, int proplen)
 
int rtems_fdt_node_offset_by_phandle (rtems_fdt_handle *handle, uint32_t phandle)
 
int rtems_fdt_node_check_compatible (rtems_fdt_handle *handle, int nodeoffset, const char *const compatible)
 
int rtems_fdt_node_offset_by_compatible (rtems_fdt_handle *handle, int startoffset, const char *compatible)
 
int rtems_fdt_next_node (rtems_fdt_handle *handle, int offset, int *depth)
 
const char * rtems_fdt_strerror (int errval)
 
bool rtems_fdt_get_parent_prop_value (rtems_fdt_handle *handle, int nodeoffset, const char *name, uint32_t *value)
 
int rtems_fdt_prop_value (const char *const path, const char *const propname, void *value, size_t *size)
 
int rtems_fdt_prop_map (const char *const path, const char *const propname, const char *const names[], uintptr_t *values, size_t count)
 
int rtems_fdt_get_value (const char *const path, const char *const property, size_t size, uintptr_t *value)
 
int rtems_fdt_num_entries (rtems_fdt_handle *handle)
 
const char * rtems_fdt_entry_name (rtems_fdt_handle *handle, int id)
 
int rtems_fdt_entry_offset (rtems_fdt_handle *handle, int id)
 
uintptr_t rtems_fdt_get_offset_len_uintptr (const void *prop, int offset, int len)
 
uint32_t rtems_fdt_get_uint32 (const void *prop)
 
uint32_t rtems_fdt_get_offset_uint32 (const void *prop, int offset)
 
uint64_t rtems_fdt_get_uint64 (const void *prop)
 
uint64_t rtems_fdt_get_offset_uint64 (const void *prop, int offset)
 
uintptr_t rtems_fdt_get_uintptr (const void *prop)
 
uintptr_t rtems_fdt_get_offset_uintptr (const void *prop, int offset)
 
int rtems_fdt_getprop_address_cells (rtems_fdt_handle *handle, int nodeoffset)
 
int rtems_fdt_getprop_size_cells (rtems_fdt_handle *handle, int nodeoffset)
 
int rtems_fdt_getprop_address_map (rtems_fdt_handle *handle, const char *path, const char *name, rtems_fdt_address_map *addr_map)
 

Detailed Description

RTEMS Flattened Device Tree.

Support for loading, managing and accessing FDT blobs in RTEMS.

Macro Definition Documentation

◆ RTEMS_FDT_ERR_BADLAYOUT

#define RTEMS_FDT_ERR_BADLAYOUT   12

RTEMS_FDT_ERR_BADLAYOUT: For read-write functions, the given device tree has it's sub-blocks in an order that the function can't handle (memory reserve map, then structure, then strings). Use rtems_fdt_open_into() to reorganize the tree into a form suitable for the read-write operations.

◆ RTEMS_FDT_ERR_BADLENGTH

#define RTEMS_FDT_ERR_BADLENGTH   105

The property length is invalid

◆ RTEMS_FDT_ERR_BADMAGIC

#define RTEMS_FDT_ERR_BADMAGIC   9

RTEMS_FDT_ERR_BADMAGIC: Given "device tree" appears not to be a device tree at all - it is missing the flattened device tree magic number.

◆ RTEMS_FDT_ERR_BADOFFSET

#define RTEMS_FDT_ERR_BADOFFSET   4

RTEMS_FDT_ERR_BADOFFSET: Function was passed a structure block offset which is out-of-bounds, or which points to an unsuitable part of the structure for the operation.

◆ RTEMS_FDT_ERR_BADPATH

#define RTEMS_FDT_ERR_BADPATH   5

RTEMS_FDT_ERR_BADPATH: Function was passed a badly formatted path (e.g. missing a leading / for a function which requires an absolute path)

◆ RTEMS_FDT_ERR_BADPHANDLE

#define RTEMS_FDT_ERR_BADPHANDLE   6

RTEMS_FDT_ERR_BADPHANDLE: Function was passed an invalid phandle value. phandle values of 0 and -1 are not permitted.

◆ RTEMS_FDT_ERR_BADSTATE

#define RTEMS_FDT_ERR_BADSTATE   7

RTEMS_FDT_ERR_BADSTATE: Function was passed an incomplete device tree created by the sequential-write functions, which is not sufficiently complete for the requested operation.

◆ RTEMS_FDT_ERR_BADSTRUCTURE

#define RTEMS_FDT_ERR_BADSTRUCTURE   11

RTEMS_FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt structure block or other serious error (e.g. misnested nodes, or subnodes preceding properties).

◆ RTEMS_FDT_ERR_BADVERSION

#define RTEMS_FDT_ERR_BADVERSION   10

RTEMS_FDT_ERR_BADVERSION: Given device tree has a version which can't be handled by the requested operation. For read-write functions, this may mean that rtems_fdt_open_into() is required to convert the tree to the expected version.

◆ RTEMS_FDT_ERR_EXISTS

#define RTEMS_FDT_ERR_EXISTS   2

RTEMS_FDT_ERR_EXISTS: Attemped to create a node or property which already exists

◆ RTEMS_FDT_ERR_INTERNAL

#define RTEMS_FDT_ERR_INTERNAL   13

"Can't happen" error indicating a bug in libfdt

◆ RTEMS_FDT_ERR_INVALID_HANDLE

#define RTEMS_FDT_ERR_INVALID_HANDLE   100

Invalid handle.

◆ RTEMS_FDT_ERR_NO_MEMORY

#define RTEMS_FDT_ERR_NO_MEMORY   101

No memory.

◆ RTEMS_FDT_ERR_NOSPACE

#define RTEMS_FDT_ERR_NOSPACE   3

RTEMS_FDT_ERR_NOSPACE: Operation needed to expand the device tree, but its buffer did not have sufficient space to contain the expanded tree. Use rtems_fdt_open_into() to move the device tree to a buffer with more space.

◆ RTEMS_FDT_ERR_NOT_FOUND

#define RTEMS_FDT_ERR_NOT_FOUND   102

File not found.

◆ RTEMS_FDT_ERR_NOTFOUND

#define RTEMS_FDT_ERR_NOTFOUND   1

RTEMS_FDT_ERR_NOTFOUND: The requested node or property does not exist

◆ RTEMS_FDT_ERR_READ_FAIL

#define RTEMS_FDT_ERR_READ_FAIL   103

Cannot read the DTB into memory.

◆ RTEMS_FDT_ERR_REFERENCED

#define RTEMS_FDT_ERR_REFERENCED   104

The blob cannot be unloaded as it is referenced.

◆ RTEMS_FDT_ERR_TRUNCATED

#define RTEMS_FDT_ERR_TRUNCATED   8

RTEMS_FDT_ERR_TRUNCATED: Structure block of the given device tree ends without an RTEMS_FDT_END tag.

Function Documentation

◆ rtems_fdt_dup_handle()

void rtems_fdt_dup_handle ( rtems_fdt_handle from,
rtems_fdt_handle to 
)

Duplicate a handle. The copy must be released.

Parameters
fromDuplicate from this handle.
toDuplicate to this handle.

◆ rtems_fdt_entry_name()

const char * rtems_fdt_entry_name ( rtems_fdt_handle handle,
int  id 
)

Get the numbered entry name. Note that the id isn't the same as the offset - it's numbered 0, 1, 2 ... num_entries-1

◆ rtems_fdt_entry_offset()

int rtems_fdt_entry_offset ( rtems_fdt_handle handle,
int  id 
)

Get the numbered entry offset. Note that the id isn't the same as the offset - it's numbered 0, 1, 2 ... num_entries-1

◆ rtems_fdt_find_path_offset()

int rtems_fdt_find_path_offset ( rtems_fdt_handle handle,
const char *  path 
)

Find a tree node by its full path looking across of loaded blobs.. Each path component may omit the unit address portion, but the results of this are undefined if any such path component is ambiguous (that is if there are multiple nodes at the relevant level matching the given component, differentiated only by unit address).

If the handle points to a valid blob it is release and the search starts from the first blob.

Parameters
handleThe FDT handle assigned to the blob if found else left invalid.
pathFull path of the node to locate.
intIf less than 0 an error code else the node offset is returned.

◆ rtems_fdt_first_prop_offset()

int rtems_fdt_first_prop_offset ( rtems_fdt_handle handle,
int  nodeoffset 
)

Retrieve the offset for the first property for a node.

Parameters
handleThe FDT handle to the current blob.
nodeoffsetStructure block offset of the starting node.
Returns
int The offset of a node's first property.

◆ rtems_fdt_get_alias()

const char * rtems_fdt_get_alias ( rtems_fdt_handle handle,
const char *  name 
)

Retreive the path referenced by a given alias. That is, the value of the property named 'name' in the node /aliases.

Parameters
handleThe FDT handle to the current blob.
nameThe name of the alias to look up.
Returns
const char* A pointer to the expansion of the alias named 'name', of it exists NULL, if the given alias or the /aliases node does not exist

◆ rtems_fdt_get_alias_namelen()

const char * rtems_fdt_get_alias_namelen ( rtems_fdt_handle handle,
const char *const  name,
int  namelen 
)

Get alias based on substring. Identical to rtems_fdt_get_alias(), but only examine the first namelen characters of name for matching the alias name.

Parameters
handleThe FDT handle to the current blob.
nameThe name of the alias th look up.
namelenThe number of characters of name to consider.
Returns
const char* The alias or NULL.

◆ rtems_fdt_get_mem_rsv()

int rtems_fdt_get_mem_rsv ( rtems_fdt_handle handle,
int  n,
uint64_t *  address,
uint64_t *  size 
)

Retrieve one memory reserve map entry. On success, *address and *size will contain the address and size of the n-th reserve map entry from the device tree blob, in native-endian format.

Parameters
blob_descA valid blob descriptor.
addressPointer to 64-bit variables to hold the addresses.
sizePointer to 64-bit variables to hold the size.
Returns
int If less than 0 it is an error code else 0 is returned on success.

◆ rtems_fdt_get_name()

const char * rtems_fdt_get_name ( rtems_fdt_handle handle,
int  nodeoffset,
int *  length 
)

Retrieve the name of a given node (including unit address) of the device tree node at structure block offset @nodeoffset. If @length is non-NULL, the length of this name is also returned, in the integer pointed to by @length.

Parameters
handleThe FDT handle to the current blob.
nodeoffsetStructure block offset of the starting node.
lengthPointer to an integer variable or NULL. If non-NULL, this will be overwritten with either the length in bytes or the error code.
Returns
const char* The node's name on success or NULL on error. The length if non-NULL will hold the error code.

◆ rtems_fdt_get_parent_prop_value()

bool rtems_fdt_get_parent_prop_value ( rtems_fdt_handle handle,
int  nodeoffset,
const char *  name,
uint32_t *  value 
)

Return a parent property given a node offset. Travel up until found or the root node is reached

◆ rtems_fdt_get_path()

int rtems_fdt_get_path ( rtems_fdt_handle handle,
int  nodeoffset,
char *  buf,
int  buflen 
)

Determine the full path of a node. This function is expensive, as it must scan the device tree structure from the start to nodeoffset. It computes the full path of the node at offset nodeoffset, and records that path in the buffer at buf.

Parameters
handleThe FDT handle to the current blob.
nodeoffsetThe offset of the node whose path to find.
bufA character buffer to contain the returned path (will be overwritten)
buflenThe size of the character buffer at buf.
Returns
int 0 on success of an error code.

◆ rtems_fdt_get_phandle()

uint32_t rtems_fdt_get_phandle ( rtems_fdt_handle handle,
int  nodeoffset 
)

Retrieve the phandle of the device tree node at structure block offset nodeoffset.

Parameters
handleThe FDT handle to the current blob. @oaram nodeoffset The structure block offset of the node. return uint32_t The phandle of the node at nodeoffset, on success (!= 0, != -1) 0, if the node has no phandle, or another error occurs.

◆ rtems_fdt_getprop()

const void * rtems_fdt_getprop ( rtems_fdt_handle handle,
int  nodeoffset,
const char *const  name,
int *  length 
)

Retrieve the value of a given property. Retrieves a pointer to the value of the property named 'name' of the node at offset nodeoffset (this will be a pointer to within the device blob itself, not a copy of the value). If lenp is non-NULL, the length of the property value is also returned, in the integer pointed to by @length.

Parameters
handleThe FDT handle to the current blob.
nodeoffsetThe offset of the node whose property to find.
nameThe name of the property to find.
lengthPointer to an integer variable or NULL. If non-NULL, this will be overwritten with either the length in bytes or the error code.
Returns
const void* The node's property on success or NULL on error. The length if non-NULL will hold the error code.

◆ rtems_fdt_getprop_by_offset()

const void * rtems_fdt_getprop_by_offset ( rtems_fdt_handle handle,
int  propoffset,
const char **  name,
int *  length 
)

Retrieve the property value, name and length of name given a property offset.

Parameters
handleThe FDT handle to the current blob.
propoffsetProperty offset
nameIf not NULL set the pointer to the name string.
lengthPointer to an integer variable or NULL. If non-NULL, this will be overwritten with either the length in bytes or the error code.
Returns
const void* The node's value data.

◆ rtems_fdt_getprop_namelen()

const void * rtems_fdt_getprop_namelen ( rtems_fdt_handle handle,
int  nodeoffset,
const char *const  name,
int  namelen,
int *  length 
)

Get property value based on substring. Identical to rtems_fdt_getprop(), but only examine the first namelen characters of name for matching the property name.

Parameters
handleThe FDT handle to the current blob.
nodeoffsetOffset of the node whose property to find
nameThe name of the property to find
namelenThe number of characters of name to consider
lengthPointer to an integer variable or NULL. If non-NULL, this will be overwritten with either the length in bytes or the error code.
Returns
const void* The node's property on success or NULL on error. The length if non-NULL will hold the error code.

◆ rtems_fdt_init_handle()

void rtems_fdt_init_handle ( rtems_fdt_handle handle)

Initialise a handle to a default state.

Parameters
handleThe handle to initialise.

◆ rtems_fdt_load()

int rtems_fdt_load ( const char *const  filename,
rtems_fdt_handle handle 
)

Load a device tree blob or DTB file into memory and register it on the chain of blobs.

Parameters
filenameThe name of the blob file to load.
handleThe handle returns the reference to the blob once load.
Returns
int If less than 0 it is an error code else it is the blob descriptor.

◆ rtems_fdt_next_node()

int rtems_fdt_next_node ( rtems_fdt_handle handle,
int  offset,
int *  depth 
)

Traverse to the next node.

Parameters
handleThe FDT handle to the current blob.
offsetThe offset in the blob to start looking for the next node.
depthPointer to return the depth the node is.
Returns
int If less than 0 an error else the node offset.

◆ rtems_fdt_next_prop_offset()

int rtems_fdt_next_prop_offset ( rtems_fdt_handle handle,
int  propoffset 
)

Retrieve the next property of a node relative to the property

Parameters
handleThe FDT handle to the current blob.
propoffsetProperty offset to search from
Returns
int Property offset or end if less than 0.

◆ rtems_fdt_node_check_compatible()

int rtems_fdt_node_check_compatible ( rtems_fdt_handle handle,
int  nodeoffset,
const char *const  compatible 
)

Check a node's compatible property returning 0 if the given node contains a 'compatible' property with the given string as one of its elements, it returns non-zero otherwise, or on error.

Parameters
handleThe FDT handle to the current blob.
nodeoffsetThe offset of a tree node.
compatibleThe string to match against.
Return values
0,ifthe node has a 'compatible' property listing the given string.
1,ifthe node has a 'compatible' property, but it does not list the given string

◆ rtems_fdt_node_depth()

int rtems_fdt_node_depth ( rtems_fdt_handle handle,
int  nodeoffset 
)

Find the depth of a given node. The root node has depth 0, its immediate subnodes depth 1 and so forth.

Note
This function is expensive, as it must scan the device tree structure from the start to nodeoffset.
Parameters
handleThe FDT handle to the current blob.
nodeoffsetThe offset of the node whose parent to find.
Returns
int If less than 0 an error else the node offset.

◆ rtems_fdt_node_offset_by_compatible()

int rtems_fdt_node_offset_by_compatible ( rtems_fdt_handle handle,
int  startoffset,
const char *  compatible 
)

Find nodes with a given 'compatible' value returning the offset of the first node after startoffset, which has a 'compatible' property which lists the given compatible string; or if startoffset is -1, the very first such node in the tree.

To iterate through all nodes matching the criterion, the following idiom can be used:

offset = rtems_fdt_node_offset_by_compatible(blob, -1, compatible); while (offset != -RTEMS_FDT_ERR_NOTFOUND) { // other code here offset = rtems_fdt_node_offset_by_compatible(blob, offset, compatible); }

Note
The -1 in the first call to the function, if 0 is used here instead, the function will never locate the root node, even if it matches the criterion.
Parameters
handleThe FDT handle to the current blob.
startoffsetOnly find nodes after this offset.
compatibleThe 'compatible' string to match against.
Returns
int If less than 0 an error else the node offset.

◆ rtems_fdt_node_offset_by_phandle()

int rtems_fdt_node_offset_by_phandle ( rtems_fdt_handle handle,
uint32_t  phandle 
)

Find the node with a given phandle returning the offset of the node which has the given phandle value. If there is more than one node in the tree with the given phandle (an invalid tree), results are undefined.

Parameters
handleThe FDT handle to the current blob.
phandleThe phandle value.
Returns
int If less than 0 an error else the node offset.

◆ rtems_fdt_node_offset_by_prop_value()

int rtems_fdt_node_offset_by_prop_value ( rtems_fdt_handle handle,
int  startoffset,
const char *const  propname,
const void *  propval,
int  proplen 
)

Find nodes with a given property value. This funtion returns the offset of the first node after startoffset, which has a property named propname whose value is of length proplen and has value equal to propval; or if startoffset is -1, the very first such node in the tree.

To iterate through all nodes matching the criterion, the following idiom can be used: offset = rtemsfdt_node_offset_by_prop_value(blob, -1, propname, propval, proplen); while (offset != -RTEMS_FDT_ERR_NOTFOUND) { // other code here offset = rtems_fdt_node_offset_by_prop_value(fdt, offset, propname, propval, proplen); }

Note
The -1 in the first call to the function, if 0 is used here instead, the function will never locate the root node, even if it matches the criterion.
Parameters
handleThe FDT handle to the current blob.
startoffsetOnly find nodes after this offset.
propnameThe property name to check.
propvalThe property value to search for.
proplenThe length of the value in propval.
Returns
int The structure block offset of the located node (>= 0, >startoffset), on success and an error code is less than 0.

◆ rtems_fdt_num_entries()

int rtems_fdt_num_entries ( rtems_fdt_handle handle)

Get the number of entries in an FDT handle.

◆ rtems_fdt_num_mem_rsv()

int rtems_fdt_num_mem_rsv ( rtems_fdt_handle handle)

Returns the number of entries in the device tree blob's memory reservation map. This does not include the terminating 0,0 entry or any other (0,0) entries reserved for expansion.

Parameters
blob_descA valid blob descriptor.
Returns
int The number of entries.

◆ rtems_fdt_parent_offset()

int rtems_fdt_parent_offset ( rtems_fdt_handle handle,
int  nodeoffset 
)

Find the parent of a given node. This funciton locates the parent node of a given node (that is, it finds the offset of the node which contains the node at nodeoffset as a subnode).

Note
This function is expensive, as it must scan the device tree structure from the start to nodeoffset, twice.
Parameters
handleThe FDT handle to the current blob.
nodeoffsetThe offset of the node whose parent to find.
Returns
int If less than 0 an error else the node offset.

◆ rtems_fdt_path_offset()

int rtems_fdt_path_offset ( rtems_fdt_handle handle,
const char *  path 
)

Find a tree node by its full path. Each path component may omit the unit address portion, but the results of this are undefined if any such path component is ambiguous (that is if there are multiple nodes at the relevant level matching the given component, differentiated only by unit address).

Parameters
handleThe FDT handle to the current blob.
pathFull path of the node to locate.
intIf less than 0 an error code else the node offset is returned.

◆ rtems_fdt_prop_map()

int rtems_fdt_prop_map ( const char *const  path,
const char *const  propname,
const char *const  names[],
uintptr_t *  values,
size_t  count 
)

Create a map given a path the property name and the names of the subnodes of the path.

◆ rtems_fdt_prop_value()

int rtems_fdt_prop_value ( const char *const  path,
const char *const  propname,
void *  value,
size_t *  size 
)

Return a property given a path.

◆ rtems_fdt_register()

int rtems_fdt_register ( const void *  blob,
rtems_fdt_handle handle 
)

Register a device tree blob or DTB on to the chain of blobs.

Parameters
blob_descA pointer to the blob.
handleThe handle returns the reference to the blob once load.
Returns
int If less than 0 it is an error code else it is the blob descriptor.

◆ rtems_fdt_release_handle()

void rtems_fdt_release_handle ( rtems_fdt_handle handle)

Release a blob from a handle and clear it.

Parameters
handleThe handle to check.

◆ rtems_fdt_strerror()

const char * rtems_fdt_strerror ( int  errval)

Return an error string given an error value.

Parameters
errvalThe error value.
Returns
const char* The error string.

◆ rtems_fdt_subnode_offset()

int rtems_fdt_subnode_offset ( rtems_fdt_handle handle,
int  parentoffset,
const char *const  name 
)

Find a subnode of a given node at structure block offset parentoffset with the given name. The name may include a unit address, in which case rtems_fdt_subnode_offset() will find the subnode with that unit address, or the unit address may be omitted, in which case rtems_fdt_subnode_offset() will find an arbitrary subnode whose name excluding unit address matches the given name.

Parameters
blob_descA valid blob descriptor.
parentoffsetStructure block offset of a node.
nameThe name of the subnode to locate.
Returns
int If less than 0 it is an error code else the subnode offset is returned.

◆ rtems_fdt_subnode_offset_namelen()

int rtems_fdt_subnode_offset_namelen ( rtems_fdt_handle handle,
int  parentoffset,
const char *const  name,
int  namelen 
)

Find a subnode based on substring. Identical to rtems_fdt_subnode_offset(), but only examine the first namelen characters of name for matching the subnode name. This is useful for finding subnodes based on a portion of a larger string, such as a full path.

Parameters
blob_descA valid blob descriptor.
parentoffsetStructure block offset of a node
nameName of the subnode to locate.
namelenNumber of characters of name to consider.
Returns
int If less than 0 it is an error code else the node offset is returned.

◆ rtems_fdt_supernode_atdepth_offset()

int rtems_fdt_supernode_atdepth_offset ( rtems_fdt_handle handle,
int  nodeoffset,
int  supernodedepth,
int *  nodedepth 
)

Find a specific ancestor of a node at a specific depth from the root (where the root itself has depth 0, its immediate subnodes depth 1 and so forth). So rtems_fdt_supernode_atdepth_offset(blob, nodeoffset, 0, NULL); will always return 0, the offset of the root node. If the node at nodeoffset has depth D, then: rtems_fdt_supernode_atdepth_offset(blob, nodeoffset, D, NULL); will return nodeoffset itself.

Parameters
handleThe FDT handle to the current blob.
nodeoffsetThe offset of the node whose parent to find.
supernodedepthThe depth of the ancestor to find. @oaram nodedepth The pointer to an integer variable (will be overwritten) or NULL
Returns
int If less than 0 an error else the node offset.

◆ rtems_fdt_unload()

int rtems_fdt_unload ( rtems_fdt_handle handle)

Unload a device tree blob or DTB file and release any memory allocated when loading. The blob is removed from the list if registered.

Parameters
blob_descA valid blob descriptor.
Returns
int If less than 0 it is an error code else 0 is return on success.

◆ rtems_fdt_valid_handle()

bool rtems_fdt_valid_handle ( const rtems_fdt_handle handle)

Check if a handle had a valid blob assigned.

Parameters
handleThe handle to check.
Return values
trueThe handle has a valid blob.
falseThe handle does not have a valid blob.