Line data Source code
1 0 : /* 2 : * Copyright (c) 2023 Carlo Caione <ccaione@baylibre.com> 3 : * 4 : * SPDX-License-Identifier: Apache-2.0 5 : */ 6 : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MEM_ATTR_H_ 7 : #define ZEPHYR_INCLUDE_DT_BINDINGS_MEM_ATTR_H_ 8 : 9 : #include <zephyr/sys/util_macro.h> 10 : 11 : /* 12 : * Generic memory attributes. 13 : * 14 : * Generic memory attributes that should be common to all architectures. 15 : */ 16 0 : #define DT_MEM_ATTR_MASK GENMASK(15, 0) 17 0 : #define DT_MEM_ATTR_GET(x) ((x) & DT_MEM_ATTR_MASK) 18 0 : #define DT_MEM_ATTR_SHIFT (0) 19 : 20 0 : #define DT_MEM_CACHEABLE BIT(0) /* cacheable */ 21 0 : #define DT_MEM_NON_VOLATILE BIT(1) /* non-volatile */ 22 0 : #define DT_MEM_OOO BIT(2) /* out-of-order */ 23 0 : #define DT_MEM_DMA BIT(3) /* DMA-able */ 24 0 : #define DT_MEM_UNKNOWN BIT(15) /* must be last */ 25 : /* to be continued */ 26 : 27 : /* 28 : * Software specific memory attributes. 29 : * 30 : * Software can define their own memory attributes if needed using the 31 : * provided mask. 32 : */ 33 0 : #define DT_MEM_SW_ATTR_MASK GENMASK(19, 16) 34 0 : #define DT_MEM_SW_ATTR_GET(x) ((x) & DT_MEM_SW_ATTR_MASK) 35 0 : #define DT_MEM_SW_ATTR_SHIFT (16) 36 0 : #define DT_MEM_SW_ATTR_UNKNOWN BIT(19) 37 : 38 : /* 39 : * Architecture specific memory attributes. 40 : * 41 : * Architectures can define their own memory attributes if needed using the 42 : * provided mask. 43 : * 44 : * See for example `include/zephyr/dt-bindings/memory-attr/memory-attr-arm.h` 45 : */ 46 0 : #define DT_MEM_ARCH_ATTR_MASK GENMASK(31, 20) 47 0 : #define DT_MEM_ARCH_ATTR_GET(x) ((x) & DT_MEM_ARCH_ATTR_MASK) 48 0 : #define DT_MEM_ARCH_ATTR_SHIFT (20) 49 0 : #define DT_MEM_ARCH_ATTR_UNKNOWN BIT(31) 50 : 51 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MEM_ATTR_H_ */