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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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

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.

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

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

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

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

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

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

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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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

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

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

OPTO32A 24 Input Bit, 8 Output Bit Optical Isolator Board

M O T O R O L A C O M P U T E R G R O U P VME DRIVER FOR LINUX USER GUIDE

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

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

Files. Eric McCreath

ICS-121. VxWORKS DEVICE DRIVER MANUAL

libnetfilter_log Reference Manual

TPMC810. Isolated 2x CAN Bus. Version 1.1. User Manual. Issue June 2009

UNIX System Calls. Sys Calls versus Library Func

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

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

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

CS240: Programming in C

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

Experiment 6 The Real World Interface

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

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

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

libquadflash API 1 General Operations

QNX Software Development Platform 6.6. OpenWF Display Configuration Developer's Guide: Modifying the Wfdcfg library

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

MaRTE OS Misc utilities

Operating systems. Lecture 7

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

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

File Descriptors and Piping

NAME attr extended attributes on XFS filesystem objects. SYNOPSIS attr [ LRq ] s attrname [ V attrvalue ] pathname

CSE 410: Systems Programming

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

QNX Momentics DDK. Input Devices. For targets running QNX Neutrino or later. 2004, QNX Software Systems Ltd.

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

DRIVER AND LIBRARY FOR DB67 DSP BOARD DRIVER AND LIBRARY FOR DB67 DSP BOARD

Communication. Serial port programming

PRODUCT OVERVIEW ISSUE 4

CS 3013 Operating Systems WPI, A Term Assigned: Friday, August 31, 2007 Due: Monday, September 17, 2007

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

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

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

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

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

User Manual SUSI 4.0. Secured & Unified Smart Interface Software APIs

spwr_base & spwr_chan

Software API Library. User s Manual V1.3

More on C programming

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

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

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

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

#define PERLIO_NOT_STDIO 0 /* For co-existence with stdio only */ #include <perlio.h> /* Usually via #include <perl.h> */

Pci3Ip, Pci5Ip, Pc104pIp, Pc104p4Ip, cpci2ip, cpci4ip and PcieCar IndustryPack Carrier Device Drivers

Upgrading Software to SynqNet Phase II

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:

What Is Operating System? Operating Systems, System Calls, and Buffered I/O. Academic Computers in 1983 and Operating System

VFS, Continued. Don Porter CSE 506

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

CSC 271 Software I: Utilities and Internals

82V391x / 8V893xx WAN PLL Device Families Device Driver User s Guide

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

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

Basic Tiger File System for SmartMedia. Version 1.04

Transcription:

The Embedded I/O Company TIP670-SW-95 QNX-Neutrino Device Driver Digital I/O Version 1.0.x User Manual Issue 1.0.0 August 2008 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 Phone: +49 (0) 4101 4058 0 25469 Halstenbek, Germany Fax: +49 (0) 4101 4058 19 www.tews.com e-mail: info@tews.com TEWS TECHNOLOGIES LLC 9190 Double Diamond Parkway, Suite 127, Reno, NV 89521, USA www.tews.com Phone: +1 (775) 850 5830 Fax: +1 (775) 201 0347 e-mail: usasales@tews.com

TIP670-SW-95 QNX-Neutrino Device Driver Digital I/O Supported Modules: TIP670 This document contains information, which is proprietary to TEWS TECHNOLOGIES GmbH. Any reproduction without written permission is forbidden. TEWS TECHNOLOGIES GmbH has made any effort to ensure that this manual is accurate and complete. However TEWS TECHNOLOGIES GmbH reserves the right to change the product described in this document at any time without notice. TEWS TECHNOLOGIES GmbH is not liable for any damage arising out of the application or use of the device described herein. 2008 by TEWS TECHNOLOGIES GmbH Issue Description Date 1.0.0 First Issue August 27, 2008 TIP670-SW-95 QNX-Neutrino Device Driver Page 2 of 61

Table of Contents 1 INTRODUCTION... 4 1.1 Device Driver...4 1.2 IPAC Carrier Driver...5 2 INSTALLATION... 6 2.1 Build the device driver...7 2.2 Build the example application...7 2.3 Start the driver process...7 3 I/O FUNCTIONS... 8 3.1 open()...8 3.2 close()...10 3.3 devctl()...12 3.3.1 DCMD_TIP670_READ...14 3.3.2 DCMD_TIP670_EVENT_READ...15 3.3.3 DCMD_TIP670_WRITE...18 3.3.4 DCMD_TIP670_WRITE_MASK...19 3.3.5 DCMD_TIP670_OUTPUTBITS_SET...21 3.3.6 DCMD_TIP670_OUTPUTBITS_CLEAR...22 3.3.7 DCMD_TIP670_OUTPUTGET...23 3.3.8 DCMD_TIP670_READ_INP_POL...24 3.3.9 DCMD_TIP670_READ_OUT_POL...25 3.3.10 DCMD_TIP670_WRITE_INP_POL...26 3.3.11 DCMD_TIP670_WRITE_OUT_POL...27 3.3.12 DCMD_TIP670_ENABLE_WD...28 3.3.13 DCMD_TIP670_DISABLE_WD...29 3.3.14 DCMD_TIP670_TRIGGER_WD...30 4 API DOCUMENTATION... 31 4.1 General Functions...31 4.1.1 tip670open()...31 4.1.2 tip670close()...33 4.2 Device Access Functions...35 4.2.1 tip670read()...35 4.2.2 tip670eventread()...37 4.2.3 tip670write()...40 4.2.4 tip670writemask()...42 4.2.5 tip670outputset()...44 4.2.6 tip670outputclear()...46 4.2.7 tip670outputget()...48 4.2.8 tip670readinputpolarity()...50 4.2.9 tip670readoutputpolarity()...52 4.2.10 tip670writeinputpolarity()...54 4.2.11 tip670writeoutputpolarity()...56 4.2.12 tip670configurewatchdog()...58 4.2.13 tip670triggerwatchdog()...60 TIP670-SW-95 QNX-Neutrino Device Driver Page 3 of 61

1 Introduction 1.1 Device Driver The TIP670-SW-95 QNX-Neutrino device driver allows the operation of the TIP670 Digital I/O IndustryPack on QNX-Neutrino systems and requires the TEWS TECHNOLOGIES QNX-Neutrino IPAC Carrier Driver Software (CARRIER-SW-95). The TIP670 device driver is basically implemented as a user installable Resource Manager. The standard file (I/O) functions (open, close and devctl) provide the basic erface for opening and closing a file descriptor and for performing device I/O and control operations. The TIP670-SW-95 device driver supports the following features: reading the input register writing the output register programming polarity of inputs and outputs programming watchdog timeout waiting for a transition at a single input line or a group of input lines (OR ed) The TIP670-SW-95 device driver supports the modules listed below: TIP670-10 8 isolated digital inputs, 8 isolated digital outputs IndustryPack compatible TIP670-20 4 isolated digital inputs, 4 isolated digital outputs IndustryPack compatible To get more information about the features and use of TIP670 devices it is recommended to read the manuals listed below. TIP670 User manual TIP670 Engineering Manual CARRIER-SW-95 User Manual TIP670-SW-95 QNX-Neutrino Device Driver Page 4 of 61

1.2 IPAC Carrier Driver IndustryPack (IPAC) carrier boards have different implementations of the system to IndustryPack bus bridge logic, different implementations of errupt and error handling and so on. Also the different byte ordering (big-endian versus little-endian) of CPU boards will cause problems on accessing the IndustryPack I/O and memory spaces. To simplify the implementation of IPAC device drivers which work with any supported carrier board, TEWS TECHNOLOGIES has designed a so called Carrier Driver that hides all differences of different carrier boards under a well defined erface. The TEWS TECHNOLOGIES IPAC Carrier Driver CARRIER-SW-82 is part of this TIP670-SW-95 distribution. It is located in directory CARRIER-SW-95 on the corresponding distribution media. This IPAC Device Driver requires a properly installed IPAC Carrier Driver. Due to the design of the Carrier Driver, it is sufficient to install the IPAC Carrier Driver once, even if multiple IPAC Device Drivers are used. Please refer to the CARRIER-SW-82 User Manual for a detailed description how to install and setup the CARRIER-SW-95 device driver, and for a description of the TEWS TECHNOLOGIES IPAC Carrier Driver concept. TIP670-SW-95 QNX-Neutrino Device Driver Page 5 of 61

2 Installation Following files are located on the distribution media: Directory path TIP670-SW-95 : TIP670-SW-95-SRC.tar.gz TIP670-SW-95-1.0.0.pdf ChangeLog.txt Release.txt GZIP compressed archive with driver source code PDF copy of this manual Release history Release information For installation the files have to be copied to the desired target directory. The GZIP compressed archive TIP670-SW-95-SRC.tar.gz contains the following files and directories: Directory path tip670 : driver/tip670.c driver/tip670def.h driver/tip670.h driver/makefile api/tip670api.h api/tip670api.c example/exampleapp example/readapp example/writeapp example/configapp TIP670 device driver source TIP670 driver include file TIP670 include file for driver and application TIP670 driver makefile TIP670 API include file for application TIP670 API source file Directory containing Interactive Example application (using driver functions) Directory containing Console application for reading data (using API) Directory containing Console application for writing data (using API) Directory containing Console application for configuring the device (using API) Each example directory contains the following structure: tip670example.c common.mk Makefile nto/makefile nto/x86/makefile nto/x86/o/makefile Example application source file make parameters recursive makefile recursive makefile recursive makefile recursive makefile In order to perform an installation, copy TIP670-SW-95-SRC.tar.gz to /usr/src and extract all files of the archive. (tar xzf TIP670-SW-95-SRC.tar.gz) Before building a new device driver, the TEWS TECHNOLOGIES IPAC carrier driver must be installed properly, because this driver includes the header files ipac_*.h, which is part of the IPAC carrier driver distribution. Please refer to the IPAC carrier driver user manual in the directory path /CARRIER-SW-95 on the distribution media. Its absolute important to extract the TIP670-SW-95-SRC.tar.gz in the /usr/src directory otherwise the automatic build with make will fail. TIP670-SW-95 QNX-Neutrino Device Driver Page 6 of 61

2.1 Build the device driver Change to the /usr/src/tip670/driver directory Execute the Makefile # make install After successful completion the driver binary will be installed in the /bin directory. 2.2 Build the example application Change to the desired example application sub-directory beneath /usr/src/tip670/example/. Make sure that either symbolic links to the TIP670 Application Programming Interface source and header file (tip670api.c and tip670api.h) located in /usr/src/tip670/api/ are available in the example s directory, or simply copy the API files o the directory. The API must be compiled together with the provided example applications. Execute the Makefile: # make install After successful completion the example binary (tip670exa, tip670read, tip670write, tip670config) will be installed in the /bin directory. 2.3 Start the driver process To start the TIP670 Resource Manager (Device Driver) you only have to start the TEWS TECHNOLOGIES IPAC Carrier Driver. The Carrier Driver automatically detects installed TEWS IPACs and dynamically loads the concerning module(s). # ipac_class & The TIP670 Resource Manager registers a device for each TIP670 in the QNX-Neutrinos pathname space under following name, where n specifies the used IPAC slot number (please refer to the IPAC Carrier Driver Manual): /dev/tip670_n This pathname must be used in the application program to open a path to the desired TIP670 device. For debugging you can start the IPAC Carrier Driver with the V (verbose) option. Now the Resource Manager will pr versatile information about TIP670 configuration and command execution on the terminal window. For further details about debugging see IPAC Carrier Driver Manual. TIP670-SW-95 QNX-Neutrino Device Driver Page 7 of 61

3 I/O Functions This chapter describes the erface 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> open ( const char *pathname, flags ) DESCRIPTION The open() function creates and returns a new file descriptor for a TIP670 device. PARAMETER pathname Specifies the device to open. flags Controls how the file is to be opened. TIP670 devices must be opened O_RDWR. EXAMPLE fd; fd = open( /dev/tip670_0, O_RDWR if (fd == -1) /* Handle error */ TIP670-SW-95 QNX-Neutrino Device Driver Page 8 of 61

RETURNS The normal return value from open is a non-negative eger file descriptor. In the case of an error, a value of 1 is returned. The global variable errno contains the detailed error code. ERROR CODES Returns only Neutrino specific error codes, see Neutrino Library Reference. SEE ALSO Library Reference - open() TIP670-SW-95 QNX-Neutrino Device Driver Page 9 of 61

3.2 close() NAME close() close a file descriptor SYNOPSIS #include <unistd.h> close ( ) filedes DESCRIPTION The close() function closes a file. PARAMETER filedes Specifies the file to close. EXAMPLE fd; if (close(fd)!= 0) /* handle close error conditions */ RETURNS 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. TIP670-SW-95 QNX-Neutrino Device Driver Page 10 of 61

ERROR CODES Returns only Neutrino specific error code, see Neutrino Library Reference. SEE ALSO Library Reference - close() TIP670-SW-95 QNX-Neutrino Device Driver Page 11 of 61

3.3 devctl() NAME devctl() device control functions SYNOPSIS #include <sys/types.h> #include <unistd.h> #include <devctl.h> devctl ( void size_t ) filedes, dcmd, *data_ptr, n_bytes, *dev_info_ptr DESCRIPTION The devctl() function sends a control code directly to a device. PARAMETER filedes dcmd Specifies the device to perform the requested operation. Specifies the control code for the operation. The following commands are defined (tip670.h): Command Description DCMD_TIP670_READ DCMD_TIP670_EVENT_READ DCMD_TIP670_WRITE DCMD_TIP670_WRITE_MASK DCMD_TIP670_OUTPUTBITS_SET DCMD_TIP670_OUTPUTBITS_CLEAR DCMD_TIP670_OUTPUTGET DCMD_TIP670_READ_INP_POL DCMD_TIP670_READ_OUT_POL DCMD_TIP670_WRITE_INP_POL DCMD_TIP670_WRITE_OUT_POL Read current digital input value Wait for an event, and return input port (blocked read) Write new digital output value Write new output value with bitmask Set single output lines Clear single output lines Return current output value Read input port polarity configuration Read output port polarity configuration Configure new input port polarity Configure new output port polarity TIP670-SW-95 QNX-Neutrino Device Driver Page 12 of 61

DCMD_TIP670_ENABLE_WD DCMD_TIP670_DISABLE_WD DCMD_TIP670_TRIGGER_WD Setup and enable output port watchdog Disable output port watchdog Trigger output port watchdog data_ptr n_bytes Depends on the command and will be described for each command in detail later in this chapter. Usually pos to a buffer that passes data between the user task and the driver Depends on the command and will be described for each command in detail later in this chapter. Usually defines the size of the buffer poed by data_ptr. dev_info_ptr Is unused for the TIP670 driver and should be set to NULL. RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). 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 devctl() code separately. Note, the TIP670 driver always returns standard QNX error codes. SEE ALSO Library Reference - devctl() TIP670-SW-95 QNX-Neutrino Device Driver Page 13 of 61

3.3.1 DCMD_TIP670_READ DESCRIPTION This function reads the current input value. The function specific argument data_ptr pos to an unsigned char data buffer and n_bytes specify its length in bytes. Bit 0 of the data value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are valid. EXAMPLE #include <tip670.h> unsigned char fd; result; inval; /* read input value */ result = devctl( fd, DCMD_TIP670_READ, &inval, sizeof(inval), NULL if (result == EOK) prf( Value: %02X\n, inval else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 14 of 61

3.3.2 DCMD_TIP670_EVENT_READ DESCRIPTION This function reads the contents of the input ports after a specified event occur. Possible events are rising or falling edge or both (any transition) at a specified input bit or a pattern match of masked input bits. Transition detection and value reading is done by an errupt service routine, and is affected by the system s errupt latency, so this function should not be used for fast changing signals. The function specific argument data_ptr pos to a data structure (TIP670_EVRD_BUFFER) and n_bytes specify its length in bytes. typedef struct unsigned char unsigned char unsigned char unsigned char value; mask; match; mode; long timeout; TIP670_EVRD_BUFFER; value mask match This parameter returns the contents of the input port when the event occurred. The value is read in the errupt service function and may not represent the value at the moment the event has occurred. For TIP670-20, only the lower 4 bits are relevant. This parameter specifies a bit mask. A 1 value marks the corresponding bit position as relevant. Bit 0 of this value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are relevant. This parameter specifies a pattern that must match to the contents of the input port. Only the bit positions specified by mask must compare to the input port. For TIP670-20, only the lower 4 bits are relevant. TIP670-SW-95 QNX-Neutrino Device Driver Page 15 of 61

mode This parameter specifies the event mode for this read request Value TIP670_MATCH TIP670_HIGH_TR TIP670_LOW_TR TIP670_ANY_TR Description The driver reads the input port if the masked input bits match to the specified pattern. The input mask must be specified in the parameter mask. A 1 value in mask means that the input bit value must-match identically to the corresponding bit in the match parameter. Note that due to errupt latency, this function may not detect very fast signal changes. The driver reads the input port if a high-transition at the specified bit position occurs. A 1 value in mask specifies the bit position of the input port. If you specify more than one bit position the events are OR ed. That means the read is completed if a hightransition at least at one relevant bit position occur. The driver reads the input port if a low-transition at the specified bit position occurs. A 1 value in mask specifies the bit position of the input port. If you specify more than one bit position the events are OR ed. That means the read is completed if a lowtransition at least at one relevant bit position occur. The driver reads the input port if a transition (high or low) at the specified bit position occurs. A 1 value in mask specifies the bit position of the input port. If you specify more than one bit position the events are OR ed. That means the read is completed if a transition at least at one relevant bit position occur. timeout Specifies the amount of time (in seconds) the caller is at least willing to wait for the specified event to occur. A value of -1 means wait indefinitely or no timeout. TIP670-SW-95 QNX-Neutrino Device Driver Page 16 of 61

EXAMPLE #include <tip670.h> TIP670_EVRD_BUFFER fd; result; EventBuf; /* ** Wait for a rising edge (high transition) at first input line */ EventBuf.mode = TIP670_HIGH_TR; EventBuf.mask = 0x01; result = devctl( fd, DCMD_TIP670_EVENT_READ, &EventBuf, sizeof(eventbuf), NULL if (result == EOK) prf( Value after Event: %02X\n, EventBuf.value else /* Handle error */ ERRORS EINVAL ETIMEDOUT Invalid argument specified, or buffer too small. The event has not occurred before the specified timeout. TIP670-SW-95 QNX-Neutrino Device Driver Page 17 of 61

3.3.3 DCMD_TIP670_WRITE DESCRIPTION This function sets the new output value. The function specific argument data_ptr pos to an unsigned char data buffer, and n_bytes specify its length in bytes. Bit 0 of the data value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. EXAMPLE #include <tip670.h> unsigned char fd; result; outval; /* ** Write new output value */ outval = 0x42; result = devctl( fd, DCMD_TIP670_WRITE, &outval, sizeof(unsigned char), NULL if (result == EOK) /* OK */ else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 18 of 61

3.3.4 DCMD_TIP670_WRITE_MASK DESCRIPTION This function writes some data bits to the digital output. The function specific argument data_ptr pos to a data structure (TIP670_WRITE_BUFFER) and n_bytes specify its length in bytes. typedef struct unsigned char unsigned char TIP670_WRITE_BUFFER; value mask value; mask; This value specifies the new output value, which will be written to the TIP670 output, in conjunction with a bitmask. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are relevant. This parameter specifies the bitmask. Only active bits (1) will be written to the TIP670 output register. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are relevant. TIP670-SW-95 QNX-Neutrino Device Driver Page 19 of 61

EXAMPLE #include <tip670.h> TIP670_WRITE_BUFFER fd; result; WriteBuf; /* ** only write the lowest bit */ WriteBuf.value = 0xf1; WriteBuf.mask = 0x01; result = devctl( fd, DCMD_TIP670_WRITE_MASK, &WriteBuf, sizeof(writebuf), NULL if (result == EOK) /* OK */ else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 20 of 61

3.3.5 DCMD_TIP670_OUTPUTBITS_SET DESCRIPTION This function sets single output lines leaving other output lines in the current state. The function specific argument data_ptr pos to an unsigned char buffer, and n_bytes specify its length in bytes. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are relevant. EXAMPLE #include <tip670.h> unsigned char fd; result; outval; /* ** set output line 1 and 8 */ outval = 0x81; result = devctl( fd, DCMD_TIP670_OUTPUTBITS_SET, &outval, sizeof(outval), NULL if (result == EOK) /* OK */ else /* Handle error ot timeout */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 21 of 61

3.3.6 DCMD_TIP670_OUTPUTBITS_CLEAR DESCRIPTION This function clears single output lines leaving other output lines in the current state. The function specific argument data_ptr pos to an unsigned char buffer, and n_bytes specify its length in bytes. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are relevant. EXAMPLE #include <tip670.h> unsigned char fd; result; outval; /* ** clear output line 1 and 2 */ outval = 0x03; result = devctl( fd, DCMD_TIP670_OUTPUTBITS_CLEAR, &outval, sizeof(outval), NULL if (result == EOK) /* OK */ else /* Handle error ot timeout */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 22 of 61

3.3.7 DCMD_TIP670_OUTPUTGET DESCRIPTION This function returns the current state of the output register. This value is retrieved from the device driver, no hardware access is performed. This function will not retrigger the output watchdog. The function specific argument data_ptr pos to an unsigned char data buffer and n_bytes specify its length in bytes. Bit 0 of the data value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. EXAMPLE #include <tip670.h> unsigned char fd; result; outval; /* ** read output value */ result = devctl( fd, DCMD_TIP670_OUTPUTGET, &outval, sizeof(outval), NULL if (result == EOK) prf( Value: %02X\n, outval else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 23 of 61

3.3.8 DCMD_TIP670_READ_INP_POL DESCRIPTION This function reads the data path polarity setting of the input port. The function specific argument data_ptr pos to an unsigned char data buffer, and n_bytes specify its length in bytes. A 0 in a particular bit position specifies the corresponding bit path of the port as inverting. If a bit is read as 1, the data path is non-inverting. Bit 0 of the data value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are valid. EXAMPLE #include <tip670.h> unsigned char fd; result; inppol; /* ** Read input polarity */ result = devctl( fd, DCMD_TIP670_READ_INP_POL, &inppol, sizeof(inppol), NULL if (result == EOK) prf( Polarity (bit mask, 0 = inverting) = %02Xh\n, inppol else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 24 of 61

3.3.9 DCMD_TIP670_READ_OUT_POL DESCRIPTION This function reads the data path polarity setting of the output port. The function specific argument data_ptr pos to an unsigned char data buffer, and n_bytes specify its length in bytes. A 0 in a particular bit position specifies the corresponding bit path of the port as noninverting. If a bit is read as 1, the data path is inverting. Bit 0 of the data value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. EXAMPLE #include <tip670.h> unsigned char fd; result; outpol; /* ** Read output polarity */ result = devctl( fd, DCMD_TIP670_READ_OUT_POL, &outpol, sizeof(outpol), NULL if (result == EOK) prf( Polarity (bit mask, 1 = inverting) = %02Xh\n, outpol else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 25 of 61

3.3.10 DCMD_TIP670_WRITE_INP_POL DESCRIPTION This function configures the data path polarity of the input port. The function specific argument data_ptr pos to an unsigned char data buffer, and n_bytes specify its length in bytes. A 0 in a particular bit position specifies the corresponding bit path of the port as inverting. If a bit is read as 1, the data path is non-inverting. Bit 0 of the data value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are valid. EXAMPLE #include <tip670.h> unsigned char fd; result; inppol; /* ** Write input polarity: invert upper 4 bits (line 5 to line 8) */ outpol = 0x0f; result = devctl( fd, DCMD_TIP670_WRITE_INP_POL, &inppol, sizeof(inppol), NULL if (result == EOK) /* OK */ else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 26 of 61

3.3.11 DCMD_TIP670_WRITE_OUT_POL DESCRIPTION This function configures the data path polarity of the output port. The function specific argument data_ptr pos to an unsigned char data buffer, and n_bytes specify its length in bytes. A 0 in a particular bit position specifies the corresponding bit path of the port as noninverting. If a bit is read as 1, the data path is inverting. Bit 0 of the data value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. EXAMPLE #include <tip670.h> unsigned char fd; result; outpol; /* ** Write output polarity: invert lower 4 bits (line 1 to line 4) */ outpol = 0x0f; result = devctl( fd, DCMD_TIP670_WRITE_OUT_POL, &outpol, sizeof(outpol), NULL if (result == EOK) /* OK */ else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 27 of 61

3.3.12 DCMD_TIP670_ENABLE_WD DESCRIPTION This function configures and enables the watchdog facility of the output port, which will disable the outputs, if there is no trigger access to the TIP670 within the configured time. The watchdog time is specified in steps of 0.5 microseconds, valid values are in the range from 1 to 65535. After driver startup, the watchdog is disabled. The function specific argument data_ptr pos to an unsigned short data buffer holding the watchdog time, and n_bytes specify its length in bytes. EXAMPLE #include <tip670.h> unsigned short fd; result; WatchdogTime; /* ** Configure Output Watchdog to 30ms */ WatchdogTime = 60000; result = devctl( fd, DCMD_TIP670_ENABLE_WD, &WatchdogTime, sizeof(watchdogtime), NULL if (result == EOK) /* OK */ else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 28 of 61

3.3.13 DCMD_TIP670_DISABLE_WD DESCRIPTION This function disables the watchdog facility of the output port. The function does not use the parameters data_ptr and n_bytes, they must be set to 0. EXAMPLE #include <tip670.h> fd; result; /* ** Disable Output Watchdog */ result = devctl( fd, DCMD_TIP670_DISABLE_WD, NULL, 0, NULL if (result == EOK) /* OK */ else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 29 of 61

3.3.14 DCMD_TIP670_TRIGGER_WD DESCRIPTION This function triggers the watchdog facility of the output port. Reading the inputs or writing the outputs of the TIP670 will trigger the watchdog, too. The function does not use the parameters data_ptr and n_bytes, they must be set to 0. EXAMPLE #include <tip670.h> fd; result; /* ** Trigger Output Watchdog */ result = devctl( fd, DCMD_TIP670_TRIGGER_WD, NULL, 0, NULL if (result == EOK) /* OK */ else /* Handle error */ ERRORS EINVAL Invalid argument specified, or buffer too small. TIP670-SW-95 QNX-Neutrino Device Driver Page 30 of 61

4 API Documentation 4.1 General Functions 4.1.1 tip670open() Name tip670open() opens a device. Synopsis tip670open ( char *DeviceName Description Before I/O can be performed to a device, a file descriptor must be opened by a call to this function. Parameters DeviceName This parameter pos to a null-terminated string that specifies the name of the device. Example #include tip670api.h FileDescriptor; /* ** open file descriptor to device */ FileDescriptor = tip670open( /dev/tip670_0 if (FileDescriptor < 0) /* handle open error */ TIP670-SW-95 QNX-Neutrino Device Driver Page 31 of 61

RETURNS A device descriptor number, or -1 if the function fails. An error code will be stored in errno. ERROR CODES The error codes are stored in errno. The error code is a standard error code set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 32 of 61

4.1.2 tip670close() Name tip670close() closes a device. Synopsis tip670close ( FileDescriptor Description This function closes previously opened devices. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. Example #include tip670api.h FileDescriptor; result; /* ** close file descriptor to device */ result = tip670close( FileDescriptor if (result < 0) /* handle close error */ TIP670-SW-95 QNX-Neutrino Device Driver Page 33 of 61

RETURNS EOK, or -1 if the function fails. An error code will be stored in errno. ERROR CODES The error codes are stored in errno. The error code is a standard error code set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 34 of 61

4.2 Device Access Functions 4.2.1 tip670read() Name tip670read() read current input value. Synopsis tip670read ( unsigned char FileDescriptor, *pinputvalue Description This function reads the current input value of the specified device. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. pinputvalue This value is a poer to an unsigned char buffer which receives the current input value. Bit 0 of this value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 35 of 61

Example #include tip670api.h FileDescriptor; result; unsigned char InputValue; /* ** read current input value */ result = tip670read( FileDescriptor, &InputValue if (result == EOK) prf( Input Value: %02X\n, InputValue else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 36 of 61

4.2.2 tip670eventread() Name tip670eventread() wait for an event, and read input value Synopsis tip670read ( FileDescriptor, EventMode, unsigned char Mask, unsigned char Match, long Timeout, unsigned char *pinputvalue Description This function waits for an event, and reads the input value of the specified device after this event has occurred. This function should not be used for fast changing devices, because event detection and reading the input value is highly affected by the system s errupt latency. Parameters FileDescriptor EventMode This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. This parameter specifies the event mode for this read request Value TIP670_MATCH Description The driver reads the input port if the masked input bits match to the specified pattern. The input mask must be specified in the parameter mask. A 1 value in mask means that the input bit value must-match identically to the corresponding bit in the match parameter. Note that due to errupt latency, this function may not detect very fast signal changes. TIP670-SW-95 QNX-Neutrino Device Driver Page 37 of 61

TIP670_HIGH_TR TIP670_LOW_TR TIP670_ANY_TR The driver reads the input port if a high-transition at the specified bit position occurs. A 1 value in mask specifies the bit position of the input port. If you specify more than one bit position the events are OR ed. That means the read is completed if a hightransition at least at one relevant bit position occur. The driver reads the input port if a low-transition at the specified bit position occurs. A 1 value in mask specifies the bit position of the input port. If you specify more than one bit position the events are OR ed. That means the read is completed if a lowtransition at least at one relevant bit position occur. The driver reads the input port if a transition (high or low) at the specified bit position occurs. A 1 value in mask specifies the bit position of the input port. If you specify more than one bit position the events are OR ed. That means the read is completed if a transition at least at one relevant bit position occur. Mask Match Timeout This parameter specifies a bit mask. A 1 value marks the corresponding bit position as relevant. Bit 0 of this value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are relevant. This parameter specifies a pattern that must match to the contents of the input port. Only the bit positions specified by mask must compare to the input port. For TIP670-20, only the lower 4 bits are relevant. Specifies the amount of time (in seconds) the caller is at least willing to wait for the specified event to occur. A value of -1 means wait indefinitely or no timeout. pinputvalue This value is a poer to an unsigned char buffer which receives the input value. Bit 0 of this value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 38 of 61

Example #include tip670api.h FileDescriptor; result; unsigned char InputValue; /* ** wait at least 5 seconds for any transition on first input line */ result = tip670eventread( FileDescriptor, TIP670_ANY_TR, /* EventMode */ (1 << 0), /* Mask */ 0, /* Match */ 5, /* Timeout */ &InputValue /* poer to input value */ if (result == EOK) prf( Event occurred.\n prf( Input Value after event: %02X\n, InputValue else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES ETIMEDOUT The event has not occurred before the specified timeout. All other error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 39 of 61

4.2.3 tip670write() Name tip670write() write new output value. Synopsis tip670write ( unsigned char FileDescriptor, OutputValue Description This function writes a new output value for the specified device. All output lines are affected, and will be set according to the specified output value. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. OutputValue This value specifies the new output value. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 40 of 61

Example #include tip670api.h FileDescriptor; result; /* ** write new output value: ** set 2 nd (bit 1) and 7 th (bit 6) output lines to ON, ** all other lines to OFF. */ result = tip670write( FileDescriptor, (1 << 1) (1 << 6) if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 41 of 61

4.2.4 tip670writemask() Name tip670writemask() write relevant bits of output value. Synopsis tip670writemask ( unsigned char unsigned char FileDescriptor, OutputValue, BitMask Description This function writes relevant bits of a new output value for the specified device. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. OutputValue BitMask This value specifies the new output value. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. This parameter specifies the bitmask. Only active bits (1) will be written to the TIP670 output register, all other output lines will be left unchanged. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are relevant. TIP670-SW-95 QNX-Neutrino Device Driver Page 42 of 61

Example #include tip670api.h FileDescriptor; result; /* ** write new output value: ** set 2 nd (bit 1) output line to ON, and 7 th (bit 6) output line to OFF. ** leave all other output lines unchanged. */ result = tip670writemask( FileDescriptor, (1 << 1), (1 << 1) (1 << 6) if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 43 of 61

4.2.5 tip670outputset() Name tip670outputset() set single output lines to ON. Synopsis tip670outputset ( unsigned char FileDescriptor, OutputValue Description This function sets single output lines to ON leaving other output lines in the current state. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. OutputValue This value specifies the new output value. Active (1) bits will set the corresponding output line to ON, unset (0) bits will not have an effect on the corresponding output lines. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 44 of 61

Example #include tip670api.h FileDescriptor; result; /* ** write new output value: ** set 2 nd (bit 1) and 3 rd (bit 2) output line to ON. ** leave all other output lines unchanged. */ result = tip670outputset( FileDescriptor, (1 << 1) (1 << 2) if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 45 of 61

4.2.6 tip670outputclear() Name tip670outputclear() clear single output lines to OFF. Synopsis tip670outputclear ( unsigned char FileDescriptor, OutputValue Description This function clears single output lines to OFF leaving other output lines in the current state. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. OutputValue This value specifies the new output value. Active (1) bits will clear the corresponding output line to OFF, unset (0) bits will not have an effect on the corresponding output lines. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 46 of 61

Example #include tip670api.h FileDescriptor; result; /* ** write new output value: ** clear 2 nd (bit 1) and 4 th (bit 3) output line to OFF. ** leave all other output lines unchanged. */ result = tip670outputclear( FileDescriptor, (1 << 1) (1 << 3) if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 47 of 61

4.2.7 tip670outputget() Name tip670outputget() return last written output value. Synopsis tip670outputget ( unsigned char FileDescriptor, *poutputvalue Description This function returns the last written output value. This value does not match the current output value, if the output lines have been disabled by the output watchdog. This function will not retrigger the output watchdog. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. poutputvalue This value is a poer to an unsigned char buffer which receives the output value. Bit 0 of this value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 48 of 61

Example #include tip670api.h FileDescriptor; result; unsigned char OutputValue; /* ** get output value */ result = tip670outputget( FileDescriptor, &OutputValue if (result == EOK) prf( Output Value: %02X\n, OutputValue else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 49 of 61

4.2.8 tip670readinputpolarity() Name tip670readinputpolarity() read input polarity. Synopsis tip670readinputpolarity ( FileDescriptor, unsigned char *ppolarity Description This function reads the data path polarity setting of the input port. Parameters FileDescriptor ppolarity This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. This value is a poer to an unsigned char buffer which receives the input polarity value. Active (1) bits represent an inverted data path, unset (0) bits represent non-inverting data path. Bit 0 of the data value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 50 of 61

Example #include tip670api.h FileDescriptor; result; unsigned char Polarity; /* ** read input polarity */ result = tip670readinputpolarity( FileDescriptor, &Polarity if (result == EOK) prf( Polarity (bit mask, 1 = inverting) = %02Xh\n, Polarity else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 51 of 61

4.2.9 tip670readoutputpolarity() Name tip670readoutputpolarity() read output polarity. Synopsis tip670readoutputpolarity ( FileDescriptor, unsigned char *ppolarity Description This function reads the data path polarity setting of the output port. Parameters FileDescriptor ppolarity This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. This value is a poer to an unsigned char buffer which receives the output polarity value. Active (1) bits represent an inverted data path, unset (0) bits represent non-inverting data path. Bit 0 of the data value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 52 of 61

Example #include tip670api.h FileDescriptor; result; unsigned char Polarity; /* ** read output polarity */ result = tip670readoutputpolarity( FileDescriptor, &Polarity if (result == EOK) prf( Polarity (bit mask, 1 = inverting) = %02Xh\n, Polarity else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 53 of 61

4.2.10 tip670writeinputpolarity() Name tip670writeinputpolarity() Configure new input port polarity. Synopsis tip670writeinputpolarity ( FileDescriptor, unsigned char Polarity Description This function configures the data path polarity setting of the input port. Parameters FileDescriptor ppolarity This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. This value specifies the new input polarity value. Active (1) bits represent an inverted data path, unset (0) bits represent non-inverting data path. Bit 0 of the data value corresponds to the first input line, bit 1 corresponds to the second input line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 54 of 61

Example #include tip670api.h FileDescriptor; result; /* ** configure input polarity: ** invert 7 th (bit 6) and 8 th (bit 7) input line */ result = tip670writeinputpolarity( FileDescriptor, (1 << 7) (1 << 6) if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 55 of 61

4.2.11 tip670writeoutputpolarity() Name tip670writeoutputpolarity() Configure new output port polarity. Synopsis tip670writeoutputpolarity ( FileDescriptor, unsigned char Polarity Description This function configures the data path polarity setting of the output port. Parameters FileDescriptor ppolarity This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. This value specifies the new output polarity value. Active (1) bits represent an inverted data path, unset (0) bits represent non-inverting data path. Bit 0 of the data value corresponds to the first output line, bit 1 corresponds to the second output line and so on. For TIP670-20, only the lower 4 bits are valid. TIP670-SW-95 QNX-Neutrino Device Driver Page 56 of 61

Example #include tip670api.h FileDescriptor; result; /* ** configure output polarity: ** invert 1 st (bit 0) and 2 nd (bit 1) output line */ result = tip670writeoutputpolarity( FileDescriptor, (1 << 1) (1 << 0) if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 57 of 61

4.2.12 tip670configurewatchdog() Name tip670configurewatchdog() Setup output port watchdog. Synopsis tip670configurewatchdog ( FileDescriptor, unsigned short WatchdogTime Description This function configures the data path polarity setting of the output port. Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. WatchdogTime This value specifies the watchdog time in steps of 0.5 microseconds. To enable the output watchdog timer, valid values are from 1 to 65535. A value of 0 disables the watchdog feature. TIP670-SW-95 QNX-Neutrino Device Driver Page 58 of 61

Example #include tip670api.h FileDescriptor; result; /* ** enable watchdog and configure the watchdog time to 30ms */ result = tip670configurewatchdog( FileDescriptor, 60000 if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 59 of 61

4.2.13 tip670triggerwatchdog() Name tip670triggerwatchdog() trigger output port watchdog. Synopsis tip670triggerwatchdog ( FileDescriptor Description This function triggers the output watchdog. Reading the inputs or writing the outputs of the TIP670 will trigger the watchdog, too Parameters FileDescriptor This value specifies the file descriptor to the hardware module retrieved by a call to the corresponding open-function. TIP670-SW-95 QNX-Neutrino Device Driver Page 60 of 61

Example #include tip670api.h FileDescriptor; result; /* ** trigger watchdog */ result = tip670triggerwatchdog( FileDescriptor if (result == EOK) /* OK */ else /* handle error */ RETURNS On success, EOK is returned. In the case of an error, the appropriate error code is returned by the function (not in errno!). ERROR CODES All error codes a standard error codes set by the I/O system. TIP670-SW-95 QNX-Neutrino Device Driver Page 61 of 61