I'm trying to write drivers for our peripherals using dma's on all writes over 1 word. I use mutexes inside the read and write block functions for the peripheral and I have tried using a suspend within the take/give mutexes to suspend the task while waiting for the isr to return and resume my task. However, I am finding the isr is happening before the suspend is completed, meaning the task never gets resumed because the resume has already happened.
I have thought about using a semaphore but it continues to execute once I have taken the semaphore when what I really want to do is suspend.
What are your thought or suggestions? Any other solutions I'm missing?
First thought - definitely DO NOT use a suspend/resume for synchronising
tasks with interrupts for exactly the reason you have experienced, which
is the reason stated on the API documentation pages for not attempting this.
In most cases the optimal solution is to use a direct to task
notification. See the examples on the following pages: