root/include/linux/serial.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   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_MAX        6
  48 
  49 /*
  50  * Definitions for async_struct (and serial_struct) flags field
  51  */
  52 #define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
  53                                    on the callout port */
  54 #define ASYNC_FOURPORT  0x0002  /* Set OU1, OUT2 per AST Fourport settings */
  55 #define ASYNC_SAK       0x0004  /* Secure Attention Key (Orange book) */
  56 #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
  57 
  58 #define ASYNC_SPD_MASK  0x0030
  59 #define ASYNC_SPD_HI    0x0010  /* Use 56000 instead of 38400 bps */
  60 
  61 #define ASYNC_SPD_VHI   0x0020  /* Use 115200 instead of 38400 bps */
  62 #define ASYNC_SPD_CUST  0x0030  /* Use user-specified divisor */
  63 
  64 #define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
  65 #define ASYNC_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
  66 #define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
  67 #define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
  68 #define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
  69 
  70 #define ASYNC_FLAGS     0x0FFF  /* Possible legal async flags */
  71 #define ASYNC_USR_MASK 0x0430   /* Legal flags that non-privileged
  72                                  * users can set or reset */
  73 
  74 /* Internal flags used only by kernel/chr_drv/serial.c */
  75 #define ASYNC_INITIALIZED       0x80000000 /* Serial port was initialized */
  76 #define ASYNC_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
  77 #define ASYNC_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
  78 #define ASYNC_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
  79 #define ASYNC_CLOSING           0x08000000 /* Serial port is closing */
  80 #define ASYNC_CTS_FLOW          0x04000000 /* Do CTS flow control */
  81 #define ASYNC_CHECK_CD          0x02000000 /* i.e., CLOCAL */
  82 
  83 /*
  84  * Multiport serial configuration structure --- external structure
  85  */
  86 struct serial_multiport_struct {
  87         int             irq;
  88         int             port1;
  89         unsigned char   mask1, match1;
  90         int             port2;
  91         unsigned char   mask2, match2;
  92         int             port3;
  93         unsigned char   mask3, match3;
  94         int             port4;
  95         unsigned char   mask4, match4;
  96         int             port_monitor;
  97         int     reserved[32];
  98 };
  99 
 100 #ifdef __KERNEL__
 101 /*
 102  * This is our internal structure for each serial port's state.
 103  * 
 104  * Many fields are paralleled by the structure used by the serial_struct
 105  * structure.
 106  *
 107  * For definitions of the flags field, see tty.h
 108  */
 109 
 110 struct async_struct {
 111         int                     magic;
 112         int                     baud_base;
 113         int                     port;
 114         int                     irq;
 115         int                     flags;          /* defined in tty.h */
 116         int                     hub6;           /* HUB6 plus one */
 117         int                     type;           /* UART type */
 118         struct tty_struct       *tty;
 119         int                     read_status_mask;
 120         int                     ignore_status_mask;
 121         int                     timeout;
 122         int                     xmit_fifo_size;
 123         int                     custom_divisor;
 124         int                     x_char; /* xon/xoff character */
 125         int                     close_delay;
 126         unsigned short          closing_wait;
 127         unsigned short          closing_wait2;
 128         int                     IER;    /* Interrupt Enable Register */
 129         int                     MCR;    /* Modem control register */
 130         int                     MCR_noint; /* MCR with interrupts off */
 131         unsigned long           event;
 132         unsigned long           last_active;
 133         int                     line;
 134         int                     count;      /* # of fd on device */
 135         int                     blocked_open; /* # of blocked opens */
 136         long                    session; /* Session of opening process */
 137         long                    pgrp; /* pgrp of opening process */
 138         unsigned char           *xmit_buf;
 139         int                     xmit_head;
 140         int                     xmit_tail;
 141         int                     xmit_cnt;
 142         struct tq_struct        tqueue;
 143         struct tq_struct        tqueue_hangup;
 144         struct termios          normal_termios;
 145         struct termios          callout_termios;
 146         struct wait_queue       *open_wait;
 147         struct wait_queue       *close_wait;
 148         struct async_struct     *next_port; /* For the linked list */
 149         struct async_struct     *prev_port;
 150 };
 151 
 152 #define SERIAL_MAGIC 0x5301
 153 
 154 /*
 155  * The size of the serial xmit buffer is 1 page, or 4096 bytes
 156  */
 157 #define SERIAL_XMIT_SIZE 4096
 158 
 159 /*
 160  * Events are used to schedule things to happen at timer-interrupt
 161  * time, instead of at rs interrupt time.
 162  */
 163 #define RS_EVENT_WRITE_WAKEUP   0
 164 
 165 /*
 166  * Multiport serial configuration structure --- internal structure
 167  */
 168 struct rs_multiport_struct {
 169         int             port1;
 170         unsigned char   mask1, match1;
 171         int             port2;
 172         unsigned char   mask2, match2;
 173         int             port3;
 174         unsigned char   mask3, match3;
 175         int             port4;
 176         unsigned char   mask4, match4;
 177         int             port_monitor;
 178 };
 179 
 180 /* Export to allow PCMCIA to use this - Dave Hinds */
 181 extern int register_serial(struct serial_struct *req);
 182 extern void unregister_serial(int line);
 183 #endif /* __KERNEL__ */
 184 #endif /* _LINUX_SERIAL_H */

/* [previous][next][first][last][top][bottom][index][help] */