qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, "Yongbok Kim" <yongbok.kim@mips.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	qemu-block@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Jason Wang" <jasowang@redhat.com>, "Fam Zheng" <famz@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [RFC v3 05/10] hw/m68k: Apple Sound Chip (ASC) emulation
Date: Thu, 28 Jun 2018 12:12:47 +0100	[thread overview]
Message-ID: <20180628111247.GB2536@work-vm> (raw)
In-Reply-To: <20180627232951.14725-6-laurent@vivier.eu>

* Laurent Vivier (laurent@vivier.eu) wrote:
> This is broken as the linux driver seems broken too...
> 
> Co-developed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---

> +static int asc_post_load(void *opaque, int version_id)
> +{
> +    return 0;
> +}

Why does that exist?

> +static const VMStateDescription vmstate_asc = {
> +    .name = "apple-sound-chip",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .minimum_version_id_old = 1,
> +    .post_load = asc_post_load,
> +    .fields      = (VMStateField[]) {
> +        VMSTATE_END_OF_LIST()
> +    }
> +};

Similarly, that doesn't have anything to migrate.

Dave

> +static void asc_reset(DeviceState *d)
> +{
> +    ASCState *s = ASC(d);
> +
> +    AUD_set_active_out(s->channel, 0);
> +
> +    memset(s->regs, 0, sizeof(s->regs));
> +    s->a_wptr = 0;
> +    s->a_rptr = 0;
> +    s->a_cnt = 0;
> +    s->b_wptr = 0;
> +    s->b_rptr = 0;
> +    s->b_cnt = 0;
> +}
> +
> +static void asc_init(Object *obj)
> +{
> +    ASCState *s = ASC(obj);
> +    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
> +    struct audsettings as;
> +
> +    AUD_register_card("Apple Sound Chip", &s->card);
> +
> +    as.freq = 22257;
> +    as.nchannels = 2;
> +    as.fmt = AUD_FMT_S8;
> +    as.endianness = 0;
> +
> +    s->channel = AUD_open_out(&s->card, s->channel, "asc.out",
> +                              s, asc_out_cb, &as);
> +
> +    s->fifo = g_malloc0(ASC_BUF_SIZE);
> +
> +    memory_region_init_io(&s->mem_regs, NULL, &asc_mmio_ops, s, "asc",
> +                          ASC_LENGTH);
> +
> +    sysbus_init_irq(sbd, &s->irq);
> +    sysbus_init_mmio(sbd, &s->mem_regs);
> +}
> +
> +static Property asc_properties[] = {
> +    DEFINE_PROP_UINT8("asctype", ASCState, type, ASC_TYPE_ASC),
> +    DEFINE_PROP_END_OF_LIST(),
> +};
> +
> +static void asc_class_init(ObjectClass *oc, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(oc);
> +
> +    dc->reset = asc_reset;
> +    dc->vmsd = &vmstate_asc;
> +    dc->props = asc_properties;
> +}
> +
> +static TypeInfo asc_info = {
> +    .name = TYPE_ASC,
> +    .parent = TYPE_SYS_BUS_DEVICE,
> +    .instance_size = sizeof(ASCState),
> +    .instance_init = asc_init,
> +    .class_init = asc_class_init,
> +};
> +
> +static void asc_register_types(void)
> +{
> +    type_register_static(&asc_info);
> +}
> +
> +type_init(asc_register_types)
> diff --git a/include/hw/audio/asc.h b/include/hw/audio/asc.h
> new file mode 100644
> index 0000000000..3540e32f69
> --- /dev/null
> +++ b/include/hw/audio/asc.h
> @@ -0,0 +1,48 @@
> +/*
> + *  Copyright (c) 2012-2018 Laurent Vivier <laurent@vivier.eu>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + */
> +
> +#ifndef HW_AUDIO_ASC_H
> +#define HW_AUDIO_ASC_H
> +
> +#include "qemu/osdep.h"
> +#include "hw/sysbus.h"
> +#include "audio/audio.h"
> +
> +enum {
> +    ASC_TYPE_ASC    = 0,  /* original discrete Apple Sound Chip */
> +    ASC_TYPE_EASC   = 1,  /* discrete Enhanced Apple Sound Chip */
> +    ASC_TYPE_V8     = 2,  /* ASC included in the V8 ASIC (LC/LCII) */
> +    ASC_TYPE_EAGLE  = 3,  /* ASC included in the Eagle ASIC (Classic II) */
> +    ASC_TYPE_SPICE  = 4,  /* ASC included in the Spice ASIC (Color Classic) */
> +    ASC_TYPE_SONORA = 5,  /* ASC included in the Sonora ASIC (LCIII) */
> +    ASC_TYPE_VASP   = 6,  /* ASC included in the VASP ASIC  (IIvx/IIvi) */
> +    ASC_TYPE_ARDBEG = 7   /* ASC included in the Ardbeg ASIC (LC520) */
> +};
> +
> +typedef struct ASCState {
> +    SysBusDevice parent_obj;
> +
> +    MemoryRegion mem_regs;
> +    QEMUSoundCard card;
> +    SWVoiceOut *channel;
> +
> +    qemu_irq irq;
> +
> +    uint8_t type;
> +    int a_wptr, a_rptr, a_cnt;
> +    int b_wptr, b_rptr, b_cnt;
> +
> +    uint8_t *fifo;
> +
> +    uint8_t regs[48];
> +} ASCState;
> +
> +#define TYPE_ASC "apple-sound-chip"
> +#define ASC(obj) OBJECT_CHECK(ASCState, (obj), TYPE_ASC)
> +
> +#endif
> -- 
> 2.14.4
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2018-06-28 11:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27 23:29 [Qemu-devel] [RFC v3 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine Laurent Vivier
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 01/10] hw/m68k: add via support Laurent Vivier
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 02/10] ADB: VIA probes ADB bus when it is idle Laurent Vivier
2018-06-28 11:30   ` Dr. David Alan Gilbert
2018-06-29 18:28   ` Mark Cave-Ayland
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 03/10] escc: introduce a selector for the register bit Laurent Vivier
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 04/10] hw/m68k: add video card Laurent Vivier
2018-06-28 12:03   ` Dr. David Alan Gilbert
2018-07-09 17:03   ` Thomas Huth
2018-08-07  8:44     ` Gerd Hoffmann
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 05/10] hw/m68k: Apple Sound Chip (ASC) emulation Laurent Vivier
2018-06-28 11:12   ` Dr. David Alan Gilbert [this message]
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 06/10] ESP: add pseudo-DMA as used by Macintosh Laurent Vivier
2018-06-28  8:13   ` Paolo Bonzini
2018-06-28  8:27     ` Laurent Vivier
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 07/10] hw/m68k: add Nubus support Laurent Vivier
2018-06-29 18:31   ` Mark Cave-Ayland
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 08/10] hw/m68k: add a dummy SWIM floppy controller Laurent Vivier
2018-06-28 19:55   ` Hervé Poussineau
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 09/10] dp8393x: manage big endian bus Laurent Vivier
2018-07-08 21:11   ` Peter Maydell
2018-07-08 22:17     ` Hervé Poussineau
2018-06-27 23:29 ` [Qemu-devel] [RFC v3 10/10] hw/m68k: define Macintosh Quadra 800 Laurent Vivier
2018-06-29 18:20 ` [Qemu-devel] [RFC v3 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine Mark Cave-Ayland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628111247.GB2536@work-vm \
    --to=dgilbert@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=famz@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).