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.

For some functions of APIs in the VICP signal processing library, there is some questions

Other Parts Discussed in Thread: CCSTUDIO

1.Please tell me what does the function CPIS_isr() perform, and what is the intent of using it? The function is defined as:

void CPIS_isr() {

    VICPIntFlag= 1;

}

2.The wait function used by the example code is CPIS_wait_Fxn(void *arg). In the function only pole for VICPIntFlag. In actual application, this shoud be replaced with Semaphore. About this, can you give me an example? I don’t understand how to replace the VICPIntFlag, and why do I replace it with Semaphore?

3.The usage example of matMul API defines the values of params.matWidth and params.matHeight as 10, when fill the Matrix buffer with random data, the size is BLOCK_HEIGHT*BLOCK_HEIGHT*2, that is 10*10*2.  why the Matrix size mutiply 2 ?

thank you!

  • Hello Kathy,

     I would recommend you refer to section 2.2.4 (Synchronous and Asynchronous Execution) and section 2.2.5 (Wait Callback) to understand how the synchronization scheme works. Refer the UG at:

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

     I'll also now try to answer the specific questions you have asked:

     

    > 1.Please tell me what does the function CPIS_isr() perform, and what is the intent of using it? The function is defined as:

    void CPIS_isr() {

        VICPIntFlag= 1;

    }

     When using asynchronous mode of execution, the VICP H/W accelerator generates DSP interrupt to signal that the requested processing has been completed. The application code (in this case the usage example) needs to:

    * Enable the DSP interrupt so that the interrupt can be received

    * Assign a function (ISR) that should be called when the interrupt is received

     The usage example uses the CPIS_isr function as the ISR. You can see the setup being done in the usage example:

        /* Hook up the ISR for the VICP */

        HWI_eventMap(VECTID_VICP, EVENTID_VICP);

        HWI_dispatchPlug(VECTID_VICP, (Fxn)CPIS_isr, NULL, NULL);

        C64_enableIER(1 << VECTID_VICP);

     

    Please refer the DSP-BIOS UG for the above APIs.

     Once the application receives the interrupt, it needs to set a flag or post a semaphore to remember that the VICP processing is completed. This is required so that the CPIS_wait_Fxn (callback function used by the CPIS_wait) can know when to return. In the usage example case, a global flag is used instead of a semaphore.

     

    > 2.The wait function used by the example code is CPIS_wait_Fxn(void *arg). In the function only pole for VICPIntFlag. In actual application, this shoud be replaced with Semaphore. About this, can you give me an example? I don't understand how to replace the VICPIntFlag, and why do I replace it with Semaphore?

     There are two questions:

    * Why do I replace it with Semaphore?

    In simple words, to better utilize DSP MIPS. Let me explain: In any application, you will generally have multiple tasks to do. For ex, you may want to run a DSP algorithm and also at lower priority communicate with another device to send debug/status information. Now, you may only want to do the lower priority task if the higher priority 'DSP algorithm task' is not active. You will notice in the example code, the CPIS_wait_Fxn will continue waiting in the while loop till the time the VICP doesn't finish its operation. This is inefficient as the DSP can for ex perform the lower priority task instead of waiting for the VICP to complete the processing. Using a semaphore can allow such implementation

     

    * I don't understand how to replace the VICPIntFlag:

    This is what you will do. At the beginning of the application, you will create a semaphore using DSP-BIOS API:

    SEM_create (vicpSem = SEM_create(0, NULL)).

    The CPIS_isr code will be modified to post a semaphore instead of setting the global flag.

    void CPIS_isr() {

        SEM_post (vicpSem);

    }

    The CPIS_wait_Fxn will be modified to pend for the semaphore:

       /*

          Replace the below:

            while (VICPIntFlag==0);

            VICPIntFlag= 0;

       */      

        SEM_pend(vicpSem);

     At this point, if you have a lower priority task in your system, the control will be passed to the lower priority task. As soon as the VICP interrupt happens and the semaphore is posted, the control will be returned to the high priority task.

    I assume you understand how to create tasks in DSP-BIOS environment. If not, please refer the DSP-BIOS UG and look at some examples at:

    C:\CCStudio_v3.3\bios_5_33\packages\ti\bios\examples

     > 3.The usage example of matMul API defines the values of params.matWidth and params.matHeight as 10, when fill the Matrix buffer with random data, the size is BLOCK_HEIGHT*BLOCK_HEIGHT*2, that is 10*10*2.  why the Matrix size mutiply 2 ?

     The matMul API supports both 8bit data and 16bit data. The buffer is filled assuming the worst case of 16bit data. Thus, you see x2 to ensure the API has enough data to work with even if the datatype is 16bit.

     

    Hope the above helps.

    Regards,

    Gagan

     

  • I see, thank you for your help.[:)]