Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arc_core_mpu.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Synopsys.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_MPU_ARC_CORE_MPU_H_
7#define ZEPHYR_INCLUDE_ARCH_ARC_V2_MPU_ARC_CORE_MPU_H_
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*
14 * The defines below represent the region types. The MPU driver is responsible
15 * to allocate the region accordingly to the type and set the correct
16 * attributes.
17 *
18 * Each MPU is different and has a different set of attributes, hence instead
19 * of having the attributes at this level the arc_mpu_core defines the intent
20 * types.
21 * An intent type (i.e. THREAD_STACK_GUARD) can correspond to a different set
22 * of operations and attributes for each MPU and it is responsibility of the
23 * MPU driver to select the correct ones.
24 *
25 * The intent based configuration can't fail hence at this level no error
26 * is returned by the configuration functions.
27 * If one of the operations corresponding to an intent fails the error has to
28 * be managed inside the MPU driver and not escalated.
29 */
30/* Thread Region Intent Type */
31#define THREAD_STACK_USER_REGION 0x0
32#define THREAD_STACK_REGION 0x1
33#define THREAD_APP_DATA_REGION 0x2
34#define THREAD_STACK_GUARD_REGION 0x3
35#define THREAD_DOMAIN_PARTITION_REGION 0x4
36
37#if defined(CONFIG_ARC_CORE_MPU)
38/* ARC Core MPU Driver API */
39
40/*
41 * This API has to be implemented by all the MPU drivers that have
42 * ARC_CORE_MPU support.
43 */
44
48void arc_core_mpu_enable(void);
49
53void arc_core_mpu_disable(void);
54
60void arc_core_mpu_configure_thread(struct k_thread *thread);
61
62/*
63 * Before configure the MPU regions, MPU should be disabled
64 */
70void arc_core_mpu_default(uint32_t region_attr);
71
80int arc_core_mpu_region(uint32_t index, uint32_t base, uint32_t size,
81 uint32_t region_attr);
82
83#endif /* CONFIG_ARC_CORE_MPU */
84
85#if defined(CONFIG_USERSPACE)
89 uint32_t partition_id);
91int arc_core_mpu_buffer_validate(const void *addr, size_t size, int write);
92
93#endif
94
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_MPU_ARC_CORE_MPU_H_ */
void arc_core_mpu_remove_mem_partition(struct k_mem_domain *domain, uint32_t partition_id)
void configure_mpu_thread(struct k_thread *thread)
void arc_core_mpu_configure_mem_domain(struct k_thread *thread)
void arc_core_mpu_remove_mem_domain(struct k_mem_domain *mem_domain)
int arc_core_mpu_buffer_validate(const void *addr, size_t size, int write)
int arc_core_mpu_get_max_domain_partition_regions(void)
static struct k_thread thread[2]
Definition atomic.c:26
ZTEST_BMEM int index[(3)]
Definition main.c:32
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Memory Domain.
Definition mem_domain.h:80
Thread Structure.
Definition thread.h:259