blob: cf9dcae7cc3fcf54daf35166f87dd8b0f6576c00 [file] [log] [blame]
Lidza Louina0b99d582013-08-01 17:00:20 -04001/*
2 * Copyright 2003 Digi International (www.digi.com)
3 * Scott H Kilau <Scott_Kilau at digi dot com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
12 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more details.
Lidza Louina0b99d582013-08-01 17:00:20 -040014 */
15
16#ifndef __DIGI_H
17#define __DIGI_H
18
Lidza Louinab8f54722013-08-21 11:08:12 -040019#ifndef TIOCM_LE
Lidza Louina0b99d582013-08-01 17:00:20 -040020#define TIOCM_LE 0x01 /* line enable */
21#define TIOCM_DTR 0x02 /* data terminal ready */
22#define TIOCM_RTS 0x04 /* request to send */
23#define TIOCM_ST 0x08 /* secondary transmit */
24#define TIOCM_SR 0x10 /* secondary receive */
25#define TIOCM_CTS 0x20 /* clear to send */
26#define TIOCM_CAR 0x40 /* carrier detect */
27#define TIOCM_RNG 0x80 /* ring indicator */
28#define TIOCM_DSR 0x100 /* data set ready */
29#define TIOCM_RI TIOCM_RNG /* ring (alternate) */
30#define TIOCM_CD TIOCM_CAR /* carrier detect (alt) */
31#endif
32
Lidza Louina0b99d582013-08-01 17:00:20 -040033#if !defined(TIOCMSET)
Andrew Milkovich6f6304b2015-01-18 10:41:30 -080034#define TIOCMSET (('d'<<8) | 252) /* set modem ctrl state */
35#define TIOCMGET (('d'<<8) | 253) /* set modem ctrl state */
Lidza Louina0b99d582013-08-01 17:00:20 -040036#endif
37
38#if !defined(TIOCMBIC)
Andrew Milkovich6f6304b2015-01-18 10:41:30 -080039#define TIOCMBIC (('d'<<8) | 254) /* set modem ctrl state */
40#define TIOCMBIS (('d'<<8) | 255) /* set modem ctrl state */
Lidza Louina0b99d582013-08-01 17:00:20 -040041#endif
42
Andrew Milkovich6f6304b2015-01-18 10:41:30 -080043#define DIGI_GETA (('e'<<8) | 94) /* Read params */
Andrew Milkovich6f6304b2015-01-18 10:41:30 -080044#define DIGI_SETA (('e'<<8) | 95) /* Set params */
45#define DIGI_SETAW (('e'<<8) | 96) /* Drain & set params */
46#define DIGI_SETAF (('e'<<8) | 97) /* Drain, flush & set params */
Giedrius Statkevičius850b41f2015-03-13 15:56:31 +020047#define DIGI_GET_NI_INFO (('d'<<8) | 250) /* Non-intelligent state info */
48#define DIGI_LOOPBACK (('d'<<8) | 252) /*
49 * Enable/disable UART
50 * internal loopback
51 */
Lidza Louina0b99d582013-08-01 17:00:20 -040052#define DIGI_FAST 0x0002 /* Fast baud rates */
53#define RTSPACE 0x0004 /* RTS input flow control */
54#define CTSPACE 0x0008 /* CTS output flow control */
Lidza Louina0b99d582013-08-01 17:00:20 -040055#define DIGI_COOK 0x0080 /* Cooked processing done in FEP */
56#define DIGI_FORCEDCD 0x0100 /* Force carrier */
57#define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
Lidza Louina0b99d582013-08-01 17:00:20 -040058#define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/
Lidza Louina0b99d582013-08-01 17:00:20 -040059#define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */
Lidza Louina0b99d582013-08-01 17:00:20 -040060#define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */
Lidza Louina0b99d582013-08-01 17:00:20 -040061#define DIGI_PLEN 28 /* String length */
62#define DIGI_TSIZ 10 /* Terminal string len */
63
64/************************************************************************
65 * Structure used with ioctl commands for DIGI parameters.
66 ************************************************************************/
67struct digi_t {
68 unsigned short digi_flags; /* Flags (see above) */
69 unsigned short digi_maxcps; /* Max printer CPS */
70 unsigned short digi_maxchar; /* Max chars in print queue */
71 unsigned short digi_bufsize; /* Buffer size */
72 unsigned char digi_onlen; /* Length of ON string */
73 unsigned char digi_offlen; /* Length of OFF string */
74 char digi_onstr[DIGI_PLEN]; /* Printer on string */
75 char digi_offstr[DIGI_PLEN]; /* Printer off string */
76 char digi_term[DIGI_TSIZ]; /* terminal string */
77};
78
79/************************************************************************
Lidza Louina0b99d582013-08-01 17:00:20 -040080 * Structure to get driver status information
81 ************************************************************************/
82struct digi_dinfo {
83 unsigned int dinfo_nboards; /* # boards configured */
84 char dinfo_reserved[12]; /* for future expansion */
85 char dinfo_version[16]; /* driver version */
86};
87
Andrew Milkovich6f6304b2015-01-18 10:41:30 -080088#define DIGI_GETDD (('d'<<8) | 248) /* get driver info */
Lidza Louinab8f54722013-08-21 11:08:12 -040089
Lidza Louina0b99d582013-08-01 17:00:20 -040090/************************************************************************
91 * Structure used with ioctl commands for per-board information
92 *
93 * physsize and memsize differ when board has "windowed" memory
94 ************************************************************************/
95struct digi_info {
96 unsigned int info_bdnum; /* Board number (0 based) */
97 unsigned int info_ioport; /* io port address */
98 unsigned int info_physaddr; /* memory address */
99 unsigned int info_physsize; /* Size of host mem window */
100 unsigned int info_memsize; /* Amount of dual-port mem */
101 /* on board */
102 unsigned short info_bdtype; /* Board type */
103 unsigned short info_nports; /* number of ports */
104 char info_bdstate; /* board state */
105 char info_reserved[7]; /* for future expansion */
106};
107
Andrew Milkovich6f6304b2015-01-18 10:41:30 -0800108#define DIGI_GETBD (('d'<<8) | 249) /* get board info */
Lidza Louinab8f54722013-08-21 11:08:12 -0400109
Lidza Louina0b99d582013-08-01 17:00:20 -0400110struct digi_getbuffer /* Struct for holding buffer use counts */
111{
112 unsigned long tIn;
113 unsigned long tOut;
114 unsigned long rxbuf;
115 unsigned long txbuf;
116 unsigned long txdone;
117};
118
Lidza Louinaba48f612013-08-21 13:27:26 -0400119struct digi_getcounter {
Lidza Louina0b99d582013-08-01 17:00:20 -0400120 unsigned long norun; /* number of UART overrun errors */
121 unsigned long noflow; /* number of buffer overflow errors */
122 unsigned long nframe; /* number of framing errors */
123 unsigned long nparity; /* number of parity errors */
124 unsigned long nbreak; /* number of breaks received */
125 unsigned long rbytes; /* number of received bytes */
126 unsigned long tbytes; /* number of bytes transmitted fully */
127};
128
Lidza Louina0b99d582013-08-01 17:00:20 -0400129/* Board State Definitions */
Lidza Louina0b99d582013-08-01 17:00:20 -0400130#define BD_RUNNING 0x0
Lidza Louina0b99d582013-08-01 17:00:20 -0400131#define BD_NOFEP 0x5
Lidza Louina0b99d582013-08-01 17:00:20 -0400132
Buţiu Alexandru Octavianb2d39772015-05-17 22:31:34 +0300133#define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */
134#define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */
Lidza Louina0b99d582013-08-01 17:00:20 -0400135
Andrew Milkovich6f6304b2015-01-18 10:41:30 -0800136#define DIGI_REALPORT_GETBUFFERS (('e'<<8) | 108)
137#define DIGI_REALPORT_SENDIMMEDIATE (('e'<<8) | 109)
138#define DIGI_REALPORT_GETCOUNTERS (('e'<<8) | 110)
139#define DIGI_REALPORT_GETEVENTS (('e'<<8) | 111)
Lidza Louina0b99d582013-08-01 17:00:20 -0400140
Buţiu Alexandru Octavianb2d39772015-05-17 22:31:34 +0300141#define EV_OPU 0x0001 /* !<Output paused by client */
142#define EV_OPS 0x0002 /* !<Output paused by reqular sw flowctrl */
143#define EV_IPU 0x0010 /* !<Input paused unconditionally by user */
144#define EV_IPS 0x0020 /* !<Input paused by high/low water marks */
145#define EV_TXB 0x0040 /* !<Transmit break pending */
Lidza Louina0b99d582013-08-01 17:00:20 -0400146
Giedrius Statkevičius850b41f2015-03-13 15:56:31 +0200147/*
148 * This structure holds data needed for the intelligent <--> nonintelligent
149 * DPA translation
150 */
151struct ni_info {
152 int board;
153 int channel;
154 int dtr;
155 int rts;
156 int cts;
157 int dsr;
158 int ri;
159 int dcd;
160 int curtx;
161 int currx;
162 unsigned short iflag;
163 unsigned short oflag;
164 unsigned short cflag;
165 unsigned short lflag;
166 unsigned int mstat;
167 unsigned char hflow;
168 unsigned char xmit_stopped;
169 unsigned char recv_stopped;
170 unsigned int baud;
171};
172
173#define T_CLASSIC 0002
174#define T_PCIBUS 0400
175#define T_NEO_EXPRESS 0001
176#define T_NEO 0000
177
Giedrius Statkevičius20dad752015-03-13 15:56:33 +0200178#define TTY_FLIPBUF_SIZE 512
Lidza Louina0b99d582013-08-01 17:00:20 -0400179#endif /* DIGI_H */