Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Make the DE0 NanoSoC work also in big-endian mode



details:   https://anonhg.NetBSD.org/src/rev/aedb3656ac2e
branches:  trunk
changeset: 836384:aedb3656ac2e
user:      aymeric <aymeric%NetBSD.org@localhost>
date:      Sun Oct 14 18:58:44 2018 +0000

description:
Make the DE0 NanoSoC work also in big-endian mode

diffstat:

 sys/arch/arm/altera/cycv_platform.c |  10 +++++-----
 sys/arch/evbarm/conf/mk.altera      |   7 ++++++-
 2 files changed, 11 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 6dd72b2daeff -r aedb3656ac2e sys/arch/arm/altera/cycv_platform.c
--- a/sys/arch/arm/altera/cycv_platform.c       Sun Oct 14 18:56:39 2018 +0000
+++ b/sys/arch/arm/altera/cycv_platform.c       Sun Oct 14 18:58:44 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_platform.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $ */
+/* $NetBSD: cycv_platform.c,v 1.2 2018/10/14 18:58:44 aymeric Exp $ */
 
 /* This file is in the public domain. */
 
@@ -6,7 +6,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.2 2018/10/14 18:58:44 aymeric Exp $");
 
 #define        _ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -71,7 +71,7 @@
         * stored very low in RAM so we can't re-map the Boot ROM easily.
         */
 
-       *(volatile uint32_t *) 0x0 = 0xea000000 | ((startfunc - 8 - 0x0) >> 2);
+       *(volatile uint32_t *) 0x0 = htole32(0xea000000 | ((startfunc - 8 - 0x0) >> 2));
 
        arm_cpu_max = 2;
 
@@ -97,10 +97,10 @@
 #define CONSADDR_VA (CONSADDR - CYCV_PERIPHERAL_BASE + CYCV_PERIPHERAL_VBASE)
        volatile uint32_t *uartaddr = (volatile uint32_t *) CONSADDR_VA;
 
-       while ((uartaddr[com_lsr] & LSR_TXRDY) == 0)
+       while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0)
                ;
 
-       uartaddr[com_data] = c;
+       uartaddr[com_data] = htole32(c);
 #endif
 }
 
diff -r 6dd72b2daeff -r aedb3656ac2e sys/arch/evbarm/conf/mk.altera
--- a/sys/arch/evbarm/conf/mk.altera    Sun Oct 14 18:56:39 2018 +0000
+++ b/sys/arch/evbarm/conf/mk.altera    Sun Oct 14 18:58:44 2018 +0000
@@ -1,4 +1,9 @@
-#      $NetBSD: mk.altera,v 1.1 2018/09/19 17:31:39 aymeric Exp $
+#      $NetBSD: mk.altera,v 1.2 2018/10/14 18:58:44 aymeric Exp $
+
+.if !empty(MACHINE_ARCH:M*eb)
+EXTRA_LINKFLAGS+=      --be8
+.endif
+
 CPPFLAGS+=             -mcpu=cortex-a9 -mfpu=neon
 
 SYSTEM_FIRST_OBJ=      altera_start.o



Home | Main Index | Thread Index | Old Index