From 8e129e0748f866d730f1e39bff296219fedac244 Mon Sep 17 00:00:00 2001 From: balrog Date: Sun, 28 Oct 2007 19:24:52 +0000 Subject: Handle MMC card insertion/removal/readonly signals. Hook them up to Palm T|E GPIOs. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3471 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/omap_mmc.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'hw/omap_mmc.c') diff --git a/hw/omap_mmc.c b/hw/omap_mmc.c index aa77660f28..008318db36 100644 --- a/hw/omap_mmc.c +++ b/hw/omap_mmc.c @@ -25,6 +25,7 @@ struct omap_mmc_s { target_phys_addr_t base; qemu_irq irq; qemu_irq *dma; + qemu_irq handler[2]; omap_clk clk; SDState *card; uint16_t last_cmd; @@ -506,6 +507,22 @@ void omap_mmc_reset(struct omap_mmc_s *host) host->transfer = 0; } +static void omap_mmc_ro_cb(void *opaque, int level) +{ + struct omap_mmc_s *s = (struct omap_mmc_s *) opaque; + + if (s->handler[0]) + qemu_set_irq(s->handler[0], level); +} + +static void omap_mmc_cover_cb(void *opaque, int level) +{ + struct omap_mmc_s *s = (struct omap_mmc_s *) opaque; + + if (s->handler[1]) + qemu_set_irq(s->handler[1], level); +} + struct omap_mmc_s *omap_mmc_init(target_phys_addr_t base, qemu_irq irq, qemu_irq dma[], omap_clk clk) { @@ -525,7 +542,13 @@ struct omap_mmc_s *omap_mmc_init(target_phys_addr_t base, /* Instantiate the storage */ s->card = sd_init(sd_bdrv); + sd_set_cb(s->card, s, omap_mmc_ro_cb, omap_mmc_cover_cb); + return s; } -/* TODO: insertion and read-only handlers */ +void omap_mmc_handlers(struct omap_mmc_s *s, qemu_irq ro, qemu_irq cover) +{ + s->handler[0] = ro; + s->handler[1] = cover; +} -- cgit v1.2.3