aboutsummaryrefslogtreecommitdiff
path: root/hw/tosa.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-04 08:43:54 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-04 08:43:54 +0000
commit6bc1d858d1cb37c4d7a982051d93190d070b50dd (patch)
tree986a5c753ac6536065323928fd952f40edf751cd /hw/tosa.c
parenta6569fc532698a7df1cc9c04f26503727a5a5bfd (diff)
Tosa: emulate LEDs (Dmitry Baryshkov).
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5612 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/tosa.c')
-rw-r--r--hw/tosa.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/hw/tosa.c b/hw/tosa.c
index 75df52ec7d..e629044aa9 100644
--- a/hw/tosa.c
+++ b/hw/tosa.c
@@ -27,11 +27,17 @@
#define TOSA_GPIO_CF_CD (13)
#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */
-#define TOSA_SCOOP_GPIO_BASE 0
+#define TOSA_SCOOP_GPIO_BASE 1
#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2)
#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3)
#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4)
+#define TOSA_SCOOP_JC_GPIO_BASE 1
+#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0)
+#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1)
+#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2)
+#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7)
+
static void tosa_microdrive_attach(struct pxa2xx_state_s *cpu)
{
struct pcmcia_card_s *md;
@@ -48,10 +54,33 @@ static void tosa_microdrive_attach(struct pxa2xx_state_s *cpu)
}
}
+static void tosa_out_switch(void *opaque, int line, int level)
+{
+ switch (line) {
+ case 0:
+ fprintf(stderr, "blue LED %s.\n", level ? "on" : "off");
+ break;
+ case 1:
+ fprintf(stderr, "green LED %s.\n", level ? "on" : "off");
+ break;
+ case 2:
+ fprintf(stderr, "amber LED %s.\n", level ? "on" : "off");
+ break;
+ case 3:
+ fprintf(stderr, "wlan LED %s.\n", level ? "on" : "off");
+ break;
+ default:
+ fprintf(stderr, "Uhandled out event: %d = %d\n", line, level);
+ break;
+ }
+}
+
+
static void tosa_gpio_setup(struct pxa2xx_state_s *cpu,
struct scoop_info_s *scp0,
struct scoop_info_s *scp1)
{
+ qemu_irq *outsignals = qemu_allocate_irqs(tosa_out_switch, cpu, 4);
/* MMC/SD host */
pxa2xx_mmci_handlers(cpu->mmc,
scoop_gpio_in_get(scp0)[TOSA_GPIO_SD_WP],
@@ -69,6 +98,10 @@ static void tosa_gpio_setup(struct pxa2xx_state_s *cpu,
pxa2xx_gpio_in_get(cpu->gpio)[TOSA_GPIO_JC_CF_IRQ],
NULL);
+ scoop_gpio_out_set(scp1, TOSA_GPIO_BT_LED, outsignals[0]);
+ scoop_gpio_out_set(scp1, TOSA_GPIO_NOTE_LED, outsignals[1]);
+ scoop_gpio_out_set(scp1, TOSA_GPIO_CHRG_ERR_LED, outsignals[2]);
+ scoop_gpio_out_set(scp1, TOSA_GPIO_WLAN_LED, outsignals[3]);
}
static struct arm_boot_info tosa_binfo = {