qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 07/26] hw/i2c/bitbang_i2c: Convert DPRINTF() to trace events
Date: Mon, 23 Jan 2023 13:35:34 +0000	[thread overview]
Message-ID: <20230123133553.2171158-8-peter.maydell@linaro.org> (raw)
In-Reply-To: <20230123133553.2171158-1-peter.maydell@linaro.org>

From: Philippe Mathieu-Daudé <philmd@linaro.org>

Convert the remaining DPRINTF debug macro uses to tracepoints.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Corey Minyard <cminyard@mvista.com>
Message-id: 20230111085016.44551-6-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/i2c/bitbang_i2c.c | 18 ++++++------------
 hw/i2c/trace-events  |  4 ++++
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index efc49b7502f..bb189547651 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -18,14 +18,6 @@
 #include "qom/object.h"
 #include "trace.h"
 
-//#define DEBUG_BITBANG_I2C
-
-#ifdef DEBUG_BITBANG_I2C
-#define DPRINTF(fmt, ...) \
-do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#endif
 
 /* bitbang_i2c_state enum to name */
 static const char * const sname[] = {
@@ -71,8 +63,10 @@ static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c)
 /* Set device data pin.  */
 static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level)
 {
+    trace_bitbang_i2c_data(i2c->last_clock, i2c->last_data,
+                           i2c->device_out, level);
     i2c->device_out = level;
-    //DPRINTF("%d %d %d\n", i2c->last_clock, i2c->last_data, i2c->device_out);
+
     return level & i2c->last_data;
 }
 
@@ -137,11 +131,11 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level)
 
         if (i2c->current_addr < 0) {
             i2c->current_addr = i2c->buffer;
-            DPRINTF("Address 0x%02x\n", i2c->current_addr);
+            trace_bitbang_i2c_addr(i2c->current_addr);
             ret = i2c_start_transfer(i2c->bus, i2c->current_addr >> 1,
                                      i2c->current_addr & 1);
         } else {
-            DPRINTF("Sent 0x%02x\n", i2c->buffer);
+            trace_bitbang_i2c_send(i2c->buffer);
             ret = i2c_send(i2c->bus, i2c->buffer);
         }
         if (ret) {
@@ -161,7 +155,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level)
     }
     case RECEIVING_BIT7:
         i2c->buffer = i2c_recv(i2c->bus);
-        DPRINTF("RX byte 0x%02x\n", i2c->buffer);
+        trace_bitbang_i2c_recv(i2c->buffer);
         /* Fall through... */
     case RECEIVING_BIT6 ... RECEIVING_BIT0:
         data = i2c->buffer >> 7;
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index 48aee4887c4..8e88aa24c1a 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -2,6 +2,10 @@
 
 # bitbang_i2c.c
 bitbang_i2c_state(const char *old_state, const char *new_state) "state %s -> %s"
+bitbang_i2c_addr(uint8_t addr) "Address 0x%02x"
+bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x"
+bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x"
+bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned new_out) "dat %u clk %u out %u -> %u"
 
 # core.c
 
-- 
2.34.1



  parent reply	other threads:[~2023-01-23 14:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 13:35 [PULL 00/26] target-arm queue Peter Maydell
2023-01-23 13:35 ` [PULL 01/26] target/arm: Widen cnthctl_el2 to uint64_t Peter Maydell
2023-01-23 13:35 ` [PULL 02/26] target/arm: Unify checking for M Main Extension in MRS/MSR Peter Maydell
2023-01-23 13:35 ` [PULL 03/26] hw/i2c/bitbang_i2c: Define TYPE_GPIO_I2C in public header Peter Maydell
2023-01-23 13:35 ` [PULL 04/26] hw/i2c/bitbang_i2c: Remove unused dummy MemoryRegion Peter Maydell
2023-01-23 13:35 ` [PULL 05/26] hw/i2c/bitbang_i2c: Change state calling bitbang_i2c_set_state() helper Peter Maydell
2023-01-23 13:35 ` [PULL 06/26] hw/i2c/bitbang_i2c: Trace state changes Peter Maydell
2023-01-23 13:35 ` Peter Maydell [this message]
2023-01-23 13:35 ` [PULL 08/26] hw/i2c/versatile_i2c: Drop useless casts from void * to pointer Peter Maydell
2023-01-23 13:35 ` [PULL 09/26] hw/i2c/versatile_i2c: Replace VersatileI2CState -> ArmSbconI2CState Peter Maydell
2023-01-23 13:35 ` [PULL 10/26] hw/i2c/versatile_i2c: Replace TYPE_VERSATILE_I2C -> TYPE_ARM_SBCON_I2C Peter Maydell
2023-01-23 13:35 ` [PULL 11/26] hw/i2c/versatile_i2c: Use ARM_SBCON_I2C() macro Peter Maydell
2023-01-23 13:35 ` [PULL 12/26] hw/i2c/versatile_i2c: Rename versatile_i2c -> arm_sbcon_i2c Peter Maydell
2023-01-23 13:35 ` [PULL 13/26] target/arm/sme: Reorg SME access handling in handle_msr_i() Peter Maydell
2023-01-23 13:35 ` [PULL 14/26] target/arm/sme: Rebuild hflags in set_pstate() helpers Peter Maydell
2023-01-23 13:35 ` [PULL 15/26] target/arm/sme: Introduce aarch64_set_svcr() Peter Maydell
2023-01-23 13:35 ` [PULL 16/26] target/arm/sme: Reset SVE state in aarch64_set_svcr() Peter Maydell
2023-01-23 13:35 ` [PULL 17/26] target/arm/sme: Reset ZA " Peter Maydell
2023-01-23 13:35 ` [PULL 18/26] target/arm/sme: Rebuild hflags " Peter Maydell
2023-01-23 13:35 ` [PULL 19/26] target/arm/sme: Unify set_pstate() SM/ZA helpers as set_svcr() Peter Maydell
2023-01-23 13:35 ` [PULL 20/26] target/arm: Fix physical address resolution for MTE Peter Maydell
2023-01-23 13:35 ` [PULL 21/26] target/arm: Fix in_debug path in S1_ptw_translate Peter Maydell
2023-01-23 13:35 ` [PULL 22/26] target/arm: Don't set EXC_RETURN.ES if Security Extension not present Peter Maydell
2023-01-23 13:35 ` [PULL 23/26] target/arm: implement DBGCLAIM registers Peter Maydell
2023-01-23 13:35 ` [PULL 24/26] target/arm: provide stubs for more external debug registers Peter Maydell
2023-01-23 13:35 ` [PULL 25/26] target/arm: Reorg do_coproc_insn Peter Maydell
2023-01-23 13:35 ` [PULL 26/26] target/arm: Look up ARMCPRegInfo at runtime Peter Maydell
2023-01-23 15:17 ` [PULL 00/26] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230123133553.2171158-8-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).