PCMMKMINOR() bit twiddling, so we can have:

- 2048 unique sound cards (dsp0 -> dsp2047)
    (used to be 15)
  - 32 unique device types  (dspW, audio, mixer, sndstat, .. 32th)
    (used to be 15)
  -  256 unique cloneable devices (dsp%d.0 -> dsp%d.255)
    (unchanged)
This commit is contained in:
Ariff Abdullah 2007-05-06 16:46:23 +00:00
parent 1a5537409f
commit 0e86bad6e3

View File

@ -107,33 +107,27 @@ struct snd_mixer;
#define SOUND_MAXVER SOUND_MODVER
/*
PROPOSAL:
each unit needs:
status, mixer, dsp, dspW, audio, sequencer, midi-in, seq2, sndproc = 9 devices
dspW and audio are deprecated.
dsp needs min 64 channels, will give it 256
minor = (unit << 20) + (dev << 16) + channel
currently minor = (channel << 16) + (unit << 4) + dev
nomenclature:
/dev/pcmX/dsp.(0..255)
/dev/pcmX/dspW
/dev/pcmX/audio
/dev/pcmX/status
/dev/pcmX/mixer
[etc.]
*/
* We're abusing the fact that MAXMINOR still have enough room
* for our bit twiddling and nobody ever need 2048 unique soundcards,
* 32 unique device types and 256 unique cloneable devices for the
* next 100 years... or until the NextPCM.
*
* MAXMINOR 0xffff00ff
* | |
* | +--- PCMMAXCHAN
* |
* +-------- ((PCMMAXUNIT << 5) | PCMMAXDEV) << 16
*/
#define PCMMAXCHAN 0xff
#define PCMMAXDEV 0x0f
#define PCMMAXUNIT 0x0f
#define PCMMINOR(x) (minor(x))
#define PCMCHAN(x) ((PCMMINOR(x) >> 16) & PCMMAXCHAN)
#define PCMUNIT(x) ((PCMMINOR(x) >> 4) & PCMMAXUNIT)
#define PCMDEV(x) (PCMMINOR(x) & PCMMAXDEV)
#define PCMMKMINOR(u, d, c) ((((c) & PCMMAXCHAN) << 16) | \
(((u) & PCMMAXUNIT) << 4) | ((d) & PCMMAXDEV))
#define PCMMAXDEV 0x1f
#define PCMMAXUNIT 0x7ff
#define PCMMINOR(x) minor(x)
#define PCMCHAN(x) (PCMMINOR(x) & PCMMAXCHAN)
#define PCMUNIT(x) ((PCMMINOR(x) >> 21) & PCMMAXUNIT)
#define PCMDEV(x) ((PCMMINOR(x) >> 16) & PCMMAXDEV)
#define PCMMKMINOR(u, d, c) ((((u) & PCMMAXUNIT) << 21) | \
(((d) & PCMMAXDEV) << 16) | ((c) & PCMMAXCHAN))
#define SD_F_SIMPLEX 0x00000001
#define SD_F_AUTOVCHAN 0x00000002