BSDL Device Tree Compiler
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Types | Public Member Functions | Public Attributes | List of all members
dtc::fdt::property_value Struct Reference

Public Types

enum  value_type {
  STRING_LIST, STRING, BINARY, CROSS_REFERENCE,
  PHANDLE, EMPTY, UNKNOWN
}
 

Public Member Functions

bool is_cross_reference ()
 
bool is_phandle ()
 
bool is_string ()
 
bool is_string_list ()
 
bool is_binary ()
 
uint32_t get_as_uint32 ()
 
 property_value (string l=string())
 
void push_to_buffer (byte_buffer &buffer)
 
void write_dts (FILE *file)
 

Public Attributes

string label
 
string string_data
 
byte_buffer byte_data
 
value_type type
 

Detailed Description

Properties may contain a number of different value, each with a different label. This class encapsulates a single value.

Member Enumeration Documentation

Enumeration describing the possible types of a value. Note that property-coded arrays will appear simply as binary (or possibly string, if they happen to be nul-terminated and printable), and must be checked separately.

Enumerator:
STRING_LIST 

This is a list of strings. When read from source, string lists become one property value for each string, however when read from binary we have a single property value incorporating the entire text, with nul bytes separating the strings.

STRING 

This property contains a single string.

BINARY 

This is a binary value. Check the size of byte_data to determine how many bytes this contains.

CROSS_REFERENCE 

This contains a short-form address that should be replaced by a fully-qualified version. This will only appear when the input is a device tree source. When parsed from a device tree blob, the cross reference will have already been resolved and the property value will be a string containing the full path of the target node.

PHANDLE 

This is a phandle reference. When parsed from source, the string_data will contain the node label for the target and, after cross references have been resolved, the binary data will contain a 32-bit integer that should match the phandle property of the target node.

EMPTY 

An empty property value. This will never appear on a real property value, it is used by checkers to indicate that no property values should exist for a property.

UNKNOWN 

The type of this property has not yet been determined.

Constructor & Destructor Documentation

dtc::fdt::property_value::property_value ( string  l = string())
inline

Default constructor, specifying the label of the value.

Member Function Documentation

uint32_t dtc::fdt::property_value::get_as_uint32 ( )
inline

Returns this property value as a 32-bit integer. Returns 0 if this property value is not 32 bits long. The bytes in the property value are assumed to be in big-endian format, but the return value is in the host native endian.

bool dtc::fdt::property_value::is_binary ( )
inline

Returns true if this value is binary, false otherwise.

bool dtc::fdt::property_value::is_cross_reference ( )
inline

Returns true if this value is a cross reference, false otherwise.

bool dtc::fdt::property_value::is_phandle ( )
inline

Returns true if this value is a phandle reference, false otherwise.

bool dtc::fdt::property_value::is_string ( )
inline

Returns true if this value is a string, false otherwise.

bool dtc::fdt::property_value::is_string_list ( )
inline

Returns true if this value is a string list (a nul-separated sequence of strings), false otherwise.

void dtc::fdt::property_value::push_to_buffer ( byte_buffer &  buffer)
inline

Writes the data for this value into an output buffer.

void dtc::fdt::property_value::write_dts ( FILE *  file)
inline

Writes the property value to the standard output. This uses the following heuristics for deciding how to print the output:

  • If the value is nul-terminated and only contains printable characters, it is written as a string.
  • If it is a multiple of 4 bytes long, then it is printed as cells.
  • Otherwise, it is printed as a byte buffer.

Member Data Documentation

byte_buffer dtc::fdt::property_value::byte_data

The data that should be written to the final output.

string dtc::fdt::property_value::label

The label for this data. This is usually empty.

string dtc::fdt::property_value::string_data

If this value is a string, or something resolved from a string (a reference) then this contains the source string.

value_type dtc::fdt::property_value::type

The type of this property.


The documentation for this struct was generated from the following file: