1998-08-31 06:35:31 +04:00
|
|
|
/* $NetBSD: beep.c,v 1.15 1998/08/31 02:35:31 mark Exp $ */
|
1996-02-01 02:14:53 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1995 Mark Brinicombe
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
1998-08-31 06:35:31 +04:00
|
|
|
* This product includes software developed by Mark Brinicombe.
|
1996-02-01 02:14:53 +03:00
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simple beep sounds using VIDC
|
1996-10-16 01:20:15 +04:00
|
|
|
*
|
|
|
|
* Added support for digital serial sound interface with
|
|
|
|
* NS LMC1982 for RC7500
|
1996-02-01 02:14:53 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To use the driver, open /dev/beep and write lines.
|
|
|
|
* Each write will generate a beep
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1998-07-07 07:05:15 +04:00
|
|
|
#include "opt_cputypes.h"
|
1998-06-03 00:41:46 +04:00
|
|
|
#include "opt_uvm.h"
|
1998-07-07 07:05:15 +04:00
|
|
|
|
1996-02-01 02:14:53 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <vm/vm.h>
|
|
|
|
#include <vm/vm_kern.h>
|
|
|
|
|
1998-06-03 00:41:46 +04:00
|
|
|
#if defined(UVM)
|
|
|
|
#include <uvm/uvm_extern.h>
|
|
|
|
#endif
|
|
|
|
|
1996-02-01 02:14:53 +03:00
|
|
|
#include <machine/irqhandler.h>
|
|
|
|
#include <machine/katelib.h>
|
|
|
|
#include <machine/vidc.h>
|
|
|
|
#include <machine/pmap.h>
|
|
|
|
#include <machine/beep.h>
|
|
|
|
#include <arm32/mainbus/mainbus.h>
|
1997-10-14 16:03:10 +04:00
|
|
|
#include <arm32/vidc/waveform.h>
|
|
|
|
#include <arm32/iomd/iomdreg.h>
|
1996-10-16 01:20:15 +04:00
|
|
|
#ifdef RC7500
|
1997-10-14 16:03:10 +04:00
|
|
|
#include <arm32/vidc/lmc1982.h>
|
1996-10-16 01:20:15 +04:00
|
|
|
#endif
|
1996-02-01 02:14:53 +03:00
|
|
|
|
|
|
|
#include "beep.h"
|
1997-07-28 22:07:03 +04:00
|
|
|
#include "locators.h"
|
1996-02-01 02:14:53 +03:00
|
|
|
|
|
|
|
struct beep_softc {
|
|
|
|
struct device sc_device;
|
|
|
|
irqhandler_t sc_ih;
|
|
|
|
int sc_iobase;
|
|
|
|
int sc_open;
|
|
|
|
int sc_count;
|
|
|
|
u_int sc_sound_cur0;
|
|
|
|
u_int sc_sound_end0;
|
|
|
|
u_int sc_sound_cur1;
|
|
|
|
u_int sc_sound_end1;
|
|
|
|
vm_offset_t sc_buffer0;
|
|
|
|
vm_offset_t sc_buffer1;
|
|
|
|
};
|
|
|
|
|
1997-10-14 16:03:10 +04:00
|
|
|
int beepprobe __P((struct device *parent, struct cfdata *cf, void *aux));
|
1996-02-01 02:14:53 +03:00
|
|
|
void beepattach __P((struct device *parent, struct device *self, void *aux));
|
|
|
|
int beepopen __P((dev_t, int, int, struct proc *));
|
|
|
|
int beepclose __P((dev_t, int, int, struct proc *));
|
1997-01-28 07:55:15 +03:00
|
|
|
int beepintr __P((void *arg));
|
1996-02-01 02:14:53 +03:00
|
|
|
void beepdma __P((struct beep_softc *sc, int buf));
|
|
|
|
|
1996-10-16 01:20:15 +04:00
|
|
|
static int sdma_channel;
|
|
|
|
|
1996-03-17 04:16:48 +03:00
|
|
|
struct cfattach beep_ca = {
|
|
|
|
sizeof(struct beep_softc), beepprobe, beepattach
|
|
|
|
};
|
|
|
|
|
1998-01-13 05:09:58 +03:00
|
|
|
extern struct cfdriver beep_cd;
|
1996-02-01 02:14:53 +03:00
|
|
|
|
|
|
|
int
|
1997-10-14 16:03:10 +04:00
|
|
|
beepprobe(parent, cf, aux)
|
1996-02-01 02:14:53 +03:00
|
|
|
struct device *parent;
|
1997-10-14 16:03:10 +04:00
|
|
|
struct cfdata *cf;
|
1996-02-01 02:14:53 +03:00
|
|
|
void *aux;
|
|
|
|
{
|
1997-10-14 16:03:10 +04:00
|
|
|
/* struct mainbus_attach_args *mb = aux;*/
|
1996-02-01 02:14:53 +03:00
|
|
|
int id;
|
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* Make sure we have an IOMD we understand */
|
1996-11-23 06:37:35 +03:00
|
|
|
id = IOMD_ID;
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* So far I only know about this IOMD */
|
1996-03-07 02:26:20 +03:00
|
|
|
switch (id) {
|
1996-10-16 01:20:15 +04:00
|
|
|
#ifdef CPU_ARM7500
|
|
|
|
case ARM7500_IOC_ID:
|
1997-10-14 16:03:10 +04:00
|
|
|
case ARM7500FE_IOC_ID:
|
1996-10-16 01:20:15 +04:00
|
|
|
sdma_channel = IRQ_SDMA;
|
|
|
|
return(1);
|
|
|
|
#else
|
1996-03-07 02:26:20 +03:00
|
|
|
case RPC600_IOMD_ID:
|
1996-10-16 01:20:15 +04:00
|
|
|
sdma_channel = IRQ_DMASCH0;
|
1996-02-01 02:14:53 +03:00
|
|
|
return(1);
|
1996-10-16 01:20:15 +04:00
|
|
|
#endif
|
1996-03-07 02:26:20 +03:00
|
|
|
default:
|
1996-10-16 01:20:15 +04:00
|
|
|
printf("beep: Unknown IOMD id=%04x\n", id);
|
1996-03-07 02:26:20 +03:00
|
|
|
break;
|
|
|
|
}
|
1996-02-01 02:14:53 +03:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
beepattach(parent, self, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct beep_softc *sc = (void *)self;
|
|
|
|
struct mainbus_attach_args *mb = aux;
|
|
|
|
|
|
|
|
sc->sc_iobase = mb->mb_iobase;
|
|
|
|
sc->sc_open = 0;
|
|
|
|
sc->sc_count = 0;
|
1998-06-03 00:41:46 +04:00
|
|
|
|
|
|
|
#if defined(UVM)
|
|
|
|
sc->sc_buffer0 = uvm_km_zalloc(kernel_map, NBPG);
|
|
|
|
#else
|
1996-02-01 02:14:53 +03:00
|
|
|
sc->sc_buffer0 = kmem_alloc(kernel_map, NBPG);
|
1998-06-03 00:41:46 +04:00
|
|
|
#endif
|
1996-02-01 02:14:53 +03:00
|
|
|
if (sc->sc_buffer0 == 0)
|
|
|
|
panic("beep: Cannot allocate buffer memory\n");
|
|
|
|
if ((sc->sc_buffer0 & (NBPG -1)) != 0)
|
|
|
|
panic("beep: Cannot allocate page aligned buffer\n");
|
|
|
|
sc->sc_buffer1 = sc->sc_buffer0;
|
|
|
|
|
|
|
|
sc->sc_sound_cur0 = pmap_extract(kernel_pmap,
|
|
|
|
(vm_offset_t)sc->sc_buffer0 & PG_FRAME);
|
|
|
|
sc->sc_sound_end0 = (sc->sc_sound_cur0 + NBPG - 16) | 0x00000000;
|
|
|
|
sc->sc_sound_cur1 = pmap_extract(kernel_pmap,
|
|
|
|
(vm_offset_t)sc->sc_buffer1 & PG_FRAME);
|
|
|
|
sc->sc_sound_end1 = (sc->sc_sound_cur1 + NBPG - 16) | 0x00000000;
|
|
|
|
|
|
|
|
bcopy(beep_waveform, (void *)sc->sc_buffer0, sizeof(beep_waveform));
|
|
|
|
|
1996-10-16 01:20:15 +04:00
|
|
|
#ifdef RC7500
|
|
|
|
/*
|
|
|
|
* Convert 8-bit data in 2's complement. We should really
|
|
|
|
* need to convert 8 bits to 16 bits.
|
|
|
|
*/
|
|
|
|
conv_jap((char *)sc->sc_buffer0, sizeof(beep_waveform));
|
|
|
|
#endif
|
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* Reset the sound DMA channel */
|
1997-10-14 16:03:10 +04:00
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURA, sc->sc_sound_cur0);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDA, sc->sc_sound_end0 | 0xc0000000);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURB, sc->sc_sound_cur1);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDB, sc->sc_sound_end1 | 0xc0000000);
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1997-10-14 16:03:10 +04:00
|
|
|
IOMD_WRITE_BYTE(IOMD_SD0CR, 0x90);
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* Install an IRQ handler */
|
1996-02-01 02:14:53 +03:00
|
|
|
sc->sc_ih.ih_func = beepintr;
|
|
|
|
sc->sc_ih.ih_arg = sc;
|
1998-08-31 06:35:31 +04:00
|
|
|
sc->sc_ih.ih_level = IPL_AUDIO;
|
1996-10-16 01:20:15 +04:00
|
|
|
#ifdef RC7500
|
|
|
|
sc->sc_ih.ih_name = "serial snd dma";
|
|
|
|
#else
|
1996-03-28 01:08:25 +03:00
|
|
|
sc->sc_ih.ih_name = "dma snd ch 0";
|
1996-10-16 01:20:15 +04:00
|
|
|
#endif
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1996-10-16 01:20:15 +04:00
|
|
|
if (irq_claim(sdma_channel, &sc->sc_ih))
|
|
|
|
panic("Cannot claim IRQ %d for beep%d\n", sdma_channel, parent->dv_unit);
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1996-10-16 01:20:15 +04:00
|
|
|
disable_irq(sdma_channel);
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* printf(" [ buf0=%08x:%08x->%08x buf1=%08x:%08x->%08x ]",
|
1996-02-01 02:14:53 +03:00
|
|
|
(u_int)sc->sc_buffer0, sc->sc_sound_cur0, sc->sc_sound_end0,
|
1998-08-31 06:35:31 +04:00
|
|
|
(u_int)sc->sc_buffer1, sc->sc_sound_cur1, sc->sc_sound_end1);*/
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("\n");
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* Set sample rate to 32us */
|
1996-02-01 02:14:53 +03:00
|
|
|
WriteWord(VIDC_BASE, VIDC_SFR | 32);
|
1996-10-16 01:20:15 +04:00
|
|
|
/* WriteWord(VIDC_BASE, VIDC_SCR | 0x05);*/
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1996-10-16 01:20:15 +04:00
|
|
|
#ifndef RC7500
|
1998-08-31 06:35:31 +04:00
|
|
|
/* Set the stereo postions to centred for all channels */
|
1996-02-01 02:14:53 +03:00
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR0 | SIR_CENTRE);
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR1 | SIR_CENTRE);
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR2 | SIR_CENTRE);
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR3 | SIR_CENTRE);
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR4 | SIR_CENTRE);
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR5 | SIR_CENTRE);
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR6 | SIR_CENTRE);
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SIR7 | SIR_CENTRE);
|
1996-10-16 01:20:15 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef RC7500
|
|
|
|
/*
|
|
|
|
* Enable serial sound. The digital serial sound interface
|
|
|
|
* consists of 16 bits sample on each channel. The waveform
|
|
|
|
* data used to generate beep sound is a 8-bits sample. I
|
|
|
|
* really don't care, since it's just beep sound.
|
|
|
|
*/
|
|
|
|
outl(VIDC_BASE, VIDC_SCR | 0x03);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Video LCD and Serial Sound Mux control. - Japanese format.
|
|
|
|
*/
|
1997-10-14 16:03:10 +04:00
|
|
|
IOMD_WRITE_BYTE(IOMD_VIDMUX, 0x02);
|
1996-10-16 01:20:15 +04:00
|
|
|
|
|
|
|
volume_ctl(VINPUTSEL, VIN1);
|
|
|
|
volume_ctl(VLOUD, 0);
|
|
|
|
volume_ctl(VBASS, VDBM0);
|
|
|
|
volume_ctl(VTREB, VDBM0);
|
|
|
|
volume_ctl(VLEFT, 24);
|
|
|
|
volume_ctl(VRIGHT, 24);
|
|
|
|
volume_ctl(VMODE, VSTEREO);
|
|
|
|
volume_ctl(VDIN, 0);
|
|
|
|
#endif
|
1996-02-01 02:14:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
beepopen(dev, flag, mode, p)
|
|
|
|
dev_t dev;
|
|
|
|
int flag;
|
|
|
|
int mode;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
|
|
|
struct beep_softc *sc;
|
|
|
|
int unit = minor(dev);
|
|
|
|
int s;
|
|
|
|
|
1996-03-17 04:16:48 +03:00
|
|
|
if (unit >= beep_cd.cd_ndevs)
|
1996-02-01 02:14:53 +03:00
|
|
|
return(ENXIO);
|
|
|
|
|
1996-03-17 04:16:48 +03:00
|
|
|
sc = beep_cd.cd_devs[unit];
|
1996-02-01 02:14:53 +03:00
|
|
|
if (!sc) return(ENXIO);
|
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* HACK hack hack */
|
1996-02-01 02:14:53 +03:00
|
|
|
s = splhigh();
|
|
|
|
if (sc->sc_open) {
|
|
|
|
(void)splx(s);
|
|
|
|
return(EBUSY);
|
|
|
|
}
|
|
|
|
|
|
|
|
++sc->sc_open;
|
|
|
|
(void)splx(s);
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
beepclose(dev, flag, mode, p)
|
|
|
|
dev_t dev;
|
|
|
|
int flag;
|
|
|
|
int mode;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
|
|
|
int unit = minor(dev);
|
1996-03-17 04:16:48 +03:00
|
|
|
struct beep_softc *sc = beep_cd.cd_devs[unit];
|
1996-02-01 02:14:53 +03:00
|
|
|
int s;
|
|
|
|
|
|
|
|
if (sc->sc_open == 0) return(ENXIO);
|
|
|
|
|
1998-08-31 06:35:31 +04:00
|
|
|
/* HACK hack hack */
|
1996-02-01 02:14:53 +03:00
|
|
|
s = splhigh();
|
|
|
|
--sc->sc_open;
|
|
|
|
(void)splx(s);
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
beep_generate(void)
|
|
|
|
{
|
1996-03-17 04:16:48 +03:00
|
|
|
struct beep_softc *sc = beep_cd.cd_devs[0];
|
1996-02-01 02:14:53 +03:00
|
|
|
/* int status;*/
|
|
|
|
|
1997-10-14 16:03:10 +04:00
|
|
|
if (sc == NULL) return;
|
|
|
|
|
1996-02-01 02:14:53 +03:00
|
|
|
if (sc->sc_count > 0) {
|
1996-10-13 07:05:43 +04:00
|
|
|
/* printf("beep: active\n");*/
|
1996-02-01 02:14:53 +03:00
|
|
|
return;
|
|
|
|
}
|
1996-10-13 07:05:43 +04:00
|
|
|
/* printf("beep: generate ");*/
|
1996-02-01 02:14:53 +03:00
|
|
|
++sc->sc_count;
|
|
|
|
|
1997-10-14 16:03:10 +04:00
|
|
|
/* status = IOMD_READ_BYTE(IOMD_SD0ST);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("st=%02x\n", status);*/
|
1997-10-14 16:03:10 +04:00
|
|
|
IOMD_WRITE_BYTE(IOMD_SD0CR, 0x90);
|
|
|
|
IOMD_WRITE_BYTE(IOMD_SD0CR, 0x30);
|
1996-02-01 02:14:53 +03:00
|
|
|
beepdma(sc, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
beepioctl(dev, cmd, data, flag, p)
|
|
|
|
dev_t dev;
|
|
|
|
int cmd;
|
|
|
|
caddr_t data;
|
|
|
|
int flag;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
1996-03-17 04:16:48 +03:00
|
|
|
struct beep_softc *sc = beep_cd.cd_devs[minor(dev)];
|
1996-02-01 02:14:53 +03:00
|
|
|
int rate;
|
|
|
|
struct wavebuffer *wave = (struct wavebuffer *)data;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case BEEP_GENERATE:
|
|
|
|
beep_generate();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BEEP_SETRATE:
|
|
|
|
rate = *(int *)data;
|
|
|
|
|
|
|
|
if (rate < 3 || rate > 255)
|
|
|
|
return(EINVAL);
|
|
|
|
|
|
|
|
WriteWord(VIDC_BASE, VIDC_SFR | rate);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BEEP_SET:
|
1996-10-16 01:20:15 +04:00
|
|
|
/* printf("set %08x\n", (u_int)data);
|
|
|
|
printf("set %08x %08x\n", (u_int)wave->addr, wave->size);*/
|
1996-02-01 02:14:53 +03:00
|
|
|
if (wave->size < 16 || wave->size > NBPG)
|
|
|
|
return(ENXIO);
|
|
|
|
copyin(wave->addr, (char *)sc->sc_buffer0, wave->size);
|
|
|
|
sc->sc_sound_end0 = (sc->sc_sound_cur0 + wave->size - 16);
|
|
|
|
sc->sc_sound_end1 = (sc->sc_sound_cur1 + wave->size - 16);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return(ENXIO);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
1997-01-28 07:55:15 +03:00
|
|
|
beepintr(arg)
|
|
|
|
void *arg;
|
1996-02-01 02:14:53 +03:00
|
|
|
{
|
1997-01-28 07:55:15 +03:00
|
|
|
struct beep_softc *sc = arg;
|
1997-10-14 16:03:10 +04:00
|
|
|
/* IOMD_WRITE_BYTE(IOMD_DMARQ, 0x10);*/
|
1996-02-01 02:14:53 +03:00
|
|
|
--sc->sc_count;
|
|
|
|
if (sc->sc_count <= 0) {
|
1997-10-14 16:03:10 +04:00
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURB, sc->sc_sound_cur1);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDB, sc->sc_sound_end1 | (1 << 30));
|
1996-10-16 01:20:15 +04:00
|
|
|
disable_irq(sdma_channel);
|
1997-10-14 16:03:10 +04:00
|
|
|
/* printf("stop:st=%02x\n", IOMD_READ_BYTE(IOMD_SD0ST));*/
|
1996-02-01 02:14:53 +03:00
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
beepdma(sc, sc->sc_count & 1);
|
1996-10-16 01:20:15 +04:00
|
|
|
return(1); /* Claim the interrupt */
|
1996-02-01 02:14:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
beepdma(sc, buf)
|
|
|
|
struct beep_softc *sc;
|
|
|
|
int buf;
|
|
|
|
{
|
|
|
|
int status;
|
1996-10-13 07:05:43 +04:00
|
|
|
/* printf("beep:dma %d", buf); */
|
1997-10-14 16:03:10 +04:00
|
|
|
status = IOMD_READ_BYTE(IOMD_SD0ST);
|
1996-10-13 07:05:43 +04:00
|
|
|
/* printf("st=%02x\n", status);*/
|
1996-02-01 02:14:53 +03:00
|
|
|
|
|
|
|
if (buf == 0) {
|
1997-10-14 16:03:10 +04:00
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURA, sc->sc_sound_cur0);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDA, sc->sc_sound_end0);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURB, sc->sc_sound_cur1);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDB, sc->sc_sound_end1 | (1 << 30));
|
1996-02-01 02:14:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (buf == 1) {
|
1997-10-14 16:03:10 +04:00
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURB, sc->sc_sound_cur1);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDB, sc->sc_sound_end1 | (1 << 30));
|
1996-02-01 02:14:53 +03:00
|
|
|
}
|
|
|
|
|
1997-10-14 16:03:10 +04:00
|
|
|
/* status = IOMD_READ_BYTE(IOMD_SD0ST);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("st=%02x\n", status);*/
|
1996-02-01 02:14:53 +03:00
|
|
|
|
1996-10-16 01:20:15 +04:00
|
|
|
enable_irq(sdma_channel);
|
1996-02-01 02:14:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* End of beep.c */
|