^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _dmasound_h_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * linux/sound/oss/dmasound/dmasound.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Minor numbers for the sound driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Unfortunately Creative called the codec chip of SB as a DSP. For this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * reason the /dev/dsp is reserved for digitized audio use. There is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * device for true DSP processors but it will be called something else.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * In v3.0 it's /dev/sndproc but this could be a temporary solution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define _dmasound_h_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define SND_NDEVS 256 /* Number of supported devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define SND_DEV_CTL 0 /* Control port /dev/mixer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) synthesizer and MIDI output) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define SND_DEV_MIDIN 2 /* Raw midi access */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define SND_DEV_STATUS 6 /* /dev/sndstat */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* #7 not in use now. Was in 2.4. Free for use after v3.0. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define SND_DEV_PSS SND_DEV_SNDPROC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* switch on various prinks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define DEBUG_DMASOUND 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define MAX_AUDIO_DEV 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define MAX_MIXER_DEV 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define MAX_SYNTH_DEV 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define MAX_MIDI_DEV 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define MAX_TIMER_DEV 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define MAX_CATCH_RADIUS 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define IOCTL_IN(arg, ret) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) do { int error = get_user(ret, (int __user *)(arg)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) if (error) return error; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define IOCTL_OUT(arg, ret) ioctl_return((int __user *)(arg), ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) static inline int ioctl_return(int __user *addr, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return value < 0 ? value : put_user(value, addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #undef HAS_8BIT_TABLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #if defined(CONFIG_DMASOUND_ATARI) || defined(CONFIG_DMASOUND_ATARI_MODULE) ||\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) defined(CONFIG_DMASOUND_PAULA) || defined(CONFIG_DMASOUND_PAULA_MODULE) ||\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) defined(CONFIG_DMASOUND_Q40) || defined(CONFIG_DMASOUND_Q40_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define HAS_8BIT_TABLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define MIN_BUFFERS 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define MIN_BUFSIZE (1<<12) /* in bytes (- where does this come from ?) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define MIN_FRAG_SIZE 8 /* not 100% sure about this */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define MAX_BUFSIZE (1<<17) /* Limit for Amiga is 128 kb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define MAX_FRAG_SIZE 15 /* allow *4 for mono-8 => stereo-16 (for multi) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #else /* is pmac and multi is off */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define MIN_BUFFERS 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define MIN_BUFSIZE (1<<8) /* in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define MIN_FRAG_SIZE 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define MAX_BUFSIZE (1<<18) /* this is somewhat arbitrary for pmac */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define MAX_FRAG_SIZE 16 /* need to allow *4 for mono-8 => stereo-16 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define DEFAULT_N_BUFFERS 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define DEFAULT_BUFF_SIZE (1<<15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * Initialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) extern int dmasound_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #ifdef MODULE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) extern void dmasound_deinit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #define dmasound_deinit() do { } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* description of the set-up applies to either hard or soft settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) int format; /* AFMT_* */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) int stereo; /* 0 = mono, 1 = stereo */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) int size; /* 8/16 bit*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) int speed; /* speed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) } SETTINGS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * Machine definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) const char *name2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) void *(*dma_alloc)(unsigned int, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) void (*dma_free)(void *, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) int (*irqinit)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #ifdef MODULE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) void (*irqcleanup)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) void (*init)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) void (*silence)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) int (*setFormat)(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int (*setVolume)(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int (*setBass)(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int (*setTreble)(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int (*setGain)(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) void (*play)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) void (*record)(void); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) void (*mixer_init)(void); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) int (*mixer_ioctl)(u_int, u_long); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int (*write_sq_setup)(void); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) int (*read_sq_setup)(void); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) int (*sq_open)(fmode_t); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) int (*state_info)(char *, size_t); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) void (*abort_read)(void); /* optional */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) int min_dsp_speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) int max_dsp_speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int version ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) int hardware_afmts ; /* OSS says we only return h'ware info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) /* when queried via SNDCTL_DSP_GETFMTS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int capabilities ; /* low-level reply to SNDCTL_DSP_GETCAPS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) SETTINGS default_hard ; /* open() or init() should set something valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) SETTINGS default_soft ; /* you can make it look like old OSS, if you want to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) } MACHINE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * Low level stuff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) ssize_t (*ct_ulaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ssize_t (*ct_alaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) ssize_t (*ct_s8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) ssize_t (*ct_u8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) ssize_t (*ct_s16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) ssize_t (*ct_u16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ssize_t (*ct_s16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) ssize_t (*ct_u16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) } TRANS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct sound_settings {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) MACHINE mach; /* machine dependent things */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) SETTINGS hard; /* hardware settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) SETTINGS soft; /* software settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) SETTINGS dsp; /* /dev/dsp default settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) TRANS *trans_write; /* supported translations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) int volume_left; /* volume (range is machine dependent) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int volume_right;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) int bass; /* tone (range is machine dependent) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) int treble;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) int gain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) int minDev; /* minor device number currently open */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) extern struct sound_settings dmasound;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #ifdef HAS_8BIT_TABLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) extern char dmasound_ulaw2dma8[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) extern char dmasound_alaw2dma8[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * Mid level stuff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) static inline int dmasound_set_volume(int volume)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) return dmasound.mach.setVolume(volume);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static inline int dmasound_set_bass(int bass)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) return dmasound.mach.setBass ? dmasound.mach.setBass(bass) : 50;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline int dmasound_set_treble(int treble)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) return dmasound.mach.setTreble ? dmasound.mach.setTreble(treble) : 50;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static inline int dmasound_set_gain(int gain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) return dmasound.mach.setGain ? dmasound.mach.setGain(gain) : 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * Sound queue stuff, the heart of the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct sound_queue {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /* buffers allocated for this queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int numBufs; /* real limits on what the user can have */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) int bufSize; /* in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) char **buffers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) /* current parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int locked ; /* params cannot be modified when != 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) int user_frags ; /* user requests this many */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) int user_frag_size ; /* of this size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int max_count; /* actual # fragments <= numBufs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int block_size; /* internal block size in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int max_active; /* in-use fragments <= max_count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /* it shouldn't be necessary to declare any of these volatile */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) int front, rear, count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) int rear_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) * The use of the playing field depends on the hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) * Atari, PMac: The number of frames that are loaded/playing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) * Amiga: Bit 0 is set: a frame is loaded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * Bit 1 is set: a frame is playing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) int active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) wait_queue_head_t action_queue, open_queue, sync_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) int non_blocking;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) int busy, syncing, xruns, died;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #define WAKE_UP(queue) (wake_up_interruptible(&queue))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) extern struct sound_queue dmasound_write_sq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) #define write_sq dmasound_write_sq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) extern int dmasound_catchRadius;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) #define catchRadius dmasound_catchRadius
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /* define the value to be put in the byte-swap reg in mac-io
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) when we want it to swap for us.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #define BS_VAL 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #define SW_INPUT_VOLUME_SCALE 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #define SW_INPUT_VOLUME_DEFAULT (128 / SW_INPUT_VOLUME_SCALE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) extern int expand_read_bal; /* Balance factor for reading */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) extern uint software_input_volume; /* software implemented recording volume! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #endif /* _dmasound_h_ */