Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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 INCLUDE_APP_MEMPORY_MEM_DOMAIN_H
9#define INCLUDE_APP_MEMPORY_MEM_DOMAIN_H
10
11#include <stdint.h>
12#include <stddef.h>
13#include <sys/dlist.h>
14#include <toolchain.h>
15#include <kernel/thread.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
59 size_t size;
62};
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
125extern void k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts,
126 struct k_mem_partition *parts[]);
127
151extern void k_mem_domain_add_partition(struct k_mem_domain *domain,
152 struct k_mem_partition *part);
153
163 struct k_mem_partition *part);
164
175extern void k_mem_domain_add_thread(struct k_mem_domain *domain,
177
178#ifdef __cplusplus
179}
180#endif
181
183#endif /* INCLUDE_APP_MEMORY_MEM_DOMAIN_H */
static struct k_thread thread[2]
Definition: atomic.c:22
Doubly-linked list implementation.
struct _dnode sys_dlist_t
Definition: dlist.h:48
void 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
void k_mem_domain_add_thread(struct k_mem_domain *domain, k_tid_t thread)
Add a thread into a memory domain.
void k_mem_domain_remove_partition(struct k_mem_domain *domain, struct k_mem_partition *part)
Remove a memory partition from a memory domain.
void k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts, struct k_mem_partition *parts[])
Initialize a memory domain.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:75
Definition: arch.h:76
Memory Domain.
Definition: mem_domain.h:80
struct k_mem_partition partitions[CONFIG_MAX_DOMAIN_PARTITIONS]
Definition: mem_domain.h:85
uint8_t num_partitions
Definition: mem_domain.h:89
sys_dlist_t mem_domain_q
Definition: mem_domain.h:87
Definition: arm_mpu_v7m.h:149
Memory Partition.
Definition: mem_domain.h:55
uintptr_t start
Definition: mem_domain.h:57
size_t size
Definition: mem_domain.h:59
k_mem_partition_attr_t attr
Definition: mem_domain.h:61
Definition: thread.h:201
Macros to abstract toolchain specific capabilities.