author | Florian Pose <fp@igh-essen.com> |
Mon, 25 Jan 2010 18:31:27 +0100 | |
changeset 1788 | af61953c3ba4 |
parent 1787 | 439f186185be |
child 1789 | 058248c47ba0 |
permissions | -rw-r--r-- |
1565 | 1 |
/****************************************************************************** |
2 |
* |
|
3 |
* $Id$ |
|
4 |
* |
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
|
6 |
* |
|
7 |
* This file is part of the IgH EtherCAT Master. |
|
8 |
* |
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
|
11 |
* published by the Free Software Foundation. |
|
12 |
* |
|
13 |
* The IgH EtherCAT Master 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 GNU General |
|
16 |
* Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License along |
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
21 |
* |
|
22 |
* --- |
|
23 |
* |
|
24 |
* The license mentioned above concerns the source code only. Using the |
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
|
27 |
* |
|
28 |
*****************************************************************************/ |
|
29 |
||
30 |
/** \file |
|
31 |
* EtherCAT tty driver module. |
|
32 |
*/ |
|
33 |
||
34 |
/*****************************************************************************/ |
|
35 |
||
36 |
#include <linux/module.h> |
|
37 |
#include <linux/err.h> |
|
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
38 |
#include <linux/tty.h> |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
39 |
#include <linux/tty_driver.h> |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
40 |
#include <linux/tty_flip.h> |
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
41 |
#include <linux/termios.h> |
1575 | 42 |
#include <linux/timer.h> |
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
43 |
#include <linux/version.h> |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
44 |
#include <linux/serial.h> |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
45 |
#include <linux/uaccess.h> |
1565 | 46 |
|
47 |
#include "../master/globals.h" |
|
1569 | 48 |
#include "../include/ectty.h" |
49 |
||
50 |
/*****************************************************************************/ |
|
51 |
||
1570 | 52 |
#define PFX "ec_tty: " |
53 |
||
1569 | 54 |
#define EC_TTY_MAX_DEVICES 10 |
1575 | 55 |
#define EC_TTY_TX_BUFFER_SIZE 100 |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
56 |
#define EC_TTY_RX_BUFFER_SIZE 100 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
57 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
58 |
#define EC_TTY_DEBUG 0 |
1569 | 59 |
|
60 |
/*****************************************************************************/ |
|
61 |
||
1565 | 62 |
char *ec_master_version_str = EC_MASTER_VERSION; /**< Version string. */ |
1570 | 63 |
unsigned int debug_level = 0; |
1565 | 64 |
|
1569 | 65 |
static struct tty_driver *tty_driver = NULL; |
66 |
ec_tty_t *ttys[EC_TTY_MAX_DEVICES]; |
|
67 |
struct semaphore tty_sem; |
|
68 |
||
1786 | 69 |
void ec_tty_wakeup(unsigned long); |
70 |
||
1565 | 71 |
/*****************************************************************************/ |
72 |
||
73 |
/** \cond */ |
|
74 |
||
75 |
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>"); |
|
76 |
MODULE_DESCRIPTION("EtherCAT TTY driver module"); |
|
77 |
MODULE_LICENSE("GPL"); |
|
78 |
MODULE_VERSION(EC_MASTER_VERSION); |
|
79 |
||
80 |
module_param_named(debug_level, debug_level, uint, S_IRUGO); |
|
81 |
MODULE_PARM_DESC(debug_level, "Debug level"); |
|
82 |
||
1569 | 83 |
/** \endcond */ |
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
84 |
|
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
85 |
/** Standard termios for ec_tty devices. |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
86 |
* |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
87 |
* Simplest possible configuration, as you would expect. |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
88 |
*/ |
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
89 |
static struct ktermios ec_tty_std_termios = { |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
90 |
.c_iflag = 0, |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
91 |
.c_oflag = 0, |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
92 |
.c_cflag = B9600 | CS8 | CREAD, |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
93 |
.c_lflag = 0, |
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
94 |
.c_cc = INIT_C_CC, |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
95 |
}; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
96 |
|
1569 | 97 |
struct ec_tty { |
98 |
int minor; |
|
99 |
struct device *dev; |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
100 |
|
1575 | 101 |
uint8_t tx_buffer[EC_TTY_TX_BUFFER_SIZE]; |
102 |
unsigned int tx_read_idx; |
|
103 |
unsigned int tx_write_idx; |
|
104 |
unsigned int wakeup; |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
105 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
106 |
uint8_t rx_buffer[EC_TTY_RX_BUFFER_SIZE]; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
107 |
unsigned int rx_read_idx; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
108 |
unsigned int rx_write_idx; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
109 |
|
1575 | 110 |
struct timer_list timer; |
111 |
struct tty_struct *tty; |
|
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
112 |
|
1787
439f186185be
Callback set via own structure.
Florian Pose <fp@igh-essen.com>
parents:
1786
diff
changeset
|
113 |
ec_tty_operations_t ops; |
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
114 |
void *cb_data; |
1569 | 115 |
}; |
1565 | 116 |
|
1575 | 117 |
static const struct tty_operations ec_tty_ops; // see below |
118 |
||
1565 | 119 |
/*****************************************************************************/ |
120 |
||
121 |
/** Module initialization. |
|
122 |
* |
|
123 |
* \return 0 on success, else < 0 |
|
124 |
*/ |
|
125 |
int __init ec_tty_init_module(void) |
|
126 |
{ |
|
1569 | 127 |
int i, ret = 0; |
1565 | 128 |
|
1570 | 129 |
printk(KERN_INFO PFX "TTY driver %s\n", EC_MASTER_VERSION); |
1565 | 130 |
|
1569 | 131 |
init_MUTEX(&tty_sem); |
132 |
||
133 |
for (i = 0; i < EC_TTY_MAX_DEVICES; i++) { |
|
134 |
ttys[i] = NULL; |
|
135 |
} |
|
136 |
||
137 |
tty_driver = alloc_tty_driver(EC_TTY_MAX_DEVICES); |
|
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
138 |
if (!tty_driver) { |
1570 | 139 |
printk(KERN_ERR PFX "Failed to allocate tty driver.\n"); |
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
140 |
ret = -ENOMEM; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
141 |
goto out_return; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
142 |
} |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
143 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
144 |
tty_driver->owner = THIS_MODULE; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
145 |
tty_driver->driver_name = "EtherCAT TTY"; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
146 |
tty_driver->name = "ttyEC"; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
147 |
tty_driver->major = 0; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
148 |
tty_driver->minor_start = 0; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
149 |
tty_driver->type = TTY_DRIVER_TYPE_SERIAL; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
150 |
tty_driver->subtype = SERIAL_TYPE_NORMAL; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
151 |
tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
152 |
tty_driver->init_termios = ec_tty_std_termios; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
153 |
tty_set_operations(tty_driver, &ec_tty_ops); |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
154 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
155 |
ret = tty_register_driver(tty_driver); |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
156 |
if (ret) { |
1570 | 157 |
printk(KERN_ERR PFX "Failed to register tty driver.\n"); |
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
158 |
goto out_put; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
159 |
} |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
160 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
161 |
return ret; |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
162 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
163 |
out_put: |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
164 |
put_tty_driver(tty_driver); |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
165 |
out_return: |
1565 | 166 |
return ret; |
167 |
} |
|
168 |
||
169 |
/*****************************************************************************/ |
|
170 |
||
171 |
/** Module cleanup. |
|
172 |
* |
|
173 |
* Clears all master instances. |
|
174 |
*/ |
|
175 |
void __exit ec_tty_cleanup_module(void) |
|
176 |
{ |
|
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
177 |
tty_unregister_driver(tty_driver); |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
178 |
put_tty_driver(tty_driver); |
1570 | 179 |
printk(KERN_INFO PFX "Module unloading.\n"); |
1565 | 180 |
} |
181 |
||
1786 | 182 |
/****************************************************************************** |
183 |
* ec_tty_t methods. |
|
184 |
*****************************************************************************/ |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
185 |
|
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
186 |
int ec_tty_init(ec_tty_t *tty, int minor, |
1787
439f186185be
Callback set via own structure.
Florian Pose <fp@igh-essen.com>
parents:
1786
diff
changeset
|
187 |
const ec_tty_operations_t *ops, void *cb_data) |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
188 |
{ |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
189 |
tty->minor = minor; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
190 |
tty->tx_read_idx = 0; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
191 |
tty->tx_write_idx = 0; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
192 |
tty->wakeup = 0; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
193 |
tty->rx_read_idx = 0; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
194 |
tty->rx_write_idx = 0; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
195 |
init_timer(&tty->timer); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
196 |
tty->tty = NULL; |
1787
439f186185be
Callback set via own structure.
Florian Pose <fp@igh-essen.com>
parents:
1786
diff
changeset
|
197 |
tty->ops = *ops; |
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
198 |
tty->cb_data = cb_data; |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
199 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
200 |
tty->dev = tty_register_device(tty_driver, tty->minor, NULL); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
201 |
if (IS_ERR(tty->dev)) { |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
202 |
printk(KERN_ERR PFX "Failed to register tty device.\n"); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
203 |
return PTR_ERR(tty->dev); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
204 |
} |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
205 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
206 |
tty->timer.function = ec_tty_wakeup; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
207 |
tty->timer.data = (unsigned long) tty; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
208 |
tty->timer.expires = jiffies + 10; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
209 |
add_timer(&tty->timer); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
210 |
return 0; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
211 |
} |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
212 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
213 |
/*****************************************************************************/ |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
214 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
215 |
void ec_tty_clear(ec_tty_t *tty) |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
216 |
{ |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
217 |
del_timer_sync(&tty->timer); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
218 |
tty_unregister_device(tty_driver, tty->minor); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
219 |
} |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
220 |
|
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
221 |
/*****************************************************************************/ |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
222 |
|
1786 | 223 |
unsigned int ec_tty_tx_size(ec_tty_t *tty) |
224 |
{ |
|
225 |
unsigned int ret; |
|
226 |
||
227 |
if (tty->tx_write_idx >= tty->tx_read_idx) { |
|
228 |
ret = tty->tx_write_idx - tty->tx_read_idx; |
|
229 |
} else { |
|
230 |
ret = EC_TTY_TX_BUFFER_SIZE + tty->tx_write_idx - tty->tx_read_idx; |
|
231 |
} |
|
232 |
||
233 |
return ret; |
|
234 |
} |
|
235 |
||
236 |
/*****************************************************************************/ |
|
237 |
||
238 |
unsigned int ec_tty_tx_space(ec_tty_t *tty) |
|
239 |
{ |
|
240 |
return EC_TTY_TX_BUFFER_SIZE - 1 - ec_tty_tx_size(tty); |
|
241 |
} |
|
242 |
||
243 |
/*****************************************************************************/ |
|
244 |
||
245 |
unsigned int ec_tty_rx_size(ec_tty_t *tty) |
|
246 |
{ |
|
247 |
unsigned int ret; |
|
248 |
||
249 |
if (tty->rx_write_idx >= tty->rx_read_idx) { |
|
250 |
ret = tty->rx_write_idx - tty->rx_read_idx; |
|
251 |
} else { |
|
252 |
ret = EC_TTY_RX_BUFFER_SIZE + tty->rx_write_idx - tty->rx_read_idx; |
|
253 |
} |
|
254 |
||
255 |
return ret; |
|
256 |
} |
|
257 |
||
258 |
/*****************************************************************************/ |
|
259 |
||
260 |
unsigned int ec_tty_rx_space(ec_tty_t *tty) |
|
261 |
{ |
|
262 |
return EC_TTY_RX_BUFFER_SIZE - 1 - ec_tty_rx_size(tty); |
|
263 |
} |
|
264 |
||
265 |
/*****************************************************************************/ |
|
266 |
||
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
267 |
int ec_tty_get_serial_info(ec_tty_t *tty, struct serial_struct *data) |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
268 |
{ |
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
269 |
struct serial_struct tmp; |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
270 |
|
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
271 |
if (!data) |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
272 |
return -EFAULT; |
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
273 |
|
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
274 |
memset(&tmp, 0, sizeof(tmp)); |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
275 |
|
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
276 |
if (copy_to_user(data, &tmp, sizeof(*data))) { |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
277 |
return -EFAULT; |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
278 |
} |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
279 |
return 0; |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
280 |
} |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
281 |
|
1786 | 282 |
/*****************************************************************************/ |
283 |
||
284 |
/** Timer function. |
|
285 |
*/ |
|
286 |
void ec_tty_wakeup(unsigned long data) |
|
287 |
{ |
|
288 |
ec_tty_t *tty = (ec_tty_t *) data; |
|
289 |
size_t to_recv; |
|
290 |
||
291 |
/* Wake up any process waiting to send data */ |
|
292 |
if (tty->wakeup) { |
|
293 |
if (tty->tty) { |
|
294 |
#if EC_TTY_DEBUG >= 1 |
|
295 |
printk(KERN_INFO PFX "Waking up.\n"); |
|
296 |
#endif |
|
297 |
tty_wakeup(tty->tty); |
|
298 |
} |
|
299 |
tty->wakeup = 0; |
|
300 |
} |
|
301 |
||
302 |
/* Push received data into TTY core. */ |
|
303 |
to_recv = ec_tty_rx_size(tty); |
|
304 |
if (to_recv && tty->tty) { |
|
305 |
unsigned char *cbuf; |
|
306 |
int space = tty_prepare_flip_string(tty->tty, &cbuf, to_recv); |
|
307 |
||
308 |
if (space < to_recv) { |
|
309 |
printk(KERN_WARNING PFX "Insufficient space to_recv=%d space=%d\n", |
|
310 |
to_recv, space); |
|
311 |
} |
|
312 |
||
313 |
if (space < 0) { |
|
314 |
to_recv = 0; |
|
315 |
} else { |
|
316 |
to_recv = space; |
|
317 |
} |
|
318 |
||
319 |
if (to_recv) { |
|
320 |
unsigned int i; |
|
321 |
||
322 |
#if EC_TTY_DEBUG >= 1 |
|
323 |
printk(KERN_INFO PFX "Pushing %u bytes to TTY core.\n", to_recv); |
|
324 |
#endif |
|
325 |
||
326 |
for (i = 0; i < to_recv; i++) { |
|
327 |
cbuf[i] = tty->rx_buffer[tty->rx_read_idx]; |
|
328 |
tty->rx_read_idx = |
|
329 |
(tty->rx_read_idx + 1) % EC_TTY_RX_BUFFER_SIZE; |
|
330 |
} |
|
331 |
tty_flip_buffer_push(tty->tty); |
|
332 |
} |
|
333 |
} |
|
334 |
||
335 |
tty->timer.expires += 1; |
|
336 |
add_timer(&tty->timer); |
|
337 |
} |
|
338 |
||
1569 | 339 |
/****************************************************************************** |
340 |
* Device callbacks |
|
341 |
*****************************************************************************/ |
|
342 |
||
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
343 |
static int ec_tty_open(struct tty_struct *tty, struct file *file) |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
344 |
{ |
1571 | 345 |
ec_tty_t *t; |
1787
439f186185be
Callback set via own structure.
Florian Pose <fp@igh-essen.com>
parents:
1786
diff
changeset
|
346 |
int line = tty->index; |
1571 | 347 |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
348 |
#if EC_TTY_DEBUG >= 1 |
1571 | 349 |
printk(KERN_INFO PFX "Opening line %i.\n", line); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
350 |
#endif |
1571 | 351 |
|
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
352 |
if (line < 0 || line >= EC_TTY_MAX_DEVICES) { |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
353 |
return -ENXIO; |
1571 | 354 |
} |
355 |
||
356 |
t = ttys[line]; |
|
357 |
if (!t) { |
|
358 |
return -ENXIO; |
|
359 |
} |
|
360 |
||
1575 | 361 |
if (t->tty) { |
362 |
return -EBUSY; |
|
363 |
} |
|
364 |
||
365 |
t->tty = tty; |
|
1571 | 366 |
tty->driver_data = t; |
367 |
return 0; |
|
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
368 |
} |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
369 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
370 |
/*****************************************************************************/ |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
371 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
372 |
static void ec_tty_close(struct tty_struct *tty, struct file *file) |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
373 |
{ |
1575 | 374 |
ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
375 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
376 |
#if EC_TTY_DEBUG >= 1 |
1571 | 377 |
printk(KERN_INFO PFX "Closing line %i.\n", tty->index); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
378 |
#endif |
1575 | 379 |
|
380 |
if (t->tty == tty) { |
|
381 |
t->tty = NULL; |
|
382 |
} |
|
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
383 |
} |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
384 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
385 |
/*****************************************************************************/ |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
386 |
|
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
387 |
static int ec_tty_write( |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
388 |
struct tty_struct *tty, |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
389 |
const unsigned char *buffer, |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
390 |
int count |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
391 |
) |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
392 |
{ |
1575 | 393 |
ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
394 |
unsigned int data_size, i; |
|
395 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
396 |
#if EC_TTY_DEBUG >= 1 |
1575 | 397 |
printk(KERN_INFO PFX "%s(count=%i)\n", __func__, count); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
398 |
#endif |
1575 | 399 |
|
400 |
if (count <= 0) { |
|
401 |
return 0; |
|
402 |
} |
|
403 |
||
404 |
data_size = min(ec_tty_tx_space(t), (unsigned int) count); |
|
405 |
for (i = 0; i < data_size; i++) { |
|
406 |
t->tx_buffer[t->tx_write_idx] = buffer[i]; |
|
407 |
t->tx_write_idx = (t->tx_write_idx + 1) % EC_TTY_TX_BUFFER_SIZE; |
|
408 |
} |
|
409 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
410 |
#if EC_TTY_DEBUG >= 1 |
1575 | 411 |
printk(KERN_INFO PFX "%s(): %u bytes written.\n", __func__, data_size); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
412 |
#endif |
1575 | 413 |
return data_size; |
414 |
} |
|
415 |
||
416 |
/*****************************************************************************/ |
|
417 |
||
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
418 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
419 |
static int ec_tty_put_char(struct tty_struct *tty, unsigned char ch) |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
420 |
#else |
1575 | 421 |
static void ec_tty_put_char(struct tty_struct *tty, unsigned char ch) |
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
422 |
#endif |
1575 | 423 |
{ |
424 |
ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
|
425 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
426 |
#if EC_TTY_DEBUG >= 1 |
1575 | 427 |
printk(KERN_INFO PFX "%s(): c=%02x.\n", __func__, (unsigned int) ch); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
428 |
#endif |
1575 | 429 |
|
430 |
if (ec_tty_tx_space(t)) { |
|
431 |
t->tx_buffer[t->tx_write_idx] = ch; |
|
432 |
t->tx_write_idx = (t->tx_write_idx + 1) % EC_TTY_TX_BUFFER_SIZE; |
|
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
433 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
434 |
return 1; |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
435 |
#endif |
1575 | 436 |
} else { |
437 |
printk(KERN_WARNING PFX "%s(): Dropped a byte!\n", __func__); |
|
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
438 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
439 |
return 0; |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
440 |
#endif |
1575 | 441 |
} |
442 |
} |
|
443 |
||
444 |
/*****************************************************************************/ |
|
445 |
||
446 |
static int ec_tty_write_room(struct tty_struct *tty) |
|
447 |
{ |
|
448 |
ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
|
449 |
int ret = ec_tty_tx_space(t); |
|
450 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
451 |
#if EC_TTY_DEBUG >= 2 |
1575 | 452 |
printk(KERN_INFO PFX "%s() = %i.\n", __func__, ret); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
453 |
#endif |
1575 | 454 |
|
455 |
return ret; |
|
456 |
} |
|
457 |
||
458 |
/*****************************************************************************/ |
|
459 |
||
460 |
static int ec_tty_chars_in_buffer(struct tty_struct *tty) |
|
461 |
{ |
|
462 |
ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
|
463 |
int ret; |
|
464 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
465 |
#if EC_TTY_DEBUG >= 2 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
466 |
printk(KERN_INFO PFX "%s().\n", __func__); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
467 |
#endif |
1575 | 468 |
|
469 |
ret = ec_tty_tx_size(t); |
|
470 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
471 |
#if EC_TTY_DEBUG >= 2 |
1575 | 472 |
printk(KERN_INFO PFX "%s() = %i.\n", __func__, ret); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
473 |
#endif |
1575 | 474 |
|
475 |
return ret; |
|
476 |
} |
|
477 |
||
478 |
/*****************************************************************************/ |
|
479 |
||
480 |
static void ec_tty_flush_buffer(struct tty_struct *tty) |
|
481 |
{ |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
482 |
#if EC_TTY_DEBUG >= 2 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
483 |
printk(KERN_INFO PFX "%s().\n", __func__); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
484 |
#endif |
1575 | 485 |
} |
486 |
||
487 |
/*****************************************************************************/ |
|
488 |
||
489 |
static int ec_tty_ioctl(struct tty_struct *tty, struct file *file, |
|
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
490 |
unsigned int cmd, unsigned long arg) |
1575 | 491 |
{ |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
492 |
ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
493 |
int ret = -ENOTTY; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
494 |
|
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
495 |
#if EC_TTY_DEBUG >= 2 |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
496 |
printk(KERN_INFO PFX "%s(tty=%p, file=%p, cmd=%08x, arg=%08lx).\n", |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
497 |
__func__, tty, file, cmd, arg); |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
498 |
printk(KERN_INFO PFX "decoded: type=%02x nr=%u\n", |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
499 |
_IOC_TYPE(cmd), _IOC_NR(cmd)); |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
500 |
#endif |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
501 |
|
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
502 |
switch (cmd) { |
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
503 |
case TIOCGSERIAL: |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
504 |
if (access_ok(VERIFY_WRITE, |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
505 |
(void *) arg, sizeof(struct serial_struct))) { |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
506 |
ret = ec_tty_get_serial_info(t, (struct serial_struct *) arg); |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
507 |
} else { |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
508 |
ret = -EFAULT; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
509 |
} |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
510 |
break; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
511 |
|
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
512 |
case TIOCSSERIAL: // TODO |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
513 |
break; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
514 |
|
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
515 |
default: |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
516 |
#if EC_TTY_DEBUG >= 2 |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
517 |
printk(KERN_INFO PFX "no ioctl()!\n"); |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
518 |
#endif |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
519 |
ret = -ENOIOCTLCMD; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
520 |
break; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
521 |
} |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
522 |
|
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
523 |
return ret; |
1575 | 524 |
} |
525 |
||
526 |
/*****************************************************************************/ |
|
527 |
||
528 |
static void ec_tty_set_termios(struct tty_struct *tty, |
|
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
529 |
struct ktermios *old_termios) |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
530 |
{ |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
531 |
ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
532 |
int ret; |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
533 |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
534 |
#if EC_TTY_DEBUG >= 2 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
535 |
printk(KERN_INFO PFX "%s().\n", __func__); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
536 |
#endif |
1778
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
537 |
|
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
538 |
if (tty->termios->c_cflag == old_termios->c_cflag) |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
539 |
return; |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
540 |
|
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
541 |
#if EC_TTY_DEBUG >= 2 |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
542 |
printk(KERN_INFO "cflag changed from %x to %x.\n", |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
543 |
old_termios->c_cflag, tty->termios->c_cflag); |
94dbb44884ec
Basic configuration for tty.
Florian Pose <fp@igh-essen.com>
parents:
1595
diff
changeset
|
544 |
#endif |
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
545 |
|
1787
439f186185be
Callback set via own structure.
Florian Pose <fp@igh-essen.com>
parents:
1786
diff
changeset
|
546 |
ret = t->ops.cflag_changed(t->cb_data, tty->termios->c_cflag); |
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
547 |
if (ret) { |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
548 |
printk(KERN_ERR PFX "ERROR: cflag 0x%x not accepted.\n", |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
549 |
tty->termios->c_cflag); |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
550 |
tty->termios->c_cflag = old_termios->c_cflag; |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
551 |
} |
1575 | 552 |
} |
553 |
||
554 |
/*****************************************************************************/ |
|
555 |
||
556 |
static void ec_tty_stop(struct tty_struct *tty) |
|
557 |
{ |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
558 |
#if EC_TTY_DEBUG >= 2 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
559 |
printk(KERN_INFO PFX "%s().\n", __func__); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
560 |
#endif |
1575 | 561 |
} |
562 |
||
563 |
/*****************************************************************************/ |
|
564 |
||
565 |
static void ec_tty_start(struct tty_struct *tty) |
|
566 |
{ |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
567 |
#if EC_TTY_DEBUG >= 2 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
568 |
printk(KERN_INFO PFX "%s().\n", __func__); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
569 |
#endif |
1575 | 570 |
} |
571 |
||
572 |
/*****************************************************************************/ |
|
573 |
||
574 |
static void ec_tty_hangup(struct tty_struct *tty) |
|
575 |
{ |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
576 |
#if EC_TTY_DEBUG >= 2 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
577 |
printk(KERN_INFO PFX "%s().\n", __func__); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
578 |
#endif |
1575 | 579 |
} |
580 |
||
581 |
/*****************************************************************************/ |
|
582 |
||
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
583 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
584 |
static int ec_tty_break(struct tty_struct *tty, int break_state) |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
585 |
#else |
1575 | 586 |
static void ec_tty_break(struct tty_struct *tty, int break_state) |
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
587 |
#endif |
1575 | 588 |
{ |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
589 |
#if EC_TTY_DEBUG >= 2 |
1575 | 590 |
printk(KERN_INFO PFX "%s(break_state = %i).\n", __func__, break_state); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
591 |
#endif |
1595
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
592 |
|
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
593 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
594 |
return -EIO; // not implemented |
8d8657654921
Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
Florian Pose <fp@igh-essen.com>
parents:
1577
diff
changeset
|
595 |
#endif |
1575 | 596 |
} |
597 |
||
598 |
/*****************************************************************************/ |
|
599 |
||
600 |
static void ec_tty_send_xchar(struct tty_struct *tty, char ch) |
|
601 |
{ |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
602 |
#if EC_TTY_DEBUG >= 2 |
1575 | 603 |
printk(KERN_INFO PFX "%s(ch=%02x).\n", __func__, (unsigned int) ch); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
604 |
#endif |
1575 | 605 |
} |
606 |
||
607 |
/*****************************************************************************/ |
|
608 |
||
609 |
static void ec_tty_wait_until_sent(struct tty_struct *tty, int timeout) |
|
610 |
{ |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
611 |
#if EC_TTY_DEBUG >= 2 |
1575 | 612 |
printk(KERN_INFO PFX "%s(timeout=%i).\n", __func__, timeout); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
613 |
#endif |
1575 | 614 |
} |
615 |
||
616 |
/*****************************************************************************/ |
|
617 |
||
618 |
static const struct tty_operations ec_tty_ops = { |
|
619 |
.open = ec_tty_open, |
|
620 |
.close = ec_tty_close, |
|
621 |
.write = ec_tty_write, |
|
1779
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
622 |
.put_char = ec_tty_put_char, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
623 |
.write_room = ec_tty_write_room, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
624 |
.chars_in_buffer = ec_tty_chars_in_buffer, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
625 |
.flush_buffer = ec_tty_flush_buffer, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
626 |
.ioctl = ec_tty_ioctl, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
627 |
.set_termios = ec_tty_set_termios, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
628 |
.stop = ec_tty_stop, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
629 |
.start = ec_tty_start, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
630 |
.hangup = ec_tty_hangup, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
631 |
.break_ctl = ec_tty_break, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
632 |
.send_xchar = ec_tty_send_xchar, |
9fab229d6ca9
Passing tty cflag to serial implementation.
Florian Pose <fp@igh-essen.com>
parents:
1778
diff
changeset
|
633 |
.wait_until_sent = ec_tty_wait_until_sent, |
1575 | 634 |
}; |
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
635 |
|
1569 | 636 |
/****************************************************************************** |
637 |
* Public functions and methods |
|
638 |
*****************************************************************************/ |
|
639 |
||
1787
439f186185be
Callback set via own structure.
Florian Pose <fp@igh-essen.com>
parents:
1786
diff
changeset
|
640 |
ec_tty_t *ectty_create(const ec_tty_operations_t *ops, void *cb_data) |
1569 | 641 |
{ |
642 |
ec_tty_t *tty; |
|
643 |
int minor, ret; |
|
644 |
||
645 |
if (down_interruptible(&tty_sem)) { |
|
646 |
return ERR_PTR(-EINTR); |
|
647 |
} |
|
648 |
||
649 |
for (minor = 0; minor < EC_TTY_MAX_DEVICES; minor++) { |
|
650 |
if (!ttys[minor]) { |
|
1575 | 651 |
printk(KERN_INFO PFX "Creating TTY interface %i.\n", minor); |
652 |
||
1569 | 653 |
tty = kmalloc(sizeof(ec_tty_t), GFP_KERNEL); |
654 |
if (!tty) { |
|
655 |
up(&tty_sem); |
|
1570 | 656 |
printk(KERN_ERR PFX "Failed to allocate memory.\n"); |
1569 | 657 |
return ERR_PTR(-ENOMEM); |
658 |
} |
|
659 |
||
1787
439f186185be
Callback set via own structure.
Florian Pose <fp@igh-essen.com>
parents:
1786
diff
changeset
|
660 |
ret = ec_tty_init(tty, minor, ops, cb_data); |
1569 | 661 |
if (ret) { |
662 |
up(&tty_sem); |
|
663 |
kfree(tty); |
|
664 |
return ERR_PTR(ret); |
|
665 |
} |
|
666 |
||
667 |
ttys[minor] = tty; |
|
668 |
up(&tty_sem); |
|
669 |
return tty; |
|
670 |
} |
|
671 |
} |
|
672 |
||
673 |
up(&tty_sem); |
|
1570 | 674 |
printk(KERN_ERR PFX "No free interfaces avaliable.\n"); |
1569 | 675 |
return ERR_PTR(-EBUSY); |
676 |
} |
|
677 |
||
678 |
/*****************************************************************************/ |
|
679 |
||
680 |
void ectty_free(ec_tty_t *tty) |
|
681 |
{ |
|
1575 | 682 |
printk(KERN_INFO PFX "Freeing TTY interface %i.\n", tty->minor); |
683 |
||
1569 | 684 |
ec_tty_clear(tty); |
1570 | 685 |
ttys[tty->minor] = NULL; |
1569 | 686 |
kfree(tty); |
687 |
} |
|
688 |
||
1568
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
689 |
/*****************************************************************************/ |
d9bbbe1883ab
Register a TTY driver with one device.
Florian Pose <fp@igh-essen.com>
parents:
1565
diff
changeset
|
690 |
|
1575 | 691 |
unsigned int ectty_tx_data(ec_tty_t *tty, uint8_t *buffer, size_t size) |
692 |
{ |
|
693 |
unsigned int data_size = min(ec_tty_tx_size(tty), size), i; |
|
694 |
||
695 |
if (data_size) { |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
696 |
#if EC_TTY_DEBUG >= 1 |
1575 | 697 |
printk(KERN_INFO PFX "Fetching %u bytes to send.\n", data_size); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
698 |
#endif |
1575 | 699 |
} |
700 |
||
701 |
for (i = 0; i < data_size; i++) { |
|
702 |
buffer[i] = tty->tx_buffer[tty->tx_read_idx]; |
|
703 |
tty->tx_read_idx = (tty->tx_read_idx + 1) % EC_TTY_TX_BUFFER_SIZE; |
|
704 |
} |
|
705 |
||
706 |
if (data_size) { |
|
707 |
tty->wakeup = 1; |
|
708 |
} |
|
709 |
||
710 |
return data_size; |
|
711 |
} |
|
712 |
||
713 |
/*****************************************************************************/ |
|
714 |
||
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
715 |
void ectty_rx_data(ec_tty_t *tty, const uint8_t *buffer, size_t size) |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
716 |
{ |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
717 |
size_t to_recv; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
718 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
719 |
if (size) { |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
720 |
unsigned int i; |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
721 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
722 |
#if EC_TTY_DEBUG >= 1 |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
723 |
printk(KERN_INFO PFX "Received %u bytes.\n", size); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
724 |
#endif |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
725 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
726 |
to_recv = min(ec_tty_rx_space(tty), size); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
727 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
728 |
if (to_recv < size) { |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
729 |
printk(KERN_WARNING PFX "Dropping %u bytes.\n", size - to_recv); |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
730 |
} |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
731 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
732 |
for (i = 0; i < size; i++) { |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
733 |
tty->rx_buffer[tty->rx_write_idx] = buffer[i]; |
1786 | 734 |
tty->rx_write_idx = |
735 |
(tty->rx_write_idx + 1) % EC_TTY_RX_BUFFER_SIZE; |
|
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
736 |
} |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
737 |
} |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
738 |
} |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
739 |
|
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
740 |
/*****************************************************************************/ |
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
741 |
|
1565 | 742 |
/** \cond */ |
743 |
||
744 |
module_init(ec_tty_init_module); |
|
745 |
module_exit(ec_tty_cleanup_module); |
|
746 |
||
1569 | 747 |
EXPORT_SYMBOL(ectty_create); |
748 |
EXPORT_SYMBOL(ectty_free); |
|
1575 | 749 |
EXPORT_SYMBOL(ectty_tx_data); |
1577
fa3f66b783c1
Implemented reading direction of tty driver.
Florian Pose <fp@igh-essen.com>
parents:
1575
diff
changeset
|
750 |
EXPORT_SYMBOL(ectty_rx_data); |
1569 | 751 |
|
1565 | 752 |
/** \endcond */ |
753 |
||
754 |
/*****************************************************************************/ |