diff options
Diffstat (limited to 'sdk/dev/tty.h')
-rw-r--r-- | sdk/dev/tty.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/sdk/dev/tty.h b/sdk/dev/tty.h new file mode 100644 index 0000000..3ff02ca --- /dev/null +++ b/sdk/dev/tty.h @@ -0,0 +1,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 |