From patchwork Mon Jan 9 08:41:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640584 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2028505pvb; Mon, 9 Jan 2023 00:53:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXteLUJ4LDIDkLJiGY77FyQOlhaoCxS7DDBwcxk/pYO+KIsroARxMb0XCdB1ZqzCG4riQOKi X-Received: by 2002:a05:622a:4818:b0:3ac:e03e:f93f with SMTP id fb24-20020a05622a481800b003ace03ef93fmr4777111qtb.2.1673254388035; Mon, 09 Jan 2023 00:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673254388; cv=none; d=google.com; s=arc-20160816; b=PmV5xSpORigBQ4GuBBqRqAAyMoVp/LSiF/cU1bkPZlgMNHt0qOG002a6YlhTFGGY85 YHXL0X1sxhoqqZxFiFPQB2rGeaTP8K8+h4d9e9VQtwdL3mSiZqaZ7grxtBSpubZx6NEp rQJ+wi8wQDKNP86PVOVLvYWEXDvIRr/hP4aiLfyLDWwbulL0wBWlZjakK9TztrL4T5yL l5EqfR3D5dwxUkxkkb+4R19olNga1rqNFCSkMQEPuDSDhqs5JIAHkGYanucxNMizdni4 lUHvb03CC5ptYxxoulWoA4hXbr9G5Wl7gjmg/xNNkWrVOOz6k03Rfx7vxjGTY6i+T4Uc n0Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rJ7Ld9KMG3cV36Q3MxoGtMbfv5FoM/NwLMR+8A4FApY=; b=o44r8PPXJm8iAGScaD+eUTZ28RSy6QhR/uZMSclP82MpxWElFZ9CjHKrQ+bzEnGz2Q T24ZO3bcAtLR+VNzZSTq+ORwYJMkvuOHlZKS3dn45PpuhUh2NgOeCVZvqj+5Hd8ooP59 DVOjWqmnm+Rsr13uOxRHlK2X/xnCO89tNXiuijs9R4mUwCqWIrLc7r74xYOLIhUrS+By 4uVopQ1tdUKgv9M/cKdhUqRDV4WDlqOXqRol39VTLlzvEYhsCEzmwZJDQjNkFzt/eMb8 0yZF3sZ21t7tRdxsryE9g8jjVT3+JYqG3kY9gYgsxpSSb1Ydx7K3crWlVt197YFCtrs6 Q1uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qachPbsK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p14-20020ac8740e000000b003970f9f8769si4118119qtq.560.2023.01.09.00.53.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 00:53:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qachPbsK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEnj6-0005pV-0J; Mon, 09 Jan 2023 03:41:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEnj5-0005or-1p for qemu-devel@nongnu.org; Mon, 09 Jan 2023 03:41:51 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEnj2-0002M7-SB for qemu-devel@nongnu.org; Mon, 09 Jan 2023 03:41:50 -0500 Received: by mail-wm1-x330.google.com with SMTP id p3-20020a05600c1d8300b003d9ee5f125bso1924442wms.4 for ; Mon, 09 Jan 2023 00:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rJ7Ld9KMG3cV36Q3MxoGtMbfv5FoM/NwLMR+8A4FApY=; b=qachPbsKzMR+AMKRNhD4UGtfFP1ArC77+F3/gsw6SbkjSbjkhLM6aJGpEJJWb8SFIK VnWxvcR7jgak923oQrD2S4R5+lQ+F/DYuesknN5e3oU++WaLkaGO/20/K8poZwG2yT/s TsW3t/rysBYtNucAGyfWro+1sVL5zJlBoi6IwzzjU6RStYfS+RlUh9WRxuzsSh7gh/A2 khag8XexU0XnotBkg71iwCIh1PRY1F7ztlk6118KFsXP6iDYE/7Fj0GgOSDFON9VPTs6 vdaxuD4XYWo9dsEj7pL1CTsFN74fvgElldGAd5Mwd6iWjxai0HJTtLV+twrpujKkKzEP RQPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rJ7Ld9KMG3cV36Q3MxoGtMbfv5FoM/NwLMR+8A4FApY=; b=rco7oE5NvcuWLCI26B69LE2J27yFMIk+UT1MANAlDj4d1xX/cZmZt88J+pUtPzU+Gu tGorTlnYCRUYJ4vHR/0KV78p1FWopapnactr/jrcmY+elZ9QqS3svQuxI7gKeGNdwKID te2y/gVdAkfAdZYniY9jwpT8pMVC2CX8LtEOoIQBukhI871Pfexd9U+e2c47KVoQz32w FkzS03Q9WKxKESSEZQRXxGDRW3LIF6ikpBXKRHYd3DvOKZ/ADwi4Mv2ogEqDAPKlzB2+ H7HMyeESZy+ZB09qh6u4Fl4JjX18JuMEJ1S8/00CCMeAhcFHGmjCfc+bhu1ch1xG41Jh JomQ== X-Gm-Message-State: AFqh2kpVlQBXl84d79QPvxu4Iw14ZYPT7z85vTSuQmxgxC42TqgWMTUU fpWWomAjI7VBAPnf5Ds/QjBvLl2CXZyGX0cr X-Received: by 2002:a7b:ce8e:0:b0:3d7:1b84:e377 with SMTP id q14-20020a7bce8e000000b003d71b84e377mr47660529wmj.27.1673253707375; Mon, 09 Jan 2023 00:41:47 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id he5-20020a05600c540500b003d9ed40a512sm4853414wmb.45.2023.01.09.00.41.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 00:41:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, qemu-trivial@nongnu.org, Jan Kiszka , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 5/5] hw/i2c/bitbang_i2c: Convert DPRINTF() to trace events Date: Mon, 9 Jan 2023 09:41:21 +0100 Message-Id: <20230109084121.72138-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109084121.72138-1-philmd@linaro.org> References: <20230109084121.72138-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert the remaining DPRINTF debug macro uses to tracepoints. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- 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 9fa19cf8b1..ffc5b95410 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 *sname[] = { @@ -72,8 +64,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; } @@ -138,11 +132,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) { @@ -162,7 +156,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 2a479c1c12..b0ab237b0f 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