fdt/writer.h header reference
[Flattened device tree IO module]

The source code of this header can be browsed online.

Description  

Write-only access to FDT blobs

Members  

Type  

Functions  

Members detail  

#define FDT_WRITER_H_  

This macro is declared in fdt/writer.h source file, line 1.

void fdt_writer_add_rsvmap(struct fdt_writer_s *writer, uint64_t addr, uint64_t size)  

this function adds a reservation entry in the memory reservation map.

All calls to this function should be done before beginning to build the structure (nodes and properties)

Parameter list:

  • writer: A writer opaque structure
  • addr: Reserve map base address
  • size: Reserve map size

error_t fdt_writer_finalize(struct fdt_writer_s *writer, size_t *real_size)  

this function finalizes the blob. This function packs the data and writes all the offsets.

Parameter list:

  • writer: A writer opaque structure
  • real_size: A pointer to a variable to fill with the real size taken by the packed blob, if successful

The return value is whether finalization succeded

error_t fdt_writer_init(struct fdt_writer_s *writer, void *blob, size_t available_size)  

this function initializes the writer internal state, give a memory region to the writer code. If this memory region is not big enough, caller wont be notified until fdt_writer_finalize is called.

Parameter list:

  • writer: A writer opaque structure to initialize
  • blob: A buffer where the writer will put the blob
  • available_size: buffer size, in bytes

The return value is whether it went well

uint32_t fdt_writer_node_entry(struct fdt_writer_s *writer, const char *name)  

this function pushes a node in the device tree.

Only the root node should have an empty name ("").

Parameter list:

  • writer: A writer opaque structure
  • name: The relative name of the new node, without '/'

The return value is The offset of the node in the structure

void fdt_writer_node_leave(struct fdt_writer_s *writer)  

this function closes the current node.

Parameter list:

  • writer: A writer opaque structure

void fdt_writer_node_prop(struct fdt_writer_s *writer, const char *name, const void *data, size_t len)  

this function pushes an property in the current node. The data will be copied in the blob.

Parameter list:

  • writer: A writer opaque structure
  • name: The property name
  • data: The property value, may be NULL if len is 0
  • len: The property size, in bytes

struct fdt_writer_s  

This struct is declared in fdt/writer.h source file, line 19.

An opaque structure containing the internal state of the writer.

FieldDescription
void * opaque[7];

Valid XHTML 1.0 StrictGenerated by diaxen on Wed Oct 17 21:18:38 2018 using MkDoc