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.

Posting a Semaphore by a HWI

Other Parts Discussed in Thread: SYSBIOS

Hi,

i want to post a semaphore via a HWI to wake the Task waiting for the completion of an EDMA request.
I came to the following cfg code, but this results in a linker error, indication that  Semaphore_post cannot be resolved.
This is most likely, because the argument of  Semaphore_post is not an uint32_t.

Is there an other method to post the Semaphore without writing an own ISR posting the Semaphore?

Thanks for your help,

Sebastian

Here the cfg code:

var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');

var semaphore0Params = new Semaphore.Params();
semaphore0Params.instance.name = "sem_aif_edma_completion";
semaphore0Params.mode = Semaphore.Mode_BINARY;
Program.global.sem_aif_edma_c2_completion = Semaphore.create(null, semaphore0Params);

    /* Transfer completion ISR */
CpIntc.sysInts[24].fxn = '&Semaphore_post';    //function pointer to the HWI function
CpIntc.sysInts[24].arg = Program.global.sem_aif_edma_c2_completion;        //argument to the HWI function
CpIntc.sysInts[24].hostInt = 8;    
CpIntc.sysInts[24].enable = true;    //enable interrupt at startup

    /* Transfer completion ISRs */
CpIntc.mapHostIntToHwiMeta(8, 4);

  • Hi Sebastian,

    Can you just mention the version of CCS and SYS/BIOS +Your hardware details ????

    -Studinstru

  • we are using bios_6_33_04_39 on a C6670 with Compiler Version 7.3.7.

    The event i want to handle is a C66x CorePac Secondary Interrupt (Event# 24) and therefore is handled via the Chip Interrupt Controller (CpIntc).

    But the linking error also occurs for a normal HWI like this:

    Program.global.hwi_4 = Hwi.create(4, "&Semaphore_post", hwiParams);


    Here is the Linker error:

     undefined      first referenced                                                                                                         
      symbol            in file                                                                                                              
     ---------      ----------------                                                                                                         
     Semaphore_post /home/xxx/bios/debug/configPkg/package/cfg/bios_pe66.oe66

    using  Semaphore_post(sem_aif_edma_c2_completion); in other parts of the code works fine.

  • Hi Sebastian,

    You cannot call a XDC spec'ed function like Semaphore_post()  from a static Hwi. You will need to write a simple ISR handler wrapper to call Semaphore_post(). Something like this:

    #include <ti/sysbios/knl/Semaphore.h>

    // Install mysem_post as the handler in your .cfg

    mysem_post(UArg arg) {

        return Semaphore_post((Semahore_Handle)arg);

    }

    Best,

    Ashish

  • I want to add to my earlier post. The reason why you cannot directly register XDC-spec'd functions with the dispatcher is because there is a bug with xgconf tool.

    Best,

    Ashish

  • I noticed, that i should have used "&ti_sysbios_knl_Semaphore_post__E" . This directly leads to an error in building the RTSC configuration project:

    "package/cfg/bios_pe66.c", line 3784: error: declaration is incompatible with "void ti_sysbios_knl_Semaphore_post__E(ti_sysbios_knl_Semaphore_Handle)" (declared at line 343 of "/opt/ti/mcsdk/bios_6_33_04_39/packages/ti/sysbios/knl/Semaphore.h")
    1 error detected in the compilation of "package/cfg/bios_pe66.c".

    So i will use a small HWI like in your previous post.


    Thanks, Sebastian