[Concept,v2,16/16] doc: Tidy up the console docs a little
Commit Message
From: Simon Glass <sjg@chromium.org>
Tweak the documentation to look better when viewed. Use 'write' instead
of 'put'.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
(no changes since v1)
doc/usage/console.rst | 69 ++++++++++++++++++++++---------------------
1 file changed, 36 insertions(+), 33 deletions(-)
@@ -6,10 +6,10 @@
U-Boot console handling
=======================
-HOW THE CONSOLE WORKS?
-----------------------
+Introduction
+------------
-At system startup U-Boot initializes a serial console. When U-Boot
+At system-startup U-Boot initializes a serial console. When U-Boot
relocates itself to RAM, all console drivers are initialized (they
will register all detected console devices to the system for further
use).
@@ -17,43 +17,46 @@ use).
If not defined in the environment, the first input device is assigned
to the 'stdin' file, the first output one to 'stdout' and 'stderr'.
-You can use the command "coninfo" to see all registered console
+You can use the command `coninfo` to see all registered console
devices and their flags. You can assign a standard file (stdin,
stdout or stderr) to any device you see in that list simply by
assigning its name to the corresponding environment variable. For
-example:
+example::
- setenv stdin serial <- To use the serial input
- setenv stdout video <- To use the video console
+ # Use the serial input
+ setenv stdin serial
-Do a simple "saveenv" to save the console settings in the environment
+ # Use the video console
+ setenv stdout vidconsole
+
+Do a simple `saveenv` to save the console settings in the environment
and get them working on the next startup, too.
-HOW CAN I USE STANDARD FILE INTO THE SOURCES?
----------------------------------------------
+How to output text to the console
+---------------------------------
You can use the following functions to access the console:
-* STDOUT:
- putc (to put a char to stdout)
- puts (to put a string to stdout)
- printf (to format and put a string to stdout)
-
-* STDIN:
- tstc (to test for the presence of a char in stdin)
- getc (to get a char from stdin)
-
-* STDERR:
- eputc (to put a char to stderr)
- eputs (to put a string to stderr)
- eprintf (to format and put a string to stderr)
-
-* FILE (can be 'stdin', 'stdout', 'stderr'):
- fputc (like putc but redirected to a file)
- fputs (like puts but redirected to a file)
- fprintf (like printf but redirected to a file)
- ftstc (like tstc but redirected to a file)
- fgetc (like getc but redirected to a file)
-
-Remember that all FILE-related functions CANNOT be used before
-U-Boot relocation (done in 'board_init_r' in `arch/*/lib/board.c`).
+stdout
+ - putc() - write a char to stdout
+ - puts() - write a string to stdout
+ - printf() - format and write a string to stdout
+
+stdin
+ - tstc() - test for the presence of a char in stdin
+ - getchar() - get a char from stdin
+
+stderr
+ - eputc() - write a char to stderr
+ - eputs() - write a string to stderr
+ - eprintf() - format and write a string to stderr
+
+file ('stdin', 'stdout' or 'stderr')
+ - fputc() - write a char to a file
+ - fputs() - write a string to a file
+ - fprintf() - format and write a string to a file
+ - ftstc() - test for the presence of a char in file
+ - fgetc() - get a char from a file
+
+Remember that FILE-related functions CANNOT be used before U-Boot relocation,
+which is done in `board_init_r()`.