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.

C6670 MCSDK API calling from HWI/SWI

Guru 15520 points

Hi,

I have a question about C6670 BIOS MCSDK.

We are trying to use FFTCP driver provided from MCSDK.
In our program, Fftc_rxOpen() is called from SWI(Software Interrupt) routine.
But just after calling Fftc_rxOpen() the execution terminates.

Is it allowed to call FFTCP and SRIO driver API from HWI and SWI?
Or should it be call from TSK thread of BIOS?

best regards,
g.f.

  • Hi g.f.,

    I'm not familiar with C66 FFTCP and SRIO, but I checked the Fftc_rxOpen source code in PDK.
    Actually, it has a handle and a parameter as API arguments.
    And depending on the passing parameter, I saw this API is calling Semaphore_create().
    As you know, Semaphore_create() is not allowed to call in Hwi/Swi context. 
    Please go to Cdoc to confirm this. 

    So, in API design point of view, I believe you should not call Fftc_rxOpen in Hwi/Swi context.
    It can be moved to Task threads.

    Regards,
    Kawada 

  • Hi Kawada-san,

    Thank you for the reply.

    I checked the SRIO source code,
    they are also calling Semaphore_create and Semaphore_pend.

    So, these API which calling Semaphore API need to be call from TSK thread, right?
    In other word, is it allowed to call LLD driver API which not calling Semaphore
    from SWI or HWI thread?

    I'm confusing about how to choose the best thread to be used for calling driver API.
    I uderstand that HWI are time critical, so it is about SWI and TSK.
    Most of MCSDK exapmple are using TSK and no SWI. Is it typical to use TSK?
    Sorry, but can you give me an advice?

    best regards,
    g.f.

  • Hi g.f.,

    I think using Task is general on Bios system because Task can do more complicated processing than Swi. Task threads can block so they can wait for the callback from HW or other process by using Semaphore, but Swi can't do that. Swi is one-shot processing and basically it should be used as a tasklet for Hwi. So in general, Hwi/Swi is for peripheral drivers and Task is for application.

    I'm not sure LLD is using Semaphore or not, but I think it is better for you to create the app with Task.

    Hope this could answer your question.

    Regards, Kawada

  • Hi,

    I received the question via a coworker, and replied to you directly, but in Japanese. :)  I agree to Kawada san's answers.

    If you have any additional questions, please post here and/or contact me.

    Regards,
    Atsushi

  • Hi Kawada-san and Yokoyama-san,

    Thank you for the reply.
    I am sorry that I couldn't understand easily.
    I was able to understand now. I appreciate.

    best regards,
    g.f.

  • Hi g.f. and Yokoyama-san,

    Looks like giving some confusions to you in the previous post.. sorry for that, but good to know that the answer helped to promote your understanding.

    Best Regards,
    Kawada 

  • Hi Kawada-san,

    Thank you for the reply.

    Your answer helped me so much.
    I really appreciate.
    Thank you for your kindness.

    best regards,
    g.f.