1 /*
2  * Copyright (C) 2018-2022 Intel Corporation.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef CONSOLE_H
8 #define CONSOLE_H
9 
10 #include <vuart.h>
11 #include <asm/guest/vcpu.h>
12 
13 /** Initializes the console module.
14  *
15  */
16 void console_init(void);
17 
18 /** Writes a given number of characters to the console.
19  *
20  *  @param s A pointer to character array to write.
21  *  @param len The number of characters to write.
22  *
23  *  @return The number of characters written or -1 if an error occurred
24  *          and no character was written.
25  */
26 size_t console_write(const char *s, size_t len);
27 
28 /** Writes a single character to the console.
29  *
30  *  @param ch The character to write.
31  *
32  *  @preturn The number of characters written or -1 if an error
33  *           occurred before any character was written.
34  */
35 void console_putc(const char *ch);
36 char console_getc(void);
37 
38 void console_setup_timer(void);
39 void console_vmexit_callback(struct acrn_vcpu *vcpu);
40 
41 void suspend_console(void);
42 void resume_console(void);
43 struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
44 bool is_using_init_ipi(void);
45 
46 #endif /* CONSOLE_H */
47