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.

SWI and HWI C function calltree problem

Hi All,

 

I am new to use TI-RTOS. I have a bit confusion about HWI, SWI and TASK. Because I have some experience of using FreeRTOS-like RTOSes, so for the TASK I have no problem to understand it in TI-RTOS. But the two concepts 'SWI' and 'HWI', I cannot understand them well.

According to some references, I know HWI and SWI use the same C STACK (system STACK). Both of them cann't be blocked until they complete there execution. And both of them have priorities. The low priority HWI/SWI can be preempted by high priority HWI/SWI.  

And HWI is essentially some C callback functions called in ISR function. 

But I don't know where the TI-RTOS schedules SWIs. From the study vedio  of TI-RTOS SWI, it pointed that

SWI function is also scheduled in ISR function. See below picture 'run any posted Swis'. 

 

 

Above is my understanding about the scheduling of HWI and SWI. Please correct me if I'm wrong.

Thanks and Best Regards.

Brian.

 

  • Bing,

    what version of SYS/BIOS are you using?

    From my understanding, the Swi scheduler can be invoked whenever you call a Swi_post() or Swi_restore(). Have you seen the online SYS/BIOS Swi training?

    http://processors.wiki.ti.com/index.php/SYS/BIOS_Training:_Swis

  • Hi Tom,

    Thanks. My verision is bios_6_40_01_15. I will study the online training in more detail. By the way, I want to know whether the Swis scehduler is called inside the Swi_post() or Swi_restore() or is just is triggerred by the two functions and is called in another place.

    Best Regards.

  • Bing WANG said:
    I want to know whether the Swis scehduler is called inside the Swi_post() or Swi_restore() or is just is triggerred by the two functions and is called in another place.

    It's literally called within the Swi_post() or Swi_restore() when called from a Task context.

    For dispatched interrupts, Swis are disabled before your Hwi function is executed and (Swi_)restore(d) afterwards which calls the Swi scheduler. There is some logic in the Swi_post() call so it won't execute the Swi scheduler when its called from a Hwi context as Hwis must run to completion.