From patchwork Wed Feb 1 22:28:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 139016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2D2D61007D1 for ; Thu, 2 Feb 2012 09:28:29 +1100 (EST) Received: from localhost ([::1]:53558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsifA-0001Cb-QI for incoming@patchwork.ozlabs.org; Wed, 01 Feb 2012 17:28:24 -0500 Received: from eggs.gnu.org ([140.186.70.92]:32834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rsif0-00018g-G1 for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:28:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rsiey-0003Ww-UP for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:28:14 -0500 Received: from smtp1-g21.free.fr ([212.27.42.1]:60589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rsiey-0003Vw-7t for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:28:12 -0500 Received: from localhost.localdomain (unknown [82.227.227.196]) by smtp1-g21.free.fr (Postfix) with ESMTP id 96E95940169; Wed, 1 Feb 2012 23:28:06 +0100 (CET) From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= To: qemu-devel@nongnu.org Date: Wed, 1 Feb 2012 23:28:31 +0100 Message-Id: <1328135314-13858-2-git-send-email-hpoussin@reactos.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1328135314-13858-1-git-send-email-hpoussin@reactos.org> References: <1328135314-13858-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 212.27.42.1 Cc: Anthony Liguori , =?UTF-8?q?Herv=C3=A9=20Poussineau?= Subject: [Qemu-devel] [PATCH v2 1/3] jazz-led: use trace framework X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Hervé Poussineau --- hw/jazz_led.c | 26 +++++++++----------------- trace-events | 4 ++++ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/hw/jazz_led.c b/hw/jazz_led.c index f8a2182..1af9268 100644 --- a/hw/jazz_led.c +++ b/hw/jazz_led.c @@ -26,17 +26,7 @@ #include "mips.h" #include "console.h" #include "pixel_ops.h" - -//#define DEBUG_LED - -#ifdef DEBUG_LED -#define DPRINTF(fmt, ...) \ -do { printf("jazz led: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) do {} while (0) -#endif -#define BADF(fmt, ...) \ -do { fprintf(stderr, "jazz led ERROR: " fmt , ## __VA_ARGS__);} while (0) +#include "trace.h" typedef enum { REDRAW_NONE = 0, REDRAW_SEGMENTS = 1, REDRAW_BACKGROUND = 2, @@ -52,18 +42,18 @@ typedef struct LedState { static uint32_t led_readb(void *opaque, target_phys_addr_t addr) { LedState *s = opaque; - uint32_t val; + uint8_t val; switch (addr) { case 0: val = s->segments; break; default: - BADF("invalid read at [" TARGET_FMT_plx "]\n", addr); + error_report("invalid read at [" TARGET_FMT_plx "]\n", addr); val = 0; } - DPRINTF("read addr=" TARGET_FMT_plx " val=0x%02x\n", addr, val); + trace_jazz_led_read(addr, val); return val; } @@ -101,16 +91,18 @@ static uint32_t led_readl(void *opaque, target_phys_addr_t addr) static void led_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) { LedState *s = opaque; + uint8_t new_val = val & 0xff; - DPRINTF("write addr=" TARGET_FMT_plx " val=0x%02x\n", addr, val); + trace_jazz_led_write(addr, new_val); switch (addr) { case 0: - s->segments = val; + s->segments = new_val; s->state |= REDRAW_SEGMENTS; break; default: - BADF("invalid write of 0x%08x at [" TARGET_FMT_plx "]\n", val, addr); + error_report("invalid write of 0x%x at [" TARGET_FMT_plx "]\n", + new_val, addr); break; } } diff --git a/trace-events b/trace-events index 5d05749..d112de4 100644 --- a/trace-events +++ b/trace-events @@ -140,6 +140,10 @@ ecc_mem_readl_ecr1(uint32_t ret) "Read event count 2 %08x" ecc_diag_mem_writeb(uint64_t addr, uint32_t val) "Write diagnostic %"PRId64" = %02x" ecc_diag_mem_readb(uint64_t addr, uint32_t ret) "Read diagnostic %"PRId64"= %02x" +# hw/jazz-led.c +jazz_led_read(uint64_t addr, uint8_t val) "read addr=0x%"PRIx64": 0x%x" +jazz_led_write(uint64_t addr, uint8_t new) "write addr=0x%"PRIx64": 0x%x" + # hw/lance.c lance_mem_readw(uint64_t addr, uint32_t ret) "addr=%"PRIx64"val=0x%04x" lance_mem_writew(uint64_t addr, uint32_t val) "addr=%"PRIx64"val=0x%04x"