[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [RFC v3 05/10] hw/m68k: Apple Sound Chip (ASC) emulatio
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-block] [RFC v3 05/10] hw/m68k: Apple Sound Chip (ASC) emulation |
Date: |
Thu, 28 Jun 2018 12:12:47 +0100 |
User-agent: |
Mutt/1.10.0 (2018-05-17) |
* Laurent Vivier (address@hidden) wrote:
> This is broken as the linux driver seems broken too...
>
> Co-developed-by: Mark Cave-Ayland <address@hidden>
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
> +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 <address@hidden>
> + *
> + * 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 / address@hidden / Manchester, UK
- [Qemu-block] [RFC v3 01/10] hw/m68k: add via support, (continued)
- [Qemu-block] [RFC v3 01/10] hw/m68k: add via support, Laurent Vivier, 2018/06/27
- [Qemu-block] [RFC v3 09/10] dp8393x: manage big endian bus, Laurent Vivier, 2018/06/27
- [Qemu-block] [RFC v3 06/10] ESP: add pseudo-DMA as used by Macintosh, Laurent Vivier, 2018/06/27
- [Qemu-block] [RFC v3 04/10] hw/m68k: add video card, Laurent Vivier, 2018/06/27
- [Qemu-block] [RFC v3 07/10] hw/m68k: add Nubus support, Laurent Vivier, 2018/06/27
- [Qemu-block] [RFC v3 05/10] hw/m68k: Apple Sound Chip (ASC) emulation, Laurent Vivier, 2018/06/27
- Re: [Qemu-block] [RFC v3 05/10] hw/m68k: Apple Sound Chip (ASC) emulation,
Dr. David Alan Gilbert <=
- [Qemu-block] [RFC v3 08/10] hw/m68k: add a dummy SWIM floppy controller, Laurent Vivier, 2018/06/27
- [Qemu-block] [RFC v3 10/10] hw/m68k: define Macintosh Quadra 800, Laurent Vivier, 2018/06/27
- Re: [Qemu-block] [Qemu-devel] [RFC v3 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine, Mark Cave-Ayland, 2018/06/29