co_error co_stream_read(co_stream stream,                         void *buffer,                         size_t buffersize); 

Header File



This function reads a data packet from a previously opened stream. This function must be called from within a process run function.


The arguments for co_stream_read are as follows:

co_stream stream

A pointer to a stream as passed on the process argument list.

void *buffer

A pointer to the destination variable, where read data will be stored. The destination is typically a local variable or array element.

size_t buffersize

The size of the destination buffer in bytes. This number must be at least as large as the stream's packet width (in bytes), as specified by co_stream_create.

Return Value

Possible return values are listed, with the resulting value of co_errno shown in parentheses:


Success (CO_ENOERROR).


Encountered an end-of-stream token (CO_EEOS).


The stream argument is NULL (CO_ENULL_PTR) or the buffersize argument is smaller than the stream's packet width in bytes (CO_EINVALID_STREAM_WIDTH).


The stream is not open for read (CO_ENOT_OPEN).


The co_stream_read function must be used only on streams that have been opened with mode O_RDONLY.

The co_stream_read function blocks (waits) if the stream is empty or until the writer closes the stream.

    Practical FPGA Programming in C
    Practical FPGA Programming in C
    ISBN: 0131543180
    EAN: 2147483647
    Year: 2005
    Pages: 208 © 2008-2017.
    If you may any questions please contact us: