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.

What's the difference between SIO_ISSUERECLAIM and SIO_STANDARD

Other Parts Discussed in Thread: CCSTUDIO

Hi,

When I using the ddk\apps\audio\evmdm642\tsk_audio.pjt, I changed the MODEL as SIO_STANDARD,

and using the SIO_STANDARD MODEL:

for(;;){

 if ((nmadus = SIO_get(inStream, (Ptr *)&inbuf)) < 0) {
            SYS_abort("Error reading buffer ");
        }
       
    for (i = 0; i < (nmadus / sizeof(short)); i++) {
            outbuf[i] = inbuf[i];
        }
 
        
    if (SIO_put(outStream, (Ptr *)&outbuf, nmadus) < 0) {
            SYS_abort("Error writing buffer ");
        }

}

But Intermittent worked, 15 senconds worked, another 15 senconds it did not, I defined the BUFSIZE as 3840. Why SIO_ISSUERECLAIM can work, and SIO_STANDARD can't?

What's the difference between SIO_ISSUERECLAIM and SIO_STANDARD?

  • Hi,

     

    SIO_STANDARD and SIO_ISSUERECLAIM models have similar logics. You can find more information about that (similarities and differences) at the documents:

     

    http://focus.ti.com/lit/ug/spru423f/spru423f.pdf (especially chapter 7)

    http://focus.ti.com/lit/ug/spru403o/spru403o.pdf

     

    I see that the example you mentioned is probably for CCS 3.1. There is an example for SIO_standard at the folder (or the equivalent path for your CCS and BIOS version):

     

    C:\CCStudio_v3.1\bios_5_20_05\packages\ti\bios\examples\advanced\streaming\evmDM642\streaming.pjt

     

    This example is not an audio one. I mean, the example above does not interact with the codec, but you could use it to understand SIO_STANDARD logic.

     

    I can see that you are getting buffers from the input stream and not putting any buffers to replace them. Also, you are putting buffers at the output stream and not getting them. This will eventually break.

     

    I did not find any examples for audio (codec) and SIO_STANDARD ready.

     

  • Blusun:

    The SIO_get and SIO_put API require the use of the SIO_standard model, so the failure you observed is expected.

    SIO_issue and SIO_reclaim are a simpler form of get and put, and don't require the standard model.

    The standard model is larger and slower, so the use of SIO_ISSUERECLAIM is preferable if this suits your programming requirements.

    Get and put are 'exchange' API. That is, they trade a TSK buffer for a DEV buffer when asserted. Get trades a full buffer from the device for an empty one from the task, put is the reverse.

    Issue and reclaim are single sided - issue gives a buffer (empty or full) from a TSK to a driver, reclaim requests a buffer back from a driver (empty or full).

    A get or put can be re-written as a set of issue/reclaim API (while simple issue/reclaim actions cannot be fully replicated with get/put). While it may appear to be more code, and therefore slower and larger, it is actually more efficient, since they are simpler mechanisms.

    Most real-time systems using issue/reclaim follow a general pattern in their task coding:

    1- create or declare two (or more) buffers for use in a given stream (single buffer systems are not usually capable of keeping up with constant data flow)

    2- issue all buffers from the TSK to the stream

    3- reclaim a single buffer from the stream

    4- process the buffer

    5- issue the 'used' buffer back to the stream it came from

     

    Here's some example code to that effect:

    short  in[2][BUF];   // 2 in bufs, 
    short  out[2][BUF];    // 2 out bufs,

    void procBuf(){    
     short  i;       // loop index counter
     SIO_Handle sioIn, sioOut;    // stream handles
     short    *pIn, *pOut;    // stream buffer pointers
     SIO_Attrs  attrs = SIO_ATTRS;   // dynamic stream attributes
     
     attrs.model = SIO_ISSUERECLAIM;   // improved SIO w/o get/put

     sioIn  = SIO_create("/dioIn" , SIO_INPUT , 2*BUF, &attrs); // make  in strm
     sioOut = SIO_create("/dioOut", SIO_OUTPUT, 2*BUF, &attrs); // make out strm

     SIO_issue(sioIn , &in[0][HIST], 2*BUF, NULL); // prime in  strm w 1st buf
     SIO_issue(sioIn , &in[1][HIST], 2*BUF, NULL); // prime in  strm w 2nd buf
     SIO_issue(sioOut, &out[0][0]  , 2*BUF, NULL); // prime out strm w 1st buf
     SIO_issue(sioOut, &out[1][0]  , 2*BUF, NULL); // prime out strm w 2nd buf

     while(1){         // forever...
      SIO_reclaim(sioIn , (Ptr *)&pIn , NULL);
      SIO_reclaim(sioOut, (Ptr *)&pOut, NULL);

       for( i = 0; i < BUF; i++ )  // for all new L&R data,
        pOut[i] = pIn[i];    // copy in buf to out buf

      SIO_issue(sioIn , pIn , 2*BUF, NULL);
      SIO_issue(sioOut, pOut, 2*BUF, NULL);
     }
    }