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         int     reserved[5];
  26 };
  27 
  28 /*
  29  * These are the supported serial types.
  30  */
  31 #define PORT_UNKNOWN    0
  32 #define PORT_8250       1
  33 #define PORT_16450      2
  34 #define PORT_16550      3
  35 #define PORT_16550A     4
  36 #define PORT_MAX        4
  37 
  38 /*
  39  * Definitions for async_struct (and serial_struct) flags field
  40  */
  41 #define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
  42                                    on the callout port */
  43 #define ASYNC_FOURPORT  0x0002  /* Set OU1, OUT2 per AST Fourport settings */
  44 #define ASYNC_SAK       0x0004  /* Secure Attention Key (Orange book) */
  45 #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
  46 
  47 #define ASYNC_SPD_MASK  0x0030
  48 #define ASYNC_SPD_HI    0x0010  /* Use 56000 instead of 38400 bps */
  49 
  50 #define ASYNC_SPD_VHI   0x0020  /* Use 115200 instead of 38400 bps */
  51 #define ASYNC_SPD_CUST  0x0030  /* Use user-specified divisor */
  52 
  53 #define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
  54 #define ASYNC_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
  55 #define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
  56 #define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
  57 #define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
  58 
  59 #define ASYNC_FLAGS     0x0FFF  /* Possible legal async flags */
  60 #define ASYNC_USR_MASK 0x0430   /* Legal flags that non-privileged
  61                                  * users can set or reset */
  62 
  63 /* Internal flags used only by kernel/chr_drv/serial.c */
  64 #define ASYNC_INITIALIZED       0x80000000 /* Serial port was initialized */
  65 #define ASYNC_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
  66 #define ASYNC_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
  67 #define ASYNC_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
  68 #define ASYNC_CLOSING           0x08000000 /* Serial port is closing */
  69 #define ASYNC_CTS_FLOW          0x04000000 /* Do CTS flow control */
  70 #define ASYNC_CHECK_CD          0x02000000 /* i.e., CLOCAL */
  71 
  72 #ifdef __KERNEL__
  73 /*
  74  * This is our internal structure for each serial port's state.
  75  * 
  76  * Many fields are paralleled by the structure used by the serial_struct
  77  * structure.
  78  *
  79  * For definitions of the flags field, see tty.h
  80  */
  81 
  82 struct async_struct {
  83         int                     magic;
  84         int                     baud_base;
  85         int                     port;
  86         int                     irq;
  87         int                     flags;          /* defined in tty.h */
  88         int                     hub6;           /* HUB6 plus one */
  89         int                     type;           /* UART type */
  90         struct tty_struct       *tty;
  91         int                     read_status_mask;
  92         int                     ignore_status_mask;
  93         int                     timeout;
  94         int                     xmit_fifo_size;
  95         int                     custom_divisor;
  96         int                     x_char; /* xon/xoff character */
  97         int                     close_delay;
  98         int                     IER;    /* Interrupt Enable Register */
  99         int                     MCR;    /* Modem control register */
 100         int                     MCR_noint; /* MCR with interrupts off */
 101         int                     event;
 102         unsigned long           last_active;
 103         int                     line;
 104         int                     count;      /* # of fd on device */
 105         int                     blocked_open; /* # of blocked opens */
 106         long                    session; /* Session of opening process */
 107         long                    pgrp; /* pgrp of opening process */
 108         unsigned char           *xmit_buf;
 109         int                     xmit_head;
 110         int                     xmit_tail;
 111         int                     xmit_cnt;
 112         struct tq_struct        tqueue;
 113         struct termios          normal_termios;
 114         struct termios          callout_termios;
 115         struct wait_queue       *open_wait;
 116         struct wait_queue       *close_wait;
 117         struct async_struct     *next_port; /* For the linked list */
 118         struct async_struct     *prev_port;
 119 };
 120 
 121 #define SERIAL_MAGIC 0x5301
 122 
 123 /*
 124  * The size of the serial xmit buffer is 1 page, or 4096 bytes
 125  */
 126 #define SERIAL_XMIT_SIZE 4096
 127 
 128 /*
 129  * Events are used to schedule things to happen at timer-interrupt
 130  * time, instead of at rs interrupt time.
 131  */
 132 #define RS_EVENT_WRITE_WAKEUP   0
 133 #define RS_EVENT_HANGUP         1
 134 
 135 /* Export to allow PCMCIA to use this - Dave Hinds */
 136 extern int register_serial(struct serial_struct *req);
 137 extern void unregister_serial(int line);
 138 #endif /* __KERNEL__ */
 139 #endif /* _LINUX_SERIAL_H */

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