Devicetree
 help / color / mirror / Atom feed
From: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org
Subject: [PATCH 3/4] ARM:boot:device tree: Add puthex routine for use in the boot wrapper
Date: Mon, 28 Feb 2011 15:33:47 -0800	[thread overview]
Message-ID: <20110228233346.24836.48614.stgit@riker> (raw)
In-Reply-To: <20110228233153.24836.24176.stgit@riker>

This patch adds a routine named 'puthex'. This allows the boot wraper code to
display hex numbers.

Signed-off-by: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
---

 arch/arm/boot/compressed/misc.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 2d4da4c..9af05ed 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -113,6 +113,31 @@ void putstr(const char *ptr)
 	flush();
 }
 
+void puthex(unsigned i)
+{
+	unsigned rem;
+	char str[32];
+	int str_idx = sizeof(str) - 1;;
+
+	str[str_idx--] = '\0';
+	putstr("0x");
+	if (!i) {
+		putstr("0");
+	} else {
+		while (i) {
+			rem = i % 16;
+
+			if (rem < 10) {
+				str[str_idx--] = rem + '0';
+			} else {
+				str[str_idx--] = (rem - 10) + 'a';
+			}
+			i = i / 16;
+		}
+
+		putstr(&str[str_idx + 1]);
+	}
+}
 
 #ifdef CONFIG_ARM_APPENDED_DTB
 /**

  parent reply	other threads:[~2011-02-28 23:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 23:33 [PATCH 0/4] Support for device-tree appended to zImage John Bonesio
2011-02-28 23:33 ` [PATCH 1/4] ARM:boot:device tree: Allow the device tree binary to be " John Bonesio
2011-03-01  6:39   ` Nicolas Pitre
     [not found]     ` <alpine.LFD.2.00.1103010019160.10356-QuJgVwGFrdf/9pzu0YdTqQ@public.gmane.org>
2011-03-02  1:41       ` John Bonesio
     [not found]         ` <4D6DA062.8010904-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
2011-03-02  2:37           ` Nicolas Pitre
2011-03-02  2:13       ` John Bonesio
     [not found]         ` <4D6DA7C3.4040609-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
2011-03-02  2:57           ` Nicolas Pitre
2011-02-28 23:33 ` [PATCH 2/4] ARM:boot:device tree: Merge specific atags into the device tree John Bonesio
2011-03-01  6:45   ` Nicolas Pitre
     [not found]     ` <alpine.LFD.2.00.1103010141140.10356-QuJgVwGFrdf/9pzu0YdTqQ@public.gmane.org>
2011-03-01 14:56       ` Grant Likely
2011-02-28 23:33 ` John Bonesio [this message]
2011-02-28 23:33 ` [PATCH 4/4] ARM:boot:device tree: Allow multiple device trees to be appended to zImage John Bonesio
2011-03-01  6:48   ` Nicolas Pitre
2011-03-01  2:58 ` [PATCH 0/4] Support for device-tree " Shawn Guo
     [not found]   ` <20110301025836.GA3920-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-01  3:25     ` John Bonesio

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=20110228233346.24836.48614.stgit@riker \
    --to=bones-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.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