diff --git a/mcfw/interfaces/link_api/system_common.h b/mcfw/interfaces/link_api/system_common.h index 13b995e..702064f 100755 --- a/mcfw/interfaces/link_api/system_common.h +++ b/mcfw/interfaces/link_api/system_common.h @@ -81,6 +81,7 @@ #define SYSTEM_IPC_SR_VIDEO_FRAME (2) #define SYSTEM_IPC_SR_AVSYNC (0) #define SYSTEM_IPC_SR_EXTRA_HEAP (3) +#define SYSTEM_IPC_SR_MAX (16) #define SYSTEM_IPC_PROC_NAME_DSP "DSP" #define SYSTEM_IPC_PROC_NAME_M3VIDEO "VIDEO-M3" diff --git a/mcfw/src_linux/links/audio/audio_utils.c b/mcfw/src_linux/links/audio/audio_utils.c index 9348059..6c0ea96 100755 --- a/mcfw/src_linux/links/audio/audio_utils.c +++ b/mcfw/src_linux/links/audio/audio_utils.c @@ -17,6 +17,7 @@ #include #include #include +#include #define SR_FRAME_BUFFERS_ID 1 /* same as UTILS_MEM_VID_BITS_BUF_HEAP */ /** ------ Globals */ @@ -97,7 +98,7 @@ Void *Audio_allocateSharedRegionBuf (Int32 bufSize) IHeap_Handle heap = NULL; Void *tmp = NULL; - heap = SharedRegion_getHeap(SR_FRAME_BUFFERS_ID); + heap = System_ipcGetSRHeap(SR_FRAME_BUFFERS_ID); tmp = Memory_calloc (heap, bufSize, 128, NULL); if (tmp) { @@ -110,7 +111,7 @@ Void Audio_freeSharedRegionBuf (Void *buf, Int32 bufSize) { IHeap_Handle heap = NULL; - heap = SharedRegion_getHeap(SR_FRAME_BUFFERS_ID); + heap = System_ipcGetSRHeap(SR_FRAME_BUFFERS_ID); if (heap) { Memory_free(heap, buf, bufSize); diff --git a/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c b/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c index c8afa56..b7d1dfe 100755 --- a/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c +++ b/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c @@ -615,7 +615,7 @@ static Int IpcBitsOutLink_createOutObj(IpcBitsOutLink_Obj * pObj) &pObj->createArgs.inQueInfo, &pObj->outQueInfo); elemId = 0; - srBitBufHeapHandle = SharedRegion_getHeap(srIndex); + srBitBufHeapHandle = System_ipcGetSRHeap(srIndex); OSA_assert(srBitBufHeapHandle != NULL); cacheLineSize = SharedRegion_getCacheLineSize(srIndex); @@ -688,7 +688,7 @@ static Int IpcBitsOutLink_deleteOutObj(IpcBitsOutLink_Obj * pObj) const UInt32 srIndex = SYSTEM_IPC_SR_CACHED; elemId = 0; - srBitBufHeapHandle = SharedRegion_getHeap(srIndex); + srBitBufHeapHandle = System_ipcGetSRHeap(srIndex); OSA_assert(srBitBufHeapHandle != NULL); for (poolId = 0; poolId < pObj->outQueInfo.allocPoolInfo.numPools; poolId++) { @@ -1160,7 +1160,7 @@ Void ipcbitsoutlink_do_delete_ch_buffer_pool(IpcBitsOutLink_Obj * pObj, Int status,i; SystemIpcBits_ListElem *pListElem; - srBitBufHeapHandle = SharedRegion_getHeap(srIndex); + srBitBufHeapHandle = System_ipcGetSRHeap(srIndex); OSA_assert(srBitBufHeapHandle != NULL); OSA_assert(OSA_queGetQueuedCount(&pObj->listElemQue[chId]) == @@ -1330,7 +1330,7 @@ Int32 IpcBitsOutLink_doChBufCreate(IpcBitsOutLink_Obj * pObj, numBufs = pObj->outQueInfo.allocPoolInfo.bufPoolInfo[chId].numBufs; totBufSize = bufSize * numBufs; printf ("###Bit buff of size from the SR # %d : %d\n", srIndex, totBufSize); - srBitBufHeapHandle = SharedRegion_getHeap(srIndex); + srBitBufHeapHandle = System_ipcGetSRHeap(srIndex); OSA_assert(srBitBufHeapHandle != NULL); Memory_getStats(srBitBufHeapHandle,&memstats); if (memstats.largestFreeSize >= totBufSize) diff --git a/mcfw/src_linux/links/system/system_ipc.c b/mcfw/src_linux/links/system/system_ipc.c index f3a1901..df1457d 100755 --- a/mcfw/src_linux/links/system/system_ipc.c +++ b/mcfw/src_linux/links/system/system_ipc.c @@ -42,6 +42,31 @@ Int32 System_printProcId(UInt32 procId) return 0; } +static +Void system_ipc_set_srheaps() +{ + Int i; + memset(gSystem_ipcObj.srHeaps,0,sizeof(gSystem_ipcObj.srHeaps)); + for (i = 0; i < SharedRegion_getNumRegions();i++) + { + OSA_assert(i < OSA_ARRAYSIZE(gSystem_ipcObj.srHeaps)); + gSystem_ipcObj.srHeaps[i] = SharedRegion_getHeap(i); + } +} + +static +Void system_ipc_reset_srheaps() +{ + memset(gSystem_ipcObj.srHeaps,0,sizeof(gSystem_ipcObj.srHeaps)); +} + +IHeap_Handle System_ipcGetSRHeap(UInt32 srIndex) +{ + OSA_assert(srIndex < OSA_ARRAYSIZE(gSystem_ipcObj.srHeaps)); + return gSystem_ipcObj.srHeaps[srIndex]; +} + + Int32 System_ipcInit() { printf(" %u: SYSTEM: IPC init in progress !!!\n", OSA_getCurTimeInMsec()); @@ -59,6 +84,8 @@ Int32 System_ipcInit() System_ipcNotifyInit(); + system_ipc_set_srheaps(); + printf(" %u: SYSTEM: IPC init DONE !!!\n", OSA_getCurTimeInMsec()); @@ -69,6 +96,8 @@ Int32 System_ipcDeInit() { printf(" %u: SYSTEM: IPC de-init in progress !!!\n", OSA_getCurTimeInMsec()); + system_ipc_reset_srheaps(); + System_ipcNotifyDeInit(); System_ipcMsgQDeInit(); diff --git a/mcfw/src_linux/links/system/system_ipc_listMP.c b/mcfw/src_linux/links/system/system_ipc_listMP.c index 09edee6..9de8462 100755 --- a/mcfw/src_linux/links/system/system_ipc_listMP.c +++ b/mcfw/src_linux/links/system/system_ipc_listMP.c @@ -200,7 +200,7 @@ UInt32 System_ipcListMPAllocListElemMem(UInt32 regionId, UInt32 size) Error_Block eb; UInt32 shAddr; - heapHndl = SharedRegion_getHeap(regionId); + heapHndl = System_ipcGetSRHeap(regionId); UTILS_assert(heapHndl!=NULL); Error_init(&eb); @@ -222,7 +222,7 @@ Int32 System_ipcListMPFreeListElemMem(UInt32 regionId, UInt32 shAddr, UInt32 siz { IHeap_Handle heapHndl; - heapHndl = SharedRegion_getHeap(regionId); + heapHndl = System_ipcGetSRHeap(regionId); UTILS_assert(heapHndl!=NULL); Memory_free(heapHndl, (Ptr)shAddr, size); diff --git a/mcfw/src_linux/links/system/system_ipc_msgq.c b/mcfw/src_linux/links/system/system_ipc_msgq.c index d534949..89db70a 100755 --- a/mcfw/src_linux/links/system/system_ipc_msgq.c +++ b/mcfw/src_linux/links/system/system_ipc_msgq.c @@ -115,7 +115,7 @@ Int32 System_ipcMsgQHeapCreate() printf(" %d: SYSTEM: Creating MsgQ Heap [%s] ...\n", OSA_getCurTimeInMsec(), msgq_heap_name); - srHeap = SharedRegion_getHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT); + srHeap = System_ipcGetSRHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT); UTILS_assert(srHeap != NULL); gSystem_ipcObj.msgQHeapBaseAddr = @@ -166,7 +166,7 @@ Int32 System_ipcMsgQHeapDelete() status = HeapMemMP_delete(&gSystem_ipcObj.msgQHeapHndl); UTILS_assert(status == OSA_SOK); - srHeap = SharedRegion_getHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT); + srHeap = System_ipcGetSRHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT); UTILS_assert(srHeap != NULL); Memory_free(srHeap, @@ -586,7 +586,7 @@ static Void system_ipc_msgq_register_rpe_msgq_heap() IHeap_Handle srHeap; UTILS_assert(Rpe_messageqHeapId != SYSTEM_IPC_MSGQ_HEAP); - srHeap = SharedRegion_getHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT); + srHeap = System_ipcGetSRHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT); UTILS_assert(srHeap != NULL); MessageQ_registerHeap(srHeap, diff --git a/mcfw/src_linux/links/system/system_priv_ipc.h b/mcfw/src_linux/links/system/system_priv_ipc.h index 6b4e192..ba0dbe0 100755 --- a/mcfw/src_linux/links/system/system_priv_ipc.h +++ b/mcfw/src_linux/links/system/system_priv_ipc.h @@ -35,6 +35,7 @@ typedef struct { MessageQ_Msg freeMsgQueMem[(SYSTEM_IPC_MSGQ_HEAP_SIZE/SYSTEM_IPC_MSGQ_MSG_SIZE_MAX)]; System_ipcNotifyCb notifyCb[SYSTEM_LINK_ID_MAX]; + IHeap_Handle srHeaps[SYSTEM_IPC_SR_MAX]; } System_IpcObj; @@ -73,5 +74,6 @@ Int32 System_ipcCopySlaveCoreSymbolContents(char *symbolName, UInt16 procId, Ptr dstPtr, UInt32 copySize); +IHeap_Handle System_ipcGetSRHeap(UInt32 srIndex); #endif diff --git a/mcfw/src_linux/mcfw_api/ti_vsys.c b/mcfw/src_linux/mcfw_api/ti_vsys.c index 0f9e163..2e30822 100755 --- a/mcfw/src_linux/mcfw_api/ti_vsys.c +++ b/mcfw/src_linux/mcfw_api/ti_vsys.c @@ -41,7 +41,7 @@ #include "ti_vsys_priv.h" - +#include /* ============================================================================= * Globals * ============================================================================= @@ -400,7 +400,7 @@ Int32 Vsys_allocBuf(UInt32 srRegId, UInt32 bufSize, UInt32 bufAlign, Vsys_AllocB { IHeap_Handle heapHndl; - heapHndl = SharedRegion_getHeap(srRegId); + heapHndl = System_ipcGetSRHeap(srRegId); OSA_assert(heapHndl != NULL); bufInfo->virtAddr = NULL; @@ -426,7 +426,7 @@ Int32 Vsys_freeBuf(UInt32 srRegId, UInt8 *virtAddr, UInt32 bufSize) { IHeap_Handle heapHndl; - heapHndl = SharedRegion_getHeap(srRegId); + heapHndl = System_ipcGetSRHeap(srRegId); OSA_assert(heapHndl != NULL); OSA_assert(virtAddr != NULL);