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/sound/pcm/channel.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/5.0/sys/dev/sound/pcm/channel.h 107285 2002-11-26 18:16:27Z cg $
   27  */
   28 
   29 struct pcmchan_children {
   30         SLIST_ENTRY(pcmchan_children) link;
   31         struct pcm_channel *channel;
   32 };
   33 
   34 struct pcmchan_caps {
   35         u_int32_t minspeed, maxspeed;
   36         u_int32_t *fmtlist;
   37         u_int32_t caps;
   38 };
   39 
   40 #define CHN_NAMELEN     32
   41 struct pcm_channel {
   42         kobj_t methods;
   43 
   44         int num;
   45         pid_t pid;
   46         int refcount;
   47         struct pcm_feeder *feeder;
   48         u_int32_t align;
   49 
   50         int volume;
   51         u_int32_t speed;
   52         u_int32_t format;
   53         u_int32_t flags;
   54         u_int32_t feederflags;
   55         u_int32_t blocks;
   56 
   57         int direction;
   58         unsigned int interrupts, xruns;
   59         struct snd_dbuf *bufhard, *bufsoft;
   60         struct snddev_info *parentsnddev;
   61         struct pcm_channel *parentchannel;
   62         void *devinfo;
   63         device_t dev;
   64         char name[CHN_NAMELEN];
   65         struct mtx *lock;
   66         SLIST_HEAD(, pcmchan_children) children;
   67 };
   68 
   69 #include "channel_if.h"
   70 
   71 int chn_reinit(struct pcm_channel *c);
   72 int chn_write(struct pcm_channel *c, struct uio *buf);
   73 int chn_read(struct pcm_channel *c, struct uio *buf);
   74 u_int32_t chn_start(struct pcm_channel *c, int force);
   75 int chn_sync(struct pcm_channel *c, int threshold);
   76 int chn_flush(struct pcm_channel *c);
   77 int chn_poll(struct pcm_channel *c, int ev, struct thread *td);
   78 
   79 int chn_init(struct pcm_channel *c, void *devinfo, int dir);
   80 int chn_kill(struct pcm_channel *c);
   81 int chn_setdir(struct pcm_channel *c, int dir);
   82 int chn_reset(struct pcm_channel *c, u_int32_t fmt);
   83 int chn_setvolume(struct pcm_channel *c, int left, int right);
   84 int chn_setspeed(struct pcm_channel *c, int speed);
   85 int chn_setformat(struct pcm_channel *c, u_int32_t fmt);
   86 int chn_setblocksize(struct pcm_channel *c, int blkcnt, int blksz);
   87 int chn_trigger(struct pcm_channel *c, int go);
   88 int chn_getptr(struct pcm_channel *c);
   89 struct pcmchan_caps *chn_getcaps(struct pcm_channel *c);
   90 u_int32_t chn_getformats(struct pcm_channel *c);
   91 
   92 void chn_resetbuf(struct pcm_channel *c);
   93 void chn_intr(struct pcm_channel *c);
   94 int chn_wrfeed(struct pcm_channel *c);
   95 int chn_rdfeed(struct pcm_channel *c);
   96 int chn_abort(struct pcm_channel *c);
   97 
   98 void chn_wrupdate(struct pcm_channel *c);
   99 void chn_rdupdate(struct pcm_channel *c);
  100 
  101 int chn_notify(struct pcm_channel *c, u_int32_t flags);
  102 
  103 #ifdef  USING_MUTEX
  104 #define CHN_LOCK(c) mtx_lock((struct mtx *)((c)->lock))
  105 #define CHN_UNLOCK(c) mtx_unlock((struct mtx *)((c)->lock))
  106 #define CHN_LOCKASSERT(c)
  107 #else
  108 #define CHN_LOCK(c)
  109 #define CHN_UNLOCK(c)
  110 #define CHN_LOCKASSERT(c)
  111 #endif
  112 
  113 int fmtvalid(u_int32_t fmt, u_int32_t *fmtlist);
  114 
  115 #define PCMDIR_VIRTUAL 2
  116 #define PCMDIR_PLAY 1
  117 #define PCMDIR_REC -1
  118 
  119 #define PCMTRIG_START 1
  120 #define PCMTRIG_EMLDMAWR 2
  121 #define PCMTRIG_EMLDMARD 3
  122 #define PCMTRIG_STOP 0
  123 #define PCMTRIG_ABORT -1
  124 
  125 #define CHN_F_CLOSING           0x00000004  /* a pending close */
  126 #define CHN_F_ABORTING          0x00000008  /* a pending abort */
  127 #define CHN_F_RUNNING           0x00000010  /* dma is running */
  128 #define CHN_F_TRIGGERED         0x00000020
  129 #define CHN_F_NOTRIGGER         0x00000040
  130 
  131 #define CHN_F_BUSY              0x00001000  /* has been opened  */
  132 #define CHN_F_HAS_SIZE          0x00002000  /* user set block size */
  133 #define CHN_F_NBIO              0x00004000  /* do non-blocking i/o */
  134 #define CHN_F_MAPPED            0x00010000  /* has been mmap()ed */
  135 #define CHN_F_DEAD              0x00020000
  136 #define CHN_F_BADSETTING        0x00040000
  137 
  138 #define CHN_F_VIRTUAL           0x10000000  /* not backed by hardware */
  139 
  140 #define CHN_F_RESET             (CHN_F_BUSY | CHN_F_DEAD | CHN_F_VIRTUAL)
  141 
  142 #define CHN_N_RATE              0x00000001
  143 #define CHN_N_FORMAT            0x00000002
  144 #define CHN_N_VOLUME            0x00000004
  145 #define CHN_N_BLOCKSIZE         0x00000008
  146 #define CHN_N_TRIGGER           0x00000010
  147 
  148 /*
  149  * This should be large enough to hold all pcm data between
  150  * tsleeps in chn_{read,write} at the highest sample rate.
  151  * (which is usually 48kHz * 16bit * stereo = 192000 bytes/sec)
  152  */
  153 #define CHN_2NDBUFBLKSIZE       (2 * 1024)
  154 /* The total number of blocks per secondary bufhard. */
  155 #define CHN_2NDBUFBLKNUM        (32)
  156 /* The size of a whole secondary bufhard. */
  157 #define CHN_2NDBUFMAXSIZE       (131072)
  158 
  159 #define CHANNEL_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj))

Cache object: cddb626fc7ee9699c75f1b613ef71997


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