Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga/amiga Add support for byteswapping of bsr2/bs...
details: https://anonhg.NetBSD.org/src/rev/771e6b7170bf
branches: trunk
changeset: 782770:771e6b7170bf
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Mon Nov 19 22:32:48 2012 +0000
description:
Add support for byteswapping of bsr2/bsw2. Needed for X-Surf IDE (incoming).
diffstat:
sys/arch/amiga/amiga/amiga_bus_simple_1word.c | 35 +++++++++++++++++++++++---
1 files changed, 30 insertions(+), 5 deletions(-)
diffs (74 lines):
diff -r b4a1e7214646 -r 771e6b7170bf sys/arch/amiga/amiga/amiga_bus_simple_1word.c
--- a/sys/arch/amiga/amiga/amiga_bus_simple_1word.c Mon Nov 19 22:31:34 2012 +0000
+++ b/sys/arch/amiga/amiga/amiga_bus_simple_1word.c Mon Nov 19 22:32:48 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amiga_bus_simple_1word.c,v 1.7 2012/02/12 16:34:06 matt Exp $ */
+/* $NetBSD: amiga_bus_simple_1word.c,v 1.8 2012/11/19 22:32:48 rkujawa Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
#include <machine/pte.h>
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_1word.c,v 1.7 2012/02/12 16:34:06 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_1word.c,v 1.8 2012/11/19 22:32:48 rkujawa Exp $");
#define AMIGA_SIMPLE_BUS_STRIDE 1 /* 1 byte per byte */
#define AMIGA_SIMPLE_BUS_WORD_METHODS
@@ -44,6 +44,8 @@
#include "simple_busfuncs.c"
+bsr(oabs(bsr2_swap_), u_int16_t);
+bsw(oabs(bsw2_swap_), u_int16_t);
bsr(oabs(bsr4_swap_), u_int32_t);
bsw(oabs(bsw4_swap_), u_int32_t);
@@ -64,6 +66,30 @@
}
/* ARGSUSED */
+u_int16_t
+oabs(bsr2_swap_)(bus_space_handle_t handle, bus_size_t offset)
+{
+ volatile u_int16_t *p;
+ u_int16_t x;
+
+ p = (volatile u_int16_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
+ x = *p;
+ amiga_bus_reorder_protect();
+ return bswap16(x);
+}
+
+/* ARGSUSED */
+void
+oabs(bsw2_swap_)(bus_space_handle_t handle, bus_size_t offset, unsigned value)
+{
+ volatile u_int16_t *p;
+
+ p = (volatile u_int16_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
+ *p = bswap16( (u_int16_t)value );
+ amiga_bus_reorder_protect();
+}
+
+/* ARGSUSED */
u_int32_t
oabs(bsr4_swap_)(bus_space_handle_t handle, bus_size_t offset)
{
@@ -185,8 +211,8 @@
.bssr1 = oabs(bssr1_),
.bscr1 = oabs(bscr1_),
- .bsr2 = oabs(bsr2_), /* XXX swap? */
- .bsw2 = oabs(bsw2_), /* XXX swap? */
+ .bsr2 = oabs(bsr2_swap_),
+ .bsw2 = oabs(bsw2_swap_),
.bsrs2 = oabs(bsr2_),
.bsws2 = oabs(bsw2_),
.bsrm2 = oabs(bsrm2_swap_),
@@ -215,4 +241,3 @@
.bssr4 = oabs(bssr4_), /* XXX swap? */
.bscr4 = oabs(bscr4_) /* XXX swap? */
};
-
Home |
Main Index |
Thread Index |
Old Index