mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] include: debug_ll: define puthexc_ll
Date: Wed, 2 Nov 2022 09:26:48 +0100	[thread overview]
Message-ID: <20221102082648.GI3143@pengutronix.de> (raw)
In-Reply-To: <20221019123817.1659468-1-a.fatoum@pengutronix.de>

On Wed, Oct 19, 2022 at 02:38:15PM +0200, Ahmad Fatoum wrote:
> puthex_ll prints a single zero-padded unsigned long, which for a single
> byte is not very readable, especially on 64-bit systems. Define
> puthexc_ll() as well, which just accepts a byte and formats its nibbles
> as hexadecimal characters.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  include/debug_ll.h | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/include/debug_ll.h b/include/debug_ll.h
> index 735033b314cc..856a157bf52c 100644
> --- a/include/debug_ll.h
> +++ b/include/debug_ll.h
> @@ -33,17 +33,25 @@ static inline void putc_ll(char value)
>  	PUTC_LL(value);
>  }
>  
> -static inline void puthex_ll(unsigned long value)
> +static inline void puthexc_ll(unsigned char value)
>  {
>  	int i; unsigned char ch;
>  
> -	for (i = sizeof(unsigned long) * 2; i--; ) {
> +	for (i = 2; i--; ) {
>  		ch = ((value >> (i * 4)) & 0xf);
>  		ch += (ch >= 10) ? 'a' - 10 : '0';
>  		putc_ll(ch);
>  	}
>  }
>  
> +static inline void puthex_ll(unsigned long value)
> +{
> +	int i;
> +
> +	for (i = sizeof(unsigned long); i--; )
> +		puthexc_ll(value >> (i * 8));
> +}
> +
>  /*
>   * Be careful with puts_ll, it only works if the binary is running at the
>   * link address which often is not the case during early startup. If in doubt
> @@ -66,6 +74,10 @@ static inline void putc_ll(char value)
>  {
>  }
>  
> +static inline void puthexc_ll(unsigned char value)
> +{
> +}
> +
>  static inline void puthex_ll(unsigned long value)
>  {
>  }
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      parent reply	other threads:[~2022-11-02  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 12:38 Ahmad Fatoum
2022-10-19 12:38 ` [PATCH 2/3] lib: hexdump: make available for PBL debugging Ahmad Fatoum
2022-10-19 12:38 ` [PATCH 3/3] pbl: decomp: print mismatched hashes on one line each Ahmad Fatoum
2022-11-02  8:26 ` Sascha Hauer [this message]

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=20221102082648.GI3143@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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