channel.h (170521) | channel.h (170815) |
---|---|
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 * | 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 170521 2007-06-11 00:49:46Z ariff $ | 26 * $FreeBSD: head/sys/dev/sound/pcm/channel.h 170815 2007-06-16 03:37:28Z ariff $ |
27 */ 28 29struct pcmchan_caps { 30 u_int32_t minspeed, maxspeed; 31 u_int32_t *fmtlist; 32 u_int32_t caps; 33}; 34 --- 53 unchanged lines hidden (view full) --- 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 /** | 27 */ 28 29struct pcmchan_caps { 30 u_int32_t minspeed, maxspeed; 31 u_int32_t *fmtlist; 32 u_int32_t caps; 33}; 34 --- 53 unchanged lines hidden (view full) --- 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 * For interrupt manipulations. 97 */ 98 struct cv intr_cv; 99 /** |
|
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 103 * wait on this cv for previous operation to finish. --- 90 unchanged lines hidden (view full) --- 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 | 100 * Increment,decrement this around operations that temporarily yield 101 * lock. 102 */ 103 unsigned int inprog; 104 /** 105 * Special channel operations should examine @c inprog after acquiring 106 * lock. If zero, operations may continue. Else, thread should 107 * wait on this cv for previous operation to finish. --- 90 unchanged lines hidden (view full) --- 198 CHN_REMOVE(x, y, z); \ 199 } \ 200} while(0) 201 202#define CHN_UNIT(x) (snd_unit2u((x)->unit)) 203#define CHN_DEV(x) (snd_unit2d((x)->unit)) 204#define CHN_CHAN(x) (snd_unit2c((x)->unit)) 205 |
206#define CHN_BUF_PARENT(x, y) \ 207 (((x) != NULL && (x)->parentchannel != NULL && \ 208 (x)->parentchannel->bufhard != NULL) ? \ 209 (x)->parentchannel->bufhard : (y)) 210 211#define CHN_BROADCAST(x) do { \ 212 if ((x)->cv_waiters != 0) \ 213 cv_broadcastpri(x, PRIBIO); \ 214} while(0) 215 |
|
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); --- 100 unchanged lines hidden (view full) --- 310#define CHN_F_MAPPED 0x00010000 /* has been mmap()ed */ 311#define CHN_F_DEAD 0x00020000 312#define CHN_F_BADSETTING 0x00040000 313#define CHN_F_SETBLOCKSIZE 0x00080000 314#define CHN_F_HAS_VCHAN 0x00100000 315 316#define CHN_F_VIRTUAL 0x10000000 /* not backed by hardware */ 317 | 216#include "channel_if.h" 217 218int chn_reinit(struct pcm_channel *c); 219int chn_write(struct pcm_channel *c, struct uio *buf); 220int chn_read(struct pcm_channel *c, struct uio *buf); 221u_int32_t chn_start(struct pcm_channel *c, int force); 222int chn_sync(struct pcm_channel *c, int threshold); 223int chn_flush(struct pcm_channel *c); --- 100 unchanged lines hidden (view full) --- 324#define CHN_F_MAPPED 0x00010000 /* has been mmap()ed */ 325#define CHN_F_DEAD 0x00020000 326#define CHN_F_BADSETTING 0x00040000 327#define CHN_F_SETBLOCKSIZE 0x00080000 328#define CHN_F_HAS_VCHAN 0x00100000 329 330#define CHN_F_VIRTUAL 0x10000000 /* not backed by hardware */ 331 |
318#define CHN_F_RESET (CHN_F_BUSY | CHN_F_DEAD | \ 319 CHN_F_HAS_VCHAN | CHN_F_VIRTUAL) | 332#define CHN_F_RESET (CHN_F_BUSY | CHN_F_DEAD | \ 333 CHN_F_HAS_VCHAN | CHN_F_VIRTUAL) 334 335#define CHN_F_MMAP_INVALID (CHN_F_DEAD | CHN_F_RUNNING) 336 |
320 321 322#define CHN_N_RATE 0x00000001 323#define CHN_N_FORMAT 0x00000002 324#define CHN_N_VOLUME 0x00000004 325#define CHN_N_BLOCKSIZE 0x00000008 326#define CHN_N_TRIGGER 0x00000010 327 328#define CHN_LATENCY_MIN 0 329#define CHN_LATENCY_MAX 10 330#define CHN_LATENCY_DEFAULT 5 331#define CHN_POLICY_MIN CHN_LATENCY_MIN 332#define CHN_POLICY_MAX CHN_LATENCY_MAX 333#define CHN_POLICY_DEFAULT CHN_LATENCY_DEFAULT 334 335#define CHN_LATENCY_PROFILE_MIN 0 336#define CHN_LATENCY_PROFILE_MAX 1 337#define CHN_LATENCY_PROFILE_DEFAULT CHN_LATENCY_PROFILE_MAX 338 | 337 338 339#define CHN_N_RATE 0x00000001 340#define CHN_N_FORMAT 0x00000002 341#define CHN_N_VOLUME 0x00000004 342#define CHN_N_BLOCKSIZE 0x00000008 343#define CHN_N_TRIGGER 0x00000010 344 345#define CHN_LATENCY_MIN 0 346#define CHN_LATENCY_MAX 10 347#define CHN_LATENCY_DEFAULT 5 348#define CHN_POLICY_MIN CHN_LATENCY_MIN 349#define CHN_POLICY_MAX CHN_LATENCY_MAX 350#define CHN_POLICY_DEFAULT CHN_LATENCY_DEFAULT 351 352#define CHN_LATENCY_PROFILE_MIN 0 353#define CHN_LATENCY_PROFILE_MAX 1 354#define CHN_LATENCY_PROFILE_DEFAULT CHN_LATENCY_PROFILE_MAX 355 |
356#define CHN_STARTED(c) ((c)->flags & CHN_F_TRIGGERED) 357#define CHN_STOPPED(c) (!CHN_STARTED(c)) 358#define CHN_DIRSTR(c) (((c)->direction == PCMDIR_PLAY) ? \ 359 "PCMDIR_PLAY" : "PCMDIR_REC") 360 361#define CHN_TIMEOUT 5 362#define CHN_TIMEOUT_MIN 1 363#define CHN_TIMEOUT_MAX 10 364 |
|
339/* 340 * This should be large enough to hold all pcm data between 341 * tsleeps in chn_{read,write} at the highest sample rate. 342 * (which is usually 48kHz * 16bit * stereo = 192000 bytes/sec) 343 */ 344#define CHN_2NDBUFBLKSIZE (2 * 1024) 345/* The total number of blocks per secondary bufhard. */ 346#define CHN_2NDBUFBLKNUM (32) 347/* The size of a whole secondary bufhard. */ 348#define CHN_2NDBUFMAXSIZE (131072) 349 350#define CHANNEL_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) | 365/* 366 * This should be large enough to hold all pcm data between 367 * tsleeps in chn_{read,write} at the highest sample rate. 368 * (which is usually 48kHz * 16bit * stereo = 192000 bytes/sec) 369 */ 370#define CHN_2NDBUFBLKSIZE (2 * 1024) 371/* The total number of blocks per secondary bufhard. */ 372#define CHN_2NDBUFBLKNUM (32) 373/* The size of a whole secondary bufhard. */ 374#define CHN_2NDBUFMAXSIZE (131072) 375 376#define CHANNEL_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) |