CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/wl/include/hndrte_cons.h
Views: 3960
1
/*
2
* Console support for hndrte.
3
*
4
* $Copyright Open Broadcom Corporation$
5
*
6
* $Id: hndrte_cons.h 383575 2013-02-07 03:10:23Z $
7
*/
8
#ifndef _HNDRTE_CONS_H
9
#define _HNDRTE_CONS_H
10
11
#include <typedefs.h>
12
13
#if defined(RWL_DONGLE) || defined(UART_REFLECTOR)
14
/* For Dongle uart tranport max cmd len is 256 bytes + header length (16 bytes)
15
* In case of ASD commands we are not sure about how much is the command size
16
* To be on the safe side, input buf len CBUF_LEN is increased to max (512) bytes.
17
*/
18
#define RWL_MAX_DATA_LEN (512 + 8) /* allow some extra bytes for '/n' termination */
19
#define CBUF_LEN (RWL_MAX_DATA_LEN + 64) /* allow 64 bytes for header ("rwl...") */
20
#else
21
#define CBUF_LEN (128)
22
#endif /* RWL_DONGLE || UART_REFLECTOR */
23
24
#define LOG_BUF_LEN 1024
25
26
typedef struct {
27
uint32 buf; /* Can't be pointer on (64-bit) hosts */
28
uint buf_size;
29
uint idx;
30
char *_buf_compat; /* redundant pointer for backward compat. */
31
} hndrte_log_t;
32
33
typedef struct {
34
/* Virtual UART
35
* When there is no UART (e.g. Quickturn), the host should write a complete
36
* input line directly into cbuf and then write the length into vcons_in.
37
* This may also be used when there is a real UART (at risk of conflicting with
38
* the real UART). vcons_out is currently unused.
39
*/
40
volatile uint vcons_in;
41
volatile uint vcons_out;
42
43
/* Output (logging) buffer
44
* Console output is written to a ring buffer log_buf at index log_idx.
45
* The host may read the output when it sees log_idx advance.
46
* Output will be lost if the output wraps around faster than the host polls.
47
*/
48
hndrte_log_t log;
49
50
/* Console input line buffer
51
* Characters are read one at a time into cbuf until <CR> is received, then
52
* the buffer is processed as a command line. Also used for virtual UART.
53
*/
54
uint cbuf_idx;
55
char cbuf[CBUF_LEN];
56
} hndrte_cons_t;
57
58
hndrte_cons_t *hndrte_get_active_cons_state(void);
59
60
#endif /* _HNDRTE_CONS_H */
61
62