root/include/linux/cdk.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*****************************************************************************/
   2 
   3 /*
   4  *      cdk.h  -- CDK interface definitions.
   5  *
   6  *      Copyright (C) 1994-1996  Greg Ungerer (gerg@stallion.oz.au).
   7  *
   8  *      This program is free software; you can redistribute it and/or modify
   9  *      it under the terms of the GNU General Public License as published by
  10  *      the Free Software Foundation; either version 2 of the License, or
  11  *      (at your option) any later version.
  12  *
  13  *      This program is distributed in the hope that it will be useful,
  14  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  *      GNU General Public License for more details.
  17  *
  18  *      You should have received a copy of the GNU General Public License
  19  *      along with this program; if not, write to the Free Software
  20  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21  */
  22 
  23 /*****************************************************************************/
  24 #ifndef _CDK_H
  25 #define _CDK_H
  26 /*****************************************************************************/
  27 
  28 #pragma pack(2)
  29 
  30 /*
  31  *      The following set of definitions is used to communicate with the
  32  *      shared memory interface of the Stallion intelligent multiport serial
  33  *      boards. The definitions in this file are taken directly from the
  34  *      document titled "Generic Stackable Interface, Downloader and
  35  *      Communications Development Kit".
  36  */
  37 
  38 /*
  39  *      Define the set of importrant shared memory addresses. These are
  40  *      required to intialize the board and get things started. All of these
  41  *      addresses are relative to the start of the shared memory.
  42  */
  43 #define CDK_SIGADDR     0x200
  44 #define CDK_FEATADDR    0x280
  45 #define CDK_CDKADDR     0x300
  46 #define CDK_RDYADDR     0x262
  47 
  48 #define CDK_ALIVEMARKER 13
  49 
  50 /*
  51  *      On hardware power up the ROMs located on the EasyConnection 8/64 will
  52  *      fill out the following signature information into shared memory. This
  53  *      way the host system can quickly determine that the board is present
  54  *      and is operational.
  55  */
  56 typedef struct cdkecpsig {
  57         unsigned long   magic;
  58         unsigned short  romver;
  59         unsigned short  cputype;
  60         unsigned char   panelid[8];
  61 } cdkecpsig_t;
  62 
  63 #define ECP_MAGIC       0x21504345
  64 
  65 /*
  66  *      On hardware power up the ROMs located on the ONboard, Stallion and
  67  *      Brumbys will fill out the following signature information into shared
  68  *      memory. This way the host system can quickly determine that the board
  69  *      is present and is operational.
  70  */
  71 typedef struct cdkonbsig {
  72         unsigned short  magic0;
  73         unsigned short  magic1;
  74         unsigned short  magic2;
  75         unsigned short  magic3;
  76         unsigned short  romver;
  77         unsigned short  memoff;
  78         unsigned short  memseg;
  79         unsigned short  amask0;
  80         unsigned short  pic;
  81         unsigned short  status;
  82         unsigned short  btype;
  83         unsigned short  clkticks;
  84         unsigned short  clkspeed;
  85         unsigned short  amask1;
  86         unsigned short  amask2;
  87 } cdkonbsig_t;
  88 
  89 #define ONB_MAGIC0      0xf2a7
  90 #define ONB_MAGIC1      0xa149
  91 #define ONB_MAGIC2      0x6352
  92 #define ONB_MAGIC3      0xf121
  93 
  94 /*
  95  *      Define the feature area structure. The feature area is the set of
  96  *      startup parameters used by the slave image when it starts executing.
  97  *      They allow for the specification of buffer sizes, debug trace, etc.
  98  */
  99 typedef struct cdkfeature {
 100         unsigned long   debug;
 101         unsigned long   banner;
 102         unsigned long   etype;
 103         unsigned long   nrdevs;
 104         unsigned long   brdspec;
 105         unsigned long   txrqsize;
 106         unsigned long   rxrqsize;
 107         unsigned long   flags;
 108 } cdkfeature_t;
 109 
 110 #define ETYP_DDK        0
 111 #define ETYP_CDK        1
 112 
 113 /*
 114  *      Define the CDK header structure. This is the info that the slave
 115  *      environment sets up after it has been downloaded and started. It
 116  *      essentially provides a memory map for the shared memory interface.
 117  */
 118 typedef struct cdkhdr {
 119         unsigned short  command;
 120         unsigned short  status;
 121         unsigned short  port;
 122         unsigned short  mode;
 123         unsigned long   cmd_buf[14];
 124         unsigned short  alive_cnt;
 125         unsigned short  intrpt_mode;
 126         unsigned char   intrpt_id[8];
 127         unsigned char   ver_release;
 128         unsigned char   ver_modification;
 129         unsigned char   ver_fix;
 130         unsigned char   deadman_restart;
 131         unsigned short  deadman;
 132         unsigned short  nrdevs;
 133         unsigned long   memp;
 134         unsigned long   hostp;
 135         unsigned long   slavep;
 136         unsigned char   hostreq;
 137         unsigned char   slavereq;
 138         unsigned char   cmd_reserved[30];
 139 } cdkhdr_t;
 140 
 141 #define MODE_DDK        0
 142 #define MODE_CDK        1
 143 
 144 #define IMD_INTR        0x0
 145 #define IMD_PPINTR      0x1
 146 #define IMD_POLL        0xff
 147 
 148 /*
 149  *      Define the memory mapping structure. This structure is pointed to by
 150  *      the memp field in the stlcdkhdr struct. As many as these structures
 151  *      as required are layed out in shared memory to define how the rest of
 152  *      shared memory is divided up. There will be one for each port.
 153  */
 154 typedef struct cdkmem {
 155         unsigned short  dtype;
 156         unsigned long   offset;
 157 } cdkmem_t;
 158 
 159 #define TYP_UNDEFINED   0x0
 160 #define TYP_ASYNCTRL    0x1
 161 #define TYP_ASYNC       0x20
 162 #define TYP_PARALLEL    0x40
 163 #define TYP_SYNCX21     0x60
 164 
 165 /*****************************************************************************/
 166 
 167 /*
 168  *      Following is a set of defines and structures used to actually deal
 169  *      with the serial ports on the board. Firstly is the set of commands
 170  *      that can be applied to ports.
 171  */
 172 #define ASYCMD          (((unsigned long) 'a') << 8)
 173 
 174 #define A_NULL          (ASYCMD | 0)
 175 #define A_FLUSH         (ASYCMD | 1)
 176 #define A_BREAK         (ASYCMD | 2)
 177 #define A_GETPORT       (ASYCMD | 3)
 178 #define A_SETPORT       (ASYCMD | 4)
 179 #define A_SETPORTF      (ASYCMD | 5)
 180 #define A_SETPORTFTX    (ASYCMD | 6)
 181 #define A_SETPORTFRX    (ASYCMD | 7)
 182 #define A_GETSIGNALS    (ASYCMD | 8)
 183 #define A_SETSIGNALS    (ASYCMD | 9)
 184 #define A_SETSIGNALSF   (ASYCMD | 10)
 185 #define A_SETSIGNALSFTX (ASYCMD | 11)
 186 #define A_SETSIGNALSFRX (ASYCMD | 12)
 187 #define A_GETNOTIFY     (ASYCMD | 13)
 188 #define A_SETNOTIFY     (ASYCMD | 14)
 189 #define A_NOTIFY        (ASYCMD | 15)
 190 #define A_PORTCTRL      (ASYCMD | 16)
 191 #define A_GETSTATS      (ASYCMD | 17)
 192 #define A_RQSTATE       (ASYCMD | 18)
 193 #define A_FLOWSTATE     (ASYCMD | 19)
 194 #define A_CLEARSTATS    (ASYCMD | 20)
 195 
 196 /*
 197  *      Define those arguments used for simple commands.
 198  */
 199 #define FLUSHRX         0x1
 200 #define FLUSHTX         0x2
 201 
 202 #define BREAKON         -1
 203 #define BREAKOFF        -2
 204 
 205 /*
 206  *      Define the port setting structure, and all those defines that go along
 207  *      with it. Basically this structure defines the charcateristics of this
 208  *      port: baud rate, chars, parity, input/output char cooking etc.
 209  */
 210 typedef struct asyport {
 211         unsigned long   baudout;
 212         unsigned long   baudin;
 213         unsigned long   iflag;
 214         unsigned long   oflag;
 215         unsigned long   lflag;
 216         unsigned long   pflag;
 217         unsigned long   flow;
 218         unsigned long   spare1;
 219         unsigned short  vtime;
 220         unsigned short  vmin;
 221         unsigned short  txlo;
 222         unsigned short  txhi;
 223         unsigned short  rxlo;
 224         unsigned short  rxhi;
 225         unsigned short  rxhog;
 226         unsigned short  spare2;
 227         unsigned char   csize;
 228         unsigned char   stopbs;
 229         unsigned char   parity;
 230         unsigned char   stopin;
 231         unsigned char   startin;
 232         unsigned char   stopout;
 233         unsigned char   startout;
 234         unsigned char   parmark;
 235         unsigned char   brkmark;
 236         unsigned char   cc[11];
 237 } asyport_t;
 238 
 239 #define PT_STOP1        0x0
 240 #define PT_STOP15       0x1
 241 #define PT_STOP2        0x2
 242 
 243 #define PT_NOPARITY     0x0
 244 #define PT_ODDPARITY    0x1
 245 #define PT_EVENPARITY   0x2
 246 #define PT_MARKPARITY   0x3
 247 #define PT_SPACEPARITY  0x4
 248 
 249 #define F_NONE          0x0
 250 #define F_IXON          0x1
 251 #define F_IXOFF         0x2
 252 #define F_IXANY         0x4
 253 #define F_IOXANY        0x8
 254 #define F_RTSFLOW       0x10
 255 #define F_CTSFLOW       0x20
 256 #define F_DTRFLOW       0x40
 257 #define F_DCDFLOW       0x80
 258 #define F_DSROFLOW      0x100
 259 #define F_DSRIFLOW      0x200
 260 
 261 #define FI_NORX         0x1
 262 #define FI_RAW          0x2
 263 #define FI_ISTRIP       0x4
 264 #define FI_UCLC         0x8
 265 #define FI_INLCR        0x10
 266 #define FI_ICRNL        0x20
 267 #define FI_IGNCR        0x40
 268 #define FI_IGNBREAK     0x80
 269 #define FI_DSCRDBREAK   0x100
 270 #define FI_1MARKBREAK   0x200
 271 #define FI_2MARKBREAK   0x400
 272 #define FI_XCHNGBREAK   0x800
 273 #define FI_IGNRXERRS    0x1000
 274 #define FI_DSCDRXERRS   0x2000
 275 #define FI_1MARKRXERRS  0x4000
 276 #define FI_2MARKRXERRS  0x8000
 277 #define FI_XCHNGRXERRS  0x10000
 278 #define FI_DSCRDNULL    0x20000
 279 
 280 #define FO_OLCUC        0x1
 281 #define FO_ONLCR        0x2
 282 #define FO_OOCRNL       0x4
 283 #define FO_ONOCR        0x8
 284 #define FO_ONLRET       0x10
 285 #define FO_ONL          0x20
 286 #define FO_OBS          0x40
 287 #define FO_OVT          0x80
 288 #define FO_OFF          0x100
 289 #define FO_OTAB1        0x200
 290 #define FO_OTAB2        0x400
 291 #define FO_OTAB3        0x800
 292 #define FO_OCR1         0x1000
 293 #define FO_OCR2         0x2000
 294 #define FO_OCR3         0x4000
 295 #define FO_OFILL        0x8000
 296 #define FO_ODELL        0x10000
 297 
 298 #define P_RTSLOCK       0x1
 299 #define P_CTSLOCK       0x2
 300 #define P_MAPRTS        0x4
 301 #define P_MAPCTS        0x8
 302 #define P_LOOPBACK      0x10
 303 #define P_DTRFOLLOW     0x20
 304 #define P_FAKEDCD       0x40
 305 
 306 /*
 307  *      Define a structure to communicate serial port signal and data state
 308  *      information.
 309  */
 310 typedef struct asysigs {
 311         unsigned long   data;
 312         unsigned long   signal;
 313         unsigned long   sigvalue;
 314 } asysigs_t;
 315 
 316 #define DT_TXBUSY       0x1
 317 #define DT_TXEMPTY      0x2
 318 #define DT_TXLOW        0x4
 319 #define DT_TXHIGH       0x8
 320 #define DT_TXFULL       0x10
 321 #define DT_TXHOG        0x20
 322 #define DT_TXFLOWED     0x40
 323 #define DT_TXBREAK      0x80
 324 
 325 #define DT_RXBUSY       0x100
 326 #define DT_RXEMPTY      0x200
 327 #define DT_RXLOW        0x400
 328 #define DT_RXHIGH       0x800
 329 #define DT_RXFULL       0x1000
 330 #define DT_RXHOG        0x2000
 331 #define DT_RXFLOWED     0x4000
 332 #define DT_RXBREAK      0x8000
 333 
 334 #define SG_DTR          0x1
 335 #define SG_DCD          0x2
 336 #define SG_RTS          0x4
 337 #define SG_CTS          0x8
 338 #define SG_DSR          0x10
 339 #define SG_RI           0x20
 340 
 341 /*
 342  *      Define the notification setting structure. This is used to tell the
 343  *      port what events we want to be informed about. Fields here use the
 344  *      same defines as for the asysigs structure above.
 345  */
 346 typedef struct asynotify {
 347         unsigned long   ctrl;
 348         unsigned long   data;
 349         unsigned long   signal;
 350         unsigned long   sigvalue;
 351 } asynotify_t;
 352 
 353 /*
 354  *      Define the port control structure. It is used to do fine grain
 355  *      control operations on the port.
 356  */
 357 typedef struct {
 358         unsigned long   rxctrl;
 359         unsigned long   txctrl;
 360         char            rximdch;
 361         char            tximdch;
 362         char            spare1;
 363         char            spare2;
 364 } asyctrl_t;
 365 
 366 #define CT_ENABLE       0x1
 367 #define CT_DISABLE      0x2
 368 #define CT_STOP         0x4
 369 #define CT_START        0x8
 370 #define CT_STARTFLOW    0x10
 371 #define CT_STOPFLOW     0x20
 372 #define CT_SENDCHR      0x40
 373 
 374 /*
 375  *      Define the stats structure kept for each port. This is a useful set
 376  *      of data collected for each port on the slave. The A_GETSTATS command
 377  *      is used to retrive this data from the slave.
 378  */
 379 typedef struct asystats {
 380         unsigned long   opens;
 381         unsigned long   txchars;
 382         unsigned long   rxchars;
 383         unsigned long   txringq;
 384         unsigned long   rxringq;
 385         unsigned long   txmsgs;
 386         unsigned long   rxmsgs;
 387         unsigned long   txflushes;
 388         unsigned long   rxflushes;
 389         unsigned long   overruns;
 390         unsigned long   framing;
 391         unsigned long   parity;
 392         unsigned long   ringover;
 393         unsigned long   lost;
 394         unsigned long   rxstart;
 395         unsigned long   rxstop;
 396         unsigned long   txstart;
 397         unsigned long   txstop;
 398         unsigned long   dcdcnt;
 399         unsigned long   dtrcnt;
 400         unsigned long   ctscnt;
 401         unsigned long   rtscnt;
 402         unsigned long   dsrcnt;
 403         unsigned long   ricnt;
 404         unsigned long   txbreaks;
 405         unsigned long   rxbreaks;
 406         unsigned long   signals;
 407         unsigned long   state;
 408         unsigned long   hwid;
 409 } asystats_t;
 410 
 411 /*****************************************************************************/
 412 
 413 /*
 414  *      All command and control communication with a device on the slave is
 415  *      via a control block in shared memory. Each device has its own control
 416  *      block, defined by the following structure. The control block allows
 417  *      the host to open, close and control the device on the slave.
 418  */
 419 typedef struct cdkctrl {
 420         unsigned char   open;
 421         unsigned char   close;
 422         unsigned long   openarg;
 423         unsigned long   closearg;
 424         unsigned long   cmd;
 425         unsigned long   status;
 426         unsigned long   args[32];
 427 } cdkctrl_t;
 428 
 429 /*
 430  *      Each device on the slave passes data to and from the host via a ring
 431  *      queue in shared memory. Define a ring queue structure to hold the
 432  *      vital information about each ring queue. Two ring queues will be
 433  *      allocated for each port, one for reveice data and one for transmit
 434  *      data.
 435  */
 436 typedef struct cdkasyrq {
 437         unsigned long   offset;
 438         unsigned short  size;
 439         unsigned short  head;
 440         unsigned short  tail;
 441 } cdkasyrq_t;
 442 
 443 /*
 444  *      Each asynchronous port is defined in shared memory by the following
 445  *      structure. It contains a control block to command a device, and also
 446  *      the neccessary data channel information as well.
 447  */
 448 typedef struct cdkasy {
 449         cdkctrl_t       ctrl;
 450         unsigned short  notify;
 451         asynotify_t     changed;
 452         unsigned short  receive;
 453         cdkasyrq_t      rxq;
 454         unsigned short  transmit;
 455         cdkasyrq_t      txq;
 456 } cdkasy_t;
 457 
 458 #pragma pack()
 459 
 460 /*****************************************************************************/
 461 
 462 /*
 463  *      Define the set of ioctls used by the driver to do special things
 464  *      to the board. These include interrupting it, and initializeing
 465  *      the driver after board startup and shutdown.
 466  */
 467 #include <linux/ioctl.h>
 468 
 469 #define STL_BINTR       _IO('s',20)
 470 #define STL_BSTART      _IO('s',21)
 471 #define STL_BSTOP       _IO('s',22)
 472 #define STL_BRESET      _IO('s',23)
 473 
 474 /*
 475  *      Define a set of ioctl extensions, used to get at special stuff.
 476  */
 477 #define STL_GETPFLAG    _IO('s',80)
 478 #define STL_SETPFLAG    _IO('s',81)
 479 
 480 /*****************************************************************************/
 481 #endif

/* [previous][next][first][last][top][bottom][index][help] */