From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14C3FC433EF for ; Wed, 19 Jan 2022 03:09:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4424183178; Wed, 19 Jan 2022 04:09:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MAUo4oIF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 42E86835CA; Wed, 19 Jan 2022 04:09:29 +0100 (CET) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 B200382DA1 for ; Wed, 19 Jan 2022 04:09:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x102d.google.com with SMTP id l16so1184292pjl.4 for ; Tue, 18 Jan 2022 19:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=JuspXNbHGiVsU1TfAe6Wk61pe+CIj5p6StUq6LfiC6I=; b=MAUo4oIFoSt+7dkVb6s3I5XwZNtKhRoW+kDazJ4Bf4fpCnHJTCVuJ6c4w9pZ44M55c pNRN6ew8INFekBVeE6yh6Lq2s2Zp7X/6J7DOXMQaAOJ1rcZv13DLFLljsVW0JYFF8BKI TaW9jkpVyXybHl3klf9wmjxIyfLyHtUKOT6DZr3FczRkMD6MsmfyT6wTTGmaGJVSbzl3 4eqm5qsYyM8jWlQg2WxKvug5T2xVdAfU64kOXlRFQGzIp2qCfgSltO3DSfMCrQgzdFG3 LeCohwkoY0bVb0bkFIK7PRXQWYuX9HhBUYnK8FbyEXqUctORD1ZoHyWlmN8IWpaUsC6E 9t5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=JuspXNbHGiVsU1TfAe6Wk61pe+CIj5p6StUq6LfiC6I=; b=zBY12GdpZHWneKp+kB+uxWV+cItJHb1HLpBAI7AL55H5ZFIIH2Pl70YWEGM73lsbRr 5Vhrpcy11Fsb+DSCD+pBjdlDp3wChhWXTVCcIy7hRGRMPy2iO6ooQ5DhP7F0gCskpV5v Ro4r+fcPqNUcRUXsVOR7LvVtNvigTN7H/pUDS5ormNPXItPyyRN90qUKr2dKdcvuSSRJ L9H433AVxWyJWJ6CSXsKis8Ti5PwkVZ0pbA32TduT1F+4ttF+OyvKp/WWCL076+S1XVc izZbUM8SYFQZ2QU4dByR9mcp7LAnqX0ObsIcRSrq9R3tdz08NI5uMUP3+yQbFbXMfp29 mArA== X-Gm-Message-State: AOAM532hm78no1NgOho/q1x6r2w/0FsDabANoD4Ddm2aG3i/7e1FVqY0 gc0tPK8sQLyGlxACEFHi3Gm6rg== X-Google-Smtp-Source: ABdhPJwMziuxCwxLP4UUqAZEdfbiVQtZAA+xAuD555x+h8MJCeo9EMV5l3ovfezV1d5YG41Co18kGA== X-Received: by 2002:a17:902:ea04:b0:14a:642a:accb with SMTP id s4-20020a170902ea0400b0014a642aaccbmr30843919plg.13.1642561763868; Tue, 18 Jan 2022 19:09:23 -0800 (PST) Received: from laputa (p914133-ipoe.ipoe.ocn.ne.jp. [153.243.15.132]) by smtp.gmail.com with ESMTPSA id me11sm4349796pjb.34.2022.01.18.19.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 19:09:23 -0800 (PST) Date: Wed, 19 Jan 2022 12:09:17 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: Tom Rini , u-boot@lists.denx.de Subject: Re: [PATCH 1/1] doc: printf() codes Message-ID: <20220119030917.GA61490@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , Tom Rini , u-boot@lists.denx.de References: <20220119002300.75709-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220119002300.75709-1-heinrich.schuchardt@canonical.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.2 at phobos.denx.de X-Virus-Status: Clean Heinrich, Thank you for additional work. On Wed, Jan 19, 2022 at 01:23:00AM +0100, Heinrich Schuchardt wrote: > Document the format specifier codes used by U-Boot's printf() > implementation. > > Signed-off-by: Heinrich Schuchardt > --- > doc/develop/index.rst | 1 + > doc/develop/printf.rst | 132 +++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 133 insertions(+) > create mode 100644 doc/develop/printf.rst > > diff --git a/doc/develop/index.rst b/doc/develop/index.rst > index 9592d193fc..c84b10ea88 100644 > --- a/doc/develop/index.rst > +++ b/doc/develop/index.rst > @@ -21,6 +21,7 @@ Implementation > logging > makefiles > menus > + printf > uefi/index > version > > diff --git a/doc/develop/printf.rst b/doc/develop/printf.rst > new file mode 100644 > index 0000000000..6a1266618e > --- /dev/null > +++ b/doc/develop/printf.rst > @@ -0,0 +1,132 @@ > +.. SPDX-License-Identifier: GPL-2.0+ > + > +Printf() format codes > +===================== > + > +Integer types > +------------- > + > +Integer qualifiers > +'''''''''''''''''' > + > +Inter qualifers describe how integer types are passed as arguments. > + > +no specifier > + int (used for bool, enum, short, int) > + > +%h > + int, consider only the low 16 bits low -> lower? (think of the opposite, "upper" or "higher") > + > +%l > + long > + > +%ll, %L > + long long > + > +%t > + ptr_diff_t ptrdiff_t > + > +%z, %Z > + size_t, ssize_t > + > +Format specifiers > +''''''''''''''''' > + > +Format specifiers control the output. > + > +%d > + signed decimal > + > +%u > + unsigned decimal > + > +%x > + lower case hexadecimal > + > +%X > + upper case hexadecimal > + > +The following tables shows the correct combinations of qulifiers and specifiers > +for the individual integer types. > + > +=================== ===================== > +Type Format specifier > +=================== ===================== > +bool %d, %x > +char %d, %x and %X? > +unsigned char %u, %x > +short %d, %x > +unsigned short %u, %x > +int %d, %x > +unsigned int %d, %x > +long %ld, %lx > +unsigned long %lu, %lx > +long long %lld, %llx > +unsigned long long %llu, %llx > +off_t %llu, %llx > +ptr_diff_t %td, %tx > +fdt_addr_t %pa, see pointers Does "see pointers" refer to "Pointer" section? There is no further description about fdt_[addr|size]_t there. > +fdt_size_t %pa, see pointers > +phys_addr_t %pa, see pointers > +phys_size_t %pa, see pointers > +size_t %zu, %zx, %Zu, %Zx > +ssize_t %zd, %zx, %Zd, %Zx > +=================== ===================== For completeness, we might better address padding (space, '0') justification ('+', '-') and '#' as well. > + > +Characters > +---------- > + > +%c > + prints a single character > + > +Strings > +------- > + > +%s > + prints a UTF-8 string (char \*) may drop "a" for consistency in below cases drop '\' > + > +%ls > + prints a UTF-16 string (u16 \*) > + > +Pointers > +-------- > + > +%p > + prints the address the pointer points to hexadecimally > + > +%pa, %pap > + prints the value of a phys_addr_t value that the pointer points to > + preceded with 0x and zero padding according to size of phys_addr_t > + > +%pD > + prints an UEFI device path an -> a, or drop it. > + > +%pi4, %pI4 > + prints IPv4 address, e.g. '192.168.0.1' > + > +%pm > + prints MAC address without separators, e.g. '001122334455' > + > +%pM > + print MAC address colon separated, e.g. '00:01:02:03:04:05' > + > +%pUb > + prints GUID big endian, lower case > + e.g. '00112233-4455-6677-8899-aabbccddeeff' > + > +%pUB > + prints GUID big endian, upper case > + e.g. '00112233-4455-6677-8899-AABBCCDDEEFF' > + > +%pUl > + prints GUID low endian, lower case low -> little > + e.g. '33221100-5544-7766-8899-aabbccddeeff' > + > +%pUL > + prints GUID low endian, upper case ditto > + e.g. '33221100-5544-7766-8899-AABBCCDDEEFF' > + > +%pUs > + prints text description of a GUID or if such is not known low endian, ditto -Takahiro Akashi > + lower case, e.g. 'system' for a GUID identifying an EFI system > + partition. > -- > 2.33.1 >