3 * Hacked version of linux/drivers/sound/dmasound/dmasound.h
6 * Minor numbers for the sound driver.
8 * Unfortunately Creative called the codec chip of SB as a DSP. For this
9 * reason the /dev/dsp is reserved for digitized audio use. There is a
10 * device for true DSP processors but it will be called something else.
11 * In v3.0 it's /dev/sndproc but this could be a temporary solution.
15 #include <linux/types.h>
16 #include <linux/config.h>
18 #define SND_NDEVS 256 /* Number of supported devices */
19 #define SND_DEV_CTL 0 /* Control port /dev/mixer */
20 #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
21 synthesizer and MIDI output) */
22 #define SND_DEV_MIDIN 2 /* Raw midi access */
23 #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
24 #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
25 #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
26 #define SND_DEV_STATUS 6 /* /dev/sndstat */
27 /* #7 not in use now. Was in 2.4. Free for use after v3.0. */
28 #define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
29 #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
30 #define SND_DEV_PSS SND_DEV_SNDPROC
32 /* switch on various prinks */
33 #define DEBUG_DMASOUND 1
35 #define MAX_AUDIO_DEV 5
36 #define MAX_MIXER_DEV 4
37 #define MAX_SYNTH_DEV 3
38 #define MAX_MIDI_DEV 6
39 #define MAX_TIMER_DEV 3
41 #define MAX_CATCH_RADIUS 10
43 #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
44 #define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
46 #define IOCTL_IN(arg, ret) \
47 do { int error = get_user(ret, (int *)(arg)); \
48 if (error) return error; \
50 #define IOCTL_OUT(arg, ret) ioctl_return((int *)(arg), ret)
52 static inline int ioctl_return(int *addr
, int value
)
54 return value
< 0 ? value
: put_user(value
, addr
);
63 /* description of the set-up applies to either hard or soft settings */
66 int format
; /* AFMT_* */
67 int stereo
; /* 0 = mono, 1 = stereo */
68 int size
; /* 8/16 bit*/
69 int speed
; /* speed */
80 void (*release
)(void);
81 void *(*dma_alloc
)(unsigned int, int);
82 void (*dma_free
)(void *, unsigned int);
85 void (*irqcleanup
)(void);
88 void (*silence
)(void);
89 int (*setFormat
)(int);
90 int (*setVolume
)(int);
92 int (*setTreble
)(int);
95 void (*record
)(void); /* optional */
96 void (*mixer_init
)(void); /* optional */
97 int (*mixer_ioctl
)(u_int
, u_long
); /* optional */
98 int (*write_sq_setup
)(void); /* optional */
99 int (*read_sq_setup
)(void); /* optional */
100 int (*sq_open
)(mode_t
); /* optional */
101 int (*state_info
)(char *, size_t); /* optional */
102 void (*abort_read
)(void); /* optional */
106 int hardware_afmts
; /* OSS says we only return h'ware info */
107 /* when queried via SNDCTL_DSP_GETFMTS */
108 int capabilities
; /* low-level reply to SNDCTL_DSP_GETCAPS */
109 SETTINGS default_hard
; /* open() or init() should set something valid */
110 SETTINGS default_soft
; /* you can make it look like old OSS, if you want to */
118 ssize_t (*ct_ulaw
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
119 ssize_t (*ct_alaw
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
120 ssize_t (*ct_s8
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
121 ssize_t (*ct_u8
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
122 ssize_t (*ct_s16be
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
123 ssize_t (*ct_u16be
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
124 ssize_t (*ct_s16le
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
125 ssize_t (*ct_u16le
)(const u_char
*, size_t, u_char
*, ssize_t
*, ssize_t
);
130 * Sound queue stuff, the heart of the driver
134 /* buffers allocated for this queue */
135 int numBufs
; /* real limits on what the user can have */
136 int bufSize
; /* in bytes */
139 /* current parameters */
140 int locked
; /* params cannot be modified when != 0 */
141 int user_frags
; /* user requests this many */
142 int user_frag_size
; /* of this size */
143 int max_count
; /* actual # fragments <= numBufs */
144 int block_size
; /* internal block size in bytes */
145 int max_active
; /* in-use fragments <= max_count */
147 /* it shouldn't be necessary to declare any of these volatile */
148 int front
, rear
, count
;
151 * The use of the playing field depends on the hardware
153 * Atari, PMac: The number of frames that are loaded/playing
155 * Amiga: Bit 0 is set: a frame is loaded
156 * Bit 1 is set: a frame is playing
159 wait_queue_head_t action_queue
, open_queue
, sync_queue
;
161 int busy
, syncing
, xruns
, died
;
164 #define SLEEP(queue) interruptible_sleep_on_timeout(&queue, HZ)
165 #define WAKE_UP(queue) (wake_up_interruptible(&queue))
167 #endif /* _cs4218_h_ */