1 /* $NetBSD: vsvar.h,v 1.9 2008/06/25 08:14:59 isaki 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. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 /* 31 * OKI MSM6258V ADPCM voice synthesizer device driver. 32 */ 33 34 #define VS_ADDR (0xe92000) 35 #define VS_DMA (3) 36 #define VS_DMAINTR (0x6a) 37 38 /* XXX: PPI should be defined elsewhere */ 39 #define PPI_ADDR (0x00e9a000) 40 #define PPI_MAPSIZE (0x00002000) 41 #define PPI_PORTA 0 42 #define PPI_PORTB 1 43 #define PPI_PORTC 2 44 #define PPI_CTRL 3 45 46 #define VS_RATE_15K (15625) 47 #define VS_RATE_10K (10417) 48 #define VS_RATE_7K (7813) 49 #define VS_RATE_5K (5208) 50 #define VS_RATE_3K (3906) 51 52 #define VS_SRATE_1024 (0x00) 53 #define VS_SRATE_768 (0x04) 54 #define VS_SRATE_512 (0x08) 55 56 #define VS_PANOUT_LR (0x00) 57 #define VS_PANOUT_R (0x01) 58 #define VS_PANOUT_L (0x02) 59 #define VS_PANOUT_OFF (0x03) 60 61 #define VS_MAX_BUFSIZE (65536*4) /* XXX: enough? */ 62 63 /* XXX: msm6258vreg.h */ 64 #define MSM6258_STAT 0 65 #define MSM6258_DATA 1 66 67 struct vs_dma { 68 bus_dma_tag_t vd_dmat; 69 bus_dmamap_t vd_map; 70 void * vd_addr; 71 bus_dma_segment_t vd_segs[1]; 72 int vd_nsegs; 73 size_t vd_size; 74 struct vs_dma *vd_next; 75 }; 76 #define KVADDR(dma) ((void *)(dma)->vd_addr) 77 #define DMAADDR(dma) ((dma)->vd_map->dm_segs[0].ds_addr) 78 79 struct vs_softc { 80 device_t sc_dev; 81 82 bus_space_tag_t sc_iot; 83 bus_space_handle_t sc_ioh; 84 bus_space_handle_t sc_ppi; /* XXX */ 85 uint8_t *sc_addr; 86 87 bus_dma_tag_t sc_dmat; 88 struct dmac_channel_stat *sc_dma_ch; 89 struct vs_dma *sc_dmas; 90 91 struct { 92 struct dmac_dma_xfer *xfer; 93 int prate, rrate; 94 int bufsize, blksize; 95 int dmap; 96 } sc_current; 97 98 const struct audio_hw_if *sc_hw_if; 99 100 void (*sc_pintr)(void *); 101 void (*sc_rintr)(void *); 102 void *sc_parg; 103 void *sc_rarg; 104 }; 105