Add missing stream methods (for wdc_pcmcia.c)

This commit is contained in:
matt 2005-03-11 16:16:06 +00:00
parent 27ff389ba6
commit 63c819e89c
1 changed files with 137 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.h,v 1.9 2002/04/28 17:10:33 uch Exp $ */
/* $NetBSD: bus.h,v 1.10 2005/03/11 16:16:06 matt Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -355,6 +355,52 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
*addr++ = bswap32(*p++);
}
/*
* void bus_space_read_region_stream_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset,
* u_intN_t *addr, size_t count);
*
* Read `count' 1, 2, 4, or 8 byte quantities from bus space
* described by tag/handle and starting at `offset' and copy into
* buffer provided.
*/
static __inline void bus_space_read_region_stream_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t);
static __inline void bus_space_read_region_stream_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t);
static __inline void bus_space_read_region_stream_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t);
void
bus_space_read_region_stream_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t *addr, bus_size_t count)
{
u_int8_t *p = (u_int8_t *)(bsh + offset);
while (count--)
*addr++ = *p++;
}
void
bus_space_read_region_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t *addr, bus_size_t count)
{
u_int16_t *p = (u_int16_t *)(bsh + offset);
while (count--)
*addr++ = *p++;
}
void
bus_space_read_region_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t *addr, bus_size_t count)
{
u_int32_t *p = (u_int32_t *)(bsh + offset);
while (count--)
*addr++ = *p++;
}
/*
* void bus_space_write_region_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset,
@ -400,6 +446,51 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
*p++ = bswap32(*addr++);
}
/*
* void bus_space_write_region_stream_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset,
* const u_intN_t *addr, size_t count);
*
* Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
* to bus space described by tag/handle starting at `offset'.
*/
static __inline void bus_space_write_region_stream_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t);
static __inline void bus_space_write_region_stream_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, const u_int16_t *, bus_size_t);
static __inline void bus_space_write_region_stream_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, const u_int32_t *, bus_size_t);
void
bus_space_write_region_stream_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int8_t *addr, bus_size_t count)
{
u_int8_t *p = (u_int8_t *)(bsh + offset);
while (count--)
*p++ = *addr++;
}
void
bus_space_write_region_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int16_t *addr, bus_size_t count)
{
u_int16_t *p = (u_int16_t *)(bsh + offset);
while (count--)
*p++ = *addr++;
}
void
bus_space_write_region_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int32_t *addr, bus_size_t count)
{
u_int32_t *p = (u_int32_t *)(bsh + offset);
while (count--)
*p++ = *addr++;
}
/*
* void bus_space_write_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset,
@ -614,6 +705,51 @@ bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
*addr++ = val;
}
/*
* void bus_space_set_region_stream_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
* size_t count);
*
* Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
* by tag/handle starting at `offset'.
*/
static __inline void bus_space_set_region_stream_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t, bus_size_t);
static __inline void bus_space_set_region_stream_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t, bus_size_t);
static __inline void bus_space_set_region_stream_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t, bus_size_t);
void
bus_space_set_region_stream_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t val, bus_size_t count)
{
volatile u_int8_t *addr = (void *)(bsh + offset);
while (count--)
*addr++ = val;
}
void
bus_space_set_region_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t val, bus_size_t count)
{
volatile u_int16_t *addr = (void *)(bsh + offset);
while (count--)
*addr++ = val;
}
void
bus_space_set_region_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t val, bus_size_t count)
{
volatile u_int32_t *addr = (void *)(bsh + offset);
while (count--)
*addr++ = val;
}
/*
* void bus_space_copy_region_N(bus_space_tag_t tag,
* bus_space_handle_t bsh1, bus_size_t off1,