summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorariff <ariff@FreeBSD.org>2007-05-06 16:46:23 +0000
committerariff <ariff@FreeBSD.org>2007-05-06 16:46:23 +0000
commit5dbec163341730f1769c5939a5e146d429090527 (patch)
tree7f11f51ba23190cf510826667f7adcdc8d1719ac /sys/dev
parenteac02dc2370cffab46245d772fb822d3338e55c3 (diff)
downloadFreeBSD-src-5dbec163341730f1769c5939a5e146d429090527.zip
FreeBSD-src-5dbec163341730f1769c5939a5e146d429090527.tar.gz
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)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sound/pcm/sound.h44
1 files changed, 19 insertions, 25 deletions
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index af08758..e09babe 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -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
OpenPOWER on IntegriCloud