Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Devicetree Fixed Partition API

Macros

#define DT_NODE_BY_FIXED_PARTITION_LABEL(label)    DT_CAT(DT_COMPAT_fixed_partitions_LABEL_, label)
 Get a node identifier for a fixed partition with a given label property. More...
 
#define DT_HAS_FIXED_PARTITION_LABEL(label)    IS_ENABLED(DT_COMPAT_fixed_partitions_LABEL_##label##_EXISTS)
 Test if a fixed partition with a given label property exists. More...
 
#define DT_FIXED_PARTITION_ID(node_id)   DT_CAT(node_id, _PARTITION_ID)
 Get a numeric identifier for a fixed partition. More...
 
#define DT_MTD_FROM_FIXED_PARTITION(node_id)
 Get the node identifier of the flash device for a partition. More...
 

Detailed Description

Macro Definition Documentation

◆ DT_FIXED_PARTITION_ID

#define DT_FIXED_PARTITION_ID (   node_id)    DT_CAT(node_id, _PARTITION_ID)

#include <include/devicetree/fixed-partitions.h>

Get a numeric identifier for a fixed partition.

Parameters
node_idnode identifier for a fixed-partitions child node
Returns
the partition's ID, a unique zero-based index number

◆ DT_HAS_FIXED_PARTITION_LABEL

#define DT_HAS_FIXED_PARTITION_LABEL (   label)     IS_ENABLED(DT_COMPAT_fixed_partitions_LABEL_##label##_EXISTS)

#include <include/devicetree/fixed-partitions.h>

Test if a fixed partition with a given label property exists.

Parameters
labellowercase-and-underscores label property value
Returns
1 if any "fixed-partitions" child node has the given label, 0 otherwise.

◆ DT_MTD_FROM_FIXED_PARTITION

#define DT_MTD_FROM_FIXED_PARTITION (   node_id)

#include <include/devicetree/fixed-partitions.h>

Value:
COND_CODE_1(DT_NODE_HAS_COMPAT(DT_GPARENT(node_id), soc_nv_flash), \
(DT_PARENT(DT_GPARENT(node_id))), \
(DT_GPARENT(node_id)))
#define DT_NODE_HAS_COMPAT(node_id, compat)
Does a devicetree node match a compatible?
Definition: devicetree.h:1917
#define DT_PARENT(node_id)
Get a node identifier for a parent node.
Definition: devicetree.h:326
#define DT_GPARENT(node_id)
Get a node identifier for a grandparent node.
Definition: devicetree.h:347
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition: util_macro.h:156

Get the node identifier of the flash device for a partition.

Parameters
node_idnode identifier for a fixed-partitions child node
Returns
the node identifier of the memory technology device that contains the fixed-partitions node.

◆ DT_NODE_BY_FIXED_PARTITION_LABEL

#define DT_NODE_BY_FIXED_PARTITION_LABEL (   label)     DT_CAT(DT_COMPAT_fixed_partitions_LABEL_, label)

#include <include/devicetree/fixed-partitions.h>

Get a node identifier for a fixed partition with a given label property.

Example devicetree fragment:

flash@... {
         partitions {
                 compatible = "fixed-partitions";
                 boot_partition: partition@0 {
                         label = "mcuboot";
                 };
                 slot0_partition: partition@c000 {
                         label = "image-0";
                 };
                 ...
         };
};

Example usage:

DT_NODE_BY_FIXED_PARTITION_LABEL(mcuboot) // node identifier for boot_partition
DT_NODE_BY_FIXED_PARTITION_LABEL(image_0) // node identifier for slot0_partition
Parameters
labellowercase-and-underscores label property value
Returns
a node identifier for the partition with that label property