From patchwork Fri Aug 22 14:21:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 120 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755872563; bh=B+3raVdqDnH7s5ENm00tpS7PNFBY/J2j3qbaehJQpDk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=at6ZdDvSL0oKPyZuEgybRK+O2yI65Ydeb/YqAsFgRp4tZ5ns1KmNT0CuSOf7HsGP1 tANfic2OpaKbKrzPBUmo4Ztgd8ZXDOviRXc5nZFluAadZq7LcY8DQxPQqia7DOG307 NFuFP8n6OaUuKSGX9Pf5TjUv307HKU+oGRvEEstci9FzgOg2FatZf5yUN9hsYKMa+L Idr6cpFuUHMFToERzokLU+ilEvX+fPKed2tqyh8HDXRb0leoF5YbM357AkPEHid6cw xFH1NEuwun0x/B4y0/g0ijfthL9O8GFOT0bFQs0rtToZSTBDYOEmSjJUY6DhvYNoxt kO1XNOtAeKfyw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BD08667712 for ; Fri, 22 Aug 2025 08:22:43 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xm3qxmgmb6Fp for ; Fri, 22 Aug 2025 08:22:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755872562; bh=B+3raVdqDnH7s5ENm00tpS7PNFBY/J2j3qbaehJQpDk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=WU9ADNONhUcCz8aP0naTc//wwuEDbA2ss26QR0Zpk7Y2F2bAU4018YznZTv75XVJi 4+l8bc0NMwpnkR/Pt7JNRTnxQu6vjROGClxF0qTB5rbEvLrlsdNdAqW7aM4g0W13FO lD8T+ncDsSIUdpZtNnmjNerhBo4/w8A4LwXTqUzzB8cttnusGUdSRPFVKQDJlQj6ur QJzf/doZnDdcEumNVC6KGnRck/9E+fDlQ5KE2LE+H28kd3upAu/fpY6/zrm0Aeca/0 2EH25CYkQXiOwNx5qtFFeI7HGTzrjyVC9s7GM1uTcC+zACMuY3r5dV8T64fk06AWcI PR4KTDolD8lIQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ACC606771A for ; Fri, 22 Aug 2025 08:22:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755872558; bh=+/Y0QjxaPiuODvBrYaAtxGJWb8WdM3+qQQga+aHIbVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ouw/I/U24nvUnZ7Xwoc+ljp6pcMQBlyAXZjs2oegWUFXgPNK06BuoGbVuT/kO6PNR KH/xUcMxzqbbC7akQXdKQANSCzw8r5JidOQJg219osWhBdc4LxbHd4O8j8HBkJm58q kpQLN87qjV+ARN5715/wFMqKdrVkZjP9KoTxPXvgbEsZJN/qGePw0kqM1qkDbuPIkX v91E8wA79F5XLXMIcuk8JztFwEZq9VilL6Cs1rVABtN9c0SJd/XjEQs7b3QHsj0atL O7H+HC+g3jAyVRj4PL8RYQbaP3Fo7ZuQmvrzJCQIZaOKmscKDP1749iKVWRrNgW9MD fwOBbikGrS36g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E67E567702; Fri, 22 Aug 2025 08:22:38 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id VdlgxuH00pD7; Fri, 22 Aug 2025 08:22:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755872552; bh=RCgCxJfrcKlkWS8Q6aPkolvo1mRvA/v6sa4Daoqfs+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g1F6hGCHbQ2NxMQfboW7dFelpO5Ew8J1unLpWxzEsOUBGK59fWNsSJlKaJVCMnUQX rU0tu2NehxyE0rIlbHFSA5CijnPRMYz13OlEOldYSRLjUsUF7XeC4+KIo7wZBhHdny Vi3vqE/SY3Urfnbvet4cTZuNSpg3en5efxeupJU55QYOB2g2gkjR1svVQiFE40k5D/ 3UpNdkPIOptBRpcGfLvHR5TqoikZRxrS4f8AoPqdh0UEaVwBfmAApAFw1AQYel60N+ BE0rAtKWQakYWH7wlLpWICp35jmLaYRxDhl//gfL1jdMqXQjGaNSR6cKS7nm64TEZG eBjS+CtlSIptQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6D9D1675E3; Fri, 22 Aug 2025 08:22:32 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 22 Aug 2025 08:21:46 -0600 Message-ID: <20250822142153.3404275-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250822142153.3404275-1-sjg@u-boot.org> References: <20250822142153.3404275-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BSB5T4CNFD5ABZIBZ54NBGCWNTJJ7333 X-Message-ID-Hash: BSB5T4CNFD5ABZIBZ54NBGCWNTJJ7333 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 15/16] doc: Tidy up the console docs a little List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Tweak the documentation to look better when viewed. Use 'write' instead of 'put'. Signed-off-by: Simon Glass --- doc/usage/console.rst | 69 ++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/doc/usage/console.rst b/doc/usage/console.rst index f624cc58038..d7d41bca187 100644 --- a/doc/usage/console.rst +++ b/doc/usage/console.rst @@ -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()`.