Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / hndrte_cons.h
blob18c8f7610857d0bfb3db0c43478993efa2c51c9b
1 /*
2 * Console support for hndrte.
4 * Copyright (C) 2010, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
12 * $Id: hndrte_cons.h,v 13.4 2009-10-08 21:49:58 Exp $
15 #include <typedefs.h>
17 #if defined(RWL_DONGLE) || defined(UART_REFLECTOR)
18 /* For Dongle uart tranport max cmd len is 256 bytes + header length (16 bytes)
19 * In case of ASD commands we are not sure about how much is the command size
20 * To be on the safe side, input buf len CBUF_LEN is increased to max (512) bytes.
22 #define RWL_MAX_DATA_LEN (512 + 8) /* allow some extra bytes for '/n' termination */
23 #define CBUF_LEN (RWL_MAX_DATA_LEN + 64) /* allow 64 bytes for header ("rwl...") */
24 #else
25 #define CBUF_LEN (128)
26 #endif /* RWL_DONGLE || UART_REFLECTOR */
28 #ifdef BCMDBG
29 #define LOG_BUF_LEN (16 * 1024)
30 #else
31 #define LOG_BUF_LEN 1024
32 #endif
34 typedef struct {
35 char *buf;
36 uint buf_size;
37 uint idx;
38 char *_buf_compat; /* redundant pointer for backward compat. */
39 } hndrte_log_t;
41 typedef struct {
42 /* Virtual UART
43 * When there is no UART (e.g. Quickturn), the host should write a complete
44 * input line directly into cbuf and then write the length into vcons_in.
45 * This may also be used when there is a real UART (at risk of conflicting with
46 * the real UART). vcons_out is currently unused.
48 volatile uint vcons_in;
49 volatile uint vcons_out;
51 /* Output (logging) buffer
52 * Console output is written to a ring buffer log_buf at index log_idx.
53 * The host may read the output when it sees log_idx advance.
54 * Output will be lost if the output wraps around faster than the host polls.
56 hndrte_log_t log;
58 /* Console input line buffer
59 * Characters are read one at a time into cbuf until <CR> is received, then
60 * the buffer is processed as a command line. Also used for virtual UART.
62 uint cbuf_idx;
63 char cbuf[CBUF_LEN];
64 } hndrte_cons_t;