Home

User Manual - powerbridge.de

image

Contents

1. int Edis int result Assert RTS SZ result ioctl fd TDRVOO9_C_RTS_SET char 0 if result OK handle ioctl error ERRORS EPERM The channel is in handshake mode so this function is not allowed Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 48 of 56 TEWS amp TECHNOLOGIES 3 5 15 TDRVO09_C_RTS_CLEAR NAME TDRV009_C_RTS_ CLEAR De Assert RTS handshake line DESCRIPTION This I O control function de asserts the RTS handshake signal line of the specific channel This function is not available if the channel is configured for hardware handshaking The function dependent argument arg is not used for this function EXAMPLE include tdrv009 h int Edis int result De assert RTS SZ result ioctl fd TDRVOO9_C_RTS_ CLEAR char 0 if result OK handle ioctl error ERRORS EPERM The channel is in handshake mode so this function is not allowed Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 49 of 56 TENSE TECHNOLOGIES 3 5 16 TDRV009_C_CTS_GET NAME TDRV009_C_CTS_GET Read state of CTS DESCRIPTION This I O control function returns the current state of the CTS handshake signal line of the specific channel The function dependent argument arg passes a pointer to an unsigned long value to the driver Depending on
2. The configuration above creates the following nodes in the dev directory dev tdrv009a_0 dev tdrv009a_1 dev tdrv009a_2 dev tdrv009a_3 TDRVO009 SW 72 LynxOS Device Driver Page 10 of 56 TENSE TECHNOLOGIES 3 TDRV009 Device Driver Programming LynxOS system calls are all available directly to any C program They are implemented as ordinary function calls to glue routines in the system library which trap to the OS code Note that many system calls use data structures which should be obtained in a program from appropriate header files Necessary header files are listed with the system call synopsis 3 1 open NAME open open a file SYNOPSIS include lt sys file h gt include lt sys types h gt include lt fcntl h gt int open char path int oflags mode_t mode DESCRIPTION Opens a file TDRV009 device named in path for reading and writing The value of oflags indicates the intended use of the file In case of a TDRVO0O09 devices oflags must be set to O_RDWR to open the file for both reading and writing The mode argument is required only when a file is created Because a TDRVO009 device already exists this argument is ignored EXAMPLE int fd open the device named dev tdrv009a_0 for I O fd open dev tdrv009a_0 O_RDWR if fd handle error TDRV009 SW 72 LynxOS Device Driver Page 11 of 56 TEWS amp TECHNOLOGIES RETURNS open returns
3. 1 is returned The global variable errno contains the detailed error code ERRORS EFAULT Invalid pointer to the read buffer EINVAL Data buffer is too small SEE ALSO GNU C Library description Low Level Input Output TDRVO009 SW 72 LynxOS Device Driver Page 14 of 56 TEWS amp TECHNOLOGIES 3 4 write NAME write write to a device SYNOPSIS int write int fd char buff int count DESCRIPTION This function attempts to write an output buffer to a TDRV009 compatible channel associated with the file descriptor fd The argument count specifies the length of the buffer The function performs a blocking write operation i e the functions waits until all data is transferred into the hardware FIFO or the specified timeout expires see SET_WARITE_TIMEOUT EXAMPLE int fd int num_bytes char buffer 100 send some text sprintf buffer Hello World num_bytes write fd buffer strlen buffer if num_bytes strlen buffer process error RETURNS On success read returns the number of bytes In case of an error a value of 1 is returned The global variable errno contains the detailed error code TDRVO009 SW 72 LynxOS Device Driver Page 15 of 56 TEWS amp TECHNOLOGIES ERRORS EFAULT Invalid pointer to the read buffer EINVAL Data buffer is too small SEE ALSO GNU C Library description Low Level Input Output TDRVO009 SW 72
4. TENSES The Embedded I O Company TECHNOLOGIES TDRV009 SW 72 LynxOS Device Driver High Speed Synch Asynch Serial Interface Version 1 0 x User Manual Issue 1 0 1 June 2011 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 TDRVO009 SW 72 LynxOS Device Driver High Speed Synch Asynch Serial Interface Supported Modules TPMC363 TPMC863 TAMC863 TCP863 Issue Description 1 0 0 1 0 1 First Issue General Revision TDRVO009 SW 72 LynxOS Device Driver TENSE 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 2009 2011 by TEWS TECHNOLOGIES GmbH Date January 19 2009 June 17 2011 Page 2 of 56 Table of Contents TENSE TECHNOLOGIES 1 INTRODUCTION yi vacciesiienceecciewiwescvencuewcueseuscuewcueweueweweweuewiueweuewewsweveweusweuewewewevewsuewevewouen 4 2 INSTALLATION 6 cscciccscscecscstsctcncuescecncwincuewcusacutvewsscuentusscucncusncnent
5. LynxOS Device Driver Page 16 of 56 3 5 ioctl NAME ioctl I O device control SYNOPSIS include lt ioctl h gt include lt tdrv009 h gt int ioctl int fd int request char arg DESCRIPTION TENSE TECHNOLOGIES ioctl provides a way of sending special commands to a device driver The call sends the value of request and the pointer arg to the device associated with the descriptor fd The following ioctl codes are supported by the driver and are defined in tdrv009 h Symbol TDRV009_C_SET_OPERATION_MODE TDRV009_C_GET_OPERATION_MODE TDRV009_C_SET_BAUDRATE TDRV009_C_SET_RECEIVER_STATE TDRV009_C_CLEAR_RX_BUFFER TDRV009_C_SET_EXT_XTAL TDRV009_C_SET_READ_TIMEOUT TDRV009_C_REG_WRITE TDRV009_C_REG_READ TDRV009_C_SCC_REG_WRITE TDRV009_C_SCC_REG_READ TDRV009_C_EEPROM_WRITE TDRV009_C_EEPROM_READ TDRV009_C_RTS_SET TDRV009_C_RTS_CLEAR TDRV009_C_CTS_GET TDRV009_C_DTR_SET TDRV009_C_DTR_CLEAR TDRV009_C_DSR_GET TDRV009_C_WAITFORINTERRUPT Meaning set a channel s operation mode get a channel s current operation mode set baudrate without other changes set operation state of the channel s receiver clear the internal receive buffer specify an externally supplied frequency specify a timeout for read operations directly write to a register directly read from a register directly write to an SCC register directly read from an SCC register write value to EEPROM read value from EEPROM Assert RTS handshake
6. TDRV009 CRC_RESET ResetValue TDRV009_CRC Type This parameter describes the CRC type to be used Possible values are Value Description TDRV009_CRC_16 16bit CRC algorithm is used for checksum TDRV009_CRC_32 32bit CRC algorithm is used for checksum RxChecking This parameter enables or disables the receive CRC checking Possible values are Value Description TDRV009_DISABLED CRC checking will not be used TDRV009_ENABLED CRC checking will be used TxGeneration This parameter enables or disables the transmit CRC generation Possible values are Value Description TDRV009_DISABLED A CRC checksum will be generated TDRV009_ENABLED A CRC checksum will not be generated ResetValue This parameter describes the reset value for the CRC algorithm Possible values are Value Description TDRV009_CRC_RST_FFFF CRC reset value will be OxFFFF TDRV009_CRC_RST_0000 CRC reset value will be 0x0000 TDRVO009 SW 72 LynxOS Device Driver Page 29 of 56 TEWS amp TECHNOLOGIES EXAMPLE include tdrv009 h int int TDRV009_OPERATION_MODE_STRUCT fd result OperationMode Retriev current configuration 7 result if ioctl fd result OK Current speed TDRV009_C_G printf else handle ioctl error d bps n ET _OPERATION_MODE char amp OperationMode OperationMode Baudrate TDRVO009 SW 72 LynxOS Device Driver Page 30 of 56 TENSE TECHNOLOGIES 3 5 3 TD
7. typedef struct unsigned long Offset unsigned ong Value TDRVOO9_EEPROM_BUFFER Offset This parameter specifies a 16bit word offset into the EEPROM Following offsets are available Offset Access 00h 5Fh R 60h ZER R W Value This parameter returns the 16bit word from the EEPROM at the given offset EXAMPLE include tdrv009 h int fd int result TDRV009_EEPROM_BUFFER FepromBuf Read a 16bit value from the EEPROM offset 0 EJ EepromBuf Offset 0 TDRV009 SW 72 LynxOS Device Driver Page 46 of 56 TEWS amp TECHNOLOGIES result ioctl fd TDRVO09_C_EEPROM_READ char amp EepromBuf if result OK printf Value 0x X n EepromBuf Value else handle ioctl error ERRORS EIO Error reading from EEPROM EACCES Specified offset is invalid and may not be accessed Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 47 of 56 TENSE TECHNOLOGIES 3 5 14 TDRV009_C_RTS_SET NAME TDRV009_C_RTS_SET Assert RTS handshake line DESCRIPTION This I O control function asserts the RTS handshake signal line of the specific channel This function is not available if the channel is configured for hardware handshaking The function dependent argument arg is not used for this function EXAMPLE include tdrv009 h
8. Contains the device number slot at which the TDRVO09 compatible device is connected Valid device numbers are in range from 0 to 31 If both PCIBusNumber and PCIDeviceNumber are 1 then the driver will auto scan for the TDRVO009 compatible device The first device found in the scan order will be allocated by the driver for this major device Already allocated devices can t be allocated twice This is important to know if there are more than one TDRVO009 major devices A device information definition is unique for every TDRVO09 major device The file tdrvO09_info c on the distribution disk contains two device information declarations tdrv009a_info for the first major device and tdrv009b_info for the second major device If the driver should support more than two major devices it is necessary to copy and paste an existing declaration and rename it with a unique name for example tdrv009c_info tdrv009d_info and so on It is also necessary to modify the device and driver configuration file respectively the configuration include file tdrv009 cfg The following device declaration information uses the auto find method to detect a TDRV009 compatible device on the PCI bus TDRVOO9_INFO tdrv009a_info 1 Auto find the device on any PCI bus TDRVO009 SW 72 LynxOS Device Driver Page 9 of 56 TENSE TECHNOLOGIES 2 1 4 Configuration File CONFIG TBL The device and driver configuration file CONFIG TBL contains entri
9. Release txt Information about the Device Driver Release The GZIP compressed archive TDRV009 SW 72 SRC tar gz contains the following files and directories tdrv009 c Driver source code tdrv009 h Definitions and data structures for driver and application commCtrl h Include file for controller chip tdrvO09def h Definitions and data structures for the driver tdrv009_info c Device information definition tdrv009_info h Device information definition header tdrv009 cfg Driver configuration file include tdrv009 import Linker import file Makefile Device driver make file example tdrv009exa c Example application source In order to perform a driver installation first extract the TAR file to a temporary directory then copy the following files to their target directories 1 Create a new directory in the system driver s directory path sys drivers xxx where xxx represents the BSP that supports the target hardware For example sys drivers pp_drm tdrv009 or sys drivers cpci_x86 tdrv009 Copy the following files to this directory tdrv009 c tdrv009def h commCtrl h tdrv009 import Makefile Copy tdrv009 h to usr include Copy tdrv009_info c to sys devices xxx or sys devices if sys devices xxx does not exist xxx represents the BSP Copy tdrv009_info h to sys dheaders Copy tdrv009 cfg to sys cfg xxx where xxx represents the BSP for the target platform For example sys cfg ppc or sys cfg x86 TDRV
10. a file descriptor number if successful or 1 on error SEE ALSO LynxOS System Call open TDRVO009 SW 72 LynxOS Device Driver Page 12 of 56 TENSE TECHNOLOGIES 3 2 close NAME close close a file SYNOPSIS int close int fd DESCRIPTION This function closes an opened device EXAMPLE int result KR close the device result close fd if result lt 0 handle error RETURNS close returns 0 OK if successful or 1 on error SEE ALSO LynxOS System Call close TDRVO009 SW 72 LynxOS Device Driver Page 13 of 56 TENSE TECHNOLOGIES 3 3 read NAME read read from a device SYNOPSIS int read int fd char buff int count DESCRIPTION This function attempts to read an input buffer from a TDRV009 compatible channel associated with the file descriptor fd The argument count specifies the length of the buffer Available data up to count bytes is copied into the users buffer pointed to by buff The function performs a blocking read operation i e the functions waits until data is available or the specified timeout expires see SET_READ_TIMEOUT In synchronous channel mode data is returned up to frame end EXAMPLE int fd int num_bytes char buffer 100 num_bytes read fd buffer 100 if num_bytes gt 0 process received data RETURNS On success read returns the number of bytes In case of an error a value of
11. be 0x0000 TDRVO009 SW 72 LynxOS Device Driver Page 23 of 56 TEWS amp TECHNOLOGIES EXAMPLE include int int TDRV009_OPERATION_MODE tdrv009 h T _ STRUCT fd result OperationMode Configure channel for Async RS232 115200bps Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera Opera resul if tion tion tion tion tion tion tion tion tion tion tion tion tion tion tion tion tion tion tion tion tion result ioctl fd Mode Mode ode ode ode Mode Mode Mode ode ode ode ode Mode Mode Mode ode ode ode Mode Mode Mode CommType TransceiverMod Oversampling Brgsource TxClkSource TxClkOutput RxC ClockMultiplier lkSource Baudrate ClockInversion Encoding Parity Stopbits Databits UseTermChar TermChar HwHs Crce Type Cre RxChecking TxGeneration Cres Crce ResetValu TDRVOO9_C_S OK T RV009_COMMTYPE RV009_TRNSCVR RV009_ENABLED RV009_BRGSRC_X RV009_TXCSRC_B RV009_RXCSRC_B TD 115200 RVO09_ENC_NRZ RV009_DISABL RV009_DISABL RV009_CRC_16 RV009_DISABL RV009_DISABLE KI Op handle ioctl error ERRORS ERATION_MODE c RVO09_CLKINV_NON RVOO09_PAR_DISABLI z
12. of the specific channel s SCC register set The function specific control parameter arg is a pointer toa TDRVO09_ADDR_STRUCT structure typedef struct unsigned long Offset unsigned long Value TDRVOO9_ADDR_STRUCT Offset This parameter specifies a byte offset into the communication controller s channel SCC register space Please refer to the hardware user manual for further information Value This 32bit word will be written to the communication controller s channel SCC register space Modifying register contents may result in communication problems system crash or other unexpected behavior TDRVO009 SW 72 LynxOS Device Driver Page 40 of 56 TEWS amp TECHNOLOGIES EXAMPLE include tdrv009 h int fds int result TDRV009_ADDR_STRUCT AddrBuf Write a 32bit value Termination Character Register AddrBuf Offset 0x0048 AddrBuf Value 1 lt lt 15 0x42 result ioctl fd TDRVO09_C_SCC_REG_WRITE char amp AddrBuf if result OK handle ioctl error ERRORS EINVAL The specified offset is invalid Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 41 of 56 TENSE TECHNOLOGIES 3 5 11 TDRV009_C_SCC_REG_READ NAME TDRV009_C_SCC_REG_READ directly read from an SCC register DESCRIPTION This I O control function reads one 32bit word from the communication controller s regist
13. the state of CTS either 0 inactive or 1 active is returned EXAMPLE include tdrv009 h int fd int result unsigned long CtsState Read CTS state result ioctl fd TDRVOO9_C_CTS_GET char amp CtsState if result OK printf CTS ld n CtsState else handle ioctl error TDRVO009 SW 72 LynxOS Device Driver Page 50 of 56 TENSE TECHNOLOGIES 3 5 17 TDRV009_C_DTR_SET NAME TDRV009_C_DTR_SET Set DTR signal line only channel 3 DESCRIPTION This I O control function sets the DTR signal line to HIGH This function is only available for local module channel 3 The function dependent argument arg is not used for this function EXAMPLE include tdrv009 h int fd int result Set DTR to HIGH only valid for channel 3 SE result ioctl fd TDRVOO09_C_DTR_SET char 0 if result OK handle ioctl error ERRORS EACCES This function is not supported by the specific channel Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 51 of 56 TENSE TECHNOLOGIES 3 5 18 TDRV009_C_DTR_CLEAR NAME TDRV009_C_DTR_CLEAR Clear DTR signal line only channel 3 DESCRIPTION This I O control function sets the DTR signal line to LOW This function is only available for local module channel 3 The function dependent argument arg is not used for this f
14. 7 _ASYNC _RS232 TALI RG RG RVO009_CLKMULT_X1 Gl Kn fl is RVOO9_CRC_RST_FFFF har amp OperationMode At least one specified parameter is invalid Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 24 of 56 TENSE TECHNOLOGIES 3 5 2 TDRV009_C_GET_OPERATION_MODE NAME TDRV009_C_GET_OPERATION_MODE get a channel s current operation mode DESCRIPTION This UO control function returns the channel s current operation mode The function specific control parameter arg is a pointer to a TDRVO09_OPERATION_MODE_STRUCT structure typedef struct TDRV009_COMM_TYPE TDRV009_TRANSCEIVER_MODE TDRV009_ENABLE_DISABLE TDRV009_ BRGSOURCE TDRV009_TXCSOURCE unsigned long TDRV009_RXCSOURCE TDRVO009_CLKMULTIPLIER unsigned long unsigned char unsigned char TDRV009_ PARITY int int TDRV009_ENABLE_DISABLE char TDRV009_ ENABLE_DISABLE TDRV009_CRC CommType TransceiverMode Oversampling BrgSource TxClkSource TxClkOutput RxClkSource ClockMultiplier Baudrate ClockInversion Encoding Parity Stopbits Databits UseTermChar TermChar HwHs Cre TDRVO09_OPERATION_MODE_STRUCT TDRVO009 SW 72 LynxOS Device Driver Page 25 of 56 TENSE TECHNOLOGIES CommType This parameter describes the general communication type for the specific channel Possible values are Value Description TDRV009_COMMTYPE_ASYN
15. C TDRV009_COMMTYPE_HDLC_ADDRO Asynchronous communication Standard HDLC communication without address recognition Used for synchronous communication TDRV009_ COMMTYPE_HDLC_TRANSP Extended Transparent mode No protocol processing channel works as simple bit collector TransceiverMode This parameter describes the transceiver mode of the programmable multi protocol transceivers Possible values are Value Description TDRVO009_TRNSCVR_NOT_USED Default V 11 TDRV009_TRNSCVR_RS530A EIA 530A V 11 V 10 TDRV009_TRNSCVR_RS530 EIA 530 V 11 also suitable for RS422 TDRVO09_TRNSCVR_X21 X 21 V 11 TDRV009_TRNSCVR_V35 V 35 V 35 V 28 TDRV009_TRNSCVR_RS449 EIA 449 V 11 TDRV009_TRNSCVR_V36 V 36 V 11 TDRV009_TRNSCVR_RS232 EIA 232 V 28 TDRV009_TRNSCVR_V28 V 28 V 28 TDRV009_TRNSCVR_NO_CABLE High impedance Oversampling This parameter enables or disables 16times oversampling used for asynchronous communication For communication with standard UARTs it is recommended to enable this feature Valid values are Value TDRV009_ DISABLED TDRV009_ ENABLED BrgSource Description The 16 times oversampling is not used The 16 times oversampling is used This parameter specifies the frequency source used as input to the BRG Baud Rate Generator Valid values are Value TDRV009_BRGSRC_XTAL1 TDRV009_BRGSRC_XTAL2 TDRV009_BRGSRC_XTAL3 TDRV009_BRGSRC_RXCEXTERN TDRV009_BRGSRC_TXCEXTERN TDRVO009 SW 72 LynxOS Device Dri
16. O009 SW 72 LynxOS Device Driver Page 5 of 56 TENSE TECHNOLOGIES 2 1 Device Driver Installation The two methods of driver installation are as follows gt Static Installation gt Dynamic Installation only native LynxOS systems 2 1 1 Static Installation With this method the driver object code is linked with the kernel routines and is installed during system start up 2 1 1 1 Build the driver object 1 Change to the directory sys drivers xxx tdrv009 where xxx represents the BSP that supports the target hardware 2 To update the library sys lib libdrivers a enter make install 2 1 1 2 Create Device Information Declaration 1 Change to the directory sys devices xxx or sys devices if sys devices xxx does not exist xxx represents the BSP 2 Add the following dependencies to the Makefile DEVICE_FILES_all tdrv009_info x And at the end of the Makefile tdrv009_info o DHEADERS tdrv009_info h 3 To update the library sys lib libdevices a enter make install 2 1 1 3 Modify the Device and Driver Configuration File In order to insert the driver object code into the kernel image an appropriate entry in file CONFIG TBL must be created 1 Change to the directory sys lynx os respective sys bsp xxx where xxx represents the BSP that supports the target hardware 2 Create an entry at the end of the file CONFIG TBL Insert the following entry at the end of this
17. RV009_C_SET_BAUDRATE NAME TDRV009 C_SET_BAUDRATE set baudrate without other changes DESCRIPTION This I O control function sets up the transmission rate for the specific channel This is done without all the other configuration stuff contained in TDRVO09_IOCS SET OPERATION MODE If async oversampling is enabled the desired baudrate is internally multiplied by 16 It is important that this result can be derived from the selected clocksource This function specifies the desired frequency which should be generated by the Baud Rate Generator BRG The function dependent parameter arg passes an unsigned long value containing the desired baudrate to the device driver EXAMPLE include tdrv009 h int fd int result J Set baudrate to 14400bps result ioctl fd TDRV009_C_SET_BAUDRATE char 14400 if result OK handle ioctl error ERRORS EINVAL Invalid parameter specified Other returned error codes are system error conditions TDRV009 SW 72 LynxOS Device Driver Page 31 of 56 3 5 4 TDRV009_C_SET_RECEIVER_STATE NAME TENSE TECHNOLOGIES TDRV009_C_SET_RECEIVER_STATE set operation state of the channel s receiver DESCRIPTION This command sets the channel s receiver either to active or inactive The parameter arg passed to this I O control function defines the new state of the receiver Possible values are Value Description TDRVO009_RCVR_ON The receiver i
18. SE TECHNOLOGIES This parameter specifies the data encoding used for communication Valid values are Value TDRV009_ENC_NRZ TDRV009_ENC_NRZI TDRV009_ENC_FMO TDRV009_ENC_FM1 TDRV009_ENC_MANCHESTER Parity Description NRZ data encoding NRZI data encoding FMO data encoding FM1 data encoding Manchester data encoding This parameter specifies the parity bit generation used for asynchronous communication Valid values are Value TDRV009_PAR_DISABLED TDRV009_PAR_EVEN TDRV009_PAR_ODD TDRV009_PAR_SPACE TDRV009_PAR_MARK Stopbits Description No parity generation is used EVEN parity bit ODD parity bit SPACE parity bit always insert 0 MARK parity bit always insert 1 This parameter specifies the number of stop bits to use for asynchronous communication Possible values are 1 or 2 Databits This parameter specifies the number of data bits to use for asynchronous communication Possible values are 5 to 8 UseTermChar This parameter enables or disables the usage of a termination character for asynchronous communication Valid values are Value TDRV009_ DISABLED TDRV009_ ENABLED TermChar Description A termination character is not used A termination character is used This parameter specifies the termination character After receiving this termination character the communication controller will forward the received data packet immediately to the host system and use a new data pack
19. _ RXCSOURCE RxClkSource TDRVO09_CLKMULTIPLIER ClockMultiplier unsigned long Baudrate unsigned char ClockInversion unsigned char Encoding TDRVO09_PARITY Parity int Stopbits int Databits TDRV0O09_ENABLE DISABLE UseTermChar char TermChar TDRVO0O9_ENABLE_DISABLE HwHs TDRV009_CRC Cre TDRVO09_OPERATION_MODE_STRUCT TDRVO009 SW 72 LynxOS Device Driver Page 19 of 56 TENSE TECHNOLOGIES CommType This parameter describes the general communication type for the specific channel Possible values are Value Description TDRV009_COMMTYPE_ASYNC TDRV009_COMMTYPE_HDLC_ADDRO Asynchronous communication Standard HDLC communication without address recognition Used for synchronous communication TDRV009_COMMTYPE_HDLC_TRANSP Extended Transparent mode No protocol processing channel works as simple bit collector TransceiverMode This parameter describes the transceiver mode of the programmable multi protocol transceivers Possible values are Value TDRV009_TRNSCVR_NOT_USED TDRV009_TRNSCVR_RS530A TDRV009_TRNSCVR_RS530 TDRVO09_TRNSCVR_X21 TDRV009_TRNSCVR_V35 TDRV009_TRNSCVR_RS449 Description Default V 11 EIA 530A V 11 V 10 EIA 530 V 11 also suitable for RS422 X 21 V 11 V 35 V 35 V 28 EIA 449 V 11 TDRV009_TRNSCVR_V36 V 36 V 11 TDRV009_TRNSCVR_RS232 EIA 232 V 28 TDRV009_TRNSCVR_V28 V 28 V 28 TDRV009_TRNSCVR_NO_ CABLE High impedance Oversampling This parameter enables or disa
20. _C_SET OPERATION MODE rankan ikinen aaa 19 3 5 2 TDRVO09_C_GET_ OPERATION MODE an aA NARAN KA RKENEN ana 25 35 3 TDRV009_ C SET BAUDRATE 31 3 5 4 TDRV009_C_ SET RECEIWNER SIATE cccccccescccceeceeeeeessneeeeesneeeeesaeeeeesneeeeessneeeeneea 32 35 5 TDRV009 C CLEAR RX BUEFEER 33 356 TDRVO09_C SET EXT STALL 34 35 7 TDRV009 SET_READ TIMEOUT 35 3 5 8 TDRVO09_C REG WRITE 36 3 5 9 TDRVO09_C REG READ sescessini uessur inhnneAnK kan AK ENANAR IKKA NA RAAVE aR KRAK KAANAK EANN RAK KEAR NA NEAS 38 3 5 10 TDRV009_C_ SCC REG WRITE 2 0 0 ceccceccesseceeeeneeeeeeeeaeeeseeeaeeessesaeeessesaeeeeseseeeeseaaes 40 3 5 11 TDRV009_C_ GCC REG READ canterieicanaiai i ai aiai 42 3 5 12 TDRV009_C_EEPROM_ WRITE rirerire inr EA E E ER EREA 44 3 5 13 TORVO09 C EEPROM READ rininis iE EEA EA EE EE ERRERA 46 3 5 14 TDRVO09 C E 48 3 5 15 TDRVO09_G RTS CLEAR erei r EE E EN 49 3 5 16 TDRVO09 OT GE EE 50 3 5 17 TFDRVO09_G DTR SE Taneri EE E E A E 51 3 5 18 TORVO99 C DTR CLEAR orenccorieyiiia a E A AS 52 3 5 19 TDRVO09 C DSR GE RE 53 3 5 20 TDRV009 C_WAITFORINTERRUPT eccirni a aai 54 4 DEBUGGING AND DIAGNOSTIC ssssnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnmnnn 56 TDRV009 SW 72 LynxOS Device Driver Page 3 of 56 TENSE TECHNOLOGIES 1 Introduction The TDRV009 SW 72 LynxOS device driver allows the operation of the TDRV009 compatible devices on LynxOS platforms with DRM based PCI interface The standard fil
21. alid values are Value Description TDRV009_CLKMULT_X1 Clock multiplier disabled TDRV009_CLKMULT_X4 Selected input clock is multiplied by 4 Baudrate This parameter specifies the desired frequency to be generated by the Baud Rate Generator BRG which can be used as clock input signal The value is derived from the selected clocksource Please note that only specific values depending on the selected oscillator are valid This frequency is internally multiplied by 16 if oversampling shall be used ClockInversion This parameter specifies the inversion of the transmit and or the receive clock This value can be binary OR ed Possible values are Value Description TDRV009_ CLKINV_NONE no clock inversion TDRV009_CLKINV_TXC transmit clock is inverted TDRV009_ CLKINV_RXC receive clock is inverted TDRVO009 SW 72 LynxOS Device Driver Page 27 of 56 Encoding TENSE TECHNOLOGIES This parameter specifies the data encoding used for communication Valid values are Value TDRV009_ENC_NRZ TDRV009_ENC_NRZI TDRV009_ENC_FMO TDRV009_ENC_FM1 TDRV009_ENC_MANCHESTER Parity Description NRZ data encoding NRZI data encoding FMO data encoding FM1 data encoding Manchester data encoding This parameter specifies the parity bit generation used for asynchronous communication Valid values are Value TDRV009_PAR_DISABLED TDRV009_PAR_EVEN TDRV009_PAR_ODD TDRV009_PAR_SPACE TDRV009_PAR_MARK Stopbits Description No parity gene
22. an be binary OR ed Valid values are Value Description TDRV009_TXCOUT_TXC Transmit clock available at TxC output line TDRV009_TXCOUT_RTS Transmit clock available at RTS output line RxClkSource This parameter specifies the frequency source used as input to the receive engine Valid values are Value Description TDRV009_ RXCSRC_BRG Baud Rate Generator output used for Rx clock TDRV009_ RXCSRC_RXCEXTERN External clock at RxC input used for Rx clock TDRV009_ RXCSRC_DPLL DPLL output used for Rx clock ClockMultiplier This parameter specifies the multiplier used for BRG clock input Valid values are Value Description TDRV0O09_CLKMULT_X1 Clock multiplier disabled TDRV009_CLKMULT_X4 Selected input clock is multiplied by 4 Baudrate This parameter specifies the desired frequency to be generated by the Baud Rate Generator BRG which can be used as clock input signal The value is derived from the selected clock source Please note that only specific values depending on the selected oscillator are valid This frequency is internally multiplied by 16 if oversampling shall be used ClockInversion This parameter specifies the inversion of the transmit and or the receive clock This value can be binary OR ed Possible values are Value Description TDRV009_CLKINV_NONE no clock inversion TDRV009_CLKINV_TXC transmit clock is inverted TDRV009_ CLKINV_RXC receive clock is inverted TDRVO009 SW 72 LynxOS Device Driver Page 21 of 56 Encoding TEN
23. bles 16times oversampling used for asynchronous communication For communication with standard UARTs it is recommended to enable this feature Valid values are Value TDRV009_ DISABLED TDRV009_ ENABLED BrgSource Description The 16 times oversampling is not used The 16 times oversampling is used This parameter specifies the frequency source used as input to the BRG Baud Rate Generator Valid values are Value TDRV009_BRGSRC_XTAL1 TDRV009_BRGSRC_XTAL2 TDRV009_BRGSRC_XTAL3 TDRV009_BRGSRC_RXCEXTERN TDRV009_BRGSRC_TXCEXTERN TDRVO009 SW 72 LynxOS Device Driver Description XTAL1 oscillator is used for BRG input XTAL2 oscillator is used for BRG input XTAL3 oscillator is used for BRG input External clock at RxC input used for BRG input External clock at TxC input used for BRG input Page 20 of 56 TEWS amp TECHNOLOGIES TxClkSource This parameter specifies the frequency source used as input to the transmit engine Valid values are Value Description TDRV009_TXCSRC_BRG Baud Rate Generator output used for Tx clock TDRV009_TXCSRC_BRGDIV16 BRG output divided by 16 used for Tx clock TDRV009_TXCSRC_RXCEXTERN External clock at RxC input used for Tx clock TDRV009_TXCSRC_TXCEXTERN External clock at TxC input used for Tx clock TDRV009_TXCSRC_DPLL DPLL output used for Tx clock TxClkOutput This parameter specifies which output lines are used to output the transmit clock e g for synchronous communication The given values c
24. cy is used for baudrate calculation and describes the input frequency to the Baud Rate Generator BRG The external frequency may be supplied either at input line TxC or RxC The function dependent argument arg passes the clock frequency in Hz EXAMPLE include tdrv009 h int fd int result Specify 1000000Hz 1MHz as external clock frequency result ioctl fd TDRVO09_C_SET_EXT_XTAL char 1000000 if result OK handle ioctl error ERRORS EINVAL Invalid parameter The specified frequency must be larger than 0 Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 34 of 56 3 5 7 TDRV009_C SET READ TIMEOUT NAME TEWS amp TECHNOLOGIES TDRV009_C_SET_READ_TIMEOUT specify a timeout for read operations DESCRIPTION This I O control function specifies the timeout used for read operations The parameter arg passes an unsigned long value containing the new timeout value in system ticks to the device driver EXAMPLE include tdrv009 h int fd int result specify the read timeout 100 clock ticks result ioctl fd TDRV009_C_SE FAD_TIMEOUT OK handle ioctl error if result TDRV009 SW 72 LynxOS Device Driver SC char 100 Page 35 of 56 TENSE TECHNOLOGIES 3 5 8 TDRV009_C_REG_WRITE NAME TDRV009_C_REG_WRITE direc
25. e I O functions open close ioctl provide the basic interface for opening and closing a file descriptor and for performing device I O and configuration operations The TDRV009 SW 72 device driver includes the following functions setup and configure serial channels send and receive data buffers character oriented read and write onboard registers directly read and write access to onboard EEPROM control handshake lines wait for interrupts VVVVVV The TDRV009 SW 72 supports the modules listed below TPMC863 4 Channel High Speed Synch Asynch PMC Serial Interface TPMC363 4 Channel High Speed Synch Asynch PMC Conduction Cooled Serial Interface TAMC863 4 Channel High Speed Synch Asynch AMC Serial Interface TCP863 4 Channel High Speed Synch Asynch CompactPCl Serial Interface In this document all supported modules and devices will be called TDRV009 Specials for a certain device will be advised To get more information about the features and use of TDRVOO9 devices it is recommended to read the manuals listed below TPMC863 or compatible User manual TPMC863 or compatible Engineering Manual TDRVO009 SW 72 LynxOS Device Driver Page 4 of 56 TENSE TECHNOLOGIES 2 Installation Following files are located in the directory TDRV009 SW 72 on the distribution media TDRV009 SW 72 1 0 1 pdf This manual in PDF format TDRV009 SW 72 SRC tar gz Device Driver and Example sources ChangeLog txt Release history
26. er space relative to the beginning of the specific channel s SCC register set The function specific control parameter arg is a pointer to a TDRV009_ADDR_STRUCT structure typedef struct unsigned long Offset unsigned long Value TDRV009_ADDR_STRUCT Offset This parameter specifies a byte offset into the communication controller s channel SCC register space Please refer to the hardware user manual for further information Value This parameter returns the 32bit word from the communication controller s channel SCC register space TDRVO009 SW 72 LynxOS Device Driver Page 42 of 56 TEWS amp TECHNOLOGIES EXAMPLE include tdrv009 h int Zo int result TDRV009_ADDR_STRUCT AddrBuf Read a 32bit value Status Register AddrBuf Offset 0x0004 result ioctl fd TDRVO09_C_SCC_REG_ READ char amp AddrBuf if result OK printf Value 0x 1X n AddrBuf Value else handle ioctl error ERRORS EINVAL The specified offset is invalid Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 43 of 56 TENSE TECHNOLOGIES 3 5 12 TDRV009_C_EEPROM_ WRITE NAME TDRV009_C_EEPROM_ WRITE write value to EEPROM DESCRIPTION This I O control function writes one 16bit word into the onboard EEPROM The first part of the EEPROM is reserved for factory usage write accesses to this area w
27. es for device drivers and its major and minor device declarations Each time the system is rebuild the config utility read this file and produces a new set of driver and device configuration tables and a corresponding nodetab To install the TDRVOO9 driver and devices into the LynxOS system the configuration include file tdrv009 cfg must be included in the CONFIG TBL see also chapter 2 1 1 3 The file tdrv009 cfg on the distribution disk contains the driver entry C tdrv009 and a major device entry D TDRV009 1 tdrv009a_info If the driver should support more than one major device the following entries for major devices must be enabled by removing the comment character By copy and paste an existing major and minor entries and renaming the new entries it is possible to add any number of additional TDRV009 devices This example shows a driver entry with one major device and one minor device Format C driver name open close read write select control install uninstall D device name info block name raw partner nam N node name minor dev C tdrv009 tdrv0090pen tdrv009close tdrv009read tdrv009write tdrv009ioctl tdrv009install tdrv009uninstall TDRVOO9 1 tdrv009a_info tdrv009a_0 0 tdrv009a_1 1 tdrv009a_2 2 tdrv009a_3 3 TDRVOO9 2 tdrv009b_info tdrv009b_0 0 tdrv009b_1 1 tdrv009b_2 2 tdrv009b_3 3 22220 GG GG 0
28. et for further received data Any 8bit value may be used for this parameter HwHs This parameter enables or disables the hardware handshaking mechanism using RTS CTS Valid values are Value TDRVO009_ DISABLED TDRV009_ ENABLED TDRVO009 SW 72 LynxOS Device Driver Description Hardware handshaking is not used Hardware handshaking is used Page 22 of 56 Cre TENSE TECHNOLOGIES This parameter is a structure describing the CRC checking configuration typedef struct TDRV009_CRC_TYPE Type TDRV009 ENABLE DISABLE RxChecking TDRV009_ENABLE DISABLE TxGeneration TDRV009 CRC_RESET ResetValue TDRV009_CRC Type This parameter describes the CRC type to be used Possible values are Value Description TDRV009_CRC_16 16bit CRC algorithm is used for checksum TDRV009_CRC_32 32bit CRC algorithm is used for checksum RxChecking This parameter enables or disables the receive CRC checking Possible values are Value Description TDRV009_DISABLED CRC checking will not be used TDRV009_ENABLED CRC checking will be used TxGeneration This parameter enables or disables the transmit CRC generation Possible values are Value Description TDRV009_DISABLED A CRC checksum will be generated TDRV009_ENABLED A CRC checksum will not be generated ResetValue This parameter describes the reset value for the CRC algorithm Possible values are Value Description TDRV009_CRC_RST_FFFF CRC reset value will be OxFFFF TDRV009_CRC_RST_0000 CRC reset value will
29. file Lttdrv009 ctg TDRVO009 SW 72 LynxOS Device Driver Page 6 of 56 2 1 1 4 TENSE TECHNOLOGIES Rebuild the Kernel Change to the directory sys lynx os sys bsp xxx Enter the following command to rebuild the kernel make install Reboot the newly created operating system by the following command not necessary for KDIs reboot aN The N flag instructs init to run mknod and create all the nodes mentioned in the new nodetab After reboot you should find the following new devices depends on the device configuration dev tdrv009a_0 dev tdrv009a_1 dev tdrv0O09a_2 dev tdrv009a_3 dev tdrv009b_0 dev tdrvO09b_1 TDRVO009 SW 72 LynxOS Device Driver Page 7 of 56 2 1 2 TENSE TECHNOLOGIES Dynamic Installation This method allows you to install the driver after the operating system is booted The driver object code is attached to the end of the kernel image and the operating system dynamically adds this driver to its internal structures The driver can also be removed dynamically 2 1 2 1 1 2 1 2 2 Build the driver object Change to the directory sys drivers xxx tdrv009 where xxx represents the BSP that supports the target hardware To make the dynamic link able driver enter make dldd Create Device Information Declaration Change to the directory sys drivers xxx tdrv009 where xxx represents the BSP that supports the target hardware To create a device de
30. finition file for the major device this works only on native system make t009info To install the driver enter drinstall c tdrv009 o0bj If successful drinstall returns a unique lt driver ID gt To install the major device enter devinstall c d lt driver ID gt t009info The lt driver ID gt is returned by the drinstall command To create a node for the device enter mknod dev tdrv009a_0 c lt major_no gt 0 mknod dev tdrv009a_l c lt major_no gt 1 mknod dev tdrv009a_2 c lt major_no gt 2 mknod dev tdrv009a_3 c lt major_no gt 3 The lt major_no gt is returned by the devinstall command If all steps are successfully completed the TDRVOO9 is ready to use 2 1 2 3 Uninstall dynamic loaded driver To uninstall the TDRV009 device enter the following commands devinstall u c lt device ID gt drinstall u lt driver ID gt TDRVO009 SW 72 LynxOS Device Driver Page 8 of 56 TEWS amp TECHNOLOGIES 2 1 3 Device Information Definition File The device information definition contains information necessary to install the TDRVOO9 major device The implementation of the device information definition is done through a C structure which is defined in the header file tdrvO09_info h This structure contains the following parameter PCIBusNumber Contains the PCI bus number at which the TDRVO09 compatible device is connected Valid bus numbers are in range from 0 to 255 PCIDeviceNumber
31. ill result in an error The function specific control parameter arg is a pointer to a TDRVO09_EEPROM_BUFFER structure typedef struct unsigned long Offset unsigned ong Value TDRVOO9_EEPROM_BUFFER Offset This parameter specifies a 16bit word offset into the EEPROM Following offsets are available Offset Access 00h GER R 60h ZER R W Value This parameter specifies the 16bit word to be written into the EEPROM at the given offset EXAMPLE include tdrv009 h int fd int result TDRV009_EEPROM_BUFFER FepromBuf write a 16bit value into the EEPROM offset 0x61 EepromBuf Offset 0x61 EepromBuf Value 0x1234 TDRVO009 SW 72 LynxOS Device Driver Page 44 of 56 TEWS amp TECHNOLOGIES result ioctl fd TDRV009_C_EEPROM_ WRITE if result OK handle ioctl error char amp RepromBuf ERRORS EIO Error writing to the EEPROM EACCES The specified offset address is invalid or read only Other returned error codes are system error conditions TDRV009 SW 72 LynxOS Device Driver Page 45 of 56 TENSE TECHNOLOGIES 3 5 13 TDRV009_C_EEPROM_READ NAME TDRV009_C_EEPROM_READ read value from EEPROM DESCRIPTION This I O control function reads one 16bit word from the onboard EEPROM The function specific control parameter arg is a pointer to a TDRV009_EEPROM BUFFER structure
32. line De Assert RTS handshake line Read state of CTS Set DTR signal line only channel 3 Clear DTR signal line only channel 3 Read state of DSR only channel 3 Wait for specific channel interrupt See behind for more detailed information on each control code TDRVO009 SW 72 LynxOS Device Driver Page 17 of 56 TEWS amp TECHNOLOGIES RETURNS ioctl returns 0 if successful or 1 on error On error errno will contain a standard error code see also LynxOS System Call ioctl SEE ALSO LynxOS System Call ioctl TDRVO009 SW 72 LynxOS Device Driver Page 18 of 56 TENSE TECHNOLOGIES 3 5 1 TDRV009_C_SET_OPERATION_MODE NAME TDRV009_C_SET_OPERATION_MODE set a channel s operation mode DESCRIPTION This I O control function configures the channel s operation mode The function specific control parameter arg is a pointer to a TDRVO09_OPERATION_MODE_STRUCT structure It is necessary to completely initialize the structure This can be done by calling the I O control function TDRV009_lIOCG_GET_OPERATION_MODE described below A call to this function must be done prior to any communication operation because after driver startup the channel s transceivers are disabled typedef struct TDRV009_COMM_TYPE CommType TDRVO09_TRANSCEIVER_MODE _ TransceiverMode TDRV009_ENABLE_DISABLE Oversampling TDRV009_ BRGSOURCE BrgSource TDRV009_TXCSOURCE TxClkSource unsigned long TxClkOutput TDRV009
33. nd Diagnostic If the driver will not work properly please enable debug outputs by defining the symbols DEBUG DEBUG_TPMC DEBUG_PCI DEBUG_INT_CFG DEBUG_INT_RX and DEBUG_INT_TX The debug output should appear on the console If not please check the symbol KKPF_PORT in uparam h This symbol should be configured to a valid COM port e g SKDB_COM1 The debug output displays the device information data for the current major device like this Bus 1 Dev 2 Func 0 00 035F1498 04 02000000 08 02800000 OC 00005800 10 84000000 14 00000000 18 00000000 1C 00000000 20 00000000 24 00000000 28 00000000 2C 000A1498 30 00000000 34 00000000 38 00000000 3C 0A03010B Found a TDRVO09 compatible module BusNo 1 DevNo 2 TDRV009 Board 0 ctrl_space 0xB4600000 TDRVO09 found TPMC863 10 FPGA Core version 0x4 TDRVOO9 XTAL1 14745600 TDRVOO9 XTAL2 24000000 TDRVOO09 XTAL3 10000000 The debug output above is only an example Debug output on other systems may be different for addresses and data in some locations TDRVO009 SW 72 LynxOS Device Driver Page 56 of 56
34. ntrol function reads one 32bit word from the communication controller s register space relative to the beginning of the register set The function specific control parameter arg is a pointer to a TDRV009_ADDR_STRUCT structure typedef struct unsigned long Offset unsigned long Value TDRVOO9_ADDR_STRUCT Offset This parameter specifies a byte offset into the communication controller s register space Please refer to the hardware user manual for further information Value This parameter returns the 32bit word from the communication controller s register space TDRVO009 SW 72 LynxOS Device Driver Page 38 of 56 TEWS amp TECHNOLOGIES EXAMPLE include tdrv009 h int Zo int result TDRV009_ADDR_STRUCT AddrBuf Read a 32bit value Version Register AddrBuf Offset 0x00F0 result ioctl fd TDRVOO09_C_REG READ char amp AddrBuf if result OK printf Value 0x 1X n AddrBuf Value else handle ioctl error ERRORS EINVAL The specified offset is invalid Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 39 of 56 TENSE TECHNOLOGIES 3 5 10 TDRV009_C_SCC_REG_WRITE NAME TDRV009_C_SCC_REG_WRITE directly write to an SCC register DESCRIPTION This I O control function writes one 32bit word to the communication controllers register space relative to the beginning
35. ration is used EVEN parity bit ODD parity bit SPACE parity bit always insert 0 MARK parity bit always insert 1 This parameter specifies the number of stop bits to use for asynchronous communication Possible values are 1 or 2 Databits This parameter specifies the number of data bits to use for asynchronous communication Possible values are 5 to 8 UseTermChar This parameter enables or disables the usage of a termination character for asynchronous communication Valid values are Value TDRV009_ DISABLED TDRV009_ ENABLED TermChar Description A termination character is not used A termination character is used This parameter specifies the termination character After receiving this termination character the communication controller will forward the received data packet immediately to the host system and use a new data packet for further received data Any 8bit value may be used for this parameter HwHs This parameter enables or disables the hardware handshaking mechanism using RTS CTS Valid values are Value TDRVO009_ DISABLED TDRV009_ ENABLED TDRVO009 SW 72 LynxOS Device Driver Description Hardware handshaking is not used Hardware handshaking is used Page 28 of 56 Cre TENSE TECHNOLOGIES This parameter is a structure describing the CRC checking configuration typedef struct TDRV009_CRC_TYPE Type TDRV009 ENABLE DISABLE RxChecking TDRV009_ENABLE DISABLE TxGeneration
36. s enabled TDRV009_ RCVR_OFF The receiver is disabled EXAMPLE include tdrv009 h int fd int result SS nable the receiver result ioctl fd TDRV0O09_C_SET RECEIVER_STATE if result OK handle ioctl error ERRORS EINVAL Invalid parameter specified Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver char TDRVO009_RCVR_ON Page 32 of 56 TENSE TECHNOLOGIES 3 5 5 TDRV009_C_CLEAR_RX_BUFFER NAME TDRV009 C CLEAR_RX_BUFFER clear the internal receive buffer DESCRIPTION This I O control function removes all received data from the channels receive buffer and flushes the hardware FIFO as well The function dependent argument arg is not used for this function EXAMPLE include tdrv009 h int fd int result Clear receive buffer Ki result ioctl fd TDRVO09_C_CLEAR_RX_BUFFER 0 if result OK handle ioctl error ERRORS EIO Error during reset or init of the receiver s hardware DMA engine Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 33 of 56 TENSE TECHNOLOGIES 3 5 6 TDRV009_C_SET_EXT_XTAL NAME TDRV009_C_SET_EXT_XTAL specify an externally supplied frequency DESCRIPTION This I O control function specifies the frequency of an externally provided clock This frequen
37. t for specific channel interrupt DESCRIPTION This I O control function waits until a specified SCC interrupt or the timeout occurs The function specific control parameter arg is a pointer to a TDRVO09_WAIT_STRUCT structure typedef struct unsigned long Interrupts int Timeout TDRVO09_WAIT_STRUCT Interrupts This parameter specifies specific interrupt bits to wait for If one interrupt occurs the value is returned in this parameter Please refer to the hardware user manual for further information on the possible interrupt bits Timeout This parameter specifies the time in system ticks to wait for an interrupt If 1 is specified the function will block indefinitely EXAMPLE include tdrv009 h int Ea int result TDRV009_WAIT STRUCT WaitStruct fx Wait at least 500 system ticks for a CTS Staus Change CSC interrupt WaitStruct Interrupts 1 lt lt 14 WaitStruct Timeout 500 TDRVO009 SW 72 LynxOS Device Driver Page 54 of 56 TEWS amp TECHNOLOGIES result ioctl fd TDRV0O09_C_WAITFORINTERRUPT char amp WaitStruct if result OK printf Interrupts 0x 1X n WaitStruct Interrupts else handle the error ERRORS EBUSY Too many simultaneous wait jobs active Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 55 of 56 TENSE TECHNOLOGIES 4 Debugging a
38. tly write to a register DESCRIPTION This I O control function writes one 32bit word to the communication controllers register space relative to the beginning of the register set The function specific control parameter arg is a pointer to a TDRV009_ADDR_STRUCT structure typedef struct unsigned long Offset unsigned long Value TDRVOO9_ADDR_STRUCT Offset This parameter specifies a byte offset into the communication controller s register space Please refer to the hardware user manual for further information Value This 32bit word will be written to the communication controllers register space Modifying register contents may result in communication problems system crash or other unexpected behavior TDRVO009 SW 72 LynxOS Device Driver Page 36 of 56 TEWS amp TECHNOLOGIES EXAMPLE include tdrv009 h int fds int result TDRV009_ADDR_STRUCT AddrBuf Write a 32bit value FIFO Control Register 4 AddrBuf Offset 0x0034 AddrBuf Value Oxffffffff result ioctl fd TDRVO09_C_REG_ WRITE char amp AddrBuf if result OK handle ioctl error ERRORS EINVAL The specified offset is invalid Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 37 of 56 TENSE TECHNOLOGIES 3 5 9 TDRV009_C_REG_READ NAME TDRV009_C_REG_READ directly read from a register DESCRIPTION This I O co
39. unction EXAMPLE include tdrv009 h int fd int result Set DTR to LOW only valid for channel 3 s result ioctl fd TDRV009_C_DTR_CLEAR char 0 if result OK handle ioctl error ERRORS EACCES This function is not supported by the specific channel Other returned error codes are system error conditions TDRV009 SW 72 LynxOS Device Driver Page 52 of 56 TEWS amp TECHNOLOGIES 3 5 19 TDRVO009_C_DSR_GET NAME TDRV009_C_DSR_GET Read state of DSR only channel 3 DESCRIPTION This I O control function returns the current state of the DSR signal line of the specific channel This function is only available for local module channel 3 The function dependent argument arg passes a pointer to an unsigned long value to the driver Depending on the state of DSR either 0 inactive or 1 active is returned EXAMPLE include tdrv009 h int fd int result unsigned long DsrState Read DSR state result ioctl fd TDRV009_C_DSR_GET char amp DsrState if result OK printf DSR ld n DsrState else handle the error ERRORS EACCES This function is not supported by the specific channel Other returned error codes are system error conditions TDRVO009 SW 72 LynxOS Device Driver Page 53 of 56 TENSE TECHNOLOGIES 3 5 20 TDRV009_C_WAITFORINTERRUPT NAME TDRV009_C_WAITFORINTERRUPT Wai
40. usncudecwsscuewcusncuoncwsncucucus 5 2 1 Device Driver Installati i scienna te ceneahan ieuceane cxdecadeannuendeehsertananancnupextestsbandtecdpexsestananuencapext 6 2 1 1 Static Installati n 2 ssdessis caviensct ents Pen adecingut ebe ennaa dup easindud stench dee D eg geed 6 2 1 1 1 Build the driver ODjeCt eee cece ee cence ee eeeeeeeeeeeee sete aeeeeeeeaeeeeesaeeeeesaeeeeeseneeeeeeeeeaeees 6 2 1 1 2 Create Device Information Declaration ccccccecsesceeeeeseeeeeseeeeeeeseneeeeesenaeensensaeens 6 2 1 1 3 Modify the Device and Driver Configuration File 6 2 1 1 4 Rebuild bekemel cece eeeeeseeaeceeeeeegcaaaaeaeceseeeeeeaaaeaeeeeeeesesennneeeeeeees 7 21 2 Dynamic Instalatora ern ee AE cue aN ATESA EANA tleecee nee 8 2 1 2 1 Build the driver ObDjeCt o oo ceceeceeeeeeeeeeeeeeeneeeeeeeeeeeeeeaeeeeeeaaeseseaaeeeseeaaeeeseeseeeseeeeneeees 8 2 1 2 2 Create Device Information Declaration cccccccecseseeceseeeeeeseeeeeeeseneseeesseeaeenssesaeens 8 2 1 2 3 Uninstall dynamic loaded Oriver AA 8 2 1 3 Device Information Definition Pie 9 2 1 4 Configuration File CONFEIO TRL ssesseesseesseesseessesseserssrttnnstnttnnstnutnnnnnntnnsnnnnnnnssnnnnnn 10 3 TDRV009 DEVICE DRIVER PDROGRAMMING een 11 Se OPIN EE 11 3 2 ClOSC E 13 Bed ROAM E 14 Se WIINC E a ccteceverscessesectecerenicenntantcscecesucenncesecsceeesadeaudescdeetesndntd send denvescednte SEENEN ENEE 15 BoD MOCK BN 17 3 5 1 TDRVO09
41. ver Description XTAL1 oscillator is used for BRG input XTAL2 oscillator is used for BRG input XTAL3 oscillator is used for BRG input External clock at RxC input used for BRG input External clock at TxC input used for BRG input Page 26 of 56 TENSE TECHNOLOGIES TxClkSource This parameter specifies the frequency source used as input to the transmit engine Valid values are Value Description TDRV009_TXCSRC_BRG Baud Rate Generator output used for Tx clock TDRV009_TXCSRC_BRGDIV16 BRG output divided by 16 used for Tx clock TDRV009_TXCSRC_RXCEXTERN External clock at RxC input used for Tx clock TDRV009_TXCSRC_TXCEXTERN External clock at TxC input used for Tx clock TDRV009_TXCSRC_DPLL DPLL output used for Tx clock TxClkOutput This parameter specifies which output lines are used to output the transmit clock e g for synchronous communication The given values can be binary OR ed Valid values are Value Description TDRV009_TXCOUT_TXC Transmit clock available at TxC output line TDRV009_TXCOUT_RTS Transmit clock available at RTS output line RxClkSource This parameter specifies the frequency source used as input to the receive engine Valid values are Value Description TDRV009_ RXCSRC_BRG Baud Rate Generator output used for Rx clock TDRV009_ RXCSRC_RXCEXTERN External clock at RxC input used for Rx clock TDRV009_ RXCSRC_DPLL DPLL output used for Rx clock ClockMultiplier This parameter specifies the multiplier used for BRG clock input V

Download Pdf Manuals

image

Related Search

Related Contents

Instruction Manual Workout Planner.cdr  取扱説明書  Coleman Cable L1306  American Standard Connoisseur Single Control Kitchen Combi Faucet 4600.104 Series User's Manual  Caméras thermiques pour la sécurité et la surveillance  Maytag MEW7527DS Installation Guide  Tecumseh AKA4476YXC Performance Data Sheet  InLine 16656P power cable    取扱説明書 棚三  

Copyright © All rights reserved.
Failed to retrieve file