|
From: <bob...@us...> - 2007-07-19 07:20:27
|
Revision: 1180
http://svn.sourceforge.net/hackndev/?rev=1180&view=rev
Author: bobofdoom
Date: 2007-07-19 00:20:25 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
QEMU: Started adding support for pxa270 matrix keypad interface.
Modified Paths:
--------------
qemu/trunk/Makefile.target
Added Paths:
-----------
qemu/trunk/hw/pxa270_keypad.c
Modified: qemu/trunk/Makefile.target
===================================================================
--- qemu/trunk/Makefile.target 2007-07-19 01:08:06 UTC (rev 1179)
+++ qemu/trunk/Makefile.target 2007-07-19 07:20:25 UTC (rev 1180)
@@ -469,7 +469,7 @@
VL_OBJS+= arm-semi.o
VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o max111x.o max7310.o
-VL_OBJS+= palm.o mdoc.o
+VL_OBJS+= palm.o mdoc.o pxa270_keypad.o
VL_OBJS+= spitz.o ads7846.o ide.o serial.o nand.o $(AUDIODRV) wm8750.o wm8753.o
VL_OBJS+= s3c2410.o s3c24xx_gpio.o s3c24xx_lcd.o s3c24xx_mmci.o s3c24xx_rtc.o
VL_OBJS+= s3c24xx_udc.o neo1973.o pcf5060x.o jbt6k74.o
Added: qemu/trunk/hw/pxa270_keypad.c
===================================================================
--- qemu/trunk/hw/pxa270_keypad.c (rev 0)
+++ qemu/trunk/hw/pxa270_keypad.c 2007-07-19 07:20:25 UTC (rev 1180)
@@ -0,0 +1,106 @@
+/*
+ * Intel XScale PXA270 Keypad Interface emulation.
+ *
+ * Copyright (c) 2007 Alex Osborne <bob...@gm...>
+ *
+ * This code is licensed under the GPL (version 2 or later).
+ */
+
+#include "vl.h"
+
+#define PXA2XX_GPIO_BANKS 4
+
+struct pxa270_keypad_s {
+ target_phys_addr_t base;
+};
+#define KPC 0x00
+#define KPDK 0x08
+#define KPREC 0x10
+#define KPMK 0x18
+#define KPAS 0x20
+#define KPASMKP0 0x28
+#define KPASMKP1 0x30
+#define KPASMKP2 0x38
+#define KPASMKP3 0x40
+#define KPKDI 0x48
+
+#if 0
+static struct {
+ enum {
+ } reg;
+ int bank;
+} pxa270_keypad_regs[0x200] = {
+ [0 ... 0x1ff] = { KP_NONE, 0 },
+#define PXA2XX_REG(reg, a0, a1, a2, a3) \
+ [a0] = { reg, 0 }, [a1] = { reg, 1 }, [a2] = { reg, 2 }, [a3] = { reg, 3 },
+
+ PXA2XX_REG(GPLR, 0x000, 0x004, 0x008, 0x100)
+ PXA2XX_REG(GPSR, 0x018, 0x01c, 0x020, 0x118)
+ PXA2XX_REG(GPCR, 0x024, 0x028, 0x02c, 0x124)
+ PXA2XX_REG(GPDR, 0x00c, 0x010, 0x014, 0x10c)
+ PXA2XX_REG(GRER, 0x030, 0x034, 0x038, 0x130)
+ PXA2XX_REG(GFER, 0x03c, 0x040, 0x044, 0x13c)
+ PXA2XX_REG(GEDR, 0x048, 0x04c, 0x050, 0x148)
+ PXA2XX_REG(GAFR_L, 0x054, 0x05c, 0x064, 0x06c)
+ PXA2XX_REG(GAFR_U, 0x058, 0x060, 0x068, 0x070)
+};
+#endif
+
+static uint32_t pxa270_keypad_read(void *opaque, target_phys_addr_t offset)
+{
+ struct pxa270_keypad_s *s = (struct pxa270_keypad_s *) opaque;
+ offset -= s->base;
+ if (offset >= 0x200)
+ return 0;
+
+ return 0;
+}
+
+static void pxa270_keypad_write(void *opaque,
+ target_phys_addr_t offset, uint32_t value)
+{
+ struct pxa270_keypad_s *s = (struct pxa270_keypad_s *) opaque;
+ offset -= s->base;
+ if (offset >= 0x200)
+ return;
+
+}
+
+static CPUReadMemoryFunc *pxa270_keypad_readfn[] = {
+ pxa270_keypad_read,
+ pxa270_keypad_read,
+ pxa270_keypad_read
+};
+
+static CPUWriteMemoryFunc *pxa270_keypad_writefn[] = {
+ pxa270_keypad_write,
+ pxa270_keypad_write,
+ pxa270_keypad_write
+};
+
+static void pxa270_keypad_handler(struct pxa270_keypad_s *s, int keycode)
+{
+ printf("Got keycode: %08x\n", keycode);
+}
+
+
+struct pxa270_keypad_s *pxa270_keypad_init(target_phys_addr_t base)
+{
+ int iomemtype;
+ struct pxa270_keypad_s *s;
+
+ s = (struct pxa270_keypad_s *)
+ qemu_mallocz(sizeof(struct pxa270_keypad_s));
+ memset(s, 0, sizeof(struct pxa270_keypad_s));
+
+ iomemtype = cpu_register_io_memory(0, pxa270_keypad_readfn,
+ pxa270_keypad_writefn, s);
+ cpu_register_physical_memory(base, 0x00001000, iomemtype);
+
+ qemu_add_kbd_event_handler((QEMUPutKBDEvent *) pxa270_keypad_handler, s);
+ /* TODO: register_savevm("pxa270_keypad", 0, 0,
+ pxa270_keypad_save, pxa2xx_gpio_load, s); */
+
+ return s;
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|