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/audiovar.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 /*      $NetBSD: audiovar.h,v 1.32.8.2 2006/04/19 20:59:13 tron Exp $   */
    2 
    3 /*-
    4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by TAMURA Kent
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *        This product includes software developed by the NetBSD
   21  *        Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 /*
   40  * Copyright (c) 1991-1993 Regents of the University of California.
   41  * All rights reserved.
   42  *
   43  * Redistribution and use in source and binary forms, with or without
   44  * modification, are permitted provided that the following conditions
   45  * are met:
   46  * 1. Redistributions of source code must retain the above copyright
   47  *    notice, this list of conditions and the following disclaimer.
   48  * 2. Redistributions in binary form must reproduce the above copyright
   49  *    notice, this list of conditions and the following disclaimer in the
   50  *    documentation and/or other materials provided with the distribution.
   51  * 3. All advertising materials mentioning features or use of this software
   52  *    must display the following acknowledgement:
   53  *      This product includes software developed by the Computer Systems
   54  *      Engineering Group at Lawrence Berkeley Laboratory.
   55  * 4. Neither the name of the University nor of the Laboratory may be used
   56  *    to endorse or promote products derived from this software without
   57  *    specific prior written permission.
   58  *
   59  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   60  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   61  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   62  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   63  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   64  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   65  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   66  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   67  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   68  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   69  * SUCH DAMAGE.
   70  *
   71  *      From: Header: audiovar.h,v 1.3 93/07/18 14:07:25 mccanne Exp  (LBL)
   72  */
   73 #ifndef _SYS_DEV_AUDIOVAR_H_
   74 #define _SYS_DEV_AUDIOVAR_H_
   75 #include <dev/audio_if.h>
   76 
   77 /*
   78  * Initial/default block duration is both configurable and patchable.
   79  */
   80 #ifndef AUDIO_BLK_MS
   81 #define AUDIO_BLK_MS    50      /* 50 ms */
   82 #endif
   83 
   84 #ifndef AU_RING_SIZE
   85 #define AU_RING_SIZE    65536
   86 #endif
   87 
   88 #define AUMINBUF        512
   89 #define AUMINBLK        32
   90 #define AUMINNOBLK      3
   91 struct audio_ringbuffer {
   92         audio_stream_t s;
   93         int     blksize;        /* I/O block size (bytes) */
   94         int     maxblks;        /* no of blocks in ring */
   95         int     usedlow;        /* start writer when used falls below this */
   96         int     usedhigh;       /* stop writer when used goes above this */
   97         u_long  stamp;          /* bytes transferred */
   98         u_long  stamp_last;     /* old value of bytes transferred */
   99         u_long  fstamp;         /* bytes transferred from/to the buffer near to userland */
  100         u_long  drops;          /* missed samples from over/underrun */
  101         u_long  pdrops;         /* paused samples */
  102         boolean_t pause;        /* transfer is paused */
  103         boolean_t copying;      /* data is being copied */
  104         boolean_t needfill;     /* buffer needs filling when copying is done */
  105         boolean_t mmapped;      /* device is mmap()-ed */
  106 };
  107 
  108 #define AUDIO_N_PORTS 4
  109 
  110 struct au_mixer_ports {
  111         int     index;          /* index of port-selector mixerctl */
  112         int     master;         /* index of master mixerctl */
  113         int     nports;         /* number of selectable ports */
  114         boolean_t isenum;       /* selector is enum type */
  115         u_int   allports;       /* all aumasks or'd */
  116         u_int   aumask[AUDIO_N_PORTS];  /* exposed value of "ports" */
  117         u_int   misel [AUDIO_N_PORTS];  /* ord of port, for selector */
  118         u_int   miport[AUDIO_N_PORTS];  /* index of port's mixerctl */
  119         boolean_t isdual;       /* has working mixerout */
  120         int     mixerout;       /* ord of mixerout, for dual case */
  121         int     cur_port;       /* the port that gain actually controls when
  122                                    mixerout is selected, for dual case */
  123 };
  124 
  125 /*
  126  * Software state, per audio device.
  127  */
  128 struct audio_softc {
  129         struct device   dev;
  130         void            *hw_hdl;        /* Hardware driver handle */
  131         const struct audio_hw_if *hw_if; /* Hardware interface */
  132         struct  device  *sc_dev;        /* Hardware device struct */
  133         u_char          sc_open;        /* single use device */
  134 #define AUOPEN_READ     0x01
  135 #define AUOPEN_WRITE    0x02
  136         u_char          sc_mode;        /* bitmask for RECORD/PLAY */
  137 
  138         struct  selinfo sc_wsel; /* write selector */
  139         struct  selinfo sc_rsel; /* read selector */
  140         struct  proc *sc_async_audio;   /* process who wants audio SIGIO */
  141         struct  mixer_asyncs {
  142                 struct mixer_asyncs *next;
  143                 struct proc *proc;
  144         } *sc_async_mixer;  /* processes who want mixer SIGIO */
  145 
  146         /* Sleep channels for reading and writing. */
  147         int             sc_rchan;
  148         int             sc_wchan;
  149 
  150         boolean_t       sc_blkset;      /* Blocksize has been set */
  151 
  152         uint8_t         *sc_sil_start;  /* start of silence in buffer */
  153         int             sc_sil_count;   /* # of silence bytes */
  154 
  155         boolean_t       sc_rbus;        /* input DMA in progress */
  156         boolean_t       sc_pbus;        /* output DMA in progress */
  157 
  158         /**
  159          *  userland
  160          *      |  write(2) & uiomove(9)
  161          *  sc_pstreams[0]      <sc_pparams> == sc_pustream;
  162          *      |  sc_pfilters[0]
  163          *  sc_pstreams[1]      <list_t::filters[n-1].param>
  164          *      :
  165          *  sc_pstreams[n-1]    <list_t::filters[1].param>
  166          *      |  sc_pfilters[n-1]
  167          *    sc_pr             <list_t::filters[0].param>
  168          *      |
  169          *  hardware
  170          */
  171         audio_params_t          sc_pparams;     /* play encoding parameters */
  172         audio_stream_t          *sc_pustream;   /* the first buffer */
  173         int                     sc_npfilters;   /* number of filters */
  174         audio_stream_t          sc_pstreams[AUDIO_MAX_FILTERS];
  175         stream_filter_t         *sc_pfilters[AUDIO_MAX_FILTERS];
  176         struct audio_ringbuffer sc_pr;          /* Play ring */
  177         int                     sc_writing;
  178         int                     sc_waitcomp;
  179         int                     sc_changing;
  180 
  181         /**
  182          *  hardware
  183          *      |
  184          *    sc_rr             <list_t::filters[0].param>
  185          *      |  sc_rfilters[0]
  186          *  sc_rstreams[0]      <list_t::filters[1].param>
  187          *      |  sc_rfilters[1]
  188          *  sc_rstreams[1]      <list_t::filters[2].param>
  189          *      :
  190          *      |  sc_rfilters[n-1]
  191          *  sc_rstreams[n-1]    <sc_rparams> == sc_rustream
  192          *      |  uiomove(9) & read(2)
  193          *  userland
  194          */
  195         struct audio_ringbuffer sc_rr;          /* Record ring */
  196         int                     sc_nrfilters;   /* number of filters */
  197         stream_filter_t         *sc_rfilters[AUDIO_MAX_FILTERS];
  198         audio_stream_t          sc_rstreams[AUDIO_MAX_FILTERS];
  199         audio_stream_t          *sc_rustream;   /* the last buffer */
  200         audio_params_t          sc_rparams;     /* record encoding parameters */
  201 
  202         int             sc_eof;         /* EOF, i.e. zero sized write, counter */
  203         u_long          sc_wstamp;      /* # of bytes read with read(2) */
  204         u_long          sc_playdrop;
  205 
  206         int             sc_full_duplex; /* device in full duplex mode */
  207 
  208         struct  au_mixer_ports sc_inports, sc_outports;
  209         int             sc_monitor_port;
  210 
  211         int             sc_refcnt;
  212         boolean_t       sc_dying;
  213 
  214 #ifdef AUDIO_INTR_TIME
  215         u_long  sc_pfirstintr;  /* first time we saw a play interrupt */
  216         int     sc_pnintr;      /* number of interrupts */
  217         u_long  sc_plastintr;   /* last time we saw a play interrupt */
  218         long    sc_pblktime;    /* nominal time between interrupts */
  219         u_long  sc_rfirstintr;  /* first time we saw a rec interrupt */
  220         int     sc_rnintr;      /* number of interrupts */
  221         u_long  sc_rlastintr;   /* last time we saw a rec interrupt */
  222         long    sc_rblktime;    /* nominal time between interrupts */
  223 #endif
  224 };
  225 
  226 #endif /* _SYS_DEV_AUDIOVAR_H_ */

Cache object: ae482a3d58ace1dd403c43197600173e


[ 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.