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