Opens a channel for synchronous I/O on the host.
Note: Use cpia_open or cpix_open to open all channels to TX boards.
#include txcpi.h
TX_HANDLE cpi_open ( U16 port, S16 mode, S16 *rcvr (S16 handle, S16 len))
Argument |
Description |
port |
Combination of the TX board number and the channel number. Use the PORT macro to combine a board number and channel number into a port. |
mode |
Unused and retained for backwards compatibility. |
rcvr |
Unused and retained for backwards compatibility. |
Return value |
Description |
CPI_INVALID_HANDLE |
Unable to open the channel. |
TX_HANDLE is operating-system specific. Since this return value is passed back only to other CPI calls, the type is not important to the application. When the handle is required for a wait call (WaitForSingleObject in Windows, poll in UNIX), use cpi_wait_obj (handle) to access the proper element for each operating system, as follows:
WaitForSingleObject (cpi_wait_obj (handle), 0);
For multiple-threaded applications, the thread that opens a channel should be the same thread that processes all I/O for that channel. Otherwise, unpredictable behavior can result.