Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mem_domain.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Linaro Limited
3 * Copyright (c) 2018-2020 Intel Corporation
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_APP_MEMORY_MEM_DOMAIN_H_
9#define ZEPHYR_INCLUDE_APP_MEMORY_MEM_DOMAIN_H_
10
11#include <stdint.h>
12#include <stddef.h>
13#include <zephyr/sys/dlist.h>
14#include <zephyr/toolchain.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
27#ifdef CONFIG_USERSPACE
33#ifdef _ARCH_MEM_PARTITION_ALIGN_CHECK
34#define K_MEM_PARTITION_DEFINE(name, start, size, attr) \
35 _ARCH_MEM_PARTITION_ALIGN_CHECK(start, size); \
36 struct k_mem_partition name =\
37 { (uintptr_t)start, size, attr}
38#else
39#define K_MEM_PARTITION_DEFINE(name, start, size, attr) \
40 struct k_mem_partition name =\
41 { (uintptr_t)start, size, attr}
42#endif /* _ARCH_MEM_PARTITION_ALIGN_CHECK */
43
63
81#ifdef CONFIG_ARCH_MEM_DOMAIN_DATA
82 struct arch_mem_domain arch;
83#endif /* CONFIG_ARCH_MEM_DOMAIN_DATA */
85 struct k_mem_partition partitions[CONFIG_MAX_DOMAIN_PARTITIONS];
86#ifdef CONFIG_MEM_DOMAIN_HAS_THREAD_LIST
91 sys_dlist_t thread_mem_domain_list;
92#endif /* CONFIG_MEM_DOMAIN_HAS_THREAD_LIST */
95};
96
98
110#else
111/* To support use of IS_ENABLED for the APIs below */
112struct k_mem_domain;
113struct k_mem_partition;
114#endif /* CONFIG_USERSPACE */
115
136int k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts,
137 struct k_mem_partition *parts[]);
138
167 struct k_mem_partition *part);
168
182 struct k_mem_partition *part);
183
196 k_tid_t thread);
197
198#ifdef __cplusplus
199}
200#endif
201
203#endif /* ZEPHYR_INCLUDE_APP_MEMORY_MEM_DOMAIN_H_ */
struct _dnode sys_dlist_t
Doubly-linked list structure.
Definition dlist.h:50
int k_mem_domain_add_partition(struct k_mem_domain *domain, struct k_mem_partition *part)
Add a memory partition into a memory domain.
struct k_mem_domain k_mem_domain_default
Default memory domain.
int k_mem_domain_add_thread(struct k_mem_domain *domain, k_tid_t thread)
Add a thread into a memory domain.
int k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts, struct k_mem_partition *parts[])
Initialize a memory domain.
int k_mem_domain_remove_partition(struct k_mem_domain *domain, struct k_mem_partition *part)
Remove a memory partition from a memory domain.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
Definition arch.h:46
Memory Domain.
Definition mem_domain.h:80
struct k_mem_partition partitions[CONFIG_MAX_DOMAIN_PARTITIONS]
partitions in the domain
Definition mem_domain.h:85
uint8_t num_partitions
number of active partitions in the domain
Definition mem_domain.h:94
Definition arm_mpu_v7m.h:142
Memory Partition.
Definition mem_domain.h:55
uintptr_t start
start address of memory partition
Definition mem_domain.h:57
size_t size
size of memory partition
Definition mem_domain.h:59
k_mem_partition_attr_t attr
attribute of memory partition
Definition mem_domain.h:61
Thread Structure.
Definition thread.h:252
Macros to abstract toolchain specific capabilities.