From patchwork Wed Feb 6 18:33:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 218749 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D57E32C02E9 for ; Thu, 7 Feb 2013 08:02:54 +1100 (EST) Received: from localhost ([::1]:33390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3C8q-0006pB-Qo for incoming@patchwork.ozlabs.org; Wed, 06 Feb 2013 16:02:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3C8j-0006ox-Jz for qemu-devel@nongnu.org; Wed, 06 Feb 2013 16:02:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3C8e-0006s4-SZ for qemu-devel@nongnu.org; Wed, 06 Feb 2013 16:02:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:54049 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U39pB-0004VF-QR for qemu-devel@nongnu.org; Wed, 06 Feb 2013 13:34:26 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 1C027A4F01; Wed, 6 Feb 2013 19:33:44 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 6 Feb 2013 19:33:29 +0100 Message-Id: <1360175610-8992-5-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360175610-8992-1-git-send-email-afaerber@suse.de> References: <1360175610-8992-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws Subject: [Qemu-devel] [PATCH v2 4/5] tmp105: Add debug output 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 From: Andreas Färber Signed-off-by: Andreas Färber --- hw/tmp105.c | 27 +++++++++++++++++++++++++-- 1 Datei geändert, 25 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) diff --git a/hw/tmp105.c b/hw/tmp105.c index 3ad2d2f..5dafa37 100644 --- a/hw/tmp105.c +++ b/hw/tmp105.c @@ -23,6 +23,18 @@ #include "tmp105.h" #include "qapi/visitor.h" +#undef DEBUG_TMP105 + +static inline void GCC_FMT_ATTR(1, 2) DPRINTF(const char *fmt, ...) +{ +#ifdef DEBUG_TMP105 + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +#endif +} + static void tmp105_interrupt_update(TMP105State *s) { qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ @@ -115,10 +127,16 @@ static void tmp105_read(TMP105State *s) s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 0; break; } + + DPRINTF("%s: %02" PRIx8 " %02" PRIx8 "%02" PRIx8 "\n", + __func__, s->pointer, s->buf[0], s->buf[1]); } static void tmp105_write(TMP105State *s) { + DPRINTF("%s: %02" PRIx8 " %02" PRIx8 "%02" PRIx8 "\n", + __func__, s->pointer, s->buf[0], s->buf[1]); + switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: break; @@ -144,18 +162,23 @@ static void tmp105_write(TMP105State *s) static int tmp105_rx(I2CSlave *i2c) { TMP105State *s = TMP105(i2c); + int ret; if (s->len < 2) { - return s->buf[s->len ++]; + ret = s->buf[s->len++]; } else { - return 0xff; + ret = 0xff; } + DPRINTF("%s: <- %02x\n", __func__, ret); + return ret; } static int tmp105_tx(I2CSlave *i2c, uint8_t data) { TMP105State *s = TMP105(i2c); + DPRINTF("%s: -> %02" PRIx8 "\n", __func__, data); + if (s->len == 0) { s->pointer = data; s->len++;