User's Manual

User's Manual

Advantech Automation Corporation Advantech Device Driver for Linux User's manual Version <2.6> Linux driver development Version: <2.4> User’s Manual Date: 3/16/2005 Edwin Revision History Date Version Description Author 10/28/2002 <1.0> Initial version Bai jingang 11/6/2002 <1.5> Update from original comedi manual Edwin 11/14/2002 <2.0> Modified with xinyong Edwin 12/09/2002 <2.0.1> Add supported cards table Changping 2003/5/1 <2.1> Add pci1784, modify installation Edwin instructions 2003/5/20 <2.2> United Linux testing Edwin du 2004/1/7 <2.3> Add pcm3730, add insn convention and Eddy Yang special hint of pcm3730 7/15/2004 <2.4> Update supported cards table Derek Zhang 10/22/2004 <2.5> Modify some inaccurate description Derek Zhang 03/16/2005 <2.6> Add pci1724 and pci1758 Derek Zhang Modify description of comedilib install Confidential ÓAdvantech Automation Corporation, 2001 Page 2 of 41 Linux driver development Version: <2.4> User’s Manual Date: 3/16/2005 Edwin Table of Contents 1. Introduction 4 1.1 Features 4 1.2 Definitions, Acronyms and Abbreviations 4 1.3 Overview 4 1.4 References 5 2. Comedi installation instructions 6 2.1 Comedi-0.7.60 installation 6 2.1.1 Patch for comedi after installing comedi package 6 2.1.2 Linux source: 7 2.1.3 RTAI support: 10 2.1.4 RTLinux support: 10 2.1.5 Configuration: 10 2.1.6 Compiling: 11 2.1.7 Installation: 11 2.1.8 Module Autoloading: 11 2.1.9 Upgrading: 11 2.1.10 Un-installation 12 2.1.11 Hack 12 2.2 Comedilib-0.7.19 installation 12 3. Package configuration 13 3.1 The existent drivers 13 3.2 Adding driver to original comedi 13 3.3 Running Comedi: 14 3.4 Multi cards co-existence 15 4. Programming with comedi 15 4.1 Relationship between user program and device driver 15 4.2 Call flow of user’s program 16 4.3 Subdevice 16 4.4 Subdevice operator mode 17 4.4.1 Directory data read and write mode: 17 4.4.2 Trigger mode 18 4.4.3 Command mode 24 4.4.4 insn mode 32 4.5 Advantech test example manuals 36 5. comedilib functions description 36 5.1 Device file operation function 36 5.2 Subdevice operation function 37 5.3 Driver information acquirement 38 5.4 Data acquisition funcion 39 Confidential ÓAdvantech Automation Corporation, 2001 Page 3 of 41 Linux driver development Version: <2.4> User’s Manual Date: 3/16/2005 Edwin User’s Manual 1. Introduction Drivers for Advantech data acquisition boards and motion control cards for Linux are developed on COMEDI (Linux Control & Measurement Device Interface). The COMEDI project develops open-source drivers, tools, and libraries for data acquisition. COMEDI is a collection of drivers for a variety of common data acquisition plug-in boards. The drivers are implemented as a core Linux kernel module providing common functionality and individual low-level driver modules. COMEDILIB is a user-space library that provides a developer-friendly interface to comedi devices. Included in the comedilib distribution is documentation, configuration and calibration utilities, and demonstration programs. This document describes usage of Advantech Linux drivers with COMEDI in general. Information on specific production please refer to the heading remarks in the driver’s source code. 1.1 Features Integrated real-time support for most hardware High-level library (comedilib) Application-level device independence Driver has been tested with Linux kernel for RedHat8(kernel2.4.18) and RedHat9(kernel2.4.20) Drivers released together with comedi-0.7.60 and comedilib-0.7.19(for RedHat8) or comedilib-0.7.20(for RedHat9). 1.2 Definitions, Acronyms and Abbreviations Definition Explain COMEDI Linux Control & Measurement Device Interface AI Analog input AO Analog output DI Digital input DO Digital output insn Instruction mode I/O cmd Command mode I/O 1.3 Overview Comedi is a collection of Advantech drivers for data acquisition hardware. These drivers work with Linux, and also with Linux combined with the real-time extensions RTAI and RTLinux. The Comedi core, which ties all the drivers together, allows applications to be written that are completely hardware independent. The distribution of Advantech Linux driver has the following structures: Confidential ÓAdvantech Automation Corporation, 2001 Page 4 of 41 Linux driver development Version: <2.4> User’s Manual Date: 3/16/2005 Edwin Ø Comedi-0.7.60.tar.gz This distribution contains just the Comedi kernel modules. More information please refer to comedi-0.7.60/README. Following is the structure of comedi-0.7.60: └─comedi-0.7.60 main COMEDI dir ├─Documentation documentations about install, configure and develop. │ └─comedi │ └─notes ├─comedi working dir. │ ├─drivers drivers, including source code and .o files. │ └─kcomedilib kernel space library ├─debian ├─include .h files that COMEDI driver needs. │ ├─asm │ └─linux ├─patches ├─rpm └─scripts ├─linux_flags └─lxdialog Ø Comedilib-0.7.19.tgz This distribution contains only the user-space library for redhat8 release version. More information please refer to comedilib-0.7.19/README. Ø Comedilib-0.7.20.tar.gz This distribution contains only the user-space library for redhat9 release version. More information please refer to comedilib-0.7.20/README Ø Test.tar.gz This distribution contains testing cases on the driver. 1.4 References - COMEDI Official web site: http://stm.lbl.gov/comedi or http://www.comedi.org/ - The IO-Port Programming Mini HOWTO: http://www.linuxdoc.org/HOWTO/mini/IO-Port-Programming.html Confidential ÓAdvantech Automation Corporation, 2001 Page 5 of 41 Linux driver development Version: <2.4> User’s Manual Date: 3/16/2005 Edwin - Linux Kernel Module Programming Guide http://www.linuxdoc.org/LDP/lkmpg/mpg.html - Kernel Hacker's Guide http://www.linuxdoc.org/LDP/khg/HyperNews/get/khg.html - Linux Device Drivers, 2nd Edition http://www.xml.com/ldd/chapter/book/index.html - RTAI web site http://www.rtai.org/ or http://www.aero.polimi.it/~rtai/ 2. Comedi installation instructions 2.1 Comedi-0.7.60 installation 2.1.1 Patch for comedi after installing comedi package When using comedi in RedHat9 or compiling with gcc 3.x.x , you should patch comedi package. Patching process as follow: 1) decompressing file patch.tgz # tar xvfz patch.tgz; The directory construction is: +patch | +--comedi-0.7.60-gcc3.patch :patch file for gcc3 problem | +--comedi-0.7.60-redhat9.patch :patch file for redhat9 problem | +--README :readme file 2) patch for gcc3.x.x If your OS (such as Redhat 8.0, 9.0 and Fedora) uses gcc3xx compiler, this patch file is needed. Patch comedi package with the following commands. # ls comedi-0.7.60/ patch/ # cd comedi-0.7.60/ # patch -p1 < ../patch/comedi-0.7.60-gcc3.patch 3) patch for redhat 9 If your OS is Redhat 9.0 with its original kernel, this patch file is needed. Patch comedi package with the following commands. # ls comedi-0.7.60/ patch/ Confidential ÓAdvantech Automation Corporation, 2001 Page 6 of 41 Linux driver development Version: <2.4> User’s Manual Date: 3/16/2005 Edwin # cd comedi-0.7.60/ # patch -p1 < ../patch/comedi-0.7.60-redhat9.patch More detail please README file 2.1.2 Linux source: In order to compile the Comedi modules, you will need to have a correctly configured Linux kernel source tree. The best way to get one is to download a tarball from kernel.org and compile your own kernel. Comedi should work with most 2.2 and 2.4 Linux kernels. Support for 2.0.3x is not actively maintained, but it should work and bugs will be fixed as they are reported. The following steps will (almost) set up your kernel sources correctly. You will also need write permission to the kernel source directory the first time you run comedi's 'make config', so you might want to unpack the kernel source into a directory you own. There are two ways to prepare Linux kernel source. One is a standard way that we strongly recommend to, which is to download a standard Linux kernel and configure it. The other way informs you the way to configure kernels in some popular Linux release, such as RedHat, Debian, Mandrake, etc. 2.1.2.1 General setup We strongly recommend to use a standard Linux kernel distributed by http://www.kernel.org , this section describes the most common steps to setup the kernel. This operation is independent to Linux releases. Read the instructions if you have problem compiling the kernels: http://www.tldp.org/HOWTO/Kernel-HOWTO/. 1) Get a copy of the kernel source that matches the kernel you are running. Download a kernel from http://www.kernel.org or from a mirror site nearby. The compressed tar archive in this directory can be downloaded using a web browser or a command- line program such as wget: #wget --no-directories --retr-symlinks http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.x.x.tar.gz 2) Copy the package into a directory that you have writes permission and unpack kernel: #cp linux-2.x.x.tar.gz /usr/src #cd /usr/src/ #tar –jxvf linux-2.x.x.tar.bz2 (This command is for .bz2 kernel) #tar –zxvf linux-2.x.x.tar.gz (This command is for .gz kernel) 3) Configure your kernel: Change into your kernel source directory. #cd linux-2.x.x #make menuconfig Then you would be provided with a graphic user interface to configure your kernel.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    41 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us