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.

difference between hwi_construct and hwi_create

Other Parts Discussed in Thread: SYSBIOS

Hardware : Tiva C series DK-TM4C129x board with TI-RTOS

I was going through the GPIO interrupt example for the above board and came across the function hwi_construct used to setup the callback for interrupt handling.

Also, I was going through Hardware interrupts section in the SYS-BIOS 6.41 user guide. there is no mention of hwi_construct. but they mention the the following

APIs

hwi_register, hwi_create, etc,,,

I would like to write minimal code in ISR and do the post-processing using SWI by using swi_post (eg. for a packet I receive on UART).  

Any tutorial or example code to help me understand of using HWI and SWI together.

TIA

Narendra

  • Narendra,

    Hwi_construct() is an alternative to Hwi_create().  The key difference is that Hwi_construct() uses a Hwi object pre-allocated by the caller, versus Hwi_create(), which uses a Hwi object it allocates from a heap.  There is some generic discussion of construct model here: rtsc.eclipse.org/.../C_-_construct

    For the TivaC Hwi, module, both options are listed in the “cdoc”: in your TI-RTOS installation,  open “tirtos_docs_overview.html”, click “TI-RTOS Kernel Runtime APIs and Configuration (cdoc)”, and then click on the package “ti.sysbios.family.arm.m3”, and then on the Hwi module.

    If you need to do dynamic creation of kernel objects at runtime, construct is often preferable because a heap (and associated alloc/free code) is not required.  And for the most lean implementation, if the objects can be created statically (in the application configuration), then that is preferable because it eliminates construct/destruct calls in your C code.

    Hope this helps clarify.

    Scott