Deleted Added
sdiff udiff text old ( 169319 ) new ( 170161 )
full compact
1/*-
2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
3 * Copyright by Hannu Savolainen 1995
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/sound/pcm/sound.h 170161 2007-05-31 18:43:33Z ariff $
28 */
29
30/*
31 * first, include kernel header files.
32 */
33
34#ifndef _OS_H_
35#define _OS_H_

--- 54 unchanged lines hidden (view full) ---

90struct snd_dbuf;
91struct snd_mixer;
92
93#include <dev/sound/pcm/buffer.h>
94#include <dev/sound/pcm/channel.h>
95#include <dev/sound/pcm/feeder.h>
96#include <dev/sound/pcm/mixer.h>
97#include <dev/sound/pcm/dsp.h>
98#include <dev/sound/clone.h>
99#include <dev/sound/unit.h>
100
101#define PCM_SOFTC_SIZE 512
102
103#define SND_STATUSLEN 64
104
105#define SOUND_MODVER 2
106
107#define SOUND_MINVER SOUND_MODVER
108#define SOUND_PREFVER SOUND_MODVER
109#define SOUND_MAXVER SOUND_MODVER
110
111/*
112 * We're abusing the fact that MAXMINOR still have enough room
113 * for our bit twiddling and nobody ever need 512 unique soundcards,
114 * 32 unique device types and 1024 unique cloneable devices for the
115 * next 100 years...
116 */
117
118#define PCMMAXUNIT (snd_max_u())
119#define PCMMAXDEV (snd_max_d())
120#define PCMMAXCHAN (snd_max_c())
121
122#define PCMMAXCLONE PCMMAXCHAN
123
124#define PCMUNIT(x) (snd_unit2u(dev2unit(x)))
125#define PCMDEV(x) (snd_unit2d(dev2unit(x)))
126#define PCMCHAN(x) (snd_unit2c(dev2unit(x)))
127
128/*
129 * By design, limit possible channels for each direction.
130 */
131#define SND_MAXHWCHAN 256
132#define SND_MAXVCHANS SND_MAXHWCHAN
133
134#define SD_F_SIMPLEX 0x00000001
135#define SD_F_AUTOVCHAN 0x00000002
136#define SD_F_SOFTPCMVOL 0x00000004
137#define SD_F_PSWAPLR 0x00000008
138#define SD_F_RSWAPLR 0x00000010
139#define SD_F_DYING 0x00000020
140#define SD_F_SUICIDE 0x00000040
141#define SD_F_PRIO_RD 0x10000000
142#define SD_F_PRIO_WR 0x20000000
143#define SD_F_PRIO_SET (SD_F_PRIO_RD | SD_F_PRIO_WR)
144#define SD_F_DIR_SET 0x40000000
145#define SD_F_TRANSIENT 0xf0000000
146
147/* many variables should be reduced to a range. Here define a macro */
148#define RANGE(var, low, high) (var) = \

--- 283 unchanged lines hidden (view full) ---

432#define AFMT_SIGNED (AFMT_S32_LE | AFMT_S32_BE | AFMT_S24_LE | AFMT_S24_BE | \
433 AFMT_S16_LE | AFMT_S16_BE | AFMT_S8)
434#define AFMT_BIGENDIAN (AFMT_S32_BE | AFMT_U32_BE | AFMT_S24_BE | AFMT_U24_BE | \
435 AFMT_S16_BE | AFMT_U16_BE)
436
437struct pcm_channel *fkchan_setup(device_t dev);
438int fkchan_kill(struct pcm_channel *c);
439
440/*
441 * Minor numbers for the sound driver.
442 *
443 * Unfortunately Creative called the codec chip of SB as a DSP. For this
444 * reason the /dev/dsp is reserved for digitized audio use. There is a
445 * device for true DSP processors but it will be called something else.
446 * In v3.0 it's /dev/sndproc but this could be a temporary solution.
447 */

--- 5 unchanged lines hidden (view full) ---

453#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
454#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
455#define SND_DEV_STATUS 6 /* /dev/sndstat */
456 /* #7 not in use now. */
457#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
458#define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
459#define SND_DEV_PSS SND_DEV_SNDPROC /* ? */
460#define SND_DEV_NORESET 10
461
462#define SND_DEV_DSPHW_PLAY 11 /* specific playback channel */
463#define SND_DEV_DSPHW_VPLAY 12 /* specific virtual playback channel */
464#define SND_DEV_DSPHW_REC 13 /* specific record channel */
465#define SND_DEV_DSPHW_VREC 14 /* specific virtual record channel */
466
467#define DSP_DEFAULT_SPEED 8000
468
469#define ON 1
470#define OFF 0
471
472extern int pcm_veto_load;
473extern int snd_unit;
474extern int snd_maxautovchans;

--- 10 unchanged lines hidden (view full) ---

485
486#ifndef DEB
487#define DEB(x)
488#endif
489
490SYSCTL_DECL(_hw_snd);
491
492struct pcm_channel *pcm_getfakechan(struct snddev_info *d);
493int pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction, pid_t pid, int devunit);
494int pcm_chnrelease(struct pcm_channel *c);
495int pcm_chnref(struct pcm_channel *c, int ref);
496int pcm_inprog(struct snddev_info *d, int delta);
497
498struct pcm_channel *pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, int dir, int num, void *devinfo);
499int pcm_chn_destroy(struct pcm_channel *ch);
500int pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch);
501int pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch);
502
503int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo);
504unsigned int pcm_getbuffersize(device_t dev, unsigned int minbufsz, unsigned int deflt, unsigned int maxbufsz);
505int pcm_register(device_t dev, void *devinfo, int numplay, int numrec);
506int pcm_unregister(device_t dev);

--- 10 unchanged lines hidden (view full) ---

517void snd_mtxfree(void *m);
518void snd_mtxassert(void *m);
519#define snd_mtxlock(m) mtx_lock(m)
520#define snd_mtxunlock(m) mtx_unlock(m)
521
522int sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS);
523
524typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose);
525int sndstat_acquire(struct thread *td);
526int sndstat_release(struct thread *td);
527int sndstat_register(device_t dev, char *str, sndstat_handler handler);
528int sndstat_registerfile(char *str);
529int sndstat_unregister(device_t dev);
530int sndstat_unregisterfile(char *str);
531
532#define SND_DECLARE_FILE(version) \
533 _SND_DECLARE_FILE(__LINE__, version)
534

--- 16 unchanged lines hidden (view full) ---

551#define PCM_DEBUG_MTX
552
553/*
554 * this is rather kludgey- we need to duplicate these struct def'ns from sound.c
555 * so that the macro versions of pcm_{,un}lock can dereference them.
556 * we also have to do this now makedev() has gone away.
557 */
558
559struct snddev_info {
560 struct {
561 struct {
562 SLIST_HEAD(, pcm_channel) head;
563 struct {
564 SLIST_HEAD(, pcm_channel) head;
565 } busy;
566 } pcm;
567 } channels;
568 struct snd_clone *clones;
569 struct pcm_channel *fakechan;
570 unsigned devcount, playcount, reccount, pvchancount, rvchancount ;
571 unsigned flags;
572 int inprog;
573 unsigned int bufsz;
574 void *devinfo;
575 device_t dev;
576 char status[SND_STATUSLEN];
577 struct mtx *lock;
578 struct cdev *mixer_dev;
579 uint32_t pvchanrate, pvchanformat;
580 uint32_t rvchanrate, rvchanformat;
581 struct sysctl_ctx_list play_sysctl_ctx, rec_sysctl_ctx;
582 struct sysctl_oid *play_sysctl_tree, *rec_sysctl_tree;
583};
584
585void sound_oss_sysinfo(oss_sysinfo *);
586
587#ifdef PCM_DEBUG_MTX
588#define pcm_lock(d) mtx_lock(((struct snddev_info *)(d))->lock)
589#define pcm_unlock(d) mtx_unlock(((struct snddev_info *)(d))->lock)
590#else

--- 13 unchanged lines hidden ---