1 // Copyright 2016 The Fuchsia Authors
2 // Copyright (c) 2008-2015 Travis Geiselbrecht
3 //
4 // Use of this source code is governed by a MIT-style
5 // license that can be found in the LICENSE file or at
6 // https://opensource.org/licenses/MIT
7 
8 #pragma once
9 
10 #include <list.h>
11 #include <sys/types.h>
12 #include <zircon/compiler.h>
13 
14 /* LK specific calls to register to get input/output of the main console */
15 
16 __BEGIN_CDECLS
17 
18 typedef struct __print_callback print_callback_t;
19 struct __print_callback {
20     struct list_node entry;
21     void (*print)(print_callback_t* cb, const char* str, size_t len);
22     void* context;
23 };
24 
25 /* register callback to receive debug prints */
26 void register_print_callback(print_callback_t* cb);
27 void unregister_print_callback(print_callback_t* cb);
28 
29 /* back doors to directly write to the kernel serial and console */
30 void __kernel_serial_write(const char* str, size_t len);
31 void __kernel_console_write(const char* str, size_t len);
32 
33 /* path from printf() to kernel debug output */
34 int __printf_output_func(const char* s, size_t len, void* state);
35 
36 __END_CDECLS
37