console: winstream: define as a proper console

eb2e5de01c made this a console driver but without adding the needed
hooks. This adds the hooks to support the console interface.

Fixes #65987
Fixes #66264

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2024-01-29 17:54:42 +00:00 committed by Carles Cufí
commit a1e03d079a

View file

@ -46,6 +46,29 @@ int arch_printk_char_out(int c)
return 0; return 0;
} }
#if defined(CONFIG_STDOUT_CONSOLE)
extern void __stdout_hook_install(int (*hook)(int));
#else
#define __stdout_hook_install(x) \
do {/* nothing */ \
} while ((0))
#endif
#if defined(CONFIG_PRINTK)
extern void __printk_hook_install(int (*fn)(int));
#else
#define __printk_hook_install(x) \
do {/* nothing */ \
} while ((0))
#endif
static void winstream_console_hook_install(void)
{
__stdout_hook_install(arch_printk_char_out);
__printk_hook_install(arch_printk_char_out);
}
static int winstream_console_init(void) static int winstream_console_init(void)
{ {
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
@ -58,6 +81,7 @@ static int winstream_console_init(void)
arch_xtensa_uncached_ptr((__sparse_force void __sparse_cache *)config->mem_base); arch_xtensa_uncached_ptr((__sparse_force void __sparse_cache *)config->mem_base);
winstream = sys_winstream_init(buf, config->size); winstream = sys_winstream_init(buf, config->size);
winstream_console_hook_install();
return 0; return 0;
} }