1/*********************************************************************
2 *
3 * Filename:      ircomm_param.h
4 * Version:       1.0
5 * Description:   Parameter handling for the IrCOMM protocol
6 * Status:        Experimental.
7 * Author:        Dag Brattli <dagb@cs.uit.no>
8 * Created at:    Mon Jun  7 08:47:28 1999
9 * Modified at:   Wed Aug 25 13:46:33 1999
10 * Modified by:   Dag Brattli <dagb@cs.uit.no>
11 *
12 *     Copyright (c) 1999 Dag Brattli, All Rights Reserved.
13 *
14 *     This program is free software; you can redistribute it and/or
15 *     modify it under the terms of the GNU General Public License as
16 *     published by the Free Software Foundation; either version 2 of
17 *     the License, or (at your option) any later version.
18 *
19 *     This program is distributed in the hope that it will be useful,
20 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
21 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 *     GNU General Public License for more details.
23 *
24 *     You should have received a copy of the GNU General Public License
25 *     along with this program; if not, write to the Free Software
26 *     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 *     MA 02111-1307 USA
28 *
29 ********************************************************************/
30
31#ifndef IRCOMM_PARAMS_H
32#define IRCOMM_PARAMS_H
33
34#include <net/irda/parameters.h>
35
36/* Parameters common to all service types */
37#define IRCOMM_SERVICE_TYPE     0x00
38#define IRCOMM_PORT_TYPE        0x01 /* Only used in LM-IAS */
39#define IRCOMM_PORT_NAME        0x02 /* Only used in LM-IAS */
40
41/* Parameters for both 3 wire and 9 wire */
42#define IRCOMM_DATA_RATE        0x10
43#define IRCOMM_DATA_FORMAT      0x11
44#define IRCOMM_FLOW_CONTROL     0x12
45#define IRCOMM_XON_XOFF         0x13
46#define IRCOMM_ENQ_ACK          0x14
47#define IRCOMM_LINE_STATUS      0x15
48#define IRCOMM_BREAK            0x16
49
50/* Parameters for 9 wire */
51#define IRCOMM_DTE              0x20
52#define IRCOMM_DCE              0x21
53#define IRCOMM_POLL             0x22
54
55/* Service type (details) */
56#define IRCOMM_3_WIRE_RAW       0x01
57#define IRCOMM_3_WIRE           0x02
58#define IRCOMM_9_WIRE           0x04
59#define IRCOMM_CENTRONICS       0x08
60
61/* Port type (details) */
62#define IRCOMM_SERIAL           0x00
63#define IRCOMM_PARALLEL         0x01
64
65/* Data format (details) */
66#define IRCOMM_WSIZE_5          0x00
67#define IRCOMM_WSIZE_6          0x01
68#define IRCOMM_WSIZE_7          0x02
69#define IRCOMM_WSIZE_8          0x03
70
71#define IRCOMM_1_STOP_BIT       0x00
72#define IRCOMM_2_STOP_BIT       0x04 /* 1.5 if char len 5 */
73
74#define IRCOMM_PARITY_DISABLE   0x00
75#define IRCOMM_PARITY_ENABLE    0x08
76
77#define IRCOMM_PARITY_ODD       0x00
78#define IRCOMM_PARITY_EVEN      0x10
79#define IRCOMM_PARITY_MARK      0x20
80#define IRCOMM_PARITY_SPACE     0x30
81
82/* Flow control */
83#define IRCOMM_XON_XOFF_IN      0x01
84#define IRCOMM_XON_XOFF_OUT     0x02
85#define IRCOMM_RTS_CTS_IN       0x04
86#define IRCOMM_RTS_CTS_OUT      0x08
87#define IRCOMM_DSR_DTR_IN       0x10
88#define IRCOMM_DSR_DTR_OUT      0x20
89#define IRCOMM_ENQ_ACK_IN       0x40
90#define IRCOMM_ENQ_ACK_OUT      0x80
91
92/* Line status */
93#define IRCOMM_OVERRUN_ERROR    0x02
94#define IRCOMM_PARITY_ERROR     0x04
95#define IRCOMM_FRAMING_ERROR    0x08
96
97/* DTE (Data terminal equipment) line settings */
98#define IRCOMM_DELTA_DTR        0x01
99#define IRCOMM_DELTA_RTS        0x02
100#define IRCOMM_DTR              0x04
101#define IRCOMM_RTS              0x08
102
103/* DCE (Data communications equipment) line settings */
104#define IRCOMM_DELTA_CTS        0x01  /* Clear to send has changed */
105#define IRCOMM_DELTA_DSR        0x02  /* Data set ready has changed */
106#define IRCOMM_DELTA_RI         0x04  /* Ring indicator has changed */
107#define IRCOMM_DELTA_CD         0x08  /* Carrier detect has changed */
108#define IRCOMM_CTS              0x10  /* Clear to send is high */
109#define IRCOMM_DSR              0x20  /* Data set ready is high */
110#define IRCOMM_RI               0x40  /* Ring indicator is high */
111#define IRCOMM_CD               0x80  /* Carrier detect is high */
112#define IRCOMM_DCE_DELTA_ANY    0x0f
113
114/*
115 * Parameter state
116 */
117struct ircomm_params {
118	/* General control params */
119	__u8  service_type;
120	__u8  port_type;
121	char  port_name[32];
122
123	/* Control params for 3- and 9-wire service type */
124	__u32 data_rate;         /* Data rate in bps */
125	__u8  data_format;
126	__u8  flow_control;
127	char  xonxoff[2];
128	char  enqack[2];
129	__u8  line_status;
130	__u8  _break;
131
132	__u8  null_modem;
133
134	/* Control params for 9-wire service type */
135	__u8 dte;
136	__u8 dce;
137	__u8 poll;
138
139	/* Control params for Centronics service type */
140};
141
142struct ircomm_tty_cb; /* Forward decl. */
143
144int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush);
145
146extern pi_param_info_t ircomm_param_info;
147
148#endif /* IRCOMM_PARAMS_H */
149