/* Function to initialize SysLink. */ Void SysLink_setup (Void) { Ipc_Config config; GT_0trace(curTrace, GT_ENTER, "SysLink_setup"); /* Initialize the MemoryOS module */ MemoryOS_setup(); #if defined(SYSLINK_BUILDOS_QNX) Cache_setup(); #endif /* Get config for the Ipc */ Ipc_getConfig(&config); /* Setup the Ipc */ Ipc_setup(&config); GT_0trace(curTrace, GT_LEAVE, "SysLink_setup"); }
/* Function to setup the System. */ Int Ipc_setup (const Ipc_Config * cfg) { Int status = Ipc_S_SUCCESS; Ipc_Config * config = NULL; Ipc_Config tConfig; IpcKnl_Config kConfig; IpcDrv_CmdArgs cmdArgs; GT_1trace (curTrace, GT_ENTER, "Ipc_setup", cfg); if (cfg == NULL) { Ipc_getConfig (&tConfig); config = &tConfig; } else { config = (Ipc_Config *) cfg; } /* TBD: Protect from multiple threads. */ Ipc_state.setupRefCount++; /* This is needed at runtime so should not be in SYSLINK_BUILD_OPTIMIZE. */ if (Ipc_state.setupRefCount > 1) { /*! @retval Ipc_S_ALREADYSETUP Success: Ipc module has been already setup in this process */ status = Ipc_S_ALREADYSETUP; GT_1trace (curTrace, GT_1CLASS, "Ipc module has been already setup in this process.\n" " RefCount: [%d]\n", Ipc_state.setupRefCount); } else { /* Call the kernel Ipc_setup to allow configuration from user-space */ /* Open the driver handle. */ status = IpcDrv_open (); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "Failed to open driver handle!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ /* Configure the ipcSyncConfig as PAIR always */ kConfig.ipcSyncConfig = Ipc_ProcSync_PAIR; cmdArgs.args.setup.config = (IpcKnl_Config *) &kConfig; status = IpcDrv_ioctl (CMD_IPC_SETUP, &cmdArgs); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "API (through IOCTL) failed on kernel-side!"); } } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } if (status >= 0) { UsrUtilsDrv_setup (); } if (status >= 0) { status = MultiProc_setup (&(config->multiProcConfig)); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "MultiProc_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.multiProcInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } #if 0 /* TBD:Temporarily comment. */ if (status >= 0) { status = SysMemMgr_setup (&(config->sysMemMgrConfig)); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "SysMemMgr_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.sysMemMgrInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } #endif /* TBD: Temporarily comment. */ /* Initialize NAMESERVER */ if (status >= 0) { status = NameServer_setup (); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "NameServer_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.nameServerInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Initialize PROCMGR */ if (status >= 0) { status = ProcMgr_setup (&(config->procMgrConfig)); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "ProcMgr_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.procMgrInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Initialize SharedRegion */ if (status >= 0) { status = SharedRegion_setup (&config->sharedRegionConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "SharedRegion_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.sharedRegionInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Initialize GateMP */ if (status >= 0) { status = GateMP_setup (&config->gateMPConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "GateMP_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.gateMPInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Initialize NOTIFY */ if (status >= 0) { status = Notify_setup (&config->notifyConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "Notify_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.notifyInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Intialize MESSAGEQ */ if (status >= 0) { status = MessageQ_setup (&config->messageQConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "MessageQ_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.messageQInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Intialize HeapBufMP */ if (status >= 0) { status = HeapBufMP_setup (&config->heapBufMPConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "HeapBufMP_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.heapBufMPInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Intialize HeapMemMP */ if (status >= 0) { status = HeapMemMP_setup (&config->heapMemMPConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "HeapMemMP_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.heapMemMPInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } #if 0 /* TBD:Temporarily comment. */ /* Intialize HeapMultiBuf */ if (status >= 0) { status = HeapMultiBuf_setup (&config->heapMultiBufConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "HeapMultiBuf_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.heapMultiBufInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } #endif /* TBD: Temporarily comment. */ /* Get the LISTMP default config */ if (status >= 0) { status = ListMP_setup (&config->listMPConfig); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "ListMP_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.listMPInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } #if 0 /* TBD:Temporarily comment. */ /* Get the ClientNotifyMgr default config */ if (status >= 0) { status = ClientNotifyMgr_setup ( &config->cliNotifyMgrCfgParams); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "ClientNotifyMgr_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.clientNotifyMgrInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Get the FrameQBufMgr default config */ if (status >= 0) { status = FrameQBufMgr_setup ( &config->frameQBufMgrCfgParams); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "FrameQBufMgr_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.frameQBufMgrInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } /* Get the FrameQ default config */ if (status >= 0) { status = FrameQ_setup ( &config->frameQCfgParams); #if !defined(SYSLINK_BUILD_OPTIMIZE) if (status < 0) { GT_setFailureReason (curTrace, GT_4CLASS, "Ipc_setup", status, "FrameQ_setup failed!"); } else { #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ Ipc_state.frameQInitFlag = TRUE; #if !defined(SYSLINK_BUILD_OPTIMIZE) } #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ } #endif /* TBD: Temporarily comment. */ GT_1trace (curTrace, GT_LEAVE, "Ipc_setup", status); /*! @retval Ipc_S_SUCCESS Operation successful */ return status; }
/* * ======== ipcSetup ======== */ Int ipcSetup (Int testCase) { Int status = 0; Char * procName; UInt16 procId; ProcMgr_AttachParams attachParams; ProcMgr_State state; #if !defined(SYSLINK_USE_DAEMON) UInt32 entryPoint = 0; ProcMgr_StartParams startParams; Char uProcId; HeapBufMP_Params heapbufmpParams; #if defined(SYSLINK_USE_LOADER) Char * imageName; UInt32 fileId; #endif #endif Ipc_Config config; Int i; UInt32 srCount; SharedRegion_Entry srEntry; Osal_printf ("ipcSetup: Setup IPC componnets \n"); switch(testCase) { case 0: Osal_printf ("ipcSetup: Local RCM test\n"); remoteServerName = RCMSERVER_NAME; procName = MPU_PROC_NAME; break; case 1: Osal_printf ("ipcSetup: RCM test with RCM client and server on " "Sys M3\n\n"); remoteServerName = SYSM3_SERVER_NAME; procName = SYSM3_PROC_NAME; break; case 2: Osal_printf ("ipcSetup: RCM test with RCM client and server on " "App M3\n\n"); remoteServerName = APPM3_SERVER_NAME; procName = APPM3_PROC_NAME; break; case 3: Osal_printf ("ipcSetup: RCM test with RCM client and server on " "Tesla\n\n"); remoteServerName = DSP_SERVER_NAME; procName = DSP_PROC_NAME; break; default: Osal_printf ("ipcSetup: Please pass valid arg " "(0-local, 1-Sys M3, 2-App M3, 3-Tesla) \n"); goto exit; break; } Ipc_getConfig (&config); status = Ipc_setup (&config); if (status < 0) { Osal_printf ("ipcSetup: Error in Ipc_setup [0x%x]\n", status); goto exit; } Osal_printf("Ipc_setup status [0x%x]\n", status); procId = ((testCase == 3) ? MultiProc_getId (DSP_PROC_NAME) : \ MultiProc_getId (SYSM3_PROC_NAME)); remoteIdClient = MultiProc_getId (procName); /* Open a handle to the ProcMgr instance. */ status = ProcMgr_open (&procMgrHandleClient, procId); if (status < 0) { Osal_printf ("ipcSetup: Error in ProcMgr_open [0x%x]\n", status); goto exit; } if (status >= 0) { Osal_printf ("ipcSetup: ProcMgr_open Status [0x%x]\n", status); ProcMgr_getAttachParams (NULL, &attachParams); /* Default params will be used if NULL is passed. */ status = ProcMgr_attach (procMgrHandleClient, &attachParams); if (status < 0) { Osal_printf ("ipcSetup: ProcMgr_attach failed [0x%x]\n", status); } else { Osal_printf ("ipcSetup: ProcMgr_attach status: [0x%x]\n", status); state = ProcMgr_getState (procMgrHandleClient); Osal_printf ("ipcSetup: After attach: ProcMgr_getState\n" " state [0x%x]\n", state); } } if ((status >= 0) && (testCase == 2)) { status = ProcMgr_open (&procMgrHandleClient1, remoteIdClient); if (status < 0) { Osal_printf ("ipcSetup: Error in ProcMgr_open [0x%x]\n", status); goto exit; } if (status >= 0) { Osal_printf ("ipcSetup: ProcMgr_open Status [0x%x]\n", status); ProcMgr_getAttachParams (NULL, &attachParams); /* Default params will be used if NULL is passed. */ status = ProcMgr_attach (procMgrHandleClient1, &attachParams); if (status < 0) { Osal_printf ("ipcSetup: ProcMgr_attach failed [0x%x]\n", status); } else { Osal_printf ("ipcSetup: ProcMgr_attach status: [0x%x]\n", status); state = ProcMgr_getState (procMgrHandleClient1); Osal_printf ("ipcSetup: After attach: ProcMgr_getState\n" " state [0x%x]\n", state); } } } #if !defined(SYSLINK_USE_DAEMON) /* Daemon sets this up */ #if defined(SYSLINK_USE_LOADER) if (testCase == 1) imageName = RCM_MPUCLIENT_SYSM3ONLY_IMAGE; else if (testCase == 2) imageName = RCM_MPUCLIENT_SYSM3_IMAGE; else if (testCase == 3) imageName = RCM_MPUCLIENT_DSP_IMAGE; if (testCase != 0) { status = ProcMgr_load (procMgrHandleClient, imageName, 2, &imageName, &entryPoint, &fileId, procId); if (status < 0) { Osal_printf ("ipcSetup: Error in ProcMgr_load %s image [0x%x]\n", procName, status); goto exit; } Osal_printf ("ipcSetup: ProcMgr_load %s image Status [0x%x]\n", procName, status); } #endif /* defined(SYSLINK_USE_LOADER) */ if (testCase != 0) { startParams.proc_id = procId; status = ProcMgr_start (procMgrHandleClient, entryPoint, &startParams); if (status < 0) { Osal_printf ("ipcSetup: Error in ProcMgr_start %s [0x%x]\n", procName, status); goto exit; } Osal_printf ("ipcSetup: ProcMgr_start %s Status [0x%x]\n", procName, status); } if (testCase == 2) { #if defined(SYSLINK_USE_LOADER) imageName = RCM_MPUCLIENT_APPM3_IMAGE; uProcId = MultiProc_getId (APPM3_PROC_NAME); status = ProcMgr_load (procMgrHandleClient1, imageName, 2, &imageName, &entryPoint, &fileId, uProcId); if (status < 0) { Osal_printf ("ipcSetup: Error in ProcMgr_load AppM3 image: " "[0x%x]\n", status); goto exit; } Osal_printf ("ipcSetup: AppM3: ProcMgr_load Status [0x%x]\n", status); #endif /* defined(SYSLINK_USE_LOADER) */ startParams.proc_id = MultiProc_getId (APPM3_PROC_NAME); status = ProcMgr_start (procMgrHandleClient1, entryPoint, &startParams); if (status < 0) { Osal_printf ("ipcSetup: Error in ProcMgr_start AppM3 [0x%x]\n", status); goto exit; } Osal_printf ("ipcSetup: ProcMgr_start AppM3 Status [0x%x]\n", status); } #endif /* defined(SYSLINK_USE_DAEMON) */ 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); } #if !defined(SYSLINK_USE_DAEMON) /* Daemon sets this up */ /* Create Heap and register it with MessageQ */ if (status >= 0) { HeapBufMP_Params_init (&heapbufmpParams); heapbufmpParams.sharedAddr = NULL; heapbufmpParams.align = 128; heapbufmpParams.numBlocks = 4; heapbufmpParams.blockSize = MSGSIZE; heapSize = HeapBufMP_sharedMemReq (&heapbufmpParams); Osal_printf ("ipcSetup: heapSize = 0x%x\n", heapSize); srHeap = SharedRegion_getHeap (RCM_HEAP_SR); if (srHeap == NULL) { status = MEMORYOS_E_FAIL; Osal_printf ("ipcSetup: SharedRegion_getHeap failed for srHeap:" " [0x%x]\n", srHeap); } else { Osal_printf ("ipcSetup: Before Memory_alloc = 0x%x\n", srHeap); heapBufPtr = Memory_alloc (srHeap, heapSize, 0); if (heapBufPtr == NULL) { status = MEMORYOS_E_MEMORY; Osal_printf ("ipcSetup: Memory_alloc failed for ptr: [0x%x]\n", heapBufPtr); } else { heapbufmpParams.name = RCM_MSGQ_HEAPNAME; heapbufmpParams.sharedAddr = heapBufPtr; Osal_printf ("ipcSetup: Before HeapBufMP_Create: [0x%x]\n", heapBufPtr); heapHandle = HeapBufMP_create (&heapbufmpParams); if (heapHandle == NULL) { status = HeapBufMP_E_FAIL; Osal_printf ("ipcSetup: HeapBufMP_create failed for Handle:" "[0x%x]\n", heapHandle); } else { /* Register this heap with MessageQ */ status = MessageQ_registerHeap (heapHandle, RCM_MSGQ_HEAPID); if (status < 0) { Osal_printf ("ipcSetup: MessageQ_registerHeap " "failed!\n"); } } } } } #endif /* defined(SYSLINK_USE_DAEMON) */ exit: Osal_printf ("ipcSetup: Leaving ipcSetup()\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); }