summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsp/env/coreplexip-arty.h2
-rw-r--r--bsp/env/coreplexip-e31-arty/platform.h10
-rw-r--r--bsp/libwrap/misc/write_hex.c4
3 files changed, 11 insertions, 5 deletions
diff --git a/bsp/env/coreplexip-arty.h b/bsp/env/coreplexip-arty.h
index 12ff9a6..161da7c 100644
--- a/bsp/env/coreplexip-arty.h
+++ b/bsp/env/coreplexip-arty.h
@@ -97,6 +97,6 @@
#define RTC_FREQ 32768
-void write_hex(int fd, uint32_t hex);
+void write_hex(int fd, long int hex);
#endif /* _SIFIVE_COREPLEXIP_ARTY_H */
diff --git a/bsp/env/coreplexip-e31-arty/platform.h b/bsp/env/coreplexip-e31-arty/platform.h
index 02a0a62..42c8887 100644
--- a/bsp/env/coreplexip-e31-arty/platform.h
+++ b/bsp/env/coreplexip-e31-arty/platform.h
@@ -4,8 +4,14 @@
#define _SIFIVE_PLATFORM_H
// Some things missing from the official encoding.h
-#define MCAUSE_INT 0x80000000
-#define MCAUSE_CAUSE 0x7FFFFFFF
+
+#if __riscv_xlen == 32
+#define MCAUSE_INT 0x80000000UL
+#define MCAUSE_CAUSE 0x7FFFFFFFUL
+#else
+#define MCAUSE_INT 0x8000000000000000UL
+#define MCAUSE_CAUSE 0x7FFFFFFFFFFFFFFFUL
+#endif
#define IRQ_M_LOCAL 16
#define MIP_MLIP(x) (1 << (IRQ_M_LOCAL + x))
diff --git a/bsp/libwrap/misc/write_hex.c b/bsp/libwrap/misc/write_hex.c
index e678bdc..96f832d 100644
--- a/bsp/libwrap/misc/write_hex.c
+++ b/bsp/libwrap/misc/write_hex.c
@@ -4,13 +4,13 @@
#include <unistd.h>
#include "platform.h"
-void write_hex(int fd, uint32_t hex)
+void write_hex(int fd, long int hex)
{
uint8_t ii;
uint8_t jj;
char towrite;
write(fd , "0x", 2);
- for (ii = 8 ; ii > 0; ii--) {
+ for (ii = sizeof(long int) * 2 ; ii > 0; ii--) {
jj = ii - 1;
uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4));
towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA));