From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR46c-0006uL-Fo 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 1aR46a-0005hi-1l for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR46Z-0005hb-Rl for qemu-devel@nongnu.org; Wed, 03 Feb 2016 15:32:48 -0500 From: John Snow Date: Wed, 3 Feb 2016 15:32:34 -0500 Message-Id: <1454531555-32022-20-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 19/20] sb16: 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-19-git-send-email-hpoussin@reactos.org Signed-off-by: John Snow --- hw/audio/sb16.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 3b2dcfd..6f8816c 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -56,6 +56,8 @@ typedef struct SB16State { uint32_t hdma; uint32_t port; uint32_t ver; + IsaDma *isa_dma; + IsaDma *isa_hdma; =20 int in_index; int out_data_len; @@ -166,16 +168,18 @@ static void speaker (SB16State *s, int on) static void control (SB16State *s, int hold) { int dma =3D s->use_hdma ? s->hdma : s->dma; + IsaDma *isa_dma =3D s->use_hdma ? s->isa_hdma : s->isa_dma; + IsaDmaClass *k =3D ISADMA_GET_CLASS(isa_dma); s->dma_running =3D hold; =20 ldebug ("hold %d high %d dma %d\n", hold, s->use_hdma, dma); =20 if (hold) { - DMA_hold_DREQ (dma); + k->hold_DREQ(isa_dma, dma); AUD_set_active_out (s->voice, 1); } else { - DMA_release_DREQ (dma); + k->release_DREQ(isa_dma, dma); AUD_set_active_out (s->voice, 0); } } @@ -1137,6 +1141,8 @@ static uint32_t mixer_read(void *opaque, uint32_t n= port) static int write_audio (SB16State *s, int nchan, int dma_pos, int dma_len, int len) { + IsaDma *isa_dma =3D nchan =3D=3D s->dma ? s->isa_dma : s->isa_hdma; + IsaDmaClass *k =3D ISADMA_GET_CLASS(isa_dma); int temp, net; uint8_t tmpbuf[4096]; =20 @@ -1153,7 +1159,7 @@ static int write_audio (SB16State *s, int nchan, in= t dma_pos, to_copy =3D sizeof (tmpbuf); } =20 - copied =3D DMA_read_memory (nchan, tmpbuf, dma_pos, to_copy); + copied =3D k->read_memory(isa_dma, nchan, tmpbuf, dma_pos, to_co= py); copied =3D AUD_write (s->voice, tmpbuf, copied); =20 temp -=3D copied; @@ -1355,6 +1361,7 @@ static void sb16_realizefn (DeviceState *dev, Error= **errp) { ISADevice *isadev =3D ISA_DEVICE (dev); SB16State *s =3D SB16 (dev); + IsaDmaClass *k; =20 isa_init_irq (isadev, &s->pic, s->irq); =20 @@ -1373,8 +1380,14 @@ static void sb16_realizefn (DeviceState *dev, Erro= r **errp) =20 isa_register_portio_list (isadev, s->port, sb16_ioport_list, s, "sb1= 6"); =20 - DMA_register_channel (s->hdma, SB_read_DMA, s); - DMA_register_channel (s->dma, SB_read_DMA, s); + s->isa_hdma =3D isa_get_dma(isa_bus_from_device(isadev), s->hdma); + k =3D ISADMA_GET_CLASS(s->isa_hdma); + k->register_channel(s->isa_hdma, s->hdma, SB_read_DMA, s); + + s->isa_dma =3D isa_get_dma(isa_bus_from_device(isadev), s->dma); + k =3D ISADMA_GET_CLASS(s->isa_dma); + k->register_channel(s->isa_dma, s->dma, SB_read_DMA, s); + s->can_write =3D 1; =20 AUD_register_card ("sb16", &s->card); --=20 2.4.3