Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/include ANSI'fy, misc KNF.
details: https://anonhg.NetBSD.org/src/rev/3f2edfff2103
branches: trunk
changeset: 753175:3f2edfff2103
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Mar 19 14:20:56 2010 +0000
description:
ANSI'fy, misc KNF.
diffstat:
sys/arch/x68k/include/bus.h | 239 +++++++++++++++----------------------------
1 files changed, 86 insertions(+), 153 deletions(-)
diffs (truncated from 467 to 300 lines):
diff -r 53c8d3ce4f7a -r 3f2edfff2103 sys/arch/x68k/include/bus.h
--- a/sys/arch/x68k/include/bus.h Fri Mar 19 14:01:57 2010 +0000
+++ b/sys/arch/x68k/include/bus.h Fri Mar 19 14:20:56 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.21 2010/03/19 10:54:00 tsutsui Exp $ */
+/* $NetBSD: bus.h,v 1.22 2010/03/19 14:20:56 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -110,19 +110,20 @@
struct device *x68k_bus_device;
};
-int x68k_bus_space_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t, bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *);
+int x68k_bus_space_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t,
+ bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *);
void x68k_bus_space_free(bus_space_tag_t, bus_space_handle_t, bus_size_t);
/*
* bus_space(9) interface
*/
-#define bus_space_map(t,a,s,f,h) \
- ((*((t)->x68k_bus_space_map)) ((t),(a),(s),(f),(h)))
-#define bus_space_unmap(t,h,s) \
- ((*((t)->x68k_bus_space_unmap)) ((t),(h),(s)))
-#define bus_space_subregion(t,h,o,s,p) \
- ((*((t)->x68k_bus_space_subregion)) ((t),(h),(o),(s),(p)))
+#define bus_space_map(t, a, s, f, h) \
+ ((*((t)->x68k_bus_space_map)) ((t), (a), (s), (f), (h)))
+#define bus_space_unmap(t, h, s) \
+ ((*((t)->x68k_bus_space_unmap)) ((t), (h), (s)))
+#define bus_space_subregion(t, h, o, s, p) \
+ ((*((t)->x68k_bus_space_subregion)) ((t), (h), (o), (s), (p)))
#define BUS_SPACE_MAP_CACHEABLE 0x0001
#define BUS_SPACE_MAP_LINEAR 0x0002
#define BUS_SPACE_MAP_PREFETCHABLE 0x0004
@@ -135,10 +136,11 @@
#define BUS_SPACE_MAP_SHIFTED_EVEN 0x1000
#define BUS_SPACE_MAP_SHIFTED BUS_SPACE_MAP_SHIFTED_ODD
-#define bus_space_alloc(t,rs,re,s,a,b,f,r,h) \
- ((*((t)->x68k_bus_space_alloc)) ((t),(rs),(re),(s),(a),(b),(f),(r),(h)))
-#define bus_space_free(t,h,s) \
- ((*((t)->x68k_bus_space_free)) ((t),(h),(s)))
+#define bus_space_alloc(t, rs, re, s, a, b, f, r, h) \
+ ((*((t)->x68k_bus_space_alloc)) ((t), \
+ (rs), (re), (s), (a), (b), (f), (r), (h)))
+#define bus_space_free(t, h, s) \
+ ((*((t)->x68k_bus_space_free)) ((t), (h), (s)))
/*
* Note: the 680x0 does not currently require barriers, but we must
@@ -267,47 +269,39 @@
+ ((handle) & 0x7fffffff))
static __inline uint8_t
-_bus_space_read_1(t, bsh, offset)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
+_bus_space_read_1(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset)
{
- return (*((volatile uint8_t *) __X68K_BUS_ADDR(t, bsh, offset)));
+
+ return *((volatile uint8_t *) __X68K_BUS_ADDR(t, bsh, offset));
}
static __inline uint16_t
-_bus_space_read_2(t, bsh, offset)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
+_bus_space_read_2(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset)
{
- return (*((volatile uint16_t *) __X68K_BUS_ADDR(t, bsh, offset)));
+
+ return *((volatile uint16_t *) __X68K_BUS_ADDR(t, bsh, offset));
}
static __inline uint32_t
-_bus_space_read_4(t, bsh, offset)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
+_bus_space_read_4(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset)
{
- return (*((volatile uint32_t *) __X68K_BUS_ADDR(t, bsh, offset)));
+
+ return *((volatile uint32_t *) __X68K_BUS_ADDR(t, bsh, offset));
}
static __inline void
-_bus_space_read_multi_1(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint8_t *datap;
- bus_size_t count;
+_bus_space_read_multi_1(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint8_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint8_t *regadr = (uint8_t *) __X68K_BUS_ADDR(t, bsh, offset);
+
for (; count; count--) {
__asm("| avoid optim. _bus_space_read_multi_1" : : : "memory");
*datap++ = *regadr;
}
#else
+
while (count-- > 0) {
*datap++ = *(volatile uint8_t *)
__X68K_BUS_ADDR(t, bsh, offset);
@@ -316,20 +310,18 @@
}
static __inline void
-_bus_space_read_multi_2(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint16_t *datap;
- bus_size_t count;
+_bus_space_read_multi_2(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint16_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint16_t *regadr = (uint16_t *) __X68K_BUS_ADDR(t, bsh, offset);
+
for (; count; count--) {
__asm("| avoid optim. _bus_space_read_multi_2" : : : "memory");
*datap++ = *regadr;
}
#else
+
while (count-- > 0) {
*datap++ = *(volatile uint16_t *)
__X68K_BUS_ADDR(t, bsh, offset);
@@ -338,20 +330,18 @@
}
static __inline void
-_bus_space_read_multi_4(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint32_t *datap;
- bus_size_t count;
+_bus_space_read_multi_4(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint32_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint32_t *regadr = (uint32_t *) __X68K_BUS_ADDR(t, bsh, offset);
+
for (; count; count--) {
__asm("| avoid optim. _bus_space_read_multi_4" : : : "memory");
*datap++ = *regadr;
}
#else
+
while (count-- > 0) {
*datap++ = *(volatile uint32_t *)
__X68K_BUS_ADDR(t, bsh, offset);
@@ -360,12 +350,8 @@
}
static __inline void
-_bus_space_read_region_1(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint8_t *datap;
- bus_size_t count;
+_bus_space_read_region_1(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint8_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint8_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
@@ -384,12 +370,8 @@
}
static __inline void
-_bus_space_read_region_2(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint16_t *datap;
- bus_size_t count;
+_bus_space_read_region_2(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint16_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint16_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
@@ -408,12 +390,8 @@
}
static __inline void
-_bus_space_read_region_4(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint32_t *datap;
- bus_size_t count;
+_bus_space_read_region_4(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint32_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint32_t *addr = (void *) __X68K_BUS_ADDR(t, bsh, offset);
@@ -432,50 +410,42 @@
}
static __inline void
-_bus_space_write_1(t, bsh, offset, value)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint8_t value;
+_bus_space_write_1(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint8_t value)
{
+
*(volatile uint8_t *) __X68K_BUS_ADDR(t, bsh, offset) = value;
}
static __inline void
-_bus_space_write_2(t, bsh, offset, value)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint16_t value;
+_bus_space_write_2(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint16_t value)
{
+
*(volatile uint16_t *) __X68K_BUS_ADDR(t, bsh, offset) = value;
}
static __inline void
-_bus_space_write_4(t, bsh, offset, value)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- uint32_t value;
+_bus_space_write_4(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, uint32_t value)
{
+
*(volatile uint32_t *) __X68K_BUS_ADDR(t, bsh, offset) = value;
}
static __inline void
-_bus_space_write_multi_1(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- const uint8_t *datap;
- bus_size_t count;
+_bus_space_write_multi_1(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, const uint8_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint8_t *regadr = (uint8_t *) __X68K_BUS_ADDR(t, bsh, offset);
+
for (; count; count--) {
__asm("| avoid optim. _bus_space_write_multi_1" : : : "memory");
*regadr = *datap++;
}
#else
+
while (count-- > 0) {
*(volatile uint8_t *) __X68K_BUS_ADDR(t, bsh, offset)
= *datap++;
@@ -484,20 +454,18 @@
}
static __inline void
-_bus_space_write_multi_2(t, bsh, offset, datap, count)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
- const uint16_t *datap;
- bus_size_t count;
+_bus_space_write_multi_2(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, const uint16_t *datap, bus_size_t count)
{
#if X68K_BUS_PERFORMANCE_HACK
uint16_t *regadr = (uint16_t *) __X68K_BUS_ADDR(t, bsh, offset);
+
for (; count; count--) {
__asm("| avoid optim. _bus_space_write_multi_2" : : : "memory");
*regadr = *datap++;
}
#else
+
while (count-- > 0) {
*(volatile uint16_t *) __X68K_BUS_ADDR(t, bsh, offset)
= *datap++;
@@ -506,20 +474,18 @@
}
Home |
Main Index |
Thread Index |
Old Index