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.

Send IPC message from an Interrupt handler (in an irq context)

Other Parts Discussed in Thread: SYSBIOS

Hello,

in my SYSBIOS application I can use functions like MessageQ_put() and MessageQ_create() from a Task.create()-Context. But when I try to call this functions when I'm in an IRQ (Interrupt handler) this methods never return. What would be a good practice to send an IPC message from an IRQ-context.

Ideas:

- Is it the designed behavior of sysbios that this methods hang when called from an IRQ ? (Or is this allready some Kind of error)

- Is there something as tasklets (like in Linux) or dsr (like in ecos) which one should use in SYSBIOS ?

- Or should one Task wait for a signal set by the IRQ ? (What mechanism can be recommended, just give me the buzzword)

What's a good practice to send an IPC (sharedmem) message from an IRQ handler (PCIe Interrupt 4 on DSPC-8681 with four TI C6678).

 

Thanks a lot,

Roelof

  • Hello,

    here's the solution I found by just using a Semaphore:

    #include <xdc/cfg/global.h>
    #include <ti/sysbios/knl/Semaphore.h>

    void irq_handler (UArg Params) {
        ...
        Semaphore_post(pcie_semaphore);
    }

    int master_main() {
        while(1) {
          Semaphore_pend(pcie_semaphore, BIOS_WAIT_FOREVER);
          hprpc_irq_process();
        }
    }

    void hprpc_irq_process() {
        ... IPC like MessageQ_Put() can be used here as we are in a clean Task context.
    }

     

    ---------------------------------------------------------------
    .cfg file:

    var Sem = xdc.useModule ('ti.sysbios.knl.Semaphore');
    var sem0Params = new Sem.Params();
    sem0Params.instance.name = "pcie_semaphore";
    sem0Params.mode = Sem.Mode_BINARY;
    Program.global.pcie_semaphore = Sem.create(null, sem0Params);

     

    var Task    =   xdc.useModule('ti.sysbios.knl.Task');
    var tskMainThread        =  Task.create("&master_main");
    tskMainThread.stackSize  = 0x2000;
    tskMainThread.priority   = 0x5;
    tskMainThread.instance.name = "master_main";

  • Glad to see this was resolved.