Int FirmwareLoad_shutdown (UInt16 procId) { Int status = 0; ProcMgr_Handle handle = NULL; UInt32 fileId; if(status>=0) status = FirmwareLoad_ipcStop(procId); if(status>=0) status = ProcMgr_open (&handle, procId); if (status >= 0) { status = ProcMgr_stop (handle); printf ("Stopped slave procId %d.\n", procId); fileId = ProcMgr_getLoadedFileId (handle); status = ProcMgr_unload (handle, fileId) ; printf ("Unloaded slave procId %d.\n", procId); status = ProcMgr_detach (handle); printf ("Detached from slave procId %d.\n", procId); status = ProcMgr_close (&handle); } return status; }
/* * ======== RcmClientCleanup ======== */ Int RcmClientCleanup (Int testCase) { Int status = 0; RcmClient_Message * rcmMsg = NULL; RcmClient_Message * returnMsg = NULL; UInt rcmMsgSize; RCM_Remote_FxnArgs * fxnExitArgs; #if !defined(SYSLINK_USE_DAEMON) ProcMgr_StopParams stopParams; #endif Osal_printf ("\nRcmClientCleanup: Entering RcmClientCleanup()\n"); /* Send terminate message */ /* Allocate a remote command message */ rcmMsgSize = sizeof(RCM_Remote_FxnArgs); status = RcmClient_alloc (rcmClientHandle, rcmMsgSize, &rcmMsg); if (status < 0) { Osal_printf ("RcmClientCleanup: Error allocating RCM message\n"); goto exit; } /* Fill in the remote command message */ rcmMsg->fxnIdx = fxnExitIdx; fxnExitArgs = (RCM_Remote_FxnArgs *)(&rcmMsg->data); fxnExitArgs->a = 0xFFFF; #if !defined(SYSLINK_USE_DAEMON) /* Execute the remote command message */ Osal_printf ("RcmClientCleanup: calling RcmClient_execDpc \n"); status = RcmClient_execDpc (rcmClientHandle, rcmMsg, &returnMsg); if (status < 0) { Osal_printf ("RcmClientCleanup: RcmClient_execDpc error [0x%x]\n", status); goto exit; } #endif /* !defined(SYSLINK_USE_DAEMON) */ /* Return message to the heap */ Osal_printf ("RcmClientCleanup: Calling RcmClient_free \n"); RcmClient_free (rcmClientHandle, returnMsg); /* Delete the rcm client */ Osal_printf ("RcmClientCleanup: Delete RCM client instance \n"); status = RcmClient_delete (&rcmClientHandle); if (status < 0) Osal_printf ("RcmClientCleanup: Error in RCM Client instance delete" " [0x%x]\n", status); else Osal_printf ("RcmClientCleanup: RcmClient_delete status: [0x%x]\n", status); /* Rcm client module destroy */ Osal_printf ("RcmClientCleanup: Destroy RCM client module \n"); RcmClient_exit (); /* Finalize modules */ #if !defined(SYSLINK_USE_DAEMON) // Do not call ProcMgr_stop if using daemon status = MessageQ_unregisterHeap (RCM_MSGQ_HEAPID); if (status < 0) Osal_printf ("RcmClientCleanup: Error in MessageQ_unregisterHeap" " [0x%x]\n", status); else Osal_printf ("RcmClientCleanup: MessageQ_unregisterHeap status:" " [0x%x]\n", status); if (heapHandle) { status = HeapBufMP_delete (&heapHandle); if (status < 0) Osal_printf ("RcmClientCleanup: Error in HeapBufMP_delete [0x%x]\n", status); else Osal_printf ("RcmClientCleanup: HeapBufMP_delete status: [0x%x]\n", status); } if (heapBufPtr) { Memory_free (srHeap, heapBufPtr, heapSize); } stopParams.proc_id = remoteIdClient; if (testCase == 2) { status = ProcMgr_stop(procMgrHandleClient1, &stopParams); if (status < 0) Osal_printf ("RcmClientCleanup: Error in ProcMgr_stop [0x%x]\n", status); else Osal_printf ("RcmClientCleanup: ProcMgr_stop status: [0x%x]\n", status); stopParams.proc_id = MultiProc_getId (SYSM3_PROC_NAME); } status = ProcMgr_stop(procMgrHandleClient, &stopParams); if (status < 0) Osal_printf ("RcmClientCleanup: Error in ProcMgr_stop [0x%x]\n", status); else Osal_printf ("RcmClientCleanup: ProcMgr_stop status: [0x%x]\n", status); #endif if (testCase == 2) { status = ProcMgr_detach (procMgrHandleClient1); Osal_printf ("RcmClientCleanup: ProcMgr_detach status [0x%x]\n", status); status = ProcMgr_close (&procMgrHandleClient1); if (status < 0) Osal_printf ("RcmClientCleanup: Error in ProcMgr_close [0x%x]\n", status); else Osal_printf ("RcmClientCleanup: ProcMgr_close status: [0x%x]\n", status); } status = ProcMgr_detach (procMgrHandleClient); Osal_printf ("RcmClientCleanup: ProcMgr_detach status [0x%x]\n", status); status = ProcMgr_close (&procMgrHandleClient); if (status < 0) Osal_printf ("RcmClientCleanup: Error in ProcMgr_close [0x%x]\n", status); else Osal_printf ("RcmClientCleanup: ProcMgr_close status: [0x%x]\n", status); status = Ipc_destroy (); if (status < 0) Osal_printf("RcmClientCleanup: Error in Ipc_destroy [0x%x]\n", status); else Osal_printf("RcmClientCleanup: Ipc_destroy status: [0x%x]\n", status); exit: Osal_printf ("RcmClientCleanup: Leaving RcmClientCleanup()\n"); return status; }
/* * ======== ipcSetup ======== */ static Int ipcSetup (Char * sysM3ImageName, Char * appM3ImageName) { Ipc_Config config; ProcMgr_StopParams stopParams; ProcMgr_StartParams startParams; UInt32 entryPoint = 0; UInt16 procId; Int status = 0; ProcMgr_AttachParams attachParams; ProcMgr_State state; HeapBufMP_Params heapbufmpParams; Int i; UInt32 srCount; SharedRegion_Entry srEntry; if(appM3ImageName != NULL) appM3Client = TRUE; else appM3Client = FALSE; Ipc_getConfig (&config); status = Ipc_setup (&config); if (status < 0) { Osal_printf ("Error in Ipc_setup [0x%x]\n", status); goto exit; } /* Get MultiProc IDs by name. */ remoteIdSysM3 = MultiProc_getId (SYSM3_PROC_NAME); Osal_printf ("MultiProc_getId remoteId: [0x%x]\n", remoteIdSysM3); remoteIdAppM3 = MultiProc_getId (APPM3_PROC_NAME); Osal_printf ("MultiProc_getId remoteId: [0x%x]\n", remoteIdAppM3); procId = remoteIdSysM3; Osal_printf ("MultiProc_getId procId: [0x%x]\n", procId); /* Temporary fix to account for a timing issue during recovery. */ usleep(FAULT_RECOVERY_DELAY); printf("RCM procId= %d\n", procId); /* Open a handle to the ProcMgr instance. */ status = ProcMgr_open (&procMgrHandleSysM3, procId); if (status < 0) { Osal_printf ("Error in ProcMgr_open [0x%x]\n", status); goto exit_ipc_destroy; } else { Osal_printf ("ProcMgr_open Status [0x%x]\n", status); ProcMgr_getAttachParams (NULL, &attachParams); /* Default params will be used if NULL is passed. */ status = ProcMgr_attach (procMgrHandleSysM3, &attachParams); if (status < 0) { Osal_printf ("ProcMgr_attach failed [0x%x]\n", status); } else { Osal_printf ("ProcMgr_attach status: [0x%x]\n", status); state = ProcMgr_getState (procMgrHandleSysM3); Osal_printf ("After attach: ProcMgr_getState\n" " state [0x%x]\n", status); } } if (status >= 0 && appM3Client) { procId = remoteIdAppM3; Osal_printf ("MultiProc_getId procId: [0x%x]\n", procId); /* Open a handle to the ProcMgr instance. */ status = ProcMgr_open (&procMgrHandleAppM3, procId); if (status < 0) { Osal_printf ("Error in ProcMgr_open [0x%x]\n", status); goto exit_ipc_destroy; } else { Osal_printf ("ProcMgr_open Status [0x%x]\n", status); ProcMgr_getAttachParams (NULL, &attachParams); /* Default params will be used if NULL is passed. */ status = ProcMgr_attach (procMgrHandleAppM3, &attachParams); if (status < 0) { Osal_printf ("ProcMgr_attach failed [0x%x]\n", status); } else { Osal_printf ("ProcMgr_attach status: [0x%x]\n", status); state = ProcMgr_getState (procMgrHandleAppM3); Osal_printf ("After attach: ProcMgr_getState\n" " state [0x%x]\n", status); } } } #if defined(SYSLINK_USE_LOADER) Osal_printf ("SysM3 Load: loading the SysM3 image %s\n", sysM3ImageName); status = ProcMgr_load (procMgrHandleSysM3, sysM3ImageName, 2, &sysM3ImageName, &entryPoint, &fileIdSysM3, remoteIdSysM3); if(status < 0) { Osal_printf ("Error in ProcMgr_load, status [0x%x]\n", status); goto exit_procmgr_close_sysm3; } #endif startParams.proc_id = remoteIdSysM3; Osal_printf ("Starting ProcMgr for procID = %d\n", startParams.proc_id); status = ProcMgr_start(procMgrHandleSysM3, entryPoint, &startParams); if(status < 0) { Osal_printf ("Error in ProcMgr_start, status [0x%x]\n", status); goto exit_procmgr_close_sysm3; } if(appM3Client) { #if defined(SYSLINK_USE_LOADER) Osal_printf ("AppM3 Load: loading the AppM3 image %s\n", appM3ImageName); status = ProcMgr_load (procMgrHandleAppM3, appM3ImageName, 2, &appM3ImageName, &entryPoint, &fileIdAppM3, remoteIdAppM3); if(status < 0) { Osal_printf ("Error in ProcMgr_load, status [0x%x]\n", status); goto exit_procmgr_stop_sysm3; } #endif startParams.proc_id = remoteIdAppM3; Osal_printf ("Starting ProcMgr for procID = %d\n", startParams.proc_id); status = ProcMgr_start(procMgrHandleAppM3, entryPoint, &startParams); if(status < 0) { Osal_printf ("Error in ProcMgr_start, status [0x%x]\n", status); goto exit_procmgr_stop_sysm3; } } Osal_printf ("SysM3: Creating Ducati DMM pool of size 0x%x\n", DUCATI_DMM_POOL_0_SIZE); status = ProcMgr_createDMMPool (DUCATI_DMM_POOL_0_ID, DUCATI_DMM_POOL_0_START, DUCATI_DMM_POOL_0_SIZE, remoteIdSysM3); if(status < 0) { Osal_printf ("Error in ProcMgr_createDMMPool, status [0x%x]\n", status); goto exit_procmgr_stop_sysm3; } srCount = SharedRegion_getNumRegions(); Osal_printf ("SharedRegion_getNumRegions = %d\n", srCount); for (i = 0; i < srCount; i++) { status = SharedRegion_getEntry (i, &srEntry); Osal_printf ("SharedRegion_entry #%d: base = 0x%x len = 0x%x " "ownerProcId = %d isValid = %d cacheEnable = %d " "cacheLineSize = 0x%x createHeap = %d name = %s\n", i, srEntry.base, srEntry.len, srEntry.ownerProcId, (Int)srEntry.isValid, (Int)srEntry.cacheEnable, srEntry.cacheLineSize, (Int)srEntry.createHeap, srEntry.name); } /* Create the heap to be used by RCM and register it with MessageQ */ /* TODO: Do this dynamically by reading from the IPC config from the * baseimage using Ipc_readConfig() */ if (status >= 0) { HeapBufMP_Params_init (&heapbufmpParams); heapbufmpParams.sharedAddr = NULL; heapbufmpParams.align = RCM_MSGQ_TILER_HEAP_ALIGN; heapbufmpParams.numBlocks = RCM_MSGQ_TILER_HEAP_BLOCKS; heapbufmpParams.blockSize = RCM_MSGQ_TILER_MSGSIZE; heapSize = HeapBufMP_sharedMemReq (&heapbufmpParams); Osal_printf ("heapSize = 0x%x\n", heapSize); srHeap = SharedRegion_getHeap (RCM_MSGQ_HEAP_SR); if (srHeap == NULL) { status = MEMORYOS_E_FAIL; Osal_printf ("SharedRegion_getHeap failed for srHeap:" " [0x%x]\n", srHeap); goto exit_procmgr_stop_sysm3; } else { Osal_printf ("Before Memory_alloc = 0x%x\n", srHeap); heapBufPtr = Memory_alloc (srHeap, heapSize, 0); if (heapBufPtr == NULL) { status = MEMORYOS_E_MEMORY; Osal_printf ("Memory_alloc failed for ptr: [0x%x]\n", heapBufPtr); goto exit_procmgr_stop_sysm3; } else { heapbufmpParams.name = RCM_MSGQ_TILER_HEAPNAME; heapbufmpParams.sharedAddr = heapBufPtr; Osal_printf ("Before HeapBufMP_Create: [0x%x]\n", heapBufPtr); heapHandle = HeapBufMP_create (&heapbufmpParams); if (heapHandle == NULL) { status = HeapBufMP_E_FAIL; Osal_printf ("HeapBufMP_create failed for Handle:" "[0x%x]\n", heapHandle); goto exit_procmgr_stop_sysm3; } else { /* Register this heap with MessageQ */ status = MessageQ_registerHeap (heapHandle, RCM_MSGQ_TILER_HEAPID); if (status < 0) { Osal_printf ("MessageQ_registerHeap failed!\n"); goto exit_procmgr_stop_sysm3; } } } } } if (status >= 0) { HeapBufMP_Params_init (&heapbufmpParams); heapbufmpParams.sharedAddr = NULL; heapbufmpParams.align = RCM_MSGQ_DOMX_HEAP_ALIGN; heapbufmpParams.numBlocks = RCM_MSGQ_DOMX_HEAP_BLOCKS; heapbufmpParams.blockSize = RCM_MSGQ_DOMX_MSGSIZE; heapSize1 = HeapBufMP_sharedMemReq (&heapbufmpParams); Osal_printf ("heapSize1 = 0x%x\n", heapSize1); heapBufPtr1 = Memory_alloc (srHeap, heapSize1, 0); if (heapBufPtr1 == NULL) { status = MEMORYOS_E_MEMORY; Osal_printf ("Memory_alloc failed for ptr: [0x%x]\n", heapBufPtr1); goto exit_procmgr_stop_sysm3; } else { heapbufmpParams.name = RCM_MSGQ_DOMX_HEAPNAME; heapbufmpParams.sharedAddr = heapBufPtr1; Osal_printf ("Before HeapBufMP_Create: [0x%x]\n", heapBufPtr1); heapHandle1 = HeapBufMP_create (&heapbufmpParams); if (heapHandle1 == NULL) { status = HeapBufMP_E_FAIL; Osal_printf ("HeapBufMP_create failed for Handle:" "[0x%x]\n", heapHandle1); goto exit_procmgr_stop_sysm3; } else { /* Register this heap with MessageQ */ status = MessageQ_registerHeap (heapHandle1, RCM_MSGQ_DOMX_HEAPID); if (status < 0) { Osal_printf ("MessageQ_registerHeap failed!\n"); goto exit_procmgr_stop_sysm3; } } } } Osal_printf ("=== SysLink-IPC setup completed successfully!===\n"); return 0; exit_procmgr_stop_sysm3: stopParams.proc_id = remoteIdSysM3; status = ProcMgr_stop (procMgrHandleSysM3, &stopParams); if (status < 0) { Osal_printf ("Error in ProcMgr_stop(%d): status = 0x%x\n", stopParams.proc_id, status); } exit_procmgr_close_sysm3: status = ProcMgr_close (&procMgrHandleSysM3); if (status < 0) { Osal_printf ("Error in ProcMgr_close: status = 0x%x\n", status); } exit_ipc_destroy: status = Ipc_destroy (); if (status < 0) { Osal_printf ("Error in Ipc_destroy: status = 0x%x\n", status); } exit: return (-1); }
/* * ======== ipc_cleanup ======== */ static Void ipcCleanup (Void) { ProcMgr_StopParams stopParams; Int status = 0; /* Cleanup the default HeapBufMP registered with MessageQ */ status = MessageQ_unregisterHeap (RCM_MSGQ_DOMX_HEAPID); if (status < 0) { Osal_printf ("Error in MessageQ_unregisterHeap [0x%x]\n", status); } if (heapHandle1) { status = HeapBufMP_delete (&heapHandle1); if (status < 0) { Osal_printf ("Error in HeapBufMP_delete [0x%x]\n", status); } } if (heapBufPtr1) { Memory_free (srHeap, heapBufPtr1, heapSize1); } status = MessageQ_unregisterHeap (RCM_MSGQ_TILER_HEAPID); if (status < 0) { Osal_printf ("Error in MessageQ_unregisterHeap [0x%x]\n", status); } if (heapHandle) { status = HeapBufMP_delete (&heapHandle); if (status < 0) { Osal_printf ("Error in HeapBufMP_delete [0x%x]\n", status); } } if (heapBufPtr) { Memory_free (srHeap, heapBufPtr, heapSize); } status = ProcMgr_deleteDMMPool (DUCATI_DMM_POOL_0_ID, remoteIdSysM3); if (status < 0) { Osal_printf ("Error in ProcMgr_deleteDMMPool:status = 0x%x\n", status); } if(appM3Client) { stopParams.proc_id = remoteIdAppM3; status = ProcMgr_stop (procMgrHandleAppM3, &stopParams); if (status < 0) { Osal_printf ("Error in ProcMgr_stop(%d): status = 0x%x\n", stopParams.proc_id, status); } #if defined(SYSLINK_USE_LOADER) status = ProcMgr_unload (procMgrHandleAppM3, fileIdAppM3); if(status < 0) { Osal_printf ("Error in ProcMgr_unload, status [0x%x]\n", status); } #endif } stopParams.proc_id = remoteIdSysM3; status = ProcMgr_stop (procMgrHandleSysM3, &stopParams); if (status < 0) { Osal_printf ("Error in ProcMgr_stop(%d): status = 0x%x\n", stopParams.proc_id, status); } #if defined(SYSLINK_USE_LOADER) status = ProcMgr_unload (procMgrHandleSysM3, fileIdSysM3); if(status < 0) { Osal_printf ("Error in ProcMgr_unload, status [0x%x]\n", status); } #endif if(appM3Client) { status = ProcMgr_detach (procMgrHandleAppM3); if (status < 0) { Osal_printf ("Error in ProcMgr_detach(AppM3): status = 0x%x\n", status); } status = ProcMgr_close (&procMgrHandleAppM3); if (status < 0) { Osal_printf ("Error in ProcMgr_close(AppM3): status = 0x%x\n", status); } } status = ProcMgr_detach (procMgrHandleSysM3); if (status < 0) { Osal_printf ("Error in ProcMgr_detach(SysM3): status = 0x%x\n", status); } status = ProcMgr_close (&procMgrHandleSysM3); if (status < 0) { Osal_printf ("Error in ProcMgr_close(SysM3): status = 0x%x\n", status); } status = Ipc_destroy (); if (status < 0) { Osal_printf ("Error in Ipc_destroy: status = 0x%x\n", status); } Osal_printf ("Done cleaning up ipc!\n\n"); }
/* * ======== RcmServerCleanup ======== */ Int RcmServerCleanup (Int testCase) { Int status = 0; #if !defined(SYSLINK_USE_DAEMON) ProcMgr_StopParams stopParams; #endif Osal_printf ("\nRcmServerCleanup: Entering RcmServerCleanup()\n"); /* Delete the rcm server */ Osal_printf ("RcmServerCleanup: Delete RCM server instance \n"); status = RcmServer_delete (&rcmServerHandle); if (status < 0) Osal_printf ("RcmServerCleanup: Error in RCM Server instance delete" " [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: RcmServer_delete status: [0x%x]\n", status); /* Rcm server module destroy */ Osal_printf ("RcmServerCleanup: Clean up RCM server module \n"); RcmServer_exit (); /* Finalize modules */ #if !defined(SYSLINK_USE_DAEMON) // Do not call ProcMgr_stop if using daemon status = MessageQ_unregisterHeap (RCM_MSGQ_HEAPID); if (status < 0) Osal_printf ("RcmServerCleanup: Error in MessageQ_unregisterHeap" " [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: MessageQ_unregisterHeap status:" " [0x%x]\n", status); if (heapHandleServer) { status = HeapBufMP_delete (&heapHandleServer); if (status < 0) Osal_printf ("RcmServerCleanup: Error in HeapBufMP_delete [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: HeapBufMP_delete status: [0x%x]\n", status); } if (heapBufPtrServer) { Memory_free (srHeapServer, heapBufPtrServer, heapSizeServer); } stopParams.proc_id = remoteIdServer; if (testCase == 2) { status = ProcMgr_stop (procMgrHandleServer1, &stopParams); if (status < 0) Osal_printf ("RcmServerCleanup: Error in ProcMgr_stop [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: ProcMgr_stop status: [0x%x]\n", status); stopParams.proc_id = MultiProc_getId (SYSM3_PROC_NAME); } status = ProcMgr_stop (procMgrHandleServer, &stopParams); if (status < 0) Osal_printf ("RcmServerCleanup: Error in ProcMgr_stop [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: ProcMgr_stop status: [0x%x]\n", status); #endif if (testCase == 2) { status = ProcMgr_detach (procMgrHandleServer1); Osal_printf ("RcmServerCleanup: ProcMgr_detach status [0x%x]\n", status); status = ProcMgr_close (&procMgrHandleServer1); if (status < 0) Osal_printf ("RcmServerCleanup: Error in ProcMgr_close [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: ProcMgr_close status: [0x%x]\n", status); } status = ProcMgr_detach (procMgrHandleServer); Osal_printf ("RcmServerCleanup: ProcMgr_detach status [0x%x]\n", status); status = ProcMgr_close (&procMgrHandleServer); if (status < 0) Osal_printf ("RcmServerCleanup: Error in ProcMgr_close [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: ProcMgr_close status: [0x%x]\n", status); status = Ipc_destroy (); if (status < 0) Osal_printf ("RcmServerCleanup: Error in Ipc_destroy [0x%x]\n", status); else Osal_printf ("RcmServerCleanup: Ipc_destroy status: [0x%x]\n", status); Osal_printf ("RcmServerCleanup: Leaving RcmServerCleanup()\n"); return status; }
/* * ======== procDelete ======== */ static Void procDelete(Processor_Handle proc) { Int status = 0; Int16 heapId; Bool unregisterAndDeleteHeap; ProcMgr_AddrInfo CMEMAddrInfo; CMEM_BlockAttrs cmemBlockAttrs; Int blockNum; Int nCMEMBlocks; Log_print1(Diags_ENTRY, "[+E] Processor_delete_d> Enter (proc=0x%x)", (IArg)proc); if (proc == NULL) { goto procDelete_return; } /* close tranport and stop DSP, detach, destroy */ /* unregister this heap with MessageQ */ if (proc->startCallBackStatus >= 0) { blockNum = 0; nCMEMBlocks = 0; status = CMEM_getNumBlocks(&nCMEMBlocks); if (status != 0) { Log_print1(Diags_USER2, "[+2] Processor_delete_d> " "CMEM_getNumBlocks() failed: %d", status); } while (blockNum < nCMEMBlocks) { status = CMEM_getBlockAttrs(blockNum, &cmemBlockAttrs); if (status != 0) { Log_print2(Diags_USER7, "[+7] Processor_delete_d> " "CMEM_getBlockAttrs(%d) failed: %d", blockNum, status); goto cmemDone; } CMEMAddrInfo.addr[ProcMgr_AddrType_MasterPhys] = cmemBlockAttrs.phys_base; CMEMAddrInfo.addr[ProcMgr_AddrType_SlaveVirt] = cmemBlockAttrs.phys_base; CMEMAddrInfo.size = cmemBlockAttrs.size; CMEMAddrInfo.isCached = FALSE; Log_print3(Diags_USER1, "[+1] Processor_delete_d> CMEM block " "#%d found, doing ProcMgr_unmap(0x%x, 0x%x)...", blockNum, (IArg)cmemBlockAttrs.phys_base, (IArg)cmemBlockAttrs.size); status = ProcMgr_unmap(proc->procMgrH, ProcMgr_SLAVEVIRT, &CMEMAddrInfo, ProcMgr_AddrType_MasterPhys); if (status < 0) { Log_print1(Diags_USER7, "[+7] Processor_delete_d> " "ProcMgr_unmap() failed: %d", status); goto cmemDone; } blockNum++; } cmemDone: Log_print2(Diags_USER7, "[+2] Processor_delete_d> " "defaultHeapH: 0x%x, proc->heapH: 0x%x", (IArg)defaultHeapH, (IArg)proc->heapH); if (proc->heapH != NULL) { unregisterAndDeleteHeap = FALSE; if (proc->heapH == defaultHeapH) { Log_print1(Diags_USER1, "[+1] Processor_delete_d> " "defaultHeapRefCount = %d", (IArg)defaultHeapRefCount); if (--defaultHeapRefCount == 0) { /* this is the last one using the default heap */ unregisterAndDeleteHeap = TRUE; } } else { unregisterAndDeleteHeap = TRUE; } if (unregisterAndDeleteHeap) { heapId = proc->heapId; Log_print1(Diags_USER1, "[+1] Processor_delete_d> " "unregisterAndDeleteHeap, heapId = %d", (IArg)heapId); if (heapId != Processor_INVALID) { Log_print1(Diags_USER1, "[+1] Processor_delete_d> " "MessageQ_unregisterHeap(heapId: %d)", (IArg)heapId); if (MessageQ_unregisterHeap(heapId) !=MessageQ_S_SUCCESS) { Log_print1(Diags_USER7, "[+7] Processor_delete_d> " "MessageQ_unregisterHeap(heapId: %d) failed", heapId); } } /* delete heap used by message queue */ Log_print1(Diags_USER1, "[+1] Processor_delete_d> " "calling HeapBufMP_delete(heapH: 0x%x)", (IArg)(proc->heapH)); HeapBufMP_delete(&proc->heapH); } } /* Stop execution on DSP */ Log_print0(Diags_USER1, "[+2] Processor_delete_d> " "calling Ipc_control(STOPCALLBACK)..."); status = Ipc_control(proc->cpuId, Ipc_CONTROLCMD_STOPCALLBACK, NULL); Log_print2(Diags_USER2, "[+2] Processor_delete_d> " "Ipc_control(STOPCALLBACK) status: 0x%x [%d]", (IArg)status, (IArg)status); } else { Log_print2(Diags_USER2, "[+2] Processor_delete_d> Not calling " "Ipc_control(STOPCALLBACK) because startCallBackStatus = " "0x%x [%d]", (IArg)proc->startCallBackStatus, (IArg)proc->startCallBackStatus); } if (proc->useExtLoader == FALSE) { /* We unload the slave processor */ Log_print0(Diags_USER2, "[+2] Processor_delete_d> Stopping DSP..."); status = ProcMgr_stop(proc->procMgrH); if (status < 0) { Log_print1(Diags_USER6, "[+6] Processor_delete_d> " "Stopping DSP FAILED, status=0x%x", (IArg)status); } if (proc->fileId != 0xffffffff) { Log_print0(Diags_USER2, "[+2] Processor_delete_d> " "Unloading DSP..."); status = ProcMgr_unload(proc->procMgrH, proc->fileId); if (status < 0) { Log_print1(Diags_USER6, "[+6] Processor_delete_d> " "Unloading DSP FAILED, status=0x%x", (IArg)status); } } /* Unmap slave memory */ if (!mapByFile(proc->procMgrH, proc->memMapName, proc->cpuId, FALSE)) { Log_print0(Diags_USER6, "Processor_delete_d> mapByFile() failed!"); } /* Detach from the processor */ Log_print0(Diags_USER1, "[+1] Processor_delete_d> " "calling ProcMgr_detach()..."); status = ProcMgr_detach(proc->procMgrH); if (status < 0) { Log_print1(Diags_USER6, "[+6] Processor_delete_d> " "Detaching from DSP FAILED, status=0x%x", (IArg)status); } } // proc->useExtLoader == FALSE Log_print0(Diags_USER1, "[+1] Processor_delete_d> " "calling ProcMgr_close()..."); status = ProcMgr_close(&proc->procMgrH); if (status < 0) { Log_print1(Diags_USER6, "[+6] Processor_delete_d> " "Closing ProcMgr FAILED, status=0x%x", (IArg)status); } procDelete_return: Log_print0(Diags_EXIT, "[+X] Processor_delete_d> return"); }