Obtains a packet of data from the specified channel.
#include txcpi.h
S16 cpia_get_data ( TX_HANDLE handle, CPIPKT *buffer, S16*len)
Argument |
Description |
handle |
TX_HANDLE associated with the asynchronous transmit completion. |
buffer |
Pointer to the CPIPKT buffer to store the received packet. |
len |
Pointer to the size of the buffer on input and the length of the received packet on output. |
Return value |
Description |
CPI_SUCCESS |
Packet successfully received. |
CPI_ERROR |
Call cpi_get_last_error to obtain the error code. |
CPI_INVALID_MODE |
Handle is not open for asynchronous I/O. |
CPI_TRUNCATED |
Received packet was larger than the passed buffer. |
cpia_get_data obtains a packet of data from the channel. On entry, the passed length parameter is checked. If the length is less than the received message, then len bytes of the message are copied to buffer and CPI_TRUNCATED is returned. The length of the received packet is placed in len.
Call cpia_get_data from within cpia_rxnotify. Calling cpia_get_data from outside cpia_rxnotify can result in communication errors.