From e307bbb2ed8b751b2e937392c4105cc09c4ff0fe Mon Sep 17 00:00:00 2001 From: niklas Date: Fri, 21 Feb 1997 10:59:16 +0000 Subject: [PATCH] add bus_space_{read,write}_region_* + some KNF --- sys/arch/amiga/include/bus.h | 39 ++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/sys/arch/amiga/include/bus.h b/sys/arch/amiga/include/bus.h index b7bb10dcce5..2bba681b4cf 100644 --- a/sys/arch/amiga/include/bus.h +++ b/sys/arch/amiga/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.3 1996/11/28 23:33:05 niklas Exp $ */ +/* $OpenBSD: bus.h,v 1.4 1997/02/21 10:59:16 niklas Exp $ */ /* * Copyright (c) 1996 Niklas Hallqvist. @@ -54,7 +54,7 @@ struct amiga_bus_space { void *bs_data; int (*bs_map)(bus_space_tag_t, bus_addr_t, bus_size_t, int, - bus_space_handle_t *); + bus_space_handle_t *); int (*bs_unmap)(bus_space_tag_t, bus_space_handle_t, bus_size_t); /* We need swapping of 16-bit entities */ @@ -113,6 +113,23 @@ bus_space_read_multi(4,32) #define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!! +#define bus_space_read_region(n, m) \ +static __inline void \ +CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ + bus_addr_t ba, CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ +{ \ + while (cnt--) { \ + *buf++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ + ba += n; \ + } \ +} + +bus_space_read_region(1,8) +bus_space_read_region(2,16) +bus_space_read_region(4,32) + +#define bus_space_read_region_8 !!! bus_space_read_region_8 not implemented !!! + static __inline void bus_space_write_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_addr_t ba, u_int8_t x) @@ -153,6 +170,24 @@ bus_space_write_multi(4,32) #define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! +#define bus_space_write_region(n, m) \ +static __inline void \ +CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ + bus_addr_t ba, const CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ +{ \ + while (cnt--) { \ + CAT(bus_space_write_,n)(bst, bsh, ba, *buf++); \ + ba += n; \ + } \ +} + +bus_space_write_region(1,8) +bus_space_write_region(2,16) +bus_space_write_region(4,32) + +#define bus_space_write_region_8 \ + !!! bus_space_write_region_8 not implemented !!! + /* OpenBSD extensions */ static __inline void bus_space_read_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, -- 2.20.1