From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR46c-0006uK-FZ for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aR46Z-0005hM-7k for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR46Y-0005hA-Vy for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:47 -0500 From: John Snow Date: Wed, 3 Feb 2016 15:32:33 -0500 Message-Id: <1454531555-32022-19-git-send-email-jsnow@redhat.com> In-Reply-To: <1454531555-32022-1-git-send-email-jsnow@redhat.com> References: <1454531555-32022-1-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 18/20] gus: use IsaDma interface instead of global DMA_* functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, jsnow@redhat.com, =?UTF-8?q?Herv=C3=A9=20Poussineau?= From: Herv=C3=A9 Poussineau Signed-off-by: Herv=C3=A9 Poussineau Message-id: 1453843944-26833-18-git-send-email-hpoussin@reactos.org Signed-off-by: John Snow --- hw/audio/gus.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 47c0fcf..b416a54 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -58,6 +58,7 @@ typedef struct GUSState { SWVoiceOut *voice; int64_t last_ticks; qemu_irq pic; + IsaDma *isa_dma; } GUSState; =20 static uint32_t gus_readb(void *opaque, uint32_t nport) @@ -168,34 +169,36 @@ void GUS_irqclear (GUSEmuState *emu, int hwirq) #endif } =20 -void GUS_dmarequest (GUSEmuState *der) +void GUS_dmarequest (GUSEmuState *emu) { - /* GUSState *s =3D (GUSState *) der; */ + GUSState *s =3D emu->opaque; + IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); ldebug ("dma request %d\n", der->gusdma); - DMA_hold_DREQ (der->gusdma); + k->hold_DREQ(s->isa_dma, s->emu.gusdma); } =20 static int GUS_read_DMA (void *opaque, int nchan, int dma_pos, int dma_l= en) { GUSState *s =3D opaque; + IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); char tmpbuf[4096]; int pos =3D dma_pos, mode, left =3D dma_len - dma_pos; =20 ldebug ("read DMA %#x %d\n", dma_pos, dma_len); - mode =3D DMA_get_channel_mode (s->emu.gusdma); + mode =3D k->has_autoinitialization(s->isa_dma, s->emu.gusdma); while (left) { int to_copy =3D audio_MIN ((size_t) left, sizeof (tmpbuf)); int copied; =20 ldebug ("left=3D%d to_copy=3D%d pos=3D%d\n", left, to_copy, pos)= ; - copied =3D DMA_read_memory (nchan, tmpbuf, pos, to_copy); + copied =3D k->read_memory(s->isa_dma, nchan, tmpbuf, pos, to_cop= y); gus_dma_transferdata (&s->emu, tmpbuf, copied, left =3D=3D copie= d); left -=3D copied; pos +=3D copied; } =20 if (((mode >> 4) & 1) =3D=3D 0) { - DMA_release_DREQ (s->emu.gusdma); + k->release_DREQ(s->isa_dma, s->emu.gusdma); } return dma_len; } @@ -232,6 +235,7 @@ static void gus_realizefn (DeviceState *dev, Error **= errp) { ISADevice *d =3D ISA_DEVICE(dev); GUSState *s =3D GUS (dev); + IsaDmaClass *k; struct audsettings as; =20 AUD_register_card ("gus", &s->card); @@ -264,7 +268,9 @@ static void gus_realizefn (DeviceState *dev, Error **= errp) isa_register_portio_list (d, (s->port + 0x100) & 0xf00, gus_portio_list2, s, "gus"); =20 - DMA_register_channel (s->emu.gusdma, GUS_read_DMA, s); + s->isa_dma =3D isa_get_dma(isa_bus_from_device(d), s->emu.gusdma); + k =3D ISADMA_GET_CLASS(s->isa_dma); + k->register_channel(s->isa_dma, s->emu.gusdma, GUS_read_DMA, s); s->emu.himemaddr =3D s->himem; s->emu.gusdatapos =3D s->emu.himemaddr + 1024 * 1024 + 32; s->emu.opaque =3D s; --=20 2.4.3