Loading...
Searching...
No Matches
furi_hal_mpu.h
1
6#pragma once
7
8#include <stdbool.h>
9#include <stdint.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15typedef enum {
16 FuriHalMpuRegionNULL = 0x00, // region 0 used to protect null pointer dereference
17 FuriHalMpuRegionMainStack = 0x01, // region 1 used to protect Main Stack
18 FuriHalMpuRegionThreadStack =
19 0x02, // region 2 used to protect currently executed RTOS Thread Stack
20 FuriHalMpuRegion3 = 0x03,
21 FuriHalMpuRegion4 = 0x04,
22 FuriHalMpuRegion5 = 0x05,
23 FuriHalMpuRegion6 = 0x06,
24 FuriHalMpuRegion7 = 0x07,
25} FuriHalMpuRegion;
26
27typedef enum {
28 FuriHalMPURegionSize32B = 0x04U,
29 FuriHalMPURegionSize64B = 0x05U,
30 FuriHalMPURegionSize128B = 0x06U,
31 FuriHalMPURegionSize256B = 0x07U,
32 FuriHalMPURegionSize512B = 0x08U,
33 FuriHalMPURegionSize1KB = 0x09U,
34 FuriHalMPURegionSize2KB = 0x0AU,
35 FuriHalMPURegionSize4KB = 0x0BU,
36 FuriHalMPURegionSize8KB = 0x0CU,
37 FuriHalMPURegionSize16KB = 0x0DU,
38 FuriHalMPURegionSize32KB = 0x0EU,
39 FuriHalMPURegionSize64KB = 0x0FU,
40 FuriHalMPURegionSize128KB = 0x10U,
41 FuriHalMPURegionSize256KB = 0x11U,
42 FuriHalMPURegionSize512KB = 0x12U,
43 FuriHalMPURegionSize1MB = 0x13U,
44 FuriHalMPURegionSize2MB = 0x14U,
45 FuriHalMPURegionSize4MB = 0x15U,
46 FuriHalMPURegionSize8MB = 0x16U,
47 FuriHalMPURegionSize16MB = 0x17U,
48 FuriHalMPURegionSize32MB = 0x18U,
49 FuriHalMPURegionSize64MB = 0x19U,
50 FuriHalMPURegionSize128MB = 0x1AU,
51 FuriHalMPURegionSize256MB = 0x1BU,
52 FuriHalMPURegionSize512MB = 0x1CU,
53 FuriHalMPURegionSize1GB = 0x1DU,
54 FuriHalMPURegionSize2GB = 0x1EU,
55 FuriHalMPURegionSize4GB = 0x1FU,
56} FuriHalMPURegionSize;
57
61void furi_hal_mpu_init(void);
62
66void furi_hal_mpu_enable(void);
67
71void furi_hal_mpu_disable(void);
72
73void furi_hal_mpu_protect_no_access(
74 FuriHalMpuRegion region,
75 uint32_t address,
76 FuriHalMPURegionSize size);
77
78void furi_hal_mpu_protect_read_only(
79 FuriHalMpuRegion region,
80 uint32_t address,
81 FuriHalMPURegionSize size);
82
83void furi_hal_mpu_protect_disable(FuriHalMpuRegion region);
84
85#ifdef __cplusplus
86}
87#endif