From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxHW6-00080j-Fk for qemu-devel@nongnu.org; Tue, 04 Nov 2008 03:44:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxHW4-00080C-0q for qemu-devel@nongnu.org; Tue, 04 Nov 2008 03:44:01 -0500 Received: from [199.232.76.173] (port=35916 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxHW3-000806-Rx for qemu-devel@nongnu.org; Tue, 04 Nov 2008 03:43:59 -0500 Received: from savannah.gnu.org ([199.232.41.3]:46340 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KxHW2-0006id-PG for qemu-devel@nongnu.org; Tue, 04 Nov 2008 03:43:59 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KxHVy-0006ep-Ko for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:43:54 +0000 Received: from balrog by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KxHVy-0006el-Fl for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:43:54 +0000 MIME-Version: 1.0 Errors-To: balrog Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Andrzej Zaborowski Message-Id: Date: Tue, 04 Nov 2008 08:43:54 +0000 Subject: [Qemu-devel] [5612] Tosa: emulate LEDs (Dmitry Baryshkov). Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5612 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5612 Author: balrog Date: 2008-11-04 08:43:54 +0000 (Tue, 04 Nov 2008) Log Message: ----------- Tosa: emulate LEDs (Dmitry Baryshkov). Signed-off-by: Dmitry Baryshkov Signed-off-by: Andrzej Zaborowski Modified Paths: -------------- trunk/hw/tosa.c Modified: trunk/hw/tosa.c =================================================================== --- trunk/hw/tosa.c 2008-11-04 08:42:00 UTC (rev 5611) +++ trunk/hw/tosa.c 2008-11-04 08:43:54 UTC (rev 5612) @@ -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_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 @@ 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 = {