Annotation of Gnu-Mach/chips/audio_defs.h, revision 1.1.1.1

1.1       root        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  [email protected]
                     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:  * Copyright (c) 1991, 1992 The Regents of the University of California.
                     28:  * All rights reserved.
                     29:  *
                     30:  * Redistribution and use in source and binary forms, with or without
                     31:  * modification, are permitted provided that the following conditions
                     32:  * are met:
                     33:  * 1. Redistributions of source code must retain the above copyright
                     34:  *    notice, this list of conditions and the following disclaimer.
                     35:  * 2. Redistributions in binary form must reproduce the above copyright
                     36:  *    notice, this list of conditions and the following disclaimer in the
                     37:  *    documentation and/or other materials provided with the distribution.
                     38:  * 3. All advertising materials mentioning features or use of this software
                     39:  *    must display the following acknowledgement:
                     40:  *     This product includes software developed by the Computer Systems
                     41:  *     Engineering Group at Lawrence Berkeley Laboratory.
                     42:  * 4. The name of the Laboratory may not be used to endorse or promote 
                     43:  *    products derived from this software without specific prior written 
                     44:  *    permission.
                     45:  *
                     46:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     47:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     48:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     49:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     50:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     51:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     52:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     53:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     54:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     55:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     56:  * SUCH DAMAGE.
                     57:  */
                     58: 
                     59: #define AUCB_SIZE 4096
                     60: #define AUCB_MOD(k)    ((k) & (AUCB_SIZE - 1))
                     61: 
                     62: #define AUCB_INIT(cb)  ((cb)->cb_head = (cb)->cb_tail = (cb)->cb_drops = \
                     63:                         (cb)->cb_pdrops = 0)
                     64: 
                     65: #define AUCB_EMPTY(cb) ((cb)->cb_head == (cb)->cb_tail)
                     66: #define AUCB_FULL(cb)  (AUCB_MOD((cb)->cb_tail + 1) == (cb)->cb_head)
                     67: #define AUCB_LEN(cb)   (AUCB_MOD((cb)->cb_tail - (cb)->cb_head))
                     68: 
                     69: #define MAXBLKSIZE (AUCB_SIZE / 2)
                     70: #define DEFBLKSIZE 128
                     71: 
                     72: #ifndef LOCORE
                     73: 
                     74: /*
                     75:  * Our own circular buffers, used if not doing DMA.
                     76:  * [af: with some work we could use the circbuf.c code instead]
                     77:  */
                     78: typedef struct au_cb {
                     79:        int     cb_head;                /* queue head */
                     80:        int     cb_tail;                /* queue tail */
                     81:        int     cb_thresh;              /* threshold for wakeup */
                     82:        unsigned int    cb_waking;      /* needs wakeup at softint level */
                     83:        unsigned int    cb_pause;       /* io paused */
                     84:        unsigned int    cb_drops;       /* missed samples from over/underrun */
                     85:        unsigned int    cb_pdrops;      /* sun compat -- paused samples */
                     86:        unsigned char   cb_data[AUCB_SIZE];     /* data buffer */
                     87: } au_cb_t;
                     88: 
                     89: /*
                     90:  * Handle on a bi-directional stream of samples
                     91:  */
                     92: typedef struct au_io {
                     93:        unsigned int    au_stamp;       /* time stamp */
                     94:        int     au_lowat;               /* xmit low water mark (for wakeup) */
                     95:        int     au_hiwat;               /* xmit high water mark (for wakeup) */
                     96:        int     au_blksize;             /* recv block (chunk) size */
                     97:        int     au_backlog;             /* # samples of xmit backlog to gen. */
                     98:        struct  au_cb au_rb;            /* read (recv) buffer */
                     99:        struct  au_cb au_wb;            /* write (xmit) buffer */
                    100: } au_io_t;
                    101: 
                    102: /*
                    103:  * Interface to specific chips
                    104:  */
                    105: typedef struct {
                    106:        void    (*init)();
                    107:        void    (*close)();
                    108:        void    (*setport)();
                    109:        int     (*getport)();
                    110:        void    (*setgains)();
                    111:        void    (*getgains)();
                    112:        io_return_t     (*setstate)();
                    113:        io_return_t     (*getstate)();
                    114: } audio_switch_t;
                    115: 
                    116: /*
                    117:  * Callbacks into audio module, and interface to kernel
                    118:  */
                    119: void           audio_attach( void *, audio_switch_t *, void **);
                    120: boolean_t      audio_hwintr( void *, unsigned int, unsigned int *);
                    121: 
                    122: extern io_return_t audio_open( int, int, io_req_t );
                    123: extern io_return_t audio_close( int );
                    124: extern io_return_t audio_read( int, io_req_t );
                    125: extern io_return_t audio_write( int, io_req_t );
                    126: extern io_return_t audio_get_status( int, dev_flavor_t, dev_status_t, natural_t *);
                    127: extern io_return_t audio_set_status( int, dev_flavor_t, dev_status_t, natural_t);
                    128: 
                    129: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.