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.

EDMA3 LLD and multiple tasks

Other Parts Discussed in Thread: SYSBIOS

Consider the following situation:

I have two tasks of equal priority, each needs to do QDMA transfers.  They both start out blocked by a semaphore and then task1 gets unblocked by an external event, in this case a notification from syslink.  Task1 starts up its QDMA.  Soon after, before task1 is done, task2 receives a notification and is unblocked.  Task1 is suspended and task2 starts up, but task2 cannot startup its QDMA as the edma3init() returns an error (-128).  Apparently the EDMA3 LLD is not thread safe.  How should this situatioon be dealt with?  Is there a way to suspend all other tasks while task1 does its DMA?

Lee Holeva

 

  • Lee,

    Sounds like you need some sort of GateMutex that is shared between the two tasks to prevent concurrent access to the QDMA code.

    Are these SYSBIOS tasks?  If so SYSBIOS has a Module called ti.sysbios.gates.GateMutex.

    Judah

  • Lee,

    Are you calling edma3init() from both the threads and it is giving the error in one of the threads while other is initializing?

    edma3init should be called once and the handler should be used by both the threads to request the channels with their own callback functions.

    -- Prasad

  • Prasad Konnur said:

    Are you calling edma3init() from both the threads and it is giving the error in one of the threads while other is initializing?

    Right now I have each thread call edma3init(). 

    Prasad Konnur said:

    edma3init should be called once and the handler should be used by both the threads to request the channels with their own callback functions.

    I tried this, but when the notification caused a switch to task3 the channel allocation failed.  Each task needs two QDMA channels.  Protecting the DMA code with a GateMutex solves the problem.

    Lee Holeva