summaryrefslogtreecommitdiff
path: root/software/double_tap_dontboot/double_tap_dontboot.c
diff options
context:
space:
mode:
authorMegan Wachs <megan@sifive.com>2017-05-04 05:50:00 -0700
committerGitHub <noreply@github.com>2017-05-04 05:49:59 -0700
commit5b2498467020616de013fd557b6a1e685544ee18 (patch)
treebb197ca9ef8f9265a79485f3a13e4e921a0ff93b /software/double_tap_dontboot/double_tap_dontboot.c
parent3a01ac1b7c0e72c04679f0cd6552c4ff0b308863 (diff)
parent4d5cbec9118cbedf2d4ae5b54acaa22862245a4c (diff)
Merge pull request #54 from sifive/tag_v20170504
Update SDK For E31/E51 Coreplex IP Evaluation
Diffstat (limited to 'software/double_tap_dontboot/double_tap_dontboot.c')
-rw-r--r--software/double_tap_dontboot/double_tap_dontboot.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/software/double_tap_dontboot/double_tap_dontboot.c b/software/double_tap_dontboot/double_tap_dontboot.c
index 0cae5b5..53c2c64 100644
--- a/software/double_tap_dontboot/double_tap_dontboot.c
+++ b/software/double_tap_dontboot/double_tap_dontboot.c
@@ -42,6 +42,11 @@
#include "platform.h"
#include "encoding.h"
+#ifndef _SIFIVE_HIFIVE1_H
+#error "double_tap_dontboot is designed to run on HiFive1 and/or E300 Arty Dev Kit."
+#endif
+
+
#define BACKUP15_MAGIC 0xD027B007
#define FINAL_ADDRESS 0x20400000
@@ -97,9 +102,9 @@ int main(void)
// because it makes it clear that the processor is actually
// running this code, not just the PWM hardware.
- now = *((volatile uint64_t*) (CLINT_BASE_ADDR + CLINT_MTIME));
+ now = *((volatile uint64_t*) (CLINT_CTRL_ADDR + CLINT_MTIME));
then = now + 32768/500;
- while (*((volatile uint64_t*) (CLINT_BASE_ADDR + CLINT_MTIME)) < then) {
+ while (*((volatile uint64_t*) (CLINT_CTRL_ADDR + CLINT_MTIME)) < then) {
asm volatile ("");
}
pwm_val = (pwm_val == 0) ? 255 : (pwm_val -1);
@@ -121,9 +126,9 @@ int main(void)
// Wait 500 ms. If reset is tapped at this point,
// we will execute the "magic" loop above.
- now = *((volatile uint64_t*) (CLINT_BASE_ADDR + CLINT_MTIME));
+ now = *((volatile uint64_t*) (CLINT_CTRL_ADDR + CLINT_MTIME));
then = now + 32768/2;
- while (*((volatile uint64_t*) (CLINT_BASE_ADDR + CLINT_MTIME)) < then) {
+ while (*((volatile uint64_t*) (CLINT_CTRL_ADDR + CLINT_MTIME)) < then) {
asm volatile ("");
}