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...
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(), ...).
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.
<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...
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...
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 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...
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...
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...
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...
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...
(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...
[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...
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...
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...
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...
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...
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...
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...
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...
Need help?
Do you have a question about the TPMC866-SW-42 and is the answer not in the manual?
Questions and answers