xref: /netbsd-src/sys/arch/x68k/dev/vsvar.h (revision d710132b4b8ce7f7cccaaf660cb16aa16b4077a0)
1 /*	$NetBSD: vsvar.h,v 1.2 2001/05/03 02:09:12 minoura Exp $	*/
2 
3 /*
4  * Copyright (c) 2001 Tetsuya Isaki. 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 Tetsuya Isaki.
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,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  */
32 
33 /*
34  * OKI MSM6258V ADPCM voice synthesizer device driver.
35  */
36 
37 #define VS_ADDR		(0xe92000)
38 #define VS_DMA		(3)
39 #define VS_DMAINTR	(0x6a)
40 
41 /* XXX: PPI should be defined elsewhere */
42 #define PPI_ADDR		(0x00e9a000)
43 #define PPI_MAPSIZE		(0x00002000)
44 #define PPI_PORTA		0
45 #define PPI_PORTB		1
46 #define PPI_PORTC		2
47 #define PPI_CTRL		3
48 
49 #define VS_RATE_15K	(15625)
50 #define VS_RATE_10K	(10417)
51 #define VS_RATE_7K	 (7813)
52 #define VS_RATE_5K	 (5208)
53 #define VS_RATE_3K	 (3906)
54 
55 #define VS_SRATE_1024	(0x00)
56 #define VS_SRATE_768	(0x04)
57 #define VS_SRATE_512	(0x08)
58 
59 #define VS_PANOUT_LR	(0x00)
60 #define VS_PANOUT_R	(0x01)
61 #define VS_PANOUT_L	(0x02)
62 #define VS_PANOUT_OFF	(0x03)
63 
64 #define VS_MAX_BUFSIZE	(65536*4) /* XXX: enough? */
65 
66 /* XXX: msm6258vreg.h */
67 #define MSM6258_STAT	0
68 #define MSM6258_DATA	1
69 
70 struct vs_dma {
71 	bus_dma_tag_t		vd_dmat;
72 	bus_dmamap_t		vd_map;
73 	caddr_t			vd_addr;
74 	bus_dma_segment_t	vd_segs[1];
75 	int			vd_nsegs;
76 	size_t			vd_size;
77 	struct vs_dma		*vd_next;
78 };
79 #define KVADDR(dma)	((void *)(dma)->vd_addr)
80 #define DMAADDR(dma)	((dma)->vd_map->dm_segs[0].ds_addr)
81 
82 struct vs_softc {
83 	struct device sc_dev;
84 
85 	void *sc_codec;		/* MI restriction: must be 1st member */
86 
87 	bus_space_tag_t sc_iot;
88 	bus_space_handle_t sc_ioh;
89 	bus_space_handle_t sc_ppi; /* XXX */
90 	u_int8_t *sc_addr;
91 
92 	bus_dma_tag_t sc_dmat;
93 	struct dmac_channel_stat *sc_dma_ch;
94 	struct vs_dma *sc_dmas;
95 
96 	struct {
97 		struct dmac_dma_xfer *xfer;
98 		int prate, rrate;
99 		int bufsize, blksize;
100 		int dmap;
101 	} sc_current;
102 
103 	struct audio_hw_if *sc_hw_if;
104 
105 	void (*sc_pintr) __P((void *));
106 	void (*sc_rintr) __P((void *));
107 	void *sc_parg;
108 	void *sc_rarg;
109 };
110