From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR46Z-0006oQ-KW for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aR46Y-0005h4-Kp for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR46Y-0005ge-EZ for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:46 -0500 From: John Snow Date: Wed, 3 Feb 2016 15:32:32 -0500 Message-Id: <1454531555-32022-18-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 17/20] cs4231a: 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-17-git-send-email-hpoussin@reactos.org Signed-off-by: John Snow --- hw/audio/cs4231a.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index b0c7c93..3ecd058 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -70,6 +70,7 @@ typedef struct CSState { uint32_t irq; uint32_t dma; uint32_t port; + IsaDma *isa_dma; int shift; int dma_running; int audio_free; @@ -265,6 +266,7 @@ static void cs_reset_voices (CSState *s, uint32_t val= ) { int xtal; struct audsettings as; + IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); =20 #ifdef DEBUG_XLAW if (val =3D=3D 0 || val =3D=3D 32) @@ -328,7 +330,7 @@ static void cs_reset_voices (CSState *s, uint32_t val= ) =20 if (s->dregs[Interface_Configuration] & PEN) { if (!s->dma_running) { - DMA_hold_DREQ (s->dma); + k->hold_DREQ(s->isa_dma, s->dma); AUD_set_active_out (s->voice, 1); s->transferred =3D 0; } @@ -336,7 +338,7 @@ static void cs_reset_voices (CSState *s, uint32_t val= ) } else { if (s->dma_running) { - DMA_release_DREQ (s->dma); + k->release_DREQ(s->isa_dma, s->dma); AUD_set_active_out (s->voice, 0); } s->dma_running =3D 0; @@ -345,7 +347,7 @@ static void cs_reset_voices (CSState *s, uint32_t val= ) =20 error: if (s->dma_running) { - DMA_release_DREQ (s->dma); + k->release_DREQ(s->isa_dma, s->dma); AUD_set_active_out (s->voice, 0); } } @@ -453,7 +455,8 @@ static void cs_write (void *opaque, hwaddr addr, } else { if (s->dma_running) { - DMA_release_DREQ (s->dma); + IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); + k->release_DREQ(s->isa_dma, s->dma); AUD_set_active_out (s->voice, 0); s->dma_running =3D 0; } @@ -518,6 +521,7 @@ static int cs_write_audio (CSState *s, int nchan, int= dma_pos, { int temp, net; uint8_t tmpbuf[4096]; + IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); =20 temp =3D len; net =3D 0; @@ -532,7 +536,7 @@ static int cs_write_audio (CSState *s, int nchan, int= dma_pos, to_copy =3D sizeof (tmpbuf); } =20 - copied =3D DMA_read_memory (nchan, tmpbuf, dma_pos, to_copy); + copied =3D k->read_memory(s->isa_dma, nchan, tmpbuf, dma_pos, to= _copy); if (s->tab) { int i; int16_t linbuf[4096]; @@ -600,7 +604,8 @@ static int cs4231a_pre_load (void *opaque) CSState *s =3D opaque; =20 if (s->dma_running) { - DMA_release_DREQ (s->dma); + IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); + k->release_DREQ(s->isa_dma, s->dma); AUD_set_active_out (s->voice, 0); } s->dma_running =3D 0; @@ -656,13 +661,15 @@ static void cs4231a_realizefn (DeviceState *dev, Er= ror **errp) { ISADevice *d =3D ISA_DEVICE (dev); CSState *s =3D CS4231A (dev); + IsaDmaClass *k; =20 isa_init_irq (d, &s->pic, s->irq); + s->isa_dma =3D isa_get_dma(isa_bus_from_device(d), s->dma); + k =3D ISADMA_GET_CLASS(s->isa_dma); + k->register_channel(s->isa_dma, s->dma, cs_dma_read, s); =20 isa_register_ioport (d, &s->ioports, s->port); =20 - DMA_register_channel (s->dma, cs_dma_read, s); - AUD_register_card ("cs4231a", &s->card); } =20 --=20 2.4.3