Zephyr API Documentation 4.0.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];
90};
91
103#else
104/* To support use of IS_ENABLED for the APIs below */
105struct k_mem_domain;
106struct k_mem_partition;
107#endif /* CONFIG_USERSPACE */
108
129int k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts,
130 struct k_mem_partition *parts[]);
131
160 struct k_mem_partition *part);
161
175 struct k_mem_partition *part);
176
189 k_tid_t thread);
190
191#ifdef __cplusplus
192}
193#endif
194
196#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:89
sys_dlist_t mem_domain_q
Doubly linked list of member threads.
Definition mem_domain.h:87
Definition arm_mpu_v7m.h:160
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:259
Macros to abstract toolchain specific capabilities.