summaryrefslogtreecommitdiffstats
path: root/sys/sys/tty.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-09-28 19:33:49 +0000
committerphk <phk@FreeBSD.org>2004-09-28 19:33:49 +0000
commitd08ddc3f6b1f2a309026672172529e0e6b5c49ba (patch)
treeafd629dc9404f876695ee7e9634821d15b4fd059 /sys/sys/tty.h
parent0d1f936e786e73bd039b6c59438d854bdbe9be0c (diff)
downloadFreeBSD-src-d08ddc3f6b1f2a309026672172529e0e6b5c49ba.zip
FreeBSD-src-d08ddc3f6b1f2a309026672172529e0e6b5c49ba.tar.gz
Add functions to create and free the "tty-ness" of a serial port in a
generic way. This code will allow a similar amount of code to be removed from most if not all serial port drivers. Add generic cdevsw for tty devices. Add generic slave cdevsw for init/lock devices. Add ttypurge function which wakes up all know generic sleep points in the tty code, and calls into the hw-driver if it provides a method. Add ttycreate function which creates tty device and optionally cua device. In both cases .init/.lock devices are created as well. Change ttygone() slightly to also call the hw driver provided purge routine. Add ttyfree() which will purge and destroy the cdevs. Add ttyconsole mode for setting console friendly termios on a port.
Diffstat (limited to 'sys/sys/tty.h')
-rw-r--r--sys/sys/tty.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index fdbdc72..0054a42 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -68,10 +68,12 @@ struct clist {
struct tty;
struct pps_state;
struct cdev;
+struct cdevsw;
typedef int t_open_t(struct tty *, struct cdev *);
typedef void t_close_t(struct tty *);
typedef void t_oproc_t(struct tty *);
+typedef void t_purge_t(struct tty *);
typedef void t_stop_t(struct tty *, int);
typedef int t_param_t(struct tty *, struct termios *);
typedef int t_modem_t(struct tty *, int, int);
@@ -99,6 +101,7 @@ struct tty {
long t_outcc; /* Output queue statistics. */
int t_line; /* Interface to device drivers. */
struct cdev *t_dev; /* Device. */
+ struct cdev *t_mdev; /* Device. */
int t_state; /* Device and driver (TS*) state. */
int t_flags; /* Tty flags. */
int t_timeout; /* Timeout for ttywait() */
@@ -145,6 +148,7 @@ struct tty {
t_break_t *t_break; /* Set break state (optional). */
t_ioctl_t *t_ioctl; /* Set ioctl handling (optional). */
t_open_t *t_open; /* First open */
+ t_purge_t *t_purge; /* Purge threads */
t_close_t *t_close; /* Last close */
__d_ioctl_t *t_cioctl; /* Ioctl on control devices */
};
@@ -343,10 +347,13 @@ struct tty *ttyalloc(void);
void ttyblock(struct tty *tp);
void ttychars(struct tty *tp);
int ttycheckoutq(struct tty *tp, int wait);
+void ttyconsolemode(struct tty *tp, int speed);
int tty_close(struct tty *tp);
+int ttycreate(struct tty *tp, struct cdevsw *, int unit, int flags, const char *fmt, ...) __printflike(5, 6);
int ttydtrwaitsleep(struct tty *tp);
void ttydtrwaitstart(struct tty *tp);
void ttyflush(struct tty *tp, int rw);
+void ttyfree(struct tty *tp);
void ttygone(struct tty *tp);
void ttyinfo(struct tty *tp);
int ttyinput(int c, struct tty *tp);
OpenPOWER on IntegriCloud