TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier

Similar documents
TIP610-SW-95 QNX-Neutrino Device Driver TIP610 16/20 Channel Digital I/O on SBS PCI40 Carrier

TPMC901-SW-95. QNX4 - Neutrino Device Driver. User Manual. The Embedded I/O Company. 6/4/2 Channel Extended CAN-Bus PMC

TIP670-SW-95. QNX-Neutrino Device Driver. User Manual. The Embedded I/O Company. Digital I/O. Version 1.0.x. Issue August 2008.

TDRV010-SW-95. QNX6 - Neutrino Device Driver. Isolated 2x CAN Bus. Version 1.0.x. User Manual. Issue September 2016

The Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC

TIP675-SW-82. Linux Device Driver. 48 TTL I/O Lines with Interrupts Version 1.2.x. User Manual. Issue November 2013

TIP114-SW-72. LynxOS Device Driver. User Manual. The Embedded I/O Company. 10 Channel Absolute Encoder Interface (SSI) Version 1.0.

TPMC500-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. 32 Channel 12 Bit ADC. Version 2.0.x. Issue 2.0.

TIP120-SW-42. VxWorks Device Driver. Motion Controller with Incremental Encoder Interface. Version 2.1.x. User Manual. Issue 2.1.

TIP700-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. Digital Output 24V DC. Version 2.0.x. Issue June 2008.

TPMC550-SW-12 OS-9 for PPC Device Driver 8 (4) Channels Isolated 12-bit D/A

CARRIER-SW-82. Linux Device Driver. IPAC Carrier Version 2.2.x. User Manual. Issue November 2017

TPMC821-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. INTERBUS Master G4 PMC. Version 1.4. Issue 1.

TIP866-SW-95. QNX-Neutrino Device Driver. 8 Channel Serial Interface IP. Version 2.1.x. User Manual. Issue October 2009

TPMC860-SW-82. Linux Device Driver. 4 Channel Isolated Serial Interface RS232 Version 1.4.x. User Manual. Issue 1.4.

TDRV006-SW-42. VxWorks Device Driver. 64 Digital Inputs/Outputs (Bit I/O) Version 4.0.x. User Manual. Issue December 2017

TPMC815-SW-72. LynxOS Device Driver. User Manual. The Embedded I/O Company. ARCNET Controller. Version 1.0.x. Issue 1.0 May 2004

TDRV011-SW-82. Linux Device Driver. Extended CAN Bus Version 1.0.x. User Manual. Issue April 2018

TPMC680-SW-82. Linux Device Driver. 64 Digital Input/Output Version 1.1.x. User Manual. Issue April 2010

TPMC851-SW-42. VxWorks Device Driver. Multifunction I/O (16 bit ADC/DAC, TTL I/O, Counter) Version 2.0.x. User Manual. Issue 2.0.

TPMC868-SW-42. VxWorks Device Driver. 16 Channel Serial PMC. Version 2.1.x. User Manual. Issue December 2011

Operating Systems. Lecture 06. System Calls (Exec, Open, Read, Write) Inter-process Communication in Unix/Linux (PIPE), Use of PIPE on command line

TPMC917-SW-82. Linux Device Driver. User Manual. The Embedded I/O Company. 4 MB SRAM with Battery Backup and 4 Channel Serial Interface Version 1.0.

CARRIER-SW-42. VxWorks Device Driver. IPAC Carrier. Version 4.2.x. User Manual. Issue July 2018

TIP550. Optically Isolated 8/4 Channel 12-bit D/A. Version 1.2. User Manual. Issue October 2009

TDRV009-SW-95. QNX6 - Neutrino Device Driver. User Manual. The Embedded I/O Company. High Speed Sync/Async Serial Interface Version 1.0.

TPMC810-SW-82. Linux Device Driver. User Manual. The Embedded I/O Company. Isolated 2x CAN Bus Version 1.2.x. Issue 1.2.

TCP866-SW-82. Linux Device Driver. User Manual. The Embedded I/O Company. 8 Channel Serial PMC Version 1.0.x. Issue 1.

TIP111. Motion Controller with Absolute Encoder Interface (SSI) User Manual. The Embedded I/O Company. Version 1.1. Issue 1.4 September 2005 D

Lecture files in /home/hwang/cs375/lecture05 on csserver.

TDRV009-SW-95. QNX6 - Neutrino Device Driver. High Speed Sync/Async Serial Interface Version 1.0.x. User Manual. Issue 1.0.

TDRV002-SW-82. Linux Device Driver. Multi-Channel Serial Interface Version 1.8.x. User Manual. Issue November 2017

Experiment 6 The Real World Interface

Lecture 3. Introduction to Unix Systems Programming: Unix File I/O System Calls

Files. Eric McCreath

OPTO32A 24 Input Bit, 8 Output Bit Optical Isolator Board

CS240: Programming in C

TPCE260. PCI Express PMC Carrier. Version 1.0. User Manual. Issue August 2014

TIP120. Motion Controller with Incremental Encoder Interface. Version 1.0. User Manual. Issue August 2014

UNIX System Calls. Sys Calls versus Library Func

Last Week: ! Efficiency read/write. ! The File. ! File pointer. ! File control/access. This Week: ! How to program with directories

TIP Digital Inputs Optically Isolated Version 1.0 Revision A. User Manual. Issue May 1997 D

TPMC Channel Motion Control. User Manual. The Embedded I/O Company. Version 1.0. Issue 1.3 March 2003 D

Advcan QNX Driver User Manual V1.02

TIP SERCOS IP with 2 Encoder Interfaces. User Manual. The Embedded I/O Company. Version 1.0. Issue 1.3 September 2006 D

DYNAMIC ENGINEERING 150 DuBois Suite C Santa Cruz, CA (831) Fax (831) Est.

TPMC815 ARCNET PMC. User Manual. The Embedded I/O Company. Version 2.0. Issue 1.2 November 2002 D

TIP815. ARCNET Controller. Version 1.0. User Manual. Issue September 2009

Shared Memory Memory mapped files

TXMC885. Four Channel 10/100/1000 Mbit/s Ethernet Adapter. Version 1.0. User Manual. Issue October 2011

CSC 271 Software I: Utilities and Internals

I/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo

TCP Channel Serial Interface RS232 / RS422 cpci Module. User Manual. The Embedded I/O Company. Version 1.0. Issue 1.

Operating systems. Lecture 7

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

TPMC Channel Isolated Serial Interface RS422/RS485. Version 1.0. User Manual. Issue July 2009

TPMC500. Optically Isolated 32 Channel 12 Bit ADC. Version 1.1. User Manual. Issue January 2014

I/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo

TPMC310. Conduction Cooled PMC Isolated 2 x CAN Bus. Version 1.1. User Manual. Issue June 2014

TPMC816. Two Independent Channels Extended CAN Bus PMC Module. Version 2.2. User Manual. Issue August 2014

CSE 333 SECTION 3. POSIX I/O Functions

System Calls and I/O Appendix. Copyright : University of Illinois CS 241 Staff 1

Processes often need to communicate. CSCB09: Software Tools and Systems Programming. Solution: Pipes. Recall: I/O mechanisms in C

COSC Operating Systems Design, Fall Lecture Note: Unnamed Pipe and Shared Memory. Unnamed Pipes

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2

Socket programming in C

Preview. System Call. System Call. System Call. System Call. Library Functions 9/20/2018. System Call

CSE 410: Systems Programming

Section 3: File I/O, JSON, Generics. Meghan Cowan

libnetfilter_log Reference Manual

TPMC x ADC, 16x/0x DAC and 8x Digital I/O. Version 1.0. User Manual. Issue May 2018

spwr_base & spwr_chan

TPMC Channel Isolated Serial Interface RS232. Version 1.0. User Manual. Issue August 2017

ECEN 449 Microprocessor System Design. Review of C Programming. Texas A&M University

24DSI32 24DSI12 24-bit, 32 Channel Delta-Sigma A/D Boards

POSIX Shared Memory. Linux/UNIX IPC Programming. Outline. Michael Kerrisk, man7.org c 2017 November 2017

DYNAMIC ENGINEERING 150 DuBois St. Suite C, Santa Cruz, CA Fax Est.

File Descriptors and Piping

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

CS , Spring Sample Exam 3

CSE 333 SECTION 3. POSIX I/O Functions

TPMC Digital Inputs/Outputs (Bit I/O) Version 2.0. User Manual. Issue February 2014

Artisan Technology Group is your source for quality new and certified-used/pre-owned equipment

CMPS 105 Systems Programming. Prof. Darrell Long E2.371

we are here I/O & Storage Layers Recall: C Low level I/O Recall: C Low Level Operations CS162 Operating Systems and Systems Programming Lecture 18

Intel Embedded System Design Contest

TPMC /8 Digital Inputs (24V) 16/8 Digital Outputs (24V, 0.5A) Version 3.0. User Manual. Issue June 2014

ICS-121. VxWORKS DEVICE DRIVER MANUAL

ECEN 449 Microprocessor System Design. Review of C Programming

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O

Lecture 21 Systems Programming in C

Hyo-bong Son Computer Systems Laboratory Sungkyunkwan University

Systems Programming. COSC Software Tools. Systems Programming. High-Level vs. Low-Level. High-Level vs. Low-Level.

DYNAMIC ENGINEERING 150 DuBois, Suite C Santa Cruz, CA (831) Fax (831) Est

Preview. Interprocess Communication with Pipe. Pipe from the Parent to the child Pipe from the child to the parent FIFO popen() with r Popen() with w

PRACTICAL NO : 1. AIM: To study various file management system calls in UNIX.

Developer s Guide. BlackBerry. Address Book API. Version 2.0

DYNAMIC ENGINEERING 150 DuBois St., Suite C Santa Cruz, CA Fax Est.

Process Creation in UNIX

TPMC Channel Serial Interface RS232/RS422. Version 1.0. User Manual. Issue August 2014

Transcription:

TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier Version 1.0.x Reference Manual Issue 1.0 January 2002 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 D-25469 Halstenbek Germany Tel.: +49 (0)4101 4058-0 Fax.: +49 (0)4101 4058-19 http://www.tews.com e-mail: info@tews.com

TIP570-SW-95 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC QNX-Neutrino Device Driver This document contains information, which is proprietary to TEWS TECHNOLOGIES. Any reproduction without written permission is forbidden. TEWS TECHNOLOGIES has made any effort to ensure that this manual is accurate and complete. However TEWS TECHNOLOGIES reserves the right to change the product described in this document at any time without notice. This product has been designed to operate with IndustryPack compatible carriers. Connection to incompatible hardware is likely to cause serious damage. TEWS TECHNOLOGIES is not liable for any damage arising out of the application or use of the device described herein. IndustryPack is a registered trademark of GreenSpring Computers, Inc 2002 by TEWS TECHNOLOGIES GmbH Issue Description Date 1.0 First Issue 21. January 2002 TIP570-SW-92 QNX4 Device Driver page 2

Table of Contents 1 INTRODUCTION... 4 2 INSTALLATION... 5 2.1 Build the device driver... 5 2.2 Build the example application... 5 2.3 Build the carrier board initialization example... 5 2.4 Start the driver process... 6 3 DEVICE INPUT/OUTPUT FUNCTIONS... 7 3.1 open()... 7 3.2 close()... 8 3.3 devctl()... 9 3.3.1 DCMD_T570_READ... 11 3.3.2 DCMD_T570_WRITE... 13 3.3.3 DCMD_T570_PARAM... 15 TIP570-SW-95 QNX-Neutrino Device Driver page 3

1 Introduction The TIP570-SW-95 QNX-Neutrino device driver allows the operation of a TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC IP on QNX-Neutrino operating systems. The TIP570 device driver is basically implemented as a user installable Resource Manager. The standard file (I/O) functions (open, close and devctl) provide the basic interface for opening and closing a file descriptor and for performing device I/O and control operations. Supported features:! Read ADC value from specified input Channel! Write DAC value to output Channel! Read module parameter! Use factory programmed correction data for ADC and DAC correction This driver will need a initializing of the carrier board, (e.g. SBS-PCI40). This driver should also announce the physical base addresses of the IP-slots. An example using the SBS-PCI40 is attached to the driver. This initialization software must be run before the driver is started. TIP570-SW-95 QNX-Neutrino Device Driver page 4

2 Installation The software is delivered on a PC formatted 3½" HD diskette. Following driver specific files are located on the diskette: /driver/tip570.c /driver/tip570.h /driver/tip570def.h /driver/node.h /driver/node.c /example/example.c /pci40/* TIP570-SW-95.pdf Driver source code Driver interface definitions and data structures Device driver include Queue management definitions Queue management source code Example application SBS-PCI40 installation example This manual in PDF format For installation create a new directory (e.g.../tip570) in the /usr/src directory and copy the complete /driver and /example directories (with sub-directories and all files) from the distribution diskette into the new created project directory. Note It s absolute important to create the tip570 project directory in the /usr/src directory otherwise the automatic build with make will fail. 2.1 Build the device driver 1. Change to the /usr/src/tip570/driver directory 2. Execute the Makefile # make install After successful completion the driver binary will be installed in the /bin directory. 2.2 Build the example application 1. Change to the /usr/src/tip570/example directory 2. Execute the Makefile # make install After successful completion the example binary (t570exam) will be installed in the /bin directory. 2.3 Build the carrier board initialization example 1. Change to the /usr/src/pci40 directory 2. Execute the Makefile # make install After successful completion the example binary (pci40) will be installed in the /bin directory. TIP570-SW-95 QNX-Neutrino Device Driver page 5

2.4 Start the driver process The carrier board initialization must be called before the driver is started. For example call the SBS-PCI40 initialization. pci40 This initialization will printout the base addresses of I/O-, memory space and interrupt vector for each IP-slot. To start the TIP570 device driver respective the TIP570 resource manager you have to enter the process name with optional parameter from the command shell or in the startup script. tip570 A<IOaddress> & This will start the TIP570 resource manager with one module mounted at the specified <IOaddress>. (The address depends on the system, this address is printed out by the SBS-PCI40 initialization example). For starting the TIP570 resource manager with more than one module, you have simply to add the additional IO-addresses behind the A flag. tip570 A<IOaddress_0>,<IOaddress_1>,,<IOaddress_n> & The TIP570 Resource Manager registers created devices in the Neutrinos pathname space under following names. /dev/tip570_0 /dev/tip570_1 /dev/tip570_x This pathname must be used in the application program to open a path to the desired TIP570 device. fd = open( /dev/tip570_0, O_RDWR); For debugging you can start the TIP570 Resource Manager with the v option. Now the Resource Manager will print versatile information about TIP570 configuration and command execution on the terminal window. tip570 v A<IOaddress> & TIP570-SW-95 QNX-Neutrino Device Driver page 6

3 Device Input/Output functions This chapter describes the interface to the device driver I/O system. 3.1 open() NAME open() - open a file descriptor SYNOPSIS #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int open (const char *pathname, int flags) DESCRIPTION The open function creates and returns a new file descriptor for the TIP570 named by pathname. The flags argument controls how the file is to be opened. TIP570 devices must be opened O_RDWR. EXAMPLE int fd; fd = open( /dev/tip570_0, O_RDWR); RETURNS ERRORS The normal return value from open is a non-negative integer file descriptor. In the case of an error, a value of 1 is returned. The global variable errno contains the detailed error code. Returns only Neutrino specific error codes, see Neutrino Library Reference. SEE ALSO Library Reference - open() TIP570-SW-95 QNX-Neutrino Device Driver page 7

3.2 close() NAME close() close a file descriptor SYNOPSIS #include <unistd.h> int close (int filedes) DESCRIPTION The close function closes the file descriptor filedes. EXAMPLE int fd; if (close(fd)!= 0) { /* handle close error conditions */ } RETURNS ERRORS The normal return value from close is 0. In the case of an error, a value of 1 is returned. The global variable errno contains the detailed error code. Returns only Neutrino specific error code, see Neutrino Library Reference. SEE ALSO Library Reference - close() TIP570-SW-95 QNX-Neutrino Device Driver page 8

3.3 devctl() NAME devctl() device control functions SYNOPSIS #include <sys/types.h> #include <unistd.h> #include <devctl.h> int devctl( int filedes, int dcmd, void * data_ptr, size_t n_bytes, int * dev_info_ptr ); DESCRIPTION The devctl function sends a control code directly to a device, specified by filedes, causing the corresponding device to perform the requested operation. The argument dcmd specifies the control code for the operation. The arguments data_ptr and n_bytes depends on the command and will be described for each command in detail later in this chapter. Usually data_ptr points to a buffer that passes data between the user task and the driver and n_bytes defines the size of this buffer. The argument dev_info_ptr is unused for the TIP570 driver and should be set to NULL. The following devctl command codes are defined in TIP570.h : Value DCMD_T570_READ DCMD_T570_WRITE DCMD_T570_PARAM Meaning Read ADC Input Channel Write DAC Output Value Read Module Parameters See behind for more detailed information on each control code. Note To use these TIP570 specific control codes the header file TIP570.h must be included in the application RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). TIP570-SW-95 QNX-Neutrino Device Driver page 9

ERRORS ENOTTY Inappropriate I/O control operation. This error code is returned if the requested devctl function is unknown. Please check the argument dcmd. Other function dependant error codes will be described for each devoctl code separately. Note, the TIP570 driver always returns standard QNX error codes. SEE ALSO Library Reference - devctl() TIP570-SW-95 QNX-Neutrino Device Driver page 10

3.3.1 DCMD_T570_READ NAME DCMD_T570_READ - Read from ADC Input Channel DESCRIPTION This devctl function reads the actual value of the specified input channel. A pointer to the callers read buffer (T570_READ_BUF) and the size of this structure is passed by the parameters data_ptr and n_bytes to the device. The T570_READ_BUF structure has the following layout: typedef struct { /* INPUT: */ unsigned long channel; /* channel number: Sngl:1-16 or Diff:1-8 */ unsigned long flags; /* TIP570_FL_CORR TIP570_FL_DIFF */ unsigned long gain; /* TIP570_GAINx */ /* OUTPUT: */ int data; /* returned ADC value */ } T570_READ_BUF, *PT570_READ_BUF; channel Specifies the ADC input channel. If single-ended mode is used, channel numbers between 1 and 16 are allowed. If differential mode is used the channel number must be between 1 and 8. flags This argument specifies special options and the predefined values can be ORed. TIP570_FL_CORR Enable data correction TIP570_FL_DIFF Select differential input gain This argument specifies the input gain. The following table shows the allowed values. TIP570_GAIN1 Input gain is 1 TIP570_GAIN2 Input gain is 2 TIP570_GAIN5 Input gain is 5 TIP570_GAIN10 Input gain is 10 data This value will be filled with the actual input value. The value will be between 2048 and 2047. TIP570-SW-95 QNX-Neutrino Device Driver page 11

EXAMPLE int int T570_READ_BUF fd; result; ReadBuf; /* Read ADC channel 1, gain=5, with corrected data */ ReadBuf.channel = 1; ReadBuf.flags = TIP570_FL_CORR; ReadBuf.gain = TIP570_GAIN5; result = devctl (fd, DCMD_T570_READ, &ReadBuf, sizeof(readbuf), NULL); if (result == EOK) { /* ADC channel read successful */ } ERRORS EINVAL ETIMEDOUT Invalid argument. This error code is returned if either the size of the message buffer is too small, or the specified receive queue is out of range. The conversion timed out, check the hardware. SEE ALSO Library Reference - devctl() TIP570-SW-95 QNX-Neutrino Device Driver page 12

3.3.2 DCMD_T570_WRITE NAME DCMD_T570_WRITE - Write to DAC Channel DESCRIPTION This devctl function writes a specified value to the specified output channel. A pointer to the callers write buffer (T570_WRITE_BUF) and the size of this structure is passed by the parameters data_ptr and n_bytes to the device. The T570_WRITE_BUF structure has the following layout: typedef struct { /* INPUT: */ unsigned long channel; /* channel number: Sngl:1-16 or Diff:1-8 */ unsigned long flags; /* TIP570_FL_CORR */ /* TIP570_FL_LATCH */ /* TIP570_FL_LATCHCONV */ int data; /* new DAC value */ } T570_WRITE_BUF, *PT570_WRITE_BUF; channel Specifies the DAC output channel. The channel number must be between 1 and 8. flags This argument specifies special options and the predefined values can be ORed. TIP570_FL_CORR Enable data correction TIP570_FL_LATCH Write data in latch mode, do not output the value before TIP570_FL_LATCHCONV is specified. TIP570_FL_LATCHCONV Write data in latched mode, output all channels. data This value specifies the new output value. The value must be between 2048 and 2047. TIP570-SW-95 QNX-Neutrino Device Driver page 13

EXAMPLE int int T570_WRITE_BUF fd; result; WriteBuf; /* Write 0x123 to DAC channel 1, with corrected data */ WriteBuf.channel = 1; WriteBuf.flags = TIP570_FL_CORR; WriteBuf.data = 0x123; result = devctl (fd, DCMD_T570_WRITE, &WriteBuf, sizeof(writebuf), NULL); if (result == EOK) { /* DAC channel write successful */ } ERRORS EINVAL ETIMEDOUT Invalid argument. This error code is returned if either the size of the message buffer is too small, or the specified receive queue is out of range. The conversion timed out, check the hardware. SEE ALSO Library Reference - devctl() TIP570-SW-95 QNX-Neutrino Device Driver page 14

3.3.3 DCMD_T570_PARAM NAME DCMD_T570_PARAM - Read from module parameter DESCRIPTION This devctl function reads the actual value the specified input channel. A pointer to the callers parameter buffer (T570_PARAM_BUF) and the size of this structure is passed by the parameters data_ptr and n_bytes to the device. The T570_PARAM_BUF structure has the following layout: typedef struct { /* OUTPUT: */ unsigned long modeltype; /* returns modeltype (TIP570-xx) */ int ADC_offset_corr[4]; /* ADC offset correction data */ int ADC_gain_corr[4]; /* ADC gain correction data */ int DAC_offset_corr[8]; /* DAC offset correction data */ int DAC_gain_corr[8]; /* DAC gain correction data */ } T570_PARAM_BUF, *PT570_PARAM_BUF; modeltype This argument returns the model type of the TIP570. ADC_offset_corr[] ADC_gain_corr[] These arrays return the correction data of the TIP570 for input. These values will be used by the driver if data correction is enabled for the read function. DAC_offset_corr[] DAC_gain_corr[] These arrays return the correction data of the TIP570 for output. These values will be used by the driver if data correction is enabled for the write function. TIP570-SW-95 QNX-Neutrino Device Driver page 15

EXAMPLE int int T570_PARAM_BUF fd; result; ParamBuf; /* Read module parameters */ result = devctl (fd, DCMD_T570_PARAM, &ParamBuf, sizeof(parambuf), NULL); if (result == EOK) { /* Parameter read successful */ } ERRORS EINVAL Invalid argument. This error code is returned if either the size of the message buffer is too small, or the specified receive queue is out of range. SEE ALSO Library Reference - devctl() TIP570-SW-95 QNX-Neutrino Device Driver page 16