Make aucc work in the presence of LEV6_DEFER.

This commit is contained in:
is 1997-06-23 23:46:23 +00:00
parent c365104f2e
commit 7fe3065765
4 changed files with 52 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cc.c,v 1.10 1997/06/14 22:24:04 is Exp $ */
/* $NetBSD: cc.c,v 1.11 1997/06/23 23:46:23 is Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -372,7 +372,7 @@ audio_handler()
/*
* disable all audio interupts with DMA set
*/
custom.intena = (audio_dma << 7);
custom.intena = (audio_dma << INTB_AUD0) & AUCC_ALLINTF;
/*
* if no audio dma enabled then exit quick.
@ -381,20 +381,19 @@ audio_handler()
/*
* clear all interrupts.
*/
custom.intreq = INTF_AUD0|INTF_AUD1|INTF_AUD2|INTF_AUD3;
custom.intreq = AUCC_ALLINTF;
goto out;
}
for (i = 0; i < 4; i++) {
for (i = 0; i < AUCC_MAXINT; i++) {
flag = (1 << i);
ir = custom.intreqr;
/*
* is this channel's interrupt is set?
*/
if ((ir & (flag << 7)) == 0)
if ((ir & (flag << INTB_AUD0)) == 0)
continue;
#if NAUDIO>0
custom.intreq=(flag<<7);
custom.intreq=(flag<<INTB_AUD0);
/* call audio handler with channel number */
if (channel[i].isaudio==1)
if (channel[i].handler)
@ -409,14 +408,14 @@ audio_handler()
* disable interrupts to this channel
*/
custom.dmacon = flag;
custom.intena = (flag << 7);
custom.intena = (flag << INTB_AUD0);
if (channel[i].isaudio==-1)
channel[i].isaudio=0;
}
/*
* clear this channels interrupt.
*/
custom.intreq = (flag << 7);
custom.intreq = (flag << INTB_AUD0);
}
out:
@ -425,7 +424,7 @@ out:
*/
audio_dma = custom.dmaconr;
audio_dma &= (DMAF_AUD0|DMAF_AUD1|DMAF_AUD2|DMAF_AUD3);
custom.intena = INTF_SETCLR | (audio_dma << 7);
custom.intena = INTF_SETCLR | (audio_dma << INTB_AUD0);
}
void
@ -462,7 +461,7 @@ play_sample(len, data, period, volume, channels, count)
/*
* turn on interrupts and enable dma for channels and
*/
custom.intena = INTF_SETCLR | (dmabits << 7);
custom.intena = INTF_SETCLR | (dmabits << INTB_AUD0);
custom.dmacon = DMAF_SETCLR | DMAF_MASTER |dmabits;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cc.h,v 1.8 1997/06/14 22:24:02 is Exp $ */
/* $NetBSD: cc.h,v 1.9 1997/06/23 23:46:24 is Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -47,12 +47,24 @@
/*
* Audio stuff
*/
struct audio_channel {
struct audio_channel {
u_short play_count;
short isaudio;
void (*handler)(int);
};
#ifdef LEV6_DEFER
#define AUCC_MAXINT 3
#define AUCC_ALLINTF (INTF_AUD0|INTF_AUD1|INTF_AUD2)
#else
#define AUCC_MAXINT 4
#define AUCC_ALLINTF (INTF_AUD0|INTF_AUD1|INTF_AUD2|INTF_AUD3)
#endif
/*
* Define this one unconditionally; we may use AUD3 as slave channel
* with LEV6_DEFER
*/
#define AUCC_ALLDMAF (DMAF_AUD0|DMAF_AUD1|DMAF_AUD2|DMAF_AUD3)
/*
* Vertical blank iterrupt sever chains.

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.amiga,v 1.57 1997/06/21 22:13:46 is Exp $
# $NetBSD: Makefile.amiga,v 1.58 1997/06/23 23:46:27 is Exp $
# Makefile for NetBSD
#
@ -172,8 +172,10 @@ uipc_proto.o vfs_conf.o: Makefile
machdep.o: Makefile
# depend on CPU configuration
amiga_init.o locore.o pmap.o sys_machdep.o aucc.o bzsc.o flsc.o sbic.o sfas.o: Makefile
amiga_init.o locore.o pmap.o sys_machdep.o bzsc.o flsc.o sbic.o sfas.o: Makefile
# LEV6_DEFER blocks usage of audio interupt 3:
aucc.o cc.o: Makefile
locore.o: ${AMIGA}/amiga/locore.s assym.h
${NORMAL_S}

View File

@ -1,4 +1,4 @@
/* $NetBSD: aucc.c,v 1.6 1997/06/21 22:46:43 kleink Exp $ */
/* $NetBSD: aucc.c,v 1.7 1997/06/23 23:46:25 is Exp $ */
#undef AUDIO_DEBUG
/*
* Copyright (c) 1997 Stephan Thesing
@ -33,10 +33,6 @@
#include "aucc.h"
#if NAUCC > 0
#ifdef LEV6_DEFER
#error Not prepared yet for coexistance with LEV6_DEFER.
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
@ -52,6 +48,17 @@
#include <amiga/amiga/device.h>
#include <amiga/dev/auccvar.h>
#ifdef LEV6_DEFER
#define AUCC_MAXINT 3
#define AUCC_ALLINTF (INTF_AUD0|INTF_AUD1|INTF_AUD2)
#else
#define AUCC_MAXINT 4
#define AUCC_ALLINTF (INTF_AUD0|INTF_AUD1|INTF_AUD2|INTF_AUD3)
#endif
/* this unconditionally; we may use AUD3 as slave channel with LEV6_DEFER */
#define AUCC_ALLDMAF (DMAF_AUD0|DMAF_AUD1|DMAF_AUD2|DMAF_AUD3)
#ifdef AUDIO_DEBUG
/*extern printf __P((const char *,...));*/
int auccdebug = 1;
@ -295,8 +302,8 @@ init_aucc(sc)
sc->sc_channelmask=0xf;
/* clear interrupts and dma: */
custom.intena = INTF_AUD0|INTF_AUD1|INTF_AUD2|INTF_AUD3;
custom.dmacon = DMAF_AUD0|DMAF_AUD1|DMAF_AUD2|DMAF_AUD3;
custom.intena = AUCC_ALLINTF;
custom.dmacon = AUCC_ALLDMAF;;
sc->sc_encoding=AUDIO_ENCODING_ULAW;
@ -322,7 +329,7 @@ aucc_open(dev, flags)
if (sc->sc_open)
return (EBUSY);
sc->sc_open = 1;
for (i=0;i<4;i++) {
for (i=0;i<AUCC_MAXINT;i++) {
sc->sc_channel[i].nd_intr=NULL;
sc->sc_channel[i].nd_intrdata=NULL;
}
@ -565,7 +572,7 @@ aucc_start_output(addr, p, cc, intr, arg)
}
/* enable interrupt on 1st channel */
for (i=0;i<4;i++) {
for (i=0;i<AUCC_MAXINT;i++) {
if (masks2[i]&mask) {
DPRINTF(("first channel is %d\n",i));
j=i;
@ -588,8 +595,8 @@ aucc_start_output(addr, p, cc, intr, arg)
/* disable ints, dma for channels, until all parameters set */
/* XXX custom.dmacon=mask;*/
custom.intreq=mask<<7;
custom.intena=mask<<7;
custom.intreq=mask<<INTB_AUD0;
custom.intena=mask<<INTB_AUD0;
/* dma buffers: we use same buffer 4 all channels */
@ -620,9 +627,9 @@ sc->sc_channel[i].nd_per, sc->sc_channel[i].nd_volume, cc>>1));
channel[j].handler=aucc_inthdl;
/* enable ints */
custom.intena=INTF_SETCLR|INTF_INTEN| (masks2[j]<<7);
custom.intena=INTF_SETCLR|INTF_INTEN| (masks2[j]<<INTB_AUD0);
DPRINTF(("enabled ints: 0x%x\n",(masks2[j]<<7)));
DPRINTF(("enabled ints: 0x%x\n",(masks2[j]<<INTB_AUD0)));
/* enable dma */
custom.dmacon=DMAF_SETCLR|DMAF_MASTER|mask;
@ -654,8 +661,8 @@ aucc_halt_output(addr)
/* XXX only halt, if input is also halted ?? */
/* stop dma, etc */
custom.intena=INTF_AUD0|INTF_AUD1|INTF_AUD2|INTF_AUD3;
custom.dmacon = DMAF_AUD0|DMAF_AUD1|DMAF_AUD2|DMAF_AUD3;
custom.intena = AUCC_ALLINTF;
custom.dmacon = AUCC_ALLDMAF;
/* mark every busy unit idle */
for (i=0;i<4;i++) {
sc->sc_channel[i].nd_busy=sc->sc_channel[i].nd_mask=0;
@ -842,9 +849,9 @@ aucc_inthdl(int ch)
mark idle */
DPRINTF(("inthandler called, channel %d, mask 0x%x\n",ch,mask));
custom.intreq=mask<<7; /* clear request */
custom.intreq=mask<<INTB_AUD0; /* clear request */
/* XXX: maybe we can leave ints and/or DMA on, if another sample has to be played?*/
custom.intena=mask<<7;
custom.intena=mask<<INTB_AUD0;
/*
* XXX custom.dmacon=mask; NO!!!
*/