Import 2.3.13pre7
[davej-history.git] / drivers / char / generic_serial.h
blobca321af9b0bfa8efad8bc4702c2c6a213fda7f0c
1 /*
2 * generic_serial.h
4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl
6 * written for the SX serial driver.
7 * Contains the code that should be shared over all the serial drivers.
9 * Version 0.1 -- December, 1998.
12 #ifndef GENERIC_SERIAL_H
13 #define GENERIC_SERIAL_H
15 struct real_driver {
16 void (*disable_tx_interrupts) (void *);
17 void (*enable_tx_interrupts) (void *);
18 void (*disable_rx_interrupts) (void *);
19 void (*enable_rx_interrupts) (void *);
20 int (*get_CD) (void *);
21 void (*shutdown_port) (void*);
22 void (*set_real_termios) (void*);
23 int (*chars_in_buffer) (void*);
24 void (*close) (void*);
25 void (*hungup) (void*);
26 void (*getserial) (void*, struct serial_struct *sp);
31 struct gs_port {
32 int magic;
33 unsigned char *xmit_buf;
34 int xmit_head;
35 int xmit_tail;
36 int xmit_cnt;
37 /* struct semaphore port_write_sem; */
38 int flags;
39 struct termios normal_termios;
40 struct termios callout_termios;
41 wait_queue_head_t open_wait;
42 wait_queue_head_t close_wait;
43 long session;
44 long pgrp;
45 int count;
46 int blocked_open;
47 struct tty_struct *tty;
48 int event;
49 unsigned short closing_wait;
50 int close_delay;
51 struct real_driver *rd;
52 int wakeup_chars;
53 int baud_base;
54 int baud;
55 int custom_divisor;
59 /* Flags */
60 /* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
61 used in serial.c, but they are also used in all other serial drivers.
62 Make sure they don't clash with these here... */
63 #define GS_TX_INTEN 0x00800000
64 #define GS_RX_INTEN 0x00400000
65 #define GS_ACTIVE 0x00200000
69 #define GS_TYPE_NORMAL 1
70 #define GS_TYPE_CALLOUT 2
73 #define GS_DEBUG_FLUSH 0x00000001
74 #define GS_DEBUG_BTR 0x00000002
75 #define GS_DEBUG_TERMIOS 0x00000004
76 #define GS_DEBUG_STUFF 0x00000008
77 #define GS_DEBUG_CLOSE 0x00000010
80 void gs_put_char(struct tty_struct *tty, unsigned char ch);
81 int gs_write(struct tty_struct *tty, int from_user,
82 const unsigned char *buf, int count);
83 int gs_write_room(struct tty_struct *tty);
84 int gs_chars_in_buffer(struct tty_struct *tty);
85 void gs_flush_buffer(struct tty_struct *tty);
86 void gs_flush_chars(struct tty_struct *tty);
87 void gs_stop(struct tty_struct *tty);
88 void gs_start(struct tty_struct *tty);
89 void gs_hangup(struct tty_struct *tty);
90 void gs_do_softint(void *private_);
91 int block_til_ready(void *port, struct file *filp);
92 void gs_close(struct tty_struct *tty, struct file *filp);
93 void gs_set_termios (struct tty_struct * tty,
94 struct termios * old_termios);
95 int gs_init_port(struct gs_port *port);
96 int gs_setserial(struct gs_port *port, struct serial_struct *sp);
97 void gs_getserial(struct gs_port *port, struct serial_struct *sp);
99 extern int gs_debug;
101 #endif