1 |
1275 |
phoenix |
=============================================================================
|
2 |
|
|
|
3 |
|
|
MOXA Smartio Family Device Driver Ver 1.1 Installation Guide
|
4 |
|
|
for Linux Kernel 2.2.x and 2.0.3x
|
5 |
|
|
Copyright (C) 1999, Moxa Technologies Co, Ltd.
|
6 |
|
|
=============================================================================
|
7 |
|
|
Content
|
8 |
|
|
|
9 |
|
|
1. Introduction
|
10 |
|
|
2. System Requirement
|
11 |
|
|
3. Installation
|
12 |
|
|
4. Utilities
|
13 |
|
|
5. Setserial
|
14 |
|
|
6. Troubleshooting
|
15 |
|
|
|
16 |
|
|
-----------------------------------------------------------------------------
|
17 |
|
|
1. Introduction
|
18 |
|
|
|
19 |
|
|
The Smartio family Linux driver, Ver. 1.1, supports following multiport
|
20 |
|
|
boards.
|
21 |
|
|
|
22 |
|
|
-C104P/H/HS, C104H/PCI, C104HS/PCI, CI-104J 4 port multiport board.
|
23 |
|
|
-C168P/H/HS, C168H/PCI 8 port multiport board.
|
24 |
|
|
|
25 |
|
|
This driver has been modified a little and cleaned up from the Moxa
|
26 |
|
|
contributed driver code and merged into Linux 2.2.14pre. In particular
|
27 |
|
|
official major/minor numbers have been assigned which are different to
|
28 |
|
|
those the original Moxa supplied driver used.
|
29 |
|
|
|
30 |
|
|
This driver and installation procedure have been developed upon Linux Kernel
|
31 |
|
|
2.2.5 and backward compatible to 2.0.3x. This driver supports Intel x86 and
|
32 |
|
|
Alpha hardware platform. In order to maintain compatibility, this version
|
33 |
|
|
has also been properly tested with RedHat, OpenLinux, TurboLinux and
|
34 |
|
|
S.u.S.E Linux. However, if compatibility problem occurs, please contact
|
35 |
|
|
Moxa at support@moxa.com.tw.
|
36 |
|
|
|
37 |
|
|
In addition to device driver, useful utilities are also provided in this
|
38 |
|
|
version. They are
|
39 |
|
|
- msdiag Diagnostic program for detecting installed Moxa Smartio boards.
|
40 |
|
|
- msmon Monitor program to observe data count and line status signals.
|
41 |
|
|
- msterm A simple terminal program which is useful in testing serial
|
42 |
|
|
ports.
|
43 |
|
|
- io-irq.exe Configuration program to setup ISA boards. Please note that
|
44 |
|
|
this program can only be executed under DOS.
|
45 |
|
|
|
46 |
|
|
All the drivers and utilities are published in form of source code under
|
47 |
|
|
GNU General Public License in this version. Please refer to GNU General
|
48 |
|
|
Public License announcement in each source code file for more detail.
|
49 |
|
|
|
50 |
|
|
In Moxa's ftp sites, you may always find latest driver at
|
51 |
|
|
ftp://ftp.moxa.com or ftp://ftp.moxa.com.tw.
|
52 |
|
|
|
53 |
|
|
This version of driver can be installed as Loadable Module (Module driver)
|
54 |
|
|
or built-in into kernel (Static driver). You may refer to following
|
55 |
|
|
installation procedure for suitable one. Before you install the driver,
|
56 |
|
|
please refer to hardware installation procedure in the User's Manual.
|
57 |
|
|
|
58 |
|
|
We assume the user should be familiar with following documents.
|
59 |
|
|
- Serial-HOWTO
|
60 |
|
|
- Kernel-HOWTO
|
61 |
|
|
|
62 |
|
|
-----------------------------------------------------------------------------
|
63 |
|
|
2. System Requirement
|
64 |
|
|
- Hardware platform: Intel x86 or Alpha machine
|
65 |
|
|
- Kernel version: 2.0.3x or 2.2.x
|
66 |
|
|
- gcc version 2.72 or later
|
67 |
|
|
- Maximum 4 boards can be installed in combination
|
68 |
|
|
|
69 |
|
|
-----------------------------------------------------------------------------
|
70 |
|
|
3. Installation
|
71 |
|
|
|
72 |
|
|
3.1 Hardware installation
|
73 |
|
|
|
74 |
|
|
There are two types of buses, ISA and PCI, for Smartio family multiport
|
75 |
|
|
board.
|
76 |
|
|
|
77 |
|
|
ISA board
|
78 |
|
|
---------
|
79 |
|
|
You'll have to configure CAP address, I/O address, Interrupt Vector
|
80 |
|
|
as well as IRQ before installing this driver. Please refer to hardware
|
81 |
|
|
installation procedure in User's Manual before proceed any further.
|
82 |
|
|
Please make sure the JP1 is open after the ISA board is set properly.
|
83 |
|
|
|
84 |
|
|
PCI board
|
85 |
|
|
---------
|
86 |
|
|
You may need to adjust IRQ usage in BIOS to avoid from IRQ conflict
|
87 |
|
|
with other ISA devices. Please refer to hardware installation
|
88 |
|
|
procedure in User's Manual in advance.
|
89 |
|
|
|
90 |
|
|
IRQ Sharing
|
91 |
|
|
-----------
|
92 |
|
|
Each port within the same multiport board shares the same IRQ. Up to
|
93 |
|
|
4 Moxa Smartio Family multiport boards can be installed together on
|
94 |
|
|
one system and they can share the same IRQ.
|
95 |
|
|
|
96 |
|
|
3.2 Driver files and device naming convention
|
97 |
|
|
|
98 |
|
|
The driver file may be obtained from ftp, CD-ROM or floppy disk. The
|
99 |
|
|
first step, anyway, is to copy driver file "mxser.tgz" into specified
|
100 |
|
|
directory. e.g. /moxa. The execute commands as below.
|
101 |
|
|
|
102 |
|
|
# cd /moxa
|
103 |
|
|
# tar xvf /dev/fd0
|
104 |
|
|
or
|
105 |
|
|
# cd /moxa
|
106 |
|
|
# cp /mnt/cdrom//mxser.tgz .
|
107 |
|
|
# tar xvfz mxser.tgz
|
108 |
|
|
|
109 |
|
|
You may find all the driver and utilities files in /moxa/mxser.
|
110 |
|
|
Following installation procedure depends on the model you'd like to
|
111 |
|
|
run the driver. If you prefer module driver, please refer to 3.3.
|
112 |
|
|
If static driver is required, please refer to 3.4.
|
113 |
|
|
|
114 |
|
|
Dialin and callout port
|
115 |
|
|
-----------------------
|
116 |
|
|
This driver remains traditional serial device properties. There're
|
117 |
|
|
two special file name for each serial port. One is dial-in port
|
118 |
|
|
which is named "ttyMxx". For callout port, the naming convention
|
119 |
|
|
is "cumxx".
|
120 |
|
|
|
121 |
|
|
Device naming when more than 2 boards installed
|
122 |
|
|
-----------------------------------------------
|
123 |
|
|
Naming convention for each Smartio multiport board is pre-defined
|
124 |
|
|
as below.
|
125 |
|
|
|
126 |
|
|
Board Num. Dial-in Port Callout port
|
127 |
|
|
1st board ttyM0 - ttyM7 cum0 - cum7
|
128 |
|
|
2nd board ttyM8 - ttyM15 cum8 - cum15
|
129 |
|
|
3rd board ttyM16 - ttyM23 cum16 - cum23
|
130 |
|
|
4th board ttyM24 - ttym31 cum24 - cum31
|
131 |
|
|
|
132 |
|
|
Board sequence
|
133 |
|
|
--------------
|
134 |
|
|
This driver will activate ISA boards according to the parameter set
|
135 |
|
|
in the driver. After all specified ISA board activated, PCI board
|
136 |
|
|
will be installed in the system automatically driven.
|
137 |
|
|
Therefore the board number is sorted by the CAP address of ISA boards.
|
138 |
|
|
For PCI boards, their sequence will be after ISA boards and C168H/PCI
|
139 |
|
|
has higher priority than C104H/PCI boards.
|
140 |
|
|
|
141 |
|
|
3.3 Module driver configuration
|
142 |
|
|
Module driver is easiest way to install. If you prefer static driver
|
143 |
|
|
installation, please skip this paragraph.
|
144 |
|
|
1. Find "Makefile" in /moxa/mxser, then run
|
145 |
|
|
|
146 |
|
|
# make install
|
147 |
|
|
|
148 |
|
|
The driver files "mxser.o" and utilities will be properly compiled
|
149 |
|
|
and copied to system directories respectively.Then run
|
150 |
|
|
|
151 |
|
|
# insmod mxser
|
152 |
|
|
|
153 |
|
|
to activate the modular driver. You may run "lsmod" to check
|
154 |
|
|
if "mxser.o" is activated.
|
155 |
|
|
|
156 |
|
|
2. Create special files by executing "msmknod".
|
157 |
|
|
# cd /moxa/mxser/driver
|
158 |
|
|
# ./msmknod
|
159 |
|
|
|
160 |
|
|
Default major numbers for dial-in device and callout device are
|
161 |
|
|
174, 175. Msmknod will delete any special files occupying the same
|
162 |
|
|
device naming.
|
163 |
|
|
|
164 |
|
|
3. Up to now, you may manually execute "insmod mxser" to activate
|
165 |
|
|
this driver and run "rmmod mxser" to remove it. However, it's
|
166 |
|
|
better to have a boot time configuration to eliminate manual
|
167 |
|
|
operation.
|
168 |
|
|
Boot time configuration can be achieved by rc file. Run following
|
169 |
|
|
command for setting rc files.
|
170 |
|
|
|
171 |
|
|
# cd /moxa/mxser/driver
|
172 |
|
|
# cp ./rc.mxser /etc/rc.d
|
173 |
|
|
# cd /etc/rc.d
|
174 |
|
|
|
175 |
|
|
You may have to modify part of the content in rc.mxser to specify
|
176 |
|
|
parameters for ISA board. Please refer to rc.mxser for more detail.
|
177 |
|
|
Find "rc.serial". If "rc.serial" doesn't exist, create it by vi.
|
178 |
|
|
Add "rc.mxser" in last line. Next, open rc.local by vi
|
179 |
|
|
and append following content.
|
180 |
|
|
|
181 |
|
|
if [ -f /etc/rc.d/rc.serial ]; then
|
182 |
|
|
sh /etc/rc.d/rc.serial
|
183 |
|
|
fi
|
184 |
|
|
|
185 |
|
|
4. Reboot and check if mxser.o activated by "lsmod" command.
|
186 |
|
|
5. If you'd like to drive Smartio ISA boards in the system, you'll
|
187 |
|
|
have to add parameter to specify CAP address of given board while
|
188 |
|
|
activating "mxser.o". The format for parameters are as follows.
|
189 |
|
|
|
190 |
|
|
insmod mxser ioaddr=0x???,0x???,0x???,0x???
|
191 |
|
|
| | | |
|
192 |
|
|
| | | +- 4th ISA board
|
193 |
|
|
| | +------ 3rd ISA board
|
194 |
|
|
| +------------ 2nd ISA board
|
195 |
|
|
+------------------- 1st ISA board
|
196 |
|
|
|
197 |
|
|
3.4 Static driver configuration
|
198 |
|
|
|
199 |
|
|
1. Create link
|
200 |
|
|
# cd /usr/src/linux/drivers/char
|
201 |
|
|
# ln -s /moxa/mxser/driver/mxser.c mxser.c
|
202 |
|
|
|
203 |
|
|
2. Add CAP address list for ISA boards
|
204 |
|
|
In module mode, the CAP address for ISA board is given by
|
205 |
|
|
parameter. In static driver configuration, you'll have to
|
206 |
|
|
assign it within driver's source code. If you will not
|
207 |
|
|
install any ISA boards, you may skip to next portion.
|
208 |
|
|
The instructions to modify driver source code are as
|
209 |
|
|
below.
|
210 |
|
|
a. # cd /moxa/mxser/driver
|
211 |
|
|
# vi mxser.c
|
212 |
|
|
b. Find the array mxserBoardCAP[] as below.
|
213 |
|
|
|
214 |
|
|
static int mxserBoardCAP[]
|
215 |
|
|
= {0x00, 0x00, 0x00, 0x00};
|
216 |
|
|
|
217 |
|
|
c. Change the address within this array using vi. For
|
218 |
|
|
example, to driver 2 ISA boards with CAP address
|
219 |
|
|
0x280 and 0x180 as 1st and 2nd board. Just to change
|
220 |
|
|
the source code as follows.
|
221 |
|
|
|
222 |
|
|
static int mxserBoardCAP[]
|
223 |
|
|
= {0x280, 0x180, 0x00, 0x00};
|
224 |
|
|
|
225 |
|
|
3. Modify tty_io.c
|
226 |
|
|
# cd /usr/src/linux/drivers/char/
|
227 |
|
|
# vi tty_io.c
|
228 |
|
|
Find pty_init(), insert "mxser_init()" as
|
229 |
|
|
|
230 |
|
|
pty_init();
|
231 |
|
|
mxser_init();
|
232 |
|
|
|
233 |
|
|
4. Modify tty.h
|
234 |
|
|
# cd /usr/src/linux/include/linux
|
235 |
|
|
# vi tty.h
|
236 |
|
|
Find extern int tty_init(void), insert "mxser_init()" as
|
237 |
|
|
|
238 |
|
|
extern int tty_init(void);
|
239 |
|
|
extern int mxser_init(void);
|
240 |
|
|
|
241 |
|
|
5. Modify Makefile
|
242 |
|
|
# cd /usr/src/linux/drivers/char
|
243 |
|
|
# vi Makefile
|
244 |
|
|
Find L_OBJS := tty_io.o ...... random.o, add
|
245 |
|
|
"mxser.o" at last of this line as
|
246 |
|
|
L_OBJS := tty_io.o ....... mxser.o
|
247 |
|
|
|
248 |
|
|
6. Rebuild kernel
|
249 |
|
|
The following are for Linux kernel rebuilding,for your reference only.
|
250 |
|
|
For appropriate details, please refer to the Linux document.
|
251 |
|
|
|
252 |
|
|
If 'lilo' utility is installed, please use 'make zlilo' to rebuild
|
253 |
|
|
kernel. If 'lilo' is not installed, please follow the following steps.
|
254 |
|
|
|
255 |
|
|
a. cd /usr/src/linux
|
256 |
|
|
b. make clean /* take a few minutes */
|
257 |
|
|
c. make dep /* take a few minutes */
|
258 |
|
|
d. make bzImage /* take probably 10-20 minutes */
|
259 |
|
|
e. Backup original boot kernel. /* optional step */
|
260 |
|
|
f. cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz
|
261 |
|
|
g. Please make sure the boot kernel (vmlinuz) is in the
|
262 |
|
|
correct position. If you use 'lilo' utility, you should
|
263 |
|
|
check /etc/lilo.conf 'image' item specified the path
|
264 |
|
|
which is the 'vmlinuz' path, or you will load wrong
|
265 |
|
|
(or old) boot kernel image (vmlinuz).
|
266 |
|
|
h. chmod 400 /vmlinuz
|
267 |
|
|
i. lilo
|
268 |
|
|
j. rdev -R /vmlinuz 1
|
269 |
|
|
k. sync
|
270 |
|
|
|
271 |
|
|
Note that if the result of "make zImage" is ERROR, then you have to
|
272 |
|
|
go back to Linux configuration Setup. Type "make config" in directory
|
273 |
|
|
/usr/src/linux or "setup".
|
274 |
|
|
|
275 |
|
|
Since system include file, /usr/src/linux/include/linux/interrupt.h,
|
276 |
|
|
is modified each time the MOXA driver is installed, kernel rebuilding
|
277 |
|
|
is inevitable. And it takes about 10 to 20 minutes depends on the
|
278 |
|
|
machine.
|
279 |
|
|
|
280 |
|
|
7. Make utility
|
281 |
|
|
# cd /moxa/mxser/utility
|
282 |
|
|
# make install
|
283 |
|
|
|
284 |
|
|
8. Make special file
|
285 |
|
|
# cd /moxa/mxser/driver
|
286 |
|
|
# ./msmknod
|
287 |
|
|
|
288 |
|
|
9. Reboot
|
289 |
|
|
|
290 |
|
|
3.5 Custom configuration
|
291 |
|
|
Although this driver already provides you default configuration, you
|
292 |
|
|
still can change the device name and major number.The instruction to
|
293 |
|
|
change these parameters are shown as below.
|
294 |
|
|
|
295 |
|
|
Change Device name
|
296 |
|
|
------------------
|
297 |
|
|
If you'd like to use other device names instead of default naming
|
298 |
|
|
convention, all you have to do is to modify the internal code
|
299 |
|
|
within the shell script "msmknod". First, you have to open "msmknod"
|
300 |
|
|
by vi. Locate each line contains "ttyM" and "cum" and change them
|
301 |
|
|
to the device name you desired. "msmknod" creates the device names
|
302 |
|
|
you need next time executed.
|
303 |
|
|
|
304 |
|
|
Change Major number
|
305 |
|
|
-------------------
|
306 |
|
|
If major number 30 and 35 had been occupied, you may have to select
|
307 |
|
|
2 free major numbers for this driver. There are 3 steps to change
|
308 |
|
|
major numbers.
|
309 |
|
|
|
310 |
|
|
1. Find free major numbers
|
311 |
|
|
In /proc/devices, you may find all the major numbers occupied
|
312 |
|
|
in the system. Please select 2 major numbers that are available.
|
313 |
|
|
e.g. 40, 45.
|
314 |
|
|
2. Create special files
|
315 |
|
|
Run /moxa/mxser/driver/msmknod to create special files with
|
316 |
|
|
specified major numbers.
|
317 |
|
|
3. Modify driver with new major number
|
318 |
|
|
Run vi to open /moxa/mxser/driver/mxser.c. Locate the line
|
319 |
|
|
contains "MXSERMAJOR". Change the content as below.
|
320 |
|
|
#define MXSERMAJOR 40
|
321 |
|
|
#define MXSERCUMAJOR 45
|
322 |
|
|
4. Run # make install in /moxa/mxser/driver.
|
323 |
|
|
|
324 |
|
|
3.6 Verify driver installation
|
325 |
|
|
You may refer to /var/log/messages to check the latest status
|
326 |
|
|
log reported by this driver whenever it's activated.
|
327 |
|
|
-----------------------------------------------------------------------------
|
328 |
|
|
4. Utilities
|
329 |
|
|
There are 3 utilities contained in this driver. They are msdiag, msmon and
|
330 |
|
|
msterm. These 3 utilities are released in form of source code. They should
|
331 |
|
|
be compiled into executable file and copied into /usr/bin.
|
332 |
|
|
|
333 |
|
|
msdiag - Diagnostic
|
334 |
|
|
--------------------
|
335 |
|
|
This utility provides the function to detect what Moxa Smartio multiport
|
336 |
|
|
board exists in the system.
|
337 |
|
|
|
338 |
|
|
msmon - Port Monitoring
|
339 |
|
|
-----------------------
|
340 |
|
|
This utility gives the user a quick view about all the MOXA ports'
|
341 |
|
|
activities. One can easily learn each port's total received/transmitted
|
342 |
|
|
(Rx/Tx) character count since the time when the monitoring is started.
|
343 |
|
|
Rx/Tx throughputs per second are also reported in interval basis (e.g.
|
344 |
|
|
the last 5 seconds) and in average basis (since the time the monitoring
|
345 |
|
|
is started). You can reset all ports' count by key. <+> <->
|
346 |
|
|
(plus/minus) keys to change the displaying time interval. Press
|
347 |
|
|
on the port, that cursor stay, to view the port's communication
|
348 |
|
|
parameters, signal status, and input/output queue.
|
349 |
|
|
|
350 |
|
|
msterm - Terminal Emulation
|
351 |
|
|
---------------------------
|
352 |
|
|
This utility provides data sending and receiving ability of all tty ports,
|
353 |
|
|
especially for MOXA ports. It is quite useful for testing simple
|
354 |
|
|
application, for example, sending AT command to a modem connected to the
|
355 |
|
|
port or used as a terminal for login purpose. Note that this is only a
|
356 |
|
|
dumb terminal emulation without handling full screen operation.
|
357 |
|
|
-----------------------------------------------------------------------------
|
358 |
|
|
5. Setserial
|
359 |
|
|
|
360 |
|
|
Supported Setserial parameters are listed as below.
|
361 |
|
|
|
362 |
|
|
uart set UART type(16450-->disable FIFO, 16550A-->enable FIFO)
|
363 |
|
|
close_delay set the amount of time(in 1/100 of a second) that DTR
|
364 |
|
|
should be kept low while being closed.
|
365 |
|
|
closing_wait set the amount of time(in 1/100 of a second) that the
|
366 |
|
|
serial port should wait for data to be drained while
|
367 |
|
|
being closed, before the receiver is disable.
|
368 |
|
|
spd_hi Use 57.6kb when the application requests 38.4kb.
|
369 |
|
|
spd_vhi Use 115.2kb when the application requests 38.4kb.
|
370 |
|
|
spd_normal Use 38.4kb when the application requests 38.4kb.
|
371 |
|
|
|
372 |
|
|
-----------------------------------------------------------------------------
|
373 |
|
|
6. Troubleshooting
|
374 |
|
|
|
375 |
|
|
The boot time error messages and solutions are stated as clearly as
|
376 |
|
|
possible. If all the possible solutions fail, please contact our technical
|
377 |
|
|
support team to get more help.
|
378 |
|
|
|
379 |
|
|
Error msg: More than 4 Moxa Smartio family boards found. Fifth board and
|
380 |
|
|
after are ignored.
|
381 |
|
|
Solution:
|
382 |
|
|
To avoid this problem, please unplug fifth and after board, because Moxa
|
383 |
|
|
driver supports up to 4 boards.
|
384 |
|
|
|
385 |
|
|
Error msg: Request_irq fail, IRQ(?) may be conflict with another device.
|
386 |
|
|
Solution:
|
387 |
|
|
Other PCI or ISA devices occupy the assigned IRQ. If you are not sure
|
388 |
|
|
which device causes the situation,please check /proc/interrupts to find
|
389 |
|
|
free IRQ and simply change another free IRQ for Moxa board.
|
390 |
|
|
|
391 |
|
|
Error msg: Board #: C1xx Series(CAP=xxx) interrupt number invalid.
|
392 |
|
|
Solution:
|
393 |
|
|
Each port within the same multiport board shares the same IRQ. Please set
|
394 |
|
|
one IRQ (IRQ doesn't equal to zero) for one Moxa board.
|
395 |
|
|
|
396 |
|
|
Error msg: No interrupt vector be set for Moxa ISA board(CAP=xxx).
|
397 |
|
|
Solution:
|
398 |
|
|
Moxa ISA board needs an interrupt vector.Please refer to user's manual
|
399 |
|
|
"Hardware Installation" chapter to set interrupt vector.
|
400 |
|
|
|
401 |
|
|
Error msg: Couldn't install MOXA Smartio family driver!
|
402 |
|
|
Solution:
|
403 |
|
|
Load Moxa driver fail, the major number may conflict with other devices.
|
404 |
|
|
Please refer to previous section 3.5 to change a free major number for
|
405 |
|
|
Moxa driver.
|
406 |
|
|
|
407 |
|
|
Error msg: Couldn't install MOXA Smartio family callout driver!
|
408 |
|
|
Solution:
|
409 |
|
|
Load Moxa callout driver fail, the callout device major number may
|
410 |
|
|
conflict with other devices. Please refer to previous section 3.5 to
|
411 |
|
|
change a free callout device major number for Moxa driver.
|
412 |
|
|
-----------------------------------------------------------------------------
|