1 /* 2 * Copyright 2024 Google LLC 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_SYS_PRINTK_HOOKS_H_ 8 #define ZEPHYR_INCLUDE_SYS_PRINTK_HOOKS_H_ 9 10 /** 11 * @brief printk function handler 12 * 13 * @param c Character to output 14 * 15 * @returns The character passed as input. 16 */ 17 typedef int (*printk_hook_fn_t)(int c); 18 19 /** 20 * @brief Install the character output routine for printk 21 * 22 * To be called by the platform's console driver at init time. Installs a 23 * routine that outputs one ASCII character at a time. 24 * @param fn putc routine to install 25 */ 26 void __printk_hook_install(printk_hook_fn_t fn); 27 28 /** 29 * @brief Get the current character output routine for printk 30 * 31 * To be called by any console driver that would like to save 32 * current hook - if any - for later re-installation. 33 * 34 * @return a function pointer or NULL if no hook is set 35 */ 36 printk_hook_fn_t __printk_get_hook(void); 37 38 #endif /* ZEPHYR_INCLUDE_SYS_PRINTK_HOOKS_H_ */ 39