diff options
author | Sean Anderson <sean.anderson@seco.com> | 2022-04-04 14:17:59 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-04-14 15:39:15 -0400 |
commit | 679190c41a25592103e711718c93d2655d344713 (patch) | |
tree | 89d69f532715c6e61ee5e5f73c71a1458119897c /arch | |
parent | efa51f2bd641965f91550e1f7eeec14b5746db87 (diff) | |
download | u-boot-679190c41a25592103e711718c93d2655d344713.zip u-boot-679190c41a25592103e711718c93d2655d344713.tar.gz u-boot-679190c41a25592103e711718c93d2655d344713.tar.bz2 |
test: serial: Add test for putc/puts
This adds a test to ensure that puts is equivalent to putc called in a
loop. We don't verify the contents of the message to avoid having to
record console output a second time (though that could be added in the
future). The globals are initialized to non-zero values to avoid a
warning; in particular, the character count is off-by-one (but we always
make relative measurements).
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sandbox/include/asm/serial.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/sandbox/include/asm/serial.h b/arch/sandbox/include/asm/serial.h index bc82aeb..16589a1 100644 --- a/arch/sandbox/include/asm/serial.h +++ b/arch/sandbox/include/asm/serial.h @@ -17,6 +17,28 @@ struct sandbox_serial_plat { }; /** + * sandbox_serial_written() - Get the total number of characters written + * + * This returns the number of characters written by the sandbox serial + * device. It is intended for performing tests of the serial subsystem + * where a console buffer cannot be used. The absolute number should not be + * relied upon; call this function twice and compare the difference. + * + * Return: The number of characters written + */ +size_t sandbox_serial_written(void); + +/** + * sandbox_serial_endisable() - Enable or disable serial output + * @enabled: Whether serial output should be enabled or not + * + * This allows tests to enable or disable the sandbox serial output. All + * processes relating to writing output (except the actual writing) will be + * performed. + */ +void sandbox_serial_endisable(bool enabled); + +/** * struct sandbox_serial_priv - Private data for this driver * * @buf: holds input characters available to be read by this driver |