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.

Cannot get SIO_STANDARD mode audio streaming to work on OMAP-L137

There are two parts to this question, the first is a general question about using SIO_STANDARD streaming in DSP/BIOS with dynamically allocated buffers. According to the documentation for SIO_create:


If the stream is being opened in SIO_STANDARD mode, SIO_create
allocates buffers of size bufsize for use by the stream. Initially these
buffers are placed on the device todevice queue for input streams, and
the device fromdevice queue for output streams.

What the documentation does not say is how to retrieve the one of these buffers for the first call to SIO_put (or SIO_get for input streams, but my example currently only does output). Since these functions do an exchange of buffers, it seems that there needs to be something to exchange with. Here are the various things I have tried:

  1. Call SIO_put with a NULL buffer (ie no exchange). This doesn't work.
  2. Call SIO_reclaim (even though the documentation says not to). SIO_reclaim just blocks in this case.
  3. Example code for SIO_STANDARD uses static buffers and retrieves the first buffer with SIO_staticbuf, attempting to do this without a static buffer does not work.
  4. Ignore the fact that SIO_create is documented to automatically allocate buffers and allocate my own. This works initially, but then fails.

Having failed to get anything working with dynamic buffers, I have tried to get something working with static buffers. However, this also fails. I have attached the code for the example that I am using, the DSP/BIOS configuration is in build/sine_standard.tcf and build/sine_standard.tci. When I try to run the program it does not reach main and gets stuck somewhere in the driver configuration.

I would be grateful if someone could take a look at the configuration and suggest why this might be happening.

  • Hi,

    Thanks for your post.

    Which TI BIOS PSP package version? Do you see any issues in McASP driver API's? Kindly elloborate more details on the issue.

    In which BIOS PSP example are you facing issues?

    Thanks & regards,

    Sivaraj K

  • 2072.sine_standard.zip

    Thanks for your reply Sivaraj. I am trying to do my own example since none of the PSP examples use the SIO_STANDARD model. I forgot to attach the code to the last post, apologies for this, I have attached it to this one.

    A lot the code in my example is identical to the PSP audio driver example. I have removed everything related to setting up the input part of the example, with, as far as I can see, only the code for setting up the output remaining. Obviously since I am attempting to use the SIO_STANDARD model with static buffers, I have changed the code to use SIO_put instead of SIO_issue/SIO_reclaim and moved the creation of the SIO stream to the configuration files mentioned.

    To be 100% clear though, the McASP output configuration remains identical to the PSP audio example.

    To elaborate more on what happens when I debug the program in the attached example, the program does not reach main and so does not execute any of the C code which I have changed. Instead it gets stuck in the function aic31I2cWrite in the file packages/ti/pspiom/platforms/codec/aic31_src/Aic31.c in the PSP drivers source tree. This appears to be due to either me giving the wrong configuration in either of the files build/sine_standard.tcf or build/sine_standard.tci in the source code which I have now attached or a bug in the drivers themselves. Please take a look at the tcf/tci files to see if there are any obvious mistakes.

    The package versions that I am using are:

    DSP/BIOS 5.41.03.17

    PSP drivers 01.30.01

    EDMA3 LLD 01.11.00.03

  • Hi,

    Thanks for your post.

    There are some constraints and calling context with reference to SIO_put & SIO_get API calls which are below:

    • The stream must not be created with attrs.model set to SIO_ISSUERECLAIM. The results of calling

                 SIO_put on a stream created for the issue/reclaim model are undefined.

            •    SIO_put cannot be called from a SWI or HWI.

    • This API is callable from the program’s main() function only if the stream's configured timeout

                attribute is 0, or if it is certain that there is a buffer available to be returned.

    For more details on the above API's, I would recommend you to check section 2.27 SIO_Module API constraints and calling context in the DSP/BIOS API reference guide as below:

    http://www.ti.com/lit/ug/spru403s/spru403s.pdf

    I also recommend you to refer section 7.3.1, buffer exchange and Fig. 7-3 to know how SIO_get works and there are good examples which explores the basic SIO_functions and it follows the SIO_STANDARD streaming model with static buffer creation. Kindly refer examples 7.5, 7.7 , 7.9, 7.15 & 7.16 in the DSP/BIOS v5.42 user guide as below:

    http://www.ti.com/lit/ug/spru423i/spru423i.pdf

    http://smartdata.usbid.com/datasheets/usbid/2000/2000-q3/spru403.pdf

    Note: If the stream was opened using the SIO_STANDARD streaming model, it should also frees all buffers remaining in the stream. User-held stream buffers should be explicitly freed by the user’s code via SIO_delete(stream). Please refer the example 7-21 from the above doc. for the DEV_Handle structure which has the following parameters:

    todevice is used to transfer DEV_Frame frames to the device. In the SIO_STANDARD (DEV_STANDARD) streaming model, SIO_put puts full frames on this queue, and SIO_get puts empty frames here. In the SIO_ISSUERECLAIM (DEV_ISSUERECLAIM) streaming model, SIO_issue places frames on this queue.

    fromdevice is used to transfer DEV_Frame frames from the device. In the SIO_STANDARD DEV_STANDARD) streaming model, SIO_put gets empty frames from this queue, and SIO_get gets full frames from here. In the SIO_ISSUERECLAIM (DEV_ISSUERECLAIM) streaming model, SIO_reclaim retrieves frames from this queue.

    Addition references for DSP/BIOS FAQ's and Debugging tips are as below:

    http://processors.wiki.ti.com/index.php/DSP_BIOS_FAQ

    http://processors.wiki.ti.com/index.php/DSP_BIOS_Debugging_Tips#Cause:_Invoking_BIOS_APIs_from_the_wrong_context

    http://www.ti.com/lit/an/spra640a/spra640a.pdf

    http://www.ti.com/lit/an/spraa25/spraa25.pdf

    Thanks & regards,

    Sivaraj K

    ------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

     

  • To answer the first part of this question regarding the dynamic buffers and SIO_STANDARD, here is a code snippet which shows the method I am now using:

    Ptr buffer;
    SIO_Handle stream;
    DEV_Frame *frame;
    
    // default - SIO_STANDARD, 2 buffers
    SIO_Attrs sioAttrs = SIO_ATTRS;
    
    stream = SIO_create( "/dioHandle",
                            SIO_OUTPUT,
                            BUFSIZE,
                            &sioAttrs );
    
    frame = QUE_get( &stream->framelist );
    buffer = frame->addr;
    
    for( ... )
    {
        // process buffer
    
        if( SIO_put(stream, &buffer, BUFSIZE) < 0 )
        {
            // handle error
        }
    }
    

    Using the above appears to be correct as I now have a working SIO_STANDARD streaming example with dynamic buffers. Note that the initial buffer is found on the framelist of the SIO object, not on the fromdevice as documented. Directly after the SIO_create call, both fromdevice and todevice are empty queues and so looking there does not appear to be the answer.

    The function to use to retrieve the buffer is QUE_get, with the result being cast to DEV_Frame pointer. The buffer is then the addr member of the resulting structure.


    Note that none of the above is documented anywhere and that all the examples work with static buffers created in the DSP/BIOS configuration. If the above is the correct way to do it, I'm sure this would be very helpful to someone else if something similar was added to the official documentation.


    As for the static buffer configuration, as far as I can see the code I have written is consistent will all the above literature and further examples that I found in the DSP/BIOS installation tree. I still have absolutely no idea why it doesn't work.

  • Hi,

    Thanks for your update

    According to the above literature documents shared and as per my opinion, the examples should work with static buffers created with DSP/BIOS configuration.

    Regards,

    Sivaraj K

    ------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

  • Bumping this because I now want to do the same with SIO_get. I have tried the same approach as worked with SIO_put above, but result is that SIO_get hangs. How do you retrieve the initial buffer for use with SIO_get?