1 /* $NetBSD: vsvar.h,v 1.11 2011/11/23 23:07:30 jmcneill 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 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28 /* 29 * OKI MSM6258V ADPCM voice synthesizer device driver. 30 */ 31 32 #define VS_ADDR (0xe92000) 33 #define VS_DMA (3) 34 #define VS_DMAINTR (0x6a) 35 36 /* XXX: PPI should be defined elsewhere */ 37 #define PPI_ADDR (0x00e9a000) 38 #define PPI_MAPSIZE (0x00002000) 39 #define PPI_PORTA 0 40 #define PPI_PORTB 1 41 #define PPI_PORTC 2 42 #define PPI_CTRL 3 43 44 #define VS_RATE_15K (15625) 45 #define VS_RATE_10K (10417) 46 #define VS_RATE_7K (7813) 47 #define VS_RATE_5K (5208) 48 #define VS_RATE_3K (3906) 49 50 #define VS_SRATE_1024 (0x00) 51 #define VS_SRATE_768 (0x04) 52 #define VS_SRATE_512 (0x08) 53 54 #define VS_PANOUT_LR (0x00) 55 #define VS_PANOUT_R (0x01) 56 #define VS_PANOUT_L (0x02) 57 #define VS_PANOUT_OFF (0x03) 58 59 #define VS_MAX_BUFSIZE (65536*4) /* XXX: enough? */ 60 61 /* XXX: msm6258vreg.h */ 62 #define MSM6258_STAT 0 63 #define MSM6258_DATA 1 64 65 struct vs_dma { 66 bus_dma_tag_t vd_dmat; 67 bus_dmamap_t vd_map; 68 void * vd_addr; 69 bus_dma_segment_t vd_segs[1]; 70 int vd_nsegs; 71 size_t vd_size; 72 struct vs_dma *vd_next; 73 }; 74 #define KVADDR(dma) ((void *)(dma)->vd_addr) 75 #define DMAADDR(dma) ((dma)->vd_map->dm_segs[0].ds_addr) 76 77 struct vs_softc { 78 device_t sc_dev; 79 kmutex_t sc_lock; 80 kmutex_t sc_intr_lock; 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