From patchwork Wed Feb 4 00:09:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1799 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=1770163840; bh=A6d84HkspN98cFas0psCk5wDyCNIdFmusCioXslfW+U=; 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=tBKMijflM+kDAVqePZxrbGnYa8m/elZG+MOEn63f5/8uV7MGn7Ak+BiUUEQQjpvlB Eah+JxXRP5VMaXUpISvz6RLAhD18qpix+qGFWRHBuYwTDL5flnvyCFcGURVsErkmY6 DAeKYmppCGRnU79pZlAFOnIAig7AoFCQ0MH+DXW21Mp/h3szNohO2zSp4uvj5wEpUj lLvZJ31VYSx/ERzac0tsphvPfwUr0oXA+6BwtasnpfPbD9RsVNX6Tgl6/ZgwFaMaHM TiS61poy2YTgnIwK44h/BNWadaHR7wXWQ0KT95GiNWGAmdjjADth9W06YzmHUgiQyb MTglz8NjLc9bQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C460569868 for ; Tue, 3 Feb 2026 17:10:40 -0700 (MST) 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 GIrVCso-sMJk for ; Tue, 3 Feb 2026 17:10:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770163840; bh=A6d84HkspN98cFas0psCk5wDyCNIdFmusCioXslfW+U=; 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=tBKMijflM+kDAVqePZxrbGnYa8m/elZG+MOEn63f5/8uV7MGn7Ak+BiUUEQQjpvlB Eah+JxXRP5VMaXUpISvz6RLAhD18qpix+qGFWRHBuYwTDL5flnvyCFcGURVsErkmY6 DAeKYmppCGRnU79pZlAFOnIAig7AoFCQ0MH+DXW21Mp/h3szNohO2zSp4uvj5wEpUj lLvZJ31VYSx/ERzac0tsphvPfwUr0oXA+6BwtasnpfPbD9RsVNX6Tgl6/ZgwFaMaHM TiS61poy2YTgnIwK44h/BNWadaHR7wXWQ0KT95GiNWGAmdjjADth9W06YzmHUgiQyb MTglz8NjLc9bQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B0EBA69911 for ; Tue, 3 Feb 2026 17:10:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770163838; bh=EZUXQmS8heLiCSicHxBfKo3xzX2qNEuKzMHjom3+Me4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vpJVkpbFyeOVzo5HjisSac1krA0SoU6PXAjL/ytZv5at7SjYiXOhpvLSmtEb+hWSi 4qkF8EnOMT4Ndszk1yn2f4z0MLe/TOU2AecW37oonBFRtMnzva0jo23HRgOd91yRR9 cSGeQW0WZ3VuBLcgfXj7I0eXRJsoMAwZUziBMSE2a7eOsrHaGDjNzbgGqsnlbUx+wn Pl9VxHplZdy9k+/exa8gSV5phTf+R2reSYjPlPVDmISDf25BjwqPgE2jMsSjl7/fNr Pkpig5EO8O4jIz8RjjzpGamtbLfW9t1EyI/xsGNPbGKa66OWlBQhuQyfQRZQ43xG1r zbcxrrU1MEldw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B867969868; Tue, 3 Feb 2026 17:10:38 -0700 (MST) 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 axIwJHSEVr2w; Tue, 3 Feb 2026 17:10:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770163834; bh=Ml180oVneysOP/IJ1Ydf5bawhWtvUfkt7eeL2Te7vZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0Mvn0W9zMZ6Yk3g8XGIUVglEodrQvtrFgJlbBCXf5HvTpBToO2FNTWHzDfapPhIB oeI94vfsRS9Ugpktkxmy0tSqK4qF+mdF47R9LDcq24aOhuEkzoD0Ja4y991+JjKmRe RB0nNCbMI3KXvb5xdJll1I9r3KN4MDyT1XfEFitbJNFhtvfBaZAvGXmvpN/bsGbRGe iawUfJfi9fk/t52hIns2iq5ndZTlbMsqjg9Tf4MzNl29eXTosLG0UegtMIk9itxXOa /QLA4MVsrrih2AMzKFX8U6ExjbIRj9bYrs82QZ82htv5g8WN3MBw+mhoyjRVqdRB0O k6O1HfbdJ9U2A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6F62A69909; Tue, 3 Feb 2026 17:10:34 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 3 Feb 2026 17:09:49 -0700 Message-ID: <20260204001002.2638622-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204001002.2638622-1-sjg@u-boot.org> References: <20260204001002.2638622-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HJ4J2BGQ5JTV4ESXMBVORFMUCAPVJYA6 X-Message-ID-Hash: HJ4J2BGQ5JTV4ESXMBVORFMUCAPVJYA6 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 , "Claude Sonnet 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/13] console: Add length-based debug UART support 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 Add printasciin() to support length-based output through the debug UART. This allows putsn() to work correctly with the early debug console. Co-developed-by: Claude Sonnet 4.5 Signed-off-by: Simon Glass --- include/debug_uart.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/debug_uart.h b/include/debug_uart.h index 714b369e6fe..f5664271f1c 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -83,6 +83,17 @@ void printch(int ch); */ void printascii(const char *str); +/** + * printasciin() - Output a string with specified length to the debug UART + * + * This outputs exactly @len characters from @str, regardless of any nul + * characters that may be present. + * + * @str: String to output (need not be nul-terminated) + * @len: Number of characters to output + */ +void printasciin(const char *str, int len); + /** * printhex2() - Output a 2-digit hex value * @@ -150,6 +161,12 @@ void printdec(unsigned int value); while (*str) \ _printch(*str++); \ } \ +\ + void printasciin(const char *str, int len) \ + { \ + while (len--) \ + _printch(*str++); \ + } \ \ static inline void printhex1(unsigned int digit) \ { \