|
Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
|
Macros | |
| #define | DT_NODE_BY_MAPPED_PARTITION_LABEL(label) |
| Get a node identifier for a mapped partition with a given label property. | |
| #define | DT_HAS_MAPPED_PARTITION_LABEL(label) |
| Test if a mapped partition with a given label property exists. | |
| #define | DT_MAPPED_PARTITION_EXISTS(node_id) |
| Test if zephyr,mapped-partition compatible node exists. | |
| #define | DT_MAPPED_PARTITION_ID(node_id) |
| Get a numeric identifier for a mapped partition. | |
| #define | DT_MEM_FROM_MAPPED_PARTITION(node_id) |
| Get the node identifier of the NVM memory for a partition. | |
| #define | DT_MTD_FROM_MAPPED_PARTITION(node_id) |
| Get the node identifier of the NVM controller for a partition. | |
| #define | DT_MAPPED_PARTITION_ADDR(node_id) |
| Get the absolute address of a mapped partition. | |
| #define | DT_MAPPED_PARTITION_OFFSET(node_id) |
| Get the offset address of a mapped partition from the NVM node. | |
| #define DT_HAS_MAPPED_PARTITION_LABEL | ( | label | ) |
#include <zephyr/devicetree/mapped-partition.h>
Test if a mapped partition with a given label property exists.
| label | lowercase-and-underscores label property value. |
| #define DT_MAPPED_PARTITION_ADDR | ( | node_id | ) |
#include <zephyr/devicetree/mapped-partition.h>
Get the absolute address of a mapped partition.
Example devicetree fragment:
flash@1000000 {
compatible = "soc-nv-flash";
reg = <0x1000000 0x30000>;
ranges = <0x0 0x1000000 0x30000>;
partitions {
ranges;
storage_partition: partition@3a000 {
compatible = "zephyr,mapped-partition";
label = "storage";
reg = <0x3a000 0x8000>;
};
};
};
Here, the "storage" partition is seen to belong to flash memory starting at address 0x1000000. The partition's address of 0x3a000 represents an offset inside that flash memory.
Example usage:
DT_MAPPED_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 zephyr,mapped-partition node |
| #define DT_MAPPED_PARTITION_EXISTS | ( | node_id | ) |
#include <zephyr/devicetree/mapped-partition.h>
Test if zephyr,mapped-partition compatible node exists.
| node_id | DTS node to test. |
| #define DT_MAPPED_PARTITION_ID | ( | node_id | ) |
#include <zephyr/devicetree/mapped-partition.h>
Get a numeric identifier for a mapped partition.
| node_id | node identifier for a zephyr,mapped-partition node. |
| #define DT_MAPPED_PARTITION_OFFSET | ( | node_id | ) |
#include <zephyr/devicetree/mapped-partition.h>
Get the offset address of a mapped partition from the NVM node.
Example devicetree fragment:
flash@1000000 {
compatible = "soc-nv-flash";
reg = <0x1000000 0x30000>;
ranges = <0x0 0x1000000 0x30000>;
partitions {
ranges;
storage_partition: partition@3a000 {
compatible = "zephyr,mapped-partition";
label = "storage";
reg = <0x3a000 0x8000>;
};
};
};
Here, the "storage" partition is seen to belong to flash memory starting at address 0x1000000. The partition's address of 0x3a000 represents an offset inside that flash memory.
Example usage:
DT_MAPPED_PARTITION_OFFSET(DT_NODELABEL(storage_partition)) // 0x3a000
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 zephyr,mapped-partition node |
| #define DT_MEM_FROM_MAPPED_PARTITION | ( | node_id | ) |
#include <zephyr/devicetree/mapped-partition.h>
Get the node identifier of the NVM memory for a partition.
| node_id | node identifier for a zephyr,mapped-partition node. |
| #define DT_MTD_FROM_MAPPED_PARTITION | ( | node_id | ) |
#include <zephyr/devicetree/mapped-partition.h>
Get the node identifier of the NVM controller for a partition.
| node_id | node identifier for a zephyr,mapped-partition node. |
| #define DT_NODE_BY_MAPPED_PARTITION_LABEL | ( | label | ) |
#include <zephyr/devicetree/mapped-partition.h>
Get a node identifier for a mapped partition with a given label property.
Example devicetree fragment:
flash@... {
reg = <0x0 0x40000>;
ranges = <0x0 0x0 0x40000>;
partitions {
ranges;
boot_partition: partition@0 {
compatible = "zephyr,mapped-partition";
reg = <0x0 0xc000>;
label = "mcuboot";
};
slot0_partition: partition@c000 {
compatible = "zephyr,mapped-partition";
reg = <0xc000 0x18000>;
label = "image-0";
};
...
};
};
Example usage:
DT_NODE_BY_MAPPED_PARTITION_LABEL(mcuboot) // Node identifier for boot_partition DT_NODE_BY_MAPPED_PARTITION_LABEL(image_0) // Node identifier for slot0_partition
| label | lowercase-and-underscores label property value. |