Hi,
I am working on K2K platform. I need to use QMSS which is shared by 8 DSP cores and each core has multi threads. I found one example code which is showed below.
Void* Osal_qmssAccCsEnter (Void)
{
/* Get the hardware semaphore.
*
* Acquire Multi core QMSS synchronization lock
*/
while ((CSL_semAcquireDirect (QMSS_ACC_HW_SEM)) == 0);
/* Disable all interrupts and OS scheduler.
*
* Acquire Multi threaded / process synchronization lock.
*/
coreKey [CSL_chipReadDNUM ()] = Hwi_disable();
return NULL;
}
Say that I have 2 tasks: Task_1 which has lower priority than Task_2. If Task_1 got QMSS_ACC_HW_SEM and Task_2 is triggered before Hwi_disable(), and Task_2 will call this function also, there will be a deadlock.
My question is that how this code prevent there won't be an interrupt between CSL_semAcquireDirect (QMSS_ACC_HW_SEM) and Hwi_disable()?