|
@@ -0,0 +1,108 @@
|
|
|
+/*
|
|
|
+ * QEMU PowerMac Awacs Screamer device support
|
|
|
+ *
|
|
|
+ * Copyright (c) 2016 Mark Cave-Ayland
|
|
|
+ *
|
|
|
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
+ * of this software and associated documentation files (the "Software"), to deal
|
|
|
+ * in the Software without restriction, including without limitation the rights
|
|
|
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
+ * copies of the Software, and to permit persons to whom the Software is
|
|
|
+ * furnished to do so, subject to the following conditions:
|
|
|
+ *
|
|
|
+ * The above copyright notice and this permission notice shall be included in
|
|
|
+ * all copies or substantial portions of the Software.
|
|
|
+ *
|
|
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
+ * THE SOFTWARE.
|
|
|
+ */
|
|
|
+
|
|
|
+#include "qemu/osdep.h"
|
|
|
+#include "hw/hw.h"
|
|
|
+#include "hw/audio/screamer.h"
|
|
|
+#include "hw/qdev-properties.h"
|
|
|
+#include "qemu/timer.h"
|
|
|
+#include "sysemu/sysemu.h"
|
|
|
+#include "qemu/cutils.h"
|
|
|
+#include "qemu/log.h"
|
|
|
+
|
|
|
+/* debug screamer */
|
|
|
+//#define DEBUG_SCREAMER
|
|
|
+
|
|
|
+#ifdef DEBUG_SCREAMER
|
|
|
+#define SCREAMER_DPRINTF(fmt, ...) \
|
|
|
+ do { printf("SCREAMER: " fmt , ## __VA_ARGS__); } while (0)
|
|
|
+#else
|
|
|
+#define SCREAMER_DPRINTF(fmt, ...)
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+static void screamer_reset(DeviceState *dev)
|
|
|
+{
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+static void screamer_realizefn(DeviceState *dev, Error **errp)
|
|
|
+{
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+static uint64_t screamer_read(void *opaque, hwaddr addr, unsigned size)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static void screamer_write(void *opaque, hwaddr addr,
|
|
|
+ uint64_t val, unsigned size)
|
|
|
+{
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+static const MemoryRegionOps screamer_ops = {
|
|
|
+ .read = screamer_read,
|
|
|
+ .write = screamer_write,
|
|
|
+ .endianness = DEVICE_BIG_ENDIAN
|
|
|
+};
|
|
|
+
|
|
|
+static void screamer_initfn(Object *obj)
|
|
|
+{
|
|
|
+ SysBusDevice *d = SYS_BUS_DEVICE(obj);
|
|
|
+ ScreamerState *s = SCREAMER(obj);
|
|
|
+
|
|
|
+ memory_region_init_io(&s->mem, obj, &screamer_ops, s, "screamer", 0x2000);
|
|
|
+ sysbus_init_mmio(d, &s->mem);
|
|
|
+ sysbus_init_irq(d, &s->irq);
|
|
|
+}
|
|
|
+
|
|
|
+static Property screamer_properties[] = {
|
|
|
+ DEFINE_PROP_END_OF_LIST()
|
|
|
+};
|
|
|
+
|
|
|
+static void screamer_class_init(ObjectClass *oc, void *data)
|
|
|
+{
|
|
|
+ DeviceClass *dc = DEVICE_CLASS(oc);
|
|
|
+
|
|
|
+ dc->realize = screamer_realizefn;
|
|
|
+ dc->reset = screamer_reset;
|
|
|
+ device_class_set_props(dc, screamer_properties);
|
|
|
+}
|
|
|
+
|
|
|
+static const TypeInfo screamer_type_info = {
|
|
|
+ .name = TYPE_SCREAMER,
|
|
|
+ .parent = TYPE_SYS_BUS_DEVICE,
|
|
|
+ .instance_size = sizeof(ScreamerState),
|
|
|
+ .instance_init = screamer_initfn,
|
|
|
+ .class_init = screamer_class_init,
|
|
|
+};
|
|
|
+
|
|
|
+static void screamer_register_types(void)
|
|
|
+{
|
|
|
+ type_register_static(&screamer_type_info);
|
|
|
+}
|
|
|
+
|
|
|
+type_init(screamer_register_types)
|