Home

User Manual - powerbridge.de

image

Contents

1. are defined Value Description TDRV002 HWHS DISABLE hardware handshake is disabled TDRV002 HWHS ENABLE hardware handshake is enabled only if FIFO is enabled EXAMPLE include tdrv002 h int fd int retval 7 Disable hardware handshake retval ioctl fd FIOHWHS TDRV002 HWHS DISABLE if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device S tdrv002Drv ILLPARAM Illegal handshake mode specified S tdrvO02Dry MODENOTSUPP The hardware does not support the specified mode TDRV002 SW 42 VxWorks Device Driver Page 39 of 65 TEWS LE TECHNOLOGIES 5 5 6 FIOSETBREAK This I O control function sets or resets break state on transmit line The function specific control parameter arg specifies the state on transmit line The following values are defined Value Description TDRV002 BREAK SET Set break on transmit line s TDRVOO2 BREAK RESET Reset break on transmit line s EXAMPLE include tdrv002 h int fd int retval Set break on Tx line s xy retval ioctl fd FIOSETBREAK TDRV002 BREAK SET if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device S_tdrv002Drv_ILLPARAM Illegal parameter
2. The error code is a standard error code set by the I O system see VxWorks Reference Manual SEE ALSO ioLib basic VO routine write TDRV002 SW 42 VxWorks Device Driver Page 32 of 65 5 5 ioctl NAME ioctl performs an I O control function SYNOPSIS include tdrv002 h int ioctl int fd int request TDRV002 IOCTL ARG T arg DESCRIPTION TEWS LE TECHNOLOGIES Special VO operation that do not fit to the standard basic I O calls read write will be performed by calling the ioctl function 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 The TDRVO002 device driver uses the standard tty driver support library tyLib For details of supported ioctl functions see VxWorks Reference Manual tyLib and VxWorks Programmer s Guide VO System Following additional functions are defined Function FIODATABITS FIOSTOPBITS FIOPARITY FIOHWHS FIOSETBREAK FIOSETMODEM FIOSETCLEARMODEM FIOGETMODEM FIOWAITMODEMSTATE TDRV002 SW 42 VxWorks Device Driver Description Set length of data word Set length of the stop bit Set parity checking mode Enable Disable hardware handshake mode Set Release Break Sets specified modem control lines Clears specified modem control lines Returns the state of the modem control lines Wait for a specifie
3. TEWS The Embedded VO Company TECHNOLOGIES TDRV002 SW 42 VxWorks Device Driver Multiple Channel Serial Interface Version 2 7 x User Manual Issue 2 7 0 February 2013 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek Germany Phone 49 0 4101 40580 Fax 49 0 4101 4058 19 e mail info tews com www tews com TDRV002 SW 42 VxWorks Device Driver Multiple Channel Serial Interface Supported Modules TPMC371 TPMC372 TPMC375 TPMC376 TPMC377 TPMC460 TPMC461 TPMC462 TPMC463 TPMC465 TPMC466 TPMC467 TPMC470 TCP460 TCP461 TCP462 TCP463 TCP465 TCP466 TCP467 TCP469 TCP470 TXMC375 TDRV002 SW 42 VxWorks Device Driver TEWS amp TECHNOLOGIES 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 2004 2013 by TEWS TECHNOLOGIES GmbH Page 2 of 65 TEWS TECHNOLOGIES Issue Description Date 1 0 First Issue TPMC461 SW 42 July 14 2004 1 1 0 Driver Name changed to TDRV002 January 18 2005 1 2 0 Local Loopback Mode and Selftest ad
4. TDRV002 PARITY MARK TDRV002 PARITY SPACE Hardware handshake TDRV002 HWHS DISABLE TDRV002 HWHS ENABLE TDRV002 SW 42 VxWorks Device Driver word length 5 bit word length 6 bit word length 7 bit word length 8 bit stop bit length 1 bit stop bit length 1 5 bit only data length 5 stop bit length 2 bit only data length 6 7 8 parity is disabled odd parity is used even parity is used a mark parity bit is used a space parity bit is used hardware handshake is disabled hardware handshake is enabled only if FIFO is enabled Page 20 of 65 TEWS amp TECHNOLOGIES FIFO mode TDRVOO2 FIFO DISABLE Hardware FIFO is disabled TDRVOO2 FIFO ENABLE Hardware FIFO is enabled Receiver and transmitter trigger level must be set in rxFSize and txFSize Local loopback mode TDRVOO2 LOCALLOOP DISABLE Disable local loopback mode TDRVOO2 LOCALLOOP ENABLE Enabled local loopback mode Interface configuration only valid for programmable VO interfaces A combination of the flags below must be specified to configure the interface TDRVOO2 TRANS RS485 RS232 SEL RS485 RS232 configuration pin TDRVOO2 TRANS HDPLX SEL HDPLX configuration pin TDRV002 TRANS RENA SEL RENA configuration pin TDRVOO2 TRANS RTERM SEL RTERM configuration pin TDRVOO2 TRANS TTERM SEL TTERM configuration pin TDRV002 TRANS SLEWLIMIT SEL SLEWLIMIT configuration pin TDRV002 TRANS SHDN SEL SHDN configuration pin TDRVOO2 AUTO RS4
5. The right place to call the function tdrv002Pcilnit is at the end of the function sysHwinit in sysLib c it can be opened from the project Files window Be sure that the function is called prior to MMU initialization otherwise the TDRV002 PCI spaces remains unmapped and an access fault occurs during driver initialization Please insert the following call at a suitable place in sysLib c tdrv002PciInit Modifying the sysLib c file will change the sysLib c in the BSP path Remember this for future projects and recompilations TDRV002 SW 42 VxWorks Device Driver Page 12 of 65 TEWS amp TECHNOLOGIES 2 4 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 1KB Semaphores 1 10 A semaphore is needed while waiting for a full modem state The specified requirements are specific to the driver The VxWorks terminal manager will require extra resources for each device 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 total requirement driver requirement 4 number of devices device requirement The maximum usage of some resources is limited by adjustable parameters If the application and driv
6. timeout TEWS LE TECHNOLOGIES This value specifies the time in unit ticks the function is willing to wait for a specified state before it returns with an error A value of WAIT FOREVER means wait for ever modemState The returned value shows the current state of the modem and status lines The returned status is an OR ed value of the Value TDRV002_MCTL_RTS TDRV002_MCTL_DTR TDRV002_MCTL_CTS TDRV002_MCTL_DSR TDRV002_MCTL_RI TDRV002_MCTL_CD EXAMPLE include tdrv002 h following flags Description If set RTS is in active state If set DTR is in active state If set CTS is in active state If set DSR is in active state If set Rl is in active state If set CD is in active state int fd int retval TDRVOO2 WAITMODEM BUFFER waitBuf Wait for an active DT R line or a passive CTS line waitBuf lineMask waitBuf lineTargetStat sy TDRV002 MCTL DIR TDRV002 MCTL CTS TDRV002 MCTL DTR waitBuf timeout 1000 retval ioctl fd FIOWAITMODEMSTATE TDRVOO2 IOCTL ARG T amp waitBuf if retval ERROR check DTR state sy if waitBuf modemState amp TDRVOO02 MCTL DTR else DTR is active if waitBuf modemState amp TDRVOO02 MCTL CTS CTS is active TDRV002 SW 42 VxWorks Device Driver Page 45 of 65 TEWS TECHNOLOGIES handle the error ERROR C
7. 6 7 target config comps vxWorks In VxWorks 6 7 and newer releases the kernel configuration tool scans the CDF file automatically and updates the CxrCat txt cache file to provide component parameter information for the kernel configuration tool as long as the timestamp of the copied CDF file is newer than the one of the CxrCat txt If your copy command preserves the timestamp force to update the timestamp by a utility such as touch In earlier VxWorks releases the CxrCat txt file may not be updated automatically In this case remove or rename the original CxrCat txt file and invoke the make command to force recreation of this file C gt cd Windriver vxworks 6 7 target config comps vxWorks C gt del CxrCat txt C gt make Using the TDRV002 serial channels needs an adaptation of the maximum number of serial ports Refer to 2 2 2 Modification of the Number of serial ports After successful completion of all steps above and restart of the Wind River Workbench the TDRV002 driver can be included in VxWorks projects by selecting the TEWS TDRV002 Driver component in the hardware default Device Drivers folder with the kernel configuration tool TDRV002 SW 42 VxWorks Device Driver Page 10 of 65 TEWS LE TECHNOLOGIES 2 2 1 Direct BSP Builds In development scenarios with the direct BSP build method without using the Workbench or the vxprj command line utility the TDRVOO2 configuration stub files must be copie
8. It is not made by the driver and the description of the port ordering above is not valid for the VxBus version of the driver See also the chapter 3 1 Assignment of Port Names raBufSize This value specifies the size of the receive software FIFO For further information of setting the FIFO trigger levels please refer to 2 5 Configuration of FIFO Trigger Levels wrtBufSize This value specifies the size of the transmit software FIFO For further information of setting the FIFO trigger levels please refer to 2 5 Configuration of FIFO Trigger Levels TDRV002 SW 42 VxWorks Device Driver Page 19 of 65 devConf TEWS LE TECHNOLOGIES This parameter points to a structure TDRV002 CHANCONFIG containing the default configuration of the channel This function will be used for reconfigurations typedef struct unsigned int baudrate unsigned int comPara unsigned char rxFSize unsigned char txFSize int options TDRV002_CHANCONFIG baudrate Selects the initial baud rate of the channel Allowed values depend on hardware comPara This value is a field of ORed definitions specifying the channel setup One value of every group must be ORed into the value Number of data bits TDRV002_DATABIT_5 TDRVOO2 DATABIT 6 TDRVOO2 DATABIT 7 TDRVOO2 DATABIT 8 Length of stop bit TDRVOO2 STOPBIT 1 TDRV002 STOPBIT 1 5 TDRV002 STOPBIT 2 Parity mode TDRV002 PARITY NO TDRV002 PARITY ODD TDRV002 PARITY EVEN
9. RE nnns 61 6 2 Internal Eoopback EER EE OE OE EE OE EO 64 6 3 Additional Error Codes EE ee EES 65 TDRV002 SW 42 VxWorks Device Driver Page 5 of 65 TEWS amp TECHNOLOGIES 1 Introduction The TDRV002 SW 42 VxWorks device driver software allows the operation of the supported modules conforming to the VxWorks I O system specification This includes a device independent basic I O interface with open close read write and ioctl functions and a buffered I O interface fopen fclose fprintf fscanf Special I O operation that do not fit to the standard I O calls will be performed by calling the ioctl function with a specific function code and an optional function dependent argument The TDRV002 SW 42 release contains independent driver sources for the old legacy pre VxBus and the new VxBus enabled driver model The VxBus enabled driver is recommended for new developments with later VxWorks 6 x release and mandatory for VxWorks 64 bit and SMP systems The TDRVOO2 driver includes the following functions supported by the VxWorks tty driver support library for pre VxBus systems or the sio driver library for VxBus compatible systems ring buffering of input and output raw mode optional line mode with backspace and line delete functions optional processing of X on X off optional RETURN LINEFEED conversion optional echoing of input characters optional stripping of the parity bit from 8 bit input optional
10. S_tdrv002Drv_ILLPARAM Illegal parameter specified TDRV002 SW 42 VxWorks Device Driver Page 49 of 65 TEWS LE TECHNOLOGIES 5 5 14 FIOLOCALSELFTEST This VO control function executes a local selftest of the specified device The local loopback mode will be used to check the communication and all local VO signals RXD TxD RTS CTS DTR DSR RI CD are used For a description of the local loopback wiring refer to 6 2 Internal Loopback The function can be executed with application supplied Rx Tx buffers or with driver allocated buffers The function will return a status if the test has been executed The function specific control parameter arg points to a supplied buffer TDRVOO2 LOCALSELFTEST BUFFER The following values are defined typedef struct char transmitBuffer int transmitSize char receiveBuffer int receiveSize int receiveCount unsigned int status TDRV002 LOCALSELFTEST BUFFER transmitBuffer This is a pointer to a buffer with data that should be transmitted with the local loopback test This allows the application to check the transmitted data and select the content and size of the test data transmitSize This argument specifies the size of the transmitBuffer If this argument is set to O or to a negative value the driver will allocate a buffer and create test data automatically If automatically allocated buffers are used the parameters transmitBuffer receiveBuffer receiveSize and receiveCount will be
11. T amp selftestBuf if retval ERROR function succeeded if selftestBuf status else No problems found Check status flags TDRV002 SW 42 VxWorks Device Driver Page 51 of 65 TEWS TECHNOLOGIES else handle the error Execute local Selftest with internal buffers selftestBuf transmitSize 0 retval ioctl fd FIOLOCALSELFTEST TDRV002 IOCTL ARG T amp selftestBuf if retval ERROR function succeeded if selftestBuf status Check status flags No problems found else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device S tdrv002Drv NOMATCHBUF Receive buffer is smaller than the transmit buffer TDRV002 SW 42 VxWorks Device Driver Page 52 of 65 5 5 15 FIOSETINTERFACE TEWS LE TECHNOLOGIES This I O control function sets a new I O interface configuration This function is only usable for devices supporting a programmable I O interface The function specific control parameter arg specifies the new configuration of the programmable transceivers Only allowed for channels supporting a programmable I O interface A combination of the flags below must be specified to configure the interface Value TDRV002 TRANS RS485 RS232 SEL TDRV002 TRANS HDPLX SEL TDRVOO2 TRANS RENA SEL TDRV002 TRANS
12. and cannot be included with the kernel configuration tool in a Wind River Workbench project To make the driver configurable the driver library for the desired processer CPU and build tool TOOL must be built in the following way 1 Open a VxWorks development shell e g CAWindRiverwrenv exe p vxworks 6 7 2 Change into the driver installation directory installDir vxworks 6 x target 3rdparty tews tdrv002 3 Invoke the build command for the required processor and build tool make CPU cpuName TOOL tool TDRV002 SW 42 VxWorks Device Driver Page 9 of 65 TEWS LE TECHNOLOGIES For Windows hosts this may look like this C gt cd WindRiver vxworks 6 7 target 3rdparty tews tdrv002 C gt make CPU PENTIUM4 TOOL diab To compile SMP enabled libraries the argument VXBUILD SMP must be added to the command line C make CPU PENTIUM4 TOOL diab VXBUILD SMP To build 64 bit libraries the argument VXBUILD LP64 must be added to the command line make TOOL gnu CPU CORE VXBUILD LP64 For 64 bit SMP enabled libraries a build command may look like this make TOOL gnu CPU CORE VXBUILD LP64 SMP To integrate the TDRVO020O driver with the VxWorks development tools Workbench the component configuration file 40tdrv002 cdf must be copied to the directory installDir vxworks 6 x target config comps Vx Works C gt cd MWindRiverNvxworks 6 7 NtargetN3rdpartyNtewsNtdrv002 C gt copy 40tdrv002 cdf Windriver vxworks
13. h tdrv002 h Makefile 40tdrv002 cdf tdrv002 dc tdrv002 dr include tvxbHal h apps tdrv002exa c TDRV002 device driver source TDRVOO2 driver include file TDRVOO2 include file for driver and application Driver Makefile Component description file for VXWorks development tools Configuration stub file for direct BSP builds Configuration stub file for direct BSP builds Hardware dependent interface functions and definitions Example application The archive TDRV002 SW 42 LEGACY zip contains the following files and directories Directory path tdrv002 tdrvOO2drv c tdrv002 h tdrvOO2def h tdrv002exa c tdrvOO2pci c include tdhal h TDRVOO2 Driver Source TDRVOO2 Application Include File TDRVOO2 Driver Include File Example Application TDRVOO2 PCI MMU mapping for Intel x86 based targets Include for hardware dependent functions For installation the files have to be copied to the desired target directory TDRV002 SW 42 VxWorks Device Driver Page 8 of 65 TEWS LE TECHNOLOGIES 2 1 Legacy vs VxBus Driver In later VxWorks 6 x releases the old VxWorks 5 x legacy device driver model was replaced by VxBus enabled device drivers Legacy device drivers are tightly coupled with the BSP and the board hardware The VxBus infrastructure hides all BSP and hardware differences under a well defined interface which improves the portability and reduces the configuration effort A further advantage is the improved performance of A
14. ignored receiveBuffer This is a pointer to a buffer that will return the locally transmitted data This buffer can be used to compare received and transmitted data receiveSize This argument specifies the size of the receive buffer The size of the receive buffer must be at least as big as the transmit buffer receiveCount This is the count of characters that have been received during the selftest The returned value should be the same as transmitSize TDRV002 SW 42 VxWorks Device Driver Page 50 of 65 TEWS TECHNOLOGIES status This is a bit field specifying the found problems The status is an OR ed value of the following flags Status Flag Description TDRV002_STATUS_LS_TXRX Problem with TxD RxD communication TDRV002_STATUS_LS_RTSCTS Problem with RTS CTS connection TDRV002_STATUS_LS_DTRDSR Problem with DTR DTS connection TDRV002_STATUS_LS_RI Problem with RI states TDRV002_STATUS_LS_CD Problem with CD states EXAMPLE include tdrv002 h int fd int retval TDRV002_LOCALSELF TEST BUFFER selftestBuf char txBuf 128 char rxBuf 150 Execute local selftest with application supplied buffers ty selftestBuf transmitBuffer txBuf selftestBuf transmitSize 128 selftestBuf receiveBuffer rxBuf selftestBuf receiveSiz 150 selftestBuf receiveCount 0 retval ioctl fd FIOLOCALSELFTEST TDRV002 IOCTL ARG
15. integrated to the VxWorks system and the devices will be automatically created when booting VxWorks 3 1 Assignment of Port Names The port names are assigned automatically when the ports are created The assigned port name will be tyCo lt n gt where n specifies the port number Generally the first two port numbers tyCo 0 tyCo 1 are assigned to system ports and the additional ports on the TDRVO002 supported boards will start with port number 2 For example a system with one TPMC462 4 channels will assign the following device names fyCo 0 1 system port tyCo 1 2 system port tyCo 2 1 channel of TPMC462 AtyCo 3 2 channel of TPMC462 AtyCo 4 3 channel of TPMC462 tyCo 5 4 channel of TPMC462 If there is more than one supported TDRV002 board installed the assignment of the channel numbers to the boards depends on the search order of the system but all the channels of one board will follow up in a row For example a system with one TPMC462 4 channels and one TPMC372 4 channels may assign the following two device names tables TPMC462 found first TPMC372 found first fyCo 0 17 system port 1 system port tyCo 1 2 system port 2 system port tyCo 2 1 channel of TPMC462 1 channel of TPMC372 tyCo 3 2 channel of TPMC462 2 channel of TPMC372 tyCo 4 3 channel of TPMC462 3 channel of TPMC372 tyCo 5 4 channel of TPMC462 4 channel of TPMC372 tyCo 6 1 c
16. special characters for shell abort and system restart VVVVVVVV Additionally the following functions are supported if the channel supports this function select FIFO triggering point use 5 8 bit data words use 1 1 5 or 2 stop bits optional even or odd parity enable disable hardware handshake only in FIFO mode control full modem lines check and wait for control and modem line states changing Baud Rates enabling disabling local loopback mode local self test changing I O interface only programmable interfaces VVVVVVVVV VV The TDRV002 SW 42 supports the modules listed below TPMC371 8 Channel Serial Interface TPMC372 4 Channel Serial Interface TPMC375 8 Channel Serial Interface programmable Interfaces TPMC376 4 Channel Serial Interface programmable Interfaces TPMC377 4 Channel Isolated Serial Interface programmable Interfaces TPMC460 16 Channel Serial Interface continued TDRV002 SW 42 VxWorks Device Driver Page 6 of 65 TEWS LE TECHNOLOGIES TPMC461 8 Channel Serial Interface TPMC462 4 Channel Serial Interface TPMC463 4 Channel Serial Interface TPMC465 8 Channel Serial Interface programmable Interfaces TPMC466 4 Channel Serial Interface programmable Interfaces TPMC467 4 Channel Serial Interface programmable Interfaces TPMC470 4 Channel Isolated Serial Interface programmable Interfaces TCP460 16 Channel Serial Interface TCP461 8 Channel Serial Interface TCP462 4 Channel Serial Inter
17. vee 4 2 tdrv002DevCreat sessie ese se Ek EN eed Nd ees ee ER awe ee HEER 4 3 tdrvOO2PcilniL lee RE ee Ee esee reru GE GE N ARE GR GR GEGEE KERR X SER Ge Ge RE Ke 5 BASIC VO FUNCTIONS ii sussa Gass oue tinus enc Bee Sewes Si RES ee De SA OPE EE EE EE EE EE EE 5 2 ClOSE 5 EE EE eet ere ee eee 5 3 OA NECEM Ly Ege 5 5 eroi pr DECORIS MEM 556 JFIOSETBREANK tet ttt eb et Yee th ed Ais 557 BIOSETMOBDEM 2 tienen eder ed ries 5 5 8 HOCLEARMODEN eee ee ee ee ee ee emen 5 5 9 HOGETMODE M cee ese ee se ee se ee ee ee ee ee ee ee Ge eene nennen 5 5 10 FIOWAITMODEMSTATE eee eene 5 5 11 FIORECONFIGURE esee ener 55 12 iIOSTATUS irte dnte tr er Vee ee ee Ee ee week Di 5 5 13 FIOLOCALLOOP ee ee ee ee ee Ge RA RA RR nre 5 5 14 FIOLOCGALSELFTEST ees ese ee se ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee eke ee 5 5 15 FIOSETINTERFACE 0 00 eee se ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee eke ee 5 5 16 FIOSETFIFOTRIGGER esse ese ee se ee ee ee ee ee ee ee ee ee ee ee ee ee eke ee 5 5 17 FIOCHANNELINFO ee se ee ee ee ee ee ee ee ee ee nemen TDRV002 SW 42 VxWorks Device Driver TEWS amp TECHNOLOGIES Page 4 of 65 TEWS amp TECHNOLOGIES MES eie N 61 6 1 Debugging Driver and DeviceS esse EER ER RE RR RR RE REG RR RE REG RR KERE Ge RR KERE Ge AR RE Re GR RR nnnm RR KEER Ge RR
18. vxDev 0x492708 Associated Devices 0 TPMC467 Channel 0 tyCo 2 Channel 1 tyCo 3 Channel 2 tyCo 4 Channel 3 tyCo 5 1 TPMC461 Channel 0 tyCo 6 Channel 1 tyCo 7 Channel 2 tyCo 8 Channel 3 tyCo 9 Channel 4 tyCo 10 Channel 5 tyCo 11 Channel 6 tyCo 12 Channel 7 tyCo 13 TDRV002 SW 42 VxWorks Device Driver Page 61 of 65 TEWS TECHNOLOGIES Device Statistics tyCo 2 Interrupt Count Transmitted Chars Received Chars Error Count Configuration tyCo 3 Interface max Baudrate Baudrate Data Stopbits Parity Local Loopback Interrupt Count Transmitted Chars Received Chars Error Count Configuration tyCo 4 Interface max Baudrate Baudrate Data Stopbits Parity Local Loopback Interrupt Count Transmitted Chars Received Chars Error Count Configuration tyCo 5 Interface Interrupt Count Transmitted Chars Received Chars Error Count Configuration Interface 733 20480 20480 RS232 programmable 44236800 115200 8 1 None enabled CO O CO coc RS485 HD 44236800 9600 8 1 None disabled O OO CH OFF programmable O O OO OFF programmable programmable TDRV002 SW 42 VxWorks Device Driver Page 62 of 65 TEWS TECHNOLOGIES tyCo 6 Interrupt Count Transmitted Chars Received Chars Error Count Configuration tyCo 7 Interface max B
19. 0002 Driver not installed S tdrv0O2Drv NOMEM 0x04610003 Allocating memory failed S tdrv002Drv BUSY 0x04610004 Driver is busy devices are open or an other already blocks function S tdrv00O2Drv NODEV 0x04610005 Channel number is not valid S tdrv002Drv EXISTS 0x04610006 Device already created S tdrv002Drv ILLBAUD 0x04610007 Invalid baud rate specified refer to your hardware manual S tdrv002Drv ILLPARAM 0x04610008 An invalid parameter value specified S tdrvO02Drv MODENOTSUP 0x04610009 Mode not supported the hardware does not support the mode refer to your hardware manual S tdrv002Drv CONFERR 0x0461000A Configuration is not allowed hardware handshake is only supported with enabled FIFO S tdrv002Drv SELFTESTBUS 0x0461000B Self test failed S tdrv002Drv NOMATCHBUF 0x0461000C Self test recognized differences between sent and received data S tdrv002Drv ILLINTF 0x0461000D Specified interface is invalid S tdrv002Drv NOTSUPP 0x0461000E Function is not supported TDRV002 SW 42 VxWorks Device Driver Page 65 of 65
20. 024 byte 115200Baud 8 T off off enabled more than 30 characters in FIFO less than 10 characters in FIFO off raw mode RS232 f tdrv002conf baudrat tdrv002conf comPara TDRVOO2 DATABIT 8 tdrv002conf rxFSize tdrv002conf txFSize tdrv002conf options e 115200 TDRV002 STOPBIT 1 TDRV002 PARITY NO RVOO2 HWHS DISABL TDRV002 FIFO ENABLE TDRV002 LOCALLOOP DISABLE TDRV002 INTE RS232 305 lw pd e e mo ie result tdrv002DevCreate tyCo 2 0 1024 1024 if result OK else Error occur Device successfully created red when creating the device amp tdrv002conf TDRV002 SW 42 VxWorks Device Driver Page 22 of 65 RETURNS TEWS LE TECHNOLOGIES OK or ERROR If the function fails an error code will be stored in errno ERROR CODES The error codes are stored in errno and can be read with the function errnoGet Error code S tdrv002Drv NODRV S tdrv002Drv NODEV S tdrv002Drv EXISTS S tdrv002Drv ILLINTF S tdrv002Drv ILLBAUD S_tdrv002Drv_ILLPARAM S tdrv002Drv MODENOTSUPP S tdrv002Drv CONFERR SEE ALSO VxWorks Programmer s Guide VO System TDRV002 SW 42 VxWorks Device Driver Description The TDRV002 driver is not installed Specified device not found The specified device has already been created Illegal interface specified Illegal default baud rate specified Illegal parameter
21. 1 if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device S_tdrv002Drv_ILLPARAM Illegal data stop bit length specified TDRV002 SW 42 VxWorks Device Driver Page 37 of 65 5 5 4 FIOPARITY TEWS LE TECHNOLOGIES This VO control function sets the parity mode The function specific control parameter arg specifies the new parity mode The following values are defined Value TDRV002 PARITY NO TDRVOO2 PARITY ODD TDRV002 PARITY EVEN TDRV002 PARITY MARK TDRV002 PARITY SPACE EXAMPLE include tdrv002 h int fd int retval Configure channel no parity retval ioctl fd FIOPARITY if retval ERROR function succeeded else handle the error ERROR CODES Error Code S tdrvoO2Drv SELFTESTBUSY S tdrv0O02Drv ILLPARAM TDRV002 SW 42 VxWorks Device Driver Wi TDRV002 PARITY NO Description parity is disabled odd parity is used even parity is used a mark parity bit is used a space parity bit is used Description Self test mode is active for the device Illegal parity mode specified Page 38 of 65 TEWS LE TECHNOLOGIES 5 5 5 FIOHWHS This I O control function enables or disables the hardware handshake The function specific control parameter arg specifies if the hardware handshake shall be enabled or disabled The following values
22. 85 SEL ENABLE enable Auto RS485 Operation mode of XR17D15x The function of the interface configuration pins can be found in the corresponding hardware User Manual There are predefined values of the interface configuration described in the hardware manual you can just OR the predefined value instead of a list of configuration flags Below is a list of the values TDRVOO2 INTF OFF interface disabled TDRVO002 INTE RS232 RS232 TDRVOO2 INTE RS422 RS422 Multidrop Full duplex TDRVOO2 INTF RS485FDM RS485 Full duplex master TDRVOO2 INTF RS485FDS RS485 Full duplex slave TDRVOO2 INTE RS485HD RS485 Half duplex rxF Size Specifies the HW receiver trigger level if the HW FIFO is enabled Allowed values depend on the HW FIFO size 1 64 for TPMCxxx and TCPxxx or 1 256 for TXMCxxx txFSize Specifies the HW transmitter trigger level if the HW FIFO is enabled Allowed values depend on the HW FIFO size 1 64 for TPMCxxx and TCPxxx or 1 256 for TXMCxxx options Selects the initial VxWorks driver options Please refer to VxWorks manuals TDRV002 SW 42 VxWorks Device Driver Page 21 of 65 TEWS TECHNOLOGIES EXAMPLE include tdrv002 h STATUS TDRVOO2 CHANCONF result tdrv002conf Create the devic tyCo 2 on channel 0 read and writ Baudrate Databits Stopbits Parity Handshake FIFOs Rx Trigger Tx Trigger Local Loop Options I O interface buffer sizes of 1
23. ETURNS Number of bytes read 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 read TDRV002 SW 42 VxWorks Device Driver Page 30 of 65 TEWS E TECHNOLOGIES 5 4 write NAME write write data from a buffer to a specified device SYNOPSIS int write int fd char buffer size t nbytes DESCRIPTION This function can be used to write data to the device PARAMETER fd This file descriptor specifies the device to be used The file descriptor has been returned by the open function buffer This argument points to a user supplied buffer The data of the buffer will be written to the device nbytes This parameter specifies the number of bytes to be written EXAMPLE int fd char buffer Hello World int retval TDRV002 SW 42 VxWorks Device Driver Page 31 of 65 TEWS LE TECHNOLOGIES Write data to a TDRV002 device sy retval write fd buffer strlen buffer if retval ERROR printf d bytes written n retval else handle the writ rror RETURNS Number of bytes written 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
24. ODES Error Code Description S tdrv0O2Drv SELFTESTBUSY Self test mode is active for the device S_tdrv002Drv_ILLPARAM A specified parameter is not allowed lineMask 0 S tdrv002Drv BUSY An other task is already waiting for modem line status TDRVOO2 SW 42 VxWorks Device Driver Page 46 of 65 5 5 11 FIORECONFIGURE This VO control function resets the device parameter arg is not used for this function EXAMPLE include tdrv002 h int fd int retval Reconfigure serial channel TEWS LE TECHNOLOGIES to the default configuration The function specific control retval ioctl fd FIOR df ERROR retval function succeeded else handle the error ERROR CODES Error Code S tdrvO02Drv SELFTESTBUSY TDRV002 SW 42 VxWorks Device Driver ECONF IGURE Ar Description Self test mode is active for the device Page 47 of 65 5 5 12 FIOSTATUS TEWS amp TECHNOLOGIES This I O control function returns the state of the device The function specific control parameter arg points to a buffer unsigned int the status will be returned The returned status is an OR ed value of the following flags Value TDRV002 STATUS FRAMINGERR TDRV002 STATUS PARITYERR TDRV002 STATUS OVERRUNERR TDRV002 STATUS PENDBREAK EXAMPLE include tdrv002 h int fd int retval unsigned int inStat Get receive status T r
25. PI calls by using the method interface and bypassing the VxWorks basic I O interface VxBus enabled device drivers are the preferred driver interface for new developments The checklist below will help you to make a decision which driver model is suitable and possible for your application Legacy Driver VxBus Driver VxWorks 5 x releases VxWorks 6 6 and later releases VxWorks 6 5 and earlier DUSEL releases SMP systems only the VxBus iver i d VxWorks 6 x releases without divers SME Sale VxBus PCI bus support 64 bit systems only the VxBus driver is 64 bit compatible TEWS TECHNOLOGIES recommends not using the VxBus Driver before VxWorks release 6 6 In previous releases required header files are missing and the support for 3 party drivers may not be available 2 2 VxBus Driver Installation Because Wind River doesn t provide a standard installation method for gu party VxBus device drivers the installation procedure needs to be done manually In order to perform a manual installation extract all files from the archive TDRV002 SW 42 VXBUS zip to the typical 3 party directory installDir vxworks 6 x target 3rdparty whereas installDir must be substituted by the VxWorks installation directory After successful installation the TDRVOO02 device driver is located in the vendor and driver specific directory installDir vxworks 6 x target 3rdparty tews tdrv002 At this point the TDRVO0O2 driver is not configurable
26. RIPTION TEWS LE TECHNOLOGIES Before VO can be performed to the TDRV002 device a file descriptor must be opened by invoking the basic I O function open PARAMETER name Specifies the device which shall be opened For the legacy driver version the name specified in tdrvOO2DevCreate must be used For the VxBus driver version the system assigned device name must be used See also 3 1 Assignment of Port Names flags Not used mode Not used TDRV002 SW 42 VxWorks Device Driver Page 25 of 65 EXAMPLE int fd Open the device named tyCo 2 for I O fd open tyCo 2 0 0 if fd ERROR error handling RETURNS TEWS LE TECHNOLOGIES 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 TDRV002 SW 42 VxWorks Device Driver Page 26 of 65 TEWS E TECHNOLOGIES 5 2 close NAME close close a device or file SYNOPSIS STATUS 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 STATUS retval close t
27. RTERM SEL TDRV002 TRANS TTERM SEL TDRVOO2 TRANS SLEWLIMIT SEL TDRV002 TRANS SHDN SEL TDRV002 AUTO RS485 SEL ENABLE Description RS485 RS232 configuration pin HDPLX configuration pin RENA configuration pin RTERM configuration pin TTERM configuration pin SLEWLIMIT configuration pin SHDN configuration pin enable Auto RS485 Operation XR17D15x mode of The function of the interface configuration pins can be found in the corresponding hardware User Manual There are predefined values of the interface configuration described in the hardware manual you can just OR the predefined value instead of a list of configuration flags Below is a list of the values Value TDRV002_INTF_OFF TDRV002_INTF_RS232 TDRV002_INTF_RS422 TDRV002_INTF_RS485FDM TDRV002_INTF_RS485FDS TDRV002_INTF_RS485HD TDRV002 SW 42 VxWorks Device Driver Description interface disabled RS232 RS422 Multidrop Full duplex RS485 Full duplex master RS485 Full duplex slave RS485 Half duplex Page 53 of 65 TEWS TECHNOLOGIES EXAMPLE include tdrv002 h int fd int retval Set I O interface for RS485 half duplex retval ioctl fd FIOSETINTERFACE TDRV002 INTE RS485HD if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device S
28. RV002 SW 42 VxWorks Device Driver Page 3 of 65 Table of Contents 1 geteilt D 2 INSTALLATION siese ede Ge N KG ri ka vi car vu N 2 1 Legacy vs VxBus Driver esse eens ee EE Re EE EE RE EE EE EE RE GE ER EE RE Ge ER EE EE Ge Ke EE EE ee 2 2 VxBus Driver Installation esse sees ee ER Ge AR EE EE EE AN Ge EE ER RR Ge EK EE EE EE kk ae 2 2 1 Direct BSP Buden 2 2 2 Modification of the Number of serial ports 2 3 Legacy Driver Installation ee ese ee EE RE RR RE RE RR RE RE GR AR RE RE GE RR RE RE Ge RR RE EE ae 2 3 1 Include Device Driver in VxWorks Projects 2 3 2 Special Installation for Intel x86 based Targets 2 4 System Resource Requirement RE EE KERE AR KRAAK RAGE ER EE AE Ka 2 5 Configuration of FIFO Trigger Level see esse ee ke AR Ke ER eere 3 VXBUS DRIVER SUPPORT ese sae ses ao ske see ses oe Ne UI N esse ed 3 1 Assignment of Port Names RR EER RR RE RE GR RR RE RE Ge RR KERE Ge RR RE Ee ae 3 2 VxBus Error Codes ee esse kes Ge ee ee ki ae Se cx E BE GE ke EE De nnna 3 3 Default Configuration esse ene Rae EE RE AR RA AR RAAR RE ER KERE AR KRAAK RAGE Ee AE RE ae 3 4 Compatibility to pre VxBus Applications eise ee ses see Re Ge AE ee 4 LEGACY I O SYSTEM FUNCTIONS see ee EE 4 1 tdrvOO2Dryv RE EE EE OE OE EE OE
29. audrate Baudrate Data Stopbits Parity Local Loopback Interrupt Count Transmitted Chars Received Chars Error Count Configuration continues for tyCo 8 to tyCo 13 Interface max Baudrate Baudrate Data Stopbits Parity Local Loopback CoO OO RS232 0 9600 8 1 None disabled O O OO RS232 0 9600 B 1 None disabled TDRV002 SW 42 VxWorks Device Driver Page 63 of 65 TEWS amp TECHNOLOGIES 6 2 Internal Loopback The internal loopback mode connects output lines with input lines of the corresponding channel This allows testing the software and general board access without any external wiring If internal loopback is enabled all VO lines can be used regardless if they are supported by board VO or not Transmit Shift TX 7 0 Register Receive Shift Register RX 7 0 2 o g s RTS 7 0 o ke S g Bi c o o S CTS 7 0 p 3 3 o a DTR 7 0 3 E Ss 8 DSR 7 0 E 9 RI 7 0 o CD 7 0 TDRV002 SW 42 VxWorks Device Driver Page 64 of 65 TEWS amp TECHNOLOGIES 6 3 Additional Error Codes If the device driver creates an error the error codes are stored in the errno They can be read with the VxWorks function errnoGet or printErrno These error codes are only available when using the TDRV002 legacy driver Symbol Name Value Description S_tdrv002Drv_NXIO 0x04610001 No supported devices found S tdrv002Drv NODRV 0x0461
30. d state on modem or control line Page 33 of 65 TEWS LE TECHNOLOGIES FIORECONFIGURE Reconfigure device with the default parameters FIOSTATUS Get state of the device FIOLOCALLOOP Enable Disable local loopback mode FIOLOCALSELFTEST Execute a local self test FIOSETINTERFACE Change the programmable VO interface FIOCHANNELINFO Returns information regarding the specified channel arg This parameter depends on the selected function request 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 SEE ALSO ioLib basic VO routine ioctl TDRVOO2 SW 42 VxWorks Device Driver Page 34 of 65 5 5 1 FIOBAUDRATE TEWS LE TECHNOLOGIES This VO control function sets up a new baudrate The function specific control parameter arg specifies the new baudrate EXAMPLE include tdrv002 h int fd int retval Set baud rate to 9600 retval ERROR if retval else handle the error ERROR CODES Error Code function succeeded ioctl fd FIOBAUDRATE S_tdrv002Drv_SELFTESTBUSY S_tdrv002Drv_ILLBAUD TDRV002 SW 42 VxWorks Device Driver 9600 Description Self test mode is active for the device Illegal baud rate specified Page 35 of 65 5 5 2 FIODATABITS TEWS LE TECHNOLOGIES Thi
31. d to the directory installDir vxworks 6 x target config comps src hwif Afterwards the vxbUsrCmaLine c file must be updated by invoking the appropriate make command C gt cd WindRiver vxworks 6 7 target 3rdparty tews tdrv002 C gt copy tdrv002 dc Windriver vxworks 6 7 target config comps src hwif C gt copy tdrv002 dr Windriver vxworks 6 7 target config comps src hwif C gt cd Windriver vxworks 6 7 target config comps src hwif C gt make vxbUsrCmdLine c 2 2 2 Modification of the Number of serial ports The new number of serial ports must be specified in the configuration tool By default only the local serial ports e g 2 ports will be set up To support the additional TDRVOO2 ports the value of hardware peripherals serial SlO number of serial ports NUM TTY must be set to the total number of installed serial ports For example if there are two local ports and a TPMC461 with 8 ports should be supported the value must be set to 10 TDRVOO2 SW 42 VxWorks Device Driver Page 11 of 65 TEWS E TECHNOLOGIES 2 3 Legacy Driver Installation 2 3 1 Include Device Driver in VxWorks Projects For including the TDRVOO2 SW 42 device driver into a VxWorks project e g Tornado IDE or Workbench follow the steps below 1 Extract all files from the archive TDRV002 SW 42 LEGACY zip to your project directory 2 Add the device drivers C files to your project Make a right click to your project in the Work
32. ded February 28 2005 1 2 1 File list changed April 1 2005 1 3 0 Support for programmable interfaces modules added September 28 2005 tdrv002DevCreate parameters changed new ioctl function FIOSETINTERFACE 1 4 0 TPMC467 TCP467 Support added July 20 2006 correction in description of tdrvO02DevCreate Distribution file list changed Missing description of error codes added Introduction Installation updated 1 4 1 New Address TEWS LLC October 9 2006 1 4 2 Address TEWS LLC removed November 18 2009 2 0 0 VxBus Driver Support added January 19 2010 2 0 1 Configuration Hint added additional information for self test execution February 18 2010 2 0 2 Legacy vs VxBus Driver modified March 25 2010 2 1 0 New debug function tdrv002Show for VxBus support April 26 2010 2 2 0 Description and schematic for local loopback added November 5 2010 Support of TPMC377 TPMC470 TCP469 TCP470 added 2 2 1 tdrvO02Show function modified February 3 2011 2 3 0 Function parameters modified for 64 bit compatibility January 10 2012 2 4 0 Functions for handshake and modem line support added February 17 2012 2 5 0 Function channel identification added March 8 2012 Description of WorkQueue issue 2 6 0 New ioctl function FIOWAITMODEMSTATE April 17 2012 Description of Legacy Driver Include modified 2 7 0 Support of TXMC375 added February 26 2013 New ioctl function FIOSETFIFOTRIGGER TD
33. er exceed these limits increase the according values in your project 2 5 Configuration of FIFO Trigger Levels The FIFO trigger levels may influence the behavior of the target system A modification of the FIFO trigger levels also means changing the duration of a single interrupt and the number of interrupts that will be generated Increasing the receive FIFO trigger level will lower the number of generated interrupts but it will also increase the execution time of a single interrupt function and it may increase the risk of loosing data by FIFO overrun Increasing the transmit FIFO trigger level will increase the number of generated interrupts but it will also lower the execution time of a single interrupt function and decrease the chance of gaps in the transmission stream Known issue with interrupt execution time In newer systems VxWorks 6 x a long interrupt execution time may lead into work queue overflow which may result in system crash or error state If such a situation occurs while a data transfer is in progress there are two ways to solve the problem first the FIFO trigger levels can be adapted to decrease the interrupt execution time and secondly the Work Queue Size can be increased value of WIND JOBS MAX Please refer to the VxWorks documentation for description of project configuration TDRV002 SW 42 VxWorks Device Driver Page 13 of 65 TEWS LE TECHNOLOGIES 3 VxBus Driver Support The TDRVOO2 will be fully
34. etval ioctl fd FIOSTATUS if retval ERROR function succeeded Description This bit is set if a framing error has been detected since the last call This bit is set if a parity error has been detected since the last call This bit is set if an overrun error has been detected since the last call This bit is set if a break signal has been detected since the last call TDRVO02_IOCTL_ARG_T amp inStat if inStat amp TDRV002 STATUS FRAMINGERR Framing error occurred else handle the error TDRV002 SW 42 VxWorks Device Driver Page 48 of 65 TEWS amp TECHNOLOGIES 5 5 13 FIOLOCALLOOP This VO control function enables or disables the local loop back mode For a description of the local loopback wiring refer to 6 2 Internal Loopback The function specific control parameter arg specifies if the local loop back shall be enabled or disabled The following values are defined Value Description TDRV002 LOCALLOOP DISABLE Local loopback mode is disabled TDRV002 LOCALLOOP ENABLE Local loopback mode is enabled EXAMPLE include tdrv002 h int fd int retval Disable local loopback mode my retval ioctl fd FIOLOCALLOOP TDRV002_LOCALLOOP_DISABLE if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device
35. f glbChanNo will be ignored PARAMETER name This string specifies the name of the device that will be used to identify the device for example for open calls TDRV002 SW 42 VxWorks Device Driver Page 18 of 65 TEWS E TECHNOLOGIES glbChanNo This index number specifies the device to add to the system The index number depends on the search priority of the modules The modules will be searched in the following order TPMC371 10 11 12 TPMC372 xx TPMC375 xx TPMC376 xx TPMC377 xx TPMC460 xx TPMC461 xx TPMC462 xx TPMC463 xx TPMC465 xx TPMC466 xx TPMC467 xx TPMC470 xx TCP460 xx TCP461 x TCP462 xx TCP463 xx TCP465 xx TCP466 xx TCP467 xx TCP469 xx TCP470 xx TXMC375 xx If modules of the same type are installed the channel numbers will be assigned in the order the VxWorks pciFindDevice function will find the devices Example A system with 2x TPMC461 10 1x TPMC372 10 1x TPMC372 11 will assign the following device indices Module Device Index TPMC372 10 0 3 TPMC372 11 ur TPMC461 10 19 8 15 TPMC461 10 27 16 23 For VxBus support this is the only used parameter The glbChanNo specifies the SIO port number including non TDRVO002 ports Normally there are two local SIO ports configured to the system and than the TDRV002 ports will follow That means the first TDRV002 port will be specified with glbChanNo set to 2 The module and port enumeration depends on the VxWorks system
36. face TCP463 4 Channel Serial Interface TCP465 8 Channel Serial Interface programmable Interfaces TCP466 4 Channel Serial Interface programmable Interfaces TCP467 4 Channel Serial Interface programmable Interfaces TCP469 8 Channel Isolated Serial Interface programmable Interfaces TCP470 4 Channel Isolated Serial Interface programmable Interfaces TXMC375 8 Channel Serial Interface programmable Interfaces In this document all supported modules and devices will be called TDRV002 Specials for a certain devices will be advised To get more information about the features and use of supported devices it is recommended to read the manuals listed below User manual of the used module Engineering Manual of the used module Programmer s Guide VO System Serial VO devices Kernel Programmer s Guide VO System Serial VO devices TDRV002 SW 42 VxWorks Device Driver Page 7 of 65 2 Installation TEWS LE TECHNOLOGIES Following files are located on the distribution media Directory path TDRV002 SW 42 TDRV002 SW 42 2 7 0 pdf TDRV002 SW 42 VXBUS zip TDRV002 SW 42 LEGACY zip ChangeLog txt Release txt PDF copy of this manual Zip compressed archive with VxBus driver sources Zip compressed archive with legacy driver sources Release history Release information The archive TDRV002 SW 42 VXBUS zip contains the following files and directories Directory path tews tdrv002 tdrvOO2drv c tdrvOO2def
37. fies the used board type The list below shows a list of the returned board IDs defined in tdrv002 h Board Id Board Type TDRV002 CHANINFO TPMC371 TPMC371 xx TDRV002 CHANINFO TPMC372 TPMC372 xx TDRV002 CHANINFO TPMC375 TPMC375 xx TDRV002 CHANINFO TPMC376 TPMC376 xx TDRV002 CHANINFO TPMC377 TPMC377 xx TDRV002 CHANINFO TPMC460 TPMC460 xx TDRV002_CHANINFO_TPMC461 TPMC461 xx TDRVOO2 CHANINFO TPMC462 TPMC462 xx TDRVOO2 CHANINFO TPMC463 TPMC463 xx TDRVOO2 CHANINFO TPMC465 TPMC465 xx TDRVOO2 CHANINFO TPMC466 TPMC466 xx TDRV002 CHANINFO TPMC467 TPMC467 xx TDRVOO2 CHANINFO TPMC470 TPMC470 xx TDRVOO2 CHANINFO TCP460 TCP460 xx TDRV002 CHANINFO TCP461 TCP461 xx TDRV002 CHANINFO TCP462 TCP462 xx TDRV002 CHANINFO TCP463 TCP463 xx TDRV002 CHANINFO TCP465 TCP465 xx TDRV002 CHANINFO TCP466 TCP466 xx TDRV002 CHANINFO TCP467 TCP467 xx TDRV002 CHANINFO TCP469 TCP469 xx TDRV002 CHANINFO TCP470 TCP470 xx TDRV002 CHANINFO TXMC375 TXMC375 xx boaraVariant This value returns the board variant The returned number specified the xx in the board name e g TPMC461 xx boardlndex This value returns the index of the specified board If just one TDRVOO2 board is used this index will always be 0 but if more than one TDRVOO2 board with the same boardld installed the index value returned is the index for PCl search The index is depends on the search order of the BSP TDRV002 SW 42 VxWorks Device Driver Page 58 of 65 TEWS TECHNOLOGIES con
38. hannel of TPMC372 1 channel of TPMC462 AyCo 7 2 d channel of TPMC372 2 channel of TPMC462 tyCo 8 3 channel of TPMC372 3 channel of TPMC462 AtyCo 9 4 channel of TPMC372 4 channel of TPMC462 After booting the available devices can be checked with devs This function will return a list of all created devices If fewer devices have been created please first check the defined maximum number of serial devices See 2 2 2 Modification of the Number of serial ports TDRV002 SW 42 VxWorks Device Driver Page 14 of 65 TEWS LE TECHNOLOGIES 3 2 VxBus Error Codes There will be just system generated return codes for the Basic VO Functions The TDRV002 specific Error Codes described with the functions are not valid for VxBus devices 3 3 Default Configuration The driver will create the port with the following default configuration 9600 Baud gt 8 Data and 1 Stopbit gt FIFO enabled Triggerlevels Rx 56 Tx 8 Ports supporting a programmable interface e g TPMC465 will startup with a disabled interface Before using the port it must be configure with the corresponding ioctl function FIOSETINTERFACE For further information of setting the FIFO trigger levels please refer to 2 5 Configuration of FIFO Trigger Levels 3 4 Compatibility to pre VxBus Applications A driver and device installation after system start like it has been common in pre VxBus systems is no longer required Theref
39. he device I retval close fd if retval ERROR error handling RETURNS OK or ERROR If the function fails an error code will be stored in errno TDRV002 SW 42 VxWorks Device Driver Page 27 of 65 TEWS 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 ioLib basic VO routine close TDRV002 SW 42 VxWorks Device Driver Page 28 of 65 TEWS E TECHNOLOGIES 5 3 read NAME read read data from a specified device SYNOPSIS int read int fd char buffer size t maxbytes DESCRIPTION This function can be used to read data from the device PARAMETER fd This file descriptor specifies the device to be used The file descriptor has been returned by the open function buffer This argument points to a user supplied buffer The returned data will be filled into this buffer maxbytes This parameter specifies the maximum number of read bytes buffer size EXAMPLE define BUFSIZE 100 int fd char buffer BUFSIZE int retval TDRV002 SW 42 VxWorks Device Driver Page 29 of 65 TEWS LE TECHNOLOGIES Read data from TDRV002 device retval read fd buffer BUFSIZE if retval ERROR printf d bytes read n retval else handle the read error R
40. nfo board channelNo PCI Location d d d n printf Controller channelInfo contro er pciBusNo channelInfo controll channelInfo controll er pciDeviceNo er pciFunctionNo printf Local channelInfo contro sd n amp OxF channel number on controller d n else handle the error ler controllerPort TDRV002 SW 42 VxWorks Device Driver Page 60 of 65 TEWS LE TECHNOLOGIES 6 Appendix 6 1 Debugging Driver and Devices Driver start up of the TDRVO002 is mainly executed at a time which does not allow the output debug messages Therefore we have implemented a function that displays some information about driver and devices void tdrv002Show The function is only available if the VxBus driver is used The function will display the following information start up errors if occurred list of boards which has been probed by the driver and position of the boards on PCI bus list of created TDRVOO2 devices and assignment to the boards some statistics to the TDRV002 devices and their configuration void For example the function can be called from the VxWorks shell to display the information Below is an example output for installed TPMC467 10 and TPMC461 12 tdrv002Show Probed Modules 0 TPMC467 Bus 4 Dev 1 DevId 0x01d3 VenId 0x1498 Init OK vxDev 0x492608 1 TPMC461 Bus 4 Dev 2 DevId 0x01cd VenId 0x1498 Init OK
41. or the specified port The function can wait for states on all the handshake and modem lines even if they are not available for the specified port The value will not change by external changes but it may be used if local loopback is enabled typedef struct unsigned int lineMask unsigned int lineTargetState int timeout unsigned int modemState TDRV002 WAITMODEM BUFFER lineMask This parameter specifies the observed modem and status lines If one of the specified lines has the specified state or it changes into it the function will return The mask is an OR ed value of the following flags Value Description TDRV002 MCTL CTS If set observe CTS state TDRV002 MCTL DSR If set observe DSR state TDRVOO2 MCTL RI If set observe RI state TDRVOO2 MCTL CD If set observe CD state lineTargetState This parameter specifies the desired states of the modem and status lines This value is an OR ed value of the following flags Value Description TDRV002 MCTL CTS If set an active CTS line will be signaled if not set an passive CTS line will be signaled TDRV002 MCTL DSR If set an active DSR line will be signaled if not set an passive DSR line will be signaled TDRVOO2 MCTL RI If set an active RI line will be signaled if not set an passive RI line will be signaled TDRVOO2 MCTL CD If set an active CD line will be signaled if not set an passive CD line will be signaled TDRV002 SW 42 VxWorks Device Driver Page 44 of 65
42. ore all legacy system I O functions are obsolete These functions are implemented to keep the driver compatible to older driver versions The obsolete functions only check if the driver is already installed or devices are present The functions do not guarantee full compatibility because port name assignment and the search order of the modules have changed TDRV002 SW 42 VxWorks Device Driver Page 15 of 65 TEWS LE TECHNOLOGIES 4 Legacy VO 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 the VO system add and initialize devices The legacy VO system functions are only relevant for the legacy TDRVO002 driver For the VxBus enabled TDRVO002 driver the driver will be installed automatically in the VO system and devices will be created as needed for detected modules 4 1 tdrv002Drv NAME tdrv002Drv installs the TDRVOO2 driver in the VO system This function is not necessary for systems supporting VxBus It is a dummy function which checks if the driver is installed It has been implemented to keep the application compatible to the legacy version SYNOPSIS include tdrv002 h STATUS tdrv002Drv void DESCRIPTION This function searches for devices on the PCI bus and installs the TDRVOO2 driver in the VO system A call to this function is the first thing the user has to do before adding any device to the
43. s VO control function sets the data word length The function specific control parameter arg specifies the length of the data word The following values are defined Value TDRV002 DATABIT 5 TDRV002 DATABIT 6 TDRVOO2 DATABIT 7 TDRV002 DATABIT 8 EXAMPLE include tdrv002 h int fd int retval Description word length 5 bit word length 6 bit word length 7 bit word length 8 bit Set channel to a word length of 7 bit sy retval ioctl fd ERROR if retval function succeeded else handle the error ERROR CODES Error Code S tdrvoO2Drv SELFTESTBUSY S tdrv002Drv ILLPARAM TDRV002 SW 42 VxWorks Device Driver FIODATABITS TDRV002 DATABIT 7 Description Self test mode is active for the device Illegal data word length specified Page 36 of 65 TEWS LE TECHNOLOGIES 5 5 3 FIOSTOPBITS This UO control function sets the length of the stop bit The function specific control parameter arg specifies the length of the stop bit word The following values are defined Value Description TDRV002 STOPBIT 1 stop bit length 1 bit TDRV002 STOPBIT 1 5 stop bit length 1 5 bit only data length 5 TDRV002 STOPBIT 2 stop bit length 2 bit only data length 6 7 8 EXAMPLE include tdrv002 h int fd int retval Set channel to a stop bit length of 1 bit retval ioctl fd FIOSTOPBITS TDRVOO2 STOPBIT
44. scription TDRV002 MCTL RTS Set RTS line into passive state TDRV002 MCTL DIR Set DTR line into passive state The supported handshake and modem lines depend on the used TDRV002 board port number and interface Which handshake and modem lines are supported can be found in the User Manual of the TDRV002 supported module EXAMPLE include tdrv002 h int fd int retval Set RTS and DTR active xf retval ioctl fd FIOCLEARMODEM TDRV002 MCTL RTS TDRVOO2 MCTL DTR if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device S tdrv00O2Drv MODENOTSUPP The specified handshake or modem line is not supported TDRV002 SW 42 VxWorks Device Driver Page 42 of 65 TEWS LE TECHNOLOGIES 5 5 9 FIOGETMODEM This VO control function returns the state of the modem and control lines of the device The function specific control parameter arg points to a buffer unsigned int the status will be returned The returned status is an OR ed value of the following flags Value Description TDRV002 MCTL RTS If set RTS is in active state TDRV002 MCTL DIR If set DTR is in active state TDRV002 MCTL CTS If set CTS is in active state TDRV002 MCTL DSR If set DSR is in active state TDRVOO2 MCTL RI If set Rl is in active state TDRVOO2 MCTL CD If set CD is in active state The suppor
45. space window and use the Add Files topic A file select box appears and the driver files in the tdrv002 directory can be selected 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 3 2 Special Installation for Intel x86 based Targets The TDRVO0O2 device driver is fully adapted for Intel x86 based targets This is done by conditional compilation directives inside the source code and controlled by the VxWorks global defined macro CPU FAMILY If the content of this macro is equal to 80X86 special Intel x86 conforming code and function calls will be included The second problem for Intel x86 based platforms can t be solved by conditional compilation directives Due to the fact that some Intel x86 BSP s doesn t map PCI memory spaces of devices which are not used by the BSP the required device memory spaces can t be accessed To solve this problem a MMU mapping entry has to be added for the required TDRV002 PCI memory spaces prior the MMU initialization usrMmulnit is done The C source file tdrv002pci c contains the function tdrv002Pcilnit This routine finds out all TDRVO002 devices and adds MMU mapping entries for all used PCI memory spaces Please insert a call to this function after the PCI initialization is done and prior to MMU initialization usrMmulnit
46. specified TDRV002 SW 42 VxWorks Device Driver Page 40 of 65 TEWS E TECHNOLOGIES 5 5 7 FIOSETMODEM This I O control function sets the specified modem and handshake lines into active state The function specific control parameter arg is an ORed value and specifies the lines that shall be set The following values are defined Value Description TDRV002 MCTL RTS Set RTS line into active state TDRV002 MCTL DIR Set DTR line into active state The supported handshake and modem lines depend on the used TDRV002 board port number and interface Which handshake and modem lines are supported can be found in the User Manual of the TDRV002 supported module EXAMPLE include tdrv002 h int fd int retval Set DTR active y retval ioctl fd FIOSETMODEM TDRV002 MCTL DIR if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrv002Drv SELFTESTBUSY Self test mode is active for the device S tdrv00O2Drv MODENOTSUPP The specified handshake or modem line is not supported TDRV002 SW 42 VxWorks Device Driver Page 41 of 65 TEWS amp TECHNOLOGIES 5 5 8 FIOCLEARMODEM This VO control function sets the specified modem and handshake lines into passive state The function specific control parameter arg is an ORed value and specifies the lines that shall be reset The following values are defined Value De
47. specified Unsupported default mode specified Configuration error specified flags exclude each other Page 23 of 65 TEWS E TECHNOLOGIES 4 3 tdrv002Pcilnit NAME tdrvOO2Pcilnit Generic PCI device initialization SYNOPSIS void tdrv002Pcilnit void DESCRIPTION This function is required only for Intel x86 VxWorks platforms The purpose is to setup the MMU mapping for all required TDRV002 PCI spaces base address register and to enable the TDRV002 device for access The global variable tdrvOO2Status obtains the result of the device initialization and can be polled later by the application before the driver will be installed Value Meaning 20 Initialization successful completed The value of tdrvOO2Status is equal to the number of mapped PCI spaces 0 No TDRVOO2 device found 0 Initialization failed The value of tdrvO02Status amp OxFF is equal to the number of mapped spaces until the error occurs Possible cause Too few entries for dynamic mappings in sysPhysMemDesc Remedy Add dummy entries as necessary syslib c This function is only supported for the TDRVOO02 legacy version It must not be used with the VxBus version EXAMPLE extern void tdrv002PciInit tdrv002PciInit TDRV002 SW 42 VxWorks Device Driver Page 24 of 65 5 Basic VO Functions 5 1 open NAME open open a device or file SYNOPSIS int open const char name int flags int mode DESC
48. system or performing any VO request TDRV002 SW 42 VxWorks Device Driver Page 16 of 65 TEWS LE TECHNOLOGIES EXAMPLE include tdrv002 h STATUS result Initialize Driver 7 result tdrv002Drv if result ERROR error handling RETURNS OK or ERROR If the function fails an error code will be stored in errno ERROR CODES The error codes are stored in errno and can be read with the function errnoGet Error code Description S tdrv002Drv NOMEM Driver cannot allocate memory S tdrv002Drv NXIO No device found SEE ALSO VxWorks Programmer s Guide VO System TDRVOO2 SW 42 VxWorks Device Driver Page 17 of 65 TEWS amp TECHNOLOGIES 4 2 tdrv002DevCreate NAME tdrv0O2DevCreate Adds TDRVOO2 device to the system and initializes the device hardware with the specified configuration SYNOPSIS include tdrv002 h STATUS tdrv002DevCreate char name int glbChanNo int rdBufSize int wrtBufSize TDRV002 CHANCONF devConf DESCRIPTION This routine creates a device on a specified serial channel that will be serviced by the TDRVOO02 driver This function must be called before performing any I O request to this device This function is not necessary for systems supporting VxBus It is a dummy function which checks if the device is installed It has been implemented to keep the application compatible to pre VxBus versions All parameters except o
49. tdrv002Drv NOTSUPP The device has no programmable VO interface S tdrv0O2Drv ILLINTF The specified interface type is not supported by the device S tdrv002Drv ILLBAUD The specified interface type can not support the current baud rate S tdrv002Drv MODENOTSUPP Handshake mode is not supported for the specified interface type TDRV002 SW 42 VxWorks Device Driver Page 54 of 65 TEWS LE TECHNOLOGIES 5 5 16 FIOSETFIFOTRIGGER This I O control function sets up the FIFO trigger levels which shall be used for the specified channel For a description of the controller s FIFO depth and possible values for the trigger level please refer to the corresponding hardware user manual The function specific control parameter arg points to a supplied buffer TDRV002 FIFOCONFIG typedef struct unsigned char rxFSize unsigned char txFSize int fifoEnable TDRV002_FIFOCONFIG rxF Size This value specifies the trigger level of the receive FIFO The controller will generate receive interrupts if the specified level is reached in the hardware receive FIFO Depending on the used UART controller s FIFO size the value can be set to values between 0 and 64 or between 0 and 128 txF Size This value specifies the trigger level of the transmit FIFO The controller will generate transmit interrupts if the number of data in the hardware transmit FIFO falls below specified level Depending on the used UART con
50. ted handshake and modem lines depend on the used TDRVOO02 board port number and interface Which handshake and modem lines are supported can be found in the User Manual of the TDRV002 supported module This function always returns the state of all handshake and modem lines as they are shown by the controller even if they are not available for the specified port EXAMPLE include tdrv002 h int fd int retval unsigned int modStat Get modem line status sy retval ioctl fd FIOGETMODEM TDRV002 IOCTL ARG T amp modStat if retval ERROR check CTS state if modStat amp TDRV002 MCTL CTS CTS is active else handle the error TDRV002 SW 42 VxWorks Device Driver Page 43 of 65 TEWS LE TECHNOLOGIES 5 5 10 FIOWAITMODEMSTATE This I O control function returns the state of the modem and control lines of the device if one of the specified states occurs it will return immediately if a state already matches The function specific control parameter arg points to a supplied buffer TDRV002 WAITMODEM BUFFER The supported handshake and modem lines depend on the used TDRV002 board port number and interface Which handshake and modem lines are supported can be found in the User Manual of the TDRV002 supported module This function always returns the state of all handshake and modem lines as they are shown by the controller even if they are not available f
51. the board where the channel is located The function will also return information about the PCl bus location where the controller of the channel can be found This information may be helpful to find a special channel in the system and to assign a physical channel to a logical device The function specific control parameter arg passes a pointer to an information structure TDRVOO2 CHANNEL INFO BUFFER where the information will be filled in typedef struct int channelNo struct tdrv002 board info board struct tdrv002 controller info controller TDRV002 CHANNEL INFO BUFFER channelNo This value returns the serial channel number For example the function will return 7 for AtyCo 7 The legacy driver will return the number at the end of the device name as described above but if there is no number at the end of the device e g ser A the function will return a driver internal channel count board This structure struct tdrv002 board info contains board information that belongs to a specified channel struct tdrv002 board info d int channelNo unsigned int boardld unsigned int boardVariant int boardindex channelNo This value returns the channel number of the board where the channel is located The returned number will match the channel number assigned in the User Manual TDRV002 SW 42 VxWorks Device Driver Page 57 of 65 TEWS amp TECHNOLOGIES boardld This value returns a unigue ID which identi
52. troller This structure struct tdrv002 controller info contains information that belongs to the controller and the specified channel which describes the location of the controller and channel on PCI bus struct tdrv002 controller info int pciBusNo int pciDeviceNo int pciFunctionNo int controllerPort pciBusNo This PCI bus number the channels controller is located at pciDeviceNo This PCI device number the channels controller is located at pciFunctionNo This PCI function number the channels controller is located at controllerPort This value specifies the channel index within the controller as assigned in the documentation of the controller chip EXAMPLE include tdrv002 h int fa int retval TDRV002_CHANNEL_INFO_BUFFER channelInfo Read board information retval ioctl fd FIOCHANNELINFO TDRV002 IOCTL ARG T amp channelInfo if result ERROR printf Get Channel Board Information successfully executed n printf Channel Name s d n TDRV002 DEVICENAME channelInfo channelNo F TDRV002 SW 42 VxWorks Device Driver Page 59 of 65 TEWS TECHNOLOGIES printf Board s d 02d Board Index sd n boardTypeList channelInfo board boardId gt gt 12 channellInfo board boardiId amp OxFFF channeliInfo board boardVariant channeliInfo board boardIndex printf Channel number on board channellI
53. troller s FIFO size the value can be set to values between 0 and 64 or between 0 and 128 fifoEnable This argument specifies if the FIFO shall be enabled or disabled If the FIFO is disabled the previous parameters are not used and there will be no FIFO for the specified channel Because of the risk of data loss if FIFO is disabled it is recommended to disable the FIFO only in special and well checked cases The values below must be used Value Description TDRVOO2 FIFO DISABLE Disable FIFO functionality TDRVOO2 FIFO ENABLE Enable FIFO functionality TDRV002 SW 42 VxWorks Device Driver Page 55 of 65 TEWS TECHNOLOGIES EXAMPLE include tdrv002 h int fd int retval TDRV002 FIFOCONFIG fifoConf fifoConf rxFSize 32 fifoConf txFSize 24 fifoConf fifoEnable TDRV002 FIFO ENABLE Set FIFO trigger levels Receive 32 Transmit 24 sy retval ioctl fd FIOSETFIFOTRIGGER TDRV002 IOCTL ARG T amp fifoConf if retval ERROR function succeeded else handle the error ERROR CODES Error Code Description S tdrvO02Drv SELFTESTBUSY Self test mode is active for the device S_tdrv002Drv_ILLPARAM Illegal parameter specified TDRV002 SW 42 VxWorks Device Driver Page 56 of 65 TEWS LE TECHNOLOGIES 5 5 17 FIOCHANNELINFO This VO control function returns information regarding the specified channel The returned information contains information about

Download Pdf Manuals

image

Related Search

Related Contents

LG AS780 Data Sheet  voir le descriptif détaillé du parcours d`automne 2015.  USB DVI Dual View KVMP Switch CS1642A / CS1644A User Manual  

Copyright © All rights reserved.
Failed to retrieve file