aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/serial
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /Documentation/serial
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'Documentation/serial')
-rw-r--r--Documentation/serial/00-INDEX2
-rw-r--r--Documentation/serial/moxa-smartio2
-rw-r--r--Documentation/serial/n_gsm.txt89
-rw-r--r--Documentation/serial/serial-rs485.txt120
-rw-r--r--Documentation/serial/tty.txt2
5 files changed, 213 insertions, 2 deletions
diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX
index 07dcdb0d2a36..e09468ad3cb1 100644
--- a/Documentation/serial/00-INDEX
+++ b/Documentation/serial/00-INDEX
@@ -14,6 +14,8 @@ riscom8.txt
14 - notes on using the RISCom/8 multi-port serial driver. 14 - notes on using the RISCom/8 multi-port serial driver.
15rocket.txt 15rocket.txt
16 - info on the Comtrol RocketPort multiport serial driver. 16 - info on the Comtrol RocketPort multiport serial driver.
17serial-rs485.txt
18 - info about RS485 structures and support in the kernel.
17specialix.txt 19specialix.txt
18 - info on hardware/driver for specialix IO8+ multiport serial card. 20 - info on hardware/driver for specialix IO8+ multiport serial card.
19stallion.txt 21stallion.txt
diff --git a/Documentation/serial/moxa-smartio b/Documentation/serial/moxa-smartio
index d10443918684..5d2a33be0bd8 100644
--- a/Documentation/serial/moxa-smartio
+++ b/Documentation/serial/moxa-smartio
@@ -473,7 +473,7 @@ Content
473 spd_normal Use 38.4kb when the application requests 38.4kb. 473 spd_normal Use 38.4kb when the application requests 38.4kb.
474 spd_cust Use the custom divisor to set the speed when the 474 spd_cust Use the custom divisor to set the speed when the
475 application requests 38.4kb. 475 application requests 38.4kb.
476 divisor This option set the custom divison. 476 divisor This option set the custom division.
477 baud_base This option set the base baud rate. 477 baud_base This option set the base baud rate.
478 478
479----------------------------------------------------------------------------- 479-----------------------------------------------------------------------------
diff --git a/Documentation/serial/n_gsm.txt b/Documentation/serial/n_gsm.txt
new file mode 100644
index 000000000000..a5d91126a8f7
--- /dev/null
+++ b/Documentation/serial/n_gsm.txt
@@ -0,0 +1,89 @@
1n_gsm.c GSM 0710 tty multiplexor HOWTO
2===================================================
3
4This line discipline implements the GSM 07.10 multiplexing protocol
5detailed in the following 3GPP document :
6http://www.3gpp.org/ftp/Specs/archive/07_series/07.10/0710-720.zip
7
8This document give some hints on how to use this driver with GPRS and 3G
9modems connected to a physical serial port.
10
11How to use it
12-------------
131- initialize the modem in 0710 mux mode (usually AT+CMUX= command) through
14its serial port. Depending on the modem used, you can pass more or less
15parameters to this command,
162- switch the serial line to using the n_gsm line discipline by using
17TIOCSETD ioctl,
183- configure the mux using GSMIOC_GETCONF / GSMIOC_SETCONF ioctl,
19
20Major parts of the initialization program :
21(a good starting point is util-linux-ng/sys-utils/ldattach.c)
22#include <linux/gsmmux.h>
23#define N_GSM0710 21 /* GSM 0710 Mux */
24#define DEFAULT_SPEED B115200
25#define SERIAL_PORT /dev/ttyS0
26
27 int ldisc = N_GSM0710;
28 struct gsm_config c;
29 struct termios configuration;
30
31 /* open the serial port connected to the modem */
32 fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY);
33
34 /* configure the serial port : speed, flow control ... */
35
36 /* send the AT commands to switch the modem to CMUX mode
37 and check that it's successful (should return OK) */
38 write(fd, "AT+CMUX=0\r", 10);
39
40 /* experience showed that some modems need some time before
41 being able to answer to the first MUX packet so a delay
42 may be needed here in some case */
43 sleep(3);
44
45 /* use n_gsm line discipline */
46 ioctl(fd, TIOCSETD, &ldisc);
47
48 /* get n_gsm configuration */
49 ioctl(fd, GSMIOC_GETCONF, &c);
50 /* we are initiator and need encoding 0 (basic) */
51 c.initiator = 1;
52 c.encapsulation = 0;
53 /* our modem defaults to a maximum size of 127 bytes */
54 c.mru = 127;
55 c.mtu = 127;
56 /* set the new configuration */
57 ioctl(fd, GSMIOC_SETCONF, &c);
58
59 /* and wait for ever to keep the line discipline enabled */
60 daemon(0,0);
61 pause();
62
634- create the devices corresponding to the "virtual" serial ports (take care,
64each modem has its configuration and some DLC have dedicated functions,
65for example GPS), starting with minor 1 (DLC0 is reserved for the management
66of the mux)
67
68MAJOR=`cat /proc/devices |grep gsmtty | awk '{print $1}`
69for i in `seq 1 4`; do
70 mknod /dev/ttygsm$i c $MAJOR $i
71done
72
735- use these devices as plain serial ports.
74for example, it's possible :
75- and to use gnokii to send / receive SMS on ttygsm1
76- to use ppp to establish a datalink on ttygsm2
77
786- first close all virtual ports before closing the physical port.
79
80Additional Documentation
81------------------------
82More practical details on the protocol and how it's supported by industrial
83modems can be found in the following documents :
84http://www.telit.com/module/infopool/download.php?id=616
85http://www.u-blox.com/images/downloads/Product_Docs/LEON-G100-G200-MuxImplementation_ApplicationNote_%28GSM%20G1-CS-10002%29.pdf
86http://www.sierrawireless.com/Support/Downloads/AirPrime/WMP_Series/~/media/Support_Downloads/AirPrime/Application_notes/CMUX_Feature_Application_Note-Rev004.ashx
87http://wm.sim.com/sim/News/photo/2010721161442.pdf
88
8911-03-08 - Eric BĂ©nard - <eric@eukrea.com>
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
new file mode 100644
index 000000000000..a4932387bbfb
--- /dev/null
+++ b/Documentation/serial/serial-rs485.txt
@@ -0,0 +1,120 @@
1 RS485 SERIAL COMMUNICATIONS
2
31. INTRODUCTION
4
5 EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the
6 electrical characteristics of drivers and receivers for use in balanced
7 digital multipoint systems.
8 This standard is widely used for communications in industrial automation
9 because it can be used effectively over long distances and in electrically
10 noisy environments.
11
122. HARDWARE-RELATED CONSIDERATIONS
13
14 Some CPUs/UARTs (e.g., Atmel AT91 or 16C950 UART) contain a built-in
15 half-duplex mode capable of automatically controlling line direction by
16 toggling RTS or DTR signals. That can be used to control external
17 half-duplex hardware like an RS485 transceiver or any RS232-connected
18 half-duplex devices like some modems.
19
20 For these microcontrollers, the Linux driver should be made capable of
21 working in both modes, and proper ioctls (see later) should be made
22 available at user-level to allow switching from one mode to the other, and
23 vice versa.
24
253. DATA STRUCTURES ALREADY AVAILABLE IN THE KERNEL
26
27 The Linux kernel provides the serial_rs485 structure (see [1]) to handle
28 RS485 communications. This data structure is used to set and configure RS485
29 parameters in the platform data and in ioctls.
30
31 Any driver for devices capable of working both as RS232 and RS485 should
32 provide at least the following ioctls:
33
34 - TIOCSRS485 (typically associated with number 0x542F). This ioctl is used
35 to enable/disable RS485 mode from user-space
36
37 - TIOCGRS485 (typically associated with number 0x542E). This ioctl is used
38 to get RS485 mode from kernel-space (i.e., driver) to user-space.
39
40 In other words, the serial driver should contain a code similar to the next
41 one:
42
43 static struct uart_ops atmel_pops = {
44 /* ... */
45 .ioctl = handle_ioctl,
46 };
47
48 static int handle_ioctl(struct uart_port *port,
49 unsigned int cmd,
50 unsigned long arg)
51 {
52 struct serial_rs485 rs485conf;
53
54 switch (cmd) {
55 case TIOCSRS485:
56 if (copy_from_user(&rs485conf,
57 (struct serial_rs485 *) arg,
58 sizeof(rs485conf)))
59 return -EFAULT;
60
61 /* ... */
62 break;
63
64 case TIOCGRS485:
65 if (copy_to_user((struct serial_rs485 *) arg,
66 ...,
67 sizeof(rs485conf)))
68 return -EFAULT;
69 /* ... */
70 break;
71
72 /* ... */
73 }
74 }
75
76
774. USAGE FROM USER-LEVEL
78
79 From user-level, RS485 configuration can be get/set using the previous
80 ioctls. For instance, to set RS485 you can use the following code:
81
82 #include <linux/serial.h>
83
84 /* Driver-specific ioctls: */
85 #define TIOCGRS485 0x542E
86 #define TIOCSRS485 0x542F
87
88 /* Open your specific device (e.g., /dev/mydevice): */
89 int fd = open ("/dev/mydevice", O_RDWR);
90 if (fd < 0) {
91 /* Error handling. See errno. */
92 }
93
94 struct serial_rs485 rs485conf;
95
96 /* Set RS485 mode: */
97 rs485conf.flags |= SER_RS485_ENABLED;
98
99 /* Set rts delay before send, if needed: */
100 rs485conf.flags |= SER_RS485_RTS_BEFORE_SEND;
101 rs485conf.delay_rts_before_send = ...;
102
103 /* Set rts delay after send, if needed: */
104 rs485conf.flags |= SER_RS485_RTS_AFTER_SEND;
105 rs485conf.delay_rts_after_send = ...;
106
107 if (ioctl (fd, TIOCSRS485, &rs485conf) < 0) {
108 /* Error handling. See errno. */
109 }
110
111 /* Use read() and write() syscalls here... */
112
113 /* Close the device when finished: */
114 if (close (fd) < 0) {
115 /* Error handling. See errno. */
116 }
117
1185. REFERENCES
119
120 [1] include/linux/serial.h
diff --git a/Documentation/serial/tty.txt b/Documentation/serial/tty.txt
index 7c900507279f..540db41dfd5d 100644
--- a/Documentation/serial/tty.txt
+++ b/Documentation/serial/tty.txt
@@ -107,7 +107,7 @@ write_wakeup() - May be called at any point between open and close.
107 107
108dcd_change() - Report to the tty line the current DCD pin status 108dcd_change() - Report to the tty line the current DCD pin status
109 changes and the relative timestamp. The timestamp 109 changes and the relative timestamp. The timestamp
110 can be NULL. 110 cannot be NULL.
111 111
112 112
113Driver Access 113Driver Access