OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [serial.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * include/linux/serial.h
3
 *
4
 * Copyright (C) 1992 by Theodore Ts'o.
5
 *
6
 * Redistribution of this file is permitted under the terms of the GNU
7
 * Public License (GPL)
8
 */
9
 
10
#ifndef _LINUX_SERIAL_H
11
#define _LINUX_SERIAL_H
12
 
13
struct serial_struct {
14
        int     type;
15
        int     line;
16
        int     port;
17
        int     irq;
18
        int     flags;
19
        int     xmit_fifo_size;
20
        int     custom_divisor;
21
        int     baud_base;
22
        unsigned short  close_delay;
23
        char    reserved_char[2];
24
        int     hub6;
25
        unsigned short  closing_wait; /* time to wait before closing */
26
        unsigned short  closing_wait2; /* no longer used... */
27
        int     reserved[4];
28
};
29
 
30
/*
31
 * For the close wait times, 0 means wait forever for serial port to
32
 * flush its output.  65535 means don't wait at all.
33
 */
34
#define ASYNC_CLOSING_WAIT_INF  0
35
#define ASYNC_CLOSING_WAIT_NONE 65535
36
 
37
/*
38
 * These are the supported serial types.
39
 */
40
#define PORT_UNKNOWN    0
41
#define PORT_8250       1
42
#define PORT_16450      2
43
#define PORT_16550      3
44
#define PORT_16550A     4
45
#define PORT_CIRRUS     5
46
#define PORT_16650      6
47
#define PORT_STARTECH   7
48
#define PORT_MAX        7
49
 
50
/*
51
 * Definitions for async_struct (and serial_struct) flags field
52
 */
53
#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
54
                                   on the callout port */
55
#define ASYNC_FOURPORT  0x0002  /* Set OU1, OUT2 per AST Fourport settings */
56
#define ASYNC_SAK       0x0004  /* Secure Attention Key (Orange book) */
57
#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
58
 
59
#define ASYNC_SPD_MASK  0x0030
60
#define ASYNC_SPD_HI    0x0010  /* Use 56000 instead of 38400 bps */
61
 
62
#define ASYNC_SPD_VHI   0x0020  /* Use 115200 instead of 38400 bps */
63
#define ASYNC_SPD_CUST  0x0030  /* Use user-specified divisor */
64
 
65
#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
66
#define ASYNC_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
67
#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
68
#define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
69
#define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
70
 
71
#define ASYNC_FLAGS     0x0FFF  /* Possible legal async flags */
72
#define ASYNC_USR_MASK 0x0430   /* Legal flags that non-privileged
73
                                 * users can set or reset */
74
 
75
/* Internal flags used only by kernel/chr_drv/serial.c */
76
#define ASYNC_INITIALIZED       0x80000000 /* Serial port was initialized */
77
#define ASYNC_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
78
#define ASYNC_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
79
#define ASYNC_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
80
#define ASYNC_CLOSING           0x08000000 /* Serial port is closing */
81
#define ASYNC_CTS_FLOW          0x04000000 /* Do CTS flow control */
82
#define ASYNC_CHECK_CD          0x02000000 /* i.e., CLOCAL */
83
#define ASYNC_SHARE_IRQ         0x01000000 /* for multifunction cards */
84
#define ASYNC_PCI           0x00800000 /* this port is on a PCI board */
85
 
86
/*
87
 * Multiport serial configuration structure --- external structure
88
 */
89
struct serial_multiport_struct {
90
        int             irq;
91
        int             port1;
92
        unsigned char   mask1, match1;
93
        int             port2;
94
        unsigned char   mask2, match2;
95
        int             port3;
96
        unsigned char   mask3, match3;
97
        int             port4;
98
        unsigned char   mask4, match4;
99
        int             port_monitor;
100
        int     reserved[32];
101
};
102
 
103
/*
104
 * Serial input interrupt line counters -- external structure
105
 * Four lines can interrupt: CTS, DSR, RI, DCD
106
 */
107
struct serial_icounter_struct {
108
        int cts, dsr, rng, dcd;
109
        int reserved[16];
110
};
111
 
112
 
113
#ifdef __KERNEL__
114
/*
115
 * This is our internal structure for each serial port's state.
116
 *
117
 * Many fields are paralleled by the structure used by the serial_struct
118
 * structure.
119
 *
120
 * For definitions of the flags field, see tty.h
121
 */
122
 
123
#include <linux/termios.h>
124
#include <linux/tqueue.h>
125
 
126
/*
127
 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
128
 */
129
struct async_icount {
130
        __u32   cts, dsr, rng, dcd;
131
};
132
 
133
struct async_struct {
134
        int                     magic;
135
        int                     baud_base;
136
        int                     port;
137
        int                     irq;
138
        int                     flags;          /* defined in tty.h */
139
        int                     hub6;           /* HUB6 plus one */
140
        int                     type;           /* UART type */
141
        struct tty_struct       *tty;
142
        int                     read_status_mask;
143
        int                     ignore_status_mask;
144
        int                     timeout;
145
        int                     xmit_fifo_size;
146
        int                     custom_divisor;
147
        int                     x_char; /* xon/xoff character */
148
        int                     close_delay;
149
        unsigned short          closing_wait;
150
        unsigned short          closing_wait2;
151
        int                     IER;    /* Interrupt Enable Register */
152
        int                     MCR;    /* Modem control register */
153
        int                     MCR_noint; /* MCR with interrupts off */
154
        unsigned long           event;
155
        unsigned long           last_active;
156
        int                     line;
157
        int                     count;      /* # of fd on device */
158
        int                     blocked_open; /* # of blocked opens */
159
        long                    session; /* Session of opening process */
160
        long                    pgrp; /* pgrp of opening process */
161
        unsigned char           *xmit_buf;
162
        int                     xmit_head;
163
        int                     xmit_tail;
164
        int                     xmit_cnt;
165
        struct tq_struct        tqueue;
166
        struct tq_struct        tqueue_hangup;
167
        struct termios          normal_termios;
168
        struct termios          callout_termios;
169
        struct wait_queue       *open_wait;
170
        struct wait_queue       *close_wait;
171
        struct wait_queue       *delta_msr_wait;
172
        struct async_icount     icount; /* kernel counters for the 4 input interrupts */
173
        struct async_struct     *next_port; /* For the linked list */
174
        struct async_struct     *prev_port;
175
};
176
 
177
#define SERIAL_MAGIC 0x5301
178
 
179
/*
180
 * The size of the serial xmit buffer is 1 page, or 4096 bytes
181
 */
182
#define SERIAL_XMIT_SIZE 4096
183
 
184
/*
185
 * Events are used to schedule things to happen at timer-interrupt
186
 * time, instead of at rs interrupt time.
187
 */
188
#define RS_EVENT_WRITE_WAKEUP   0
189
 
190
/*
191
 * Multiport serial configuration structure --- internal structure
192
 */
193
struct rs_multiport_struct {
194
        int             port1;
195
        unsigned char   mask1, match1;
196
        int             port2;
197
        unsigned char   mask2, match2;
198
        int             port3;
199
        unsigned char   mask3, match3;
200
        int             port4;
201
        unsigned char   mask4, match4;
202
        int             port_monitor;
203
};
204
 
205
/*
206
 * PCI board base -- internal structure
207
 */
208
 
209
/*
210
 * There are four config spaces on a PCI board. Which ones house the
211
 * serial chips?
212
 */
213
 
214
enum pci_spc {
215
  pci_space_0 = 1,
216
  pci_space_1 = 2,
217
  pci_space_2 = 4,
218
  pci_space_3 = 8
219
};
220
 
221
struct pci_struct {
222
  int start;                        /* IO Base for this chip */
223
  struct pci_serial_boards *type;   /* Pointer to the board type */
224
};
225
 
226
struct pci_serial_boards {
227
  int vendor_id;          /* Vendor of the Board */
228
  int device_id;          /* Device ID */
229
  char *board_name;       /* Name of the Board */
230
  int board_type;         /* Which chip is on the board */
231
  enum pci_spc pci_space; /* How many PCI spaces should be mapped in? */
232
  int dev_per_space;      /* How many chips are in every PCI space */
233
  int dev_spacing;        /* What spacing are they located? */
234
  int io_size;            /* Size of the Register IO Space */
235
  int baud_base;          /* What crystal is on the board */
236
};
237
 
238
 
239
 
240
 
241
/* Export to allow PCMCIA to use this - Dave Hinds */
242
extern int register_serial(struct serial_struct *req);
243
extern void unregister_serial(int line);
244
#endif /* __KERNEL__ */
245
#endif /* _LINUX_SERIAL_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.