[BACK]Return to esavar.h CVS log [TXT][DIR] Up to [local] / sys / dev / pci

Annotation of sys/dev/pci/esavar.h, Revision 1.1.1.1

1.1       nbrk        1: /* $OpenBSD: esavar.h,v 1.1 2002/04/08 01:47:33 frantzen Exp $ */
                      2: /* $NetBSD: esavar.h,v 1.4 2002/03/16 14:34:01 jmcneill Exp $ */
                      3:
                      4: /*
                      5:  * Copyright (c) 2001, 2002 Jared D. McNeill <jmcneill@invisible.yi.org>
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. The name of the author may not be used to endorse or promote products
                     14:  *    derived from this software without specific prior written permission.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     17:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     18:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     19:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     20:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
                     21:  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
                     22:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
                     23:  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
                     24:  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     25:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     26:  * SUCH DAMAGE.
                     27:  */
                     28:
                     29: /*
                     30:  * ESS Allegro-1 / Maestro3 Audio Driver
                     31:  *
                     32:  * Based on the FreeBSD maestro3 driver
                     33:  *
                     34:  */
                     35:
                     36: /*
                     37:  * Number of simultaneous voices
                     38:  *
                     39:  * NOTE: The current code attaches audio0 thru audioESA_NUM_VOICES-1
                     40:  *       to this driver, and a lot of people probably don't want that.
                     41:  *       So, we'll default to 1 but we'll allow for the possibility of
                     42:  *       more.
                     43:  *
                     44:  * The current MINISRC image limits us to a maximum of 4 simultaneous voices.
                     45:  */
                     46: #ifndef ESA_NUM_VOICES
                     47: #define        ESA_NUM_VOICES          1
                     48: #endif
                     49:
                     50: #define KERNADDR(p)    ((void *)((p)->addr))
                     51: #define        DMAADDR(p)      ((p)->map->dm_segs[0].ds_addr)
                     52:
                     53: #define ESA_MINRATE    8000
                     54: #define ESA_MAXRATE    48000
                     55:
                     56: struct esa_list {
                     57:        int                     currlen;
                     58:        int                     mem_addr;
                     59:        int                     max;
                     60:        int                     indexmap[ESA_NUM_VOICES * 2];
                     61: };
                     62:
                     63: struct esa_dma {
                     64:        bus_dmamap_t            map;
                     65:        caddr_t                 addr;
                     66:        bus_dma_segment_t       segs[1];
                     67:        int                     nsegs;
                     68:        size_t                  size;
                     69:        struct esa_dma          *next;
                     70: };
                     71:
                     72: struct esa_channel {
                     73:        int                     active;
                     74:        int                     data_offset;
                     75:        int                     index;
                     76:        size_t                  bufsize;
                     77:        int                     blksize;
                     78:        int                     pos;
                     79:        void                    *buf;
                     80:        u_int32_t               start;
                     81:        u_int32_t               count;
                     82:
                     83:        /* mode settings */
                     84:        struct audio_params     mode;
                     85:
                     86:        void                    (*intr)(void *);
                     87:        void                    *arg;
                     88: };
                     89:
                     90: struct esa_voice {
                     91:        struct device           *parent;        /* pointer to our parent */
                     92:        struct esa_channel      play;
                     93:        struct esa_channel      rec;
                     94:        struct esa_dma          *dma;
                     95:        int                     inlist;
                     96:        int                     index;  /* 0: play, 1: record */
                     97: };
                     98:
                     99: struct esa_softc
                    100: {
                    101:        struct device           sc_dev;
                    102:        bus_space_tag_t         sc_iot;
                    103:        bus_space_handle_t      sc_ioh;
                    104:        bus_addr_t              sc_iob;
                    105:        bus_size_t              sc_ios;
                    106:
                    107:        pcitag_t                sc_tag;
                    108:        pci_chipset_tag_t       sc_pct;
                    109:        bus_dma_tag_t           sc_dmat;
                    110:        pcireg_t                sc_pcireg;
                    111:
                    112:        void                    *sc_ih;
                    113:
                    114:        struct ac97_codec_if    *codec_if;
                    115:        struct ac97_host_if     host_if;
                    116:        enum ac97_host_flags    codec_flags;
                    117:
                    118:        struct device           *sc_audiodev[ESA_NUM_VOICES];
                    119:
                    120:        struct esa_voice        voice[ESA_NUM_VOICES];
                    121:        struct esa_dma          *sc_dmas;
                    122:        int                     count;
                    123:
                    124:        /* timer management */
                    125:        int                     sc_ntimers;
                    126:
                    127:        /* packed list structures */
                    128:        struct esa_list         mixer_list;
                    129:        struct esa_list         adc1_list;
                    130:        struct esa_list         dma_list;
                    131:        struct esa_list         msrc_list;
                    132:
                    133:        int                     type;           /* Allegro-1 or Maestro 3? */
                    134:        int                     delay1, delay2;
                    135:
                    136:        void                    *powerhook;
                    137:        u_int16_t               *savemem;
                    138: };

CVSweb