2 * QEMU Apple Sound Chip emulation
4 * Apple Sound Chip (ASC) 344S0063
5 * Enhanced Apple Sound Chip (EASC) 343S1063
7 * Copyright (c) 2012-2018 Laurent Vivier <laurent@vivier.eu>
8 * Copyright (c) 2022 Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef HW_AUDIO_ASC_H
14 #define HW_AUDIO_ASC_H
16 #include "hw/sysbus.h"
17 #include "audio/audio.h"
19 #define ASC_FREQ 22257
22 ASC_TYPE_ASC
= 0, /* original discrete Apple Sound Chip */
23 ASC_TYPE_EASC
= 1 /* discrete Enhanced Apple Sound Chip */
26 #define ASC_FIFO_OFFSET 0x0
27 #define ASC_FIFO_SIZE 0x400
29 #define ASC_REG_OFFSET 0x800
30 #define ASC_REG_SIZE 0x60
32 #define ASC_EXTREG_OFFSET 0xf00
33 #define ASC_EXTREG_SIZE 0x20
35 typedef struct ASCFIFOState
{
38 MemoryRegion mem_fifo
;
39 uint8_t fifo
[ASC_FIFO_SIZE
];
46 MemoryRegion mem_extregs
;
47 uint8_t extregs
[ASC_EXTREG_SIZE
];
56 SysBusDevice parent_obj
;
60 MemoryRegion mem_fifo
;
61 MemoryRegion mem_regs
;
62 MemoryRegion mem_extregs
;
72 /* Time when we were last able to generate samples */
73 int64_t fifo_empty_ns
;
77 ASCFIFOState fifos
[2];
79 uint8_t regs
[ASC_REG_SIZE
];
82 #define TYPE_ASC "apple-sound-chip"
83 OBJECT_DECLARE_SIMPLE_TYPE(ASCState
, ASC
)