patch-2.1.120 linux/drivers/sound/msnd_pinnacle.c
Next file: linux/drivers/sound/msnd_pinnacle.h
Previous file: linux/drivers/sound/msnd_classic.h
Back to the patch index
Back to the overall index
- Lines: 1318
- Date:
Fri Sep 4 15:32:27 1998
- Orig file:
v2.1.119/linux/drivers/sound/msnd_pinnacle.c
- Orig date:
Wed Aug 26 11:37:39 1998
diff -u --recursive --new-file v2.1.119/linux/drivers/sound/msnd_pinnacle.c linux/drivers/sound/msnd_pinnacle.c
@@ -29,7 +29,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: msnd_pinnacle.c,v 1.8 1998/08/06 21:06:14 andrewtv Exp $
+ * $Id: msnd_pinnacle.c,v 1.17 1998/09/04 18:41:27 andrewtv Exp $
*
********************************************************************/
@@ -59,11 +59,7 @@
# define LOGNAME "msnd_pinnacle"
#endif
-#define DEVNAME dev.name
-#define MIXERMINOR dev.mixer_minor
-#define DSPMINOR dev.dsp_minor
-
-multisound_dev_t dev;
+static multisound_dev_t dev;
#ifndef HAVE_DSPCODEH
static char *dspini, *permini;
@@ -76,25 +72,22 @@
LPDAQD lpDAQ;
msnd_fifo_make_empty(&dev.DAPF);
- dev.DAPQ->wHead = 0;
- dev.DAPQ->wTail = PCTODSP_OFFSET(2 * DAPQ_STRUCT_SIZE);
+ writew(0, dev.DAPQ + JQS_wHead);
+ writew(PCTODSP_OFFSET(2 * DAPQ_STRUCT_SIZE), dev.DAPQ + JQS_wTail);
dev.CurDAQD = (LPDAQD)(dev.base + 1 * DAPQ_DATA_BUFF);
outb(HPBLKSEL_0, dev.io + HP_BLKS);
memset_io(dev.base, 0, DAP_BUFF_SIZE * 3);
- for (n = 0, lpDAQ = dev.CurDAQD; n < 3; ++n, ++lpDAQ) {
-
- writew(PCTODSP_BASED((DWORD)(DAP_BUFF_SIZE * n)), &lpDAQ->wStart);
- writew(DAP_BUFF_SIZE, &lpDAQ->wSize);
- writew(1, &lpDAQ->wFormat);
- writew(dev.sample_size, &lpDAQ->wSampleSize);
- writew(dev.channels, &lpDAQ->wChannels);
- writew(dev.sample_rate, &lpDAQ->wSampleRate);
- writew(HIMT_PLAY_DONE * 0x100 + n, &lpDAQ->wIntMsg);
- writew(n + 1, &lpDAQ->wFlags);
-
+ for (n = 0, lpDAQ = dev.CurDAQD; n < 3; ++n, lpDAQ += DAQDS__size) {
+ writew(PCTODSP_BASED((DWORD)(DAP_BUFF_SIZE * n)), lpDAQ + DAQDS_wStart);
+ writew(DAP_BUFF_SIZE, lpDAQ + DAQDS_wSize);
+ writew(1, lpDAQ + DAQDS_wFormat);
+ writew(dev.sample_size, lpDAQ + DAQDS_wSampleSize);
+ writew(dev.channels, lpDAQ + DAQDS_wChannels);
+ writew(dev.sample_rate, lpDAQ + DAQDS_wSampleRate);
+ writew(HIMT_PLAY_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg);
+ writew(n + 1, lpDAQ + DAQDS_wFlags);
}
-
dev.lastbank = -1;
}
@@ -104,34 +97,62 @@
LPDAQD lpDAQ;
msnd_fifo_make_empty(&dev.DARF);
- dev.DARQ->wHead = 0;
- dev.DARQ->wTail = PCTODSP_OFFSET(2 * DARQ_STRUCT_SIZE);
+ writew(0, dev.DARQ + JQS_wHead);
+ writew(PCTODSP_OFFSET(2 * DARQ_STRUCT_SIZE), dev.DARQ + JQS_wTail);
dev.CurDARQD = (LPDAQD)(dev.base + 1 * DARQ_DATA_BUFF);
outb(HPBLKSEL_1, dev.io + HP_BLKS);
memset_io(dev.base, 0, DAR_BUFF_SIZE * 3);
outb(HPBLKSEL_0, dev.io + HP_BLKS);
- for (n = 0, lpDAQ = dev.CurDARQD; n < 3; ++n, ++lpDAQ) {
-
- writew(PCTODSP_BASED((DWORD)(DAR_BUFF_SIZE * n)) + 0x4000, &lpDAQ->wStart);
- writew(DAR_BUFF_SIZE, &lpDAQ->wSize);
- writew(1, &lpDAQ->wFormat);
- writew(dev.sample_size, &lpDAQ->wSampleSize);
- writew(dev.channels, &lpDAQ->wChannels);
- writew(dev.sample_rate, &lpDAQ->wSampleRate);
- writew(HIMT_RECORD_DONE * 0x100 + n, &lpDAQ->wIntMsg);
- writew(n + 1, &lpDAQ->wFlags);
-
+ for (n = 0, lpDAQ = dev.CurDARQD; n < 3; ++n, lpDAQ += DAQDS__size) {
+ writew(PCTODSP_BASED((DWORD)(DAR_BUFF_SIZE * n)) + 0x4000, lpDAQ + DAQDS_wStart);
+ writew(DAR_BUFF_SIZE, lpDAQ + DAQDS_wSize);
+ writew(1, lpDAQ + DAQDS_wFormat);
+ writew(dev.sample_size, lpDAQ + DAQDS_wSampleSize);
+ writew(dev.channels, lpDAQ + DAQDS_wChannels);
+ writew(dev.sample_rate, lpDAQ + DAQDS_wSampleRate);
+ writew(HIMT_RECORD_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg);
+ writew(n + 1, lpDAQ + DAQDS_wFlags);
}
}
static void reset_queues(void)
{
- dev.DSPQ->wHead = dev.DSPQ->wTail = 0;
+ writew(0, dev.DSPQ + JQS_wHead);
+ writew(0, dev.DSPQ + JQS_wTail);
reset_play_queue();
reset_record_queue();
}
+static int dsp_set_format(int val)
+{
+ int data, i;
+ LPDAQD lpDAQ, lpDARQ;
+
+ lpDAQ = (LPDAQD)(dev.base + DAPQ_DATA_BUFF);
+ lpDARQ = (LPDAQD)(dev.base + DARQ_DATA_BUFF);
+
+ switch (val) {
+ case AFMT_U8:
+ case AFMT_S16_LE:
+ data = val;
+ break;
+ default:
+ data = DEFSAMPLESIZE;
+ break;
+ }
+
+ for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) {
+
+ writew(data, lpDAQ + DAQDS_wSampleSize);
+ writew(data, lpDARQ + DAQDS_wSampleSize);
+ }
+
+ dev.sample_size = data;
+
+ return data;
+}
+
static int dsp_ioctl(unsigned int cmd, unsigned long arg)
{
int val, i, data, tmp;
@@ -154,64 +175,43 @@
case SNDCTL_DSP_SYNC:
case SNDCTL_DSP_RESET:
-
reset_play_queue();
reset_record_queue();
-
return 0;
case SNDCTL_DSP_GETBLKSIZE:
-
tmp = dev.fifosize / 4;
if (put_user(tmp, (int *)arg))
return -EFAULT;
-
- return 0;
-
- case SNDCTL_DSP_NONBLOCK:
-
- dev.mode |= O_NONBLOCK;
-
return 0;
- case SNDCTL_DSP_GETCAPS:
-
- val = DSP_CAP_DUPLEX | DSP_CAP_BATCH;
+ case SNDCTL_DSP_GETFMTS:
+ val = AFMT_S16_LE | AFMT_U8;
if (put_user(val, (int *)arg))
return -EFAULT;
-
return 0;
- case SNDCTL_DSP_SAMPLESIZE:
-
+ case SNDCTL_DSP_SETFMT:
if (get_user(val, (int *)arg))
return -EFAULT;
- switch (val) {
- case 16:
- case 8:
- data = val;
- break;
- default:
- data = DEFSAMPLESIZE;
- break;
- }
-
- for (i = 0; i < 3; ++i, ++lpDAQ, ++lpDARQ) {
+ data = (val == AFMT_QUERY) ? dev.sample_size : dsp_set_format(val);
- lpDAQ->wSampleSize = data;
- lpDARQ->wSampleSize = data;
- }
-
- dev.sample_size = data;
-
if (put_user(data, (int *)arg))
return -EFAULT;
+ return 0;
+
+ case SNDCTL_DSP_NONBLOCK:
+ dev.mode |= O_NONBLOCK;
+ return 0;
+ case SNDCTL_DSP_GETCAPS:
+ val = DSP_CAP_DUPLEX | DSP_CAP_BATCH;
+ if (put_user(val, (int *)arg))
+ return -EFAULT;
return 0;
case SNDCTL_DSP_SPEED:
-
if (get_user(val, (int *)arg))
return -EFAULT;
@@ -223,21 +223,19 @@
data = val;
- for (i = 0; i < 3; ++i, ++lpDAQ, ++lpDARQ) {
-
- lpDAQ->wSampleRate = data;
- lpDARQ->wSampleRate = data;
+ for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) {
+
+ writew(data, lpDAQ + DAQDS_wSampleRate);
+ writew(data, lpDARQ + DAQDS_wSampleRate);
}
dev.sample_rate = data;
if (put_user(data, (int *)arg))
return -EFAULT;
-
return 0;
case SNDCTL_DSP_CHANNELS:
-
if (get_user(val, (int *)arg))
return -EFAULT;
@@ -251,21 +249,19 @@
break;
}
- for (i = 0; i < 3; ++i, ++lpDAQ, ++lpDARQ) {
+ for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) {
- lpDAQ->wChannels = data;
- lpDARQ->wChannels = data;
+ writew(data, lpDAQ + DAQDS_wChannels);
+ writew(data, lpDARQ + DAQDS_wChannels);
}
dev.channels = data;
if (put_user(val, (int *)arg))
return -EFAULT;
-
return 0;
case SNDCTL_DSP_STEREO:
-
if (get_user(val, (int *)arg))
return -EFAULT;
@@ -280,17 +276,16 @@
break;
}
- for (i = 0; i < 3; ++i, ++lpDAQ, ++lpDARQ) {
+ for (i = 0; i < 3; ++i, lpDAQ += DAQDS__size, lpDARQ += DAQDS__size) {
- lpDAQ->wChannels = data;
- lpDARQ->wChannels = data;
+ writew(data, lpDAQ + DAQDS_wChannels);
+ writew(data, lpDARQ + DAQDS_wChannels);
}
dev.channels = data;
if (put_user(val, (int *)arg))
return -EFAULT;
-
return 0;
}
@@ -319,11 +314,11 @@
}
}
-#define update_vol(a,b,s) \
- writew(dev.left_levels[a] * readw(&dev.SMA->wCurrMastVolLeft) / 0xffff / s, \
- &dev.SMA->b##Left); \
- writew(dev.right_levels[a] * readw(&dev.SMA->wCurrMastVolRight) / 0xffff / s, \
- &dev.SMA->b##Right);
+#define update_vol(a,b,s) \
+ writew(dev.left_levels[a] * readw(dev.SMA + SMA_wCurrMastVolLeft) / 0xffff / s, \
+ dev.SMA + SMA_##b##Left); \
+ writew(dev.right_levels[a] * readw(dev.SMA + SMA_wCurrMastVolRight) / 0xffff / s, \
+ dev.SMA + SMA_##b##Right);
static int mixer_set(int d, int value)
{
@@ -346,30 +341,30 @@
switch (d) {
case SOUND_MIXER_VOLUME: /* master volume */
- writew(wLeft / 2, &dev.SMA->wCurrMastVolLeft);
- writew(wRight / 2, &dev.SMA->wCurrMastVolRight);
+ writew(wLeft / 2, dev.SMA + SMA_wCurrMastVolLeft);
+ writew(wRight / 2, dev.SMA + SMA_wCurrMastVolRight);
break;
/* pot controls */
case SOUND_MIXER_LINE: /* aux pot control */
- writeb(bLeft, &dev.SMA->bInPotPosLeft);
- writeb(bRight, &dev.SMA->bInPotPosRight);
+ writeb(bLeft, dev.SMA + SMA_bInPotPosLeft);
+ writeb(bRight, dev.SMA + SMA_bInPotPosRight);
if (msnd_send_word(&dev, 0, 0, HDEXAR_IN_SET_POTS) == 0)
msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ);
break;
#ifndef MSND_CLASSIC
case SOUND_MIXER_MIC: /* mic pot control */
- writeb(bLeft, &dev.SMA->bMicPotPosLeft);
- writeb(bRight, &dev.SMA->bMicPotPosRight);
+ writeb(bLeft, dev.SMA + SMA_bMicPotPosLeft);
+ writeb(bRight, dev.SMA + SMA_bMicPotPosRight);
if (msnd_send_word(&dev, 0, 0, HDEXAR_MIC_SET_POTS) == 0)
msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ);
break;
#endif
case SOUND_MIXER_LINE1: /* line pot control */
- writeb(bLeft, &dev.SMA->bAuxPotPosLeft);
- writeb(bRight, &dev.SMA->bAuxPotPosRight);
+ writeb(bLeft, dev.SMA + SMA_bAuxPotPosLeft);
+ writeb(bRight, dev.SMA + SMA_bAuxPotPosRight);
if (msnd_send_word(&dev, 0, 0, HDEXAR_AUX_SET_POTS) == 0)
msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ);
break;
@@ -407,19 +402,14 @@
#ifndef MSND_CLASSIC
if (dev.recsrc & SOUND_MASK_LINE) {
-
if (msnd_send_word(&dev, 0, 0, HDEXAR_SET_ANA_IN) == 0)
msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ);
-
}
else if (dev.recsrc & SOUND_MASK_SYNTH) {
-
if (msnd_send_word(&dev, 0, 0, HDEXAR_SET_SYNTH_IN) == 0)
msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ);
-
}
else if ((dev.recsrc & SOUND_MASK_DIGITAL1) && test_bit(F_HAVEDIGITAL, &dev.flags)) {
-
if (msnd_send_word(&dev, 0, 0, HDEXAR_SET_DAT_IN) == 0) {
udelay(50);
msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ);
@@ -457,13 +447,14 @@
set_mixer_info();
return copy_to_user((void *)arg, &info, sizeof(info));
}
- else if (cmd == OSS_GETVERSION)
- return put_user(SOUND_VERSION, (int *)arg);
+ else if (cmd == OSS_GETVERSION) {
+ int sound_version = SOUND_VERSION;
+ return put_user(sound_version, (int *)arg);
+ }
else if (((cmd >> 8) & 0xff) == 'M') {
int val = 0;
if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
-
switch (cmd & 0xff) {
case SOUND_MIXER_RECSRC:
if (get_user(val, (int *)arg))
@@ -477,9 +468,7 @@
val = mixer_set(cmd & 0xff, val);
break;
}
-
++dev.mixer_mod_count;
-
return put_user(val, (int *)arg);
}
else {
@@ -532,9 +521,9 @@
{
int minor = MINOR(inode->i_rdev);
- if (minor == DSPMINOR)
+ if (minor == dev.dsp_minor)
return dsp_ioctl(cmd, arg);
- else if (minor == MIXERMINOR)
+ else if (minor == dev.mixer_minor)
return mixer_ioctl(cmd, arg);
return -EINVAL;
@@ -597,14 +586,14 @@
int minor = MINOR(inode->i_rdev);
int err = 0;
- if (minor == DSPMINOR) {
+ if (minor == dev.dsp_minor) {
if (test_bit(F_AUDIO_INUSE, &dev.flags))
return -EBUSY;
err = dsp_open(file);
}
- else if (minor == MIXERMINOR) {
+ else if (minor == dev.mixer_minor) {
/* nothing */
} else
err = -EINVAL;
@@ -626,13 +615,13 @@
int err = 0;
#endif
- if (minor == DSPMINOR) {
+ if (minor == dev.dsp_minor) {
#ifndef LINUX20
err =
#endif
dsp_close();
}
- else if (minor == MIXERMINOR) {
+ else if (minor == dev.mixer_minor) {
/* nothing */
}
#ifndef LINUX20
@@ -770,7 +759,7 @@
int minor = MINOR(file->f_dentry->d_inode->i_rdev);
#endif
- if (minor == DSPMINOR) {
+ if (minor == dev.dsp_minor) {
return dsp_read(buf, count);
@@ -788,7 +777,7 @@
int minor = MINOR(file->f_dentry->d_inode->i_rdev);
#endif
- if (minor == DSPMINOR) {
+ if (minor == dev.dsp_minor) {
return dsp_write(buf, count);
@@ -798,32 +787,32 @@
static void eval_dsp_msg(WORD wMessage)
{
+ WORD wTmp;
+
switch (HIBYTE(wMessage)) {
case HIMT_PLAY_DONE:
-
if (dev.lastbank == LOBYTE(wMessage))
break;
dev.lastbank = LOBYTE(wMessage);
- dev.CurDAQD->wSize = DAP_BUFF_SIZE;
+ writew(DAP_BUFF_SIZE, dev.CurDAQD + DAQDS_wSize);
- if ((dev.DAPQ->wTail += PCTODSP_OFFSET(DAPQ_STRUCT_SIZE)) > dev.DAPQ->wSize)
- dev.DAPQ->wTail = 0;
+ wTmp = readw(dev.DAPQ + JQS_wTail) + PCTODSP_OFFSET(DAPQ_STRUCT_SIZE);
+ if (wTmp > readw(dev.DAPQ + JQS_wSize))
+ writew(0, dev.DAPQ + JQS_wTail);
+ else
+ writew(wTmp, dev.DAPQ + JQS_wTail);
- if (++dev.CurDAQD > (LPDAQD)(dev.base + DAPQ_DATA_BUFF + 2 * DAPQ_STRUCT_SIZE))
+ if ((dev.CurDAQD += DAQDS__size) > (LPDAQD)(dev.base + DAPQ_DATA_BUFF + 2 * DAPQ_STRUCT_SIZE))
dev.CurDAQD = (LPDAQD)(dev.base + DAPQ_DATA_BUFF);
if (dev.lastbank < 3) {
-
if (DAPF_to_bank(dev.lastbank) > 0) {
-
mdelay(1);
msnd_send_dsp_cmd(&dev, HDEX_PLAY_START);
-
}
else if (!test_bit(F_WRITEBLOCK, &dev.flags)) {
-
clear_bit(F_WRITING, &dev.flags);
#ifdef LINUX20
if (test_bit(F_WRITEFLUSH, &dev.flags)) {
@@ -834,44 +823,33 @@
if (test_and_clear_bit(F_WRITEFLUSH, &dev.flags))
wake_up_interruptible(&dev.writeflush);
#endif
- msnd_disable_irq(&dev);
-
}
}
if (test_bit(F_WRITEBLOCK, &dev.flags))
wake_up_interruptible(&dev.writeblock);
-
break;
- case HIMT_RECORD_DONE: {
-
- WORD wTemp;
-
- wTemp = dev.DARQ->wTail + (DARQ_STRUCT_SIZE / 2);
+ case HIMT_RECORD_DONE:
+ wTmp = readw(dev.DARQ + JQS_wTail) + DARQ_STRUCT_SIZE / 2;
- if (wTemp > dev.DARQ->wSize)
- wTemp = 0;
+ if (wTmp > readw(dev.DARQ + JQS_wSize))
+ wTmp = 0;
- while (wTemp == dev.DARQ->wHead);
+ while (wTmp == readw(dev.DARQ + JQS_wHead));
- dev.DARQ->wTail = wTemp;
+ writew(wTmp, dev.DARQ + JQS_wTail);
outb(HPBLKSEL_1, dev.io + HP_BLKS);
- if (bank_to_DARF(LOBYTE(wMessage)) == 0 &&
- !test_bit(F_READBLOCK, &dev.flags)) {
-
+ if (bank_to_DARF(LOBYTE(wMessage)) == 0 && !test_bit(F_READBLOCK, &dev.flags)) {
memset_io(dev.base, 0, DAR_BUFF_SIZE * 3);
clear_bit(F_READING, &dev.flags);
- msnd_disable_irq(&dev);
-
}
outb(HPBLKSEL_0, dev.io + HP_BLKS);
if (test_bit(F_READBLOCK, &dev.flags))
wake_up_interruptible(&dev.readblock);
-
- } break;
+ break;
case HIMT_DSP:
switch (LOBYTE(wMessage)) {
@@ -879,12 +857,12 @@
case HIDSP_PLAY_UNDER:
#endif
case HIDSP_INT_PLAY_UNDER:
- printk(KERN_INFO LOGNAME ": Write underflow\n");
+/* printk(KERN_INFO LOGNAME ": Write underflow\n"); */
reset_play_queue();
break;
case HIDSP_INT_RECORD_OVER:
- printk(KERN_INFO LOGNAME ": Read overflow\n");
+/* printk(KERN_INFO LOGNAME ": Read overflow\n"); */
reset_record_queue();
break;
@@ -921,12 +899,16 @@
inb(dev.io + HP_RXL);
- while (dev.DSPQ->wTail != dev.DSPQ->wHead) {
-
- eval_dsp_msg(*(dev.pwDSPQData + dev.DSPQ->wHead));
+ while (readw(dev.DSPQ + JQS_wTail) != readw(dev.DSPQ + JQS_wHead)) {
+ WORD wTmp;
- if (++dev.DSPQ->wHead > dev.DSPQ->wSize)
- dev.DSPQ->wHead = 0;
+ eval_dsp_msg(*(dev.pwDSPQData + readw(dev.DSPQ + JQS_wHead)));
+
+ wTmp = readw(dev.DSPQ + JQS_wHead) + 1;
+ if (wTmp > readw(dev.DSPQ + JQS_wSize))
+ writew(0, dev.DSPQ + JQS_wHead);
+ else
+ writew(wTmp, dev.DSPQ + JQS_wHead);
}
if (test_bit(F_BANKONE, &dev.flags))
@@ -944,13 +926,17 @@
dev_ioctl,
NULL,
dev_open,
- NULL, /* flush */
+#ifndef LINUX20
+# if LINUX_VERSION_CODE >= 0x020100 + 118
+ NULL,
+# endif /* >= 2.1.118 */
+#endif
dev_close,
};
__initfunc(static int reset_dsp(void))
{
- int timeout = 20000;
+ int timeout = 100;
outb(HPDSPRESET_ON, dev.io + HP_DSPR);
@@ -984,7 +970,6 @@
#endif
if (check_region(dev.io, dev.numio)) {
-
printk(KERN_ERR LOGNAME ": I/O port conflict\n");
return -ENODEV;
}
@@ -992,7 +977,6 @@
request_region(dev.io, dev.numio, "probing");
if (reset_dsp() < 0) {
-
release_region(dev.io, dev.numio);
return -ENODEV;
}
@@ -1056,13 +1040,12 @@
outb(HPBLKSEL_0, dev.io + HP_BLKS);
- dev.DAPQ = (struct JobQueueStruct *)(dev.base + DAPQ_OFFSET);
- dev.DARQ = (struct JobQueueStruct *)(dev.base + DARQ_OFFSET);
- dev.MODQ = (struct JobQueueStruct *)(dev.base + MODQ_OFFSET);
- dev.MIDQ = (struct JobQueueStruct *)(dev.base + MIDQ_OFFSET);
- dev.DSPQ = (struct JobQueueStruct *)(dev.base + DSPQ_OFFSET);
-
- dev.SMA = (struct SMA0_CommonData *)(dev.base + SMA_STRUCT_START);
+ dev.DAPQ = (BYTE *)(dev.base + DAPQ_OFFSET);
+ dev.DARQ = (BYTE *)(dev.base + DARQ_OFFSET);
+ dev.MODQ = (BYTE *)(dev.base + MODQ_OFFSET);
+ dev.MIDQ = (BYTE *)(dev.base + MIDQ_OFFSET);
+ dev.DSPQ = (BYTE *)(dev.base + DSPQ_OFFSET);
+ dev.SMA = (BYTE *)(dev.base + SMA_STRUCT_START);
dev.CurDAQD = (LPDAQD)(dev.base + DAPQ_DATA_BUFF);
dev.CurDARQD = (LPDAQD)(dev.base + DARQ_DATA_BUFF);
@@ -1071,28 +1054,28 @@
dev.sample_rate = DEFSAMPLERATE;
dev.channels = DEFCHANNELS;
- for (n = 0, lpDAQ = dev.CurDAQD; n < 3; ++n, ++lpDAQ) {
+ for (n = 0, lpDAQ = dev.CurDAQD; n < 3; ++n, lpDAQ += DAQDS__size) {
- writew(PCTODSP_BASED((DWORD)(DAP_BUFF_SIZE * n)), &lpDAQ->wStart);
- writew(DAP_BUFF_SIZE, &lpDAQ->wSize);
- writew(1, &lpDAQ->wFormat);
- writew(dev.sample_size, &lpDAQ->wSampleSize);
- writew(dev.channels, &lpDAQ->wChannels);
- writew(dev.sample_rate, &lpDAQ->wSampleRate);
- writew(HIMT_PLAY_DONE * 0x100 + n, &lpDAQ->wIntMsg);
- writew(n + 1, &lpDAQ->wFlags);
- }
-
- for (n = 0, lpDAQ = dev.CurDARQD; n < 3; ++n, ++lpDAQ) {
-
- writew(PCTODSP_BASED((DWORD)(DAR_BUFF_SIZE * n)) + 0x4000, &lpDAQ->wStart);
- writew(DAR_BUFF_SIZE, &lpDAQ->wSize);
- writew(1, &lpDAQ->wFormat);
- writew(dev.sample_size, &lpDAQ->wSampleSize);
- writew(dev.channels, &lpDAQ->wChannels);
- writew(dev.sample_rate, &lpDAQ->wSampleRate);
- writew(HIMT_RECORD_DONE * 0x100 + n, &lpDAQ->wIntMsg);
- writew(n + 1, &lpDAQ->wFlags);
+ writew(PCTODSP_BASED((DWORD)(DAP_BUFF_SIZE * n)), lpDAQ + DAQDS_wStart);
+ writew(DAP_BUFF_SIZE, lpDAQ + DAQDS_wSize);
+ writew(1, lpDAQ + DAQDS_wFormat);
+ writew(dev.sample_size, lpDAQ + DAQDS_wSampleSize);
+ writew(dev.channels, lpDAQ + DAQDS_wChannels);
+ writew(dev.sample_rate, lpDAQ + DAQDS_wSampleRate);
+ writew(HIMT_PLAY_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg);
+ writew(n + 1, lpDAQ + DAQDS_wFlags);
+ }
+
+ for (n = 0, lpDAQ = dev.CurDARQD; n < 3; ++n, lpDAQ += DAQDS__size) {
+
+ writew(PCTODSP_BASED((DWORD)(DAR_BUFF_SIZE * n)) + 0x4000, lpDAQ + DAQDS_wStart);
+ writew(DAR_BUFF_SIZE, lpDAQ + DAQDS_wSize);
+ writew(1, lpDAQ + DAQDS_wFormat);
+ writew(dev.sample_size, lpDAQ + DAQDS_wSampleSize);
+ writew(dev.channels, lpDAQ + DAQDS_wChannels);
+ writew(dev.sample_rate, lpDAQ + DAQDS_wSampleRate);
+ writew(HIMT_RECORD_DONE * 0x100 + n, lpDAQ + DAQDS_wIntMsg);
+ writew(n + 1, lpDAQ + DAQDS_wFlags);
}
@@ -1100,68 +1083,68 @@
dev.pwMODQData = (WORD *)(dev.base + MODQ_DATA_BUFF);
dev.pwMIDQData = (WORD *)(dev.base + MIDQ_DATA_BUFF);
- writew(PCTODSP_BASED(MIDQ_DATA_BUFF), &dev.MIDQ->wStart);
- writew(PCTODSP_OFFSET(MIDQ_BUFF_SIZE) - 1, &dev.MIDQ->wSize);
- writew(0, &dev.MIDQ->wHead);
- writew(0, &dev.MIDQ->wTail);
-
- writew(PCTODSP_BASED(MODQ_DATA_BUFF), &dev.MODQ->wStart);
- writew(PCTODSP_OFFSET(MODQ_BUFF_SIZE) - 1, &dev.MODQ->wSize);
- writew(0, &dev.MODQ->wHead);
- writew(0, &dev.MODQ->wTail);
-
- writew(PCTODSP_BASED(DAPQ_DATA_BUFF), &dev.DAPQ->wStart);
- writew(PCTODSP_OFFSET(DAPQ_BUFF_SIZE) - 1, &dev.DAPQ->wSize);
- writew(0, &dev.DAPQ->wHead);
- writew(0, &dev.DAPQ->wTail);
-
- writew(PCTODSP_BASED(DARQ_DATA_BUFF), &dev.DARQ->wStart);
- writew(PCTODSP_OFFSET(DARQ_BUFF_SIZE) - 1, &dev.DARQ->wSize);
- writew(0, &dev.DARQ->wHead);
- writew(0, &dev.DARQ->wTail);
-
- writew(PCTODSP_BASED(DSPQ_DATA_BUFF), &dev.DSPQ->wStart);
- writew(PCTODSP_OFFSET(DSPQ_BUFF_SIZE) - 1, &dev.DSPQ->wSize);
- writew(0, &dev.DSPQ->wHead);
- writew(0, &dev.DSPQ->wTail);
-
- writew(0, &dev.SMA->wCurrPlayBytes);
- writew(0, &dev.SMA->wCurrRecordBytes);
+ writew(PCTODSP_BASED(MIDQ_DATA_BUFF), dev.MIDQ + JQS_wStart);
+ writew(PCTODSP_OFFSET(MIDQ_BUFF_SIZE) - 1, dev.MIDQ + JQS_wSize);
+ writew(0, dev.MIDQ + JQS_wHead);
+ writew(0, dev.MIDQ + JQS_wTail);
+
+ writew(PCTODSP_BASED(MODQ_DATA_BUFF), dev.MODQ + JQS_wStart);
+ writew(PCTODSP_OFFSET(MODQ_BUFF_SIZE) - 1, dev.MODQ + JQS_wSize);
+ writew(0, dev.MODQ + JQS_wHead);
+ writew(0, dev.MODQ + JQS_wTail);
+
+ writew(PCTODSP_BASED(DAPQ_DATA_BUFF), dev.DAPQ + JQS_wStart);
+ writew(PCTODSP_OFFSET(DAPQ_BUFF_SIZE) - 1, dev.DAPQ + JQS_wSize);
+ writew(0, dev.DAPQ + JQS_wHead);
+ writew(0, dev.DAPQ + JQS_wTail);
+
+ writew(PCTODSP_BASED(DARQ_DATA_BUFF), dev.DARQ + JQS_wStart);
+ writew(PCTODSP_OFFSET(DARQ_BUFF_SIZE) - 1, dev.DARQ + JQS_wSize);
+ writew(0, dev.DARQ + JQS_wHead);
+ writew(0, dev.DARQ + JQS_wTail);
+
+ writew(PCTODSP_BASED(DSPQ_DATA_BUFF), dev.DSPQ + JQS_wStart);
+ writew(PCTODSP_OFFSET(DSPQ_BUFF_SIZE) - 1, dev.DSPQ + JQS_wSize);
+ writew(0, dev.DSPQ + JQS_wHead);
+ writew(0, dev.DSPQ + JQS_wTail);
+
+ writew(0, dev.SMA + SMA_wCurrPlayBytes);
+ writew(0, dev.SMA + SMA_wCurrRecordBytes);
- writew(0, &dev.SMA->wCurrPlayVolLeft);
- writew(0, &dev.SMA->wCurrPlayVolRight);
+ writew(0, dev.SMA + SMA_wCurrPlayVolLeft);
+ writew(0, dev.SMA + SMA_wCurrPlayVolRight);
- writew(0, &dev.SMA->wCurrInVolLeft);
- writew(0, &dev.SMA->wCurrInVolRight);
+ writew(0, dev.SMA + SMA_wCurrInVolLeft);
+ writew(0, dev.SMA + SMA_wCurrInVolRight);
- writew(0, &dev.SMA->wCurrMastVolLeft);
- writew(0, &dev.SMA->wCurrMastVolRight);
+ writew(0, dev.SMA + SMA_wCurrMastVolLeft);
+ writew(0, dev.SMA + SMA_wCurrMastVolRight);
#ifndef MSND_CLASSIC
- writel(0x00010000, &dev.SMA->dwCurrPlayPitch);
- writel(0x00000001, &dev.SMA->dwCurrPlayRate);
+ writel(0x00010000, dev.SMA + SMA_dwCurrPlayPitch);
+ writel(0x00000001, dev.SMA + SMA_dwCurrPlayRate);
#endif
- writew(0x0000, &dev.SMA->wCurrDSPStatusFlags);
- writew(0x0000, &dev.SMA->wCurrHostStatusFlags);
+ writew(0x0000, dev.SMA + SMA_wCurrDSPStatusFlags);
+ writew(0x0000, dev.SMA + SMA_wCurrHostStatusFlags);
- writew(0x303, &dev.SMA->wCurrInputTagBits);
- writew(0, &dev.SMA->wCurrLeftPeak);
- writew(0, &dev.SMA->wCurrRightPeak);
+ writew(0x303, dev.SMA + SMA_wCurrInputTagBits);
+ writew(0, dev.SMA + SMA_wCurrLeftPeak);
+ writew(0, dev.SMA + SMA_wCurrRightPeak);
- writeb(0, &dev.SMA->bInPotPosRight);
- writeb(0, &dev.SMA->bInPotPosLeft);
+ writeb(0, dev.SMA + SMA_bInPotPosRight);
+ writeb(0, dev.SMA + SMA_bInPotPosLeft);
- writeb(0, &dev.SMA->bAuxPotPosRight);
- writeb(0, &dev.SMA->bAuxPotPosLeft);
+ writeb(0, dev.SMA + SMA_bAuxPotPosRight);
+ writeb(0, dev.SMA + SMA_bAuxPotPosLeft);
#ifndef MSND_CLASSIC
- writew(1, &dev.SMA->wCurrPlayFormat);
- writew(dev.sample_size, &dev.SMA->wCurrPlaySampleSize);
- writew(dev.channels, &dev.SMA->wCurrPlayChannels);
- writew(dev.sample_rate, &dev.SMA->wCurrPlaySampleRate);
+ writew(1, dev.SMA + SMA_wCurrPlayFormat);
+ writew(dev.sample_size, dev.SMA + SMA_wCurrPlaySampleSize);
+ writew(dev.channels, dev.SMA + SMA_wCurrPlayChannels);
+ writew(dev.sample_rate, dev.SMA + SMA_wCurrPlaySampleRate);
#endif
- writew(dev.sample_rate, &dev.SMA->wCalFreqAtoD);
+ writew(dev.sample_rate, dev.SMA + SMA_wCalFreqAtoD);
return 0;
}
@@ -1169,25 +1152,21 @@
__initfunc(static int calibrate_adc(WORD srate))
{
if (!dev.calibrate_signal) {
-
printk(KERN_INFO LOGNAME ": ADC calibration to board ground ");
- writew(readw(&dev.SMA->wCurrHostStatusFlags)
- | 0x0001, &dev.SMA->wCurrHostStatusFlags);
- }
- else {
-
+ writew(readw(dev.SMA + SMA_wCurrHostStatusFlags)
+ | 0x0001, dev.SMA + SMA_wCurrHostStatusFlags);
+ } else {
printk(KERN_INFO LOGNAME ": ADC calibration to signal ground ");
- writew(readw(&dev.SMA->wCurrHostStatusFlags)
- & ~0x0001, &dev.SMA->wCurrHostStatusFlags);
+ writew(readw(dev.SMA + SMA_wCurrHostStatusFlags)
+ & ~0x0001, dev.SMA + SMA_wCurrHostStatusFlags);
}
- writew(srate, &dev.SMA->wCalFreqAtoD);
+ writew(srate, dev.SMA + SMA_wCalFreqAtoD);
if (msnd_send_word(&dev, 0, 0, HDEXAR_CAL_A_TO_D) == 0 &&
msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ) == 0) {
-
current->state = TASK_INTERRUPTIBLE;
- current->timeout = jiffies + HZ;
+ current->timeout = jiffies + HZ / 3;
schedule();
current->timeout = 0;
printk("successful\n");
@@ -1221,9 +1200,7 @@
}
#endif
memcpy_toio(dev.base, PERMCODE, PERMCODESIZE);
-
if (msnd_upload_host(&dev, INITCODE, INITCODESIZE) < 0) {
-
printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n");
return -ENODEV;
}
@@ -1258,7 +1235,6 @@
#endif
if ((err = init_sma()) < 0) {
-
printk(KERN_WARNING LOGNAME ": Cannot initialize SMA\n");
return err;
}
@@ -1267,17 +1243,15 @@
return err;
if ((err = upload_dsp_code()) < 0) {
-
printk(KERN_WARNING LOGNAME ": Cannot upload DSP code\n");
return err;
} else
printk(KERN_INFO LOGNAME ": DSP upload successful\n");
- timeout = 2000;
+ timeout = 200;
while (readw(dev.base)) {
-
mdelay(1);
if (--timeout < 0)
return -EIO;
@@ -1292,17 +1266,15 @@
printk(KERN_DEBUG LOGNAME ": Intializing DSP\n");
- if ((err = request_irq(dev.irq, intr, SA_SHIRQ, DEVNAME, &dev)) < 0) {
-
+ if ((err = request_irq(dev.irq, intr, SA_SHIRQ, dev.name, &dev)) < 0) {
printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", dev.irq);
return err;
}
- request_region(dev.io, dev.numio, DEVNAME);
+ request_region(dev.io, dev.numio, dev.name);
if ((err = initialize()) < 0) {
-
printk(KERN_WARNING LOGNAME ": Initialization failure\n");
release_region(dev.io, dev.numio);
free_irq(dev.irq, &dev);
@@ -1311,41 +1283,34 @@
}
if ((err = msnd_register(&dev)) < 0) {
-
printk(KERN_ERR LOGNAME ": Unable to register MultiSound\n");
release_region(dev.io, dev.numio);
free_irq(dev.irq, &dev);
return err;
}
- if ((DSPMINOR = register_sound_dsp(&dev_fileops)) < 0) {
-
+ if ((dev.dsp_minor = register_sound_dsp(&dev_fileops)) < 0) {
printk(KERN_ERR LOGNAME ": Unable to register DSP operations\n");
msnd_unregister(&dev);
release_region(dev.io, dev.numio);
free_irq(dev.irq, &dev);
- return DSPMINOR;
+ return dev.dsp_minor;
}
- if ((MIXERMINOR = register_sound_mixer(&dev_fileops)) < 0) {
-
+ if ((dev.mixer_minor = register_sound_mixer(&dev_fileops)) < 0) {
printk(KERN_ERR LOGNAME ": Unable to register mixer operations\n");
- unregister_sound_mixer(MIXERMINOR);
+ unregister_sound_mixer(dev.mixer_minor);
msnd_unregister(&dev);
release_region(dev.io, dev.numio);
free_irq(dev.irq, &dev);
- return MIXERMINOR;
+ return dev.mixer_minor;
}
- printk(KERN_INFO LOGNAME ": Using DSP minor %d, mixer minor %d\n", MIXERMINOR, DSPMINOR);
+ printk(KERN_INFO LOGNAME ": Using DSP minor %d, mixer minor %d\n", dev.dsp_minor, dev.mixer_minor);
calibrate_adc(dev.sample_rate);
#ifndef MSND_CLASSIC
- printk(KERN_INFO LOGNAME ": Setting recording source to Line In\n");
- if (msnd_send_word(&dev, 0, 0, HDEXAR_SET_ANA_IN) != 0 ||
- msnd_send_dsp_cmd(&dev, HDEX_AUX_REQ) != 0) {
- printk(KERN_DEBUG LOGNAME ": Error setting Line In as recording source\n");
- }
- dev.recsrc = SOUND_MASK_LINE;
+ printk(KERN_INFO LOGNAME ": Setting initial recording source to Line In\n");
+ set_recsrc(SOUND_MASK_LINE);
#endif
return 0;
@@ -1355,8 +1320,8 @@
{
release_region(dev.io, dev.numio);
free_irq(dev.irq, &dev);
- unregister_sound_mixer(MIXERMINOR);
- unregister_sound_dsp(DSPMINOR);
+ unregister_sound_mixer(dev.mixer_minor);
+ unregister_sound_dsp(dev.dsp_minor);
msnd_unregister(&dev);
}
@@ -1370,6 +1335,155 @@
MOD_DEC_USE_COUNT;
}
+#ifndef MSND_CLASSIC
+
+/* Pinnacle/Fiji Logical Device Configuration */
+
+__initfunc(static int msnd_write_cfg(int cfg, int reg, int value))
+{
+ outb(reg, cfg);
+ outb(value, cfg + 1);
+ if (value != inb(cfg + 1)) {
+ printk(KERN_ERR LOGNAME ": msnd_write_cfg: I/O error\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+__initfunc(static int msnd_write_cfg_io0(int cfg, int num, WORD io))
+{
+ if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_IO0_BASEHI, HIBYTE(io)))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_IO0_BASELO, LOBYTE(io)))
+ return -EIO;
+ return 0;
+}
+
+__initfunc(static int msnd_write_cfg_io1(int cfg, int num, WORD io))
+{
+ if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io)))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io)))
+ return -EIO;
+ return 0;
+}
+
+__initfunc(static int msnd_write_cfg_irq(int cfg, int num, WORD irq))
+{
+ if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_IRQ_NUMBER, LOBYTE(irq)))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_IRQ_TYPE, IRQTYPE_EDGE))
+ return -EIO;
+ return 0;
+}
+
+__initfunc(static int msnd_write_cfg_mem(int cfg, int num, int mem))
+{
+ WORD wmem;
+
+ mem >>= 8;
+ mem &= 0xfff;
+ wmem = (WORD)mem;
+ if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_MEMBASEHI, HIBYTE(wmem)))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_MEMBASELO, LOBYTE(wmem)))
+ return -EIO;
+ if (wmem && msnd_write_cfg(cfg, IREG_MEMCONTROL, (MEMTYPE_HIADDR | MEMTYPE_16BIT)))
+ return -EIO;
+ return 0;
+}
+
+__initfunc(static int msnd_activate_logical(int cfg, int num))
+{
+ if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
+ return -EIO;
+ if (msnd_write_cfg(cfg, IREG_ACTIVATE, LD_ACTIVATE))
+ return -EIO;
+ return 0;
+}
+
+__initfunc(static int msnd_write_cfg_logical(int cfg, int num, WORD io0, WORD io1, WORD irq, int mem))
+{
+ if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
+ return -EIO;
+ if (msnd_write_cfg_io0(cfg, num, io0))
+ return -EIO;
+ if (msnd_write_cfg_io1(cfg, num, io1))
+ return -EIO;
+ if (msnd_write_cfg_irq(cfg, num, irq))
+ return -EIO;
+ if (msnd_write_cfg_mem(cfg, num, mem))
+ return -EIO;
+ if (msnd_activate_logical(cfg, num))
+ return -EIO;
+ return 0;
+}
+
+typedef struct msnd_pinnacle_cfg_device {
+ WORD io0, io1, irq;
+ int mem;
+} msnd_pinnacle_cfg_t[4];
+
+__initfunc(static int msnd_pinnacle_cfg_devices(int cfg, int reset, msnd_pinnacle_cfg_t device))
+{
+ int i;
+
+ /* Reset devices if told to */
+ if (reset) {
+ printk(KERN_INFO LOGNAME ": Resetting all devices\n");
+ for (i = 0; i < 4; ++i)
+ if (msnd_write_cfg_logical(cfg, i, 0, 0, 0, 0))
+ return -EIO;
+ }
+
+ /* Configure specified devices */
+ for (i = 0; i < 4; ++i) {
+
+ switch (i) {
+ case 0: /* DSP */
+ if (!(device[i].io0 && device[i].irq && device[i].mem))
+ continue;
+ break;
+ case 1: /* MPU */
+ if (!(device[i].io0 && device[i].irq))
+ continue;
+ printk(KERN_INFO LOGNAME
+ ": Configuring MPU to I/O 0x%x IRQ %d\n",
+ device[i].io0, device[i].irq);
+ break;
+ case 2: /* IDE */
+ if (!(device[i].io0 && device[i].io1 && device[i].irq))
+ continue;
+ printk(KERN_INFO LOGNAME
+ ": Configuring IDE to I/O 0x%x, 0x%x IRQ %d\n",
+ device[i].io0, device[i].io1, device[i].irq);
+ break;
+ case 3: /* Joystick */
+ if (!(device[i].io0))
+ continue;
+ printk(KERN_INFO LOGNAME
+ ": Configuring joystick to I/O 0x%x\n",
+ device[i].io0);
+ break;
+ }
+
+ /* Configure the device */
+ if (msnd_write_cfg_logical(cfg, i, device[i].io0, device[i].io1, device[i].irq, device[i].mem))
+ return -EIO;
+ }
+
+ return 0;
+}
+#endif
+
#ifdef MODULE
MODULE_AUTHOR ("Andrew Veliath <andrewtv@usa.net>");
MODULE_DESCRIPTION ("Turtle Beach " LONGNAME " Linux Driver");
@@ -1381,39 +1495,118 @@
MODULE_PARM (calibrate_signal, "i");
#ifndef MSND_CLASSIC
MODULE_PARM (digital, "i");
+MODULE_PARM (cfg, "i");
+MODULE_PARM (reset, "i");
+MODULE_PARM (mpu_io, "i");
+MODULE_PARM (mpu_irq, "i");
+MODULE_PARM (ide_io0, "i");
+MODULE_PARM (ide_io1, "i");
+MODULE_PARM (ide_irq, "i");
+MODULE_PARM (joystick_io, "i");
#endif
static int io __initdata = -1;
static int irq __initdata = -1;
static int mem __initdata = -1;
+
#ifndef MSND_CLASSIC
+/* Pinnacle/Fiji non-PnP Config Port */
+static int cfg __initdata = -1;
+
+/* Extra Peripheral Configuration */
+static int reset __initdata;
+static int mpu_io __initdata;
+static int mpu_irq __initdata;
+static int ide_io0 __initdata;
+static int ide_io1 __initdata;
+static int ide_irq __initdata;
+static int joystick_io __initdata;
+
+/* If we have the digital daugherboard... */
static int digital __initdata;
#endif
+
static int fifosize __initdata = DEFFIFOSIZE;
static int calibrate_signal __initdata;
+/* If we're a module, this is just init_module */
+
int init_module(void)
+
#else /* not a module */
+
#ifdef MSND_CLASSIC
static int io __initdata = CONFIG_MSNDCLAS_IO;
static int irq __initdata = CONFIG_MSNDCLAS_IRQ;
static int mem __initdata = CONFIG_MSNDCLAS_MEM;
#else /* Pinnacle/Fiji */
+
static int io __initdata = CONFIG_MSNDPIN_IO;
static int irq __initdata = CONFIG_MSNDPIN_IRQ;
static int mem __initdata = CONFIG_MSNDPIN_MEM;
+
+/* Pinnacle/Fiji non-PnP Config Port */
+#ifdef CONFIG_MSNDPIN_NONPNP
+# ifndef CONFIG_MSNDPIN_CFG
+# define CONFIG_MSNDPIN_CFG 0x250
+# endif
+#else
+# ifdef CONFIG_MSNDPIN_CFG
+# undef CONFIG_MSNDPIN_CFG
+# endif
+# define CONFIG_MSNDPIN_CFG -1
+#endif
+static int cfg __initdata = CONFIG_MSNDPIN_CFG;
+/* If not a module, we don't need to bother with reset=1 */
+static int reset __initdata;
+
+/* Extra Peripheral Configuration (Default: Disable) */
+#ifndef CONFIG_MSNDPIN_MPU_IO
+# define CONFIG_MSNDPIN_MPU_IO 0
+#endif
+static int mpu_io __initdata = CONFIG_MSNDPIN_MPU_IO;
+
+#ifndef CONFIG_MSNDPIN_MPU_IRQ
+# define CONFIG_MSNDPIN_MPU_IRQ 0
+#endif
+static int mpu_irq __initdata = CONFIG_MSNDPIN_MPU_IRQ;
+
+#ifndef CONFIG_MSNDPIN_IDE_IO0
+# define CONFIG_MSNDPIN_IDE_IO0 0
+#endif
+static int ide_io0 __initdata = CONFIG_MSNDPIN_IDE_IO0;
+
+#ifndef CONFIG_MSNDPIN_IDE_IO1
+# define CONFIG_MSNDPIN_IDE_IO1 0
+#endif
+static int ide_io1 __initdata = CONFIG_MSNDPIN_IDE_IO1;
+
+#ifndef CONFIG_MSNDPIN_IDE_IRQ
+# define CONFIG_MSNDPIN_IDE_IRQ 0
+#endif
+static int ide_irq __initdata = CONFIG_MSNDPIN_IDE_IRQ;
+
+#ifndef CONFIG_MSNDPIN_JOYSTICK_IO
+# define CONFIG_MSNDPIN_JOYSTICK_IO 0
+#endif
+static int joystick_io __initdata = CONFIG_MSNDPIN_JOYSTICK_IO;
+
+/* Have SPDIF (Digital) Daughterboard */
#ifndef CONFIG_MSNDPIN_DIGITAL
# define CONFIG_MSNDPIN_DIGITAL 0
#endif
static int digital __initdata = CONFIG_MSNDPIN_DIGITAL;
+
#endif /* MSND_CLASSIC */
+
#ifndef CONFIG_MSND_FIFOSIZE
# define CONFIG_MSND_FIFOSIZE DEFFIFOSIZE
-#endif /* CONFIG_MSND_FIFOSIZE */
+#endif
static int fifosize __initdata = CONFIG_MSND_FIFOSIZE;
+
#ifndef CONFIG_MSND_CALSIGNAL
# define CONFIG_MSND_CALSIGNAL 0
-#endif /* CONFIG_MSND_CALSIGNAL */
+#endif
static int
calibrate_signal __initdata = CONFIG_MSND_CALSIGNAL;
@@ -1422,9 +1615,13 @@
#else
__initfunc(int msnd_pinnacle_init(void))
#endif /* MSND_CLASSIC */
-#endif
+
+#endif /* MODULE */
{
int err;
+#ifndef MSND_CLASSIC
+ static msnd_pinnacle_cfg_t pinnacle_devs;
+#endif /* MSND_CLASSIC */
printk(KERN_INFO LOGNAME ": Turtle Beach " LONGNAME " Linux Driver Version "
VERSION ", Copyright (C) 1998 Andrew Veliath\n");
@@ -1433,7 +1630,7 @@
printk(KERN_WARNING LOGNAME ": io, irq and mem must be set\n");
}
-
+
if (io == -1 ||
!(io == 0x290 ||
io == 0x260 ||
@@ -1444,7 +1641,7 @@
io == 0x210 ||
io == 0x3e0)) {
- printk(KERN_ERR LOGNAME ": \"io\" - DSP I/O base must be set\n");
+ printk(KERN_ERR LOGNAME ": \"io\" - DSP I/O base must be set to 0x210, 0x220, 0x230, 0x240, 0x250, 0x260, 0x290, or 0x3E0\n");
return -EINVAL;
}
@@ -1490,6 +1687,47 @@
case 0xd8000: dev.memid = HPMEM_D800; break;
case 0xe0000: dev.memid = HPMEM_E000; break;
case 0xe8000: dev.memid = HPMEM_E800; break;
+ }
+#else
+ if (cfg == -1) {
+ printk(KERN_INFO LOGNAME ": Assuming PnP mode\n");
+ } else if (cfg != 0x250 && cfg != 0x260 && cfg != 0x270) {
+ printk(KERN_INFO LOGNAME ": Config port must be 0x250, 0x260 or 0x270 (or unspecified for PnP mode)\n");
+ return -EINVAL;
+ } else {
+ printk(KERN_INFO LOGNAME ": Non-PnP mode: configuring at port 0x%x\n", cfg);
+
+ /* DSP */
+ pinnacle_devs[0].io0 = io;
+ pinnacle_devs[0].irq = irq;
+ pinnacle_devs[0].mem = mem;
+
+ /* The following are Pinnacle specific */
+
+ /* MPU */
+ pinnacle_devs[1].io0 = mpu_io;
+ pinnacle_devs[1].irq = mpu_irq;
+
+ /* IDE */
+ pinnacle_devs[2].io0 = ide_io0;
+ pinnacle_devs[2].io1 = ide_io1;
+ pinnacle_devs[2].irq = ide_irq;
+
+ /* Joystick */
+ pinnacle_devs[3].io0 = joystick_io;
+
+ if (check_region(cfg, 2)) {
+ printk(KERN_ERR LOGNAME ": Config port 0x%x conflict\n", cfg);
+ return -EIO;
+ }
+
+ request_region(cfg, 2, "Pinnacle/Fiji Config");
+ if (msnd_pinnacle_cfg_devices(cfg, reset, pinnacle_devs)) {
+ printk(KERN_ERR LOGNAME ": Device configuration error\n");
+ release_region(cfg, 2);
+ return -EIO;
+ }
+ release_region(cfg, 2);
}
#endif /* MSND_CLASSIC */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov