Home

User Manual - TEWS Bentech Taiwan

image

Contents

1. retval ioctl fd FIO T675 REMOVE ISF int amp RsfPar if retval ERROR handle function specific error conditions TIP675 SW 42 VxWorks Device Driver Page 23 of 26 TEWS TECHNOLOGIES ERROR CODES S t675Drv ILINE Specified VO line out of range S t675Drv IPARAM No valid transition parameter TIP675 SW 42 VxWorks Device Driver Page 24 of 26 TEWS TECHNOLOGIES A 3 6 FIO T675 ENA EXCLK This ioctl function enables the simultaneous update feature of the TIP675 Setting the ioctl argument arg to 7675 POS EDGE will cause the inputs and outputs to be latched on the rising edge of the external clock while setting arg to 7675 NEG EDGE will latch the inputs and outputs on the falling edge EXAMPLE include tip675 h int fd int retval Enable simultaneous update on falling edge retval ioctl fd FIO T675 ENA EXCLK T675 NEG EDGE if retval ERROR handle function specific error conditions TIP675 SW 42 VxWorks Device Driver Page 25 of 26 TEWS TECHNOLOGIES 4 3 7 FIO T675 DIS EXCLK This ioctl function disables the simultaneous update feature of the TIP675 After driver startup the simultaneous update feature is disabled The optional argument arg shall be set to 0 EXAMPLE include tip675 h int fd int retval Disable simultaneous update of inputs
2. TECHNOLOGIES 1 Introduction 1 1 Device Driver The TIP675 SW 42 VxWorks device driver software allows the operation of the TIP675 IP conforming to the VxWorks VO system specification This includes a device independent basic VO interface with open close and ioctl functions The TIP675 driver includes the following functions reading the input register writing the output register programming direction of every I O line configure simultaneous update feature connect interrupt callback functions to every I O line Support for legacy and VxBus IPAC carrier driver SMP Support VVVVVVV The TIP675 SW 42 supports the modules listed below TIP675 10 48 TTL VO Lines with Interrupts IndustryPack compatible To get more information about the features and use of the supported devices it is recommended to read the manuals listed below TIP675 User manual TIP675 Engineering Manual CARRIER SW 42 IPAC Carrier User Manual TIP675 SW 42 VxWorks Device Driver Page 4 of 26 TEWS TECHNOLOGIES 1 2 IPAC Carrier Driver IndustryPack IPAC carrier boards have different implementations of the system to IndustryPack bus bridge logic different implementations of interrupt and error handling and so on Also the different byte ordering big endian versus little endian of CPU boards might cause problems when accessing the IndustryPack I O and memory spaces To simplify the implementation of IPAC
3. TEWS The Embedded VO Company TECHNOLOGIES TIP675 SW 42 VxWorks Device Driver 48 TTL VO Lines with Interrupts Version 2 0 x User Manual Issue 2 0 0 July 2010 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek Germany Phone 49 0 4101 4058 0 Fax 49 0 4101 4058 19 e mail info tews com www tews com TEWS TECHNOLOGIES TIP675 SW 42 This document contains information which is VxWorks Device Driver proprietary to TEWS TECHNOLOGIES GmbH Any 48 TTL I O Lines with Interrupts reproduction without written permission is forbidden Supported Modules TEWS TECHNOLOGIES GmbH has made any TIP675 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 2002 2010 by TEWS TECHNOLOGIES GmbH Issue Description Date 1 0 First Issue September 12 2002 1 1 0 IPAC Carrier Driver Support January 11 2006 1 2 0 New Address TEWS TECHNOLOGIES LLC December 5 2006 ChangeLog txt added to file list new error code for tip675DevCreate 1 2 1 Carrier Driver description added June 24 2008 2 0 0 SMP Support IPAC carrier interface functions removed return value July 26 2010 for ioctl function changed TIP675 SW 42 VxWorks Device Driver Page 2 of 26 TEWS TEC
4. IsfPar arg 0 retval ioctl fd FIO T675 INSTALL ISF int amp IsfPar if retval ERROR handle function specific error conditions ERRORS CODES S t675Drv ILINE Specified VO line out of range S t675Drv IPARAM No valid transition parameter S t675Drv BUSY This VO line and edge combination is already occupied Call the ioctl function FIO_T675_REMOVE_ISF to remove the previous installed callback function TIP675 SW 42 VxWorks Device Driver Page 22 of 26 TEWS TECHNOLOGIES 4 3 5 FIO T675 REMOVE ISF This ioctl function removes a previously installed callback function from a specified I O line and transition edge The function specific control parameter arg is a pointer to a T675_INSTALL_ISF_STR structure typedef struct unsigned short io_line unsigned short edge T675 REMOVE ISF STR io line Specifies the VO line number from which the callback function shall be removed Valid VO lines are in range from 1 to 48 edge Specifies the transition edge from which the callback function shall be removed Valid values are Value Description T675 POS EDGE Rising edge low to high transition T675 NEG EDGE Falling edge high to low transition EXAMPLE include tip675 h int fd int retval T675 REMOVE ISF STR RsfPar Remove user supplied callback function from I O line 24 RsfPar io line 24 RsfPar edge T675 POS EDGE
5. and outputs sy retval ioctl fd FIO T675 DIS EXCLK 0 if retval ERROR handle function specific error conditions TIP675 SW 42 VxWorks Device Driver Page 26 of 26
6. type T675 READ STR The buffer is filled with the contents of the line input registers directly on entrance of the drivers interrupt service routine The read buffer is placed on the interrupt stack and only available in the interrupt context Due to the fact that the input registers aren t latched the input buffer doesn t reflect the state of the input lines at the moment of the transition The read is delayed by the interrupts latency which depends on the system performance and other functions which may block the interrupt processing arg User supplied argument EXAMPLE include tip675 h 7 CALLBACK FUNCTION INTERRUPT x static void callback unsigned long base unsigned long line info T675_READ_STR pvalue unsigned long arg int line line line info amp Oxffff mask lower 16 bit if line_info gt gt 16 amp T675_POS_EDGE 0 yes this was a rising edge do whatever necessary to handle this interrupt TIP675 SW 42 VxWorks Device Driver Page 21 of 26 TEWS TECHNOLOGIES USER APPLICATION sy int fd int retval T675 INSTALL ISF STR IsfPar Install a cal llback function for line 12 interrupts The function will be called if a rising edge occurred The user argument is not used 0 sy IsfPar io line 12 IsfPar edge T675 POS EDGE IsfPar funcPtr callback
7. 2 device driver into a VxWorks project e g Tornado IDE or Workbench follow the steps below 1 Copy the files from the distribution media into a subdirectory in your project path For example TIP675 2 Add the device drivers C files to your project 3 Now the driver is included in the project and will be built with the project For a more detailed description of the project facility please refer to your VxWorks User s Guide e g Tornado Workbench etc 2 2 System resource requirement The table gives an overview over the system resources that will be needed by the driver Resource Driver requirement Devices requirement Memory lt 1KB lt 1KB Stack lt 1KB lt 1KB Semaphores Memory and Stack usage may differ from system to system depending on the used compiler and its setup The following formula shows the way to calculate the common requirements of the driver and devices lt total requirement gt lt driver requirement gt lt number of devices lt device requirement gt The maximum usage of some resources is limited by adjustable parameters If the application and driver exceed these limits increase the according values in your project TIP675 SW 42 VxWorks Device Driver Page 6 of 26 TEWS TECHNOLOGIES 3VO system functions This chapter describes the driver level interface to the I O system The purpose of these functions is to install the driver in
8. HNOLOGIES Table of Contents 1 INTRODUCTION EE EE EE aana iaaiiai aa aaa aaa i EEA aaia 4 1 1 Device Driver EE EE N EE N EE EE 4 1 2 IPAC aitier Drive ee Es IE raare ee Ee ee es oe ee ge Ee oge EE ED ei 5 2 INSTALLATION isdie GEREGEER GWEN GEGEE GER OGE GEGEE GEGEE GEE SEGE ENG GEE 6 2 1 Include device driver in VxWorks projects se EER RR EER RR RE RE RR RE RE GR AR EE RE GR RR RE Re Ge RR RE nnmnnn EE Ee ee 6 2 2 System resource requirement see Re EE Re AR RA AR KEER ER ERA RR AR RAAR RR KEER KEER AR RE GA AR RA GR ER Re AR Ke AR Re annen nnn 6 3 MO SYSTEM FUNCTIONS iis ss se ese ai vi de ves ak kw Gere dei wi de eo ed ed ea Ra 7 Heyde DE EE RE EE EE EE EE N EE EE 7 3 2 edel ie iN EE RE EE EI N 9 4 VO FUNCTIONS essens ee seek Ge Ge Ke KEES RE Ge GREG Ke SEE Ke Ke SEEK Ge GER Ge WE KG EES KERS 11 Ee AR EE N EE EE EE EE N 11 EE OE EE N EE EE N EE N 13 RA EER EE EE N EE EN E OE EE eauvetetamavsate 15 43 1 FIO T675 ls GR EE EE RE EO ERa AAE NEDRE 17 43 2 FIO MI ERROR HE RO RE Oa 18 43 3 FIO T675 SET DIR OR RE EE RE RE 19 43 4 FIO T675 INSTALL ISF kiemen ieaiaia wee KERR ek aaa aa ataa aata TAEA O RRi 20 43 5 FIO T675 REMOVE SE sesse ees Reg esse sie an GR Ee See Reed aa aaa ga oek ENa 23 496 FIO T675 ENA EXGLK ie Sies ee eN ee Gede was esse a VER Ee See RR eg Re Ke Pn Ee a Ee gese Ne ee 25 43 7 FIO 1T675 DIS EXOLK SERE EE EE EE aae 26 TIP675 SW 42 VxWorks Device Driver Page 3 of 26 TEWS
9. STATUS result close the device Af result close fd if result ERROR Handle error TIP675 SW 42 VxWorks Device Driver Page 13 of 26 TEWS TECHNOLOGIES RETURNS OK or ERROR If the function fails an error code will be stored in errno ERROR CODES The error code can be read with the function errnoGet The error code is a standard error code set by the I O system see VxWorks Reference Manual SEE ALSO ioLib basic VO routine close TIP675 SW 42 VxWorks Device Driver Page 14 of 26 4 3 ioctl NAME ioctl performs an I O control function SYNOPSIS include tip675 h int ioctl int fd int request int arg DESCRIPTION TEWS TECHNOLOGIES Special I O operations that do not fit to the standard basic I O calls will be performed by calling the ioctl function with a specific function code and an optional function dependent argument For details of supported ioctl functions see VxWorks Reference Manual VxWorks Programmer s Guide I O system PARAMETER fd This file descriptor specifies the device to be used The file descriptor has been returned by the open function request This argument specifies the function that shall be executed Following functions are defined Function Description FIO_T675_READ Read from input buffer FIO_T675_WRITE Write to output buffer FIO_T675_SET_DIR Set d
10. Value Description T675 POS EDGE An interrupt will be generated on a Low to High transition T675 NEG EDGE An interrupt will be generated on a High to Low transition arg This user defined argument will be passed in the 4 argument to the user supplied callback function This argument could be a semaphore ID a message ID or something like that funcPtr This parameter contains a pointer to a function to be called if the interrupt at the connected VO line occurred The routine is invoked in supervisor mode at interrupt level A proper C environment is established the necessary registers saved and the stack is set up The function prototype of the callback function has the following arguments described below void callback unsigned long base unsigned long line_info T675 READ STR inBuf unsigned long arg TIP675 SW 42 VxWorks Device Driver Page 20 of 26 TEWS TECHNOLOGIES base Base address of the modules VO space This argument is available for compatibility purposes only and it is not recommended to be used line info The lower 16 bit contains the number of the I O line 1 48 at which the event occurred The upper 16 bit contains a flag which specifies the transition on which this interrupt was generated The corresponding macros are the same as used for the parameter edge in the T675_INSTALL_ISF_STR structure Please note these flags are left shifted by 16 bits inBuf This argument is a pointer to a read buffer of
11. device drivers which shall 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 interface The TEWS TECHNOLOGIES IPAC Carrier Driver CARRIER SW 42 is part of this TIP675 SW 42 distribution It is located in the directory CARRIER SW 42 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 42 User Manual for a detailed description on how to install and setup the CARRIER SW 42 device driver and for a description of the TEWS TECHNOLOGIES IPAC Carrier Driver concept TIP675 SW 42 VxWorks Device Driver Page 5 of 26 TEWS TECHNOLOGIES 2 Installation The following files and directories are located on the distribution media Directory path TIP675 SW 42 tip675drv c TIP675 device driver source tip675def h TIP675 driver include file tip675 h TIP675 include file for driver and application tip675exa c Example application include ipac_carrier h Carrier driver interface definitions TIP675 SW 42 2 0 0 pdf PDF copy of this manual Release txt Release information ChangeLog txt Release history 2 1 Include device driver in VxWorks projects For including the TIP675 SW 4
12. his string specifies the name of the device that will be used to identify the device for example for open calls devldx This index number specifies the desired device instance beginning by 0 This parameter is 0 for the first TIP675 in the system 1 for the second TIP675 and so forth The order of TIP675 modules depends on the search order of the IPAC carrier driver funcType This parameter is unused and should be set to 0 pParam This parameter is unused and should be set to NULL TIP675 SW 42 VxWorks Device Driver Page 9 of 26 TEWS TECHNOLOGIES EXAMPLE include tip675 h STATUS result Create the device tip675 0 for the first TIP675 module result tip675DevCreate tip675 0 0 0 NULL if result ERROR Error occurred when creating the device k RETURNS OK or ERROR If the function fails an error code will be stored in errno ERROR CODES The error codes can be read with the function errnoGet Error code Description S_ioLib NO DRIVER Driver not installed call tip675Drv first S_tip675Drv_IARG The parameter devldx is out of range S_tip675Drv_EXISTS The TIP675 device specified by the parameter devldx has been created already ENXIO No TIP675 module found for the specified parameter devidx If this error occurred for parameter devldx 0 no TIP675 module at all was recognized SEE ALSO VxWorks Programmer s Guide VO System TIP675 SW 42 VxW
13. irection of VO lines FIO_T675_INSTALL_ISF Install user supplied I O service function at specified I O line FIO_T675_REMOVE_ISF Remove user supplied I O service function from specified I O line FIO T675 ENA EXCLK Enable simultaneous update feature FIO T675 DIS EXCLK Disable simultaneous update feature TIP675 SW 42 VxWorks Device Driver Page 15 of 26 TEWS TECHNOLOGIES arg This parameter depends on the selected function reguest How to use this parameter is described below with the function RETURNS OK or ERROR If the function fails an error code will be stored in errno ERROR CODES The error code can be read with the function errnoGet The error code is a standard error code set by the I O system see VxWorks Reference Manual Function specific error codes will be described with the function SEE ALSO ioLib basic VO routine ioctl TIP675 SW 42 VxWorks Device Driver Page 16 of 26 TEWS TECHNOLOGIES 4 3 1 FIO T675 READ This function reads the current contents of the input registers of the TIP675 associated with the device descriptor fd into the read buffer of type T675 READ STR The function specific control parameter arg is a pointer to a T675 READ STR structure typedef struct unsigned short in 1 16 unsigned short in 17 32 unsigned short in aa 48 T675 READ STR in 1 16 Returns the contents of the input register for VO line 1 up
14. is assigned to bit 0 line 34 to bit 1 and so on EXAMPLE include Cipe75 H int fd int retval T675_DIRECTION_STR dBuf Set direction Line 1 24 output Line 25 32 input a dBuf out_1_16 OxFFFF dBuf out_17_32 OXOOFF dBuf out_33_48 0x0000 retval ioctl fd FIO T675 SET DIR int amp dBuf if retval ERROR handle function specific error conditions TIP675 SW 42 VxWorks Device Driver Page 19 of 26 TEWS 4 3 4 FIO T675 INSTALL ISF This ioctl function connects a user supplied function to an interrupt at the specified VO line Each time an interrupt occurred with the specified transition at the specified I O line this function will be called Only one callback function can be installed per I O line and transition at the same time The callback function will be invoked in supervisor mode at interrupt level Be sure that only suitable system functions will be called and no wait conditions do occur The function specific control parameter arg is a pointer to a T675 INSTALL ISF STR structure typedef struct unsigned short io_line unsigned short edge unsigned long arg VOIDFUNCPTR funcPtr T675 INSTALL ISF STR io line Specifies the VO line at which the callback function will be installed Valid I O lines are in range from 1 to 48 edge Specifies the transition positive negative at which the callback function will be installed Valid values are
15. ne 17 is assigned to bit 0 line 18 to bit 1 and so on out 33 48 Specifies the output value that will be written into the output register for VO lines 33 up to 48 Line 33 is assigned to bit 0 line 34 to bit 1 and so on EXAMPLE include Ltip675 h int fd int retval T675 WRITE STR wBuf write to the output registers sy wBuf out 1 16 Ox9abc wBuf out 17 32 0x5678 wBuf out 33 48 0x1234 retval ioctl fd FIO T675 WRITE int amp wBuf if retval ERROR handle function specific error conditions TIP675 SW 42 VxWorks Device Driver Page 18 of 26 TEWS TECHNOLOGIES 4 3 3 FIO T675 SET DIR With this ioctl function each of the 48 VO lines may be individually set as input or output After driver startup all VO lines are set to be inputs To enable a certain output line set the corresponding bit in the mask to 1 The function specific control parameter arg is a pointer to a T675 DIRECTION STR structure typedef struct unsigned short dir 1 16 unsigned short dir 17 32 unsigned short dir aa 48 T675 DIRECTION STR dir 1 16 Specifies the line direction for VO lines 1 up to 16 Line 1 is assigned to bit 0 line 2 to bit 1 and SO on dir 17 32 Specifies the line direction for VO lines 17 up to 32 Line 17 is assigned to bit 0 line 18 to bit 1 and so on dir_33_48 Specifies the line direction for I O lines 33 up to 48 Line 33
16. orks Device Driver Page 10 of 26 TEWS TECHNOLOGIES 41 O Functions 4 1 open NAME open open a device or file SYNOPSIS int open const char name int flags int mode DESCRIPTION Before I O can be performed to the TIP675 device a file descriptor must be opened by invoking the basic I O function open PARAMETER name Specifies the device which shall be opened the name specified in tip675DevCreate must be used flags Not used mode Not used TIP675 SW 42 VxWorks Device Driver Page 11 of 26 TEWS TECHNOLOGIES EXAMPLE int fd Open the device named tip675 0 for I O fd open tip675 0 0 0 if fd ERROR Handle error RETURNS A device descriptor number or ERROR If the function fails an error code will be stored in errno ERROR CODES The error code can be read with the function errnoGet The error code is a standard error code set by the I O system see VxWorks Reference Manual SEE ALSO ioLib basic VO routine open TIP675 SW 42 VxWorks Device Driver Page 12 of 26 TEWS TECHNOLOGIES 4 2 close NAME close close a device or file SYNOPSIS int close int fd DESCRIPTION This function closes opened devices PARAMETER fd This file descriptor specifies the device to be closed The file descriptor has been returned by the open function EXAMPLE int fd
17. the I O system add and initialize devices 3 1 tip675Drv NAME tip675Drv installs the TIP675 driver in the VO system SYNOPSIS include tip675 h STATUS tip675Drv void DESCRIPTION This function initializes the TIP675 driver and installs it in the VO system The call of this function is the first thing the user has to do before adding any device to the system or performing any VO request EXAMPLE include tip675 h status tip675Drv if status ERROR Error handling RETURNS OK or ERROR If the function fails an error code will be stored in errno TIP675 SW 42 VxWorks Device Driver Page 7 of 26 TENSE TECHNOLOGIES ERROR CODES The error code can be read with the function errnoGet The error code is a standard error code set by the I O system see VxWorks Reference Manual SEE ALSO VxWorks Programmers Guide VO System TIP675 SW 42 VxWorks Device Driver Page 8 of 26 TEWS TECHNOLOGIES 3 2 tip675DevCreate NAME tip675DevCreate Add a TIP675 device to the VxWorks system SYNOPSIS include tip675 h STATUS tip675DevCreate char name int devldx int funcType void pParam DESCRIPTION This routine adds a TIP675 device to the VxWorks system The device hardware will be setup and prepared for use This function must be called before performing any I O request to this device PARAMETER name T
18. to 16 Line 1 is assigned to bit 0 line 2 to bit 1 and so on in 17 32 Returns the contents of the input register for VO line 17 up to 32 Line 17 is assigned to bit 0 line 18 to bit 1 and so on in 33 48 Returns the contents of the input register for VO line 33 up to 48 Line 33 is assigned to bit 0 line 34 to bit 1 and so on EXAMPLE include LipOIS h int fd int retval T675 READ STR rBuf read the input registers of the device associated with fd retval ioctl fd FIO_T675_READ int amp rBuf if retval OK printf Input 1 16 04X n rBuf in_1_16 printf Input 17 32 04XNn rBuf in 17 32 printf Input 33 48 04X n rBuf in 33 48 L TIP675 SW 42 VxWorks Device Driver Page 17 of 26 TEWS 4 3 2 FIO T675 WRITE This function writes to the output registers of the TIP675 associated with the device descriptor fd from a write buffer of type T675 WRITE STR The function specific control parameter arg is a pointer to a T675 WRITE STR structure typedef struct unsigned short out 1 16 unsigned short out 17 32 unsigned short out 33 48 T675 WRITE STR out 1 16 Specifies the output value that will be written into the output register for VO lines 1 up to 16 Line 1 is assigned to bit 0 line 2 to bit 1 and so on out 17 32 Specifies the output value that will be written into the output register for VO lines 17 up to 32 Li

Download Pdf Manuals

image

Related Search

Related Contents

E300 Electronic Overload Relay Loss of Communications  KLK209_N06-15 - University of Idaho  User`s Guide  LED101 Multi-color LED Lamp  Alpine CDE-113BT User Guide Manual - CaRadio  Avaya IP Key Expansion Module (KEM) User Guide  RM2255    6 - SEW-EURODRIVE  

Copyright © All rights reserved.
Failed to retrieve file