diff options
author | markm <markm@FreeBSD.org> | 1997-11-10 18:31:35 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 1997-11-10 18:31:35 +0000 |
commit | 1a385f5cdc52ad58db6d17799aab3177e988a213 (patch) | |
tree | c7efd2f94120b495b46cf4aca21ce4473dea7ae5 | |
parent | 53af1df4e61b5911f54909c98c2542da81e8479e (diff) | |
download | FreeBSD-src-1a385f5cdc52ad58db6d17799aab3177e988a213.zip FreeBSD-src-1a385f5cdc52ad58db6d17799aab3177e988a213.tar.gz |
Fix conflicts.
-rw-r--r-- | sys/i386/isa/sound/ad1848.c | 54 | ||||
-rw-r--r-- | sys/i386/isa/sound/audio.c | 13 | ||||
-rw-r--r-- | sys/i386/isa/sound/dmabuf.c | 13 | ||||
-rw-r--r-- | sys/i386/isa/sound/gus_wave.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/sound/local.h | 11 | ||||
-rw-r--r-- | sys/i386/isa/sound/midibuf.c | 33 | ||||
-rw-r--r-- | sys/i386/isa/sound/os.h | 2 | ||||
-rw-r--r-- | sys/i386/isa/sound/sequencer.c | 37 | ||||
-rw-r--r-- | sys/i386/isa/sound/sound_calls.h | 2 | ||||
-rw-r--r-- | sys/i386/isa/sound/soundcard.c | 39 | ||||
-rw-r--r-- | sys/i386/isa/sound/sscape.c | 4 |
11 files changed, 140 insertions, 72 deletions
diff --git a/sys/i386/isa/sound/ad1848.c b/sys/i386/isa/sound/ad1848.c index 39a0e55..05d77fa 100644 --- a/sys/i386/isa/sound/ad1848.c +++ b/sys/i386/isa/sound/ad1848.c @@ -407,7 +407,7 @@ ad1848_mixer_set(ad1848_info * devc, int dev, int value) if (mix_devices[dev][RIGHT_CHN].nbits == 0) /* Mono control */ right = left; - retvol = left | (left << 8); + retvol = left | (right << 8); /* Scale volumes */ left = mix_cvt[left]; @@ -913,12 +913,14 @@ ad1848_prepare_for_IO(int dev, int bsize, int bcount) if (devc->irq_mode) return 0; - flags = splhigh(); fs = devc->speed_bits | (devc->format_bits << 5); if (devc->channels > 1) fs |= 0x10; old_fs = fs; + + flags = splhigh(); + if (devc->mode == MD_1845) { /* Use alternate speed select regs */ fs &= 0xf0; /* Mask off the rate select bits */ @@ -927,6 +929,7 @@ ad1848_prepare_for_IO(int dev, int bsize, int bcount) } ad_enter_MCE(devc); /* Enables changes to the format select reg */ + ad_write(devc, 8, fs); /* @@ -946,36 +949,13 @@ ad1848_prepare_for_IO(int dev, int bsize, int bcount) */ AD_WAIT_INIT(10000); } - ad_leave_MCE(devc); /* Starts the calibration process. */ - /* amancio */ - ad_enter_MCE(devc); /* Enables changes to the format select reg */ - - ad_write(devc, 8, fs); - /* - * Write to I8 starts resyncronization. Wait until it completes. - */ - AD_WAIT_INIT(10000); ad_write(devc, 9, ad_read(devc, 9) & ~0x08); - /* ad_write (devc, 9, ad_read (devc, 9) | 0x08); */ - /* - * If mode == 2 (CS4231), set I28 also. It's the capture format - * register. - */ - if (devc->mode != MD_1848) { - ad_write(devc, 28, fs); - - /* - * Write to I28 starts resyncronization. Wait until it - * completes. - */ - AD_WAIT_INIT(10000); - } + ad_leave_MCE(devc); - ad_leave_MCE(devc); /* Starts the calibration process. */ - /* amancio */ splx(flags); + devc->xfer_count = 0; #ifdef CONFIG_SEQUENCER if (dev == timer_installed && devc->timer_running) @@ -998,31 +978,27 @@ ad1848_halt(int dev) ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; u_long flags; int timeout; + flags = splhigh(); ad_mute(devc); - ad_enter_MCE(devc); - ad_write(devc, 9, ad_read(devc, 9) & ~0x03); /* Stop DMA */ - ad_write(devc, 9, ad_read(devc, 9) | 0x8); ad_write(devc, 9, ad_read(devc, 9) & ~0x03); /* Stop DMA */ - /* - * ad_write (devc, 15, 0); Clear DMA counter ad_write (devc, - * 14, 0); Clear DMA counter - */ + + ad_write(devc, 14, 0); /* Clear DMA counter */ + ad_write(devc, 15, 0); /* Clear DMA counter */ if (devc->mode != MD_1848) { ad_write(devc, 30, 0); /* Clear DMA counter */ ad_write(devc, 31, 0); /* Clear DMA counter */ } - for (timeout = 0; timeout < 1000 && !(inb(io_Status(devc)) & 0x80); + + for (timeout = 0; timeout < 1000 && !(inb(io_Status(devc)) & 0x01); timeout++); /* Wait for interrupt */ - ad_write(devc, 9, ad_read(devc, 9) & ~0x03); /* Stop DMA */ - outb(io_Status(devc), 0); /* Clear interrupt status */ outb(io_Status(devc), 0); /* Clear interrupt status */ + devc->irq_mode = 0; - ad_leave_MCE(devc); /* DMAbuf_reset_dma (dev); */ splx(flags); @@ -1499,7 +1475,7 @@ ad1848_init(char *name, int io_base, int irq, irq2dev[-irq] = devc->dev_no = my_dev; audio_devs[my_dev]->otherside = -1 ; - audio_devs[my_dev]->flags = DMA_AUTOMODE | DMA_DUPLEX; + audio_devs[my_dev]->flags |= DMA_AUTOMODE | DMA_DUPLEX; audio_devs[my_dev]->dmachan1 = dma_playback; audio_devs[my_dev]->dmachan2 = dma_capture; audio_devs[my_dev]->buffsize = DSP_BUFFSIZE; diff --git a/sys/i386/isa/sound/audio.c b/sys/i386/isa/sound/audio.c index 8e1a3c8..a485248 100644 --- a/sys/i386/isa/sound/audio.c +++ b/sys/i386/isa/sound/audio.c @@ -36,6 +36,11 @@ #define ON 1 #define OFF 0 +int +DMAbuf_poll(int dev, struct fileinfo * file, int events, select_table * wait); + +int +audio_poll(int dev, struct fileinfo * file, int events, select_table * wait); static int wr_buff_no[MAX_AUDIO_DEV]; /* != -1, if there is a incomplete output block in the queue. */ @@ -426,11 +431,11 @@ audio_ioctl(int dev, struct fileinfo * file, u_int cmd, ioctl_arg arg) } } -#ifdef ALLOW_SELECT - /* +#ifdef ALLOW_POLL +/* * XXX should we use spltty() in the select calls ? - lr970714 * - */ + */ int audio_poll(int dev, struct fileinfo * file, int events, select_table * wait) @@ -459,6 +464,6 @@ audio_poll(int dev, struct fileinfo * file, int events, select_table * wait) } return 0; } -#endif /* ALLOW_SELECT */ +#endif /* ALLOW_POLL */ #endif diff --git a/sys/i386/isa/sound/dmabuf.c b/sys/i386/isa/sound/dmabuf.c index 55b8ff1..db1824e 100644 --- a/sys/i386/isa/sound/dmabuf.c +++ b/sys/i386/isa/sound/dmabuf.c @@ -28,8 +28,17 @@ */ #include <i386/isa/sound/sound_config.h> +#include <i386/include/md_var.h> #if defined(CONFIG_AUDIO) || defined(CONFIG_GUS) +#ifdef ALLOW_POLL + +int +DMAbuf_poll(int dev, struct fileinfo * file, int events, select_table * wait); +#endif; + +static void +reorganize_buffers(int dev, struct dma_buffparms * dmap); static int *in_sleeper[MAX_AUDIO_DEV] = {NULL}; static volatile struct snd_wait in_sleep_flag[MAX_AUDIO_DEV] = {{0}}; @@ -1379,7 +1388,7 @@ DMAbuf_reset_dma(int dev) { } -#ifdef ALLOW_SELECT +#ifdef ALLOW_POLL int DMAbuf_poll(int dev, struct fileinfo * file, int events, select_table * wait) @@ -1500,7 +1509,7 @@ DMAbuf_select(int dev, struct fileinfo * file, int sel_type, select_table * wait return 0; } -#endif /* ALLOW_SELECT */ +#endif /* ALLOW_POLL */ #endif #else /* CONFIG_AUDIO */ diff --git a/sys/i386/isa/sound/gus_wave.c b/sys/i386/isa/sound/gus_wave.c index f1269f5..8cb3419 100644 --- a/sys/i386/isa/sound/gus_wave.c +++ b/sys/i386/isa/sound/gus_wave.c @@ -37,7 +37,7 @@ #define GUS_PNP_ID 0x100561e #define MAX_CARDS 8 -#define MAX_GUS_PNP 8 +#define MAX_GUS_PNP 12 /* Static ports */ @@ -61,7 +61,7 @@ IWAVE iw; #define MAX_SAMPLE 150 #define MAX_PATCH 256 -#define MAX_GUS_PNP 12 + u_int gus_pnp_found[MAX_GUS_PNP] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; diff --git a/sys/i386/isa/sound/local.h b/sys/i386/isa/sound/local.h index 8c86bd8..e42e790 100644 --- a/sys/i386/isa/sound/local.h +++ b/sys/i386/isa/sound/local.h @@ -28,6 +28,11 @@ #define CONFIG_GUSMAX #endif +#include "sscape.h" +#if NSSCAPE != 0 && !defined(CONFIG_SSCAPE) +#define CONFIG_SSCAPE +#endif + #include "trix.h" #if NTRIX > 0 #define INCLUDE_TRIX_BOOT @@ -35,7 +40,7 @@ #define CONFIG_YM3812 #endif -#if defined(CONFIG_GUSMAX) || ( NTRIX > 0 ) +#if defined(CONFIG_GUSMAX) || ( NSSCAPE > 0 ) || ( NTRIX > 0 ) #define CONFIG_AD1848 #endif @@ -86,9 +91,7 @@ #define CONFIG_YM3812 #endif -#include "sscape.h" - -#define ALLOW_SELECT +#define ALLOW_POLL /* #undef CONFIG_PAS */ /* #undef CONFIG_ADLIB */ diff --git a/sys/i386/isa/sound/midibuf.c b/sys/i386/isa/sound/midibuf.c index faddba9..e452e0a 100644 --- a/sys/i386/isa/sound/midibuf.c +++ b/sys/i386/isa/sound/midibuf.c @@ -37,6 +37,11 @@ */ #define MAX_QUEUE_SIZE 4000 +int +MIDIbuf_poll (int dev, struct fileinfo *file, int events, select_table * wait); + +void +drain_midi_queue(int dev); static int *midi_sleeper[MAX_MIDI_DEV] = {NULL}; static volatile struct snd_wait midi_sleep_flag[MAX_MIDI_DEV] = { {0}}; @@ -393,4 +398,32 @@ MIDIbuf_ioctl(int dev, struct fileinfo * file, u_int cmd, ioctl_arg arg) return midi_devs[dev]->ioctl(dev, cmd, arg); } } + +#ifdef ALLOW_POLL +int +MIDIbuf_poll (int dev, struct fileinfo *file, int events, select_table * wait) +{ + int revents = 0; + + dev = dev >> 4; + + if (events & (POLLIN | POLLRDNORM)) + if (!DATA_AVAIL (midi_in_buf[dev])) + selrecord(wait, &selinfo[dev]); + else + revents |= events & (POLLIN | POLLRDNORM); + + if (events & (POLLOUT | POLLWRNORM)) + if (SPACE_AVAIL (midi_out_buf[dev])) + selrecord(wait, &selinfo[dev]); + else + revents |= events & (POLLOUT | POLLWRNORM); + + return revents; +} + +#endif /* ALLOW_SELECT */ + + + #endif diff --git a/sys/i386/isa/sound/os.h b/sys/i386/isa/sound/os.h index 159e460..1049069 100644 --- a/sys/i386/isa/sound/os.h +++ b/sys/i386/isa/sound/os.h @@ -93,7 +93,7 @@ typedef struct sound_os_info { #define PROCESS_ABORTING( f) (f.aborting || CURSIG(curproc)) #define TIMED_OUT( f) (f.mode & WK_TIMEOUT) -#ifdef ALLOW_SELECT +#ifdef ALLOW_POLL typedef struct proc select_table; extern struct selinfo selinfo[]; #endif diff --git a/sys/i386/isa/sound/sequencer.c b/sys/i386/isa/sound/sequencer.c index ef86ed7..d6bd72d3 100644 --- a/sys/i386/isa/sound/sequencer.c +++ b/sys/i386/isa/sound/sequencer.c @@ -37,7 +37,8 @@ #include <i386/isa/sound/midi_ctrl.h> void seq_drain_midi_queues(void); - +int +sequencer_poll (int dev, struct fileinfo *file, int events, select_table * wait); static int sequencer_ok = 0; static struct sound_timer_operations *tmr; static int tmr_no = -1; /* Currently selected timer */ @@ -1677,6 +1678,40 @@ sequencer_ioctl(int dev, struct fileinfo * file, return -(EINVAL); } +#ifdef ALLOW_POLL +int +sequencer_poll (int dev, struct fileinfo *file, int events, select_table * wait) +{ + unsigned long flags; + int revents = 0; + + dev = dev >> 4; + flags = splhigh(); + + + if (events & (POLLIN | POLLRDNORM)) + if (!iqlen) + selrecord(wait, &selinfo[dev]); + else { + revents |= events & (POLLIN | POLLRDNORM); + midi_sleep_flag.mode &= ~WK_SLEEP; + } + + if (events & (POLLOUT | POLLWRNORM)) + if (qlen >= SEQ_MAX_QUEUE) + selrecord(wait, &selinfo[dev]); + else { + revents |= events & (POLLOUT | POLLWRNORM); + seq_sleep_flag.mode &= ~WK_SLEEP; + } + + splx(flags); + + return (revents); +} + +#endif + void sequencer_timer(void *dummy) diff --git a/sys/i386/isa/sound/sound_calls.h b/sys/i386/isa/sound/sound_calls.h index c0b0721..5f3a067 100644 --- a/sys/i386/isa/sound/sound_calls.h +++ b/sys/i386/isa/sound/sound_calls.h @@ -17,7 +17,7 @@ void DMAbuf_reset_dma (int dev); void DMAbuf_inputintr(int dev); void DMAbuf_outputintr(int dev, int underflow_flag); void DMAbuf_start_devices(u_int devmask); -#ifdef ALLOW_SELECT +#ifdef ALLOW_POLL int DMAbuf_select(int dev, struct fileinfo *file, int sel_type, select_table * wait); #endif diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index a653a53..a83df93 100644 --- a/sys/i386/isa/sound/soundcard.c +++ b/sys/i386/isa/sound/soundcard.c @@ -67,6 +67,14 @@ static int soundcard_configured = 0; static struct fileinfo files[SND_NDEVS]; struct selinfo selinfo[SND_NDEVS >> 4]; +int +MIDIbuf_poll (int dev, struct fileinfo *file, int events, select_table * wait); + +int +audio_poll(int dev, struct fileinfo * file, int events, select_table * wait); + +int +sequencer_poll (int dev, struct fileinfo *file, int events, select_table * wait); void sndintr __P((int unit)); int sndprobe __P((struct isa_device *)); @@ -118,9 +126,8 @@ struct isa_driver gusxvidriver = {sndprobe, sndattach, "gusxvi"}; struct isa_driver gusmaxdriver = {sndprobe, sndattach, "gusmax"}; struct isa_driver uartdriver = {sndprobe, sndattach, "uart"}; struct isa_driver mssdriver = {sndprobe, sndattach, "mss"}; - -/* XXX does this work ? lr 970714 */ -struct isa_driver sscapedriver = {sndprobe, sndattach, "ss_mss"}; +struct isa_driver sscapedriver = {sndprobe, sndattach, "sscape"}; +struct isa_driver sscape_mssdriver = {sndprobe, sndattach, "sscape_mss"}; short ipri_to_irq(u_short ipri); @@ -228,16 +235,16 @@ sndpoll(dev_t dev, int events, struct proc * p) dev = minor(dev); /* printf ("snd_select(dev=%d, rw=%d, pid=%d)\n", dev, rw, p->p_pid); */ -#ifdef ALLOW_SELECT +#ifdef ALLOW_POLL switch (dev & 0x0f) { -#ifdef EXCLUDE_SEQUENCER +#ifdef CONFIG_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_poll(dev, &files[dev], events, p); break; #endif -#ifdef EXCLUDE_MIDI +#ifdef CONFIG_MIDI case SND_DEV_MIDIN: return MIDIbuf_poll(dev, &files[dev], events, p); break; @@ -256,7 +263,7 @@ sndpoll(dev_t dev, int events, struct proc * p) return 0; } -#endif /* ALLOW_SELECT */ +#endif /* ALLOW_POLL */ DEB(printf("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg)); return 0 ; @@ -307,12 +314,14 @@ driver_to_voxunit(struct isa_driver * driver) return (SNDCARD_GUS16); else if (driver == &mssdriver) return (SNDCARD_MSS); + else if (driver == &sscapedriver) + return(SNDCARD_SSCAPE); + else if (driver == &sscape_mssdriver) + return(SNDCARD_SSCAPE_MSS); else if (driver == &trixdriver) return (SNDCARD_TRXPRO); else if (driver == &trixsbdriver) return (SNDCARD_TRXPRO_SB); - else if (driver == &sscapedriver) - return (SNDCARD_SSCAPE_MSS); else return (0); } @@ -542,8 +551,7 @@ conf_printf(char *name, struct address_info * hw_config) if (!trace_init) return; - printf("snd0: <%s> ", name); -#if 0 + printf("<%s> ", name); if (hw_config->io_base != -1 ) printf("at 0x%03x", hw_config->io_base); @@ -555,7 +563,7 @@ conf_printf(char *name, struct address_info * hw_config) if (hw_config->dma2 != -1) printf(",%d", hw_config->dma2); } -#endif + } @@ -565,10 +573,7 @@ conf_printf2(char *name, int base, int irq, int dma, int dma2) if (!trace_init) return; - printf("snd0: <%s> ", name); -#if 0 - if (hw_config->io_base != -1 ) - printf("at 0x%03x", hw_config->io_base); + printf("<%s> at 0x%03x", name, base); if (irq) printf(" irq %d", irq); @@ -578,7 +583,7 @@ conf_printf2(char *name, int base, int irq, int dma, int dma2) if (dma2 != -1) printf(",%d", dma2); } -#endif + } diff --git a/sys/i386/isa/sound/sscape.c b/sys/i386/isa/sound/sscape.c index 3ba866e..bfd5abe 100644 --- a/sys/i386/isa/sound/sscape.c +++ b/sys/i386/isa/sound/sscape.c @@ -33,6 +33,8 @@ #include <i386/isa/sound/coproc.h> +#define EXCLUDE_NATIVE_PCM + /* * I/O ports */ @@ -292,7 +294,7 @@ sscapeintr(int irq) u_char bits, tmp; static int debug = 0; - printf("sscapeintr(0x%02x)\n", (bits = sscape_read(devc, GA_INTSTAT_REG))); + DEB(printf("sscapeintr(0x%02x)\n", (bits = sscape_read(devc, GA_INTSTAT_REG)))); if ((sscape_sleep_flag.mode & WK_SLEEP)) { sscape_sleep_flag.mode = WK_WAKEUP; wakeup(sscape_sleeper); |