blob: 4c22a997d595a819a9992fa444ea50a09909fdc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __CONSOLE_H__
#define __CONSOLE_H__
/* Returned by getc callbacks when receive FIFO is empty. */
#define ERROR_NO_PENDING_CHAR -1
/* Returned by console_xxx() if the registered console doesn't implement xxx. */
#define ERROR_NO_VALID_CONSOLE (-128)
#ifndef __ASSEMBLY__
#include <stdint.h>
/*
* Function to initialize the console without a C Runtime to print debug
* information. It saves the console base to the data section. Returns 1 on
* success, 0 on error.
*/
int console_init(uintptr_t base_addr,
unsigned int uart_clk, unsigned int baud_rate);
/*
* Function to output a character over the console. It returns the character
* printed on success or an error code.
*/
int console_putc(int c);
/*
* Function to get a character from the console. It returns the character
* grabbed on success or an error code on error. This function is blocking, it
* waits until there is an available character to return. Returns a character or
* error code.
*/
int console_getc(void);
/*
* Function to get a character from the console. It returns the character
* grabbed on success or an error code on error. This function is non-blocking,
* it returns immediately.
*/
int console_try_getc(void);
/*
* Function to force a write of all buffered data that hasn't been output. It
* returns 0 upon successful completion, otherwise it returns an error code.
*/
int console_flush(void);
#endif /* __ASSEMBLY__ */
#endif /* __CONSOLE_H__ */
|