aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-12-26 11:36:49 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-07 19:30:17 -0500
commite70b70fb75bb9b6017df3f5ff2d900b897ad3a8c (patch)
tree0c26d18138736f886d87bcc89fe01a0c50ff7ad4
parenta978167e3971bcf517a588072d081a42d37d48a0 (diff)
downloadkutter-e70b70fb75bb9b6017df3f5ff2d900b897ad3a8c.tar.gz
kutter-e70b70fb75bb9b6017df3f5ff2d900b897ad3a8c.tar.xz
kutter-e70b70fb75bb9b6017df3f5ff2d900b897ad3a8c.zip
sam4e8e: Move the sam4 cache setup to its own sam4_cache.c file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/sam4e8e/Makefile2
-rw-r--r--src/sam4e8e/main.c6
-rw-r--r--src/sam4e8e/sam4_cache.c16
3 files changed, 17 insertions, 7 deletions
diff --git a/src/sam4e8e/Makefile b/src/sam4e8e/Makefile
index 19d270d6..4eda793d 100644
--- a/src/sam4e8e/Makefile
+++ b/src/sam4e8e/Makefile
@@ -24,7 +24,7 @@ src-$(CONFIG_SERIAL) += sam4e8e/serial.c generic/serial_irq.c
src-$(CONFIG_HAVE_GPIO) += sam4e8e/gpio.c sam4e8e/afec.c
src-y += generic/crc16_ccitt.c generic/alloc.c
src-y += generic/armcm_irq.c generic/timer_irq.c
-src-y += sam4e8e/main.c sam4e8e/timer.c
+src-y += sam4e8e/main.c sam4e8e/sam4_cache.c sam4e8e/timer.c
# Build the additional hex output file
target-y += $(OUT)klipper.bin
diff --git a/src/sam4e8e/main.c b/src/sam4e8e/main.c
index 38e9653a..f3666075 100644
--- a/src/sam4e8e/main.c
+++ b/src/sam4e8e/main.c
@@ -43,12 +43,6 @@ int
main(void)
{
SystemInit();
-
- // Enable Cache
- if (!(CMCC->CMCC_SR & CMCC_SR_CSTS))
- CMCC->CMCC_CTRL = CMCC_CTRL_CEN;
-
- // Start main loop
sched_main();
return 0;
}
diff --git a/src/sam4e8e/sam4_cache.c b/src/sam4e8e/sam4_cache.c
new file mode 100644
index 00000000..75459660
--- /dev/null
+++ b/src/sam4e8e/sam4_cache.c
@@ -0,0 +1,16 @@
+// SAM4 cache enable
+//
+// Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
+//
+// This file may be distributed under the terms of the GNU GPLv3 license.
+
+#include "sam4e.h" // CMCC
+#include "sched.h" // DECL_INIT
+
+void
+sam4_cache_init(void)
+{
+ if (!(CMCC->CMCC_SR & CMCC_SR_CSTS))
+ CMCC->CMCC_CTRL = CMCC_CTRL_CEN;
+}
+DECL_INIT(sam4_cache_init);