File: /usr/src/linux/include/linux/generic_serial.h

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