1/*- 2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> 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 unchanged lines hidden (view full) --- 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: head/sys/dev/sound/pcm/channel.h 170161 2007-05-31 18:43:33Z ariff $ |
27 */ 28 |
29struct pcmchan_caps { 30 u_int32_t minspeed, maxspeed; 31 u_int32_t *fmtlist; 32 u_int32_t caps; 33}; 34 35/* Forward declarations */ 36struct pcm_channel; --- 25 unchanged lines hidden (view full) --- 62 struct pcmchan_syncgroup *parent; /**< group head */ 63 struct pcm_channel *ch; 64}; 65 66#define CHN_NAMELEN 32 67struct pcm_channel { 68 kobj_t methods; 69 |
70 pid_t pid; 71 int refcount; 72 struct pcm_feeder *feeder; 73 u_int32_t align; 74 75 int volume; 76 int latency; 77 u_int32_t speed; --- 5 unchanged lines hidden (view full) --- 83 int direction; 84 unsigned int interrupts, xruns, feedcount; 85 unsigned int timeout; 86 struct snd_dbuf *bufhard, *bufsoft; 87 struct snddev_info *parentsnddev; 88 struct pcm_channel *parentchannel; 89 void *devinfo; 90 device_t dev; |
91 int unit; |
92 char name[CHN_NAMELEN]; 93 struct mtx *lock; |
94 int trigger; |
95 /** 96 * Increment,decrement this around operations that temporarily yield 97 * lock. 98 */ 99 unsigned int inprog; 100 /** 101 * Special channel operations should examine @c inprog after acquiring 102 * lock. If zero, operations may continue. Else, thread should --- 11 unchanged lines hidden (view full) --- 114 /** 115 * If part of a sync group, this will point to the syncmember 116 * container. 117 */ 118 struct pcmchan_syncmember *sm; 119#ifdef OSSV4_EXPERIMENT 120 u_int16_t lpeak, rpeak; /**< Peak value from 0-32767. */ 121#endif |
122 123 struct { 124 SLIST_HEAD(, pcm_channel) head; 125 SLIST_ENTRY(pcm_channel) link; 126 struct { 127 SLIST_HEAD(, pcm_channel) head; 128 SLIST_ENTRY(pcm_channel) link; 129 } busy; 130 } children; 131 132 struct { 133 struct { 134 SLIST_ENTRY(pcm_channel) link; 135 struct { 136 SLIST_ENTRY(pcm_channel) link; 137 } busy; 138 } pcm; 139 } channels; 140 141 void *data1, *data2; |
142}; 143 |
144#define CHN_HEAD(x, y) &(x)->y.head 145#define CHN_INIT(x, y) SLIST_INIT(CHN_HEAD(x, y)) 146#define CHN_LINK(y) y.link 147#define CHN_EMPTY(x, y) SLIST_EMPTY(CHN_HEAD(x, y)) 148#define CHN_FIRST(x, y) SLIST_FIRST(CHN_HEAD(x, y)) 149 150#define CHN_FOREACH(x, y, z) \ 151 SLIST_FOREACH(x, CHN_HEAD(y, z), CHN_LINK(z)) 152 153#define CHN_FOREACH_SAFE(w, x, y, z) \ 154 SLIST_FOREACH_SAFE(w, CHN_HEAD(x, z), CHN_LINK(z), y) 155 156#define CHN_INSERT_HEAD(x, y, z) \ 157 SLIST_INSERT_HEAD(CHN_HEAD(x, z), y, CHN_LINK(z)) 158 159#define CHN_INSERT_AFTER(x, y, z) \ 160 SLIST_INSERT_AFTER(x, y, CHN_LINK(z)) 161 162#define CHN_REMOVE(x, y, z) \ 163 SLIST_REMOVE(CHN_HEAD(x, z), y, pcm_channel, CHN_LINK(z)) 164 165#define CHN_INSERT_HEAD_SAFE(x, y, z) do { \ 166 struct pcm_channel *t = NULL; \ 167 CHN_FOREACH(t, x, z) { \ 168 if (t == y) \ 169 break; \ 170 } \ 171 if (t != y) { \ 172 CHN_INSERT_HEAD(x, y, z); \ 173 } \ 174} while(0) 175 176#define CHN_INSERT_AFTER_SAFE(w, x, y, z) do { \ 177 struct pcm_channel *t = NULL; \ 178 CHN_FOREACH(t, w, z) { \ 179 if (t == y) \ 180 break; \ 181 } \ 182 if (t != y) { \ 183 CHN_INSERT_AFTER(x, y, z); \ 184 } \ 185} while(0) 186 187#define CHN_REMOVE_SAFE(x, y, z) do { \ 188 struct pcm_channel *t = NULL; \ 189 CHN_FOREACH(t, x, z) { \ 190 if (t == y) \ 191 break; \ 192 } \ 193 if (t == y) { \ 194 CHN_REMOVE(x, y, z); \ 195 } \ 196} while(0) 197 198#define CHN_UNIT(x) (snd_unit2u((x)->unit)) 199#define CHN_DEV(x) (snd_unit2d((x)->unit)) 200#define CHN_CHAN(x) (snd_unit2c((x)->unit)) 201 |
202#include "channel_if.h" 203 204int chn_reinit(struct pcm_channel *c); 205int chn_write(struct pcm_channel *c, struct uio *buf); 206int chn_read(struct pcm_channel *c, struct uio *buf); 207u_int32_t chn_start(struct pcm_channel *c, int force); 208int chn_sync(struct pcm_channel *c, int threshold); 209int chn_flush(struct pcm_channel *c); --- 66 unchanged lines hidden (view full) --- 276int afmtstr_swap_endian(char *); 277u_int32_t afmtstr2afmt(struct afmtstr_table *, const char *, int); 278u_int32_t afmt2afmtstr(struct afmtstr_table *, u_int32_t, char *, size_t, int, int); 279 280extern int chn_latency; 281extern int chn_latency_profile; 282extern int report_soft_formats; 283 |
284#define PCMDIR_PLAY 1 285#define PCMDIR_PLAY_VIRTUAL 2 286#define PCMDIR_REC -1 287#define PCMDIR_REC_VIRTUAL -2 |
288 289#define PCMTRIG_START 1 290#define PCMTRIG_EMLDMAWR 2 291#define PCMTRIG_EMLDMARD 3 292#define PCMTRIG_STOP 0 293#define PCMTRIG_ABORT -1 294 295#define CHN_F_CLOSING 0x00000004 /* a pending close */ 296#define CHN_F_ABORTING 0x00000008 /* a pending abort */ 297#define CHN_F_RUNNING 0x00000010 /* dma is running */ 298#define CHN_F_TRIGGERED 0x00000020 299#define CHN_F_NOTRIGGER 0x00000040 |
300#define CHN_F_SLEEPING 0x00000080 |
301 302#define CHN_F_BUSY 0x00001000 /* has been opened */ 303#define CHN_F_HAS_SIZE 0x00002000 /* user set block size */ 304#define CHN_F_NBIO 0x00004000 /* do non-blocking i/o */ 305#define CHN_F_MAPPED 0x00010000 /* has been mmap()ed */ 306#define CHN_F_DEAD 0x00020000 307#define CHN_F_BADSETTING 0x00040000 308#define CHN_F_SETBLOCKSIZE 0x00080000 --- 37 unchanged lines hidden --- |