This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSPLink + RingIO problem reading buffer with variable attribute set.

Hi

I've encountered strange problem with RingIO module within DSPLink API.

I've set up GPP as a writer client and DSP as a reader client. When I set variable attribute on GPP side there is a problem reading the buffer on DSP side.

RingIO_acquire returns RINGIO_EFAILURE when this attribute is set at offset different than 0. Let's say we set the attribute at offset 10 for example, and want to read it with RingIO_acquire pSize set to 100 for example then bang! So the question is how should I properly read the buffer when I expect an attribute set somewhere within the acquired buffer? I need RINGIO_NEED_EXACT_SIZE flag to be set.

In the manual: "The attributes written by the writer should be 'read' before the reader can read any more data after the offset at which the attribute is set". So how to read it if I read buffer in constant blocks and don't know in advance where to expect the attribute.

Thanks for any help.

suhl

 

  • Hi,

    This is not explicitly mentioned in the document, but this behaves as follows:

    When RINGIO_NEED_EXACT_SIZE flag is set, error will be returned if you cannot get a valid buffer of exactly the size you have specified. But, as you saw, the attributes written by the writer must be read before the reader can read any data from that offset. Hence, a valid buffer of your required size is only available if:

    1. Sufficient valid data is available.

    2. Valid data of the required size can be returned as a contiguous buffer (this also depends on footbuffer configuration, which is detailed in the ProgrammersGuide document).

    3. An attribute is not present within the requested data size.

    If an attribute is present within the requested data size, with RINGIO_NEED_EXACT_SIZE set, it means an error. Reader is expected to read exactly the amount of data till the attribute and then only you can read the attribute. Since reader does not know where the attribute is set, you cannot do this.

    So, the solution to your problem is:

    1. Do not use RINGIO_NEED_EXACT_SIZE. In this case, your data acquire will return you data as per size requested/upto the first attribute/valid/contiguous data, whichever comes first. The acquire API also returns information about the amount of data size that you got, and the status code returned would indicate which condition caused lesser data (in case that happened), so that you can take the appropriate action after that. For example, presence of early attribute would give a RINGIO_SPENDINGATTRIBUTE status code.

    2. If you must use RINGIO_NEED_EXACT_SIZE, set your attributes at the same data size intervals that the reader will read, so that you will always be able to successfully acquire data and attributes.

    Regards,
    Mugdha

  • Hi Mugdha

     

    Thanks for your fast reply. Now it seems to be more clear how it works. I actually used the same approach as you suggested in 2nd solution. It works great.

    Thank you very much.

     

    Kind regards

    Konrad