1 /*****************************************************************************/
4 * cdk.h -- CDK interface definitions.
6 * Copyright (C) 1996-1998 Stallion Technologies
7 * Copyright (C) 1994-1996 Greg Ungerer.
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.
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.
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.
24 /*****************************************************************************/
27 /*****************************************************************************/
32 * The following set of definitions is used to communicate with the
33 * shared memory interface of the Stallion intelligent multiport serial
34 * boards. The definitions in this file are taken directly from the
35 * document titled "Generic Stackable Interface, Downloader and
36 * Communications Development Kit".
40 * Define the set of important shared memory addresses. These are
41 * required to initialize the board and get things started. All of these
42 * addresses are relative to the start of the shared memory.
44 #define CDK_SIGADDR 0x200
45 #define CDK_FEATADDR 0x280
46 #define CDK_CDKADDR 0x300
47 #define CDK_RDYADDR 0x262
49 #define CDK_ALIVEMARKER 13
52 * On hardware power up the ROMs located on the EasyConnection 8/64 will
53 * fill out the following signature information into shared memory. This
54 * way the host system can quickly determine that the board is present
57 typedef struct cdkecpsig
{
59 unsigned short romver
;
60 unsigned short cputype
;
61 unsigned char panelid
[8];
64 #define ECP_MAGIC 0x21504345
67 * On hardware power up the ROMs located on the ONboard, Stallion and
68 * Brumbys will fill out the following signature information into shared
69 * memory. This way the host system can quickly determine that the board
70 * is present and is operational.
72 typedef struct cdkonbsig
{
73 unsigned short magic0
;
74 unsigned short magic1
;
75 unsigned short magic2
;
76 unsigned short magic3
;
77 unsigned short romver
;
78 unsigned short memoff
;
79 unsigned short memseg
;
80 unsigned short amask0
;
82 unsigned short status
;
84 unsigned short clkticks
;
85 unsigned short clkspeed
;
86 unsigned short amask1
;
87 unsigned short amask2
;
90 #define ONB_MAGIC0 0xf2a7
91 #define ONB_MAGIC1 0xa149
92 #define ONB_MAGIC2 0x6352
93 #define ONB_MAGIC3 0xf121
96 * Define the feature area structure. The feature area is the set of
97 * startup parameters used by the slave image when it starts executing.
98 * They allow for the specification of buffer sizes, debug trace, etc.
100 typedef struct cdkfeature
{
102 unsigned long banner
;
104 unsigned long nrdevs
;
105 unsigned long brdspec
;
106 unsigned long txrqsize
;
107 unsigned long rxrqsize
;
115 * Define the CDK header structure. This is the info that the slave
116 * environment sets up after it has been downloaded and started. It
117 * essentially provides a memory map for the shared memory interface.
119 typedef struct cdkhdr
{
120 unsigned short command
;
121 unsigned short status
;
124 unsigned long cmd_buf
[14];
125 unsigned short alive_cnt
;
126 unsigned short intrpt_mode
;
127 unsigned char intrpt_id
[8];
128 unsigned char ver_release
;
129 unsigned char ver_modification
;
130 unsigned char ver_fix
;
131 unsigned char deadman_restart
;
132 unsigned short deadman
;
133 unsigned short nrdevs
;
136 unsigned long slavep
;
137 unsigned char hostreq
;
138 unsigned char slavereq
;
139 unsigned char cmd_reserved
[30];
146 #define IMD_PPINTR 0x1
147 #define IMD_POLL 0xff
150 * Define the memory mapping structure. This structure is pointed to by
151 * the memp field in the stlcdkhdr struct. As many as these structures
152 * as required are laid out in shared memory to define how the rest of
153 * shared memory is divided up. There will be one for each port.
155 typedef struct cdkmem
{
156 unsigned short dtype
;
157 unsigned long offset
;
160 #define TYP_UNDEFINED 0x0
161 #define TYP_ASYNCTRL 0x1
162 #define TYP_ASYNC 0x20
163 #define TYP_PARALLEL 0x40
164 #define TYP_SYNCX21 0x60
166 /*****************************************************************************/
169 * Following is a set of defines and structures used to actually deal
170 * with the serial ports on the board. Firstly is the set of commands
171 * that can be applied to ports.
173 #define ASYCMD (((unsigned long) 'a') << 8)
175 #define A_NULL (ASYCMD | 0)
176 #define A_FLUSH (ASYCMD | 1)
177 #define A_BREAK (ASYCMD | 2)
178 #define A_GETPORT (ASYCMD | 3)
179 #define A_SETPORT (ASYCMD | 4)
180 #define A_SETPORTF (ASYCMD | 5)
181 #define A_SETPORTFTX (ASYCMD | 6)
182 #define A_SETPORTFRX (ASYCMD | 7)
183 #define A_GETSIGNALS (ASYCMD | 8)
184 #define A_SETSIGNALS (ASYCMD | 9)
185 #define A_SETSIGNALSF (ASYCMD | 10)
186 #define A_SETSIGNALSFTX (ASYCMD | 11)
187 #define A_SETSIGNALSFRX (ASYCMD | 12)
188 #define A_GETNOTIFY (ASYCMD | 13)
189 #define A_SETNOTIFY (ASYCMD | 14)
190 #define A_NOTIFY (ASYCMD | 15)
191 #define A_PORTCTRL (ASYCMD | 16)
192 #define A_GETSTATS (ASYCMD | 17)
193 #define A_RQSTATE (ASYCMD | 18)
194 #define A_FLOWSTATE (ASYCMD | 19)
195 #define A_CLEARSTATS (ASYCMD | 20)
198 * Define those arguments used for simple commands.
207 * Define the port setting structure, and all those defines that go along
208 * with it. Basically this structure defines the characteristics of this
209 * port: baud rate, chars, parity, input/output char cooking etc.
211 typedef struct asyport
{
212 unsigned long baudout
;
213 unsigned long baudin
;
219 unsigned long spare1
;
220 unsigned short vtime
;
226 unsigned short rxhog
;
227 unsigned short spare2
;
229 unsigned char stopbs
;
230 unsigned char parity
;
231 unsigned char stopin
;
232 unsigned char startin
;
233 unsigned char stopout
;
234 unsigned char startout
;
235 unsigned char parmark
;
236 unsigned char brkmark
;
237 unsigned char cc
[11];
241 #define PT_STOP15 0x1
244 #define PT_NOPARITY 0x0
245 #define PT_ODDPARITY 0x1
246 #define PT_EVENPARITY 0x2
247 #define PT_MARKPARITY 0x3
248 #define PT_SPACEPARITY 0x4
255 #define F_RTSFLOW 0x10
256 #define F_CTSFLOW 0x20
257 #define F_DTRFLOW 0x40
258 #define F_DCDFLOW 0x80
259 #define F_DSROFLOW 0x100
260 #define F_DSRIFLOW 0x200
264 #define FI_ISTRIP 0x4
266 #define FI_INLCR 0x10
267 #define FI_ICRNL 0x20
268 #define FI_IGNCR 0x40
269 #define FI_IGNBREAK 0x80
270 #define FI_DSCRDBREAK 0x100
271 #define FI_1MARKBREAK 0x200
272 #define FI_2MARKBREAK 0x400
273 #define FI_XCHNGBREAK 0x800
274 #define FI_IGNRXERRS 0x1000
275 #define FI_DSCDRXERRS 0x2000
276 #define FI_1MARKRXERRS 0x4000
277 #define FI_2MARKRXERRS 0x8000
278 #define FI_XCHNGRXERRS 0x10000
279 #define FI_DSCRDNULL 0x20000
283 #define FO_OOCRNL 0x4
285 #define FO_ONLRET 0x10
290 #define FO_OTAB1 0x200
291 #define FO_OTAB2 0x400
292 #define FO_OTAB3 0x800
293 #define FO_OCR1 0x1000
294 #define FO_OCR2 0x2000
295 #define FO_OCR3 0x4000
296 #define FO_OFILL 0x8000
297 #define FO_ODELL 0x10000
299 #define P_RTSLOCK 0x1
300 #define P_CTSLOCK 0x2
303 #define P_LOOPBACK 0x10
304 #define P_DTRFOLLOW 0x20
305 #define P_FAKEDCD 0x40
307 #define P_RXIMIN 0x10000
308 #define P_RXITIME 0x20000
309 #define P_RXTHOLD 0x40000
312 * Define a structure to communicate serial port signal and data state
315 typedef struct asysigs
{
317 unsigned long signal
;
318 unsigned long sigvalue
;
321 #define DT_TXBUSY 0x1
322 #define DT_TXEMPTY 0x2
324 #define DT_TXHIGH 0x8
325 #define DT_TXFULL 0x10
326 #define DT_TXHOG 0x20
327 #define DT_TXFLOWED 0x40
328 #define DT_TXBREAK 0x80
330 #define DT_RXBUSY 0x100
331 #define DT_RXEMPTY 0x200
332 #define DT_RXLOW 0x400
333 #define DT_RXHIGH 0x800
334 #define DT_RXFULL 0x1000
335 #define DT_RXHOG 0x2000
336 #define DT_RXFLOWED 0x4000
337 #define DT_RXBREAK 0x8000
347 * Define the notification setting structure. This is used to tell the
348 * port what events we want to be informed about. Fields here use the
349 * same defines as for the asysigs structure above.
351 typedef struct asynotify
{
354 unsigned long signal
;
355 unsigned long sigvalue
;
359 * Define the port control structure. It is used to do fine grain
360 * control operations on the port.
363 unsigned long rxctrl
;
364 unsigned long txctrl
;
371 #define CT_ENABLE 0x1
372 #define CT_DISABLE 0x2
375 #define CT_STARTFLOW 0x10
376 #define CT_STOPFLOW 0x20
377 #define CT_SENDCHR 0x40
380 * Define the stats structure kept for each port. This is a useful set
381 * of data collected for each port on the slave. The A_GETSTATS command
382 * is used to retrieve this data from the slave.
384 typedef struct asystats
{
386 unsigned long txchars
;
387 unsigned long rxchars
;
388 unsigned long txringq
;
389 unsigned long rxringq
;
390 unsigned long txmsgs
;
391 unsigned long rxmsgs
;
392 unsigned long txflushes
;
393 unsigned long rxflushes
;
394 unsigned long overruns
;
395 unsigned long framing
;
396 unsigned long parity
;
397 unsigned long ringover
;
399 unsigned long rxstart
;
400 unsigned long rxstop
;
401 unsigned long txstart
;
402 unsigned long txstop
;
403 unsigned long dcdcnt
;
404 unsigned long dtrcnt
;
405 unsigned long ctscnt
;
406 unsigned long rtscnt
;
407 unsigned long dsrcnt
;
409 unsigned long txbreaks
;
410 unsigned long rxbreaks
;
411 unsigned long signals
;
416 /*****************************************************************************/
419 * All command and control communication with a device on the slave is
420 * via a control block in shared memory. Each device has its own control
421 * block, defined by the following structure. The control block allows
422 * the host to open, close and control the device on the slave.
424 typedef struct cdkctrl
{
427 unsigned long openarg
;
428 unsigned long closearg
;
430 unsigned long status
;
431 unsigned long args
[32];
435 * Each device on the slave passes data to and from the host via a ring
436 * queue in shared memory. Define a ring queue structure to hold the
437 * vital information about each ring queue. Two ring queues will be
438 * allocated for each port, one for receive data and one for transmit
441 typedef struct cdkasyrq
{
442 unsigned long offset
;
449 * Each asynchronous port is defined in shared memory by the following
450 * structure. It contains a control block to command a device, and also
451 * the necessary data channel information as well.
453 typedef struct cdkasy
{
455 unsigned short notify
;
457 unsigned short receive
;
459 unsigned short transmit
;
465 /*****************************************************************************/
468 * Define the set of ioctls used by the driver to do special things
469 * to the board. These include interrupting it, and initializing
470 * the driver after board startup and shutdown.
472 #include <linux/ioctl.h>
474 #define STL_BINTR _IO('s',20)
475 #define STL_BSTART _IO('s',21)
476 #define STL_BSTOP _IO('s',22)
477 #define STL_BRESET _IO('s',23)
480 * Define a set of ioctl extensions, used to get at special stuff.
482 #define STL_GETPFLAG _IO('s',80)
483 #define STL_SETPFLAG _IO('s',81)
485 /*****************************************************************************/