moxa-smartio 16 KB

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