The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/isa/sbdspvar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: sbdspvar.h,v 1.19 2022/10/28 14:55:46 kn Exp $        */
    2 /*      $NetBSD: sbdspvar.h,v 1.37 1998/08/10 00:20:39 mycroft Exp $    */
    3 
    4 /*
    5  * Copyright (c) 1991-1993 Regents of the University of California.
    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. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by the Computer Systems
   19  *      Engineering Group at Lawrence Berkeley Laboratory.
   20  * 4. Neither the name of the University nor of the Laboratory may be used
   21  *    to endorse or promote products derived from this software without
   22  *    specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  */
   37 
   38 #include "midi.h"
   39 #if NMIDI > 0
   40 #include <dev/ic/mpuvar.h>
   41 #endif
   42 
   43 #include <sys/timeout.h>
   44 
   45 #define SB_MASTER_VOL   0
   46 #define SB_MIDI_VOL     1
   47 #define SB_CD_VOL       2
   48 #define SB_VOICE_VOL    3
   49 #define SB_OUTPUT_CLASS 4
   50 
   51 #define SB_MIC_VOL      5
   52 #define SB_LINE_IN_VOL  6
   53 #define SB_RECORD_SOURCE 7
   54 #define SB_TREBLE       8
   55 #define SB_BASS         9
   56 #define SB_RECORD_CLASS 10
   57 #define SB_INPUT_CLASS  11
   58 
   59 #define SB_PCSPEAKER    12
   60 #define SB_INPUT_GAIN   13
   61 #define SB_OUTPUT_GAIN  14
   62 #define SB_AGC          15
   63 #define SB_EQUALIZATION_CLASS 16
   64 
   65 #define SB_CD_IN_MUTE   17
   66 #define SB_MIC_IN_MUTE  18
   67 #define SB_LINE_IN_MUTE 19
   68 #define SB_MIDI_IN_MUTE 20
   69 
   70 #define SB_CD_SWAP      21
   71 #define SB_MIC_SWAP     22
   72 #define SB_LINE_SWAP    23
   73 #define SB_MIDI_SWAP    24
   74 
   75 #define SB_CD_OUT_MUTE  25
   76 #define SB_MIC_OUT_MUTE 26
   77 #define SB_LINE_OUT_MUTE 27
   78 
   79 #define SB_NDEVS        28
   80 
   81 #define SB_IS_IN_MUTE(x) ((x) < SB_CD_SWAP)
   82 
   83 /*
   84  * Software state, per SoundBlaster card.
   85  * The soundblaster has multiple functionality, which we must demultiplex.
   86  * One approach is to have one major device number for the soundblaster card,
   87  * and use different minor numbers to indicate which hardware function
   88  * we want.  This would make for one large driver.  Instead our approach
   89  * is to partition the design into a set of drivers that share an underlying
   90  * piece of hardware.  Most things are hard to share, for example, the audio
   91  * and midi ports.  For audio, we might want to mix two processes' signals,
   92  * and for midi we might want to merge streams (this is hard due to
   93  * running status).  Moreover, we should be able to re-use the high-level
   94  * modules with other kinds of hardware.  In this module, we only handle the
   95  * most basic communications with the sb card.
   96  */
   97 struct sbdsp_softc {
   98         struct  device sc_dev;          /* base device */
   99         struct  isadev sc_id;           /* ISA device */
  100         isa_chipset_tag_t sc_ic;
  101         bus_space_tag_t sc_iot;         /* tag */
  102         bus_space_handle_t sc_ioh;      /* handle */
  103         void    *sc_ih;                 /* interrupt vectoring */
  104         struct device *sc_isa;
  105         struct timeout sc_tmo;
  106 
  107         int     sc_iobase;              /* I/O port base address */
  108         int     sc_irq;                 /* interrupt */
  109         int     sc_ist;                 /* interrupt share type */
  110         int     sc_drq8;                /* DMA (8-bit) */
  111         int     sc_drq16;               /* DMA (16-bit) */
  112 
  113         int     sc_open;                /* reference count of open calls */
  114 #define SB_CLOSED 0
  115 #define SB_OPEN_AUDIO 1
  116 #define SB_OPEN_MIDI 2
  117         int     sc_openflags;           /* flags used on open */
  118         u_char  sc_fullduplex;          /* can do full duplex */
  119 
  120         u_char  gain[SB_NDEVS][2];      /* kept in input levels */
  121 #define SB_LEFT 0
  122 #define SB_RIGHT 1
  123 #define SB_LR 0
  124 
  125         u_int   in_mask;                /* input ports */
  126         u_int   in_port;                /* XXX needed for MI interface */
  127         u_int   in_filter;              /* one of SB_TREBLE_EQ, SB_BASS_EQ, 0 */
  128 
  129         u_int   spkr_state;             /* non-null is on */
  130 
  131         struct sbdsp_state {
  132                 u_int   rate;           /* Sample rate */
  133                 u_char  tc;             /* Time constant */
  134                 struct  sbmode *modep;
  135                 u_char  bmode;
  136                 int     dmachan;        /* DMA channel */
  137                 int     blksize;        /* Block size, preadjusted */
  138                 u_char  run;
  139 #define SB_NOTRUNNING 0         /* Not running, not initialized */
  140 #define SB_RUNNING 3            /* non-looping mode */
  141 #define SB_LOOPING 2            /* DMA&PCM running (looping mode) */
  142         } sc_i, sc_o;                   /* Input and output state */
  143 
  144         u_long  sc_interrupts;          /* number of interrupts taken */
  145 
  146         int     (*sc_intr8)(void *);    /* dma completion intr handler */
  147         void    *sc_arg8;               /* arg for sc_intr8() */
  148         int     (*sc_intr16)(void *);   /* dma completion intr handler */
  149         void    *sc_arg16;              /* arg for sc_intr16() */
  150         void    (*sc_intrp)(void *);    /* PCM output intr handler */
  151         void    *sc_argp;               /* arg for sc_intrp() */
  152         void    (*sc_intrr)(void *);    /* PCM input intr handler */
  153         void    *sc_argr;               /* arg for sc_intrr() */
  154         void    (*sc_intrm)(void *, int);/* midi input intr handler */
  155         void    *sc_argm;               /* arg for sc_intrm() */
  156 
  157         u_int   sc_mixer_model;
  158 #define SBM_NONE        0
  159 #define SBM_CT1335      1
  160 #define SBM_CT1345      2
  161 #define SBM_CT1XX5      3
  162 #define SBM_CT1745      4
  163 #define ISSBM1745(x) ((x)->sc_mixer_model >= SBM_CT1XX5)
  164 
  165         int     sc_model;               /* DSP model */
  166 #define SB_UNK  -1
  167 #define SB_1    0                       /* original SB */
  168 #define SB_20   1                       /* SB 2 */
  169 #define SB_2x   2                       /* SB 2, new version */
  170 #define SB_PRO  3                       /* SB Pro */
  171 #define SB_JAZZ 4                       /* Jazz 16 */
  172 #define SB_16   5                       /* SB 16 */
  173 #define SB_32   6                       /* SB AWE 32 */
  174 #define SB_64   7                       /* SB AWE 64 */
  175 
  176 #define SB_NAMES { "SB_1", "SB_2.0", "SB_2.x", "SB_Pro", "Jazz_16", "SB_16", "SB_AWE_32", "SB_AWE_64" }
  177 
  178         u_int   sc_version;             /* DSP version */
  179 #define SBVER_MAJOR(v)  (((v)>>8) & 0xff)
  180 #define SBVER_MINOR(v)  ((v)&0xff)
  181 
  182 #if NMIDI > 0
  183         int     sc_hasmpu;
  184         struct  mpu_softc sc_mpu_sc;    /* MPU401 Uart state */
  185 #endif
  186 };
  187 
  188 #define ISSBPRO(sc) ((sc)->sc_model == SB_PRO || (sc)->sc_model == SB_JAZZ)
  189 #define ISSBPROCLASS(sc) ((sc)->sc_model >= SB_PRO)
  190 #define ISSB16CLASS(sc) ((sc)->sc_model >= SB_16)
  191 
  192 #ifdef _KERNEL
  193 int     sbdsp_open(void *, int);
  194 void    sbdsp_close(void *);
  195 
  196 int     sbdsp_probe(struct sbdsp_softc *);
  197 void    sbdsp_attach(struct sbdsp_softc *);
  198 
  199 int     sbdsp_set_in_gain(void *, u_int, u_char);
  200 int     sbdsp_set_in_gain_real(void *, u_int, u_char);
  201 int     sbdsp_get_in_gain(void *);
  202 int     sbdsp_set_out_gain(void *, u_int, u_char);
  203 int     sbdsp_set_out_gain_real(void *, u_int, u_char);
  204 int     sbdsp_get_out_gain(void *);
  205 int     sbdsp_set_monitor_gain(void *, u_int);
  206 int     sbdsp_get_monitor_gain(void *);
  207 int     sbdsp_set_params(void *, int, int, struct audio_params *, struct audio_params *);
  208 int     sbdsp_round_blocksize(void *, int);
  209 int     sbdsp_get_avail_in_ports(void *);
  210 int     sbdsp_get_avail_out_ports(void *);
  211 int     sbdsp_speaker_ctl(void *, int);
  212 
  213 int     sbdsp_commit(void *);
  214 int     sbdsp_trigger_output(void *, void *, void *, int, void (*)(void *),
  215             void *, struct audio_params *);
  216 int     sbdsp_trigger_input(void *, void *, void *, int, void (*)(void *),
  217             void *, struct audio_params *);
  218 
  219 int     sbdsp_haltdma(void *);
  220 
  221 void    sbdsp_compress(int, u_char *, int);
  222 void    sbdsp_expand(int, u_char *, int);
  223 
  224 int     sbdsp_reset(struct sbdsp_softc *);
  225 void    sbdsp_spkron(struct sbdsp_softc *);
  226 void    sbdsp_spkroff(struct sbdsp_softc *);
  227 
  228 int     sbdsp_wdsp(struct sbdsp_softc *, int v);
  229 int     sbdsp_rdsp(struct sbdsp_softc *);
  230 
  231 int     sbdsp_intr(void *);
  232 
  233 int     sbdsp_set_sr(struct sbdsp_softc *, u_long *, int);
  234 
  235 void    sbdsp_mix_write(struct sbdsp_softc *, int, int);
  236 int     sbdsp_mix_read(struct sbdsp_softc *, int);
  237 
  238 int     sbdsp_mixer_set_port(void *, mixer_ctrl_t *);
  239 int     sbdsp_mixer_get_port(void *, mixer_ctrl_t *);
  240 int     sbdsp_mixer_query_devinfo(void *, mixer_devinfo_t *);
  241 
  242 void    *sb_malloc(void *, int, size_t, int, int);
  243 void    sb_free(void *, void *, int);
  244 size_t sb_round(void *, int, size_t);
  245 
  246 
  247 int     sbdsp_midi_open(void *, int,
  248                              void (*iintr)(void *, int),
  249                              void (*ointr)(void *), void *arg);
  250 void    sbdsp_midi_close(void *);
  251 int     sbdsp_midi_output(void *, int);
  252 void    sbdsp_midi_getinfo(void *, struct midi_info *);
  253 #endif

Cache object: 9f9b60dc58f62cdd64d3d843cfa8f593


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.