aboutsummaryrefslogtreecommitdiff
path: root/tests/test_mpu.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2021-10-26 00:10:06 -0600
committerJosh Rahm <joshuarahm@gmail.com>2021-10-26 00:10:06 -0600
commitf9b12f748b557994b958115c04fd1591b322248e (patch)
tree7d80680edadf5b0018944966af64f8773bfa8f1a /tests/test_mpu.c
parentdbbe83bd8882fe18e26f6305a1f425145bfea8db (diff)
parent90eb3a0b79bfef67c70dc545b49c48928eea05f4 (diff)
downloadstm32l4-f9b12f748b557994b958115c04fd1591b322248e.tar.gz
stm32l4-f9b12f748b557994b958115c04fd1591b322248e.tar.bz2
stm32l4-f9b12f748b557994b958115c04fd1591b322248e.zip
Merge branch 'christmas' into HEAD
Diffstat (limited to 'tests/test_mpu.c')
-rw-r--r--tests/test_mpu.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_mpu.c b/tests/test_mpu.c
new file mode 100644
index 0000000..551e079
--- /dev/null
+++ b/tests/test_mpu.c
@@ -0,0 +1,27 @@
+#include "test_harness.c"
+
+#include "arch/arm/cortex-m4/mpu.h"
+#include "kern/mpu/mpu_manager.h"
+
+TEST(mpu, smell)
+{
+ memory_region_opts_t memopts = { 0 };
+ memopts.region = (void*) 0;
+ memopts.bufferable = 0;
+ memopts.cacheable = 1;
+ memopts.sharable = 1;
+ memopts.tex = 0;
+ memopts.size = REGION_SIZE_4Gb;
+ memopts.perms = ACCESS_PERMS_FULL;
+ memopts.subregion_disable = 0;
+ memopts.executable = 1;
+ memopts.enable = 1;
+
+ mpu_configure_region(0, &memopts);
+ mpu_set_enabled(1);
+
+ ASSERT_EQ(MPU.rba_r, 1 << 4);
+ ASSERT_EQ(MPU.ras_r, 0x0306003F);
+
+ return 0;
+}