Lines Matching +full:serial +full:- +full:midi

1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (C) by Paul Barton-Davis 1998-1999
5 * copyright (C) by Hannu Savolainen 1993-1996
14 * of GUS patches during loading, and full user-level access to all
15 * WaveFront commands. It tries to provide semi-intelligent patch and
36 loading. if non-zero, then during driver loading, the
80 checks on-board RAM.
87 MODULE_PARM_DESC(wf_raw, "if non-zero, assume that we need to boot the OS");
89 MODULE_PARM_DESC(fx_raw, "if non-zero, assume that the FX process needs help");
107 /* if WF_DEBUG not defined, no run-time debugging messages will
118 if ((dev->debug & (cond)) == (cond)) { \
157 { 0x0E, "Bad MIDI channel number" },
175 { WFC_MISYNTH_OFF, "disable midi-in to synth", 0, 0, NEEDS_ACK },
176 { WFC_MISYNTH_ON, "enable midi-in to synth", 0, 0, NEEDS_ACK },
177 { WFC_VMIDI_ON, "enable virtual midi mode", 0, 0, NEEDS_ACK },
178 { WFC_VMIDI_OFF, "disable virtual midi mode", 0, 0, NEEDS_ACK },
179 { WFC_MIDI_STATUS, "report midi status", 1, 0, 0 },
225 { WFC_NOOP, "the no-op command", 0, 0, NEEDS_ACK },
263 return inb (dev->status_port); in wavefront_status()
311 return inb (dev->data_port); in wavefront_read()
315 return -1; in wavefront_read()
323 outb (data, dev->data_port); in wavefront_write()
329 return -1; in wavefront_write()
344 dev_err(dev->card->dev, "command 0x%x not supported.\n", in snd_wavefront_cmd()
349 /* Hack to handle the one variable-size write command. See in snd_wavefront_cmd()
355 wfcmd->write_cnt = (unsigned long) rbuf; in snd_wavefront_cmd()
360 cmd, wfcmd->action, wfcmd->read_cnt, in snd_wavefront_cmd()
361 wfcmd->write_cnt, wfcmd->need_ack); in snd_wavefront_cmd()
366 cmd, wfcmd->action); in snd_wavefront_cmd()
370 if (wfcmd->write_cnt > 0) { in snd_wavefront_cmd()
373 wfcmd->write_cnt, cmd); in snd_wavefront_cmd()
375 for (i = 0; i < wfcmd->write_cnt; i++) { in snd_wavefront_cmd()
379 i, cmd, wfcmd->action); in snd_wavefront_cmd()
388 if (wfcmd->read_cnt > 0) { in snd_wavefront_cmd()
391 wfcmd->read_cnt, cmd); in snd_wavefront_cmd()
393 for (i = 0; i < wfcmd->read_cnt; i++) { in snd_wavefront_cmd()
396 if (c == -1) { in snd_wavefront_cmd()
399 i, cmd, wfcmd->action); in snd_wavefront_cmd()
407 if (c == -1) { in snd_wavefront_cmd()
413 wfcmd->action); in snd_wavefront_cmd()
420 wfcmd->cmd == WFC_IDENTIFY_SAMPLE_TYPE) { in snd_wavefront_cmd()
425 wfcmd->cmd == WFC_UPLOAD_PATCH) { in snd_wavefront_cmd()
430 wfcmd->cmd == WFC_UPLOAD_PROGRAM) { in snd_wavefront_cmd()
444 wfcmd->action); in snd_wavefront_cmd()
457 if ((wfcmd->read_cnt == 0 && wfcmd->write_cnt == 0) || wfcmd->need_ack) { in snd_wavefront_cmd()
470 if (ack == -1) { in snd_wavefront_cmd()
473 cmd, wfcmd->action); in snd_wavefront_cmd()
477 int err = -1; /* something unknown */ in snd_wavefront_cmd()
482 if (err == -1) { in snd_wavefront_cmd()
486 cmd, wfcmd->action); in snd_wavefront_cmd()
492 cmd, wfcmd->action, ack, err, in snd_wavefront_cmd()
495 return -err; in snd_wavefront_cmd()
501 cmd, wfcmd->action); in snd_wavefront_cmd()
506 cmd, wfcmd->action, wfcmd->read_cnt, in snd_wavefront_cmd()
507 wfcmd->write_cnt, wfcmd->need_ack); in snd_wavefront_cmd()
522 the x86 side as 8-32 bit values. Sometimes, we need to munge data
525 different functions for munging and 2 for de-munging. This avoids
526 weird casting and worrying about bit-level offsets.
554 for (i = src_size - 1; i >= 0; i--) { in demunge_int32()
610 dev->sample_status[sample_num] = WF_ST_EMPTY; in wavefront_delete_sample()
626 dev_err(dev->card->dev, "cannot request sample count.\n"); in wavefront_get_sample_status()
627 return -1; in wavefront_get_sample_status()
630 sc_real = sc_alias = sc_multi = dev->samples_used = 0; in wavefront_get_sample_status()
638 dev_warn(dev->card->dev, in wavefront_get_sample_status()
640 dev->sample_status[i] = WF_ST_EMPTY; in wavefront_get_sample_status()
644 dev->sample_status[i] = (WF_SLOT_FILLED|rbuf[0]); in wavefront_get_sample_status()
647 dev->sample_status[i] |= WF_SLOT_ROM; in wavefront_get_sample_status()
664 dev_err(dev->card->dev, in wavefront_get_sample_status()
670 dev->samples_used++; in wavefront_get_sample_status()
674 dev_info(dev->card->dev, in wavefront_get_sample_status()
676 dev->samples_used, sc_real, sc_alias, sc_multi, in wavefront_get_sample_status()
677 WF_MAX_SAMPLE - dev->samples_used); in wavefront_get_sample_status()
701 dev->patch_status[i] |= WF_SLOT_FILLED; in wavefront_get_patch_status()
703 dev->sample_status in wavefront_get_patch_status()
704 [p->sample_number|(p->sample_msb<<7)] |= in wavefront_get_patch_status()
708 dev->patch_status[i] = 0; in wavefront_get_patch_status()
710 dev_err(dev->card->dev, in wavefront_get_patch_status()
712 dev->patch_status[i] = 0; in wavefront_get_patch_status()
720 if (dev->patch_status[i] & WF_SLOT_FILLED) { in wavefront_get_patch_status()
723 if (dev->patch_status[i] & WF_SLOT_USED) { in wavefront_get_patch_status()
728 dev_info(dev->card->dev, "%d patch slots filled, %d in use\n", in wavefront_get_patch_status()
750 dev->prog_status[i] |= WF_SLOT_USED; in wavefront_get_program_status()
757 dev->patch_status in wavefront_get_program_status()
763 dev->prog_status[i] = 0; in wavefront_get_program_status()
765 dev_err(dev->card->dev, in wavefront_get_program_status()
767 dev->prog_status[i] = 0; in wavefront_get_program_status()
772 if (dev->prog_status[i]) { in wavefront_get_program_status()
777 dev_info(dev->card->dev, "%d programs slots in use\n", cnt); in wavefront_get_program_status()
790 header->number); in wavefront_send_patch()
792 if (header->number >= ARRAY_SIZE(dev->patch_status)) in wavefront_send_patch()
793 return -EINVAL; in wavefront_send_patch()
795 dev->patch_status[header->number] |= WF_SLOT_FILLED; in wavefront_send_patch()
797 bptr = munge_int32 (header->number, buf, 2); in wavefront_send_patch()
798 munge_buf ((unsigned char *)&header->hdr.p, bptr, WF_PATCH_BYTES); in wavefront_send_patch()
801 dev_err(dev->card->dev, "download patch failed\n"); in wavefront_send_patch()
802 return -EIO; in wavefront_send_patch()
816 header->number); in wavefront_send_program()
818 if (header->number >= ARRAY_SIZE(dev->prog_status)) in wavefront_send_program()
819 return -EINVAL; in wavefront_send_program()
821 dev->prog_status[header->number] = WF_SLOT_USED; in wavefront_send_program()
828 if (header->hdr.pr.layer[i].mute) { in wavefront_send_program()
829 dev->patch_status[header->hdr.pr.layer[i].patch_number] |= in wavefront_send_program()
838 buf[0] = header->number; in wavefront_send_program()
839 munge_buf ((unsigned char *)&header->hdr.pr, &buf[1], WF_PROGRAM_BYTES); in wavefront_send_program()
842 dev_err(dev->card->dev, "download patch failed\n"); in wavefront_send_program()
843 return -EIO; in wavefront_send_program()
856 dev_err(dev->card->dev, "can't get memory stats.\n"); in wavefront_freemem()
857 return -1; in wavefront_freemem()
870 /* samples are downloaded via a 16-bit wide i/o port in wavefront_send_sample()
871 (you could think of it as 2 adjacent 8-bit wide ports in wavefront_send_sample()
875 which are given in 8-bit units (bytes), need to be in wavefront_send_sample()
895 header->size ? "" : "header ", in wavefront_send_sample()
896 header->number, header->subkey, in wavefront_send_sample()
897 header->size, in wavefront_send_sample()
898 (unsigned long) header->dataptr); in wavefront_send_sample()
900 if (header->number == WAVEFRONT_FIND_FREE_SAMPLE_SLOT) { in wavefront_send_sample()
905 return -ENOMEM; in wavefront_send_sample()
906 dev_info(dev->card->dev, "unspecified sample => %d\n", x); in wavefront_send_sample()
907 header->number = x; in wavefront_send_sample()
910 if (header->number >= WF_MAX_SAMPLE) in wavefront_send_sample()
911 return -EINVAL; in wavefront_send_sample()
913 if (header->size) { in wavefront_send_sample()
921 available in the WFB file for General MIDI, and so these in wavefront_send_sample()
929 this driver, and so a complete reset (back to General MIDI, in wavefront_send_sample()
938 if (dev->rom_samples_rdonly) { in wavefront_send_sample()
939 if (dev->sample_status[header->number] & WF_SLOT_ROM) { in wavefront_send_sample()
940 dev_err(dev->card->dev, in wavefront_send_sample()
942 header->number); in wavefront_send_sample()
943 return -EACCES; in wavefront_send_sample()
947 wavefront_delete_sample (dev, header->number); in wavefront_send_sample()
950 if (header->size) { in wavefront_send_sample()
951 dev->freemem = wavefront_freemem (dev); in wavefront_send_sample()
953 if (dev->freemem < (int)header->size) { in wavefront_send_sample()
954 dev_err(dev->card->dev, in wavefront_send_sample()
956 header->size); in wavefront_send_sample()
957 return -ENOMEM; in wavefront_send_sample()
962 skip = WF_GET_CHANNEL(&header->hdr.s); in wavefront_send_sample()
964 if (skip > 0 && header->hdr.s.SampleResolution != LINEAR_16BIT) { in wavefront_send_sample()
965 dev_err(dev->card->dev, in wavefront_send_sample()
966 "channel selection only possible on 16-bit samples"); in wavefront_send_sample()
967 return -EINVAL; in wavefront_send_sample()
1003 WF_GET_CHANNEL (&header->hdr.s), in wavefront_send_sample()
1008 WF_SET_CHANNEL(&header->hdr.s, 0); in wavefront_send_sample()
1015 length = header->size / 2; in wavefront_send_sample()
1024 shptr = munge_int32 (header->number, shptr, 2); in wavefront_send_sample()
1026 if (header->size) { in wavefront_send_sample()
1034 shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleStartOffset), in wavefront_send_sample()
1036 shptr = munge_int32 (*((u32 *) &header->hdr.s.loopStartOffset), in wavefront_send_sample()
1038 shptr = munge_int32 (*((u32 *) &header->hdr.s.loopEndOffset), in wavefront_send_sample()
1040 shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleEndOffset), in wavefront_send_sample()
1048 shptr = munge_int32 (header->hdr.s.FrequencyBias, shptr, 3); in wavefront_send_sample()
1052 good-faith guess at where it starts. in wavefront_send_sample()
1055 shptr = munge_int32 (*(&header->hdr.s.FrequencyBias+1), in wavefront_send_sample()
1059 header->size ? in wavefront_send_sample()
1062 dev_err(dev->card->dev, "sample %sdownload refused.\n", in wavefront_send_sample()
1063 header->size ? "" : "header "); in wavefront_send_sample()
1064 return -EIO; in wavefront_send_sample()
1067 if (header->size == 0) { in wavefront_send_sample()
1080 if ((length - written) > max_blksize) { in wavefront_send_sample()
1083 /* round to nearest 16-byte value */ in wavefront_send_sample()
1084 blocksize = ALIGN(length - written, 8); in wavefront_send_sample()
1088 dev_err(dev->card->dev, in wavefront_send_sample()
1090 return -EIO; in wavefront_send_sample()
1098 return -EFAULT; in wavefront_send_sample()
1103 if (WF_SAMPLE_IS_8BIT(&header->hdr.s)) { in wavefront_send_sample()
1136 if (i < blocksize - 1) { in wavefront_send_sample()
1137 outw (sample_short, dev->block_port); in wavefront_send_sample()
1139 outw (sample_short, dev->last_block_port); in wavefront_send_sample()
1149 if (dma_ack == -1) { in wavefront_send_sample()
1150 dev_err(dev->card->dev, in wavefront_send_sample()
1152 return -EIO; in wavefront_send_sample()
1154 dev_err(dev->card->dev, in wavefront_send_sample()
1157 return -EIO; in wavefront_send_sample()
1162 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_SAMPLE); in wavefront_send_sample()
1180 header->number, in wavefront_send_alias()
1181 header->hdr.a.OriginalSample); in wavefront_send_alias()
1183 if (header->number >= WF_MAX_SAMPLE) in wavefront_send_alias()
1184 return -EINVAL; in wavefront_send_alias()
1186 munge_int32 (header->number, &alias_hdr[0], 2); in wavefront_send_alias()
1187 munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2); in wavefront_send_alias()
1188 munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset), in wavefront_send_alias()
1190 munge_int32 (*((unsigned int *)&header->hdr.a.loopStartOffset), in wavefront_send_alias()
1192 munge_int32 (*((unsigned int *)&header->hdr.a.loopEndOffset), in wavefront_send_alias()
1194 munge_int32 (*((unsigned int *)&header->hdr.a.sampleEndOffset), in wavefront_send_alias()
1196 munge_int32 (header->hdr.a.FrequencyBias, &alias_hdr[20], 3); in wavefront_send_alias()
1197 munge_int32 (*(&header->hdr.a.FrequencyBias+1), &alias_hdr[23], 2); in wavefront_send_alias()
1200 dev_err(dev->card->dev, "download alias failed.\n"); in wavefront_send_alias()
1201 return -EIO; in wavefront_send_alias()
1204 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_ALIAS); in wavefront_send_alias()
1216 if (header->number >= WF_MAX_SAMPLE) in wavefront_send_multisample()
1217 return -EINVAL; in wavefront_send_multisample()
1221 return -ENOMEM; in wavefront_send_multisample()
1223 munge_int32 (header->number, &msample_hdr[0], 2); in wavefront_send_multisample()
1230 num_samples = (1<<(header->hdr.ms.NumberOfSamples&7)); in wavefront_send_multisample()
1231 msample_hdr[2] = (unsigned char) header->hdr.ms.NumberOfSamples; in wavefront_send_multisample()
1234 header->number, in wavefront_send_multisample()
1235 header->hdr.ms.NumberOfSamples, in wavefront_send_multisample()
1240 i, header->hdr.ms.SampleNumber[i]); in wavefront_send_multisample()
1241 munge_int32 (header->hdr.ms.SampleNumber[i], in wavefront_send_multisample()
1253 dev_err(dev->card->dev, "download of multisample failed.\n"); in wavefront_send_multisample()
1255 return -EIO; in wavefront_send_multisample()
1258 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_MULTISAMPLE); in wavefront_send_multisample()
1273 munge_int32 (header->number, number, 2); in wavefront_fetch_multisample()
1276 dev_err(dev->card->dev, "upload multisample failed.\n"); in wavefront_fetch_multisample()
1277 return -EIO; in wavefront_fetch_multisample()
1281 header->number, log_ns[0]); in wavefront_fetch_multisample()
1283 header->hdr.ms.NumberOfSamples = log_ns[0]; in wavefront_fetch_multisample()
1294 if (val == -1) { in wavefront_fetch_multisample()
1295 dev_err(dev->card->dev, in wavefront_fetch_multisample()
1297 return -EIO; in wavefront_fetch_multisample()
1302 if (val == -1) { in wavefront_fetch_multisample()
1303 dev_err(dev->card->dev, in wavefront_fetch_multisample()
1305 return -EIO; in wavefront_fetch_multisample()
1309 header->hdr.ms.SampleNumber[i] = in wavefront_fetch_multisample()
1313 i, header->hdr.ms.SampleNumber[i]); in wavefront_fetch_multisample()
1325 wavefront_drum *drum = &header->hdr.d; in wavefront_send_drum()
1328 DPRINT (WF_DEBUG_LOAD_PATCH, "downloading edrum for MIDI " in wavefront_send_drum()
1330 header->number, drum->PatchNumber); in wavefront_send_drum()
1332 drumbuf[0] = header->number & 0x7f; in wavefront_send_drum()
1339 dev_err(dev->card->dev, "download drum failed.\n"); in wavefront_send_drum()
1340 return -EIO; in wavefront_send_drum()
1353 if (!(dev->sample_status[i] & WF_SLOT_FILLED)) { in wavefront_find_free_sample()
1357 dev_err(dev->card->dev, "no free sample slots!\n"); in wavefront_find_free_sample()
1358 return -1; in wavefront_find_free_sample()
1369 if (!(dev->patch_status[i] & WF_SLOT_FILLED)) {
1373 dev_err(dev->card->dev, "no free patch slots!\n");
1374 return -1;
1386 return -ENOMEM; in wavefront_load_patch()
1388 if (copy_from_user (header, addr, sizeof(wavefront_patch_info) - in wavefront_load_patch()
1390 dev_err(dev->card->dev, "bad address for load patch.\n"); in wavefront_load_patch()
1391 err = -EFAULT; in wavefront_load_patch()
1399 header->subkey, in wavefront_load_patch()
1400 header->number, in wavefront_load_patch()
1401 header->size); in wavefront_load_patch()
1403 switch (header->subkey) { in wavefront_load_patch()
1404 case WF_ST_SAMPLE: /* sample or sample_header, based on patch->size */ in wavefront_load_patch()
1406 if (copy_from_user (&header->hdr.s, header->hdrptr, in wavefront_load_patch()
1408 err = -EFAULT; in wavefront_load_patch()
1412 err = wavefront_send_sample (dev, header, header->dataptr, 0); in wavefront_load_patch()
1417 if (copy_from_user (&header->hdr.s, header->hdrptr, in wavefront_load_patch()
1419 err = -EFAULT; in wavefront_load_patch()
1428 if (copy_from_user (&header->hdr.a, header->hdrptr, in wavefront_load_patch()
1430 err = -EFAULT; in wavefront_load_patch()
1438 if (copy_from_user (&header->hdr.d, header->hdrptr, in wavefront_load_patch()
1440 err = -EFAULT; in wavefront_load_patch()
1448 if (copy_from_user (&header->hdr.p, header->hdrptr, in wavefront_load_patch()
1450 err = -EFAULT; in wavefront_load_patch()
1458 if (copy_from_user (&header->hdr.pr, header->hdrptr, in wavefront_load_patch()
1460 err = -EFAULT; in wavefront_load_patch()
1468 dev_err(dev->card->dev, "unknown patch type %d.\n", in wavefront_load_patch()
1469 header->subkey); in wavefront_load_patch()
1470 err = -EINVAL; in wavefront_load_patch()
1480 WaveFront: hardware-dependent interface
1520 snd_wavefront_t *dev = &acard->wavefront; in wavefront_synth_control()
1525 "cmd 0x%x\n", wc->cmd); in wavefront_synth_control()
1527 /* Pre-handling of or for various commands */ in wavefront_synth_control()
1529 switch (wc->cmd) { in wavefront_synth_control()
1532 dev_dbg(dev->card->dev, "interrupts disabled.\n"); in wavefront_synth_control()
1533 outb (0x80|0x20, dev->control_port); in wavefront_synth_control()
1534 dev->interrupts_are_midi = 1; in wavefront_synth_control()
1538 dev_dbg(dev->card->dev, "interrupts enabled.\n"); in wavefront_synth_control()
1539 outb (0x80|0x40|0x20, dev->control_port); in wavefront_synth_control()
1540 dev->interrupts_are_midi = 1; in wavefront_synth_control()
1544 wc->rbuf[0] = dev->interrupts_are_midi; in wavefront_synth_control()
1548 dev->rom_samples_rdonly = wc->wbuf[0]; in wavefront_synth_control()
1549 wc->status = 0; in wavefront_synth_control()
1553 i = wc->wbuf[0] | (wc->wbuf[1] << 7); in wavefront_synth_control()
1555 dev_err(dev->card->dev, "invalid slot ID %d\n", in wavefront_synth_control()
1557 wc->status = EINVAL; in wavefront_synth_control()
1558 return -EINVAL; in wavefront_synth_control()
1560 wc->rbuf[0] = dev->sample_status[i]; in wavefront_synth_control()
1561 wc->status = 0; in wavefront_synth_control()
1565 dev->debug = wc->wbuf[0]; in wavefront_synth_control()
1566 dev_dbg(dev->card->dev, "debug = 0x%x\n", dev->debug); in wavefront_synth_control()
1570 munge_int32 (*((u32 *) wc->wbuf), patchnumbuf, 2); in wavefront_synth_control()
1571 memcpy (wc->wbuf, patchnumbuf, 2); in wavefront_synth_control()
1578 wc->status = wavefront_fetch_multisample in wavefront_synth_control()
1579 (dev, (wavefront_patch_info *) wc->rbuf); in wavefront_synth_control()
1583 dev_err(dev->card->dev, in wavefront_synth_control()
1585 wc->status = EINVAL; in wavefront_synth_control()
1586 return -EINVAL; in wavefront_synth_control()
1589 wc->status = snd_wavefront_cmd (dev, wc->cmd, wc->rbuf, wc->wbuf); in wavefront_synth_control()
1591 /* Post-handling of certain commands. in wavefront_synth_control()
1594 so that the user-level doesn't have to think about it. in wavefront_synth_control()
1597 if (wc->status == 0) { in wavefront_synth_control()
1598 switch (wc->cmd) { in wavefront_synth_control()
1600 we are always current with the user-level view in wavefront_synth_control()
1605 dev->freemem = demunge_int32 (wc->rbuf, 4); in wavefront_synth_control()
1609 demunge_buf (wc->rbuf, wc->rbuf, WF_PATCH_BYTES); in wavefront_synth_control()
1613 demunge_buf (wc->rbuf, wc->rbuf, WF_PROGRAM_BYTES); in wavefront_synth_control()
1617 demunge_buf (wc->rbuf, wc->rbuf, WF_DRUM_BYTES - 1); in wavefront_synth_control()
1621 process_sample_hdr (wc->rbuf); in wavefront_synth_control()
1625 dev_err(dev->card->dev, in wavefront_synth_control()
1646 if (!try_module_get(hw->card->module)) in snd_wavefront_synth_open()
1647 return -EFAULT; in snd_wavefront_synth_open()
1648 file->private_data = hw; in snd_wavefront_synth_open()
1656 module_put(hw->card->module); in snd_wavefront_synth_release()
1672 card = (struct snd_card *) hw->card; in snd_wavefront_synth_ioctl()
1675 return -ENODEV; in snd_wavefront_synth_ioctl()
1676 if (snd_BUG_ON(!card->private_data)) in snd_wavefront_synth_ioctl()
1677 return -ENODEV; in snd_wavefront_synth_ioctl()
1679 acard = card->private_data; in snd_wavefront_synth_ioctl()
1680 dev = &acard->wavefront; in snd_wavefront_synth_ioctl()
1685 return -EIO; in snd_wavefront_synth_ioctl()
1695 err = -EIO; in snd_wavefront_synth_ioctl()
1697 err = -EFAULT; in snd_wavefront_synth_ioctl()
1704 return -EINVAL; in snd_wavefront_synth_ioctl()
1712 /* WaveFront: interface for card-level wavefront module */
1718 snd_wavefront_t *dev = &card->wavefront; in snd_wavefront_internal_interrupt()
1723 doing busy and/or sleep-waiting. Alas, it appears that once in snd_wavefront_internal_interrupt()
1737 firmware prevents RX-ready interrupts. in snd_wavefront_internal_interrupt()
1744 spin_lock(&dev->irq_lock); in snd_wavefront_internal_interrupt()
1745 dev->irq_ok = 1; in snd_wavefront_internal_interrupt()
1746 dev->irq_cnt++; in snd_wavefront_internal_interrupt()
1747 spin_unlock(&dev->irq_lock); in snd_wavefront_internal_interrupt()
1748 wake_up(&dev->interrupt_sleeper); in snd_wavefront_internal_interrupt()
1784 dev_err(dev->card->dev, "invalid IRQ %d\n", irq); in snd_wavefront_interrupt_bits()
1785 bits = -1; in snd_wavefront_interrupt_bits()
1799 spin_lock_irq(&dev->irq_lock); in wavefront_should_cause_interrupt()
1800 add_wait_queue(&dev->interrupt_sleeper, &wait); in wavefront_should_cause_interrupt()
1801 dev->irq_ok = 0; in wavefront_should_cause_interrupt()
1803 spin_unlock_irq(&dev->irq_lock); in wavefront_should_cause_interrupt()
1804 while (!dev->irq_ok && time_before(jiffies, timeout)) { in wavefront_should_cause_interrupt()
1819 bits = snd_wavefront_interrupt_bits(dev, dev->irq); in wavefront_reset_to_cleanliness()
1823 outb (0x0, dev->control_port); in wavefront_reset_to_cleanliness()
1828 Bit 7 - Enable IRQ Driver in wavefront_reset_to_cleanliness()
1829 0 - Tri-state the Wave-Board drivers for the PC Bus IRQs in wavefront_reset_to_cleanliness()
1830 1 - Enable IRQ selected by bits 5:3 to be driven onto the PC Bus. in wavefront_reset_to_cleanliness()
1832 Bit 6 - MIDI Interface Select in wavefront_reset_to_cleanliness()
1834 0 - Use the MIDI Input from the 26-pin WaveBlaster in wavefront_reset_to_cleanliness()
1835 compatible header as the serial MIDI source in wavefront_reset_to_cleanliness()
1836 1 - Use the MIDI Input from the 9-pin D connector as the in wavefront_reset_to_cleanliness()
1837 serial MIDI source. in wavefront_reset_to_cleanliness()
1839 Bits 5:3 - IRQ Selection in wavefront_reset_to_cleanliness()
1840 0 0 0 - IRQ 2/9 in wavefront_reset_to_cleanliness()
1841 0 0 1 - IRQ 5 in wavefront_reset_to_cleanliness()
1842 0 1 0 - IRQ 12 in wavefront_reset_to_cleanliness()
1843 0 1 1 - IRQ 15 in wavefront_reset_to_cleanliness()
1844 1 0 0 - Reserved in wavefront_reset_to_cleanliness()
1845 1 0 1 - Reserved in wavefront_reset_to_cleanliness()
1846 1 1 0 - Reserved in wavefront_reset_to_cleanliness()
1847 1 1 1 - Reserved in wavefront_reset_to_cleanliness()
1849 Bits 2:1 - Reserved in wavefront_reset_to_cleanliness()
1850 Bit 0 - Disable Boot ROM in wavefront_reset_to_cleanliness()
1851 0 - memory accesses to 03FC30-03FFFFH utilize the internal Boot ROM in wavefront_reset_to_cleanliness()
1852 1 - memory accesses to 03FC30-03FFFFH are directed to external in wavefront_reset_to_cleanliness()
1858 plus external 9-pin MIDI interface selected in wavefront_reset_to_cleanliness()
1861 outb (0x80 | 0x40 | bits, dev->data_port); in wavefront_reset_to_cleanliness()
1881 dev->control_port, in wavefront_reset_to_cleanliness()
1888 if (!dev->irq_ok) { in wavefront_reset_to_cleanliness()
1889 dev_err(dev->card->dev, "intr not received after h/w un-reset.\n"); in wavefront_reset_to_cleanliness()
1900 seconds - with 12MB of RAM on a Tropez+, it takes a lot in wavefront_reset_to_cleanliness()
1910 dev->data_port, ramcheck_time*HZ); in wavefront_reset_to_cleanliness()
1912 if (!dev->irq_ok) { in wavefront_reset_to_cleanliness()
1913 dev_err(dev->card->dev, "post-RAM-check interrupt not received.\n"); in wavefront_reset_to_cleanliness()
1918 dev_err(dev->card->dev, "no response to HW version cmd.\n"); in wavefront_reset_to_cleanliness()
1923 if (hwv[0] == -1) { in wavefront_reset_to_cleanliness()
1924 dev_err(dev->card->dev, "board not responding correctly.\n"); in wavefront_reset_to_cleanliness()
1935 if (hwv[0] == -1) { in wavefront_reset_to_cleanliness()
1936 dev_err(dev->card->dev, in wavefront_reset_to_cleanliness()
1937 "on-board RAM test failed (bad error code).\n"); in wavefront_reset_to_cleanliness()
1939 dev_err(dev->card->dev, in wavefront_reset_to_cleanliness()
1940 "on-board RAM test failed (error code: 0x%x).\n", in wavefront_reset_to_cleanliness()
1949 if (hwv[1] == -1) { in wavefront_reset_to_cleanliness()
1950 dev_err(dev->card->dev, "incorrect h/w response.\n"); in wavefront_reset_to_cleanliness()
1954 dev_info(dev->card->dev, "hardware version %d.%d\n", in wavefront_reset_to_cleanliness()
1973 err = request_firmware(&firmware, path, dev->card->dev); in wavefront_download_firmware()
1975 dev_err(dev->card->dev, "firmware (%s) download failed!!!\n", path); in wavefront_download_firmware()
1980 buf = firmware->data; in wavefront_download_firmware()
1986 dev_err(dev->card->dev, in wavefront_download_firmware()
1994 if (firmware->size < len + section_length) { in wavefront_download_firmware()
1995 dev_err(dev->card->dev, "firmware section read error.\n"); in wavefront_download_firmware()
2003 for (; section_length; section_length--) { in wavefront_download_firmware()
2012 dev_err(dev->card->dev, "time out for firmware ACK.\n"); in wavefront_download_firmware()
2015 err = inb(dev->data_port); in wavefront_download_firmware()
2017 dev_err(dev->card->dev, in wavefront_download_firmware()
2031 dev_err(dev->card->dev, "firmware download failed!!!\n"); in wavefront_download_firmware()
2043 dev_err(dev->card->dev, "hw reset failed.\n"); in wavefront_do_reset()
2047 if (dev->israw) { in wavefront_do_reset()
2052 dev->israw = 0; in wavefront_do_reset()
2055 this is non-obvious, and was determined by in wavefront_do_reset()
2056 using port-IO tracing in DOSemu and some in wavefront_do_reset()
2063 dev->data_port, in wavefront_do_reset()
2066 if (!dev->irq_ok) { in wavefront_do_reset()
2067 dev_err(dev->card->dev, "no post-OS interrupt.\n"); in wavefront_do_reset()
2074 dev->data_port, (10*HZ)); in wavefront_do_reset()
2076 if (!dev->irq_ok) { in wavefront_do_reset()
2077 dev_err(dev->card->dev, "no post-OS interrupt(2).\n"); in wavefront_do_reset()
2085 outb (0x80|0x40, dev->control_port); in wavefront_do_reset()
2093 dev->freemem = wavefront_freemem(dev); in wavefront_do_reset()
2094 if (dev->freemem < 0) in wavefront_do_reset()
2097 dev_info(dev->card->dev, "available DRAM %dk\n", dev->freemem / 1024); in wavefront_do_reset()
2102 dev->debug = 0; in wavefront_do_reset()
2103 dev_err(dev->card->dev, "MPU emulation mode not set.\n"); in wavefront_do_reset()
2110 dev_err(dev->card->dev, "cannot set number of voices to 32.\n"); in wavefront_do_reset()
2120 outb (0x0, dev->control_port); in wavefront_do_reset()
2121 dev->interrupts_are_midi = 0; in wavefront_do_reset()
2135 if (dev->israw) { in snd_wavefront_start()
2142 if (dev->israw || fx_raw) { in snd_wavefront_start()
2144 return -1; in snd_wavefront_start()
2149 dev->has_fx = (snd_wavefront_fx_detect (dev) == 0); in snd_wavefront_start()
2151 if (dev->has_fx && fx_raw) { in snd_wavefront_start()
2162 outb (0x80|0x40|0x20, dev->control_port); in snd_wavefront_start()
2172 snd_wavefront_t *dev = &card->wavefront; in snd_wavefront_detect()
2178 dev->israw = 0; in snd_wavefront_detect()
2179 dev->has_fx = 0; in snd_wavefront_detect()
2180 dev->debug = debug_default; in snd_wavefront_detect()
2181 dev->interrupts_are_midi = 0; in snd_wavefront_detect()
2182 dev->irq_cnt = 0; in snd_wavefront_detect()
2183 dev->rom_samples_rdonly = 1; in snd_wavefront_detect()
2187 dev->fw_version[0] = rbuf[0]; in snd_wavefront_detect()
2188 dev->fw_version[1] = rbuf[1]; in snd_wavefront_detect()
2190 dev_info(dev->card->dev, "firmware %d.%d already loaded.\n", in snd_wavefront_detect()
2197 dev->hw_version[0] = rbuf[0]; in snd_wavefront_detect()
2198 dev->hw_version[1] = rbuf[1]; in snd_wavefront_detect()
2200 dev_err(dev->card->dev, in snd_wavefront_detect()
2202 return -1; in snd_wavefront_detect()
2208 dev_info(dev->card->dev, in snd_wavefront_detect()
2210 dev->israw = 1; in snd_wavefront_detect()
2215 dev->israw = 1; in snd_wavefront_detect()
2216 dev_info(dev->card->dev, in snd_wavefront_detect()