8a962f23f2
the original ad-audiomp branch notes: Add MP locking to the audio drivers. Making the audio drivers MP safe is necessary before efforts can be made to make the VM system MP safe. The are two locks per device instance, an ISR lock and a character device lock. The ISR lock replaces calls to splaudio()/splx(), and will be held across calls to device methods which were called at splaudio() before (e.g. trigger_output). The character device lock is held across calls to nearly all of the methods, excluding some only used for initialization, e.g. get_locks. Welcome to 5.99.57.
105 lines
2.9 KiB
C
105 lines
2.9 KiB
C
/* $NetBSD: vsvar.h,v 1.11 2011/11/23 23:07:30 jmcneill Exp $ */
|
|
|
|
/*
|
|
* Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*/
|
|
|
|
/*
|
|
* OKI MSM6258V ADPCM voice synthesizer device driver.
|
|
*/
|
|
|
|
#define VS_ADDR (0xe92000)
|
|
#define VS_DMA (3)
|
|
#define VS_DMAINTR (0x6a)
|
|
|
|
/* XXX: PPI should be defined elsewhere */
|
|
#define PPI_ADDR (0x00e9a000)
|
|
#define PPI_MAPSIZE (0x00002000)
|
|
#define PPI_PORTA 0
|
|
#define PPI_PORTB 1
|
|
#define PPI_PORTC 2
|
|
#define PPI_CTRL 3
|
|
|
|
#define VS_RATE_15K (15625)
|
|
#define VS_RATE_10K (10417)
|
|
#define VS_RATE_7K (7813)
|
|
#define VS_RATE_5K (5208)
|
|
#define VS_RATE_3K (3906)
|
|
|
|
#define VS_SRATE_1024 (0x00)
|
|
#define VS_SRATE_768 (0x04)
|
|
#define VS_SRATE_512 (0x08)
|
|
|
|
#define VS_PANOUT_LR (0x00)
|
|
#define VS_PANOUT_R (0x01)
|
|
#define VS_PANOUT_L (0x02)
|
|
#define VS_PANOUT_OFF (0x03)
|
|
|
|
#define VS_MAX_BUFSIZE (65536*4) /* XXX: enough? */
|
|
|
|
/* XXX: msm6258vreg.h */
|
|
#define MSM6258_STAT 0
|
|
#define MSM6258_DATA 1
|
|
|
|
struct vs_dma {
|
|
bus_dma_tag_t vd_dmat;
|
|
bus_dmamap_t vd_map;
|
|
void * vd_addr;
|
|
bus_dma_segment_t vd_segs[1];
|
|
int vd_nsegs;
|
|
size_t vd_size;
|
|
struct vs_dma *vd_next;
|
|
};
|
|
#define KVADDR(dma) ((void *)(dma)->vd_addr)
|
|
#define DMAADDR(dma) ((dma)->vd_map->dm_segs[0].ds_addr)
|
|
|
|
struct vs_softc {
|
|
device_t sc_dev;
|
|
kmutex_t sc_lock;
|
|
kmutex_t sc_intr_lock;
|
|
|
|
bus_space_tag_t sc_iot;
|
|
bus_space_handle_t sc_ioh;
|
|
bus_space_handle_t sc_ppi; /* XXX */
|
|
uint8_t *sc_addr;
|
|
|
|
bus_dma_tag_t sc_dmat;
|
|
struct dmac_channel_stat *sc_dma_ch;
|
|
struct vs_dma *sc_dmas;
|
|
|
|
struct {
|
|
struct dmac_dma_xfer *xfer;
|
|
int prate, rrate;
|
|
int bufsize, blksize;
|
|
int dmap;
|
|
} sc_current;
|
|
|
|
const struct audio_hw_if *sc_hw_if;
|
|
|
|
void (*sc_pintr)(void *);
|
|
void (*sc_rintr)(void *);
|
|
void *sc_parg;
|
|
void *sc_rarg;
|
|
};
|