blob: 652611a4bdcd1ea05aa0bcd6e6a2d9d1a2a39da7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Ingo Molnar81861d72006-03-23 03:00:44 -080015#include <linux/mutex.h>
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017struct real_driver {
18 void (*disable_tx_interrupts) (void *);
19 void (*enable_tx_interrupts) (void *);
20 void (*disable_rx_interrupts) (void *);
21 void (*enable_rx_interrupts) (void *);
22 int (*get_CD) (void *);
23 void (*shutdown_port) (void*);
24 int (*set_real_termios) (void*);
25 int (*chars_in_buffer) (void*);
26 void (*close) (void*);
27 void (*hungup) (void*);
28 void (*getserial) (void*, struct serial_struct *sp);
29};
30
31
32
33struct gs_port {
34 int magic;
35 unsigned char *xmit_buf;
36 int xmit_head;
37 int xmit_tail;
38 int xmit_cnt;
Ingo Molnar81861d72006-03-23 03:00:44 -080039 struct mutex port_write_mutex;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 int flags;
41 wait_queue_head_t open_wait;
42 wait_queue_head_t close_wait;
43 int count;
44 int blocked_open;
45 struct tty_struct *tty;
46 unsigned long event;
47 unsigned short closing_wait;
48 int close_delay;
49 struct real_driver *rd;
50 int wakeup_chars;
51 int baud_base;
52 int baud;
53 int custom_divisor;
54 spinlock_t driver_lock;
55};
56
57
58/* Flags */
59/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
60 used in serial.c, but they are also used in all other serial drivers.
61 Make sure they don't clash with these here... */
62#define GS_TX_INTEN 0x00800000
63#define GS_RX_INTEN 0x00400000
64#define GS_ACTIVE 0x00200000
65
66
67
68#define GS_TYPE_NORMAL 1
69
70#define GS_DEBUG_FLUSH 0x00000001
71#define GS_DEBUG_BTR 0x00000002
72#define GS_DEBUG_TERMIOS 0x00000004
73#define GS_DEBUG_STUFF 0x00000008
74#define GS_DEBUG_CLOSE 0x00000010
75#define GS_DEBUG_FLOW 0x00000020
76#define GS_DEBUG_WRITE 0x00000040
77
78
79void gs_put_char(struct tty_struct *tty, unsigned char ch);
80int gs_write(struct tty_struct *tty,
81 const unsigned char *buf, int count);
82int gs_write_room(struct tty_struct *tty);
83int gs_chars_in_buffer(struct tty_struct *tty);
84void gs_flush_buffer(struct tty_struct *tty);
85void gs_flush_chars(struct tty_struct *tty);
86void gs_stop(struct tty_struct *tty);
87void gs_start(struct tty_struct *tty);
88void gs_hangup(struct tty_struct *tty);
89int gs_block_til_ready(void *port, struct file *filp);
90void gs_close(struct tty_struct *tty, struct file *filp);
91void gs_set_termios (struct tty_struct * tty,
92 struct termios * old_termios);
93int gs_init_port(struct gs_port *port);
94int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
95int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
96void gs_got_break(struct gs_port *port);
97
98#endif