libc, console: declare __stdout_hook_install in libc-hooks.h
Declare __stdout_hook_install in libc-hooks.h and use it in the console drivers rather than redeclare it every time. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
2f530cfbbd
commit
e466efaf74
14 changed files with 15 additions and 38 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <zephyr/init.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
|
||||
extern int efi_console_putchar(int c);
|
||||
|
||||
|
@ -39,10 +40,6 @@ static int console_out(int c)
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
extern void __stdout_hook_install(int (*hook)(int));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Install printk/stdout hook for EFI console output
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <zephyr/init.h>
|
||||
#include <zephyr/drivers/ipm.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(ipm_console, CONFIG_IPM_LOG_LEVEL);
|
||||
|
@ -42,10 +43,6 @@ static int console_out(int c)
|
|||
return c;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
extern void __stdout_hook_install(int (*hook)(int));
|
||||
#endif
|
||||
|
||||
/* Install printk/stdout hooks */
|
||||
static void ipm_console_hook_install(void)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
#include <zephyr/drivers/ipm.h>
|
||||
#include <zephyr/drivers/console/ipm_console.h>
|
||||
|
||||
|
@ -31,8 +32,6 @@ static int consoleOut(int character)
|
|||
return character;
|
||||
}
|
||||
|
||||
extern void __stdout_hook_install(int (*fn)(int));
|
||||
|
||||
int ipm_console_sender_init(const struct device *d)
|
||||
{
|
||||
const struct ipm_console_sender_config_info *config_info;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
|
||||
|
@ -26,10 +27,6 @@ static int console_out(int c)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
extern void __stdout_hook_install(int (*hook)(int));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initialize the console/debug port
|
||||
* @return 0 if successful, otherwise failed.
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <zephyr/init.h>
|
||||
#include <zephyr/arch/posix/posix_trace.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
|
||||
#define _STDOUT_BUF_SIZE 256
|
||||
static char stdout_buff[_STDOUT_BUF_SIZE];
|
||||
|
@ -55,7 +56,6 @@ static int posix_arch_console_init(void)
|
|||
__printk_hook_install(print_char);
|
||||
#endif
|
||||
#ifdef CONFIG_STDOUT_CONSOLE
|
||||
extern void __stdout_hook_install(int (*fn)(int));
|
||||
__stdout_hook_install(print_char);
|
||||
#endif
|
||||
return 0;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/linker/devicetree_regions.h>
|
||||
|
@ -28,8 +29,6 @@
|
|||
#define RAM_CONSOLE_BUF_ATTR
|
||||
#endif
|
||||
|
||||
extern void __stdout_hook_install(int (*fn)(int));
|
||||
|
||||
char ram_console_buf[CONFIG_RAM_CONSOLE_BUFFER_SIZE] RAM_CONSOLE_BUF_ATTR;
|
||||
char *ram_console;
|
||||
static int pos;
|
||||
|
|
|
@ -12,12 +12,11 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <SEGGER_RTT.h>
|
||||
|
||||
extern void __stdout_hook_install(int (*fn)(int));
|
||||
|
||||
static bool host_present;
|
||||
|
||||
/** @brief Wait for fixed period.
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/arch/common/semihost.h>
|
||||
|
||||
extern void __stdout_hook_install(int (*fn)(int));
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
|
||||
int arch_printk_char_out(int _c)
|
||||
{
|
||||
|
@ -18,7 +17,6 @@ int arch_printk_char_out(int _c)
|
|||
|
||||
static int semihost_console_init(void)
|
||||
{
|
||||
|
||||
/*
|
||||
* The printk output callback is arch_printk_char_out by default and
|
||||
* is installed at link time. That makes printk() usable very early.
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <zephyr/sys/atomic.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
#include <zephyr/pm/device_runtime.h>
|
||||
#ifdef CONFIG_UART_CONSOLE_MCUMGR
|
||||
#include <zephyr/mgmt/mcumgr/transport/serial.h>
|
||||
|
@ -111,10 +112,6 @@ static int console_out(int c)
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
extern void __stdout_hook_install(int (*hook)(int c));
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CONSOLE_HANDLER)
|
||||
static struct k_fifo *avail_queue;
|
||||
static struct k_fifo *lines_queue;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/winstream.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
#include <zephyr/devicetree.h>
|
||||
#include <zephyr/cache.h>
|
||||
|
||||
|
@ -47,10 +48,6 @@ int arch_printk_char_out(int c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
extern void __stdout_hook_install(int (*hook)(int));
|
||||
#endif
|
||||
|
||||
static void winstream_console_hook_install(void)
|
||||
{
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
|
||||
#if defined(CONFIG_PRINTK) || defined(CONFIG_STDOUT_CONSOLE)
|
||||
/**
|
||||
|
@ -34,10 +35,6 @@ int arch_printk_char_out(int c)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
extern void __stdout_hook_install(int (*hook)(int));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Install printk/stdout hook for Xtensa Simulator console output
|
||||
*/
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/device_mmio.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(uart_hvc_xen, CONFIG_UART_LOG_LEVEL);
|
||||
|
@ -268,8 +269,6 @@ DEVICE_DT_DEFINE(DT_NODELABEL(xen_hvc), xen_console_init, NULL, &xen_hvc_data,
|
|||
&xen_hvc_api);
|
||||
|
||||
#ifdef CONFIG_XEN_EARLY_CONSOLEIO
|
||||
extern void __stdout_hook_install(int (*fn)(int));
|
||||
|
||||
int xen_consoleio_putc(int c)
|
||||
{
|
||||
char symbol = (char) c;
|
||||
|
|
|
@ -44,6 +44,8 @@ __syscall size_t zephyr_fwrite(const void *ZRESTRICT ptr, size_t size,
|
|||
|
||||
#endif /* CONFIG_NEWLIB_LIBC */
|
||||
|
||||
void __stdout_hook_install(int (*hook)(int));
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#ifdef CONFIG_COMMON_LIBC_MALLOC
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <zephyr/drivers/uart_pipe.h>
|
||||
#include <zephyr/sys/byteorder.h>
|
||||
#include <zephyr/sys/printk-hooks.h>
|
||||
#include <zephyr/sys/libc-hooks.h>
|
||||
#include <zephyr/drivers/uart.h>
|
||||
|
||||
#include <zephyr/logging/log_backend.h>
|
||||
|
@ -260,8 +261,6 @@ static int monitor_console_out(int c)
|
|||
|
||||
return c;
|
||||
}
|
||||
|
||||
extern void __stdout_hook_install(int (*fn)(int));
|
||||
#endif /* !CONFIG_UART_CONSOLE && !CONFIG_RTT_CONSOLE && !CONFIG_LOG_PRINTK */
|
||||
|
||||
#ifndef CONFIG_LOG_MODE_MINIMAL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue