Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

linux/serial.h

Go to the documentation of this file.
00001 /*
00002  * include/linux/serial.h
00003  *
00004  * Copyright (C) 1992 by Theodore Ts'o.
00005  * 
00006  * Redistribution of this file is permitted under the terms of the GNU 
00007  * Public License (GPL)
00008  */
00009 
00010 #ifndef _LINUX_SERIAL_H
00011 #define _LINUX_SERIAL_H
00012 
00013 struct serial_struct {
00014         int     type;
00015         int     line;
00016         int     port;
00017         int     irq;
00018         int     flags;
00019         int     xmit_fifo_size;
00020         int     custom_divisor;
00021         int     baud_base;
00022         unsigned short  close_delay;
00023         char    reserved_char[2];
00024         int     hub6;
00025         unsigned short  closing_wait; /* time to wait before closing */
00026         unsigned short  closing_wait2; /* no longer used... */
00027         int     reserved[4];
00028 };
00029 
00030 /*
00031  * For the close wait times, 0 means wait forever for serial port to
00032  * flush its output.  65535 means don't wait at all.
00033  */
00034 #define ASYNC_CLOSING_WAIT_INF  0
00035 #define ASYNC_CLOSING_WAIT_NONE 65535
00036 
00037 /*
00038  * These are the supported serial types.
00039  */
00040 #define PORT_UNKNOWN    0
00041 #define PORT_8250       1
00042 #define PORT_16450      2
00043 #define PORT_16550      3
00044 #define PORT_16550A     4
00045 #define PORT_CIRRUS     5       /* usurped by cyclades.c */
00046 #define PORT_16650      6
00047 #define PORT_16650V2    7
00048 #define PORT_16750      8
00049 #define PORT_STARTECH   9       /* usurped by cyclades.c */
00050 #define PORT_MAX        9
00051 
00052 struct serial_uart_config {
00053         char    *name;
00054         int     dfl_xmit_fifo_size;
00055         int     flags;
00056 };
00057 
00058 #define UART_CLEAR_FIFO         0x01
00059 #define UART_USE_FIFO           0x02
00060 #define UART_STARTECH           0x04
00061 
00062 /*
00063  * Definitions for async_struct (and serial_struct) flags field
00064  */
00065 #define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
00066                                    on the callout port */
00067 #define ASYNC_FOURPORT  0x0002  /* Set OU1, OUT2 per AST Fourport settings */
00068 #define ASYNC_SAK       0x0004  /* Secure Attention Key (Orange book) */
00069 #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
00070 
00071 #define ASYNC_SPD_MASK  0x1030
00072 #define ASYNC_SPD_HI    0x0010  /* Use 56000 instead of 38400 bps */
00073 
00074 #define ASYNC_SPD_VHI   0x0020  /* Use 115200 instead of 38400 bps */
00075 #define ASYNC_SPD_CUST  0x0030  /* Use user-specified divisor */
00076 
00077 #define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
00078 #define ASYNC_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
00079 #define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
00080 #define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
00081 #define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
00082 
00083 #define ASYNC_HARDPPS_CD        0x0800  /* Call hardpps when CD goes high  */
00084 
00085 #define ASYNC_SPD_SHI   0x1000  /* Use 230400 instead of 38400 bps */
00086 #define ASYNC_SPD_WARP  0x1010  /* Use 460800 instead of 38400 bps */
00087 
00088 #define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */
00089 
00090 #define ASYNC_FLAGS     0x3FFF  /* Possible legal async flags */
00091 #define ASYNC_USR_MASK  0x3430  /* Legal flags that non-privileged
00092                                  * users can set or reset */
00093 
00094 /* Internal flags used only by kernel/chr_drv/serial.c */
00095 #define ASYNC_INITIALIZED       0x80000000 /* Serial port was initialized */
00096 #define ASYNC_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
00097 #define ASYNC_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
00098 #define ASYNC_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
00099 #define ASYNC_CLOSING           0x08000000 /* Serial port is closing */
00100 #define ASYNC_CTS_FLOW          0x04000000 /* Do CTS flow control */
00101 #define ASYNC_CHECK_CD          0x02000000 /* i.e., CLOCAL */
00102 #define ASYNC_SHARE_IRQ         0x01000000 /* for multifunction cards */
00103 
00104 #define ASYNC_INTERNAL_FLAGS    0xFF000000 /* Internal flags */
00105 
00106 /*
00107  * Multiport serial configuration structure --- external structure
00108  */
00109 struct serial_multiport_struct {
00110         int             irq;
00111         int             port1;
00112         unsigned char   mask1, match1;
00113         int             port2;
00114         unsigned char   mask2, match2;
00115         int             port3;
00116         unsigned char   mask3, match3;
00117         int             port4;
00118         unsigned char   mask4, match4;
00119         int             port_monitor;
00120         int     reserved[32];
00121 };
00122 
00123 /*
00124  * Serial input interrupt line counters -- external structure
00125  * Four lines can interrupt: CTS, DSR, RI, DCD
00126  */
00127 struct serial_icounter_struct {
00128         int cts, dsr, rng, dcd;
00129         int rx, tx;
00130         int frame, overrun, parity, brk;
00131         int buf_overrun;
00132         int reserved[9];
00133 };
00134 
00135 
00136 #ifdef __KERNEL__
00137 /* Export to allow PCMCIA to use this - Dave Hinds */
00138 extern int register_serial(struct serial_struct *req);
00139 extern void unregister_serial(int line);
00140 
00141 #endif /* __KERNEL__ */
00142 #endif /* _LINUX_SERIAL_H */