-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
156 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include "hw/arm/ipod_touch_fmss.h" | ||
|
||
static uint64_t ipod_touch_fmss_read(void *opaque, hwaddr addr, unsigned size) | ||
{ | ||
//fprintf(stderr, "%s: read from location 0x%08x\n", __func__, addr); | ||
|
||
IPodTouchFMSSState *s = (IPodTouchFMSSState *)opaque; | ||
switch(addr) | ||
{ | ||
case FMSS__CS_BUF_RST_OK: | ||
return 0x1; | ||
case FMSS__CS_IRQ: | ||
return 0x0; | ||
case FMSS__FMCTRL1: | ||
return (0x1 << 30); | ||
default: | ||
// hw_error("%s: read invalid location 0x%08x.\n", __func__, addr); | ||
break; | ||
} | ||
return 0; | ||
} | ||
|
||
static void ipod_touch_fmss_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) | ||
{ | ||
IPodTouchFMSSState *s = (IPodTouchFMSSState *)opaque; | ||
fprintf(stderr, "%s: writing 0x%08x to 0x%08x\n", __func__, val, addr); | ||
} | ||
|
||
static const MemoryRegionOps fmss_ops = { | ||
.read = ipod_touch_fmss_read, | ||
.write = ipod_touch_fmss_write, | ||
.endianness = DEVICE_NATIVE_ENDIAN, | ||
}; | ||
|
||
static void ipod_touch_fmss_realize(DeviceState *dev, Error **errp) | ||
{ | ||
|
||
} | ||
|
||
static void ipod_touch_fmss_init(Object *obj) | ||
{ | ||
SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
DeviceState *dev = DEVICE(sbd); | ||
IPodTouchFMSSState *s = IPOD_TOUCH_FMSS(dev); | ||
|
||
memory_region_init_io(&s->iomem, obj, &fmss_ops, s, "fmss", 0x1000); | ||
sysbus_init_mmio(sbd, &s->iomem); | ||
sysbus_init_irq(sbd, &s->irq); | ||
} | ||
|
||
static void ipod_touch_fmss_class_init(ObjectClass *klass, void *data) | ||
{ | ||
DeviceClass *dc = DEVICE_CLASS(klass); | ||
|
||
dc->realize = ipod_touch_fmss_realize; | ||
} | ||
|
||
static const TypeInfo ipod_touch_fmss_info = { | ||
.name = TYPE_IPOD_TOUCH_FMSS, | ||
.parent = TYPE_SYS_BUS_DEVICE, | ||
.instance_size = sizeof(IPodTouchFMSSState), | ||
.instance_init = ipod_touch_fmss_init, | ||
.class_init = ipod_touch_fmss_class_init, | ||
}; | ||
|
||
static void ipod_touch_machine_types(void) | ||
{ | ||
type_register_static(&ipod_touch_fmss_info); | ||
} | ||
|
||
type_init(ipod_touch_machine_types) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef IPOD_TOUCH_FMSS_H | ||
#define IPOD_TOUCH_FMSS_H | ||
|
||
#include <math.h> | ||
#include "qemu/osdep.h" | ||
#include "qemu/module.h" | ||
#include "qemu/timer.h" | ||
#include "hw/sysbus.h" | ||
#include "hw/irq.h" | ||
|
||
#define TYPE_IPOD_TOUCH_FMSS "ipodtouch.fmss" | ||
OBJECT_DECLARE_SIMPLE_TYPE(IPodTouchFMSSState, IPOD_TOUCH_FMSS) | ||
|
||
#define FMSS__FMCTRL1 0x4 | ||
#define FMSS__CS_IRQ 0xC0C | ||
#define FMSS__CS_BUF_RST_OK 0xC64 | ||
|
||
typedef struct IPodTouchFMSSState | ||
{ | ||
SysBusDevice parent_obj; | ||
MemoryRegion iomem; | ||
qemu_irq irq; | ||
} IPodTouchFMSSState; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In case you haven't noticed, this device is already implemented in QEMU in
hw/block/m25p80.c
:D