diff --git a/mcfw/src_linux/links/system/system_common.c b/mcfw/src_linux/links/system/system_common.c index 1870f8f..39a1f0b 100755 --- a/mcfw/src_linux/links/system/system_common.c +++ b/mcfw/src_linux/links/system/system_common.c @@ -66,6 +66,9 @@ Int32 System_init() memset(&gSystem_objCommon, 0, sizeof(gSystem_objCommon)); + status = OSA_mutexCreate(&gSystem_objCommon.linkControlMutex); + UTILS_assert(status==OSA_SOK); + System_ipcInit(); IpcBitsInLink_init(); @@ -89,6 +92,8 @@ Int32 System_init() Int32 System_deInit() { + Int32 status; + #ifdef SYSTEM_DEBUG printf ( " %u: SYSTEM: System Common De-Init in progress !!!\n", OSA_getCurTimeInMsec()); #endif @@ -105,6 +110,9 @@ Int32 System_deInit() OSA_mbxDelete(&gSystem_objCommon.mbx); + status = OSA_mutexDelete(&gSystem_objCommon.linkControlMutex); + UTILS_assert(status==OSA_SOK); + #ifdef SYSTEM_DEBUG printf ( " %u: SYSTEM: System Common De-Init Done !!!\n", OSA_getCurTimeInMsec()); #endif diff --git a/mcfw/src_linux/links/system/system_linkApi_local.c b/mcfw/src_linux/links/system/system_linkApi_local.c index bda4c57..2b212df 100755 --- a/mcfw/src_linux/links/system/system_linkApi_local.c +++ b/mcfw/src_linux/links/system/system_linkApi_local.c @@ -17,6 +17,8 @@ Int32 System_linkControl_local(UInt32 linkId, UInt32 cmd, Void *pPrm, UInt32 prm UTILS_assert( linkId < SYSTEM_LINK_ID_MAX); + if (waitAck) + { + OSA_mutexLock(&gSystem_objCommon.linkControlMutex); + + } pToMbx = &gSystem_objCommon.linkObj[linkId].pTsk->mbxHndl; if(waitAck) @@ -24,6 +26,7 @@ Int32 System_linkControl_local(UInt32 linkId, UInt32 cmd, Void *pPrm, UInt32 prm status = OSA_mbxSendMsg(pToMbx,&gSystem_objCommon.mbx, cmd, pPrm, flags); + if (waitAck) + { + OSA_mutexUnlock(&gSystem_objCommon.linkControlMutex); + + } return status; } diff --git a/mcfw/src_linux/links/system/system_priv_common.h b/mcfw/src_linux/links/system/system_priv_common.h index a367f48..a0c7435 100755 --- a/mcfw/src_linux/links/system/system_priv_common.h +++ b/mcfw/src_linux/links/system/system_priv_common.h @@ -53,6 +53,7 @@ typedef struct */ typedef struct { + OSA_MutexHndl linkControlMutex; OSA_MbxHndl mbx; System_LinkObj linkObj[SYSTEM_LINK_ID_MAX]; diff --git a/mcfw/src_linux/osa/src/osa_mbx.c b/mcfw/src_linux/osa/src/osa_mbx.c index c7e2384..2cc5083 100755 --- a/mcfw/src_linux/osa/src/osa_mbx.c +++ b/mcfw/src_linux/osa/src/osa_mbx.c @@ -73,6 +73,10 @@ int OSA_mbxSendMsg(OSA_MbxHndl *pMbxTo, OSA_MbxHndl *pMbxFrom, Uint32 cmd, void waitAck = FALSE; retVal = OSA_msgGetAckStatus(pRcvMsg); } + else { + OSA_printf("OSA_MBX:MSG RECEIVED OUT OF ORDER.SERIOUS ERROR!!! Expected[%d]:Received[%d]",pSentMsg->cmd,pRcvMsg->cmd); + OSA_assert(FALSE); + } OSA_mbxFreeMsg(pRcvMsg);