Waits a specified amount of time (in milliseconds) and returns a packet if one is received.
#include txcpi.h
S16 cpi_wait_msg ( TX_HANDLE handle, CPIPKT *buffer, S16*len, S32 millisecs)
Argument |
Description |
handle |
TX handle associated with the channel. |
buffer |
Pointer to the address to which to copy the received buffer. |
len |
Pointer to the length of the buffer on input and the length of the received packet on output. |
millisecs |
Amount of time to wait before returning the packet. |
Return value |
Description |
CPI_SUCCESS |
Packet successfully received in buffer. |
CPI_ERROR |
Call cpi_get_last_error to obtain the error code. |
CPI_TIMEOUT |
No packet to receive. |
CPI_TRUNCATED |
Received length is longer than the specified buffer length. |
cpi_wait_msg recovers received packets from the channel associated with the specified handle. Upon entry, len contains the size of the buffer. If there is a packet to receive, the length is placed in len and the packet is placed in the specified buffer.