|
Zephyr API Documentation 4.3.0-rc1
A Scalable Open Source RTOS
|
Macros | |
| #define | DT_NODE_BY_FIXED_PARTITION_LABEL(label) |
| Get a node identifier for a fixed partition with a given label property. | |
| #define | DT_HAS_FIXED_PARTITION_LABEL(label) |
| Test if a fixed partition with a given label property exists. | |
| #define | DT_FIXED_PARTITION_EXISTS(node_id) |
| Test if fixed-partition compatible node exists. | |
| #define | DT_FIXED_PARTITION_ID(node_id) |
| Get a numeric identifier for a fixed partition. | |
| #define | DT_MEM_FROM_FIXED_PARTITION(node_id) |
| Get the node identifier of the flash memory for a partition. | |
| #define | DT_MTD_FROM_FIXED_PARTITION(node_id) |
| Get the node identifier of the flash controller for a partition. | |
| #define | DT_FIXED_PARTITION_ADDR(node_id) |
| Get the absolute address of a fixed partition. | |
| #define | DT_FIXED_SUBPARTITION_EXISTS(node_id) |
| Test if fixed-subpartitions compatible node exists. | |
| #define | DT_MEM_FROM_FIXED_SUBPARTITION(node_id) |
| Get the node identifier of the flash memory for a subpartition. | |
| #define | DT_MTD_FROM_FIXED_SUBPARTITION(node_id) |
| Get the node identifier of the flash controller for a subpartition. | |
| #define | DT_FIXED_SUBPARTITION_ADDR(node_id) |
| Get the absolute address of a fixed subpartition. | |
| #define DT_FIXED_PARTITION_ADDR | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Get the absolute address of a fixed partition.
Example devicetree fragment:
&flash_controller {
flash@1000000 {
compatible = "soc-nv-flash";
partitions {
compatible = "fixed-partitions";
storage_partition: partition@3a000 {
label = "storage";
};
};
};
};
Here, the "storage" partition is seen to belong to flash memory starting at address 0x1000000. The partition's unit address of 0x3a000 represents an offset inside that flash memory.
Example usage:
DT_FIXED_PARTITION_ADDR(DT_NODELABEL(storage_partition)) // 0x103a000
This macro can only be used with partitions of internal memory addressable by the CPU. Otherwise, it may produce a compile-time error, such as: ‘’__REG_IDX_0_VAL_ADDRESS' undeclared`.
| node_id | node identifier for a fixed-partitions child node |
| #define DT_FIXED_PARTITION_EXISTS | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Test if fixed-partition compatible node exists.
| node_id | DTS node to test |
| #define DT_FIXED_PARTITION_ID | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Get a numeric identifier for a fixed partition.
| node_id | node identifier for a fixed-partitions child node |
| #define DT_FIXED_SUBPARTITION_ADDR | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Get the absolute address of a fixed subpartition.
Example devicetree fragment:
&flash_controller {
flash@1000000 {
compatible = "soc-nv-flash";
partitions {
compatible = "fixed-partitions";
slot0_partition: partition@10000 {
compatible = "fixed-subpartitions";
reg = <0x00010000 0x40000>;
ranges = <0x0 0x10000 0x40000>;
#address-cells = <1>;
#size-cells = <1>;
storage_partition: partition@0 {
label = "storage";
reg = <0x00000000 0x40000>;
};
};
};
};
};
Here, the "storage" partition is seen to belong to flash memory starting at address 0x1000000. The partition's unit address of 0x10000 represents an offset inside that flash memory.
Example usage:
DT_FIXED_SUBPARTITION_ADDR(DT_NODELABEL(storage_partition)) // 0x1010000
This macro can only be used with subpartitions of internal memory addressable by the CPU. Otherwise, it may produce a compile-time error, such as: ‘’__REG_IDX_0_VAL_ADDRESS' undeclared`.
| node_id | node identifier for a fixed-subpartitions child node |
| #define DT_FIXED_SUBPARTITION_EXISTS | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Test if fixed-subpartitions compatible node exists.
| node_id | DTS node to test |
| #define DT_HAS_FIXED_PARTITION_LABEL | ( | label | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Test if a fixed partition with a given label property exists.
| label | lowercase-and-underscores label property value |
| #define DT_MEM_FROM_FIXED_PARTITION | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Get the node identifier of the flash memory for a partition.
| node_id | node identifier for a fixed-partitions child node |
| #define DT_MEM_FROM_FIXED_SUBPARTITION | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Get the node identifier of the flash memory for a subpartition.
| node_id | node identifier for a fixed-subpartitions child node |
| #define DT_MTD_FROM_FIXED_PARTITION | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Get the node identifier of the flash controller for a partition.
| node_id | node identifier for a fixed-partitions child node |
| #define DT_MTD_FROM_FIXED_SUBPARTITION | ( | node_id | ) |
#include <zephyr/devicetree/fixed-partitions.h>
Get the node identifier of the flash controller for a subpartition.
| node_id | node identifier for a fixed-subpartitions child node |
| #define DT_NODE_BY_FIXED_PARTITION_LABEL | ( | label | ) |
#include <zephyr/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
| label | lowercase-and-underscores label property value |