xref: /netbsd/sys/arch/next68k/dev/nextdmavar.h (revision c4a72b64)
1 /*	$NetBSD: nextdmavar.h,v 1.11 2002/09/11 01:46:32 mycroft Exp $	*/
2 /*
3  * Copyright (c) 1998 Darrin B. Jewell
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *      This product includes software developed by Darrin B. Jewell
17  * 4. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 
33 struct nextdma_channel {
34 	char			*nd_name;
35 	int			nd_base;
36 	int			nd_size;
37 	u_long			nd_intr;
38 	int			(*nd_intrfunc) __P((void *));
39 };
40 
41 struct nextdma_config {
42 	/* This is called to get another map to dma */
43 	bus_dmamap_t		(*nd_continue_cb) __P((void *));
44 	/* This is called when a map has completed dma */
45 	void			(*nd_completed_cb) __P((bus_dmamap_t, void *));
46 	/* This is called when dma shuts down */
47 	void			(*nd_shutdown_cb)  __P((void *));
48 	/* callback argument */
49 	void			*nd_cb_arg;
50 };
51 
52 struct nextdma_status {
53 	bus_dmamap_t	nd_map;			/* map currently in dd_next */
54 	int		nd_idx;			/* idx of segment currently in dd_next */
55 	bus_dmamap_t	nd_map_cont;		/* map needed to continue DMA */
56 	int		nd_idx_cont;		/* segment index to continue DMA */
57 	int		nd_exception;
58 };
59 
60 struct nextdma_softc {
61 	struct device		sc_dev;
62 	struct nextdma_channel	*sc_chan;
63 	bus_space_handle_t	sc_bsh;		/* bus space handle */
64 	bus_space_tag_t		sc_bst;		/* bus space tag */
65 	bus_dma_tag_t		sc_dmat;
66 	struct nextdma_config	sc_conf;
67 	struct nextdma_status	sc_stat;
68 	struct evcnt		sc_intrcnt;
69 };
70 
71 #define nextdma_setconf(nsc, elem, val) nsc->sc_conf.nd_##elem = (val)
72 
73 /* Configure the interface & initialize private structure vars */
74 void nextdma_config	__P((struct nextdma_softc *));
75 void nextdma_init	__P((struct nextdma_softc *));
76 void nextdma_start	__P((struct nextdma_softc *, u_long));
77 
78 /* query to see if nextdma is finished */
79 int nextdma_finished	__P((struct nextdma_softc *));
80 void nextdma_reset	__P((struct nextdma_softc *));
81 
82 void nextdma_print	__P((struct nextdma_softc *));
83 
84 struct nextdma_softc *nextdma_findchannel __P((char *));
85