Tews Technologies TPMC866-SW-42 User Manual

Vxworks device driver 8 channel serial pmc

Advertisement

Quick Links

The Embedded I/O Company
TPMC866-SW-42
TEWS TECHNOLOGIES GmbH
Am Bahnhof 7
25469 Halstenbek, Germany
www.tews.com
VxWorks Device Driver
8 Channel Serial PMC
Version 2.0.x
User Manual
Issue 2.0.1
September 2008
Phone: +49 (0) 4101 4058 0
Fax: +49 (0) 4101 4058 19
e-mail: info@tews.com
TEWS TECHNOLOGIES LLC
9190 Double Diamond Parkway,
Suite 127, Reno, NV 89521, USA
www.tews.com
Phone: +1 (775) 850 5830
Fax: +1 (775) 201 0347
e-mail: usasales@tews.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TPMC866-SW-42 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Tews Technologies TPMC866-SW-42

  • Page 1 VxWorks Device Driver 8 Channel Serial PMC Version 2.0.x User Manual Issue 2.0.1 September 2008 TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC Am Bahnhof 7 Phone: +49 (0) 4101 4058 0 9190 Double Diamond Parkway, Phone: +1 (775) 850 5830 25469 Halstenbek, Germany...
  • Page 2 TPMC866-12 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. 1998-2008 by TEWS TECHNOLOGIES GmbH...
  • Page 3: Table Of Contents

    4.5.4 FIOSTOPBITS .......................27 4.5.5 FIOPARITY ........................28 4.5.6 FIOENABLEHWHS......................29 4.5.7 FIODISABLEHWHS.......................30 4.5.8 FIOSETBREAK......................31 4.5.9 FIOCLEARBREAK......................32 4.5.10 FIOCHECKBREAK ......................33 4.5.11 FIOCHECKERRORS.....................34 4.5.12 FIORECONFIGURE ......................35 APPENDIX........................ 36 5.1 Predefined Symbols........................36 5.2 Additional Error Codes.........................37 TPMC866-SW-42 - VxWorks Device Driver Page 3 of 37...
  • Page 4: Introduction

    1 Introduction The TPMC866-SW-42 VxWorks device driver allows the operation of the TPMC866 serial PMC 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(), fprintf(), fscanf(), ...).
  • Page 5: Installation

    Release information 2.1 Include device driver in Tornado IDE project For Including the TPMC866-SW-42 device driver into a Tornado IDE project follow the steps below: (1) Copy the files from the distribution media into a subdirectory in your project path.
  • Page 6: System Resource Requirement

    <total requirement> = <driver requirement> + (<number of devices> * <device requirement>) The maximum usage of some resources is limited by adjustable parameters. If the application and driver exceed these limits, increase the according values in your project. TPMC866-SW-42 - VxWorks Device Driver Page 6 of 37...
  • Page 7: O System Functions

    A call to this function is the first thing the user has to do before adding any device to the system or performing any I/O request. EXAMPLE #include "tpmc866.h” … STATUS result; … /*------------------- Initialize Driver -------------------*/ result = tpmc866Drv(); if (result == ERROR) /* Error handling */ … TPMC866-SW-42 - VxWorks Device Driver Page 7 of 37...
  • Page 8 ERROR CODES The error codes are stored in errno and can be read with the function errnoGet(). Error code Description ENXIO No TPMC866 found SEE ALSO VxWorks Programmer’s Guide: I/O System TPMC866-SW-42 - VxWorks Device Driver Page 8 of 37...
  • Page 9: Tpmc866Devcreate()

    VxWorks pciFindDevice() function will find the devices. rdBufSize This value specifies the size of the receive software FIFO. wrtBufSize This value specifies the size of the transmit software FIFO. TPMC866-SW-42 - VxWorks Device Driver Page 9 of 37...
  • Page 10 Selects the parity checking mode (use predefined values in tpmc866.h) Handshake If hardware handshake is enabled or disabled (after startup) select YES to use the handshake lines, otherwise NO. This parameter is ignored for TPMC866-11/-12. TPMC866-SW-42 - VxWorks Device Driver Page 10 of 37...
  • Page 11 512 bytes. Baudrate: 115200Baud Options: Terminal FIFOs: disabled Databits: Stopbits: Parity: Handshake: off ModelType: TPMC866-10 -------------------------------------------------------------*/ result = tp866DevCreate ("/tp866/1", 0, 512, 512, &tp866setup); if (result == ERROR) /* Error handling */ TPMC866-SW-42 - VxWorks Device Driver Page 11 of 37...
  • Page 12 RETURNS OK or ERROR (if the driver is not installed, or the channel is invalid or the device already exists) TPMC866-SW-42 - VxWorks Device Driver Page 12 of 37...
  • Page 13: O Interface Functions

    Before I/O can be performed to the TPMC866 device, a file descriptor must be opened by invoking the basic I/O function open(). PARAMETER name Specifies the device which shall be opened flags Not used mode Not used TPMC866-SW-42 - VxWorks Device Driver Page 13 of 37...
  • Page 14 /* Handle errror */ … RETURNS A device descriptor number or ERROR (if the device does not exist or no device descriptors are available) SEE ALSO ioLib, basic I/O routine - open() TPMC866-SW-42 - VxWorks Device Driver Page 14 of 37...
  • Page 15: Close()

    EXAMPLE STATUS retval; … /*---------------- close the device ----------------*/ retval = close(fd); RETURNS OK or ERROR. If the function fails, an error code will be stored in errno. TPMC866-SW-42 - VxWorks Device Driver Page 15 of 37...
  • Page 16 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 I/O routine - close() TPMC866-SW-42 - VxWorks Device Driver Page 16 of 37...
  • Page 17: Read()

    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). TPMC866-SW-42 - VxWorks Device Driver Page 17 of 37...
  • Page 18 /* handle the read error */ RETURNS Number of bytes read or ERROR. If the function fails an error code will be stored in errno. SEE ALSO ioLib, basic I/O routine - read() TPMC866-SW-42 - VxWorks Device Driver Page 18 of 37...
  • Page 19: Write()

    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. TPMC866-SW-42 - VxWorks Device Driver Page 19 of 37...
  • Page 20 /* handle the write error */ RETURNS Number of bytes written or ERROR. If the function fails an error code will be stored in errno. SEE ALSO ioLib, basic I/O routine - write() TPMC866-SW-42 - VxWorks Device Driver Page 20 of 37...
  • Page 21: Ioctl()

    (TPMC866-10 only) FIODISABLEHWHS disable hardware handshaking FIOSETBREAK set BREAK signal FIOCLEARBREAK clear BREAK signal FIOCHECKBREAK check for received BREAK signal FIOCHECKERRORS read error status flags FIORECONFIGURE reconfigure channels to default values TPMC866-SW-42 - VxWorks Device Driver Page 21 of 37...
  • Page 22 The error code is a standard error code set by the I/O system (see VxWorks Reference Manual). Function specific error codes will be described with the function. SEE ALSO ioLib, basic I/O routine - ioctl() TPMC866-SW-42 - VxWorks Device Driver Page 22 of 37...
  • Page 23: Fiobaudrate

    Set baud rate to 9600 -------------------------*/ result = ioctl (fd, FIOBAUDRATE, 9600); if (result == OK) /* Success */ else /* Function failed */ ERROR CODES Error code Description S_tp866Drv_IARG Invalid baudrate specified TPMC866-SW-42 - VxWorks Device Driver Page 23 of 37...
  • Page 24: Fiofifo

    [TP866F_NO| 0..127] If one FIFO trigger is set to TP866F_NO both FIFOs are disabled. Both FIFO trigger levels must be set up to use the FIFO. TPMC866-SW-42 - VxWorks Device Driver Page 24 of 37...
  • Page 25 = ioctl (fd, FIOFIFO, (TP866F_R8 << 8) | TP866F_T16); if (result == OK) /* Success */ else /* Function failed */ ERROR CODES Error code Description S_tp866Drv_IARG Invalid parameter specified TPMC866-SW-42 - VxWorks Device Driver Page 25 of 37...
  • Page 26: Fiodatabits

    Set channel to a word length of 7 bit -------------------------------------*/ result = ioctl (fd, FIODATABITS, TP866DB_7); if (result == OK) /* Success */ else /* Function failed */ ERROR CODES Error code Description S_tp866Drv_IARG Invalid parameter specified TPMC866-SW-42 - VxWorks Device Driver Page 26 of 37...
  • Page 27: Fiostopbits

    Set channel to a stop bit length of 1 bit -----------------------------------------*/ result = ioctl (fd, FIOSTOPBITS, TP866SB_10); if (result == OK) /* Success */ else /* Function failed */ ERROR CODES Error code Description S_tp866Drv_IARG Invalid parameter specified TPMC866-SW-42 - VxWorks Device Driver Page 27 of 37...
  • Page 28: Fioparity

    Configure channel no parity -------------------------------*/ result = ioctl (fd, FIOPARITY, TP866NOP); if (result == OK) /* Success */ else /* Function failed */ ERROR CODES Error code Description S_tp866Drv_IARG Invalid parameter specified TPMC866-SW-42 - VxWorks Device Driver Page 28 of 37...
  • Page 29: Fioenablehwhs

    This function is only available for TPMC866-10, used for other types will lead to an error. EXAMPLE #include "tpmc866.h” result; … /*----------------------------------------------------------- Enable hardware handshaking -----------------------------------------------------------*/ result = ioctl (fd, FIOENABLEHWHS, 0); if (result == OK) /* Success */ else /* Function failed */ TPMC866-SW-42 - VxWorks Device Driver Page 29 of 37...
  • Page 30: Fiodisablehwhs

    This function is only available for TPMC866-10, used for other types will lead to an error. EXAMPLE #include "tpmc866.h” result; … /*----------------------------------------------------------- Disable hardware handshaking -----------------------------------------------------------*/ result = ioctl (fd, FIODISABLEHWHS, 0); if (result == OK) /* Success */ else /* Function failed */ TPMC866-SW-42 - VxWorks Device Driver Page 30 of 37...
  • Page 31: Fiosetbreak

    The function specific control parameter arg is not used. EXAMPLE #include "tpmc866.h” result; … /*----------------------------------------------------------- Set the break flag -----------------------------------------------------------*/ result = ioctl (fd, FIOSETBREAK, 0); if (result == OK) /* Success */ else /* Function failed */ TPMC866-SW-42 - VxWorks Device Driver Page 31 of 37...
  • Page 32: Fioclearbreak

    The function specific control parameter arg is not used. EXAMPLE #include "tpmc866.h” result; … /*----------------------------------------------------------- Clear the break flag -----------------------------------------------------------*/ result = ioctl (fd, FIOCLEARBREAK, 0); if (result == OK) /* Success */ else /* Function failed */ TPMC866-SW-42 - VxWorks Device Driver Page 32 of 37...
  • Page 33: Fiocheckbreak

    … /*----------------------------------------------------------- Check the break flag -----------------------------------------------------------*/ result = ioctl (fd, FIOCHECKBREAK, &break_rcv); if (result == OK) /* Success */ if (break_rcv) printf(“BREAK received.\n”); else /* Function failed */ TPMC866-SW-42 - VxWorks Device Driver Page 33 of 37...
  • Page 34: Fiocheckerrors

    -----------------------------------------------------------*/ result = ioctl (fd, FIOCHECKERRORS, &errors_rcv); if (result == OK) /* Success */ if (errors_rcv & TP866_FRAMING_ERR) printf(“FRAMING error\n”); if (errors_rcv & TP866_PARITY_ERR) printf(“PARITY error\n”); else /* Function failed */ TPMC866-SW-42 - VxWorks Device Driver Page 34 of 37...
  • Page 35: Fioreconfigure

    #include "tpmc866.h” result; … /*----------------------------------------------------------- Reset the channel to its default values -----------------------------------------------------------*/ result = ioctl (fd, FIORECONFIGURE, 0); if (result == OK) /* Success */ else /* Function failed */ TPMC866-SW-42 - VxWorks Device Driver Page 35 of 37...
  • Page 36: Appendix

    PARITY Settings: TP866NOP No parity checking TP866ODP Create and check odd parity TP866EVP Create and check even parity ERRORSTATUS Bits: TP866_FRAMING_ERR (1 << 0) Framing error TP866_PARITY_ERR (1 << 1) Parity error TPMC866-SW-42 - VxWorks Device Driver Page 36 of 37...
  • Page 37: Additional Error Codes

    5.2 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(). S_tp866Drv_IARG 0x08660100 Invalid argument TPMC866-SW-42 - VxWorks Device Driver Page 37 of 37...

Table of Contents