173149Snyan/* $FreeBSD$ */
279697Snon/*	$NecBSD: bshwvar.h,v 1.3.14.3 2001/06/21 04:07:37 honda Exp $	*/
373149Snyan/*	$NetBSD$	*/
473149Snyan
5139749Simp/*-
673149Snyan * [NetBSD for NEC PC-98 series]
773149Snyan *  Copyright (c) 1994, 1995, 1996, 1997, 1998
873149Snyan *	NetBSD/pc98 porting staff. All rights reserved.
973149Snyan *
1073149Snyan *  Redistribution and use in source and binary forms, with or without
1173149Snyan *  modification, are permitted provided that the following conditions
1273149Snyan *  are met:
1373149Snyan *  1. Redistributions of source code must retain the above copyright
1473149Snyan *     notice, this list of conditions and the following disclaimer.
1573149Snyan *  2. Redistributions in binary form must reproduce the above copyright
1673149Snyan *     notice, this list of conditions and the following disclaimer in the
1773149Snyan *     documentation and/or other materials provided with the distribution.
1873149Snyan *  3. The name of the author may not be used to endorse or promote products
1973149Snyan *     derived from this software without specific prior written permission.
2073149Snyan *
2173149Snyan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2273149Snyan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2373149Snyan * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2473149Snyan * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
2573149Snyan * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2673149Snyan * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2773149Snyan * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2873149Snyan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2973149Snyan * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3073149Snyan * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3173149Snyan * POSSIBILITY OF SUCH DAMAGE.
3273149Snyan */
3373149Snyan#ifndef	_BSHWVAR_H_
3473149Snyan#define	_BSHWVAR_H_
3573149Snyan
3673149Snyan/*
3773149Snyan * bshwvar.h
3873149Snyan * NEC 55 compatible board specific definitions
3973149Snyan */
4073149Snyan
4173149Snyan#define	BSHW_DEFAULT_CHIPCLK	20	/* 20MHz */
4273149Snyan#define	BSHW_DEFAULT_HOSTID	7
4373149Snyan
4473149Snyanstruct bshw {
4573149Snyan#define	BSHW_SYNC_RELOAD	0x01
4673149Snyan#define	BSHW_SMFIFO		0x02
4773149Snyan#define	BSHW_DOUBLE_DMACHAN	0x04
4873149Snyan	u_int hw_flags;
4979697Snon	u_int hw_sregaddr;
5073149Snyan
5192739Salfred	int ((*hw_dma_init)(struct ct_softc *));
5292739Salfred	void ((*hw_dma_start)(struct ct_softc *));
5392739Salfred	void ((*hw_dma_stop)(struct ct_softc *));
5473149Snyan};
5573149Snyan
5673149Snyanstruct bshw_softc {
5773149Snyan	int sc_hostid;
5873149Snyan	int sc_irq;			/* irq */
5973149Snyan	int sc_drq;			/* drq */
6073149Snyan
6173149Snyan	/* dma transfer */
6273149Snyan	u_int8_t *sc_segaddr;
6373149Snyan	u_int8_t *sc_bufp;
6473149Snyan	int sc_seglen;
6579697Snon	u_int sc_sdatalen;		/* SMIT */
6679697Snon	u_int sc_edatalen;		/* SMIT */
6773149Snyan
6873149Snyan	/* private bounce */
6973149Snyan	u_int8_t *sc_bounce_phys;
7073149Snyan	u_int8_t *sc_bounce_addr;
7173149Snyan	u_int sc_bounce_size;
7273149Snyan	bus_addr_t sc_minphys;
7373149Snyan
7479697Snon	/* io control */
7579697Snon#define	BSHW_READ_INTERRUPT_DRIVEN	0x0001
7679697Snon#define	BSHW_WRITE_INTERRUPT_DRIVEN	0x0002
7779697Snon#define	BSHW_DMA_BLOCK			0x0010
7879697Snon#define	BSHW_SMIT_BLOCK			0x0020
7979697Snon	u_int sc_io_control;
8079697Snon
8173149Snyan	/* hardware */
8273149Snyan	struct bshw *sc_hw;
8392739Salfred	void ((*sc_dmasync_before))(struct ct_softc *);
8492739Salfred	void ((*sc_dmasync_after))(struct ct_softc *);
8573149Snyan};
8673149Snyan
8792739Salfredvoid bshw_synch_setup(struct ct_softc *, struct targ_info *);
8892739Salfredvoid bshw_bus_reset(struct ct_softc *);
8992739Salfredint bshw_read_settings(struct ct_bus_access_handle *, struct bshw_softc *);
9092739Salfredint bshw_smit_xfer_start(struct ct_softc *);
9192739Salfredvoid bshw_smit_xfer_stop(struct ct_softc *);
9292739Salfredint bshw_dma_xfer_start(struct ct_softc *);
9392739Salfredvoid bshw_dma_xfer_stop(struct ct_softc *);
9479697Snon
9573149Snyanextern struct dvcfg_hwsel bshw_hwsel;
9673149Snyan#endif	/* !_BSHWVAR_H_ */
97