diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/vayu/Platform.c b/qnx/src/ipc3x_dev/ti/syslink/family/vayu/Platform.c
index 7fc4609ee55c3c57ec3b1b371bd41eff9836cec4..946d91a6b7176085f7f00fe10b3494ac0a7c47bd 100644 (file)
*
* ============================================================================
*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2014, Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include <ti/ipc/Ipc.h>
#include <_Ipc.h>
+#include <_MultiProc.h>
#include <IpcKnl.h>
#include <sys/mman.h>
+#include <GateHWSpinlock.h>
+#include <gptimers.h>
#if defined (__cplusplus)
extern "C" {
* Macros.
* ============================================================================
*/
+/* Hardware spinlocks info */
+#define HWSPINLOCK_BASE 0x4A0F6000
+#define HWSPINLOCK_SIZE 0x1000
+#define HWSPINLOCK_OFFSET 0x800
/** ============================================================================
* Application specific configuration, please change these value according to
ElfLoader_Config elfLoaderConfig;
/*!< Elf loader config parameter */
+
+ GateHWSpinlock_Config gateHWSpinlockConfig;
+ /*!< GateHWSpinlock config parameter */
} Platform_Config;
/*! @brief structure for platform instance */
/*!< Handle to the PwrMgr instance used */
ElfLoader_Handle ldrHandle;
/*!< Handle to the Loader instance used */
- } ipu1;
+ } ipu;
} sHandles;
/*!< Slave specific handles */
} Platform_Object, *Platform_Handle;
/*!< IpcInt Initialize flag */
Bool platformInitFlag;
/*!< Flag to indicate platform initialization status */
+ Bool gateHWSpinlockInitFlag;
+ /*!< GateHWSpinlock Initialize flag */
+ Ptr gateHWSpinlockVAddr;
+ /*!< GateHWSpinlock Virtual Address */
} Platform_Module_State;
String Syslink_Override_Params = "ProcMgr.proc[DSP1].mmuEnable=TRUE;"
"ProcMgr.proc[DSP1].carveoutAddr0=0xBA300000;"
"ProcMgr.proc[DSP1].carveoutSize0=0x5A00000;"
+ "ProcMgr.proc[IPU1].mmuEnable=TRUE;"
+ "ProcMgr.proc[IPU1].carveoutAddr0=0xBA300000;"
+ "ProcMgr.proc[IPU1].carveoutSize0=0x5A00000;"
"ProcMgr.proc[IPU2].mmuEnable=TRUE;"
"ProcMgr.proc[IPU2].carveoutAddr0=0xBA300000;"
"ProcMgr.proc[IPU2].carveoutSize0=0x5A00000;";
/* Get the ElfLoader default config */
ElfLoader_getConfig (&config->elfLoaderConfig);
+
+ /* Get the HWSpinlock default config */
+ GateHWSpinlock_getConfig (&config->gateHWSpinlockConfig);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
}
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
_ProcMgr_saveParams(cfg->params, String_len(cfg->params));
- /* Override the gatepeterson default config */
- config->multiProcConfig.numProcessors = 9;
- config->multiProcConfig.id = 0;
- String_cpy (config->multiProcConfig.nameList [0],
- "HOST");
- String_cpy (config->multiProcConfig.nameList [1],
- "IPU2");
- String_cpy (config->multiProcConfig.nameList [2],
- "IPU1");
- String_cpy (config->multiProcConfig.nameList [3],
- "DSP2");
- String_cpy (config->multiProcConfig.nameList [4],
- "DSP1");
- String_cpy (config->multiProcConfig.nameList [5],
- "EVE4");
- String_cpy (config->multiProcConfig.nameList [6],
- "EVE3");
- String_cpy (config->multiProcConfig.nameList [7],
- "EVE2");
- String_cpy (config->multiProcConfig.nameList [8],
- "EVE1");
+ /* Set the MultiProc config as defined in SystemCfg.c */
+ config->multiProcConfig = _MultiProc_cfg;
/* Override the MESSAGEQCOPY default config */
- config->MQCopyConfig.intId[1] = 116; // 84 + 32
- config->MQCopyConfig.intId[4] = 115; // 83 + 32
+ config->MQCopyConfig.intId[1] = 173; // 141 + 32
+ config->MQCopyConfig.intId[2] = 168; // 136 + 32
+ config->MQCopyConfig.intId[4] = 168; // 136 + 32
#if !defined(SYSLINK_BUILD_OPTIMIZE)
}
Platform_Config _config;
Platform_Config * config;
VAYUIpcInt_Config VAYUcfg;
+ Memory_MapInfo minfo;
Platform_getConfig (&_config);
config = &_config;
}
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
}
+ if (status >= 0) {
+ minfo.src = HWSPINLOCK_BASE;
+ minfo.size = HWSPINLOCK_SIZE;
+ minfo.isCached = FALSE;
+ status = Memory_map (&minfo);
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_setup",
+ status,
+ "Memory_map failed!");
+ }
+ else {
+ Platform_module->gateHWSpinlockVAddr = (Ptr)minfo.dst;
+ config->gateHWSpinlockConfig.numLocks = 32;
+ config->gateHWSpinlockConfig.baseAddr = minfo.dst + HWSPINLOCK_OFFSET;
+ status = GateHWSpinlock_setup (&config->gateHWSpinlockConfig);
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_setup",
+ status,
+ "GateHWSpinlock_setup failed!");
+ }
+ else {
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ status = GateHWSpinlock_start();
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_setup",
+ status,
+ "GateHWSpinlock_start failed!");
+ }
+ else {
+ Platform_module->gateHWSpinlockInitFlag = TRUE;
+ }
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ }
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+ }
+
+ /* Enable GP timers */
+ if (status >= 0) {
+ status = gpt_setup();
+ if (status < 0) {
+ GT_setFailureReason(curTrace, GT_4CLASS, "Platform_setup",
+ status, "gpt_setup failed!");
+ }
+ }
if (status < 0) {
Platform_destroy();
Platform_destroy (void)
{
Int32 status = Platform_S_SUCCESS;
+ Memory_UnmapInfo minfo;
GT_0trace (curTrace, GT_ENTER, "Platform_destroy");
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
}
+ /* disable GP timers */
+ gpt_destroy();
+
/* Finalize elf loader */
if (Platform_module->elfLoaderInitFlag == TRUE) {
status = ElfLoader_destroy ();
(sizeof (Platform_Object) * MultiProc_getNumProcessors()));
}
+ if (Platform_module->gateHWSpinlockInitFlag == TRUE) {
+ status = GateHWSpinlock_stop();
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_destroy",
+ status,
+ "GateHWSpinlock_stop failed!");
+ }
+ else {
+ status = GateHWSpinlock_destroy();
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_destroy",
+ status,
+ "GateHWSpinlock_destroy failed!");
+ }
+ else {
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ Platform_module->gateHWSpinlockInitFlag = FALSE;
+ }
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ }
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+
+ if (Platform_module->gateHWSpinlockVAddr) {
+ minfo.addr = (UInt32)Platform_module->gateHWSpinlockVAddr;
+ minfo.size = HWSPINLOCK_SIZE;
+ minfo.isCached = FALSE;
+ status = Memory_unmap(&minfo);
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_destroy",
+ status,
+ "Memory_unmap failed!");
+ }
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ Platform_module->gateHWSpinlockVAddr = NULL;
+ }
+
GT_1trace (curTrace, GT_LEAVE, "Platform_destroy", status);
/*! @retval Platform_S_SUCCESS Operation successful */
typedef union _Platform_setup_Local {
ProcMgr_Params params;
VAYUDSPPROC_Config dspProcConfig;
- VAYUIPUCORE1PROC_Config videoProcConfig;
- VAYUIPUCORE0PROC_Config vpssProcConfig;
+ VAYUIPUCORE0PROC_Config ipuProcConfig;
VAYUDSPPWR_Config dspPwrConfig;
- VAYUIPUPWR_Config videoPwrConfig;
- VAYUIPUPWR_Config vpssPwrConfig;
+ VAYUIPUPWR_Config ipuPwrConfig;
VAYUDSPPROC_Params dspProcParams;
- VAYUIPUCORE1PROC_Params videoProcParams;
- VAYUIPUCORE0PROC_Params vpssProcParams;
+ VAYUIPUCORE0PROC_Params ipuProcParams;
VAYUDSPPWR_Params dspPwrParams;
- VAYUIPUPWR_Params videoPwrParams;
- VAYUIPUPWR_Params vpssPwrParams;
+ VAYUIPUPWR_Params ipuPwrParams;
ElfLoader_Params elfLoaderParams;
} _Platform_setup_Local;
}
if (status >= 0) {
/* Get MultiProc ID by name. */
- procId = MultiProc_getId ("IPU2");
+ procId = MultiProc_getId ("IPU1");
handle = &Platform_objects [procId];
- VAYUIPUCORE0PROC_getConfig (&lv->vpssProcConfig);
- status = VAYUIPUCORE0PROC_setup (&lv->vpssProcConfig);
+ VAYUIPUCORE0PROC_getConfig (&lv->ipuProcConfig);
+ status = VAYUIPUCORE0PROC_setup (&lv->ipuProcConfig);
if (status < 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"VAYUIPUCORE0PROC_setup failed!");
}
else {
- VAYUIPUPWR_getConfig (&lv->vpssPwrConfig);
- status = VAYUIPUPWR_setup (&lv->vpssPwrConfig);
+ VAYUIPUPWR_getConfig (&lv->ipuPwrConfig);
+ status = VAYUIPUPWR_setup (&lv->ipuPwrConfig);
if (status < 0) {
GT_setFailureReason (curTrace,
GT_4CLASS,
if (status >= 0) {
/* Create an instance of the Processor object for
* VAYUIPUCORE0 */
- VAYUIPUCORE0PROC_Params_init (NULL, &lv->vpssProcParams);
- handle->sHandles.ipu1.pHandle = VAYUIPUCORE0PROC_create (procId,
- &lv->vpssProcParams);
+ VAYUIPUCORE0PROC_Params_init (NULL, &lv->ipuProcParams);
+ handle->sHandles.ipu.pHandle = VAYUIPUCORE0PROC_create (procId,
+ &lv->ipuProcParams);
+
+ /* Create an instance of the ELF Loader object */
+ ElfLoader_Params_init (NULL, &lv->elfLoaderParams);
+ handle->sHandles.ipu.ldrHandle = ElfLoader_create (procId,
+ &lv->elfLoaderParams);
+
+ /* Create an instance of the PwrMgr object for VAYUIPUCORE0 */
+ VAYUIPUPWR_Params_init (&lv->ipuPwrParams);
+ handle->sHandles.ipu.pwrHandle = VAYUIPUPWR_create (
+ procId,
+ &lv->ipuPwrParams);
+
+ if (handle->sHandles.ipu.pHandle == NULL) {
+ status = Platform_E_FAIL;
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_setup",
+ status,
+ "VAYUIPUCORE0PROC_create failed!");
+ }
+ else if (handle->sHandles.ipu.ldrHandle == NULL) {
+ status = Platform_E_FAIL;
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_setup",
+ status,
+ "Failed to create loader instance!");
+ }
+ else if (handle->sHandles.ipu.pwrHandle == NULL) {
+ status = Platform_E_FAIL;
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_setup",
+ status,
+ "VAYUIPUPWR_create failed!");
+ }
+ else {
+ /* Initialize parameters */
+ ProcMgr_Params_init (NULL, &lv->params);
+ lv->params.procHandle = handle->sHandles.ipu.pHandle;
+ lv->params.loaderHandle = handle->sHandles.ipu.ldrHandle;
+ lv->params.pwrHandle = handle->sHandles.ipu.pwrHandle;
+ handle->pmHandle = ProcMgr_create (procId, &lv->params);
+ if (handle->pmHandle == NULL) {
+ status = Platform_E_FAIL;
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_setup",
+ status,
+ "ProcMgr_create failed!");
+ }
+ }
+ }
+ }
+
+ if (status >= 0) {
+ /* Get MultiProc ID by name. */
+ procId = MultiProc_getId ("IPU2");
+
+ handle = &Platform_objects [procId];
+
+ if (status >= 0) {
+ /* Create an instance of the Processor object for
+ * VAYUIPUCORE0 */
+ VAYUIPUCORE0PROC_Params_init (NULL, &lv->ipuProcParams);
+ handle->sHandles.ipu.pHandle = VAYUIPUCORE0PROC_create (procId,
+ &lv->ipuProcParams);
/* Create an instance of the ELF Loader object */
ElfLoader_Params_init (NULL, &lv->elfLoaderParams);
- handle->sHandles.ipu1.ldrHandle = ElfLoader_create (procId,
+ handle->sHandles.ipu.ldrHandle = ElfLoader_create (procId,
&lv->elfLoaderParams);
/* Create an instance of the PwrMgr object for VAYUIPUCORE0 */
- VAYUIPUPWR_Params_init (&lv->vpssPwrParams);
- handle->sHandles.ipu1.pwrHandle = VAYUIPUPWR_create (
+ VAYUIPUPWR_Params_init (&lv->ipuPwrParams);
+ handle->sHandles.ipu.pwrHandle = VAYUIPUPWR_create (
procId,
- &lv->vpssPwrParams);
+ &lv->ipuPwrParams);
- if (handle->sHandles.ipu1.pHandle == NULL) {
+ if (handle->sHandles.ipu.pHandle == NULL) {
status = Platform_E_FAIL;
GT_setFailureReason (curTrace,
GT_4CLASS,
status,
"VAYUIPUCORE0PROC_create failed!");
}
- else if (handle->sHandles.ipu1.ldrHandle == NULL) {
+ else if (handle->sHandles.ipu.ldrHandle == NULL) {
status = Platform_E_FAIL;
GT_setFailureReason (curTrace,
GT_4CLASS,
status,
"Failed to create loader instance!");
}
- else if (handle->sHandles.ipu1.pwrHandle == NULL) {
+ else if (handle->sHandles.ipu.pwrHandle == NULL) {
status = Platform_E_FAIL;
GT_setFailureReason (curTrace,
GT_4CLASS,
else {
/* Initialize parameters */
ProcMgr_Params_init (NULL, &lv->params);
- lv->params.procHandle = handle->sHandles.ipu1.pHandle;
- lv->params.loaderHandle = handle->sHandles.ipu1.ldrHandle;
- lv->params.pwrHandle = handle->sHandles.ipu1.pwrHandle;
+ lv->params.procHandle = handle->sHandles.ipu.pHandle;
+ lv->params.loaderHandle = handle->sHandles.ipu.ldrHandle;
+ lv->params.pwrHandle = handle->sHandles.ipu.pwrHandle;
handle->pmHandle = ProcMgr_create (procId, &lv->params);
if (handle->pmHandle == NULL) {
status = Platform_E_FAIL;
}
/* ------------------------- IPU1 cleanup ------------------------------- */
+ handle = &Platform_objects [MultiProc_getId ("IPU1")];
+ if (handle->pmHandle != NULL) {
+ tmpStatus = ProcMgr_delete (&handle->pmHandle);
+ GT_assert (curTrace, (tmpStatus >= 0));
+ if ((status >= 0) && (tmpStatus < 0)) {
+ status = tmpStatus;
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_destroy",
+ status,
+ "ProcMgr_delete failed!");
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+ }
+
+ /* Delete the Processor, Loader and PwrMgr instances */
+ if (handle->sHandles.ipu.pwrHandle != NULL) {
+ tmpStatus = VAYUIPUPWR_delete (&handle->sHandles.ipu.pwrHandle);
+ GT_assert (curTrace, (tmpStatus >= 0));
+ if ((status >= 0) && (tmpStatus < 0)) {
+ status = tmpStatus;
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_destroy",
+ status,
+ "VAYUIPUPWR_delete failed!");
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+ }
+
+ if (handle->sHandles.ipu.ldrHandle != NULL) {
+ tmpStatus = ElfLoader_delete (&handle->sHandles.ipu.ldrHandle);
+ GT_assert (curTrace, (tmpStatus >= 0));
+ if ((status >= 0) && (tmpStatus < 0)) {
+ status = tmpStatus;
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_destroy",
+ status,
+ "Failed to delete loader instance!");
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+ }
+
+ if (handle->sHandles.ipu.pHandle != NULL) {
+ tmpStatus = VAYUIPUCORE0PROC_delete (&handle->sHandles.ipu.pHandle);
+ GT_assert (curTrace, (tmpStatus >= 0));
+ if ((status >= 0) && (tmpStatus < 0)) {
+ status = tmpStatus;
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "_Platform_destroy",
+ status,
+ "VAYUIPUCORE0PROC_delete failed!");
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+ }
+
+ /* ------------------------- IPU2 cleanup ------------------------------- */
handle = &Platform_objects [MultiProc_getId ("IPU2")];
if (handle->pmHandle != NULL) {
tmpStatus = ProcMgr_delete (&handle->pmHandle);
}
/* Delete the Processor, Loader and PwrMgr instances */
- if (handle->sHandles.ipu1.pwrHandle != NULL) {
- tmpStatus = VAYUIPUPWR_delete (&handle->sHandles.ipu1.pwrHandle);
+ if (handle->sHandles.ipu.pwrHandle != NULL) {
+ tmpStatus = VAYUIPUPWR_delete (&handle->sHandles.ipu.pwrHandle);
GT_assert (curTrace, (tmpStatus >= 0));
if ((status >= 0) && (tmpStatus < 0)) {
status = tmpStatus;
}
}
- if (handle->sHandles.ipu1.ldrHandle != NULL) {
- tmpStatus = ElfLoader_delete (&handle->sHandles.ipu1.ldrHandle);
+ if (handle->sHandles.ipu.ldrHandle != NULL) {
+ tmpStatus = ElfLoader_delete (&handle->sHandles.ipu.ldrHandle);
GT_assert (curTrace, (tmpStatus >= 0));
if ((status >= 0) && (tmpStatus < 0)) {
status = tmpStatus;
}
}
- if (handle->sHandles.ipu1.pHandle != NULL) {
- tmpStatus = VAYUIPUCORE0PROC_delete (&handle->sHandles.ipu1.pHandle);
+ if (handle->sHandles.ipu.pHandle != NULL) {
+ tmpStatus = VAYUIPUCORE0PROC_delete (&handle->sHandles.ipu.pHandle);
GT_assert (curTrace, (tmpStatus >= 0));
if ((status >= 0) && (tmpStatus < 0)) {
status = tmpStatus;