18ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt/*
28ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * Console support for hndrte.
38ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt *
4832523286e7a5d2fb5ea9f4b87659508d44cdf45Dmitry Shmidt * Copyright (C) 1999-2012, Broadcom Corporation
58ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt *
6832523286e7a5d2fb5ea9f4b87659508d44cdf45Dmitry Shmidt *      Unless you and Broadcom execute a separate written software license
78ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * agreement governing use of this software, this software is licensed to you
88ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * under the terms of the GNU General Public License version 2 (the "GPL"),
98ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * available at http://www.broadcom.com/licenses/GPLv2.php, with the
108ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * following added to such license:
118ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt *
128ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt *      As a special exception, the copyright holders of this software give you
138ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * permission to link this software with independent modules, and to copy and
148ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * distribute the resulting executable under terms of your choice, provided that
158ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * you also meet, for each linked independent module, the terms and conditions of
168ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * the license of that module.  An independent module is a module which is not
178ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * derived from this software.  The special exception does not apply to any
188ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * modifications of the software.
198ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt *
208ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt *      Notwithstanding the above, under no circumstances may you combine this
218ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * software in any way with any other Broadcom software provided under a license
228ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt * other than the GPL, without Broadcom's express prior written consent.
238ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt *
24832523286e7a5d2fb5ea9f4b87659508d44cdf45Dmitry Shmidt * $Id: hndrte_cons.h 300516 2011-12-04 17:39:44Z $
258ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt */
268ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt#ifndef	_HNDRTE_CONS_H
278ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt#define	_HNDRTE_CONS_H
288ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
298ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt#include <typedefs.h>
308ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
318ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt#define CBUF_LEN	(128)
328ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
338ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt#define LOG_BUF_LEN	1024
348ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
358ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidttypedef struct {
368ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	uint32		buf;		/* Can't be pointer on (64-bit) hosts */
378ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	uint		buf_size;
388ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	uint		idx;
398ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	char		*_buf_compat;	/* redundant pointer for backward compat. */
408ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt} hndrte_log_t;
418ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
428ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidttypedef struct {
438ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	/* Virtual UART
448ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   When there is no UART (e.g. Quickturn), the host should write a complete
458ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   input line directly into cbuf and then write the length into vcons_in.
468ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   This may also be used when there is a real UART (at risk of conflicting with
478ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   the real UART).  vcons_out is currently unused.
488ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 */
498ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	volatile uint	vcons_in;
508ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	volatile uint	vcons_out;
518ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
528ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	/* Output (logging) buffer
538ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   Console output is written to a ring buffer log_buf at index log_idx.
548ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   The host may read the output when it sees log_idx advance.
558ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   Output will be lost if the output wraps around faster than the host polls.
568ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 */
578ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	hndrte_log_t	log;
588ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
598ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	/* Console input line buffer
608ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   Characters are read one at a time into cbuf until <CR> is received, then
618ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 *   the buffer is processed as a command line.  Also used for virtual UART.
628ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	 */
638ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	uint		cbuf_idx;
648ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt	char		cbuf[CBUF_LEN];
658ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt} hndrte_cons_t;
668ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt
678ce1727333a1c411bb88330d69f82386a118c6bfDmitry Shmidt#endif /* _HNDRTE_CONS_H */
68