diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-09-17 19:27:22 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-09-17 19:27:22 +0000 |
commit | ccbf627c6c20e2b8545d927ea7f2962d6d8a2f9c (patch) | |
tree | 6d992df2c79f85f5d220ee6fc2a703f6f1e79802 /sys/arch/amiga/include | |
parent | 6f9551b5e7e9cb2b7c7b85031d6796fc2f080ee0 (diff) |
It is indeed tricky to get all bus accesses right when factoring out
the canonical form for all the three bus access interfaces amiga ave now
Diffstat (limited to 'sys/arch/amiga/include')
-rw-r--r-- | sys/arch/amiga/include/bus.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/amiga/include/bus.h b/sys/arch/amiga/include/bus.h index 87d8332a4a1..2ca83cecd0c 100644 --- a/sys/arch/amiga/include/bus.h +++ b/sys/arch/amiga/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.5 1997/09/09 22:41:42 niklas Exp $ */ +/* $OpenBSD: bus.h,v 1.6 1997/09/17 19:27:21 niklas Exp $ */ /* * Copyright (c) 1996 Niklas Hallqvist. @@ -86,7 +86,8 @@ bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_addr_t ba) static __inline u_int16_t bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_addr_t ba) { - u_int16_t x = *(volatile u_int16_t *)(bsh + (ba << bst->bs_shift)); + u_int16_t x = + *(volatile u_int16_t *)((bsh & ~1) + (ba << bst->bs_shift)); return bst->bs_swapped ? swap(x) : x; } @@ -144,7 +145,7 @@ static __inline void bus_space_write_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_addr_t ba, u_int16_t x) { - *(volatile u_int16_t *)(bsh + (ba << bst->bs_shift)) = + *(volatile u_int16_t *)((bsh & ~1) + (ba << bst->bs_shift)) = bst->bs_swapped ? swap(x) : x; } @@ -199,8 +200,8 @@ bus_space_read_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, register u_int16_t *buf16 = (u_int16_t *)buf; while (cnt) { - register u_int16_t x = - *(volatile u_int16_t *)(bsh + (ba << bst->bs_shift)); + register u_int16_t x = *(volatile u_int16_t *) + ((bsh & ~1) + (ba << bst->bs_shift)); *buf16++ = bst->bs_swapped ? x : swap(x); cnt -= 2; @@ -225,7 +226,7 @@ bus_space_write_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, register const u_int16_t *buf16 = (const u_int16_t *)buf; while (cnt) { - *(volatile u_int16_t *)(bsh + (ba << bst->bs_shift)) = + *(volatile u_int16_t *)((bsh & ~1) + (ba << bst->bs_shift)) = bst->bs_swapped ? *buf16 : swap(*buf16); buf16++; cnt -= 2; |