Lines Matching refs:dev
118 if ((dev->debug & (cond)) == (cond)) { \
260 wavefront_status (snd_wavefront_t *dev) in wavefront_status() argument
263 return inb (dev->status_port); in wavefront_status()
276 wavefront_wait (snd_wavefront_t *dev, int mask) in wavefront_wait() argument
286 if (wavefront_status (dev) & mask) { in wavefront_wait()
294 if (wavefront_status (dev) & mask) { in wavefront_wait()
307 wavefront_read (snd_wavefront_t *dev) in wavefront_read() argument
310 if (wavefront_wait (dev, STAT_CAN_READ)) in wavefront_read()
311 return inb (dev->data_port); in wavefront_read()
319 wavefront_write (snd_wavefront_t *dev, unsigned char data) in wavefront_write() argument
322 if (wavefront_wait (dev, STAT_CAN_WRITE)) { in wavefront_write()
323 outb (data, dev->data_port); in wavefront_write()
333 snd_wavefront_cmd (snd_wavefront_t *dev, in snd_wavefront_cmd() argument
363 if (wavefront_write (dev, cmd)) { in snd_wavefront_cmd()
376 if (wavefront_write (dev, wbuf[i])) { in snd_wavefront_cmd()
395 c = wavefront_read(dev); in snd_wavefront_cmd()
406 c = wavefront_read(dev); in snd_wavefront_cmd()
465 ack = wavefront_read(dev); in snd_wavefront_cmd()
481 err = wavefront_read(dev); in snd_wavefront_cmd()
599 wavefront_delete_sample (snd_wavefront_t *dev, int sample_num) in wavefront_delete_sample() argument
608 x = snd_wavefront_cmd(dev, WFC_DELETE_SAMPLE, NULL, wbuf); in wavefront_delete_sample()
610 dev->sample_status[sample_num] = WF_ST_EMPTY; in wavefront_delete_sample()
616 wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom) in wavefront_get_sample_status() argument
625 if (snd_wavefront_cmd (dev, WFC_GET_NSAMPLES, rbuf, wbuf)) { in wavefront_get_sample_status()
630 sc_real = sc_alias = sc_multi = dev->samples_used = 0; in wavefront_get_sample_status()
637 if (snd_wavefront_cmd (dev, WFC_IDENTIFY_SAMPLE_TYPE, rbuf, wbuf)) { 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()
670 dev->samples_used++; in wavefront_get_sample_status()
675 "%d empty\n", dev->samples_used, sc_real, sc_alias, sc_multi, in wavefront_get_sample_status()
676 WF_MAX_SAMPLE - dev->samples_used); in wavefront_get_sample_status()
684 wavefront_get_patch_status (snd_wavefront_t *dev) in wavefront_get_patch_status() argument
696 x = snd_wavefront_cmd(dev, WFC_UPLOAD_PATCH, patchbuf, in wavefront_get_patch_status()
700 dev->patch_status[i] |= WF_SLOT_FILLED; in wavefront_get_patch_status()
702 dev->sample_status in wavefront_get_patch_status()
707 dev->patch_status[i] = 0; in wavefront_get_patch_status()
711 dev->patch_status[i] = 0; in wavefront_get_patch_status()
719 if (dev->patch_status[i] & WF_SLOT_FILLED) { in wavefront_get_patch_status()
722 if (dev->patch_status[i] & WF_SLOT_USED) { in wavefront_get_patch_status()
733 wavefront_get_program_status (snd_wavefront_t *dev) in wavefront_get_program_status() argument
744 x = snd_wavefront_cmd(dev, WFC_UPLOAD_PROGRAM, progbuf, in wavefront_get_program_status()
748 dev->prog_status[i] |= WF_SLOT_USED; in wavefront_get_program_status()
755 dev->patch_status in wavefront_get_program_status()
761 dev->prog_status[i] = 0; in wavefront_get_program_status()
765 dev->prog_status[i] = 0; in wavefront_get_program_status()
770 if (dev->prog_status[i]) { in wavefront_get_program_status()
781 wavefront_send_patch (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_patch() argument
790 if (header->number >= ARRAY_SIZE(dev->patch_status)) in wavefront_send_patch()
793 dev->patch_status[header->number] |= WF_SLOT_FILLED; in wavefront_send_patch()
798 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PATCH, NULL, buf)) { in wavefront_send_patch()
807 wavefront_send_program (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_program() argument
816 if (header->number >= ARRAY_SIZE(dev->prog_status)) in wavefront_send_program()
819 dev->prog_status[header->number] = WF_SLOT_USED; in wavefront_send_program()
827 dev->patch_status[header->hdr.pr.layer[i].patch_number] |= in wavefront_send_program()
839 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PROGRAM, NULL, buf)) { in wavefront_send_program()
848 wavefront_freemem (snd_wavefront_t *dev) in wavefront_freemem() argument
853 if (snd_wavefront_cmd (dev, WFC_REPORT_FREE_MEMORY, rbuf, NULL)) { in wavefront_freemem()
862 wavefront_send_sample (snd_wavefront_t *dev, in wavefront_send_sample() argument
901 x = wavefront_find_free_sample(dev); in wavefront_send_sample()
936 if (dev->rom_samples_rdonly) { in wavefront_send_sample()
937 if (dev->sample_status[header->number] & WF_SLOT_ROM) { in wavefront_send_sample()
945 wavefront_delete_sample (dev, header->number); in wavefront_send_sample()
949 dev->freemem = wavefront_freemem (dev); in wavefront_send_sample()
951 if (dev->freemem < (int)header->size) { in wavefront_send_sample()
1056 if (snd_wavefront_cmd (dev, in wavefront_send_sample()
1085 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) { in wavefront_send_sample()
1135 outw (sample_short, dev->block_port); in wavefront_send_sample()
1137 outw (sample_short, dev->last_block_port); in wavefront_send_sample()
1145 dma_ack = wavefront_read(dev); in wavefront_send_sample()
1160 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_SAMPLE); in wavefront_send_sample()
1171 wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_alias() argument
1197 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) { in wavefront_send_alias()
1202 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_ALIAS); in wavefront_send_alias()
1208 wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_multisample() argument
1248 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_MULTISAMPLE, in wavefront_send_multisample()
1256 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_MULTISAMPLE); in wavefront_send_multisample()
1263 wavefront_fetch_multisample (snd_wavefront_t *dev, in wavefront_fetch_multisample() argument
1273 if (snd_wavefront_cmd (dev, WFC_UPLOAD_MULTISAMPLE, log_ns, number)) { in wavefront_fetch_multisample()
1291 val = wavefront_read(dev); in wavefront_fetch_multisample()
1299 val = wavefront_read(dev); in wavefront_fetch_multisample()
1319 wavefront_send_drum (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_drum() argument
1336 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) { in wavefront_send_drum()
1345 wavefront_find_free_sample (snd_wavefront_t *dev) in wavefront_find_free_sample() argument
1351 if (!(dev->sample_status[i] & WF_SLOT_FILLED)) { in wavefront_find_free_sample()
1361 wavefront_find_free_patch (snd_wavefront_t *dev)
1367 if (!(dev->patch_status[i] & WF_SLOT_FILLED)) {
1377 wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr) in wavefront_load_patch() argument
1410 err = wavefront_send_sample (dev, header, header->dataptr, 0); in wavefront_load_patch()
1421 err = wavefront_send_multisample (dev, header); in wavefront_load_patch()
1432 err = wavefront_send_alias (dev, header); in wavefront_load_patch()
1442 err = wavefront_send_drum (dev, header); in wavefront_load_patch()
1452 err = wavefront_send_patch (dev, header); in wavefront_load_patch()
1462 err = wavefront_send_program (dev, header); in wavefront_load_patch()
1518 snd_wavefront_t *dev = &acard->wavefront; in wavefront_synth_control() local
1531 outb (0x80|0x20, dev->control_port); in wavefront_synth_control()
1532 dev->interrupts_are_midi = 1; in wavefront_synth_control()
1537 outb (0x80|0x40|0x20, dev->control_port); in wavefront_synth_control()
1538 dev->interrupts_are_midi = 1; in wavefront_synth_control()
1542 wc->rbuf[0] = dev->interrupts_are_midi; in wavefront_synth_control()
1546 dev->rom_samples_rdonly = wc->wbuf[0]; in wavefront_synth_control()
1558 wc->rbuf[0] = dev->sample_status[i]; in wavefront_synth_control()
1563 dev->debug = wc->wbuf[0]; in wavefront_synth_control()
1564 snd_printk ("debug = 0x%x\n", dev->debug); in wavefront_synth_control()
1577 (dev, (wavefront_patch_info *) wc->rbuf); in wavefront_synth_control()
1587 wc->status = snd_wavefront_cmd (dev, wc->cmd, wc->rbuf, wc->wbuf); in wavefront_synth_control()
1603 dev->freemem = demunge_int32 (wc->rbuf, 4); in wavefront_synth_control()
1665 snd_wavefront_t *dev; in snd_wavefront_synth_ioctl() local
1679 dev = &acard->wavefront; in snd_wavefront_synth_ioctl()
1683 if (wavefront_load_patch (dev, argp) != 0) { in snd_wavefront_synth_ioctl()
1717 snd_wavefront_t *dev = &card->wavefront; in snd_wavefront_internal_interrupt() local
1739 if ((wavefront_status(dev) & (STAT_INTR_READ|STAT_INTR_WRITE)) == 0) { in snd_wavefront_internal_interrupt()
1743 spin_lock(&dev->irq_lock); in snd_wavefront_internal_interrupt()
1744 dev->irq_ok = 1; in snd_wavefront_internal_interrupt()
1745 dev->irq_cnt++; in snd_wavefront_internal_interrupt()
1746 spin_unlock(&dev->irq_lock); in snd_wavefront_internal_interrupt()
1747 wake_up(&dev->interrupt_sleeper); in snd_wavefront_internal_interrupt()
1791 wavefront_should_cause_interrupt (snd_wavefront_t *dev, in wavefront_should_cause_interrupt() argument
1798 spin_lock_irq(&dev->irq_lock); in wavefront_should_cause_interrupt()
1799 add_wait_queue(&dev->interrupt_sleeper, &wait); in wavefront_should_cause_interrupt()
1800 dev->irq_ok = 0; in wavefront_should_cause_interrupt()
1802 spin_unlock_irq(&dev->irq_lock); in wavefront_should_cause_interrupt()
1803 while (!dev->irq_ok && time_before(jiffies, timeout)) { in wavefront_should_cause_interrupt()
1810 wavefront_reset_to_cleanliness (snd_wavefront_t *dev) in wavefront_reset_to_cleanliness() argument
1818 bits = snd_wavefront_interrupt_bits (dev->irq); in wavefront_reset_to_cleanliness()
1822 outb (0x0, dev->control_port); in wavefront_reset_to_cleanliness()
1860 outb (0x80 | 0x40 | bits, dev->data_port); in wavefront_reset_to_cleanliness()
1879 wavefront_should_cause_interrupt(dev, 0x80|0x40|0x10|0x1, in wavefront_reset_to_cleanliness()
1880 dev->control_port, in wavefront_reset_to_cleanliness()
1887 if (!dev->irq_ok) { in wavefront_reset_to_cleanliness()
1908 wavefront_should_cause_interrupt(dev, WFC_HARDWARE_VERSION, in wavefront_reset_to_cleanliness()
1909 dev->data_port, ramcheck_time*HZ); in wavefront_reset_to_cleanliness()
1911 if (!dev->irq_ok) { in wavefront_reset_to_cleanliness()
1916 if (!wavefront_wait (dev, STAT_CAN_READ)) { in wavefront_reset_to_cleanliness()
1921 hwv[0] = wavefront_read(dev); in wavefront_reset_to_cleanliness()
1933 hwv[0] = wavefront_read(dev); in wavefront_reset_to_cleanliness()
1947 hwv[1] = wavefront_read(dev); in wavefront_reset_to_cleanliness()
1964 wavefront_download_firmware (snd_wavefront_t *dev, char *path) in wavefront_download_firmware() argument
1972 err = request_firmware(&firmware, path, dev->card->dev); in wavefront_download_firmware()
1999 if (wavefront_write(dev, WFC_DOWNLOAD_OS)) in wavefront_download_firmware()
2003 if (wavefront_write(dev, *buf)) in wavefront_download_firmware()
2010 if (!wavefront_wait(dev, STAT_CAN_READ)) { in wavefront_download_firmware()
2014 err = inb(dev->data_port); in wavefront_download_firmware()
2037 wavefront_do_reset (snd_wavefront_t *dev) in wavefront_do_reset() argument
2042 if (wavefront_reset_to_cleanliness (dev)) { in wavefront_do_reset()
2047 if (dev->israw) { in wavefront_do_reset()
2048 if (wavefront_download_firmware (dev, ospath)) { in wavefront_do_reset()
2052 dev->israw = 0; in wavefront_do_reset()
2062 wavefront_should_cause_interrupt (dev, WFC_NOOP, in wavefront_do_reset()
2063 dev->data_port, in wavefront_do_reset()
2066 if (!dev->irq_ok) { in wavefront_do_reset()
2073 wavefront_should_cause_interrupt (dev, WFC_NOOP, in wavefront_do_reset()
2074 dev->data_port, (10*HZ)); in wavefront_do_reset()
2076 if (!dev->irq_ok) { 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 snd_printk ("available DRAM %dk\n", dev->freemem / 1024); in wavefront_do_reset()
2099 if (wavefront_write (dev, 0xf0) || in wavefront_do_reset()
2100 wavefront_write (dev, 1) || in wavefront_do_reset()
2101 (wavefront_read (dev) < 0)) { in wavefront_do_reset()
2102 dev->debug = 0; in wavefront_do_reset()
2109 if (snd_wavefront_cmd (dev, WFC_SET_NVOICES, NULL, voices)) { in wavefront_do_reset()
2120 outb (0x0, dev->control_port); in wavefront_do_reset()
2121 dev->interrupts_are_midi = 0; in wavefront_do_reset()
2126 snd_wavefront_start (snd_wavefront_t *dev) in snd_wavefront_start() argument
2135 if (dev->israw) { in snd_wavefront_start()
2142 if (dev->israw || fx_raw) { in snd_wavefront_start()
2143 if (wavefront_do_reset (dev)) { 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()
2152 snd_wavefront_fx_start (dev); in snd_wavefront_start()
2155 wavefront_get_sample_status (dev, samples_are_from_rom); in snd_wavefront_start()
2156 wavefront_get_program_status (dev); in snd_wavefront_start()
2157 wavefront_get_patch_status (dev); 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() local
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()
2185 if (snd_wavefront_cmd (dev, WFC_FIRMWARE_VERSION, rbuf, wbuf) == 0) { 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()
2195 if (snd_wavefront_cmd (dev, WFC_HARDWARE_VERSION, 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()
2209 dev->israw = 1; in snd_wavefront_detect()
2214 dev->israw = 1; in snd_wavefront_detect()