Commit 6bc1d858d1cb37c4d7a982051d93190d070b50dd

Authored by balrog
1 parent a6569fc5

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
Showing 1 changed file with 34 additions and 1 deletions
hw/tosa.c
... ... @@ -27,11 +27,17 @@
27 27 #define TOSA_GPIO_CF_CD (13)
28 28 #define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */
29 29  
30   -#define TOSA_SCOOP_GPIO_BASE 0
  30 +#define TOSA_SCOOP_GPIO_BASE 1
31 31 #define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2)
32 32 #define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3)
33 33 #define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4)
34 34  
  35 +#define TOSA_SCOOP_JC_GPIO_BASE 1
  36 +#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0)
  37 +#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1)
  38 +#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2)
  39 +#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7)
  40 +
35 41 static void tosa_microdrive_attach(struct pxa2xx_state_s *cpu)
36 42 {
37 43 struct pcmcia_card_s *md;
... ... @@ -48,10 +54,33 @@ static void tosa_microdrive_attach(struct pxa2xx_state_s *cpu)
48 54 }
49 55 }
50 56  
  57 +static void tosa_out_switch(void *opaque, int line, int level)
  58 +{
  59 + switch (line) {
  60 + case 0:
  61 + fprintf(stderr, "blue LED %s.\n", level ? "on" : "off");
  62 + break;
  63 + case 1:
  64 + fprintf(stderr, "green LED %s.\n", level ? "on" : "off");
  65 + break;
  66 + case 2:
  67 + fprintf(stderr, "amber LED %s.\n", level ? "on" : "off");
  68 + break;
  69 + case 3:
  70 + fprintf(stderr, "wlan LED %s.\n", level ? "on" : "off");
  71 + break;
  72 + default:
  73 + fprintf(stderr, "Uhandled out event: %d = %d\n", line, level);
  74 + break;
  75 + }
  76 +}
  77 +
  78 +
51 79 static void tosa_gpio_setup(struct pxa2xx_state_s *cpu,
52 80 struct scoop_info_s *scp0,
53 81 struct scoop_info_s *scp1)
54 82 {
  83 + qemu_irq *outsignals = qemu_allocate_irqs(tosa_out_switch, cpu, 4);
55 84 /* MMC/SD host */
56 85 pxa2xx_mmci_handlers(cpu->mmc,
57 86 scoop_gpio_in_get(scp0)[TOSA_GPIO_SD_WP],
... ... @@ -69,6 +98,10 @@ static void tosa_gpio_setup(struct pxa2xx_state_s *cpu,
69 98 pxa2xx_gpio_in_get(cpu->gpio)[TOSA_GPIO_JC_CF_IRQ],
70 99 NULL);
71 100  
  101 + scoop_gpio_out_set(scp1, TOSA_GPIO_BT_LED, outsignals[0]);
  102 + scoop_gpio_out_set(scp1, TOSA_GPIO_NOTE_LED, outsignals[1]);
  103 + scoop_gpio_out_set(scp1, TOSA_GPIO_CHRG_ERR_LED, outsignals[2]);
  104 + scoop_gpio_out_set(scp1, TOSA_GPIO_WLAN_LED, outsignals[3]);
72 105 }
73 106  
74 107 static struct arm_boot_info tosa_binfo = {
... ...