channel.h (74763) | channel.h (77269) |
---|---|
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 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 <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 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 74763 2001-03-24 23:10:29Z cg $ | 26 * $FreeBSD: head/sys/dev/sound/pcm/channel.h 77269 2001-05-27 17:22:00Z cg $ |
27 */ 28 | 27 */ 28 |
29struct pcmchan_children { 30 SLIST_ENTRY(pcmchan_children) link; 31 struct pcm_channel *channel; 32}; 33 |
|
29struct pcmchan_caps { 30 u_int32_t minspeed, maxspeed; 31 u_int32_t *fmtlist; 32 u_int32_t caps; 33}; 34 35#define CHN_NAMELEN 32 36struct pcm_channel { 37 kobj_t methods; 38 | 34struct 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 41struct pcm_channel { 42 kobj_t methods; 43 |
44 pid_t pid; 45 int refcount; |
|
39 struct pcm_feeder *feeder; 40 u_int32_t align; 41 42 int volume; 43 u_int32_t speed; 44 u_int32_t format; 45 u_int32_t flags; 46 u_int32_t feederflags; 47 u_int32_t blocks; 48 49 int direction; 50 struct snd_dbuf *bufhard, *bufsoft; | 46 struct pcm_feeder *feeder; 47 u_int32_t align; 48 49 int volume; 50 u_int32_t speed; 51 u_int32_t format; 52 u_int32_t flags; 53 u_int32_t feederflags; 54 u_int32_t blocks; 55 56 int direction; 57 struct snd_dbuf *bufhard, *bufsoft; |
51 struct snddev_info *parent; | 58 struct snddev_info *parentsnddev; 59 struct pcm_channel *parentchannel; |
52 void *devinfo; 53 char name[CHN_NAMELEN]; 54 void *lock; | 60 void *devinfo; 61 char name[CHN_NAMELEN]; 62 void *lock; |
63 SLIST_HEAD(, pcmchan_children) children; |
|
55}; 56 57#include "channel_if.h" 58 59int chn_reinit(struct pcm_channel *c); 60int chn_write(struct pcm_channel *c, struct uio *buf); 61int chn_read(struct pcm_channel *c, struct uio *buf); 62u_int32_t chn_start(struct pcm_channel *c, int force); --- 18 unchanged lines hidden (view full) --- 81void chn_intr(struct pcm_channel *c); 82int chn_wrfeed(struct pcm_channel *c); 83int chn_rdfeed(struct pcm_channel *c); 84int chn_abort(struct pcm_channel *c); 85 86void chn_wrupdate(struct pcm_channel *c); 87void chn_rdupdate(struct pcm_channel *c); 88 | 64}; 65 66#include "channel_if.h" 67 68int chn_reinit(struct pcm_channel *c); 69int chn_write(struct pcm_channel *c, struct uio *buf); 70int chn_read(struct pcm_channel *c, struct uio *buf); 71u_int32_t chn_start(struct pcm_channel *c, int force); --- 18 unchanged lines hidden (view full) --- 90void chn_intr(struct pcm_channel *c); 91int chn_wrfeed(struct pcm_channel *c); 92int chn_rdfeed(struct pcm_channel *c); 93int chn_abort(struct pcm_channel *c); 94 95void chn_wrupdate(struct pcm_channel *c); 96void chn_rdupdate(struct pcm_channel *c); 97 |
98int chn_notify(struct pcm_channel *c, u_int32_t flags); 99 |
|
89#define CHN_LOCK(c) mtx_lock((struct mtx *)((c)->lock)) 90#define CHN_UNLOCK(c) mtx_unlock((struct mtx *)((c)->lock)) 91#define CHN_LOCKASSERT(c) 92 93int fmtvalid(u_int32_t fmt, u_int32_t *fmtlist); 94 | 100#define CHN_LOCK(c) mtx_lock((struct mtx *)((c)->lock)) 101#define CHN_UNLOCK(c) mtx_unlock((struct mtx *)((c)->lock)) 102#define CHN_LOCKASSERT(c) 103 104int fmtvalid(u_int32_t fmt, u_int32_t *fmtlist); 105 |
106#define PCMDIR_VIRTUAL 2 |
|
95#define PCMDIR_PLAY 1 96#define PCMDIR_REC -1 97 98#define PCMTRIG_START 1 99#define PCMTRIG_EMLDMAWR 2 100#define PCMTRIG_EMLDMARD 3 101#define PCMTRIG_STOP 0 102#define PCMTRIG_ABORT -1 --- 6 unchanged lines hidden (view full) --- 109 110#define CHN_F_BUSY 0x00001000 /* has been opened */ 111#define CHN_F_HAS_SIZE 0x00002000 /* user set block size */ 112#define CHN_F_NBIO 0x00004000 /* do non-blocking i/o */ 113#define CHN_F_MAPPED 0x00010000 /* has been mmap()ed */ 114#define CHN_F_DEAD 0x00020000 115#define CHN_F_BADSETTING 0x00040000 116 | 107#define PCMDIR_PLAY 1 108#define PCMDIR_REC -1 109 110#define PCMTRIG_START 1 111#define PCMTRIG_EMLDMAWR 2 112#define PCMTRIG_EMLDMARD 3 113#define PCMTRIG_STOP 0 114#define PCMTRIG_ABORT -1 --- 6 unchanged lines hidden (view full) --- 121 122#define CHN_F_BUSY 0x00001000 /* has been opened */ 123#define CHN_F_HAS_SIZE 0x00002000 /* user set block size */ 124#define CHN_F_NBIO 0x00004000 /* do non-blocking i/o */ 125#define CHN_F_MAPPED 0x00010000 /* has been mmap()ed */ 126#define CHN_F_DEAD 0x00020000 127#define CHN_F_BADSETTING 0x00040000 128 |
117#define CHN_F_RESET (CHN_F_BUSY | CHN_F_DEAD) | 129#define CHN_F_VIRTUAL 0x10000000 /* not backed by hardware */ |
118 | 130 |
131#define CHN_F_RESET (CHN_F_BUSY | CHN_F_DEAD | CHN_F_VIRTUAL) 132 133#define CHN_N_RATE 0x00000001 134#define CHN_N_FORMAT 0x00000002 135#define CHN_N_VOLUME 0x00000004 136#define CHN_N_BLOCKSIZE 0x00000008 137#define CHN_N_TRIGGER 0x00000010 138 |
|
119/* 120 * This should be large enough to hold all pcm data between 121 * tsleeps in chn_{read,write} at the highest sample rate. 122 * (which is usually 48kHz * 16bit * stereo = 192000 bytes/sec) 123 */ 124#define CHN_2NDBUFBLKSIZE (2 * 1024) 125/* The total number of blocks per secondary bufhard. */ 126#define CHN_2NDBUFBLKNUM (32) 127/* The size of a whole secondary bufhard. */ 128#define CHN_2NDBUFMAXSIZE (131072) 129 130#define CHN_DEFAULT_HZ 50 131 132#define CHANNEL_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) | 139/* 140 * This should be large enough to hold all pcm data between 141 * tsleeps in chn_{read,write} at the highest sample rate. 142 * (which is usually 48kHz * 16bit * stereo = 192000 bytes/sec) 143 */ 144#define CHN_2NDBUFBLKSIZE (2 * 1024) 145/* The total number of blocks per secondary bufhard. */ 146#define CHN_2NDBUFBLKNUM (32) 147/* The size of a whole secondary bufhard. */ 148#define CHN_2NDBUFMAXSIZE (131072) 149 150#define CHN_DEFAULT_HZ 50 151 152#define CHANNEL_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) |