Skip to content

Commit 744eed5

Browse files
committed
cu: merge the cu.h to cu_main.c
merge the cu.h to cu_main.c, to make the cu tools code more cleaner Signed-off-by: guoshichao <[email protected]>
1 parent 3d74819 commit 744eed5

File tree

2 files changed

+32
-93
lines changed

2 files changed

+32
-93
lines changed

system/cu/cu.h

Lines changed: 0 additions & 92 deletions
This file was deleted.

system/cu/cu_main.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,26 @@
5353
#include <stdlib.h>
5454
#include <signal.h>
5555
#include <debug.h>
56+
#include <stdint.h>
57+
#include <stdbool.h>
58+
#include <semaphore.h>
59+
#include <termios.h>
5660

5761
#include "system/readline.h"
5862

59-
#include "cu.h"
63+
/****************************************************************************
64+
* Pre-processor Definitions
65+
****************************************************************************/
66+
67+
/* Configuration ************************************************************/
68+
69+
#ifndef CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE
70+
# define CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE "/dev/ttyS0"
71+
#endif
72+
73+
#ifndef CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD
74+
# define CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD 115200
75+
#endif
6076

6177
#ifdef CONFIG_SYSTEM_CUTERM_DISABLE_ERROR_PRINT
6278
# define cu_error(...)
@@ -75,6 +91,21 @@ enum parity_mode
7591
PARITY_ODD,
7692
};
7793

94+
/* All terminal state data is packaged in a single structure to minimize
95+
* name conflicts with other global symbols -- a poor man's name space.
96+
*/
97+
98+
struct cu_globals_s
99+
{
100+
int devfd; /* I/O data to serial port */
101+
int stdfd; /* I/O data to standard console */
102+
int escape; /* Escape char */
103+
struct termios devtio; /* Original serial port setting */
104+
struct termios stdtio; /* Original standard console setting */
105+
pthread_t listener; /* Terminal listener thread */
106+
bool force_exit; /* Force exit */
107+
};
108+
78109
/****************************************************************************
79110
* Private Data
80111
****************************************************************************/

0 commit comments

Comments
 (0)