Skip to content

Commit 3440378

Browse files
57300nordicjm
authored andcommitted
[nrf fromlist] soc: nordic: dmm: Fix DMM_REG_ALIGN_SIZE macro when CONFIG_DCACHE=n
Upstream PR #: 80676 Make sure this expansion doesn't include `CONFIG_DCACHE_LINE_SIZE`, which would be undefined and produce a build error. Signed-off-by: Grzegorz Swiderski <[email protected]> (cherry picked from commit cf5405a59931a55b34ed7223ec82f30e3548f339)
1 parent 015b317 commit 3440378

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

soc/nordic/common/dmm.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,27 @@ extern "C" {
2323

2424
/** @cond INTERNAL_HIDDEN */
2525

26+
#ifdef CONFIG_DCACHE
27+
2628
/* Determine if memory region is cacheable. */
27-
#define DMM_IS_REG_CACHEABLE(node_id) \
28-
COND_CODE_1(CONFIG_DCACHE, \
29-
(COND_CODE_1(DT_NODE_HAS_PROP(node_id, zephyr_memory_attr), \
30-
((DT_PROP(node_id, zephyr_memory_attr) & DT_MEM_CACHEABLE)), \
31-
(0))), (0))
29+
#define DMM_IS_REG_CACHEABLE(node_id) \
30+
COND_CODE_1(DT_NODE_HAS_PROP(node_id, zephyr_memory_attr), \
31+
((DT_PROP(node_id, zephyr_memory_attr) & DT_MEM_CACHEABLE)), \
32+
(0))
3233

3334
/* Determine required alignment of the data buffers in specified memory region.
3435
* Cache line alignment is required if region is cacheable and data cache is enabled.
3536
*/
3637
#define DMM_REG_ALIGN_SIZE(node_id) \
3738
(DMM_IS_REG_CACHEABLE(node_id) ? CONFIG_DCACHE_LINE_SIZE : sizeof(uint8_t))
3839

40+
#else
41+
42+
#define DMM_IS_REG_CACHEABLE(node_id) 0
43+
#define DMM_REG_ALIGN_SIZE(node_id) (sizeof(uint8_t))
44+
45+
#endif /* CONFIG_DCACHE */
46+
3947
/* Determine required alignment of the data buffers in memory region
4048
* associated with specified device node.
4149
*/

0 commit comments

Comments
 (0)