• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Console support for RTE - for host use only.
4  *
5  * Copyright (C) 1999-2019, Broadcom.
6  *
7  *      Unless you and Broadcom execute a separate written software license
8  * agreement governing use of this software, this software is licensed to you
9  * under the terms of the GNU General Public License version 2 (the "GPL"),
10  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
11  * following added to such license:
12  *
13  *      As a special exception, the copyright holders of this software give you
14  * permission to link this software with independent modules, and to copy and
15  * distribute the resulting executable under terms of your choice, provided that
16  * you also meet, for each linked independent module, the terms and conditions of
17  * the license of that module.  An independent module is a module which is not
18  * derived from this software.  The special exception does not apply to any
19  * modifications of the software.
20  *
21  *      Notwithstanding the above, under no circumstances may you combine this
22  * software in any way with any other Broadcom software provided under a license
23  * other than the GPL, without Broadcom's express prior written consent.
24  *
25  *
26  * <<Broadcom-WL-IPTag/Open:>>
27  *
28  * $Id: hnd_cons.h 624181 2016-03-10 18:58:22Z $
29  */
30 #ifndef	_hnd_cons_h_
31 #define	_hnd_cons_h_
32 
33 #include <typedefs.h>
34 #include <siutils.h>
35 
36 #define CBUF_LEN	(128)
37 
38 #ifndef LOG_BUF_LEN
39 #if defined(BCM_BIG_LOG)
40 #define LOG_BUF_LEN	(16 * 1024)
41 #else
42 #define LOG_BUF_LEN	1024
43 #endif // endif
44 #endif /* LOG_BUF_LEN */
45 
46 #ifdef BOOTLOADER_CONSOLE_OUTPUT
47 #undef RWL_MAX_DATA_LEN
48 #undef CBUF_LEN
49 #undef LOG_BUF_LEN
50 #define RWL_MAX_DATA_LEN (4 * 1024 + 8)
51 #define CBUF_LEN	(RWL_MAX_DATA_LEN + 64)
52 #define LOG_BUF_LEN (16 * 1024)
53 #endif // endif
54 
55 typedef struct {
56 	uint32		buf;		/* Can't be pointer on (64-bit) hosts */
57 	uint		buf_size;
58 	uint		idx;
59 	uint		out_idx;	/* output index */
60 } hnd_log_t;
61 
62 typedef struct {
63 	/* Virtual UART
64 	 *   When there is no UART (e.g. Quickturn), the host should write a complete
65 	 *   input line directly into cbuf and then write the length into vcons_in.
66 	 *   This may also be used when there is a real UART (at risk of conflicting with
67 	 *   the real UART).  vcons_out is currently unused.
68 	 */
69 	volatile uint	vcons_in;
70 	volatile uint	vcons_out;
71 
72 	/* Output (logging) buffer
73 	 *   Console output is written to a ring buffer log_buf at index log_idx.
74 	 *   The host may read the output when it sees log_idx advance.
75 	 *   Output will be lost if the output wraps around faster than the host polls.
76 	 */
77 	hnd_log_t	log;
78 
79 	/* Console input line buffer
80 	 *   Characters are read one at a time into cbuf until <CR> is received, then
81 	 *   the buffer is processed as a command line.  Also used for virtual UART.
82 	 */
83 	uint		cbuf_idx;
84 	char		cbuf[CBUF_LEN];
85 } hnd_cons_t;
86 
87 #endif /* _hnd_cons_h_ */
88