From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RunEu-00045a-Eq for qemu-devel@nongnu.org; Tue, 07 Feb 2012 10:45:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RunEk-000782-I6 for qemu-devel@nongnu.org; Tue, 07 Feb 2012 10:45:52 -0500 Received: from smtp1-g21.free.fr ([212.27.42.1]:41477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RunEj-00077j-SU for qemu-devel@nongnu.org; Tue, 07 Feb 2012 10:45:42 -0500 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Tue, 7 Feb 2012 16:46:12 +0100 Message-Id: <1328629574-11671-2-git-send-email-hpoussin@reactos.org> In-Reply-To: <1328629574-11671-1-git-send-email-hpoussin@reactos.org> References: <1328629574-11671-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v3 1/3] jazz-led: use trace framework List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , =?UTF-8?q?Herv=C3=A9=20Poussineau?= Signed-off-by: Herv=C3=A9 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" =20 typedef enum { REDRAW_NONE =3D 0, REDRAW_SEGMENTS =3D 1, REDRAW_BACKGROUND =3D 2, @@ -52,18 +42,18 @@ typedef struct LedState { static uint32_t led_readb(void *opaque, target_phys_addr_t addr) { LedState *s =3D opaque; - uint32_t val; + uint8_t val; =20 switch (addr) { case 0: val =3D s->segments; break; default: - BADF("invalid read at [" TARGET_FMT_plx "]\n", addr); + error_report("invalid read at [" TARGET_FMT_plx "]\n", addr)= ; val =3D 0; } =20 - DPRINTF("read addr=3D" TARGET_FMT_plx " val=3D0x%02x\n", addr, val); + trace_jazz_led_read(addr, val); =20 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 v= al) { LedState *s =3D opaque; + uint8_t new_val =3D val & 0xff; =20 - DPRINTF("write addr=3D" TARGET_FMT_plx " val=3D0x%02x\n", addr, val)= ; + trace_jazz_led_write(addr, new_val); =20 switch (addr) { case 0: - s->segments =3D val; + s->segments =3D new_val; s->state |=3D REDRAW_SEGMENTS; break; default: - BADF("invalid write of 0x%08x at [" TARGET_FMT_plx "]\n", va= l, 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 %"PRI= d64" =3D %02x" ecc_diag_mem_readb(uint64_t addr, uint32_t ret) "Read diagnostic %"PRId6= 4"=3D %02x" =20 +# hw/jazz-led.c +jazz_led_read(uint64_t addr, uint8_t val) "read addr=3D0x%"PRIx64": 0x%x= " +jazz_led_write(uint64_t addr, uint8_t new) "write addr=3D0x%"PRIx64": 0x= %x" + # hw/lance.c lance_mem_readw(uint64_t addr, uint32_t ret) "addr=3D%"PRIx64"val=3D0x%0= 4x" lance_mem_writew(uint64_t addr, uint32_t val) "addr=3D%"PRIx64"val=3D0x%= 04x" --=20 1.7.8.3