URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [include/] [linux/] [serial.h] - Rev 1765
Compare with Previous | Blame | View Log
/* * include/linux/serial.h * * Copyright (C) 1992 by Theodore Ts'o. * * Redistribution of this file is permitted under the terms of the GNU * Public License (GPL) */ #ifndef _LINUX_SERIAL_H #define _LINUX_SERIAL_H struct serial_struct { int type; int line; int port; int irq; int flags; int xmit_fifo_size; int custom_divisor; int baud_base; unsigned short close_delay; char reserved_char[2]; int hub6; unsigned short closing_wait; /* time to wait before closing */ unsigned short closing_wait2; /* no longer used... */ int reserved[4]; }; /* * For the close wait times, 0 means wait forever for serial port to * flush its output. 65535 means don't wait at all. */ #define ASYNC_CLOSING_WAIT_INF 0 #define ASYNC_CLOSING_WAIT_NONE 65535 /* * These are the supported serial types. */ #define PORT_UNKNOWN 0 #define PORT_8250 1 #define PORT_16450 2 #define PORT_16550 3 #define PORT_16550A 4 #define PORT_CIRRUS 5 #define PORT_16650 6 #define PORT_STARTECH 7 #define PORT_MAX 7 /* * Definitions for async_struct (and serial_struct) flags field */ #define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes on the callout port */ #define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ #define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ #define ASYNC_SPD_MASK 0x0030 #define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ #define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ #define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ #define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ #define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ #define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ #define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ #define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ #define ASYNC_FLAGS 0x0FFF /* Possible legal async flags */ #define ASYNC_USR_MASK 0x0430 /* Legal flags that non-privileged * users can set or reset */ /* Internal flags used only by kernel/chr_drv/serial.c */ #define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */ #define ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */ #define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ #define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ #define ASYNC_CLOSING 0x08000000 /* Serial port is closing */ #define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ #define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ #define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards */ #define ASYNC_PCI 0x00800000 /* this port is on a PCI board */ /* * Multiport serial configuration structure --- external structure */ struct serial_multiport_struct { int irq; int port1; unsigned char mask1, match1; int port2; unsigned char mask2, match2; int port3; unsigned char mask3, match3; int port4; unsigned char mask4, match4; int port_monitor; int reserved[32]; }; /* * Serial input interrupt line counters -- external structure * Four lines can interrupt: CTS, DSR, RI, DCD */ struct serial_icounter_struct { int cts, dsr, rng, dcd; int reserved[16]; }; #ifdef __KERNEL__ /* * This is our internal structure for each serial port's state. * * Many fields are paralleled by the structure used by the serial_struct * structure. * * For definitions of the flags field, see tty.h */ #include <linux/termios.h> #include <linux/tqueue.h> /* * Counters of the input lines (CTS, DSR, RI, CD) interrupts */ struct async_icount { __u32 cts, dsr, rng, dcd; }; struct async_struct { int magic; int baud_base; int port; int irq; int flags; /* defined in tty.h */ int hub6; /* HUB6 plus one */ int type; /* UART type */ struct tty_struct *tty; int read_status_mask; int ignore_status_mask; int timeout; int xmit_fifo_size; int custom_divisor; int x_char; /* xon/xoff character */ int close_delay; unsigned short closing_wait; unsigned short closing_wait2; int IER; /* Interrupt Enable Register */ int MCR; /* Modem control register */ int MCR_noint; /* MCR with interrupts off */ unsigned long event; unsigned long last_active; int line; int count; /* # of fd on device */ int blocked_open; /* # of blocked opens */ long session; /* Session of opening process */ long pgrp; /* pgrp of opening process */ unsigned char *xmit_buf; int xmit_head; int xmit_tail; int xmit_cnt; struct tq_struct tqueue; struct tq_struct tqueue_hangup; struct termios normal_termios; struct termios callout_termios; struct wait_queue *open_wait; struct wait_queue *close_wait; struct wait_queue *delta_msr_wait; struct async_icount icount; /* kernel counters for the 4 input interrupts */ struct async_struct *next_port; /* For the linked list */ struct async_struct *prev_port; }; #define SERIAL_MAGIC 0x5301 /* * The size of the serial xmit buffer is 1 page, or 4096 bytes */ #define SERIAL_XMIT_SIZE 4096 /* * Events are used to schedule things to happen at timer-interrupt * time, instead of at rs interrupt time. */ #define RS_EVENT_WRITE_WAKEUP 0 /* * Multiport serial configuration structure --- internal structure */ struct rs_multiport_struct { int port1; unsigned char mask1, match1; int port2; unsigned char mask2, match2; int port3; unsigned char mask3, match3; int port4; unsigned char mask4, match4; int port_monitor; }; /* * PCI board base -- internal structure */ /* * There are four config spaces on a PCI board. Which ones house the * serial chips? */ enum pci_spc { pci_space_0 = 1, pci_space_1 = 2, pci_space_2 = 4, pci_space_3 = 8 }; struct pci_struct { int start; /* IO Base for this chip */ struct pci_serial_boards *type; /* Pointer to the board type */ }; struct pci_serial_boards { int vendor_id; /* Vendor of the Board */ int device_id; /* Device ID */ char *board_name; /* Name of the Board */ int board_type; /* Which chip is on the board */ enum pci_spc pci_space; /* How many PCI spaces should be mapped in? */ int dev_per_space; /* How many chips are in every PCI space */ int dev_spacing; /* What spacing are they located? */ int io_size; /* Size of the Register IO Space */ int baud_base; /* What crystal is on the board */ }; /* Export to allow PCMCIA to use this - Dave Hinds */ extern int register_serial(struct serial_struct *req); extern void unregister_serial(int line); #endif /* __KERNEL__ */ #endif /* _LINUX_SERIAL_H */