Download P2P Software Library and Utilities User Manual The Goebel Company
Transcript
P2Psim Hardware Manual April 15, 2013 Description This function returns a pointer to the next packet of data in the read buffer. Note BUFFERED mode must be selected when using this function. By using this function the copy of packet data from the read buffer to a user buffer can be avoided. Note, the packet data must be consumed by the caller before subsequent calls to p2p_read_pkt. It is allowed to change data in the packet buffer, however, care should be taken to not exceed the packet size indicated in hdr.length. Example p2p_rx_packet_t *pbuf; pbuf = p2p_read_pkt(boardHdl); if (pbuf == 0 || pbuf == P2P_CALL_FAILED) return errno; /* error */ length = pbuf->hdr.length; Parameters hdl board handle returned by p2p_open with P2P_OPEN_READ_BUFFERED or P2P_OPEN_READ_ASYNC selected. Returns The function returns a pointer to the next read packet, or zero if the end of read data is reached. If an error occurred, P2P_CALL_FAILED is returned and errno will contain the error code. Errors EINVAL hdl is not a valid handle returned from p2p_open 4.7.3 p2p_channel_read Synopsis #include <p2p_lib.h> int p2p_channel_read(p2p_hdl_t hdl, p2p_rx_packet_t *packet, int size); Description This function reads a packet from the channel identified by hdl. This function is used to read from a specific channel. This differs from a buffered mode, where the board handle is read, and packets from any channel may be returned. A packet header precedes the packet data returned. Parameters hdl value returned by p2p_channel_open or p2p_label_open. © The Goebel Company e-mail: [email protected] Page 56 / 83