diff mbox series

[v2,10/14] doc: Add a note about number representation

Message ID 20210724150341.243074-11-sjg@chromium.org
State Accepted
Commit 5f4b356121fdb520e4c9bb4fe3483c1a5f93439c
Delegated to: Tom Rini
Headers show
Series lib: Add support for a decimal 0t prefix for numbers | expand

Commit Message

Simon Glass July 24, 2021, 3:03 p.m. UTC
Mention the default base of U-Boot in the command-line section. Add
examples for decimal and octal.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 doc/usage/cmdline.rst | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Comments

Tom Rini Aug. 2, 2021, 5:52 p.m. UTC | #1
On Sat, Jul 24, 2021 at 09:03:37AM -0600, Simon Glass wrote:

> Mention the default base of U-Boot in the command-line section. Add
> examples for decimal and octal.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/doc/usage/cmdline.rst b/doc/usage/cmdline.rst
index b3dbdb8b230..2d5127c9554 100644
--- a/doc/usage/cmdline.rst
+++ b/doc/usage/cmdline.rst
@@ -54,3 +54,34 @@  General rules
    calling run with a list of variables as arguments), any failing
    command will cause "run" to terminate, i. e. the remaining
    variables are not executed.
+
+Representing numbers
+--------------------
+
+Most U-Boot commands use hexadecimal (hex) as the default base, for convenient
+use of addresses, for example::
+
+  => md 1000 6
+  00001000: 2c786f62 00697073 03000000 0c000000  box,spi.........
+  00001010: 67020000 00000000                    ...g....
+
+There is no need to add a `0x` prefix to the arguments and the output is shown
+in hex also, without any prefixes. This helps to avoid clutter.
+
+Some commands use decimal where it is more natural::
+
+  => i2c dev 0
+  Setting bus to 0
+  => i2c speed
+  Current bus speed=400000
+  => i2c speed 100000
+  Setting bus speed to 100000 Hz
+
+In some cases the default is decimal but it is possible to use octal if that is
+useful::
+
+  pmic dev pmic@41
+  dev: 1 @ pmic@41
+  => pmic write 2 0177
+  => pmic read 2
+  0x02: 0x00007f