ANSIfy.
This commit is contained in:
parent
478a76b17a
commit
090e150c3f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: am79c930.c,v 1.8 2003/10/04 22:04:36 dyoung Exp $ */
|
||||
/* $NetBSD: am79c930.c,v 1.9 2004/01/15 09:33:48 onoe Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -61,10 +61,16 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: am79c930.c,v 1.8 2003/10/04 22:04:36 dyoung Exp $");
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: am79c930.c,v 1.9 2004/01/15 09:33:48 onoe Exp $");
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/endian.h>
|
||||
#ifndef __FreeBSD__
|
||||
#include <sys/device.h>
|
||||
#endif
|
||||
|
@ -90,27 +96,27 @@ __KERNEL_RCSID(0, "$NetBSD: am79c930.c,v 1.8 2003/10/04 22:04:36 dyoung Exp $");
|
|||
|
||||
#define AM930_DELAY(x) /*nothing*/
|
||||
|
||||
void am79c930_regdump __P((struct am79c930_softc *sc));
|
||||
void am79c930_regdump(struct am79c930_softc *sc);
|
||||
|
||||
static void io_write_1 __P((struct am79c930_softc *, u_int32_t, u_int8_t));
|
||||
static void io_write_2 __P((struct am79c930_softc *, u_int32_t, u_int16_t));
|
||||
static void io_write_4 __P((struct am79c930_softc *, u_int32_t, u_int32_t));
|
||||
static void io_write_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t));
|
||||
static void io_write_1(struct am79c930_softc *, u_int32_t, u_int8_t);
|
||||
static void io_write_2(struct am79c930_softc *, u_int32_t, u_int16_t);
|
||||
static void io_write_4(struct am79c930_softc *, u_int32_t, u_int32_t);
|
||||
static void io_write_bytes(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
|
||||
|
||||
static u_int8_t io_read_1 __P((struct am79c930_softc *, u_int32_t));
|
||||
static u_int16_t io_read_2 __P((struct am79c930_softc *, u_int32_t));
|
||||
static u_int32_t io_read_4 __P((struct am79c930_softc *, u_int32_t));
|
||||
static void io_read_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t));
|
||||
static u_int8_t io_read_1(struct am79c930_softc *, u_int32_t);
|
||||
static u_int16_t io_read_2(struct am79c930_softc *, u_int32_t);
|
||||
static u_int32_t io_read_4(struct am79c930_softc *, u_int32_t);
|
||||
static void io_read_bytes(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
|
||||
|
||||
static void mem_write_1 __P((struct am79c930_softc *, u_int32_t, u_int8_t));
|
||||
static void mem_write_2 __P((struct am79c930_softc *, u_int32_t, u_int16_t));
|
||||
static void mem_write_4 __P((struct am79c930_softc *, u_int32_t, u_int32_t));
|
||||
static void mem_write_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t));
|
||||
static void mem_write_1(struct am79c930_softc *, u_int32_t, u_int8_t);
|
||||
static void mem_write_2(struct am79c930_softc *, u_int32_t, u_int16_t);
|
||||
static void mem_write_4(struct am79c930_softc *, u_int32_t, u_int32_t);
|
||||
static void mem_write_bytes(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
|
||||
|
||||
static u_int8_t mem_read_1 __P((struct am79c930_softc *, u_int32_t));
|
||||
static u_int16_t mem_read_2 __P((struct am79c930_softc *, u_int32_t));
|
||||
static u_int32_t mem_read_4 __P((struct am79c930_softc *, u_int32_t));
|
||||
static void mem_read_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t));
|
||||
static u_int8_t mem_read_1(struct am79c930_softc *, u_int32_t);
|
||||
static u_int16_t mem_read_2(struct am79c930_softc *, u_int32_t);
|
||||
static u_int32_t mem_read_4(struct am79c930_softc *, u_int32_t);
|
||||
static void mem_read_bytes(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
|
||||
|
||||
static struct am79c930_ops iospace_ops = {
|
||||
io_write_1,
|
||||
|
@ -134,10 +140,8 @@ struct am79c930_ops memspace_ops = {
|
|||
mem_read_bytes
|
||||
};
|
||||
|
||||
static void io_write_1 (sc, off, val)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int8_t val;
|
||||
static void
|
||||
io_write_1( struct am79c930_softc *sc, u_int32_t off, u_int8_t val)
|
||||
{
|
||||
AM930_DELAY(1);
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI,
|
||||
|
@ -149,10 +153,8 @@ static void io_write_1 (sc, off, val)
|
|||
AM930_DELAY(1);
|
||||
}
|
||||
|
||||
static void io_write_2 (sc, off, val)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int16_t val;
|
||||
static void
|
||||
io_write_2(struct am79c930_softc *sc, u_int32_t off, u_int16_t val)
|
||||
{
|
||||
AM930_DELAY(1);
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI,
|
||||
|
@ -166,10 +168,8 @@ static void io_write_2 (sc, off, val)
|
|||
AM930_DELAY(1);
|
||||
}
|
||||
|
||||
static void io_write_4 (sc, off, val)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int32_t val;
|
||||
static void
|
||||
io_write_4(struct am79c930_softc *sc, u_int32_t off, u_int32_t val)
|
||||
{
|
||||
AM930_DELAY(1);
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI,
|
||||
|
@ -187,11 +187,9 @@ static void io_write_4 (sc, off, val)
|
|||
AM930_DELAY(1);
|
||||
}
|
||||
|
||||
static void io_write_bytes (sc, off, ptr, len)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int8_t *ptr;
|
||||
size_t len;
|
||||
static void
|
||||
io_write_bytes(struct am79c930_softc *sc, u_int32_t off, u_int8_t *ptr,
|
||||
size_t len)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -205,9 +203,8 @@ static void io_write_bytes (sc, off, ptr, len)
|
|||
bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA,ptr[i]);
|
||||
}
|
||||
|
||||
static u_int8_t io_read_1 (sc, off)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
static u_int8_t
|
||||
io_read_1(struct am79c930_softc *sc, u_int32_t off)
|
||||
{
|
||||
u_int8_t val;
|
||||
|
||||
|
@ -221,9 +218,8 @@ static u_int8_t io_read_1 (sc, off)
|
|||
return val;
|
||||
}
|
||||
|
||||
static u_int16_t io_read_2 (sc, off)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
static u_int16_t
|
||||
io_read_2(struct am79c930_softc *sc, u_int32_t off)
|
||||
{
|
||||
u_int16_t val;
|
||||
|
||||
|
@ -239,9 +235,8 @@ static u_int16_t io_read_2 (sc, off)
|
|||
return val;
|
||||
}
|
||||
|
||||
static u_int32_t io_read_4 (sc, off)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
static u_int32_t
|
||||
io_read_4(struct am79c930_softc *sc, u_int32_t off)
|
||||
{
|
||||
u_int32_t val;
|
||||
|
||||
|
@ -261,11 +256,9 @@ static u_int32_t io_read_4 (sc, off)
|
|||
return val;
|
||||
}
|
||||
|
||||
static void io_read_bytes (sc, off, ptr, len)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int8_t *ptr;
|
||||
size_t len;
|
||||
static void
|
||||
io_read_bytes(struct am79c930_softc *sc, u_int32_t off, u_int8_t *ptr,
|
||||
size_t len)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -279,18 +272,14 @@ static void io_read_bytes (sc, off, ptr, len)
|
|||
AM79C930_IODPA);
|
||||
}
|
||||
|
||||
static void mem_write_1 (sc, off, val)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int8_t val;
|
||||
static void
|
||||
mem_write_1(struct am79c930_softc *sc, u_int32_t off, u_int8_t val)
|
||||
{
|
||||
bus_space_write_1(sc->sc_memt, sc->sc_memh, off, val);
|
||||
}
|
||||
|
||||
static void mem_write_2 (sc, off, val)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int16_t val;
|
||||
static
|
||||
void mem_write_2(struct am79c930_softc *sc, u_int32_t off, u_int16_t val)
|
||||
{
|
||||
bus_space_tag_t t = sc->sc_memt;
|
||||
bus_space_handle_t h = sc->sc_memh;
|
||||
|
@ -304,10 +293,8 @@ static void mem_write_2 (sc, off, val)
|
|||
}
|
||||
}
|
||||
|
||||
static void mem_write_4 (sc, off, val)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int32_t val;
|
||||
static void
|
||||
mem_write_4(struct am79c930_softc *sc, u_int32_t off, u_int32_t val)
|
||||
{
|
||||
bus_space_tag_t t = sc->sc_memt;
|
||||
bus_space_handle_t h = sc->sc_memh;
|
||||
|
@ -323,26 +310,21 @@ static void mem_write_4 (sc, off, val)
|
|||
}
|
||||
}
|
||||
|
||||
static void mem_write_bytes (sc, off, ptr, len)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int8_t *ptr;
|
||||
size_t len;
|
||||
static void
|
||||
mem_write_bytes(struct am79c930_softc *sc, u_int32_t off, u_int8_t *ptr,
|
||||
size_t len)
|
||||
{
|
||||
bus_space_write_region_1 (sc->sc_memt, sc->sc_memh, off, ptr, len);
|
||||
}
|
||||
|
||||
|
||||
static u_int8_t mem_read_1 (sc, off)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
static u_int8_t
|
||||
mem_read_1(struct am79c930_softc *sc, u_int32_t off)
|
||||
{
|
||||
return bus_space_read_1(sc->sc_memt, sc->sc_memh, off);
|
||||
}
|
||||
|
||||
static u_int16_t mem_read_2 (sc, off)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
static u_int16_t
|
||||
mem_read_2(struct am79c930_softc *sc, u_int32_t off)
|
||||
{
|
||||
/* could be unaligned */
|
||||
if ((off & 0x1) == 0)
|
||||
|
@ -353,9 +335,8 @@ static u_int16_t mem_read_2 (sc, off)
|
|||
(bus_space_read_1(sc->sc_memt, sc->sc_memh, off+1) << 8);
|
||||
}
|
||||
|
||||
static u_int32_t mem_read_4 (sc, off)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
static u_int32_t
|
||||
mem_read_4(struct am79c930_softc *sc, u_int32_t off)
|
||||
{
|
||||
/* could be unaligned */
|
||||
if ((off & 0x3) == 0)
|
||||
|
@ -368,27 +349,20 @@ static u_int32_t mem_read_4 (sc, off)
|
|||
(bus_space_read_1(sc->sc_memt, sc->sc_memh, off+3) <<24);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void mem_read_bytes (sc, off, ptr, len)
|
||||
struct am79c930_softc *sc;
|
||||
u_int32_t off;
|
||||
u_int8_t *ptr;
|
||||
size_t len;
|
||||
static void
|
||||
mem_read_bytes(struct am79c930_softc *sc, u_int32_t off, u_int8_t *ptr,
|
||||
size_t len)
|
||||
{
|
||||
bus_space_read_region_1 (sc->sc_memt, sc->sc_memh, off, ptr, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Set bits in GCR.
|
||||
*/
|
||||
|
||||
void am79c930_gcr_setbits (sc, bits)
|
||||
struct am79c930_softc *sc;
|
||||
u_int8_t bits;
|
||||
void
|
||||
am79c930_gcr_setbits(struct am79c930_softc *sc, u_int8_t bits)
|
||||
{
|
||||
u_int8_t gcr = bus_space_read_1 (sc->sc_iot, sc->sc_ioh, AM79C930_GCR);
|
||||
|
||||
|
@ -401,9 +375,8 @@ void am79c930_gcr_setbits (sc, bits)
|
|||
* Clear bits in GCR.
|
||||
*/
|
||||
|
||||
void am79c930_gcr_clearbits (sc, bits)
|
||||
struct am79c930_softc *sc;
|
||||
u_int8_t bits;
|
||||
void
|
||||
am79c930_gcr_clearbits(struct am79c930_softc *sc, u_int8_t bits)
|
||||
{
|
||||
u_int8_t gcr = bus_space_read_1 (sc->sc_iot, sc->sc_ioh, AM79C930_GCR);
|
||||
|
||||
|
@ -412,15 +385,15 @@ void am79c930_gcr_clearbits (sc, bits)
|
|||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_GCR, gcr);
|
||||
}
|
||||
|
||||
u_int8_t am79c930_gcr_read (sc)
|
||||
struct am79c930_softc *sc;
|
||||
u_int8_t
|
||||
am79c930_gcr_read(struct am79c930_softc *sc)
|
||||
{
|
||||
return bus_space_read_1 (sc->sc_iot, sc->sc_ioh, AM79C930_GCR);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void am79c930_regdump (sc)
|
||||
struct am79c930_softc *sc;
|
||||
void
|
||||
am79c930_regdump(struct am79c930_softc *sc)
|
||||
{
|
||||
u_int8_t buf[8];
|
||||
int i;
|
||||
|
@ -438,8 +411,8 @@ void am79c930_regdump (sc)
|
|||
}
|
||||
#endif
|
||||
|
||||
void am79c930_chip_init (sc, how)
|
||||
struct am79c930_softc *sc;
|
||||
void
|
||||
am79c930_chip_init(struct am79c930_softc *sc, int how)
|
||||
{
|
||||
/* zero the bank select register, and leave it that way.. */
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_BSS, 0);
|
||||
|
@ -448,5 +421,3 @@ void am79c930_chip_init (sc, how)
|
|||
else
|
||||
sc->sc_ops = &iospace_ops;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* $NetBSD: am79c930var.h,v 1.2 1999/11/05 05:13:36 sommerfeld Exp $ */
|
||||
/* $NetBSD: am79c930var.h,v 1.3 2004/01/15 09:33:48 onoe Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -54,23 +55,23 @@ struct am79c930_softc
|
|||
|
||||
struct am79c930_ops
|
||||
{
|
||||
void (*write_1) __P((struct am79c930_softc *, u_int32_t, u_int8_t));
|
||||
void (*write_2) __P((struct am79c930_softc *, u_int32_t, u_int16_t));
|
||||
void (*write_4) __P((struct am79c930_softc *, u_int32_t, u_int32_t));
|
||||
void (*write_bytes) __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t));
|
||||
void (*write_1)(struct am79c930_softc *, u_int32_t, u_int8_t);
|
||||
void (*write_2)(struct am79c930_softc *, u_int32_t, u_int16_t);
|
||||
void (*write_4)(struct am79c930_softc *, u_int32_t, u_int32_t);
|
||||
void (*write_bytes)(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
|
||||
|
||||
u_int8_t (*read_1) __P((struct am79c930_softc *, u_int32_t));
|
||||
u_int16_t (*read_2) __P((struct am79c930_softc *, u_int32_t));
|
||||
u_int32_t (*read_4) __P((struct am79c930_softc *, u_int32_t));
|
||||
void (*read_bytes) __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t));
|
||||
u_int8_t (*read_1)(struct am79c930_softc *, u_int32_t);
|
||||
u_int16_t (*read_2)(struct am79c930_softc *, u_int32_t);
|
||||
u_int32_t (*read_4)(struct am79c930_softc *, u_int32_t);
|
||||
void (*read_bytes)(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
|
||||
};
|
||||
|
||||
void am79c930_chip_init __P((struct am79c930_softc *sc, int));
|
||||
void am79c930_chip_init(struct am79c930_softc *sc, int);
|
||||
|
||||
void am79c930_gcr_setbits __P((struct am79c930_softc *sc, u_int8_t bits));
|
||||
void am79c930_gcr_clearbits __P((struct am79c930_softc *sc, u_int8_t bits));
|
||||
void am79c930_gcr_setbits(struct am79c930_softc *sc, u_int8_t bits);
|
||||
void am79c930_gcr_clearbits(struct am79c930_softc *sc, u_int8_t bits);
|
||||
|
||||
u_int8_t am79c930_gcr_read __P((struct am79c930_softc *sc));
|
||||
u_int8_t am79c930_gcr_read(struct am79c930_softc *sc);
|
||||
|
||||
#define am79c930_hard_reset(sc) am79c930_gcr_setbits(sc, AM79C930_GCR_CORESET)
|
||||
#define am79c930_hard_reset_off(sc) am79c930_gcr_clearbits(sc, AM79C930_GCR_CORESET)
|
||||
|
|
Loading…
Reference in New Issue