Commit Graph

6 Commits

Author SHA1 Message Date
Randall Spangler
6ab8e91658 cleanup: Remove checkpatch warnings
This make minor syntactic changes and renames some camel-cased symbols
to keep checkpatch from complaining.  The goal is to reduce the
temptation to use 'repo upload --no-verify'.

This is a big furball of find/replace, but no functional changes.

BUG=chromium:322144
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180495
2013-12-19 00:12:28 +00:00
Randall Spangler
7f5019c9e3 Reduce stack space used by vfnprintf()
Converting some of the boolean variables in vfnprintf() to a single
flags word reduces stack usage by 8 bytes and function size by 12
bytes.  So it's slightly more efficient in both respects.

Confirmed size and stack usage improvements via 'make BOARD=rambi all
dis' and looking at the disassembly for vfnprintf()

BUG=chrome-os-partner:24148
BRANCH=none
TEST=Run taskinfo command twice and compare stack used by CONSOLE task.
     Run timerinfo and charger commands and verify output looks reasonable;
     those exercise binary and 64-bit number printing.

Change-Id: Ie4396bb0bc01dc155956fa2d8ca84c6630006729
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177400
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-11-20 18:43:56 +00:00
Randall Spangler
e228692eb2 Clean up printf module
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system; debug output still shows up on EC console

Change-Id: I63f4f9481f5393aaff065b37a274236bd78622d9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36581
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-25 14:12:10 -07:00
Randall Spangler
7d06db201f Enhance printf()
1. Add precision to limit string length.
   ccprintf("%.4s", "foobar") prints "foob"

2. Handle '*' for length, precision fields.
   ccprintf("%.*s", 3, "foobar") prints "foo"

3. Add hex-dump code "%h"
   ccprintf("%.*s", 4, "foobar") prints 666f6f62

BUG=none
TEST=at ec console, 'hash' prints the current hash

Change-Id: I568310f2727495b021081bf58df2a0bbb3c74e73
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28704
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-30 13:41:33 -07:00
Randall Spangler
8fcfec5f7f Fix printing hex numbers
Off-by-one is not my friend.

BUG=chrome-os-partner:10206
TEST=manual

1. rw 0x20000000
2. ww back the same number printed
3. rw 0x20000000.  should match

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I61e0d26cf4cb274a88326d4e7d24ff1c82d6e515
Reviewed-on: https://gerrit.chromium.org/gerrit/24756
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-06-07 14:33:26 -07:00
Randall Spangler
c7f2e0246e Move printf() formatting to its own file to enable re-use
Also add snprintf(), and %X format code.

BUG=chrome-os-partner:10206
TEST=timerinfo; should print correctly.  'ectool battery' on host side should print same serial as 'battery' on EC console.

Change-Id: I5c9f69d1a20ee5d0a59440c122655adbf62c9aea
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/24635
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2012-06-07 00:54:02 -07:00