xref: /netbsd-src/sys/dev/ic/am79c930var.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /* $NetBSD: am79c930var.h,v 1.6 2008/04/28 20:23:49 martin Exp $ */
2090e150cSonoe /* $FreeBSD$ */
373bf1311Ssommerfeld 
458e709f6Ssommerfeld /*-
558e709f6Ssommerfeld  * Copyright (c) 1999 The NetBSD Foundation, Inc.
658e709f6Ssommerfeld  * All rights reserved.
758e709f6Ssommerfeld  *
858e709f6Ssommerfeld  * This code is derived from software contributed to The NetBSD Foundation
958e709f6Ssommerfeld  * by Bill Sommerfeld
1058e709f6Ssommerfeld  *
1158e709f6Ssommerfeld  * Redistribution and use in source and binary forms, with or without
1258e709f6Ssommerfeld  * modification, are permitted provided that the following conditions
1358e709f6Ssommerfeld  * are met:
1458e709f6Ssommerfeld  * 1. Redistributions of source code must retain the above copyright
1558e709f6Ssommerfeld  *    notice, this list of conditions and the following disclaimer.
1658e709f6Ssommerfeld  * 2. Redistributions in binary form must reproduce the above copyright
1758e709f6Ssommerfeld  *    notice, this list of conditions and the following disclaimer in the
1858e709f6Ssommerfeld  *    documentation and/or other materials provided with the distribution.
1958e709f6Ssommerfeld  *
2058e709f6Ssommerfeld  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2158e709f6Ssommerfeld  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2258e709f6Ssommerfeld  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2358e709f6Ssommerfeld  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2458e709f6Ssommerfeld  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2558e709f6Ssommerfeld  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2658e709f6Ssommerfeld  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2758e709f6Ssommerfeld  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2858e709f6Ssommerfeld  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2958e709f6Ssommerfeld  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3058e709f6Ssommerfeld  * POSSIBILITY OF SUCH DAMAGE.
3158e709f6Ssommerfeld  */
3258e709f6Ssommerfeld 
3358e709f6Ssommerfeld #define AM79C930_BUS_PCMCIA 1
3458e709f6Ssommerfeld #define AM79C930_BUS_ISAPNP 2	/* not implemented */
3558e709f6Ssommerfeld 
3658e709f6Ssommerfeld struct am79c930_softc
3758e709f6Ssommerfeld {
3858e709f6Ssommerfeld 	bus_space_tag_t sc_iot;
3958e709f6Ssommerfeld 	bus_space_handle_t sc_ioh;
4058e709f6Ssommerfeld 
4158e709f6Ssommerfeld 	bus_space_tag_t sc_memt;
4258e709f6Ssommerfeld 	bus_space_handle_t sc_memh;
4358e709f6Ssommerfeld 
4458e709f6Ssommerfeld 	struct am79c930_ops *sc_ops;
4558e709f6Ssommerfeld 
4658e709f6Ssommerfeld 	int sc_bustype;
4758e709f6Ssommerfeld };
4858e709f6Ssommerfeld 
4958e709f6Ssommerfeld struct am79c930_ops
5058e709f6Ssommerfeld {
51090e150cSonoe 	void (*write_1)(struct am79c930_softc *, u_int32_t, u_int8_t);
52090e150cSonoe 	void (*write_2)(struct am79c930_softc *, u_int32_t, u_int16_t);
53090e150cSonoe 	void (*write_4)(struct am79c930_softc *, u_int32_t, u_int32_t);
54090e150cSonoe 	void (*write_bytes)(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
5558e709f6Ssommerfeld 
56090e150cSonoe 	u_int8_t (*read_1)(struct am79c930_softc *, u_int32_t);
57090e150cSonoe 	u_int16_t (*read_2)(struct am79c930_softc *, u_int32_t);
58090e150cSonoe 	u_int32_t (*read_4)(struct am79c930_softc *, u_int32_t);
59090e150cSonoe 	void (*read_bytes)(struct am79c930_softc *, u_int32_t, u_int8_t *, size_t);
6058e709f6Ssommerfeld };
6158e709f6Ssommerfeld 
62090e150cSonoe void am79c930_chip_init(struct am79c930_softc *sc, int);
6358e709f6Ssommerfeld 
64090e150cSonoe void am79c930_gcr_setbits(struct am79c930_softc *sc, u_int8_t bits);
65090e150cSonoe void am79c930_gcr_clearbits(struct am79c930_softc *sc, u_int8_t bits);
6658e709f6Ssommerfeld 
67090e150cSonoe u_int8_t am79c930_gcr_read(struct am79c930_softc *sc);
6858e709f6Ssommerfeld 
6958e709f6Ssommerfeld #define am79c930_hard_reset(sc) am79c930_gcr_setbits(sc, AM79C930_GCR_CORESET)
7058e709f6Ssommerfeld #define am79c930_hard_reset_off(sc) am79c930_gcr_clearbits(sc, AM79C930_GCR_CORESET)
7158e709f6Ssommerfeld 
7258e709f6Ssommerfeld 
73