Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 
  2 /*
  3  *  sx.h
  4  *
  5  *  Copyright (C) 1998/1999 R.E.Wolff@BitWizard.nl
  6  *
  7  *  SX serial driver.
  8  *  -- Supports SI, XIO and SX host cards. 
  9  *  -- Supports TAs, MTAs and SXDCs.
 10  *
 11  *  Version 1.3 -- March, 1999. 
 12  * 
 13  */
 14 
 15 #define SX_NBOARDS        4
 16 #define SX_PORTSPERBOARD 32
 17 #define SX_NPORTS        (SX_NBOARDS * SX_PORTSPERBOARD)
 18 
 19 #ifdef __KERNEL__
 20 
 21 #define SX_MAGIC 0x12345678
 22 
 23 struct sx_port {
 24   struct gs_port          gs;
 25   struct wait_queue       *shutdown_wait;
 26   int                     ch_base;
 27   int                     c_dcd;
 28   struct sx_board         *board;
 29   int                     line;
 30   unsigned long           locks;
 31 };
 32 
 33 struct sx_board {
 34   int magic;
 35   void __iomem *base;
 36   void __iomem *base2;
 37   unsigned long hw_base;
 38   resource_size_t hw_len;
 39   int eisa_base;
 40   int port_base; /* Number of the first port */
 41   struct sx_port *ports;
 42   int nports;
 43   int flags;
 44   int irq;
 45   int poll;
 46   int ta_type;
 47   struct timer_list       timer;
 48   unsigned long           locks;
 49 };
 50 
 51 struct vpd_prom {
 52   unsigned short id;
 53   char hwrev;
 54   char hwass;
 55   int uniqid;
 56   char myear;
 57   char mweek;
 58   char hw_feature[5];
 59   char oem_id;
 60   char identifier[16];
 61 };
 62 
 63 #ifndef MOD_RS232DB25MALE
 64 #define MOD_RS232DB25MALE 0x0a
 65 #endif
 66 
 67 #define SI_ISA_BOARD         0x00000001
 68 #define SX_ISA_BOARD         0x00000002
 69 #define SX_PCI_BOARD         0x00000004
 70 #define SX_CFPCI_BOARD       0x00000008
 71 #define SX_CFISA_BOARD       0x00000010
 72 #define SI_EISA_BOARD        0x00000020
 73 #define SI1_ISA_BOARD        0x00000040
 74 
 75 #define SX_BOARD_PRESENT     0x00001000
 76 #define SX_BOARD_INITIALIZED 0x00002000
 77 #define SX_IRQ_ALLOCATED     0x00004000
 78 
 79 #define SX_BOARD_TYPE        0x000000ff
 80 
 81 #define IS_SX_BOARD(board) (board->flags & (SX_PCI_BOARD | SX_CFPCI_BOARD | \
 82                                             SX_ISA_BOARD | SX_CFISA_BOARD))
 83 
 84 #define IS_SI_BOARD(board) (board->flags & SI_ISA_BOARD)
 85 #define IS_SI1_BOARD(board) (board->flags & SI1_ISA_BOARD)
 86 
 87 #define IS_EISA_BOARD(board) (board->flags & SI_EISA_BOARD)
 88 
 89 #define IS_CF_BOARD(board) (board->flags & (SX_CFISA_BOARD | SX_CFPCI_BOARD))
 90 
 91 /* The SI processor clock is required to calculate the cc_int_count register
 92    value for the SI cards. */
 93 #define SI_PROCESSOR_CLOCK 25000000
 94 
 95 
 96 /* port flags */
 97 /* Make sure these don't clash with gs flags or async flags */
 98 #define SX_RX_THROTTLE        0x0000001
 99 
100 
101 
102 #define SX_PORT_TRANSMIT_LOCK  0
103 #define SX_BOARD_INTR_LOCK     0
104 
105 
106 
107 /* Debug flags. Add these together to get more debug info. */
108 
109 #define SX_DEBUG_OPEN          0x00000001
110 #define SX_DEBUG_SETTING       0x00000002
111 #define SX_DEBUG_FLOW          0x00000004
112 #define SX_DEBUG_MODEMSIGNALS  0x00000008
113 #define SX_DEBUG_TERMIOS       0x00000010
114 #define SX_DEBUG_TRANSMIT      0x00000020
115 #define SX_DEBUG_RECEIVE       0x00000040
116 #define SX_DEBUG_INTERRUPTS    0x00000080
117 #define SX_DEBUG_PROBE         0x00000100
118 #define SX_DEBUG_INIT          0x00000200
119 #define SX_DEBUG_CLEANUP       0x00000400
120 #define SX_DEBUG_CLOSE         0x00000800
121 #define SX_DEBUG_FIRMWARE      0x00001000
122 #define SX_DEBUG_MEMTEST       0x00002000
123 
124 #define SX_DEBUG_ALL           0xffffffff
125 
126 
127 #define O_OTHER(tty)    \
128       ((O_OLCUC(tty))  ||\
129       (O_ONLCR(tty))   ||\
130       (O_OCRNL(tty))   ||\
131       (O_ONOCR(tty))   ||\
132       (O_ONLRET(tty))  ||\
133       (O_OFILL(tty))   ||\
134       (O_OFDEL(tty))   ||\
135       (O_NLDLY(tty))   ||\
136       (O_CRDLY(tty))   ||\
137       (O_TABDLY(tty))  ||\
138       (O_BSDLY(tty))   ||\
139       (O_VTDLY(tty))   ||\
140       (O_FFDLY(tty)))
141 
142 /* Same for input. */
143 #define I_OTHER(tty)    \
144       ((I_INLCR(tty))  ||\
145       (I_IGNCR(tty))   ||\
146       (I_ICRNL(tty))   ||\
147       (I_IUCLC(tty))   ||\
148       (L_ISIG(tty)))
149 
150 #define MOD_TA   (        TA>>4)
151 #define MOD_MTA  (MTA_CD1400>>4)
152 #define MOD_SXDC (      SXDC>>4)
153 
154 
155 /* We copy the download code over to the card in chunks of ... bytes */
156 #define SX_CHUNK_SIZE 128
157 
158 #endif /* __KERNEL__ */
159 
160 
161 
162 /* Specialix document 6210046-11 page 3 */
163 #define SPX(X) (('S'<<24) | ('P' << 16) | (X))
164 
165 /* Specialix-Linux specific IOCTLS. */
166 #define SPXL(X) (SPX(('L' << 8) | (X)))
167 
168 
169 #define SXIO_SET_BOARD      SPXL(0x01)
170 #define SXIO_GET_TYPE       SPXL(0x02)
171 #define SXIO_DOWNLOAD       SPXL(0x03)
172 #define SXIO_INIT           SPXL(0x04)
173 #define SXIO_SETDEBUG       SPXL(0x05)
174 #define SXIO_GETDEBUG       SPXL(0x06)
175 #define SXIO_DO_RAMTEST     SPXL(0x07)
176 #define SXIO_SETGSDEBUG     SPXL(0x08)
177 #define SXIO_GETGSDEBUG     SPXL(0x09)
178 #define SXIO_GETNPORTS      SPXL(0x0a)
179 
180 
181 #ifndef SXCTL_MISC_MINOR 
182 /* Allow others to gather this into "major.h" or something like that */
183 #define SXCTL_MISC_MINOR    167
184 #endif
185 
186 #ifndef SX_NORMAL_MAJOR
187 /* This allows overriding on the compiler commandline, or in a "major.h" 
188    include or something like that */
189 #define SX_NORMAL_MAJOR  32
190 #define SX_CALLOUT_MAJOR 33
191 #endif
192 
193 
194 #define SX_TYPE_SX          0x01
195 #define SX_TYPE_SI          0x02
196 #define SX_TYPE_CF          0x03
197 
198 
199 #define WINDOW_LEN(board) (IS_CF_BOARD(board)?0x20000:SX_WINDOW_LEN)
200 /*                         Need a #define for ^^^^^^^ !!! */
201 
202 
  This page was automatically generated by the LXR engine.