From patchwork Sat May 8 12:59:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1475855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=XCTcZxE2; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FcnVl3Cgqz9vFl for ; Sat, 8 May 2021 23:00:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48D7E82E6F; Sat, 8 May 2021 15:00:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="XCTcZxE2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7603C82E6E; Sat, 8 May 2021 15:00:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 03AF182D58 for ; Sat, 8 May 2021 15:00:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x333.google.com with SMTP id i23-20020a9d68d70000b02902dc19ed4c15so6343563oto.0 for ; Sat, 08 May 2021 06:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vcsTsK7ZomaihHebT+PidgvPEas3fHHCzB+8GwBZyoQ=; b=XCTcZxE2yNELiKDtbcPvPUStYAaeWIF4Lv8Ay2MnN+FIoCX7Zxrqab6X+ERM/+CwSs ZmCP5uyGLTOHhFUH9o9gjL5lSYEN1tgNdxi7YvQ2pOBfvlguOzFix6NYg32MIzJ9ROUR AnHNOOaewmLSHq4wrtItk/+tjM2HkoCQ/ukgc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vcsTsK7ZomaihHebT+PidgvPEas3fHHCzB+8GwBZyoQ=; b=JhnkBdWMSaTQrCmwUg81QDTMULghP6JlB9Sx28fGnEGU3MOdJ3vVtoH7M9MjeUxoLL yb3Ym293jrHEzQYrWWxqDS77ddVYJ2mHkeoLmzUg+Nfuvm3U9KrKNcF/kMSiBwDRdaDQ +g7ImE5FKfXaFaB+zpKOu27BdqVhL6UIqR3mWL16p7mKUCoSd2rOvv+5GhWoYCIi0aDJ ui15DUUjKANgJUwE6xuHtfeWosVPzMwjX0l8Pzb4BUhqf8C1fuuz8f/19r2uxgQAFcP+ 4XR9NdHR1HGmHAeN1Nr9sna/horc+vBmXIoizaXZ00V0Xf+bT/k5CwSSDbCAX6WY3pWZ SlNw== X-Gm-Message-State: AOAM533Cf6UG4PCj7zc/eVGPPYzGRpNERpbrpdxXTg/8wIVaMssjW77N MRKx+WIzvk8B+pxUt3o+hjgXja5Yb0LiSZoA X-Google-Smtp-Source: ABdhPJzPhAQp6zrzvBjLkt7ahCK1MWKXcrSHnGqtpxzJ4NMdYP1vcFKhLyUDR1w92VcEOA4xZLai0w== X-Received: by 2002:a05:6830:4ad:: with SMTP id l13mr3934653otd.200.1620478819131; Sat, 08 May 2021 06:00:19 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id i9sm1800200otr.19.2021.05.08.06.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 May 2021 06:00:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v2 00/12] display_options: Start to unify print_buffer() and hexdump Date: Sat, 8 May 2021 06:59:55 -0600 Message-Id: <20210508130007.1708527-1-sjg@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean At present we have two ways of showing a hex dump. Once has been in U-Boot since the dawn of time and the other was recently added from Linux. They both have their own unique features. This series makes a few changes to bring them closer together. It also adds support for logging a buffer, which is useful since it can put it through the same log drivers as other logging output. Also it adds tests, so we can check the behaviour. The code-size impact of the main part of this series is 160 bytes on Thumb2, which seems acceptable. However the final patch adds another 600 bytes or so, which is not. Changes in v2: - Drop unwanted #if at top of file - Fix sandbox build error Simon Glass (12): console: Report an error when output buffer is exhausted test: Detect when expect_str is too small test: Convert print tests to use ut framework test: Add a test for print_buffer() display_options: Drop two spaces before the ASCII column hexdump: Move API to header file hexdump: Add support for sandbox hexdump: Support any rowsize hexdump: Allow ctrl-c to interrupt output display_options: Split print_buffer() into two functions log: Add support for logging a buffer RFC: display_options: Use print_hex_dump() for print_buffer() common/console.c | 18 +- common/log.c | 30 ++++ include/asm-generic/global_data.h | 16 +- include/console.h | 3 +- include/display_options.h | 25 +++ include/hexdump.h | 81 ++++++++- include/log.h | 35 ++++ include/test/suites.h | 1 + include/test/test.h | 4 +- lib/display_options.c | 124 ++++++++----- lib/hexdump.c | 104 +++-------- test/cmd/mem_search.c | 26 +-- test/cmd_ut.c | 2 + test/dm/rtc.c | 9 +- test/log/log_test.c | 27 +++ test/print_ut.c | 284 ++++++++++++++++++++++++------ test/ut.c | 55 +++++- 17 files changed, 629 insertions(+), 215 deletions(-)