at v2.6.13 4.3 kB view raw
1/*****************************************************************************/ 2 3/* 4 * stallion.h -- stallion multiport serial driver. 5 * 6 * Copyright (C) 1996-1998 Stallion Technologies 7 * Copyright (C) 1994-1996 Greg Ungerer. 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 */ 23 24#include <linux/version.h> 25 26/*****************************************************************************/ 27#ifndef _STALLION_H 28#define _STALLION_H 29/*****************************************************************************/ 30 31/* 32 * Define important driver constants here. 33 */ 34#define STL_MAXBRDS 4 35#define STL_MAXPANELS 4 36#define STL_MAXBANKS 8 37#define STL_PORTSPERPANEL 16 38#define STL_MAXPORTS 64 39#define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS) 40 41 42/* 43 * Define a set of structures to hold all the board/panel/port info 44 * for our ports. These will be dynamically allocated as required. 45 */ 46 47/* 48 * Define a ring queue structure for each port. This will hold the 49 * TX data waiting to be output. Characters are fed into this buffer 50 * from the line discipline (or even direct from user space!) and 51 * then fed into the UARTs during interrupts. Will use a classic ring 52 * queue here for this. The good thing about this type of ring queue 53 * is that the head and tail pointers can be updated without interrupt 54 * protection - since "write" code only needs to change the head, and 55 * interrupt code only needs to change the tail. 56 */ 57typedef struct { 58 char *buf; 59 char *head; 60 char *tail; 61} stlrq_t; 62 63/* 64 * Port, panel and board structures to hold status info about each. 65 * The board structure contains pointers to structures for each panel 66 * connected to it, and in turn each panel structure contains pointers 67 * for each port structure for each port on that panel. Note that 68 * the port structure also contains the board and panel number that it 69 * is associated with, this makes it (fairly) easy to get back to the 70 * board/panel info for a port. 71 */ 72typedef struct stlport { 73 unsigned long magic; 74 int portnr; 75 int panelnr; 76 int brdnr; 77 int ioaddr; 78 int uartaddr; 79 int pagenr; 80 long istate; 81 int flags; 82 int baud_base; 83 int custom_divisor; 84 int close_delay; 85 int closing_wait; 86 int refcount; 87 int openwaitcnt; 88 int brklen; 89 unsigned int sigs; 90 unsigned int rxignoremsk; 91 unsigned int rxmarkmsk; 92 unsigned int imr; 93 unsigned int crenable; 94 unsigned long clk; 95 unsigned long hwid; 96 void *uartp; 97 struct tty_struct *tty; 98 wait_queue_head_t open_wait; 99 wait_queue_head_t close_wait; 100 struct work_struct tqueue; 101 comstats_t stats; 102 stlrq_t tx; 103} stlport_t; 104 105typedef struct stlpanel { 106 unsigned long magic; 107 int panelnr; 108 int brdnr; 109 int pagenr; 110 int nrports; 111 int iobase; 112 void *uartp; 113 void (*isr)(struct stlpanel *panelp, unsigned int iobase); 114 unsigned int hwid; 115 unsigned int ackmask; 116 stlport_t *ports[STL_PORTSPERPANEL]; 117} stlpanel_t; 118 119typedef struct stlbrd { 120 unsigned long magic; 121 int brdnr; 122 int brdtype; 123 int state; 124 int nrpanels; 125 int nrports; 126 int nrbnks; 127 int irq; 128 int irqtype; 129 int (*isr)(struct stlbrd *brdp); 130 unsigned int ioaddr1; 131 unsigned int ioaddr2; 132 unsigned int iosize1; 133 unsigned int iosize2; 134 unsigned int iostatus; 135 unsigned int ioctrl; 136 unsigned int ioctrlval; 137 unsigned int hwid; 138 unsigned long clk; 139 unsigned int bnkpageaddr[STL_MAXBANKS]; 140 unsigned int bnkstataddr[STL_MAXBANKS]; 141 stlpanel_t *bnk2panel[STL_MAXBANKS]; 142 stlpanel_t *panels[STL_MAXPANELS]; 143} stlbrd_t; 144 145 146/* 147 * Define MAGIC numbers used for above structures. 148 */ 149#define STL_PORTMAGIC 0x5a7182c9 150#define STL_PANELMAGIC 0x7ef621a1 151#define STL_BOARDMAGIC 0xa2267f52 152 153/*****************************************************************************/ 154#endif