aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/dev/tty.h
blob: 3ff02caec5f07945efcec670287e6b790af6f300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * Portable serial interface control and operation.
 * $Id$
 * Copyright (c) 1997 by Tycho Softworks.
 * For conditions of distribution and reuse see product license.
 */

#ifndef	__DEV_TTY_H__
#define	__DEV_TTY_H__

#ifndef	__STD_TYPES_H__
#include <std/types.h>
#endif

#ifndef	__STD_FILES_H__
#include <std/files.h>
#endif

typedef	void	*stty_t;

#ifdef	__cplusplus
extern "C" {
#endif

#define	ulock_device(lck) ulock_file(lck)

typedef	enum
{
	FC_NONE,
	FC_HARD,
	FC_SOFT,
	FC_FULL
}	FLOWCONTROL;

#ifdef	__NAMESPACE
#define	lock_device	__NAMESPACE(lock_device)
#define	setspeed	__NAMESPACE(setspeed)
#define	setformat	__NAMESPACE(setformat)
#define	setflowctrl	__NAMESPACE(setflowctrl)
#define	waitfor		__NAMESPACE(waitfor)
#define	waitsync	__NAMESPACE(waitsync)
#define	input		__NAMESPACE(input)
#define	dropdtr		__NAMESPACE(dropdtr)
#define	inkey		__NAMESPACE(inkey)
#define	interactive	__NAMESPACE(interactive)
#define	readcrc		__NAMESPACE(readcrc)
#define	writecrc	__NAMESPACE(writecrc)
#define	readcsum	__NAMESPACE(readcsum)
#define	writecsum	__NAMESPACE(writecsum)
#define	xmit		__NAMESPACE(xmit)
#define	empty		__NAMESPACE(empty)
#endif

stty_t	getstty(fd_t fd);
void	putstty(fd_t fd, stty_t stty, bool now);
int	setspeed(stty_t stty, ulong speed);
int	setformat(stty_t stty, char *format);
int	setflowctrl(stty_t stty, FLOWCONTROL flow);
int	waitfor(fd_t fd, uchar *str, size_t len, int timeout, ulong maxbytes);
int 	waitsync(fd_t fd, uchar *list, size_t len, int timeout, ulong maxbytes);
int	input(fd_t fd, uchar *buf, size_t len, int timeout, const uchar *term);
int	dropdtr(fd_t fd);
int	inkey(fd_t fd, int timeout);
bool	interactive(stty_t stty, bool mode);
int	xmit(fd_t fd, char *str);
void	empty(fd_t fd);

#ifdef	__cplusplus
}
#endif

#endif