background image

TIP675-SW-42 – VxWorks Device Driver

Page 19 of 31

4.3.1 FIO_T675_SET_DIR

NAME

FIO_T675_SET_DIR – Set direction of I/O lines

DESCRIPTION

With this ioctl function each of the 48 I/O line may be individually set as input or output. After driver
startup all I/O lines are set to be inputs. To set a line to be input, set the corresponding bit in the mask
to 1.

The direction mask (

T675_DIRECTION_STR

) will be passed in the ioctl argument

arg

to the driver.

typedef struct

{

unsigned short

dir_1_16;

unsigned short

dir_17_32;

unsigned short

dir_33_48;

} T675_DIRECTION_STR;

dir_1_16

Specifies the line direction for I/O-line 1 up to 16. (Line 1 is assigned to bit 0, line 2 to bit 1 and
so on.)

dir_17_32

Specifies the line direction for I/O-line 17 up to 32. (Line 17 is assigned to bit 0, line 18 to bit 1
and so on.)

dir_33_48

Specifies the line direction for I/O-line 33 up to 48. (Line 33 is assigned to bit 0, line 34 to bit 1
and so on.)

Summary of Contents for TIP675-SW-42

Page 1: ...Issue 1 2 1 June 2008 TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC Am Bahnhof 7 25469 Halstenbek Germany www tews com Phone 49 0 4101 4058 0 Fax 49 0 4101 4058 19 e mail info tews com 9190 Double Dia...

Page 2: ...lete 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 th...

Page 3: ...r in Tornado IDE project 6 2 2 System resource requirement 7 3 I O SYSTEM FUNCTIONS 8 3 1 tip675Drv 8 3 2 tip675DevCreate 10 4 I O FUNCTIONS 13 4 1 open 13 4 2 close 15 4 3 ioctl 17 4 3 1 FIO_T675_SET...

Page 4: ...cludes the following functions reading the input register writing the output register programming direction of every I O line configure simultaneous update feature connect interrupt callback functions...

Page 5: ...AC Carrier Driver CARRIER SW 42 is part of this TIP675 SW 42 distribution It is located in directory CARRIER SW 42 on the corresponding distribution media This IPAC Device Driver requires a properly i...

Page 6: ...rmation ChangeLog txt Release history 2 1 Include device driver in Tornado IDE project For Including the TIP675 SW 42 device driver into a Tornado IDE project follow the steps below 1 Copy the files f...

Page 7: ...phores 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 d...

Page 8: ...tip675Drv installs the TIP675 driver in the I O system SYNOPSIS include tip675 h STATUS tip675Drv void DESCRIPTION This function initializes the TIP675 driver and installs it in the I O system The cal...

Page 9: ...e 9 of 31 ERROR CODES The error codes are stored in errno and 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...

Page 10: ...tion must be called before performing any I O request to this device PARAMETER name This string specifies the name of the device that will be used to identify the device for example for open calls dev...

Page 11: ...retrieved by CARRIER Driver ipFindDevice function EXAMPLE include tip675 h STATUS result TIP675_DEVCONFIG tip675Conf struct ipac_resource ipac IPAC CARRIER Driver initialization Find an IP module fro...

Page 12: ...e stored in errno ERROR CODES The error codes are stored in errno and can be read with the function errnoGet Error code Description S_ioLib_NO_DRIVER Driver not installed run tip675Drv S_tip675Drv_IAR...

Page 13: ...int open const char name int flags int mode DESCRIPTION Before I O can be performed to the TIP675 device a file descriptor must be opened by invoking the basic I O function open PARAMETER name Specifi...

Page 14: ...Handle error RETURNS A device descriptor number or ERROR if the function fails an error code will be stored in errno ERROR CODES The error codes are stored in errno and can be read with the function e...

Page 15: ...e SYNOPSIS int close int fd DESCRIPTION This function closes opened devices PARAMETER fd This file descriptor specifies the device to be closed The file descriptor has been returned by the open functi...

Page 16: ...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 The error code is a standard error code set...

Page 17: ...uide I O system PARAMETER fd This file descriptor specifies the device to be used The file descriptor has been returned by the open function request This argument specifies the function that shall be...

Page 18: ...e function RETURNS Function dependent value described with the function 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...

Page 19: ...direction mask T675_DIRECTION_STR will be passed in the ioctl argument arg to the driver typedef struct unsigned short dir_1_16 unsigned short dir_17_32 unsigned short dir_33_48 T675_DIRECTION_STR di...

Page 20: ...ection Line 1 24 output Line 25 32 input dBuf out_1_16 0xFFFF dBuf out_17_32 0x00FF dBuf out_33_48 0x0000 retval ioctl fd FIO_T675_SET_DIR int dBuf if retval ERROR handle function specific error condi...

Page 21: ...g line unsigned long arg base Base address of the IP s I O space inBuf Current content of the IP s input registers for a buffer description refer to the FIO_T675_READ ioctl function line I O line at w...

Page 22: ...ned argument will be passed in the 4 th argument to the user supplied callback function This argument could be a semaphore ID a message ID or whatever funcPtr This parameter contains a pointer to a fu...

Page 23: ...GE IsfPar funcPtr callback IsfPar arg 0 retval ioctl fd FIO_T675_INSTALL_ISF int IsfPar if retval ERROR handle function specific error conditions ERRORS S_t675Drv_ILINE Specified I O line out of range...

Page 24: ...r and the edge must be passed in the ioctl argument arg to the driver typedef struct unsigned short io_line unsigned short edge T675_REMOVE_ISF_STR io_line I O line specifying the callback function to...

Page 25: ...O line 24 Interrupt on hi transition RsfPar io_line 24 RsfPar edge T675_POS_EDGE retval ioctl fd FIO_T675_REMOVE_ISF int RsfPar if retval ERROR handle function specific error conditions ERRORS S_t675D...

Page 26: ...the inputs and outputs to be latched on the rising edge of the external clock while setting arg to T675_NEG_EDGE will latch the inputs and outputs on the falling edge EXAMPLE include tip675 h int fd...

Page 27: ...IP675 After driver startup the simultaneous update feature is disabled The optional argument must be set to 0 EXAMPLE include tip675 h int fd int retval Disable simultaneous update of inputs and outpu...

Page 28: ...struct unsigned short in_1_16 unsigned short in_17_32 unsigned short in_33_48 T675_READ_STR in_1_16 Returns the content of the input register for I O line 1 up to 16 Line 1 is assigned to bit 0 line 2...

Page 29: ...fd retval ioctl fd FIO_T675_READ int rBuf if retval ERROR handle function specific error conditions else printf Input 1 16 04X n rBuf in_1_16 printf Input 17 32 04X n rBuf in_17_32 printf Input 33 48...

Page 30: ...rt out_1_16 unsigned short out_17_32 unsigned short out_33_48 T675_WRITE_STR out_1_16 Specifies the output value that will be written into the output register for I O line 1 up to 16 Line 1 is assigne...

Page 31: ...s 48 1 of the device associated with fd wBuf out_1_16 0x9abc wBuf out_17_32 0x5678 wBuf out_33_48 0x1234 retval ioctl fd FIO_T675_WRITE int wBuf if retval ERROR handle function specific error conditio...

Reviews: