2018-03-07 20:57:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
|
|
*
|
2018-05-26 01:49:13 +08:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2018-03-07 20:57:14 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONSOLE_H
|
|
|
|
#define CONSOLE_H
|
|
|
|
|
2018-08-13 21:23:50 +08:00
|
|
|
/* Switching key combinations for shell and uart console */
|
|
|
|
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */
|
|
|
|
|
2018-03-07 20:57:14 +08:00
|
|
|
/** Initializes the console module.
|
|
|
|
*
|
|
|
|
*/
|
2018-07-12 11:59:19 +08:00
|
|
|
void console_init(void);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
/** Writes a given number of characters to the console.
|
|
|
|
*
|
2018-08-01 14:59:53 +08:00
|
|
|
* @param s A pointer to character array to write.
|
2018-03-07 20:57:14 +08:00
|
|
|
* @param len The number of characters to write.
|
|
|
|
*
|
|
|
|
* @return The number of characters written or -1 if an error occurred
|
|
|
|
* and no character was written.
|
|
|
|
*/
|
2018-09-18 17:50:26 +08:00
|
|
|
size_t console_write(const char *s, size_t len);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
/** Writes a single character to the console.
|
|
|
|
*
|
|
|
|
* @param ch The character to write.
|
|
|
|
*
|
|
|
|
* @preturn The number of characters written or -1 if an error
|
|
|
|
* occurred before any character was written.
|
|
|
|
*/
|
2018-07-27 16:23:09 +08:00
|
|
|
void console_putc(const char *ch);
|
|
|
|
char console_getc(void);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
void console_setup_timer(void);
|
2018-07-30 11:29:34 +08:00
|
|
|
void uart16550_set_property(bool enabled, bool port_mapped, uint64_t base_addr);
|
2018-11-29 14:59:10 +08:00
|
|
|
bool is_pci_dbg_uart(union pci_bdf bdf_value);
|
2018-12-24 21:27:04 +08:00
|
|
|
bool is_dbg_uart_enabled(void);
|
2018-06-04 16:35:20 +08:00
|
|
|
|
2018-08-13 21:23:50 +08:00
|
|
|
void shell_init(void);
|
|
|
|
void shell_kick(void);
|
|
|
|
|
2018-11-27 14:54:30 +08:00
|
|
|
void suspend_console(void);
|
|
|
|
void resume_console(void);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
2018-12-26 16:39:35 +08:00
|
|
|
bool handle_dbg_cmd(const char *cmd, int32_t len);
|
2018-03-07 20:57:14 +08:00
|
|
|
#endif /* CONSOLE_H */
|