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/chips/audio_defs.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 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1993 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        audio_defs.h,v $
   29  * Revision 2.2  93/03/18  10:37:04  mrt
   30  *      Started, from Berkeley's driver.
   31  *      [93/03/09            af]
   32  * 
   33 /*-
   34  * Copyright (c) 1991, 1992 The Regents of the University of California.
   35  * All rights reserved.
   36  *
   37  * Redistribution and use in source and binary forms, with or without
   38  * modification, are permitted provided that the following conditions
   39  * are met:
   40  * 1. Redistributions of source code must retain the above copyright
   41  *    notice, this list of conditions and the following disclaimer.
   42  * 2. Redistributions in binary form must reproduce the above copyright
   43  *    notice, this list of conditions and the following disclaimer in the
   44  *    documentation and/or other materials provided with the distribution.
   45  * 3. All advertising materials mentioning features or use of this software
   46  *    must display the following acknowledgement:
   47  *      This product includes software developed by the Computer Systems
   48  *      Engineering Group at Lawrence Berkeley Laboratory.
   49  * 4. The name of the Laboratory may not be used to endorse or promote 
   50  *    products derived from this software without specific prior written 
   51  *    permission.
   52  *
   53  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   54  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   55  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   56  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   57  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   58  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   59  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   60  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   61  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   62  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   63  * SUCH DAMAGE.
   64  *
   65  *      $Header: audio_defs.h,v 2.2 93/03/18 10:37:04 mrt Exp $ (LBL)
   66  */
   67 
   68 #define AUCB_SIZE 4096
   69 #define AUCB_MOD(k)     ((k) & (AUCB_SIZE - 1))
   70 
   71 #define AUCB_INIT(cb)   ((cb)->cb_head = (cb)->cb_tail = (cb)->cb_drops = \
   72                          (cb)->cb_pdrops = 0)
   73 
   74 #define AUCB_EMPTY(cb)  ((cb)->cb_head == (cb)->cb_tail)
   75 #define AUCB_FULL(cb)   (AUCB_MOD((cb)->cb_tail + 1) == (cb)->cb_head)
   76 #define AUCB_LEN(cb)    (AUCB_MOD((cb)->cb_tail - (cb)->cb_head))
   77 
   78 #define MAXBLKSIZE (AUCB_SIZE / 2)
   79 #define DEFBLKSIZE 128
   80 
   81 #ifndef LOCORE
   82 
   83 /*
   84  * Our own circular buffers, used if not doing DMA.
   85  * [af: with some work we could use the circbuf.c code instead]
   86  */
   87 typedef struct au_cb {
   88         int     cb_head;                /* queue head */
   89         int     cb_tail;                /* queue tail */
   90         int     cb_thresh;              /* threshold for wakeup */
   91         unsigned int    cb_waking;      /* needs wakeup at softint level */
   92         unsigned int    cb_pause;       /* io paused */
   93         unsigned int    cb_drops;       /* missed samples from over/underrun */
   94         unsigned int    cb_pdrops;      /* sun compat -- paused samples */
   95         unsigned char   cb_data[AUCB_SIZE];     /* data buffer */
   96 } au_cb_t;
   97 
   98 /*
   99  * Handle on a bi-directional stream of samples
  100  */
  101 typedef struct au_io {
  102         unsigned int    au_stamp;       /* time stamp */
  103         int     au_lowat;               /* xmit low water mark (for wakeup) */
  104         int     au_hiwat;               /* xmit high water mark (for wakeup) */
  105         int     au_blksize;             /* recv block (chunk) size */
  106         int     au_backlog;             /* # samples of xmit backlog to gen. */
  107         struct  au_cb au_rb;            /* read (recv) buffer */
  108         struct  au_cb au_wb;            /* write (xmit) buffer */
  109 } au_io_t;
  110 
  111 /*
  112  * Interface to specific chips
  113  */
  114 typedef struct {
  115         void    (*init)();
  116         void    (*close)();
  117         void    (*setport)();
  118         int     (*getport)();
  119         void    (*setgains)();
  120         void    (*getgains)();
  121         io_return_t     (*setstate)();
  122         io_return_t     (*getstate)();
  123 } audio_switch_t;
  124 
  125 /*
  126  * Callbacks into audio module, and interface to kernel
  127  */
  128 void            audio_attach( void *, audio_switch_t *, void **);
  129 boolean_t       audio_hwintr( void *, unsigned int, unsigned int *);
  130 
  131 extern io_return_t audio_open( int, int, io_req_t );
  132 extern io_return_t audio_close( int );
  133 extern io_return_t audio_read( int, io_req_t );
  134 extern io_return_t audio_write( int, io_req_t );
  135 extern io_return_t audio_get_status( int, dev_flavor_t, dev_status_t, natural_t *);
  136 extern io_return_t audio_set_status( int, dev_flavor_t, dev_status_t, natural_t);
  137 
  138 #endif

Cache object: cc3a8b61e699357244c988008e3b8726


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