1 /*****************************************************************************/
4 * cdk.h -- CDK interface definitions.
6 * Copyright (c) 1994-1998 Greg Ungerer (gerg@stallion.oz.au).
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Greg Ungerer.
20 * 4. Neither the name of the author nor the names of any co-contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * $FreeBSD: src/sys/i386/include/cdk.h,v 1.5.2.1 2001/08/30 12:29:57 murray Exp $
37 * $DragonFly: src/sys/platform/pc32/include/cdk.h,v 1.3 2003/06/28 04:16:03 dillon Exp $
43 #include <sys/ioccom.h>
48 * The following set of definitions is used to communicate with the
49 * shared memory interface of the Stallion intelligent multiport serial
50 * boards. The definitions in this file are taken directly from the
51 * document titled "Generic Stackable Interface, Downloader and
52 * Communications Development Kit".
56 * Define the set of importrant shared memory addresses. These are
57 * required to intialize the board and get things started. All of these
58 * addresses are relative to the start of the shared memory.
60 #define CDK_SIGADDR 0x200
61 #define CDK_FEATADDR 0x280
62 #define CDK_CDKADDR 0x300
63 #define CDK_RDYADDR 0x262
65 #define CDK_ALIVEMARKER 13
68 * On hardware power up the ROMs located on the EasyConnection 8/64 will
69 * fill out the following signature information into shared memory. This
70 * way the host system can quickly determine that the board is present
73 typedef struct cdkecpsig {
75 unsigned short romver;
76 unsigned short cputype;
77 unsigned char panelid[8];
80 #define ECP_MAGIC 0x21504345
83 * On hardware power up the ROMs located on the ONboard, Stallion and
84 * Brumbys will fill out the following signature information into shared
85 * memory. This way the host system can quickly determine that the board
86 * is present and is operational.
88 typedef struct cdkonbsig {
89 unsigned short magic0;
90 unsigned short magic1;
91 unsigned short magic2;
92 unsigned short magic3;
93 unsigned short romver;
94 unsigned short memoff;
95 unsigned short memseg;
96 unsigned short amask0;
98 unsigned short status;
100 unsigned short clkticks;
101 unsigned short clkspeed;
102 unsigned short amask1;
103 unsigned short amask2;
106 #define ONB_MAGIC0 0xf2a7
107 #define ONB_MAGIC1 0xa149
108 #define ONB_MAGIC2 0x6352
109 #define ONB_MAGIC3 0xf121
112 * Define the feature area structure. The feature area is the set of
113 * startup parameters used by the slave image when it starts executing.
114 * They allow for the specification of buffer sizes, debug trace, etc.
116 typedef struct cdkfeature {
118 unsigned long banner;
120 unsigned long nrdevs;
121 unsigned long brdspec;
122 unsigned long txrqsize;
123 unsigned long rxrqsize;
131 * Define the CDK header structure. This is the info that the slave
132 * environment sets up after it has been downloaded and started. It
133 * essentially provides a memory map for the shared memory interface.
135 typedef struct cdkhdr {
136 unsigned short command;
137 unsigned short status;
140 unsigned long cmd_buf[14];
141 unsigned short alive_cnt;
142 unsigned short intrpt_mode;
143 unsigned char intrpt_id[8];
144 unsigned char ver_release;
145 unsigned char ver_modification;
146 unsigned char ver_fix;
147 unsigned char deadman_restart;
148 unsigned short deadman;
149 unsigned short nrdevs;
152 unsigned long slavep;
153 unsigned char hostreq;
154 unsigned char slavereq;
155 unsigned char cmd_reserved[30];
162 #define IMD_PPINTR 0x1
163 #define IMD_POLL 0xff
166 * Define the memory mapping structure. This structure is pointed to by
167 * the memp field in the stlcdkhdr struct. As many as these structures
168 * as required are layed out in shared memory to define how the rest of
169 * shared memory is divided up. There will be one for each port.
171 typedef struct cdkmem {
172 unsigned short dtype;
173 unsigned long offset;
176 #define TYP_UNDEFINED 0x0
177 #define TYP_ASYNCTRL 0x1
178 #define TYP_ASYNC 0x20
179 #define TYP_PARALLEL 0x40
180 #define TYP_SYNCX21 0x60
182 /*****************************************************************************/
185 * Following is a set of defines and structures used to actually deal
186 * with the serial ports on the board. Firstly is the set of commands
187 * that can be applied to ports.
189 #define ASYCMD (((unsigned long) 'a') << 8)
191 #define A_NULL (ASYCMD | 0)
192 #define A_FLUSH (ASYCMD | 1)
193 #define A_BREAK (ASYCMD | 2)
194 #define A_GETPORT (ASYCMD | 3)
195 #define A_SETPORT (ASYCMD | 4)
196 #define A_SETPORTF (ASYCMD | 5)
197 #define A_SETPORTFTX (ASYCMD | 6)
198 #define A_SETPORTFRX (ASYCMD | 7)
199 #define A_GETSIGNALS (ASYCMD | 8)
200 #define A_SETSIGNALS (ASYCMD | 9)
201 #define A_SETSIGNALSF (ASYCMD | 10)
202 #define A_SETSIGNALSFTX (ASYCMD | 11)
203 #define A_SETSIGNALSFRX (ASYCMD | 12)
204 #define A_GETNOTIFY (ASYCMD | 13)
205 #define A_SETNOTIFY (ASYCMD | 14)
206 #define A_NOTIFY (ASYCMD | 15)
207 #define A_PORTCTRL (ASYCMD | 16)
208 #define A_GETSTATS (ASYCMD | 17)
209 #define A_RQSTATE (ASYCMD | 18)
210 #define A_FLOWSTATE (ASYCMD | 19)
211 #define A_CLEARSTATS (ASYCMD | 20)
214 * Define those arguments used for simple commands.
223 * Define the port setting structure, and all those defines that go along
224 * with it. Basically this structure defines the charcateristics of this
225 * port: baud rate, chars, parity, input/output char cooking etc.
227 typedef struct asyport {
228 unsigned long baudout;
229 unsigned long baudin;
235 unsigned long spare1;
236 unsigned short vtime;
242 unsigned short rxhog;
243 unsigned short spare2;
245 unsigned char stopbs;
246 unsigned char parity;
247 unsigned char stopin;
248 unsigned char startin;
249 unsigned char stopout;
250 unsigned char startout;
251 unsigned char parmark;
252 unsigned char brkmark;
253 unsigned char cc[11];
257 #define PT_STOP15 0x1
260 #define PT_NOPARITY 0x0
261 #define PT_ODDPARITY 0x1
262 #define PT_EVENPARITY 0x2
263 #define PT_MARKPARITY 0x3
264 #define PT_SPACEPARITY 0x4
271 #define F_RTSFLOW 0x10
272 #define F_CTSFLOW 0x20
273 #define F_DTRFLOW 0x40
274 #define F_DCDFLOW 0x80
275 #define F_DSROFLOW 0x100
276 #define F_DSRIFLOW 0x200
280 #define FI_ISTRIP 0x4
282 #define FI_INLCR 0x10
283 #define FI_ICRNL 0x20
284 #define FI_IGNCR 0x40
285 #define FI_IGNBREAK 0x80
286 #define FI_DSCRDBREAK 0x100
287 #define FI_1MARKBREAK 0x200
288 #define FI_2MARKBREAK 0x400
289 #define FI_XCHNGBREAK 0x800
290 #define FI_IGNRXERRS 0x1000
291 #define FI_DSCDRXERRS 0x2000
292 #define FI_1MARKRXERRS 0x4000
293 #define FI_2MARKRXERRS 0x8000
294 #define FI_XCHNGRXERRS 0x10000
295 #define FI_DSCRDNULL 0x20000
299 #define FO_OOCRNL 0x4
301 #define FO_ONLRET 0x10
306 #define FO_OTAB1 0x200
307 #define FO_OTAB2 0x400
308 #define FO_OTAB3 0x800
309 #define FO_OCR1 0x1000
310 #define FO_OCR2 0x2000
311 #define FO_OCR3 0x4000
312 #define FO_OFILL 0x8000
313 #define FO_ODELL 0x10000
315 #define P_RTSLOCK 0x1
316 #define P_CTSLOCK 0x2
319 #define P_LOOPBACK 0x10
320 #define P_DTRFOLLOW 0x20
321 #define P_FAKEDCD 0x40
323 #define P_RXIMIN 0x10000
324 #define P_RXITIME 0x20000
325 #define P_RXTHOLD 0x40000
328 * Define a structure to communicate serial port signal and data state
331 typedef struct asysigs {
333 unsigned long signal;
334 unsigned long sigvalue;
337 #define DT_TXBUSY 0x1
338 #define DT_TXEMPTY 0x2
340 #define DT_TXHIGH 0x8
341 #define DT_TXFULL 0x10
342 #define DT_TXHOG 0x20
343 #define DT_TXFLOWED 0x40
344 #define DT_TXBREAK 0x80
346 #define DT_RXBUSY 0x100
347 #define DT_RXEMPTY 0x200
348 #define DT_RXLOW 0x400
349 #define DT_RXHIGH 0x800
350 #define DT_RXFULL 0x1000
351 #define DT_RXHOG 0x2000
352 #define DT_RXFLOWED 0x4000
353 #define DT_RXBREAK 0x8000
363 * Define the notification setting structure. This is used to tell the
364 * port what events we want to be informed about. Fields here use the
365 * same defines as for the asysigs structure above.
367 typedef struct asynotify {
370 unsigned long signal;
371 unsigned long sigvalue;
375 * Define the port control structure. It is used to do fine grain
376 * control operations on the port.
379 unsigned long rxctrl;
380 unsigned long txctrl;
387 #define CT_ENABLE 0x1
388 #define CT_DISABLE 0x2
391 #define CT_STARTFLOW 0x10
392 #define CT_STOPFLOW 0x20
393 #define CT_SENDCHR 0x40
396 * Define the stats structure kept for each port. This is a useful set
397 * of data collected for each port on the slave. The A_GETSTATS command
398 * is used to retrive this data from the slave.
400 typedef struct asystats {
402 unsigned long txchars;
403 unsigned long rxchars;
404 unsigned long txringq;
405 unsigned long rxringq;
406 unsigned long txmsgs;
407 unsigned long rxmsgs;
408 unsigned long txflushes;
409 unsigned long rxflushes;
410 unsigned long overruns;
411 unsigned long framing;
412 unsigned long parity;
413 unsigned long ringover;
415 unsigned long rxstart;
416 unsigned long rxstop;
417 unsigned long txstart;
418 unsigned long txstop;
419 unsigned long dcdcnt;
420 unsigned long dtrcnt;
421 unsigned long ctscnt;
422 unsigned long rtscnt;
423 unsigned long dsrcnt;
425 unsigned long txbreaks;
426 unsigned long rxbreaks;
427 unsigned long signals;
432 /*****************************************************************************/
435 * All command and control communication with a device on the slave is
436 * via a control block in shared memory. Each device has its own control
437 * block, defined by the following structure. The control block allows
438 * the host to open, close and control the device on the slave.
440 typedef struct cdkctrl {
443 unsigned long openarg;
444 unsigned long closearg;
446 unsigned long status;
447 unsigned long args[32];
451 * Each device on the slave passes data to and from the host via a ring
452 * queue in shared memory. Define a ring queue structure to hold the
453 * vital information about each ring queue. Two ring queues will be
454 * allocated for each port, one for reveice data and one for transmit
457 typedef struct cdkasyrq {
458 unsigned long offset;
465 * Each asynchronous port is defined in shared memory by the following
466 * structure. It contains a control block to command a device, and also
467 * the neccessary data channel information as well.
469 typedef struct cdkasy {
471 unsigned short notify;
473 unsigned short receive;
475 unsigned short transmit;
481 /*****************************************************************************/
484 * Define the set of ioctls used by the driver to do special things
485 * to the board. These include interrupting it, and initializeing
486 * the driver after board startup and shutdown.
488 #define STL_BINTR _IO('s', 20)
489 #define STL_BSTART _IO('s', 21)
490 #define STL_BSTOP _IO('s', 22)
491 #define STL_BRESET _IO('s', 23)
494 * Define a set of ioctl extensions, used to get at special stuff.
496 #define STL_GETPFLAG _IOR('s', 80, unsigned long)
497 #define STL_SETPFLAG _IOW('s', 81, unsigned long)
499 /*****************************************************************************/