From 0cf3614475fa3a9bb49f570aac1cb0edec9abe4a Mon Sep 17 00:00:00 2001 From: "vwan@ti.com" Date: Fri, 24 May 2013 15:47:05 -0700 Subject: [PATCH] OMAP4: Removed files specific to OMAP4 in qnx directory This commit removes all source files that are specific to OMAP4, which the product does not support. Note that there are still file names, variable names, macros, etc. related to OMAP4 that will need subsequent clean up. Files in tiler and rpmsg-resmgr directories have been left in place as we are discussing their removal in an on-going thread. A minor change was needed in syslink_main.c as well in order to eliminate its use of type 'u32' defined in rprcfmt.h, so that we can remove the latter file, which is specific to the OMAP4 loader. Signed-off-by: VW --- qnx/src/ipc3x_dev/ReadMe.txt | 2 - .../syslink/build/Qnx/resmgr/syslink_main.c | 7 +- .../ti/syslink/family/omap4430/Platform.c | 1002 -------- .../syslink/family/omap4430/ipu/GlobalTypes.h | 187 -- .../syslink/family/omap4430/ipu/MMUAccInt.h | 211 -- .../syslink/family/omap4430/ipu/MMURegAcM.h | 454 ---- .../omap4430/ipu/OMAP4430DucatiPhyShmem.c | 326 --- .../ti/syslink/family/omap4430/ipu/hw_defs.h | 93 - .../ti/syslink/family/omap4430/ipu/hw_mmu.c | 597 ----- .../ti/syslink/family/omap4430/ipu/hw_mmu.h | 198 -- .../syslink/family/omap4430/ipu/omap4430Dmm.c | 393 ---- .../omap4430/ipu/omap4430DucatiEnabler.c | 1839 --------------- .../family/omap4430/ipu/omap4430DucatiHal.c | 190 -- .../omap4430/ipu/omap4430DucatiHalMmu.c | 937 -------- .../omap4430/ipu/omap4430DucatiHalReset.c | 442 ---- .../family/omap4430/ipu/omap4430DucatiProc.c | 2056 ----------------- .../syslink/inc/knl/OMAP4430DucatiEnabler.h | 423 ---- .../ti/syslink/inc/knl/OMAP4430DucatiHal.h | 120 - .../ti/syslink/inc/knl/OMAP4430DucatiHalMmu.h | 267 --- .../syslink/inc/knl/OMAP4430DucatiHalReset.h | 132 -- .../syslink/inc/knl/OMAP4430DucatiPhyShmem.h | 125 - .../ti/syslink/inc/knl/OMAP4430DucatiProc.h | 355 --- .../ti/syslink/inc/knl/Omap4430IpcInt.h | 155 -- .../ti/syslink/inc/knl/_Omap4430IpcInt.h | 90 - .../hlos/knl/arch/omap4430/Omap4430IpcInt.c | 1333 ----------- .../procMgr/hlos/knl/loaders/rprc/readrprc.c | 187 -- .../procMgr/hlos/knl/loaders/rprc/rprcfmt.h | 115 - .../hlos/knl/loaders/rprc/rprcloader.c | 1319 ----------- .../hlos/knl/Qnx/family/omap5430/ipu_pm.c | 19 +- 29 files changed, 3 insertions(+), 13571 deletions(-) delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/Platform.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/GlobalTypes.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMUAccInt.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMURegAcM.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/OMAP4430DucatiPhyShmem.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_defs.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430Dmm.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiEnabler.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHal.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalMmu.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalReset.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiProc.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiEnabler.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHal.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalMmu.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalReset.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiPhyShmem.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiProc.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/Omap4430IpcInt.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/inc/knl/_Omap4430IpcInt.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/arch/omap4430/Omap4430IpcInt.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/readrprc.c delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcfmt.h delete mode 100644 qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcloader.c diff --git a/qnx/src/ipc3x_dev/ReadMe.txt b/qnx/src/ipc3x_dev/ReadMe.txt index 5a6d0b2..b00f4f8 100644 --- a/qnx/src/ipc3x_dev/ReadMe.txt +++ b/qnx/src/ipc3x_dev/ReadMe.txt @@ -56,8 +56,6 @@ Build Instructions (Windows): Set the environment variable QCONF_OVERRIDE as follows: set QCONF_OVERRIDE = C:\ide-4.7-workspace\trunk\qconf-override.mk 3) From the command prompt: - To build for OMAP4: - > make To build for OMAP5: > make SYSLINK_PLATFORM=omap5430 TILER_PLATFORM=omap5430 SMP=1 To build for TI811X (note, there is no tiler support for j5 eco): diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_main.c b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_main.c index 3512cc6..fa400c6 100644 --- a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_main.c +++ b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_main.c @@ -68,7 +68,6 @@ #include #include #include <_MultiProc.h> -#include #include #include #if defined(SYSLINK_PLATFORM_OMAP4430) || defined(SYSLINK_PLATFORM_OMAP5430) @@ -309,8 +308,8 @@ int init_syslink_trace_device(syslink_dev_t *dev) syslink_attr_t * trace_attr; char trace_name[_POSIX_PATH_MAX]; int status = 0; - u32 da = 0, pa = 0; - u32 len; + unsigned int da = 0, pa = 0; + unsigned int len; memset(&resmgr_attr, 0, sizeof resmgr_attr); resmgr_attr.nparts_max = 10; @@ -407,8 +406,6 @@ int init_syslink_device(syslink_dev_t *dev) int i; char trace_name[_POSIX_PATH_MAX]; int status = 0; - u32 da = 0, pa = 0; - u32 len; pthread_mutex_init(&dev->lock, NULL); diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/Platform.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/Platform.c deleted file mode 100644 index 538f4cd..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/Platform.c +++ /dev/null @@ -1,1002 +0,0 @@ -/* - * @file Platform.c - * - * @brief Implementation of Platform initialization logic. - * - * - * @ver 02.00.00.46_alpha1 - * - * ============================================================================ - * - * Copyright (c) 2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -/* Standard header files */ -#include - -/* Utilities & Osal headers */ -#include -#include -#include -#include -#include -#include <_MultiProc.h> -#include -#include - -/* SysLink device specific headers */ -#include -#include -#include -#include -#include -#include -#include - -/* Module level headers */ -#include <_MessageQCopy.h> -#include -#include <_MessageQCopyDefs.h> - -#include -#include <_ProcMgr.h> -#include -#include - -#include -#include <_Ipc.h> -#include -#include - -#if defined (__cplusplus) -extern "C" { -#endif - - -/** ============================================================================ - * Macros. - * ============================================================================ - */ -#define RESETVECTOR_SYMBOL "_Ipc_ResetVector" - -#define IPC_MEM_VRING0 0xA0000000 -#define IPC_MEM_VRING1 0xA0004000 -#define IPC_MEM_VRING2 0xA0008000 -#define IPC_MEM_VRING3 0xA000c000 - -/** ============================================================================ - * Application specific configuration, please change these value according to - * your application's need. - * ============================================================================ - */ -/*! - * @brief Structure defining config parameters for overall System. - */ -typedef struct Platform_Config { - MultiProc_Config multiProcConfig; - /*!< Multiproc config parameter */ - - MessageQCopy_Config MQCopyConfig; - /*!< Notify config parameter */ - - ProcMgr_Config procMgrConfig; - /*!< Processor manager config parameter */ - - ipu_pm_config ipu_pm_config; - /* ipu_pm config parameter */ - - rprcloader_Config rprcloaderConfig; - /*!< Elf loader config parameter */ -} Platform_Config; - - -/* Struct embedded into slave binary */ -typedef struct Platform_SlaveConfig { - UInt32 cacheLineSize; - UInt32 brOffset; -} Platform_SlaveConfig; - -typedef struct Platform_SlaveSRConfig { - UInt32 entryBase; - UInt32 entryLen; - UInt32 ownerProcId; - UInt32 id; - UInt32 createHeap; - UInt32 cacheLineSize; -} Platform_SlaveSRConfig; - -/* Shared region configuration information for host side. */ -typedef struct Platform_HostSRConfig { - UInt16 refCount; -} Platform_HostSRConfig; - -/*! @brief structure for platform instance */ -typedef struct Platform_Object { - /*!< Flag to indicate platform initialization status */ - ProcMgr_Handle pmHandle; - /*!< Handle to the ProcMgr instance used */ - union{ - struct { - OMAP4430DUCATIPROC_Handle pHandle; - /*!< Handle to the Processor instance used */ - /*!< Handle to the PwrMgr instance used */ - rprcloader_Handle ldrHandle; - /*!< Handle to the Loader instance used */ - UInt32 fileId; - /*!< File ID of loaded image, needed for un-loading */ - } sysm3; - struct { - OMAP4430DUCATIPROC_Handle pHandle; - /*!< Handle to the Processor instance used */ - /*!< Handle to the PwrMgr instance used */ - /* NOTE: no loader used for appm3, both cores loaded at once */ - /*!< Handle to the Loader instance used */ - } appm3; - } sHandles; - /*!< Slave specific handles */ - Platform_SlaveConfig slaveCfg; - /*!< Slave embedded config */ - Platform_SlaveSRConfig * slaveSRCfg; - /*!< Shared region details from slave */ -} Platform_Object, *Platform_Handle; - - -/*! @brief structure for platform instance */ -typedef struct Platform_Module_State { - Bool multiProcInitFlag; - /*!< MultiProc Initialize flag */ - Bool ipu_pm_init_flag; - /*!< ipu_pm Initialize flag */ - Bool procMgrInitFlag; - /*!< Processor manager Initialize flag */ - Bool rprcloaderInitFlag; - /*!< rprc loader Initialize flag */ - Bool ipcIntInitFlag; - /*!< IpcInt Initialize flag */ - Bool platformInitFlag; - /*!< Flag to indicate platform initialization status */ - Bool mqcopyInitFlag; - /*!< rprc loader Initialize flag */ - Bool platform_mem_init_flag; -} Platform_Module_State; - - -/* ============================================================================= - * GLOBALS - * ============================================================================= - */ -static Platform_Object Platform_objects [MultiProc_MAXPROCESSORS]; -static Platform_Module_State Platform_Module_state; -static Platform_Module_State * Platform_module = &Platform_Module_state; - -Int32 _Platform_setup (Ipc_Config * cfg); -Int32 _Platform_destroy (void); - -/** ============================================================================ - * APIs. - * ============================================================================ - */ -/* Function to read slave memory */ -Int32 -_Platform_readSlaveMemory (UInt16 procId, - UInt32 addr, - Ptr value, - UInt32 * numBytes); - -/* Function to write slave memory */ -Int32 -_Platform_writeSlaveMemory (UInt16 procId, - UInt32 addr, - Ptr value, - UInt32 * numBytes); -/*! - * @brief Function to get the default values for configurations. - * - * @param config Configuration values. - */ -Void -Platform_getConfig (Platform_Config * config) -{ - GT_1trace (curTrace, GT_ENTER, "Platform_getConfig", config); - - GT_assert (curTrace, (config != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (config == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_getConfig", - Platform_E_INVALIDARG, - "Argument of type (Platform_getConfig *) passed " - "is null!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - /* Get the gatepeterson default config */ - MultiProc_getConfig (&config->multiProcConfig); - - /* Get the PROCMGR default config */ - ProcMgr_getConfig (&config->procMgrConfig); - - /* Get the ElfLoader default config */ - rprcloader_getConfig (&config->rprcloaderConfig); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "Platform_getConfig"); -} - -/*! - * @brief Function to override the default confiuration values. - * - * @param config Configuration values. - */ -Int32 -Platform_overrideConfig (Platform_Config * config, Ipc_Config * cfg) -{ - Int32 status = Platform_S_SUCCESS; - - GT_1trace (curTrace, GT_ENTER, "Platform_overrideConfig", config); - - GT_assert (curTrace, (config != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (config == NULL) { - /*! @retval Platform_E_INVALIDARG Argument of type - * (Platform_Config *) passed is null*/ - status = Platform_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_overrideConfig", - status, - "Argument of type (Platform_getConfig *) passed " - "is null!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - /* Override the gatepeterson default config */ - config->multiProcConfig.numProcessors = 4; - config->multiProcConfig.id = 0; - - String_cpy (config->multiProcConfig.nameList [0], - "HOST"); - String_cpy (config->multiProcConfig.nameList [1], - "CORE0"); - String_cpy (config->multiProcConfig.nameList [2], - "CORE1"); - String_cpy (config->multiProcConfig.nameList [3], - "DSP"); - - /* Override the PROCMGR default config */ - - /* Override the MessageQCopy default config */ - config->MQCopyConfig.intId[1] = 58; - config->MQCopyConfig.intId[2] = 58; - config->MQCopyConfig.intId[3] = 58; - - config->ipu_pm_config.int_id = 58; - config->ipu_pm_config.num_procs = 2; - config->ipu_pm_config.proc_ids[0] = 2; // CORE0 is set as 2 above - config->ipu_pm_config.proc_ids[1] = 1; // CORE1 is set as 1 above - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_ENTER, "Platform_overrideConfig", status); - - /*! @retval Platform_S_SUCCESS operation was successful */ - return status; -} - -/*! - * @brief Function to setup platform. - * TBD: logic would change completely in the final system. - */ -Int32 -Platform_setup (Ipc_Config * cfg) -{ - Int32 status = Platform_S_SUCCESS; - Platform_Config _config; - Platform_Config * config; - Omap4430IpcInt_Config omap4430cfg; - - Platform_getConfig (&_config); - config = &_config; - -/* Initialize PlatformMem */ - status = MemoryOS_setup(); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_setup", - status, - "platform_mem_setup!"); - } else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->platform_mem_init_flag = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - Platform_overrideConfig (config, cfg); - - status = MultiProc_setup (&(config->multiProcConfig)); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_setup", - status, - "MultiProc_setup failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->multiProcInitFlag = 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, - "Platform_setup", - status, - "ProcMgr_setup failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->procMgrInitFlag = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - /* Initialize IpcInt required for VirtQueue/MessageQCopy. */ - if (status >= 0) { - /* Do the IPC interrupt setup for the full platform (cfg is not used) */ - Omap4430IpcInt_setup(&omap4430cfg); - Platform_module->ipcIntInitFlag = TRUE; - } - -/* Initialize rprc loader */ - if (status >= 0) { - status = rprcloader_setup (&config->rprcloaderConfig); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_setup", - status, - "rprcloader_setup failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->rprcloaderInitFlag = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - -/* Initialize ipu_pm */ - if (status >= 0) { - status = ipu_pm_setup (&config->ipu_pm_config); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_setup", - status, - "ipu_pm_setup failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->ipu_pm_init_flag = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - -/* Initialize MessageQCopy */ - if (status >= 0) { - status = MessageQCopy_setup (&config->MQCopyConfig); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_setup", - status, - "MessageQCopy_setup failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->mqcopyInitFlag = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - if (status >= 0) { - Memory_set (Platform_objects, - 0, - (sizeof (Platform_Object) * MultiProc_getNumProcessors())); - } - - if (status >= 0) { - /* Doing per remote-proc init stuff */ - status = _Platform_setup (cfg); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_setup", - status, - "_Platform_setup failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->platformInitFlag = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - if (status < 0) { - Platform_destroy(); - } - - return status; -} - - -/*! - * @brief Function to destroy the System. - * - * @sa Platform_setup - */ -Int32 -Platform_destroy (void) -{ - Int32 status = Platform_S_SUCCESS; - - GT_0trace (curTrace, GT_ENTER, "Platform_destroy"); - - /* Finalize Platform-specific destroy */ - if (Platform_module->platformInitFlag == TRUE) { - status = _Platform_destroy (); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_destroy", - status, - "Platform_destroy failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->platformInitFlag = FALSE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - /* Finalize MessageQCopy */ - if (Platform_module->mqcopyInitFlag == TRUE) { - status = MessageQCopy_destroy (); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_destroy", - status, - "MessageQCopy_destroy failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->mqcopyInitFlag = FALSE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - /* Finalize ipu_pm */ - if (Platform_module->ipu_pm_init_flag == TRUE) { - status = ipu_pm_destroy (); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_destroy", - status, - "ipu_pm_destroy failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->ipu_pm_init_flag = FALSE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - /* Finalize rprc loader */ - if (Platform_module->rprcloaderInitFlag == TRUE) { - status = rprcloader_destroy (); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_destroy", - status, - "rprcloader_destroy failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->rprcloaderInitFlag = FALSE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - if (Platform_module->ipcIntInitFlag == TRUE) { - Omap4430IpcInt_destroy (); - Platform_module->ipcIntInitFlag = FALSE; - } - - /* Finalize PROCMGR */ - if (Platform_module->procMgrInitFlag == TRUE) { - status = ProcMgr_destroy (); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_destroy", - status, - "ProcMgr_destroy failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->procMgrInitFlag = FALSE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - /* Finalize MultiProc */ - if (Platform_module->multiProcInitFlag == TRUE) { - status = MultiProc_destroy (); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_destroy", - status, - "MultiProc_destroy failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->multiProcInitFlag = FALSE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - if (status >= 0) { - Memory_set (Platform_objects, - 0, - (sizeof (Platform_Object) * MultiProc_getNumProcessors())); - } - - if (Platform_module->platform_mem_init_flag == TRUE) { - status = MemoryOS_destroy(); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Platform_destroy", - status, - "MemoryOS_destroy failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Platform_module->platform_mem_init_flag = FALSE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - GT_1trace (curTrace, GT_LEAVE, "Platform_destroy", status); - - /*! @retval Platform_S_SUCCESS Operation successful */ - return status; -} - -/*! - * @brief Function to setup platform. - * TBD: logic would change completely in the final system. - */ -Int32 -_Platform_setup (Ipc_Config * cfg) -{ - Int32 status = Platform_S_SUCCESS; - ProcMgr_Params params; - OMAP4430DUCATIPROC_Config sysM3ProcConfig; - OMAP4430DUCATIPROC_Config appM3ProcConfig; - OMAP4430DUCATIPROC_Params sysM3ProcParams; - OMAP4430DUCATIPROC_Params appM3ProcParams; - ProcMgr_AddrInfo * memEntries; - rprcloader_Params rprcloaderParams; - rprcloader_Handle ldrHandle; - UInt16 procId; - Platform_Handle handle; - UInt32 pa, va; - UInt32 i = 0; - Bool core0Setup = FALSE; - Bool core1Setup = FALSE; - ProcMgr_AttachParams attachParams; - - GT_0trace (curTrace, GT_ENTER, "_Platform_setup"); - - /* Get MultiProc ID by name. */ - procId = MultiProc_getId ("CORE0"); - - handle = &Platform_objects [procId]; - - OMAP4430DUCATIPROC_get_config(&sysM3ProcConfig, procId ); - status = OMAP4430DUCATIPROC_setup (&sysM3ProcConfig, procId); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "_Platform_setup", - status, - "OMAP4430PROC_setup failed!"); - } - else { - core0Setup = TRUE; - /* Create an instance of the Processor object for - * OMAP4430 */ - OMAP4430DUCATIPROC_Params_init (NULL, &sysM3ProcParams, procId); - pa = cfg->pAddr; - va = cfg->vAddr; - memEntries = sysM3ProcParams.memEntries; - for (i = 0; i < sysM3ProcParams.numMemEntries; i++) { - memEntries[i].addr[ProcMgr_AddrType_MasterPhys] = pa; - memEntries[i].addr[ProcMgr_AddrType_MasterKnlVirt] = va; - pa += memEntries[i].size; - va += memEntries[i].size; - } - handle->sHandles.sysm3.pHandle = OMAP4430DUCATIPROC_create ( - procId, - &sysM3ProcParams); - - /* Create an instance of the rprc Loader object */ - rprcloader_Params_init (NULL, &rprcloaderParams); - handle->sHandles.sysm3.ldrHandle = rprcloader_create (procId, - &rprcloaderParams); - - if (handle->sHandles.sysm3.pHandle == NULL) { - status = Platform_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_Platform_setup", - status, - "OMAP4430PROC_create failed!"); - } - else if (handle->sHandles.sysm3.ldrHandle == NULL) { - status = Platform_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_Platform_setup", - status, - "Failed to create loader instance!"); - } - else { - /* Initialize parameters */ - ProcMgr_Params_init (NULL, ¶ms); - params.procHandle = handle->sHandles.sysm3.pHandle; - params.loaderHandle = handle->sHandles.sysm3.ldrHandle; - ldrHandle = params.loaderHandle; - String_cpy (params.rstVectorSectionName, - RESETVECTOR_SYMBOL); - handle->pmHandle = ProcMgr_create (procId, ¶ms); - if (handle->pmHandle == NULL) { - status = Platform_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_Platform_setup", - status, - "ProcMgr_create failed!"); - } - else { - ProcMgr_getAttachParams(handle->pmHandle, &attachParams); - ProcMgr_attach(handle->pmHandle, &attachParams); - MessageQCopy_attach(procId, (Ptr)IPC_MEM_VRING0, 0); - } - } - } - - if (status >= 0) { - /* Get MultiProc ID by name. */ - procId = MultiProc_getId ("CORE1"); - - handle = &Platform_objects [procId]; - OMAP4430DUCATIPROC_get_config (&appM3ProcConfig, procId ); - status = OMAP4430DUCATIPROC_setup (&appM3ProcConfig, procId); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "_Platform_setup", - status, - "OMAP4430PROC_setup failed!"); - } - else { - core1Setup = TRUE; - /* Create an instance of the Processor object for - * OMAP4430 */ - OMAP4430DUCATIPROC_Params_init(NULL, &appM3ProcParams,procId); - pa = cfg->pAddr; - va = cfg->vAddr; - memEntries = appM3ProcParams.memEntries; - for (i = 0; i < appM3ProcParams.numMemEntries; i++) { - memEntries[i].addr[ProcMgr_AddrType_MasterPhys] = pa; - memEntries[i].addr[ProcMgr_AddrType_MasterKnlVirt] = va; - pa += memEntries[i].size; - va += memEntries[i].size; - } - handle->sHandles.appm3.pHandle = OMAP4430DUCATIPROC_create(procId, - &appM3ProcParams); - - /* Don't create an instance of the rprc Loader - not needed */ - - if (handle->sHandles.appm3.pHandle == NULL) { - status = Platform_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_Platform_setup", - status, - "OMAP4430PROC_create failed!"); - } - else { - /* Initialize parameters */ - ProcMgr_Params_init (NULL, ¶ms); - params.procHandle = handle->sHandles.appm3.pHandle; - /* Use the same loader handle as sysm3 to avoid ProcMgr errors */ - params.loaderHandle = ldrHandle; - String_cpy (params.rstVectorSectionName, - RESETVECTOR_SYMBOL); - handle->pmHandle = ProcMgr_create (procId, ¶ms); - if (handle->pmHandle == NULL) { - status = Platform_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_Platform_setup", - status, - "ProcMgr_create failed!"); - } - else { - ProcMgr_getAttachParams(handle->pmHandle, &attachParams); - ProcMgr_attach(handle->pmHandle, &attachParams); - MessageQCopy_attach(procId, (Ptr)IPC_MEM_VRING2, 200); - } - } - } - } - - if (status < 0) { - /* Cleanup in case of error */ - procId = MultiProc_getId ("CORE1"); - handle = &Platform_objects [procId]; - if (handle->pmHandle) { - ProcMgr_delete(&handle->pmHandle); - handle->pmHandle = NULL; - } - if (handle->sHandles.appm3.pHandle) { - OMAP4430DUCATIPROC_delete(&handle->sHandles.appm3.pHandle); - handle->sHandles.appm3.pHandle = NULL; - } - if (core1Setup) - OMAP4430DUCATIPROC_destroy(procId); - - procId = MultiProc_getId ("CORE0"); - handle = &Platform_objects [procId]; - if (handle->pmHandle) { - ProcMgr_delete(&handle->pmHandle); - handle->pmHandle = NULL; - } - if (handle->sHandles.sysm3.ldrHandle) { - rprcloader_delete(&handle->sHandles.sysm3.ldrHandle); - handle->sHandles.sysm3.ldrHandle = NULL; - } - if (handle->sHandles.sysm3.pHandle) { - OMAP4430DUCATIPROC_delete(&handle->sHandles.sysm3.pHandle); - handle->sHandles.sysm3.pHandle = NULL; - } - if (core0Setup) - OMAP4430DUCATIPROC_destroy(procId); - } - GT_1trace (curTrace, GT_LEAVE, "_Platform_setup", status); - - /*! @retval Platform_S_SUCCESS operation was successful */ - return status; -} - - -/*! - * @brief Function to setup platform. - * TBD: logic would change completely in the final system. - */ -Int32 -_Platform_destroy (void) -{ - Int32 status = Platform_S_SUCCESS; - Int32 tmpStatus = Platform_S_SUCCESS; - Platform_Handle handle; - /*UInt16 procId;*/ - - /* Get MultiProc ID by name. */ - - GT_0trace (curTrace, GT_ENTER, "_Platform_destroy"); - - /* ------------------------- APPM3 cleanup ------------------------------ */ - handle = &Platform_objects [MultiProc_getId ("CORE1")]; - 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.appm3.pHandle != NULL) { - tmpStatus = OMAP4430DUCATIPROC_delete (&handle->sHandles.appm3.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, - "OMAP4430PROC_delete failed!"); -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - } - - tmpStatus = OMAP4430DUCATIPROC_destroy (MultiProc_getId ("CORE1")); - 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, - "OMAP4430PROC_destroy failed!"); -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - /* ------------------------- SYSM3 cleanup ------------------------------ */ - handle = &Platform_objects [MultiProc_getId ("CORE0")]; - 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.sysm3.ldrHandle != NULL) { - tmpStatus = rprcloader_delete (&handle->sHandles.sysm3.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.sysm3.pHandle != NULL) { - tmpStatus = OMAP4430DUCATIPROC_delete (&handle->sHandles.sysm3.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, - "OMAP4430PROC_delete failed!"); -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - } - - tmpStatus = OMAP4430DUCATIPROC_destroy (MultiProc_getId ("CORE0")); - 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, - "OMAP4430PROC_destroy failed!"); -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - GT_1trace (curTrace, GT_LEAVE, "_Platform_destroy", status); - - /*! @retval Platform_S_SUCCESS operation was successful */ - return status; -} - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/GlobalTypes.h b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/GlobalTypes.h deleted file mode 100644 index 831b9b8..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/GlobalTypes.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * @file GlobalTypes.h - * - * @brief Macro definitions required by HW layer. - * - * - * @ver 02.00.00.46_alpha1 - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef __GLOBALTYPES_H -#define __GLOBALTYPES_H - -#define REG volatile - -/* - * Definition: RET_CODE_BASE - * - * DESCRIPTION: Base value for return code offsets - * - * - */ -#define RET_CODE_BASE 0 - -/* - * TYPE: ReturnCode_t - * - * DESCRIPTION: Return codes to be returned by all library functions - * - * - */ -enum ReturnCode_label { -RET_OK = 0, -RET_FAIL = -1, -RET_BAD_NULL_PARAM = -2, -RET_PARAM_OUT_OF_RANGE = -3, -RET_INVALID_ID = -4, -RET_EMPTY = -5, -RET_FULL = -6, -RET_TIMEOUT = -7, -RET_INVALID_OPERATION = -8, -/* Add new error codes at end of above list */ -RET_NUM_RET_CODES /* this should ALWAYS be LAST entry */ -}; - - - -/* - * MACRO: RD_MEM_32_VOLATILE, WR_MEM_32_VOLATILE - * - * DESCRIPTION: 32 bit register access macros - * - * - */ -#define RD_MEM_32_VOLATILE(addr) \ -((unsigned long)(*((REG unsigned long *)(addr)))) - -#define WR_MEM_32_VOLATILE(addr, data) \ -(*((REG unsigned long *)(addr)) = (unsigned long)(data)) - - - - -#ifdef CHECK_INPUT_PARAMS -/* - * MACRO: CHECK_INPUT_PARAMS - * - * DESCRIPTION: Checks an input code and returns a specified value if code is - * invalid value, also writes spy value if error found. - * - * NOTE: Can be disabled to save HW cycles. - * - * - */ -#define CHECK_INPUT_PARAM(actualValue, invalidValue, \ -returnCodeIfMismatch, spyCodeIfMisMatch) do {\ - if ((invalidValue) == (actualValue)) {\ - RES_Set((spyCodeIfMisMatch));\ - return returnCodeIfMismatch; \ - } \ -} while (0) - -/* - * MACRO: CHECK_INPUT_RANGE - * - * DESCRIPTION: Checks an input value and returns a specified value if not in - * specified range, also writes spy value if error found. - * -* NOTE: Can be disabled to save HW cycles. - * - * - */ -#define CHECK_INPUT_RANGE(actualValue, minValidValue, maxValidValue, \ -returnCodeIfMismatch, spyCodeIfMisMatch) do {\ - if (((actualValue) < (minValidValue)) || \ - ((actualValue) > (maxValidValue))) {\ - RES_Set((spyCodeIfMisMatch));\ - return returnCodeIfMismatch; \ - } \ -} while (0) - -/* - * MACRO: CHECK_INPUT_RANGE_MIN0 - * - * DESCRIPTION: Checks an input value and returns a - * specified value if not in - * specified range, also writes spy value if error found. - * The minimum - * value is 0. - * - * NOTE: Can be disabled to save HW cycles. - * - * - */ -#define CHECK_INPUT_RANGE_MIN0(actualValue, maxValidValue, \ -returnCodeIfMismatch, spyCodeIfMisMatch) do {\ - if ((actualValue) > (maxValidValue)) {\ - RES_Set((spyCodeIfMisMatch));\ - return returnCodeIfMismatch; \ - } \ -} while (0) - -#else - -#define CHECK_INPUT_PARAM(actualValue, invalidValue, returnCodeIfMismatch,\ -spyCodeIfMisMatch) - -#define CHECK_INPUT_PARAM_NO_SPY(actualValue, invalidValue, \ -returnCodeIfMismatch) - -#define CHECK_INPUT_RANGE(actualValue, minValidValue, maxValidValue, \ -returnCodeIfMismatch, spyCodeIfMisMatch) - -#define CHECK_INPUT_RANGE_NO_SPY(actualValue, minValidValue , \ -maxValidValue, returnCodeIfMismatch) - -#define CHECK_INPUT_RANGE_MIN0(actualValue, maxValidValue, \ -returnCodeIfMismatch, spyCodeIfMisMatch) - -#define CHECK_INPUT_RANGE_NO_SPY_MIN0(actualValue, \ -maxValidValue, returnCodeIfMismatch) - -#endif - -#ifdef __cplusplus -} -#endif -#endif /* __GLOBALTYPES_H */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMUAccInt.h b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMUAccInt.h deleted file mode 100644 index f1948ee..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMUAccInt.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * @file MMUAccInt.h - * - * @brief MMU Register offset definitions - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -#ifndef _MMU_ACC_INT_H -#define _MMU_ACC_INT_H - - -/* Register offset address definitions */ - -#define MMU_MMU_REVISION_OFFSET 0x0 -#define MMU_MMU_SYSCONFIG_OFFSET 0x10 -#define MMU_MMU_SYSSTATUS_OFFSET 014 -#define MMU_MMU_IRQSTATUS_OFFSET 0x18 -#define MMU_MMU_IRQENABLE_OFFSET 0x1c -#define MMU_MMU_WALKING_ST_OFFSET 0x40 -#define MMU_MMU_CNTL_OFFSET 0x44 -#define MMU_MMU_FAULT_AD_OFFSET 0x48 -#define MMU_MMU_TTB_OFFSET 0x4c -#define MMU_MMU_LOCK_OFFSET 0x50 -#define MMU_MMU_LD_TLB_OFFSET 0x54 -#define MMU_MMU_CAM_OFFSET 0x58 -#define MMU_MMU_RAM_OFFSET 0x5c -#define MMU_MMU_GFLUSH_OFFSET 0x60 -#define MMU_MMU_FLUSH_ENTRY_OFFSET 0x64 -#define MMU_MMU_READ_CAM_OFFSET 0x68 -#define MMU_MMU_READ_RAM_OFFSET 0x6c -#define MMU_MMU_EMU_FAULT_AD_OFFSET 0x70 - - -/* Bitfield mask and offset declarations */ - -#define MMU_MMU_REVISION_Rev_MASK 0xff -#define MMU_MMU_REVISION_Rev_OFFSET 0 - -#define MMU_MMU_SYSCONFIG_ClockActivity_MASK 0x300 -#define MMU_MMU_SYSCONFIG_ClockActivity_OFFSET 8 - -#define MMU_MMU_SYSCONFIG_IdleMode_MASK 0x18 -#define MMU_MMU_SYSCONFIG_IdleMode_OFFSET 3 - -#define MMU_MMU_SYSCONFIG_SoftReset_MASK 0x2 -#define MMU_MMU_SYSCONFIG_SoftReset_OFFSET 1 - -#define MMU_MMU_SYSCONFIG_AutoIdle_MASK 0x1 -#define MMU_MMU_SYSCONFIG_AutoIdle_OFFSET 0 - -#define MMU_MMU_SYSSTATUS_ResetDone_MASK 0x1 -#define MMU_MMU_SYSSTATUS_ResetDone_OFFSET 0 - -#define MMU_MMU_IRQSTATUS_MultiHitFault_MASK 0x10 -#define MMU_MMU_IRQSTATUS_MultiHitFault_OFFSET 4 - -#define MMU_MMU_IRQSTATUS_TableWalkFault_MASK 0x8 -#define MMU_MMU_IRQSTATUS_TableWalkFault_OFFSET 3 - -#define MMU_MMU_IRQSTATUS_EMUMiss_MASK 0x4 -#define MMU_MMU_IRQSTATUS_EMUMiss_OFFSET 2 - -#define MMU_MMU_IRQSTATUS_TranslationFault_MASK 0x2 -#define MMU_MMU_IRQSTATUS_TranslationFault_OFFSET 1 - -#define MMU_MMU_IRQSTATUS_TLBMiss_MASK 0x1 -#define MMU_MMU_IRQSTATUS_TLBMiss_OFFSET 0 - -#define MMU_MMU_IRQENABLE_MultiHitFault_MASK 0x10 -#define MMU_MMU_IRQENABLE_MultiHitFault_OFFSET 4 - -#define MMU_MMU_IRQENABLE_TableWalkFault_MASK 0x8 -#define MMU_MMU_IRQENABLE_TableWalkFault_OFFSET 3 - -#define MMU_MMU_IRQENABLE_EMUMiss_MASK 0x4 -#define MMU_MMU_IRQENABLE_EMUMiss_OFFSET 2 - -#define MMU_MMU_IRQENABLE_TranslationFault_MASK 0x2 -#define MMU_MMU_IRQENABLE_TranslationFault_OFFSET 1 - -#define MMU_MMU_IRQENABLE_TLBMiss_MASK 0x1 -#define MMU_MMU_IRQENABLE_TLBMiss_OFFSET 0 - -#define MMU_MMU_WALKING_ST_TWLRunning_MASK 0x1 -#define MMU_MMU_WALKING_ST_TWLRunning_OFFSET 0 - -#define MMU_MMU_CNTL_EmuTLBUpdate_MASK 0x8 -#define MMU_MMU_CNTL_EmuTLBUpdate_OFFSET 3 - -#define MMU_MMU_CNTL_TWLEnable_MASK 0x4 -#define MMU_MMU_CNTL_TWLEnable_OFFSET 2 - -#define MMU_MMU_CNTL_MMUEnable_MASK 0x2 -#define MMU_MMU_CNTL_MMUEnable_OFFSET 1 - -#define MMU_MMU_FAULT_AD_FaultAddress_MASK 0xffffffff -#define MMU_MMU_FAULT_AD_FaultAddress_OFFSET 0 - -#define MMU_MMU_TTB_TTBAddress_MASK 0xffffff00 -#define MMU_MMU_TTB_TTBAddress_OFFSET 8 - -#define MMU_MMU_LOCK_BaseValue_MASK 0xfc00 -#define MMU_MMU_LOCK_BaseValue_OFFSET 10 - -#define MMU_MMU_LOCK_CurrentVictim_MASK 0x3f0 -#define MMU_MMU_LOCK_CurrentVictim_OFFSET 4 - -#define MMU_MMU_LD_TLB_LdTLBItem_MASK 0x1 -#define MMU_MMU_LD_TLB_LdTLBItem_OFFSET 0 - -#define MMU_MMU_CAM_VATag_MASK 0xfffff000 -#define MMU_MMU_CAM_VATag_OFFSET 12 - -#define MMU_MMU_CAM_P_MASK 0x8 -#define MMU_MMU_CAM_P_OFFSET 3 - -#define MMU_MMU_CAM_V_MASK 0x4 -#define MMU_MMU_CAM_V_OFFSET 2 - -#define MMU_MMU_CAM_PageSize_MASK 0x3 -#define MMU_MMU_CAM_PageSize_OFFSET 0 - -#define MMU_MMU_RAM_PhysicalAddress_MASK 0xfffff000 -#define MMU_MMU_RAM_PhysicalAddress_OFFSET 12 - -#define MMU_MMU_RAM_Endianness_MASK 0x200 -#define MMU_MMU_RAM_Endianness_OFFSET 9 - -#define MMU_MMU_RAM_ElementSize_MASK 0x180 -#define MMU_MMU_RAM_ElementSize_OFFSET 7 - -#define MMU_MMU_RAM_Mixed_MASK 0x40 -#define MMU_MMU_RAM_Mixed_OFFSET 6 - -#define MMU_MMU_GFLUSH_GlobalFlush_MASK 0x1 -#define MMU_MMU_GFLUSH_GlobalFlush_OFFSET 0 - -#define MMU_MMU_FLUSH_ENTRY_FlushEntry_MASK 0x1 -#define MMU_MMU_FLUSH_ENTRY_FlushEntry_OFFSET 0 - -#define MMU_MMU_READ_CAM_VATag_MASK 0xfffff000 -#define MMU_MMU_READ_CAM_VATag_OFFSET 12 - -#define MMU_MMU_READ_CAM_P_MASK 0x8 -#define MMU_MMU_READ_CAM_P_OFFSET 3 - -#define MMU_MMU_READ_CAM_V_MASK 0x4 -#define MMU_MMU_READ_CAM_V_OFFSET 2 - -#define MMU_MMU_READ_CAM_PageSize_MASK 0x3 -#define MMU_MMU_READ_CAM_PageSize_OFFSET 0 - -#define MMU_MMU_READ_RAM_PhysicalAddress_MASK 0xfffff000 -#define MMU_MMU_READ_RAM_PhysicalAddress_OFFSET 12 - -#define MMU_MMU_READ_RAM_Endianness_MASK 0x200 -#define MMU_MMU_READ_RAM_Endianness_OFFSET 9 - -#define MMU_MMU_READ_RAM_ElementSize_MASK 0x180 -#define MMU_MMU_READ_RAM_ElementSize_OFFSET 7 - -#define MMU_MMU_READ_RAM_Mixed_MASK 0x40 -#define MMU_MMU_READ_RAM_Mixed_OFFSET 6 - -#define MMU_MMU_EMU_FAULT_AD_EmuFaultAddress_MASK 0xffffffff -#define MMU_MMU_EMU_FAULT_AD_EmuFaultAddress_OFFSET 0 - -#endif /* _MMU_ACC_INT_H */ -/* EOF */ - diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMURegAcM.h b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMURegAcM.h deleted file mode 100644 index 4e89344..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/MMURegAcM.h +++ /dev/null @@ -1,454 +0,0 @@ -/* - * @file MMUAccInt.h - * - * @brief MMU Register access Macros - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef _MMU_REG_ACM_H -#define _MMU_REG_ACM_H - - - -#include -#include - - -/* -* EXPORTED DEFINITIONS -* -*/ - -#define MMUMMU_SYSCONFIGReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_SYSCONFIG_OFFSET)) - - -#define MMUMMU_SYSCONFIGWriteRegister32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_SYSCONFIG_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - -#define MMUMMU_SYSCONFIGClockActivityGet32(var)\ - ((UInt32)(((var) & MMU_MMU_SYSCONFIG_ClockActivity_MASK)\ - >> MMU_MMU_SYSCONFIG_ClockActivity_OFFSET)) - -#define mmu_sisconf_auto_idle_set32(var, value)\ - ((((var) & ~(MMU_MMU_SYSCONFIG_AutoIdle_MASK)) |\ - (((value) << MMU_MMU_SYSCONFIG_AutoIdle_OFFSET) &\ - MMU_MMU_SYSCONFIG_AutoIdle_MASK))) - -#define MMUMMU_IRQSTATUSReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_IRQSTATUS_OFFSET)) - - -#define MMUMMU_IRQSTATUSWriteRegister32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_IRQSTATUS_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - - -#define MMUMMU_IRQENABLEReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_IRQENABLE_OFFSET)) - - -#define MMUMMU_IRQENABLEWriteRegister32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_IRQENABLE_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - -#define MMUMMU_IRQENABLETableWalkFaultSet32(var, value)\ - ((((var) & ~(MMU_MMU_IRQENABLE_TableWalkFault_MASK)) |\ - (((value) << MMU_MMU_IRQENABLE_TableWalkFault_OFFSET) &\ - MMU_MMU_IRQENABLE_TableWalkFault_MASK))) - -#define MMUMMU_IRQENABLETranslationFaultRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_IRQENABLE_OFFSET)))) &\ - MMU_MMU_IRQENABLE_TranslationFault_MASK) >>\ - MMU_MMU_IRQENABLE_TranslationFault_OFFSET)) - - - -#define MMUMMU_IRQENABLETranslationFaultSet32(var, value)\ - ((((var) & ~(MMU_MMU_IRQENABLE_TranslationFault_MASK)) |\ - (((value) << MMU_MMU_IRQENABLE_TranslationFault_OFFSET) &\ - MMU_MMU_IRQENABLE_TranslationFault_MASK))) - - -#define MMUMMU_IRQENABLETLBMissRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_IRQENABLE_OFFSET)))) &\ - MMU_MMU_IRQENABLE_TLBMiss_MASK) >>\ - MMU_MMU_IRQENABLE_TLBMiss_OFFSET)) - - -#define MMUMMU_IRQENABLETLBMissReadIsTrMissIntM32(base_address)\ - ((MMUMMU_IRQENABLETLBMissTrMissIntM == (MMUMMU_IRQENABLETLBMissE)\ - (((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_IRQENABLE_OFFSET)))) &\ - MMU_MMU_IRQENABLE_TLBMiss_MASK) >>\ - MMU_MMU_IRQENABLE_TLBMiss_OFFSET))) - - -#define MMUMMU_IRQENABLETLBMissReadIsTrMissGInt32(base_address)\ - ((MMUMMU_IRQENABLETLBMissTrMissGInt == (MMUMMU_IRQENABLETLBMissE)\ - (((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_IRQENABLE_OFFSET)))) &\ - MMU_MMU_IRQENABLE_TLBMiss_MASK) >>\ - MMU_MMU_IRQENABLE_TLBMiss_OFFSET))) - - -#define MMUMMU_IRQENABLETLBMissGet32(var)\ - ((UInt32)(((var) & MMU_MMU_IRQENABLE_TLBMiss_MASK)\ - >> MMU_MMU_IRQENABLE_TLBMiss_OFFSET)) - - -#define MMUMMU_IRQENABLETLBMissIsTrMissIntM32(var)\ - ((MMUMMU_IRQENABLETLBMissTrMissIntM == \ - (MMUMMU_IRQENABLETLBMissE)(((var) & MMU_MMU_IRQENABLE_TLBMiss_MASK) >>\ - MMU_MMU_IRQENABLE_TLBMiss_OFFSET))) - -#define MMUMMU_IRQENABLETLBMissIsTrMissGInt32(var)\ - ((MMUMMU_IRQENABLETLBMissTrMissGInt ==\ - (MMUMMU_IRQENABLETLBMissE)(((var) & MMU_MMU_IRQENABLE_TLBMiss_MASK) >>\ - MMU_MMU_IRQENABLE_TLBMiss_OFFSET))) - -#define MMUMMU_IRQENABLETLBMissWrite32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_IRQENABLE_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE((base_address)+offset);\ - register UInt32 newValue = (value);\ - data &= ~(MMU_MMU_IRQENABLE_TLBMiss_MASK);\ - newValue <<= MMU_MMU_IRQENABLE_TLBMiss_OFFSET;\ - newValue &= MMU_MMU_IRQENABLE_TLBMiss_MASK;\ - newValue |= data;\ - WR_MEM_32_VOLATILE(base_address+offset, newValue);\ -} - - -#define MMUMMU_IRQENABLETLBMissWriteTrMissIntM32(base_address)\ -{\ - const UInt32 offset = MMU_MMU_IRQENABLE_OFFSET;\ - const UInt32 newValue = (UInt32)MMUMMU_IRQENABLETLBMissTrMissIntM <<\ - MMU_MMU_IRQENABLE_TLBMiss_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE(base_address+offset);\ - data &= ~(MMU_MMU_IRQENABLE_TLBMiss_MASK);\ - data |= newValue;\ - WR_MEM_32_VOLATILE(base_address+offset, data);\ -} - - -#define MMUMMU_IRQENABLETLBMissWriteTrMissGInt32(base_address)\ -{\ - const UInt32 offset = MMU_MMU_IRQENABLE_OFFSET;\ - const UInt32 newValue = (UInt32)MMUMMU_IRQENABLETLBMissTrMissGInt <<\ - MMU_MMU_IRQENABLE_TLBMiss_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE(base_address+offset);\ - data &= ~(MMU_MMU_IRQENABLE_TLBMiss_MASK);\ - data |= newValue;\ - WR_MEM_32_VOLATILE(base_address+offset, data);\ -} - - -#define MMUMMU_IRQENABLETLBMissSet32(var, value)\ - ((((var) & ~(MMU_MMU_IRQENABLE_TLBMiss_MASK)) |\ - (((value) << MMU_MMU_IRQENABLE_TLBMiss_OFFSET) &\ - MMU_MMU_IRQENABLE_TLBMiss_MASK))) - - -#define MMUMMU_WALKING_STTWLRunningRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_WALKING_ST_OFFSET)))) &\ - MMU_MMU_WALKING_ST_TWLRunning_MASK) >>\ - MMU_MMU_WALKING_ST_TWLRunning_OFFSET)) - - - -#define MMUMMU_CNTLTWLEnableRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_CNTL_OFFSET)))) &\ - MMU_MMU_CNTL_TWLEnable_MASK) >>\ - MMU_MMU_CNTL_TWLEnable_OFFSET)) - - -#define MMUMMU_CNTLTWLEnableWrite32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_CNTL_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE((base_address)+offset);\ - register UInt32 newValue = (value);\ - data &= ~(MMU_MMU_CNTL_TWLEnable_MASK);\ - newValue <<= MMU_MMU_CNTL_TWLEnable_OFFSET;\ - newValue &= MMU_MMU_CNTL_TWLEnable_MASK;\ - newValue |= data;\ - WR_MEM_32_VOLATILE(base_address+offset, newValue);\ -} - - -#define MMUMMU_CNTLMMUEnableWrite32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_CNTL_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE((base_address)+offset);\ - register UInt32 newValue = (value);\ - data &= ~(MMU_MMU_CNTL_MMUEnable_MASK);\ - newValue <<= MMU_MMU_CNTL_MMUEnable_OFFSET;\ - newValue &= MMU_MMU_CNTL_MMUEnable_MASK;\ - newValue |= data;\ - WR_MEM_32_VOLATILE(base_address+offset, newValue);\ -} - - -#define MMUMMU_FAULT_ADReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_FAULT_AD_OFFSET)) - - -#define MMUMMU_FAULT_ADFaultAddressRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_FAULT_AD_OFFSET)))) &\ - MMU_MMU_FAULT_AD_FaultAddress_MASK) >>\ - MMU_MMU_FAULT_AD_FaultAddress_OFFSET)) - -#define MMUMMU_FAULT_ADFaultAddressGet32(var)\ - ((UInt32)(((var) & MMU_MMU_FAULT_AD_FaultAddress_MASK)\ - >> MMU_MMU_FAULT_AD_FaultAddress_OFFSET)) - - -#define MMUMMU_TTBReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_TTB_OFFSET)) - -#define MMUMMU_TTBWriteRegister32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_TTB_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - -#define MMUMMU_TTBTTBAddressRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_TTB_OFFSET)))) &\ - MMU_MMU_TTB_TTBAddress_MASK) >>\ - MMU_MMU_TTB_TTBAddress_OFFSET)) - -#define MMUMMU_TTBTTBAddressGet32(var)\ - ((UInt32)(((var) & MMU_MMU_TTB_TTBAddress_MASK)\ - >> MMU_MMU_TTB_TTBAddress_OFFSET)) - - -#define MMUMMU_TTBTTBAddressWrite32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_TTB_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE((base_address)+offset);\ - register UInt32 newValue = (value);\ - data &= ~(MMU_MMU_TTB_TTBAddress_MASK);\ - newValue <<= MMU_MMU_TTB_TTBAddress_OFFSET;\ - newValue &= MMU_MMU_TTB_TTBAddress_MASK;\ - newValue |= data;\ - WR_MEM_32_VOLATILE(base_address+offset, newValue);\ -} - -#define MMUMMU_TTBTTBAddressSet32(var, value)\ - ((((var) & ~(MMU_MMU_TTB_TTBAddress_MASK)) |\ - (((value) << MMU_MMU_TTB_TTBAddress_OFFSET) &\ - MMU_MMU_TTB_TTBAddress_MASK))) - - -#define mmu_lckread_reg_32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_LOCK_OFFSET)) - -#define mmu_lck_write_reg32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_LOCK_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - - -#define MMUMMU_LOCKBaseValueRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_LOCK_OFFSET)))) &\ - MMU_MMU_LOCK_BaseValue_MASK) >>\ - MMU_MMU_LOCK_BaseValue_OFFSET)) -#define MMUMMU_LOCKBaseValueGet32(var)\ - ((UInt32)(((var) & MMU_MMU_LOCK_BaseValue_MASK)\ - >> MMU_MMU_LOCK_BaseValue_OFFSET)) - - -#define MMUMMU_LOCKBaseValueWrite32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_LOCK_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE((base_address)+offset);\ - register UInt32 newValue = (value);\ - data &= ~(MMU_MMU_LOCK_BaseValue_MASK);\ - newValue <<= MMU_MMU_LOCK_BaseValue_OFFSET;\ - newValue &= MMU_MMU_LOCK_BaseValue_MASK;\ - newValue |= data;\ - WR_MEM_32_VOLATILE(base_address+offset, newValue);\ -} - - -#define MMUMMU_LOCKBaseValueSet32(var, value)\ - ((((var) & ~(MMU_MMU_LOCK_BaseValue_MASK)) |\ - (((value) << MMU_MMU_LOCK_BaseValue_OFFSET) &\ - MMU_MMU_LOCK_BaseValue_MASK))) - -#define MMUMMU_LOCKCurrentVictimRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_LOCK_OFFSET)))) &\ - MMU_MMU_LOCK_CurrentVictim_MASK) >>\ - MMU_MMU_LOCK_CurrentVictim_OFFSET)) - - -#define MMUMMU_LOCKCurrentVictimGet32(var)\ - ((UInt32)(((var) & MMU_MMU_LOCK_CurrentVictim_MASK)\ - >> MMU_MMU_LOCK_CurrentVictim_OFFSET)) - - -#define mmu_lck_crnt_vctmwite32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_LOCK_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE((base_address)+offset);\ - register UInt32 newValue = (value);\ - data &= ~(MMU_MMU_LOCK_CurrentVictim_MASK);\ - newValue <<= MMU_MMU_LOCK_CurrentVictim_OFFSET;\ - newValue &= MMU_MMU_LOCK_CurrentVictim_MASK;\ - newValue |= data;\ - WR_MEM_32_VOLATILE(base_address+offset, newValue);\ -} - - -#define MMUMMU_LOCKCurrentVictimSet32(var, value)\ - ((((var) & ~(MMU_MMU_LOCK_CurrentVictim_MASK)) |\ - (((value) << MMU_MMU_LOCK_CurrentVictim_OFFSET) &\ - MMU_MMU_LOCK_CurrentVictim_MASK))) - - -#define MMUMMU_LD_TLBReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_LD_TLB_OFFSET)) - -#define mmu_ld_tlbwrt_reg32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_LD_TLB_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - -#define MMUMMU_LD_TLBLdTLBItemRead32(base_address)\ - ((((RD_MEM_32_VOLATILE(((base_address)+(MMU_MMU_LD_TLB_OFFSET)))) &\ - MMU_MMU_LD_TLB_LdTLBItem_MASK) >>\ - MMU_MMU_LD_TLB_LdTLBItem_OFFSET)) - - -#define MMUMMU_CAMReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_READ_CAM_OFFSET)) - - -#define MMUMMU_CAMWriteRegister32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_CAM_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - -#define MMUMMU_RAMReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_READ_RAM_OFFSET)) - - -#define MMUMMU_RAMWriteRegister32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_RAM_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - -#define MMUMMU_GFLUSHGlobalFlushWrite32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_GFLUSH_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE((base_address)+offset);\ - register UInt32 newValue = (value);\ - data &= ~(MMU_MMU_GFLUSH_GlobalFlush_MASK);\ - newValue <<= MMU_MMU_GFLUSH_GlobalFlush_OFFSET;\ - newValue &= MMU_MMU_GFLUSH_GlobalFlush_MASK;\ - newValue |= data;\ - WR_MEM_32_VOLATILE(base_address+offset, newValue);\ -} - -#define MMUMMU_GFLUSHGlobalFlushWritenft_w32(base_address)\ -{\ - const UInt32 offset = MMU_MMU_GFLUSH_OFFSET;\ - const UInt32 newValue = (UInt32)MMUMMU_GFLUSHGlobalFlushnft_w <<\ - MMU_MMU_GFLUSH_GlobalFlush_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE(base_address+offset);\ - data &= ~(MMU_MMU_GFLUSH_GlobalFlush_MASK);\ - data |= newValue;\ - WR_MEM_32_VOLATILE(base_address+offset, data);\ -} - -#define MMUMMU_GFLUSHGlobalFlushWriteflush_w32(base_address)\ -{\ - const UInt32 offset = MMU_MMU_GFLUSH_OFFSET;\ - const UInt32 newValue = (UInt32)MMUMMU_GFLUSHGlobalFlushflush_w <<\ - MMU_MMU_GFLUSH_GlobalFlush_OFFSET;\ - register UInt32 data = RD_MEM_32_VOLATILE(base_address+offset);\ - data &= ~(MMU_MMU_GFLUSH_GlobalFlush_MASK);\ - data |= newValue;\ - WR_MEM_32_VOLATILE(base_address+offset, data);\ -} - - -#define MMUMMU_GFLUSHGlobalFlushSet32(var, value)\ - ((((var) & ~(MMU_MMU_GFLUSH_GlobalFlush_MASK)) |\ - (((value) << MMU_MMU_GFLUSH_GlobalFlush_OFFSET) &\ - MMU_MMU_GFLUSH_GlobalFlush_MASK))) - -#define MMUMMU_FLUSH_ENTRYReadRegister32(base_address)\ - (RD_MEM_32_VOLATILE((base_address)+MMU_MMU_FLUSH_ENTRY_OFFSET)) - - -#define MMUMMU_FLUSH_ENTRYWriteRegister32(base_address, value)\ -{\ - const UInt32 offset = MMU_MMU_FLUSH_ENTRY_OFFSET;\ - register UInt32 newValue = (value);\ - WR_MEM_32_VOLATILE((base_address)+offset, newValue);\ -} - - - - -#endif /* _MMU_REG_ACM_H */ -/* EOF */ - diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/OMAP4430DucatiPhyShmem.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/OMAP4430DucatiPhyShmem.c deleted file mode 100644 index 6449f64..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/OMAP4430DucatiPhyShmem.c +++ /dev/null @@ -1,326 +0,0 @@ -/* - * @file OMAP4430DucatiPhyShmem.c - * - * @brief Qnx shared memory physical interface file for OMAP4430Ducati. - * - * This module is responsible for handling boot-related hardware- - * specific operations. - * The implementation is specific to OMAP4430Ducati. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - - - -/* Standard headers */ -#include - -/* Module headers */ -#include <_ProcDefs.h> -#include - -/* OSAL and utils */ -#include - -/* Hardware Abstraction Layer headers */ -#include -#include -#include -#include -#include - -#define INREG32(x) in32(x) -#define OUTREG32(x, y) out32(x, y) - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ - - -/* ============================================================================= - * APIs called by OMAP4430DucatiPROC module - * ============================================================================= - */ -/*! - * @brief Function to initialize Shared Driver/device. - * - * @param halObj Pointer to the HAL object - * @param addrInfo Pointer to address info - * - * @sa OMAP4430DUCATI_phyShmemExit - * Memory_map - */ -Int -OMAP4430DUCATI_phyShmemInit (Ptr halObj, ProcMgr_AddrInfo *addrInfo) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalObject * halObject = NULL; - Memory_MapInfo mapInfo; - Memory_UnmapInfo unmapInfo; - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATI_phyShmemInit", halObj); - - GT_assert (curTrace, (halObj != NULL)); - GT_assert (curTrace, (addrInfo != NULL)); - - halObject = (OMAP4430DUCATI_HalObject *) halObj; - - /* Map code base */ - mapInfo.src = addrInfo[0].addr[ProcMgr_AddrType_MasterPhys]; - mapInfo.size = addrInfo[0].size; - mapInfo.isCached = FALSE; - status = Memory_map (&mapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_phyShmemInit", - status, - "Failure in Memory_map for Code base registers"); - halObject->CodeBase = 0; - } - else { - halObject->CodeBase = mapInfo.dst; - addrInfo[0].addr[ProcMgr_AddrType_MasterKnlVirt] = mapInfo.dst; - - /* Map M3 Base */ - mapInfo.src = addrInfo[1].addr[ProcMgr_AddrType_MasterPhys]; - mapInfo.size = addrInfo[1].size; - mapInfo.isCached = FALSE; - status = Memory_map (&mapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP5430DUCATI_phyShmemInit", - status, - "Failure in Memory_map for M3 base"); - halObject->M3Base= 0; - - unmapInfo.addr = halObject->CodeBase; - unmapInfo.size = addrInfo[0].size; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - halObject->CodeBase = 0; - } - else{ - halObject->M3Base = mapInfo.dst; - addrInfo[1].addr[ProcMgr_AddrType_MasterKnlVirt] = mapInfo.dst; - - /* Map Const Base */ - mapInfo.src = addrInfo[2].addr[ProcMgr_AddrType_MasterPhys]; - mapInfo.size = addrInfo[2].size; - mapInfo.isCached = FALSE; - status = Memory_map (&mapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_phyShmemInit", - status, - "Failure in Memory_map for Const base"); - halObject->ConstBase= 0; - - unmapInfo.addr = halObject->M3Base; - unmapInfo.size = addrInfo[1].size; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - halObject->M3Base= 0; - - unmapInfo.addr = halObject->CodeBase; - unmapInfo.size = addrInfo[0].size; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - halObject->CodeBase = 0; - } - else { - halObject->ConstBase = mapInfo.dst; - addrInfo[2].addr[ProcMgr_AddrType_MasterKnlVirt] = mapInfo.dst; - - /* Map MMU base */ - mapInfo.src = OMAP4_MMU1_BASE; - mapInfo.size = OMAP4_MMU1_SIZE; - mapInfo.isCached = FALSE; - status = Memory_map (&mapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_phyShmemInit", - status, - "Failure in Memory_map for MMU base"); - halObject->mmuBase = 0; - - unmapInfo.addr = halObject->ConstBase; - unmapInfo.size = addrInfo[2].size; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - halObject->ConstBase = 0; - - unmapInfo.addr = halObject->M3Base; - unmapInfo.size = addrInfo[1].size; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - halObject->M3Base = 0; - - unmapInfo.addr = halObject->CodeBase; - unmapInfo.size = addrInfo[0].size; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - halObject->CodeBase = 0; - } - else { - halObject->mmuBase = mapInfo.dst; - } - } - } - } - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_phyShmemInit", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to finalize Shared Driver/device. - * - * @param halObj Pointer to the HAL object - * @param addrInfo Pointer to addr info - * - * @sa OMAP4430DUCATI_phyShmemInit - * Memory_Unmap - */ -Int OMAP4430DUCATI_phyShmemExit (Ptr halObj, ProcMgr_AddrInfo * addrInfo) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalObject * halObject = NULL; - Memory_UnmapInfo unmapInfo; - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATI_phyShmemExit", halObj); - - GT_assert (curTrace, (halObj != NULL)); - GT_assert (curTrace, (addrInfo != NULL)); - - halObject = (OMAP4430DUCATI_HalObject *) halObj; - - unmapInfo.addr = halObject->mmuBase; - unmapInfo.size = MMU_SIZE; - unmapInfo.isCached = FALSE; - if (unmapInfo.addr != 0) { - status = Memory_unmap (&unmapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_phyShmemExit", - status, - "Failure in Memory_Unmap for MMU base"); - } - halObject->mmuBase = 0; - } - - /* Map Const Base */ - unmapInfo.addr = halObject->ConstBase; - unmapInfo.size = addrInfo[2].size; - unmapInfo.isCached = FALSE; - if (unmapInfo.addr != 0) { - status = Memory_unmap (&unmapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_phyShmemExit", - status, - "Failure in Memory_unmap for const base"); - } - halObject->ConstBase = 0; - } - - /* Map M3 Base */ - unmapInfo.addr = halObject->M3Base; - unmapInfo.size = addrInfo[1].size; - unmapInfo.isCached = FALSE; - if (unmapInfo.addr != 0) { - status = Memory_unmap (&unmapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_phyShmemExit", - status, - "Failure in Memory_unmap for M3 base"); - } - halObject->M3Base = 0; - } - - /* Un-Map code base */ - unmapInfo.addr = halObject->CodeBase; - unmapInfo.size = addrInfo[0].size; - unmapInfo.isCached = FALSE; - if (unmapInfo.addr != 0) { - status = Memory_unmap (&unmapInfo); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_phyShmemExit", - status, - "Failure in Memory_unmap for code base"); - } - halObject->CodeBase = 0; - } - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_phyShmemExit",status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -#if defined (__cplusplus) - -} -#endif diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_defs.h b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_defs.h deleted file mode 100644 index b07378c..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_defs.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @file hw_defs.h - * - * @brief Definitions required for HW module - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef __HW_DEFS_H -#define __HW_DEFS_H - -#include - -/* Page size */ -#define HW_PAGE_SIZE_4KB 0x1000 -#define HW_PAGE_SIZE_64KB 0x10000 -#define HW_PAGE_SIZE_1MB 0x100000 -#define HW_PAGE_SIZE_16MB 0x1000000 - -/* hw_status: return type for HW API */ -typedef long hw_status; - -/* hw_set_clear_t: Enumerated Type used to set and clear any bit */ -enum hw_set_clear_t { - HW_CLEAR, - HW_SET -} ; - -/* hw_endianism_t: Enumerated Type used to specify the endianism - * Do NOT change these values. They are used as bit fields. */ -enum hw_endianism_t { - HW_LITTLE_ENDIAN, - HW_BIG_ENDIAN - -} ; - -/* hw_elemnt_siz_t: Enumerated Type used to specify the element size - * Do NOT change these values. They are used as bit fields. */ -enum hw_elemnt_siz_t { - HW_ELEM_SIZE_8BIT, - HW_ELEM_SIZE_16BIT, - HW_ELEM_SIZE_32BIT, - HW_ELEM_SIZE_64BIT - -} ; - -/* HW_IdleMode_t: Enumerated Type used to specify Idle modes */ -enum HW_IdleMode_t { - HW_FORCE_IDLE, - HW_NO_IDLE, - HW_SMART_IDLE -} ; - -#endif /* __HW_DEFS_H */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.c deleted file mode 100644 index 6b9da69..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.c +++ /dev/null @@ -1,597 +0,0 @@ -/* - * @file hw_mbox.c - * - * @brief Functions required to program MMU - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - - -#include -#include -#include -#include -#include - -#define MMU_BASE_VAL_MASK 0xFC00 -#define MMU_PAGE_MAX 3 -#define MMU_ELEMENTSIZE_MAX 3 -#define MMU_ADDR_MASK 0xFFFFF000 -#define MMU_TTB_MASK 0xFFFFC000 -#define MMU_SECTION_ADDR_MASK 0xFFF00000 -#define MMU_SSECTION_ADDR_MASK 0xFF000000 -#define MMU_PAGE_TABLE_MASK 0xFFFFFC00 -#define MMU_LARGE_PAGE_MASK 0xFFFF0000 -#define MMU_SMALL_PAGE_MASK 0xFFFFF000 - -#define MMU_LOAD_TLB 0x00000001 -#define NUM_TLB_ENTRIES 32 - -/* -* type: hw_mmu_pgsiz_t -* -* desc: Enumerated Type used to specify the MMU Page Size(SLSS) -* -* -*/ -enum hw_mmu_pgsiz_t { - HW_MMU_SECTION, - HW_MMU_LARGE_PAGE, - HW_MMU_SMALL_PAGE, - HW_MMU_SUPERSECTION - -}; - -/* -* function : mmu_flsh_entry -*/ - -static hw_status mmu_flsh_entry(const UInt32 base_address); - - /* -* function : mme_set_cam_entry -* -*/ - -static hw_status mme_set_cam_entry(const UInt32 base_address, - const UInt32 page_size, - const UInt32 preserve_bit, - const UInt32 valid_bit, - const UInt32 virt_addr_tag); - -/* -* function : mmu_set_ram_entry -*/ -static hw_status mmu_set_ram_entry(const UInt32 base_address, - const UInt32 physical_addr, - enum hw_endianism_t endianism, - enum hw_elemnt_siz_t element_size, - enum hw_mmu_mixed_size_t mixedSize); - -/* -* hw functions -* -*/ - -hw_status hw_mmu_enable(const UInt32 base_address) -{ - hw_status status = RET_OK; - - MMUMMU_CNTLMMUEnableWrite32(base_address, HW_SET); - - return status; -} - -hw_status hw_mmu_disable(const UInt32 base_address) -{ - hw_status status = RET_OK; - - MMUMMU_CNTLMMUEnableWrite32(base_address, HW_CLEAR); - - return status; -} - -hw_status hw_mmu_nulck_set(const UInt32 base_address, UInt32 *num_lcked_entries) -{ - hw_status status = RET_OK; - - *num_lcked_entries = MMUMMU_LOCKBaseValueRead32(base_address); - - return status; -} - - -hw_status hw_mmu_numlocked_set(const UInt32 base_address, UInt32 num_lcked_entries) -{ - hw_status status = RET_OK; - - MMUMMU_LOCKBaseValueWrite32(base_address, num_lcked_entries); - - return status; -} - - - -hw_status hw_mmu_vctm_numget(const UInt32 base_address, UInt32 *vctm_entry_num) -{ - hw_status status = RET_OK; - - *vctm_entry_num = MMUMMU_LOCKCurrentVictimRead32(base_address); - - return status; -} - - - -hw_status hw_mmu_victim_numset(const UInt32 base_address, UInt32 vctm_entry_num) -{ - hw_status status = RET_OK; - - mmu_lck_crnt_vctmwite32(base_address, vctm_entry_num); - - return status; -} - -hw_status hw_mmu_tlb_flushAll(const UInt32 base_address) -{ - hw_status status = RET_OK; - - MMUMMU_GFLUSHGlobalFlushWrite32(base_address, HW_SET); - - return status; -} - -hw_status hw_mmu_eventack(const UInt32 base_address, UInt32 irq_mask) -{ - hw_status status = RET_OK; - - MMUMMU_IRQSTATUSWriteRegister32(base_address, irq_mask); - - return status; -} - -hw_status hw_mmu_event_disable(const UInt32 base_address, UInt32 irq_mask) -{ - hw_status status = RET_OK; - UInt32 irqReg; - irqReg = MMUMMU_IRQENABLEReadRegister32(base_address); - - MMUMMU_IRQENABLEWriteRegister32(base_address, irqReg & ~irq_mask); - - return status; -} - -hw_status hw_mmu_event_enable(const UInt32 base_address, UInt32 irq_mask) -{ - hw_status status = RET_OK; - UInt32 irqReg; - - irqReg = MMUMMU_IRQENABLEReadRegister32(base_address); - - MMUMMU_IRQENABLEWriteRegister32(base_address, irqReg | irq_mask); - - return status; -} - -hw_status hw_mmu_event_status(const UInt32 base_address, UInt32 *irq_mask) -{ - hw_status status = RET_OK; - - *irq_mask = MMUMMU_IRQSTATUSReadRegister32(base_address); - - return status; -} - -hw_status hw_mmu_flt_adr_rd(const UInt32 base_address, UInt32 *addr) -{ - hw_status status = RET_OK; - - /*Check the input Parameters*/ - CHECK_INPUT_PARAM(base_address, 0, RET_BAD_NULL_PARAM, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - /* read values from register */ - *addr = MMUMMU_FAULT_ADReadRegister32(base_address); - - return status; -} - - -hw_status hw_mmu_ttbset(const UInt32 base_address, UInt32 ttb_phys_addr) -{ - hw_status status = RET_OK; - UInt32 loadTTB; - - /*Check the input Parameters*/ - CHECK_INPUT_PARAM(base_address, 0, RET_BAD_NULL_PARAM, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - - loadTTB = ttb_phys_addr & ~0x7FUL; - /* write values to register */ - MMUMMU_TTBWriteRegister32(base_address, loadTTB); - - return status; -} - -hw_status hw_mmu_twl_enable(const UInt32 base_address) -{ - hw_status status = RET_OK; - - MMUMMU_CNTLTWLEnableWrite32(base_address, HW_SET); - - return status; -} - -hw_status hw_mmu_twl_disable(const UInt32 base_address) -{ - hw_status status = RET_OK; - - MMUMMU_CNTLTWLEnableWrite32(base_address, HW_CLEAR); - - return status; -} - - -hw_status hw_mmu_tlb_flush(const UInt32 base_address, - UInt32 virtual_addr, - UInt32 page_size) -{ - hw_status status = RET_OK; - UInt32 virt_addr_tag; - enum hw_mmu_pgsiz_t pg_sizeBits; - - switch (page_size) { - case HW_PAGE_SIZE_4KB: - pg_sizeBits = HW_MMU_SMALL_PAGE; - break; - - case HW_PAGE_SIZE_64KB: - pg_sizeBits = HW_MMU_LARGE_PAGE; - break; - - case HW_PAGE_SIZE_1MB: - pg_sizeBits = HW_MMU_SECTION; - break; - - case HW_PAGE_SIZE_16MB: - pg_sizeBits = HW_MMU_SUPERSECTION; - break; - - default: - return RET_FAIL; - } - - /* Generate the 20-bit tag from virtual address */ - virt_addr_tag = ((virtual_addr & MMU_ADDR_MASK) >> 12); - - mme_set_cam_entry(base_address, pg_sizeBits, 0, 0, virt_addr_tag); - - mmu_flsh_entry(base_address); - - return status; -} - - -hw_status hw_mmu_tlb_add(const UInt32 base_address, - UInt32 physical_addr, - UInt32 virtual_addr, - UInt32 page_size, - UInt32 entryNum, - struct hw_mmu_map_attrs_t *map_attrs, - enum hw_set_clear_t preserve_bit, - enum hw_set_clear_t valid_bit) -{ - hw_status status = RET_OK; - UInt32 lockReg; - UInt32 virt_addr_tag; - enum hw_mmu_pgsiz_t mmu_pg_size; - - /*Check the input Parameters*/ - CHECK_INPUT_PARAM(base_address, 0, RET_BAD_NULL_PARAM, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - CHECK_INPUT_RANGE_MIN0(page_size, MMU_PAGE_MAX, RET_PARAM_OUT_OF_RANGE, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - CHECK_INPUT_RANGE_MIN0(map_attrs->element_size, - MMU_ELEMENTSIZE_MAX, RET_PARAM_OUT_OF_RANGE, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - - switch (page_size) { - case HW_PAGE_SIZE_4KB: - mmu_pg_size = HW_MMU_SMALL_PAGE; - break; - - case HW_PAGE_SIZE_64KB: - mmu_pg_size = HW_MMU_LARGE_PAGE; - break; - - case HW_PAGE_SIZE_1MB: - mmu_pg_size = HW_MMU_SECTION; - break; - - case HW_PAGE_SIZE_16MB: - mmu_pg_size = HW_MMU_SUPERSECTION; - break; - - default: - return RET_FAIL; - } - - lockReg = mmu_lckread_reg_32(base_address); - - /* Generate the 20-bit tag from virtual address */ - virt_addr_tag = ((virtual_addr & MMU_ADDR_MASK) >> 12); - - /* Write the fields in the CAM Entry Register */ - mme_set_cam_entry(base_address, mmu_pg_size, preserve_bit, valid_bit, - virt_addr_tag); - - /* Write the different fields of the RAM Entry Register */ - /* endianism of the page,Element Size of the page (8, 16, 32, 64 bit) */ - mmu_set_ram_entry(base_address, physical_addr, - map_attrs->endianism, map_attrs->element_size, map_attrs->mixedSize); - - /* Update the MMU Lock Register */ - /* currentVictim between lockedBaseValue and (MMU_Entries_Number - 1) */ - mmu_lck_crnt_vctmwite32(base_address, entryNum); - - /* Enable loading of an entry in TLB by writing 1 into LD_TLB_REG - register */ - mmu_ld_tlbwrt_reg32(base_address, MMU_LOAD_TLB); - - - mmu_lck_write_reg32(base_address, lockReg); - - return status; -} - - - -hw_status hw_mmu_pte_set(const UInt32 pg_tbl_va, - UInt32 physical_addr, - UInt32 virtual_addr, - UInt32 page_size, - struct hw_mmu_map_attrs_t *map_attrs) -{ - hw_status status = RET_OK; - UInt32 pte_addr, pte_val; - long int num_entries = 1; - - switch (page_size) { - - case HW_PAGE_SIZE_4KB: - pte_addr = hw_mmu_pte_addr_l2(pg_tbl_va, virtual_addr & - MMU_SMALL_PAGE_MASK); - pte_val = ((physical_addr & MMU_SMALL_PAGE_MASK) | - (map_attrs->endianism << 9) | - (map_attrs->element_size << 4) | - (map_attrs->mixedSize << 11) | 2 - ); - break; - - case HW_PAGE_SIZE_64KB: - num_entries = 16; - pte_addr = hw_mmu_pte_addr_l2(pg_tbl_va, virtual_addr & - MMU_LARGE_PAGE_MASK); - pte_val = ((physical_addr & MMU_LARGE_PAGE_MASK) | - (map_attrs->endianism << 9) | - (map_attrs->element_size << 4) | - (map_attrs->mixedSize << 11) | 1 - ); - break; - - case HW_PAGE_SIZE_1MB: - pte_addr = hw_mmu_pte_addr_l1(pg_tbl_va, virtual_addr & - MMU_SECTION_ADDR_MASK); - pte_val = ((((physical_addr & MMU_SECTION_ADDR_MASK) | - (map_attrs->endianism << 15) | - (map_attrs->element_size << 10) | - (map_attrs->mixedSize << 17)) & - ~0x40000) | 0x2 - ); - break; - - case HW_PAGE_SIZE_16MB: - num_entries = 16; - pte_addr = hw_mmu_pte_addr_l1(pg_tbl_va, virtual_addr & - MMU_SSECTION_ADDR_MASK); - pte_val = ((physical_addr & MMU_SSECTION_ADDR_MASK) |0x40022); - break; - - case HW_MMU_COARSE_PAGE_SIZE: - pte_addr = hw_mmu_pte_addr_l1(pg_tbl_va, virtual_addr & - MMU_SECTION_ADDR_MASK); - pte_val = (physical_addr & MMU_PAGE_TABLE_MASK) | 1; - break; - - default: - return RET_FAIL; - } - - while (--num_entries >= 0) - ((ULONG*)pte_addr)[num_entries] = pte_val; - - - return status; -} - -hw_status hw_mmu_pte_clear(const UInt32 pg_tbl_va, - UInt32 virtual_addr, - UInt32 pg_size) -{ - hw_status status = RET_OK; - UInt32 pte_addr; - long int num_entries = 1; - - switch (pg_size) { - case HW_PAGE_SIZE_4KB: - pte_addr = hw_mmu_pte_addr_l2(pg_tbl_va, - virtual_addr & MMU_SMALL_PAGE_MASK); - break; - - case HW_PAGE_SIZE_64KB: - num_entries = 16; - pte_addr = hw_mmu_pte_addr_l2(pg_tbl_va, - virtual_addr & MMU_LARGE_PAGE_MASK); - break; - - case HW_PAGE_SIZE_1MB: - case HW_MMU_COARSE_PAGE_SIZE: - pte_addr = hw_mmu_pte_addr_l1(pg_tbl_va, - virtual_addr & MMU_SECTION_ADDR_MASK); - break; - - case HW_PAGE_SIZE_16MB: - num_entries = 16; - pte_addr = hw_mmu_pte_addr_l1(pg_tbl_va, - virtual_addr & MMU_SSECTION_ADDR_MASK); - break; - - default: - return RET_FAIL; - } - - while (--num_entries >= 0) - ((UInt32 *)pte_addr)[num_entries] = 0; - - return status; -} - -/* -* function: mmu_flsh_entry -*/ -static hw_status mmu_flsh_entry(const UInt32 base_address) -{ - hw_status status = RET_OK; - UInt32 flushEntryData = 0x1; - - /*Check the input Parameters*/ - CHECK_INPUT_PARAM(base_address, 0, RET_BAD_NULL_PARAM, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - - /* write values to register */ - MMUMMU_FLUSH_ENTRYWriteRegister32(base_address, flushEntryData); - - return status; -} -/* -* function : mme_set_cam_entry -*/ -static hw_status mme_set_cam_entry(const UInt32 base_address, - const UInt32 page_size, - const UInt32 preserve_bit, - const UInt32 valid_bit, - const UInt32 virt_addr_tag) -{ - hw_status status = RET_OK; - UInt32 mmuCamReg; - - /*Check the input Parameters*/ - CHECK_INPUT_PARAM(base_address, 0, RET_BAD_NULL_PARAM, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - - mmuCamReg = (virt_addr_tag << 12); - mmuCamReg = (mmuCamReg) | (page_size) | (valid_bit << 2) - | (preserve_bit << 3); - - /* write values to register */ - MMUMMU_CAMWriteRegister32(base_address, mmuCamReg); - - return status; -} -/* -* function: mmu_set_ram_entry -*/ -static hw_status mmu_set_ram_entry(const UInt32 base_address, - const UInt32 physical_addr, - enum hw_endianism_t endianism, - enum hw_elemnt_siz_t element_size, - enum hw_mmu_mixed_size_t mixedSize) -{ - hw_status status = RET_OK; - UInt32 mmuRamReg; - - /*Check the input Parameters*/ - CHECK_INPUT_PARAM(base_address, 0, RET_BAD_NULL_PARAM, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - CHECK_INPUT_RANGE_MIN0(element_size, MMU_ELEMENTSIZE_MAX, - RET_PARAM_OUT_OF_RANGE, - RES_MMU_BASE + RES_INVALID_INPUT_PARAM); - - - mmuRamReg = (physical_addr & MMU_ADDR_MASK); - mmuRamReg = (mmuRamReg) | ((endianism << 9) | (element_size << 7) - | (mixedSize << 6)); - - /* write values to register */ - MMUMMU_RAMWriteRegister32(base_address, mmuRamReg); - - return status; - -} - -UInt32 hw_mmu_pte_phyaddr(UInt32 pte_val, UInt32 pte_size) -{ - UInt32 ret_val = 0; - - switch (pte_size) { - - case HW_PAGE_SIZE_4KB: - ret_val = pte_val & MMU_SMALL_PAGE_MASK; - break; - case HW_PAGE_SIZE_64KB: - ret_val = pte_val & MMU_LARGE_PAGE_MASK; - break; - - case HW_PAGE_SIZE_1MB: - ret_val = pte_val & MMU_SECTION_ADDR_MASK; - break; - case HW_PAGE_SIZE_16MB: - ret_val = pte_val & MMU_SSECTION_ADDR_MASK; - break; - default: - /* Invalid */ - break; - - } - - return ret_val; -} diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.h b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.h deleted file mode 100644 index 7977b31..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/hw_mmu.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * @file hw_mbox.h - * - * @brief Functions required to program MMU - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef __HW_MMU_H -#define __HW_MMU_H - - -/* Bitmasks for interrupt sources */ -#define HW_MMU_TRANSLATION_FAULT 0x2 -#define HW_MMU_ALL_INTERRUPTS 0x1F - -#define HW_MMU_COARSE_PAGE_SIZE 0x400 - -/* hw_mmu_mixed_size_t: Enumerated Type used to specify whether to follow - CPU/TLB Element size */ -enum hw_mmu_mixed_size_t { - HW_MMU_TLBES, - HW_MMU_CPUES - -} ; - -/* hw_mmu_map_attrs_t: Struct containing MMU mapping attributes */ -struct hw_mmu_map_attrs_t { - enum hw_endianism_t endianism; - enum hw_elemnt_siz_t element_size; - enum hw_mmu_mixed_size_t mixedSize; -} ; - -extern hw_status hw_mmu_enable(const UInt32 base_address); - -extern hw_status hw_mmu_disable(const UInt32 base_address); - -extern hw_status hw_mmu_numlocked_set(const UInt32 base_address, - UInt32 num_lcked_entries); - -extern hw_status hw_mmu_victim_numset(const UInt32 base_address, - UInt32 vctm_entry_num); - -/* For MMU faults */ -extern hw_status hw_mmu_eventack(const UInt32 base_address, - UInt32 irq_mask); - -extern hw_status hw_mmu_event_disable(const UInt32 base_address, - UInt32 irq_mask); - -extern hw_status hw_mmu_event_enable(const UInt32 base_address, - UInt32 irq_mask); - -extern hw_status hw_mmu_event_status(const UInt32 base_address, - UInt32 *irq_mask); - -extern hw_status hw_mmu_flt_adr_rd(const UInt32 base_address, - UInt32 *addr); - -/* Set the TT base address */ -extern hw_status hw_mmu_ttbset(const UInt32 base_address, - UInt32 ttb_phys_addr); - -extern hw_status hw_mmu_twl_enable(const UInt32 base_address); - -extern hw_status hw_mmu_twl_disable(const UInt32 base_address); - -extern hw_status hw_mmu_tlb_flush(const UInt32 base_address, - UInt32 virtual_addr, - UInt32 page_size); - -extern hw_status hw_mmu_tlb_flushAll(const UInt32 base_address); - -extern hw_status hw_mmu_tlb_add(const UInt32 base_address, - UInt32 physical_addr, - UInt32 virtual_addr, - UInt32 page_size, - UInt32 entryNum, - struct hw_mmu_map_attrs_t *map_attrs, - enum hw_set_clear_t preserve_bit, - enum hw_set_clear_t valid_bit); - - -/* For PTEs */ -extern hw_status hw_mmu_pte_set(const UInt32 pg_tbl_va, - UInt32 physical_addr, - UInt32 virtual_addr, - UInt32 page_size, - struct hw_mmu_map_attrs_t *map_attrs); - -extern hw_status hw_mmu_pte_clear(const UInt32 pg_tbl_va, - UInt32 pg_size, - UInt32 virtual_addr); - -static inline UInt32 hw_mmu_pte_addr_l1(UInt32 l1_base, UInt32 va) -{ - UInt32 pte_addr; - UInt32 VA_31_to_20; - - VA_31_to_20 = va >> (20 - 2); /* Left-shift by 2 here itself */ - VA_31_to_20 &= 0xFFFFFFFCUL; - pte_addr = l1_base + VA_31_to_20; - - return pte_addr; -} - -static inline UInt32 hw_mmu_pte_addr_l2(UInt32 l2_base, UInt32 va) -{ - UInt32 pte_addr; - - pte_addr = (l2_base & 0xFFFFFC00) | ((va >> 10) & 0x3FC); - - return pte_addr; -} - -static inline UInt32 hw_mmu_pte_coarsel1(UInt32 pte_val) -{ - UInt32 pteCoarse; - - pteCoarse = pte_val & 0xFFFFFC00; - - return pteCoarse; -} - -static inline UInt32 hw_mmu_pte_sizel1(UInt32 pte_val) -{ - UInt32 pte_size = 0; - - if ((pte_val & 0x3) == 0x1) { - /* Points to L2 PT */ - pte_size = HW_MMU_COARSE_PAGE_SIZE; - } - - if ((pte_val & 0x3) == 0x2) { - if (pte_val & (1 << 18)) - pte_size = HW_PAGE_SIZE_16MB; - else - pte_size = HW_PAGE_SIZE_1MB; - } - - return pte_size; -} - -static inline UInt32 hw_mmu_pte_sizel2(UInt32 pte_val) -{ - UInt32 pte_size = 0; - - if (pte_val & 0x2) - pte_size = HW_PAGE_SIZE_4KB; - else if (pte_val & 0x1) - pte_size = HW_PAGE_SIZE_64KB; - - return pte_size; -} -extern hw_status hw_mmu_tlb_dump(UInt32 base_address, BOOL shw_inv_entries); - -extern UInt32 hw_mmu_pte_phyaddr(UInt32 pte_val, UInt32 pte_size); - -#endif /* __HW_MMU_H */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430Dmm.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430Dmm.c deleted file mode 100644 index 1902b32..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430Dmm.c +++ /dev/null @@ -1,393 +0,0 @@ -/* - * @file omap4430Dmm.c - * - * @brief MMU programming module - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -/* - * ======== dmm.c ======== - * Purpose: - *The Dynamic Memory Manager (DMM) module manages the DSP Virtual address - *space that can be directly mapped to any MPU buffer or memory region - * - * Public Functions: - * ---------------------- - * dmm_create_tables -- Done - * dmm_create -- Done - * dmm_destroy -- Done - * dmm_exit - * dmm_init -- Done - * dmm_map_memory -- Done - * DMM_Reset - * dmm_reserve_memory -- Done - * dmm_unmap_memory - * dmm_unreserve_memory -- Done - * - * Private Functions: - * ------------------- - * add_region - * create_region - * get_region - * get_free_region -- Done - * get_mapped_region -- Done - * - * Notes: - *Region: Generic memory entity having a start address and a size - *Chunk: Reserved region - * - *! - */ - -#include -#include -#include "OMAP4430Dmm.h" -#include - -#define DMM_ADDR_VIRTUAL(x, a) \ - do { \ - x = (((struct map_page *)(a) - p_virt_mapping_tbl) * PAGE_SIZE \ - + dyn_mem_map_begin);\ - } while (0) - -#define DMM_ADDR_TO_INDEX(i, a) \ - do { \ - i = (((a) - dyn_mem_map_begin) / PAGE_SIZE); \ - } while (0) - -struct map_page { - u32 region_size:31; - u32 b_reserved:1; -}; - -/* Create the free list */ -static struct map_page *p_virt_mapping_tbl; -static u32 i_freeregion; /* The index of free region */ -static u32 i_freesize; -static u32 table_size;/* The size of virtual and physical pages tables */ -static u32 dyn_mem_map_begin; -OsalMutex_Handle dmm_lock; - -/* - * ======== get_mapped_region ======== - * Purpose: - * Returns the requestedmapped region - */ -struct map_page *get_mapped_region(u32 addr) -{ - u32 i = 0; - struct map_page *curr_region = NULL; - - if (p_virt_mapping_tbl == NULL) - return curr_region; - - DMM_ADDR_TO_INDEX(i, addr); - if (i < table_size && (p_virt_mapping_tbl[i].b_reserved)) - curr_region = p_virt_mapping_tbl + i; - return curr_region; -} - - - -/* - * ======== get_free_region ======== - * Purpose: - * Returns the requested free region - */ -struct map_page *get_free_region(u32 size) -{ - struct map_page *curr_region = NULL; - u32 i = 0; - u32 region_size = 0; - u32 next_i = 0; - - if (p_virt_mapping_tbl == NULL) - return curr_region; - if (size > i_freesize) { - /* Find the largest free region - * (coalesce during the traversal) */ - while (i < table_size) { - region_size = p_virt_mapping_tbl[i].region_size; - next_i = i+region_size; - if (p_virt_mapping_tbl[i].b_reserved == false) { - /* Coalesce, if possible */ - if (next_i < table_size && - p_virt_mapping_tbl[next_i].b_reserved - == false) { - p_virt_mapping_tbl[i].region_size += - p_virt_mapping_tbl[next_i].region_size; - continue; - } - region_size *= PAGE_SIZE; - if (region_size > i_freesize) { - i_freeregion = i; - i_freesize = region_size; - } - } - i = next_i; - } - } - if (size <= i_freesize) { - curr_region = p_virt_mapping_tbl + i_freeregion; - i_freeregion += (size / PAGE_SIZE); - i_freesize -= size; - } - return curr_region; -} - - - - -/* - * ======== dmm_delete_tables ======== - * Purpose: - *Delete DMM Tables. - */ -void dmm_delete_tables(void) -{ - /* Delete all DMM tables */ - IArg key = 0; - OsalMutex_enter(dmm_lock); - if (p_virt_mapping_tbl != NULL) { - free(p_virt_mapping_tbl); - p_virt_mapping_tbl = NULL; - } - OsalMutex_leave(dmm_lock, key); -} - - - - -/* ======== dmm_create_tables ======== - * Purpose: - *Create table to hold information of the virtual memory that is reserved - *for DSP. - */ -int dmm_create_tables(u32 addr, u32 size) -{ - int status = 0; - - IArg key = 0; - - dmm_delete_tables(); - OsalMutex_enter(dmm_lock); - - dyn_mem_map_begin = addr; - table_size = (size/PAGE_SIZE) + 1; - /* Create the free list */ - p_virt_mapping_tbl = (struct map_page *)malloc( - table_size*sizeof(struct map_page)); - if (p_virt_mapping_tbl == NULL) - status = -ENOMEM; - /* On successful allocation, - * all entries are zero ('free') */ - i_freeregion = 0; - i_freesize = table_size*PAGE_SIZE; - p_virt_mapping_tbl[0].region_size = table_size; - OsalMutex_leave(dmm_lock, key); - - return status; -} - -/* - * ======== dmm_create ======== - * Purpose: - *Create a dynamic memory manager object. - */ -int dmm_create(void) -{ - int status = 0; - dmm_lock = OsalMutex_create (OsalMutex_Type_Interruptible); - - return status; -} - - - -/* - * ======== dmm_destroy ======== - * Purpose: - *Release the communication memory manager resources. - */ -void dmm_destroy(void) -{ - dmm_delete_tables(); - OsalMutex_delete(&dmm_lock); -} - - - - -/* - * ======== dmm_init ======== - * Purpose: - *Initializes private state of DMM module. - */ -void dmm_init(void) -{ - p_virt_mapping_tbl = NULL ; - table_size = 0; -} - -/* - * ======== dmm_reserve_memory ======== - * Purpose: - *Reserve a chunk of virtually contiguous DSP/IVA address space. - */ -int dmm_reserve_memory(u32 size, u32 *p_rsv_addr) -{ - - int status = 0; - - struct map_page *node; - u32 rsv_addr = 0; - u32 rsv_size = 0; - IArg key = 0; - - - OsalMutex_enter(dmm_lock); - - /* Try to get a DSP chunk from the free list */ - node = get_free_region(size); - if (node != NULL) { - /* DSP chunk of given size is available. */ - DMM_ADDR_VIRTUAL(rsv_addr, node); - /* Calculate the number entries to use */ - rsv_size = size/PAGE_SIZE; - if (rsv_size < node->region_size) { - /* Mark remainder of free region */ - node[rsv_size].b_reserved = false; - node[rsv_size].region_size = - node->region_size - rsv_size; - } - /* get_region will return first fit chunk. But we only use what - is requested. */ - node->b_reserved = true; - node->region_size = rsv_size; - /* Return the chunk's starting address */ - *p_rsv_addr = rsv_addr; - } else - /*dSP chunk of given size is not available */ - status = -ENOMEM; - OsalMutex_leave(dmm_lock, key); - - return status; -} - - -/* - * ======== dmm_unreserve_memory ======== - * Purpose: - *Free a chunk of reserved DSP/IVA address space. - */ - -int dmm_unreserve_memory(u32 rsv_addr, u32 *psize) -{ - int status = 0; - - struct map_page *chunk; - IArg key = 0; - - OsalMutex_enter(dmm_lock); - /* Find the chunk containing the reserved address */ - chunk = get_mapped_region(rsv_addr); - if (chunk == NULL) - status = -ENXIO; - if(status < 0); // why is this required -- Vikas KM - if (status == 0) { - chunk->b_reserved = false; - *psize = chunk->region_size * PAGE_SIZE; - /* NOTE: We do NOT coalesce free regions here. - * Free regions are coalesced in get_region(), as it traverses - *the whole mapping table - */ - } - OsalMutex_leave(dmm_lock, key); - - return status; -} - -#ifdef DSP_DMM_DEBUG -int dmm_mem_map_dump(void) -{ - - struct map_page *curNode = NULL; - u32 i; - u32 freemem = 0; - u32 bigsize = 0; - - IArg key = 0; - OsalMutex_enter(dmm_lock); - - if (p_virt_mapping_tbl != NULL) { - for (i = 0; i < table_size; i += - p_virt_mapping_tbl[i].region_size) { - curNode = p_virt_mapping_tbl + i; - if (curNode->b_reserved == true) { - printf("RESERVED size = 0x%x, " - "Map size = 0x%x\n", - (curNode->region_size * PAGE_SIZE), - (curNode->b_mapped == false) ? 0 : - (curNode->mapped_size * PAGE_SIZE)); - } else { - printf("UNRESERVED size = 0x%x\n", - (curNode->region_size * PAGE_SIZE)); - - freemem += (curNode->region_size * PAGE_SIZE); - if (curNode->region_size > bigsize) - bigsize = curNode->region_size; - } - } - } - printf("Total DSP VA FREE memory = %d Mbytes\n", - freemem/(1024*1024)); - printf("Total DSP VA USED memory= %d Mbytes \n", - (((table_size * PAGE_SIZE)-freemem))/(1024*1024)); - printf("DSP VA - Biggest FREE block = %d Mbytes \n\n", - (bigsize*PAGE_SIZE/(1024*1024))); - OsalMutex_leave(dmm_lock, key); - - return 0; -} -#endif - diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiEnabler.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiEnabler.c deleted file mode 100644 index 5d487fe..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiEnabler.c +++ /dev/null @@ -1,1839 +0,0 @@ -/* - * @file Omap4430DucatiEnabler.c - * - * @brief MMU programming module - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#include -#include -#include - -/* OSAL and utils headers */ -#include -#include -#include - -/* Module level headers */ -#include -#include <_ProcDefs.h> -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#define MMU_REGS_SIZE (sizeof(OMAP4430Ducati_MMURegs) / sizeof (UInt32)) -static UInt32 mmu_regs[MMU_REGS_SIZE]; - - -#define PAGE_SIZE 0x1000 -static UInt32 nr_tlbs = 0; -#define NR_TLBS_MAX 32 -struct iotlb_entry ducati_tlbs[NR_TLBS_MAX]; -//struct iotlb_entry tesla_tlbs[NR_TLBS_MAX]; - -/* Attributes of L2 page tables for DSP MMU.*/ -struct page_info { - /* Number of valid PTEs in the L2 PT*/ - UInt32 num_entries; -}; - - -/* Attributes used to manage the DSP MMU page tables */ -struct pg_table_attrs { - struct sync_cs_object *hcs_object;/* Critical section object handle */ - UInt32 l1_base_pa; /* Physical address of the L1 PT */ - UInt32 l1_base_va; /* Virtual address of the L1 PT */ - UInt32 l1_size; /* Size of the L1 PT */ - UInt32 l1_tbl_alloc_pa; - /* Physical address of Allocated mem for L1 table. May not be aligned */ - UInt32 l1_tbl_alloc_va; - /* Virtual address of Allocated mem for L1 table. May not be aligned */ - UInt32 l1_tbl_alloc_sz; - /* Size of consistent memory allocated for L1 table. - * May not be aligned */ - UInt32 l2_base_pa; /* Physical address of the L2 PT */ - UInt32 l2_base_va; /* Virtual address of the L2 PT */ - UInt32 l2_size; /* Size of the L2 PT */ - UInt32 l2_tbl_alloc_pa; - /* Physical address of Allocated mem for L2 table. May not be aligned */ - UInt32 l2_tbl_alloc_va; - /* Virtual address of Allocated mem for L2 table. May not be aligned */ - UInt32 ls_tbl_alloc_sz; - /* Size of consistent memory allocated for L2 table. - * May not be aligned */ - UInt32 l2_num_pages; /* Number of allocated L2 PT */ - struct page_info *pg_info; -}; - - -static struct pg_table_attrs *p_pt_attrs = NULL; - -enum pagetype { - SECTION = 0, - LARGE_PAGE = 1, - SMALL_PAGE = 2, - SUPER_SECTION = 3 -}; - -static UInt32 shm_phys_addr; -#define INREG32(x) in32((uintptr_t)x) -#define OUTREG32(x, y) out32((uintptr_t)x, y) -#define SIZE 0x4 - -static UInt32 iotlb_dump_cr (struct cr_regs *cr, char *buf); -static Int load_iotlb_entry (OMAP4430DUCATI_HalObject * halObject, - struct iotlb_entry *e); -static Int iotlb_cr_valid (struct cr_regs *cr); - -static Int ducati_mem_map (OMAP4430DUCATI_HalObject * halObject, - UInt32 mpu_addr, UInt32 ul_virt_addr, - UInt32 num_bytes, UInt32 map_attr); -static Int ducati_mem_unmap (OMAP4430DUCATI_HalObject * halObject, UInt32 da, - UInt32 num_bytes); - - -static Void iotlb_cr_to_e (struct cr_regs *cr, struct iotlb_entry *e) -{ - e->da = cr->cam & MMU_CAM_VATAG_MASK; - e->pa = cr->ram & MMU_RAM_PADDR_MASK; - e->valid = cr->cam & MMU_CAM_V; - e->prsvd = cr->cam & MMU_CAM_P; - e->pgsz = cr->cam & MMU_CAM_PGSZ_MASK; - e->endian = cr->ram & MMU_RAM_ENDIAN_MASK; - e->elsz = cr->ram & MMU_RAM_ELSZ_MASK; - e->mixed = cr->ram & MMU_RAM_MIXED; -} - -static Void iotlb_getLock (OMAP4430DUCATI_HalObject * halObject, - struct iotlb_lock *l) -{ - ULONG reg; - OMAP4430Ducati_MMURegs * mmuRegs = - (OMAP4430Ducati_MMURegs *)halObject->mmuBase; - - reg = INREG32(&mmuRegs->LOCK); - l->base = MMU_LOCK_BASE(reg); - l->vict = MMU_LOCK_VICT(reg); -} - -static Void iotlb_setLock (OMAP4430DUCATI_HalObject * halObject, - struct iotlb_lock *l) -{ - ULONG reg; - OMAP4430Ducati_MMURegs * mmuRegs = - (OMAP4430Ducati_MMURegs *)halObject->mmuBase; - - reg = (l->base << MMU_LOCK_BASE_SHIFT); - reg |= (l->vict << MMU_LOCK_VICT_SHIFT); - OUTREG32(&mmuRegs->LOCK, reg); -} - -static void omap4_tlb_read_cr (OMAP4430DUCATI_HalObject * halObject, - struct cr_regs *cr) -{ - OMAP4430Ducati_MMURegs * mmuRegs = - (OMAP4430Ducati_MMURegs *)halObject->mmuBase; - - cr->cam = INREG32(&mmuRegs->READ_CAM); - cr->ram = INREG32(&mmuRegs->READ_RAM); -} - -/* only used for iotlb iteration in for-loop */ -static struct cr_regs __iotlb_read_cr (OMAP4430DUCATI_HalObject * halObject, - int n) -{ - struct cr_regs cr; - struct iotlb_lock l; - iotlb_getLock(halObject, &l); - l.vict = n; - iotlb_setLock(halObject, &l); - omap4_tlb_read_cr(halObject, &cr); - return cr; -} - -#define for_each_iotlb_cr(n, __i, cr) \ - for (__i = 0; \ - (__i < (n)) && (cr = __iotlb_read_cr(halObject, __i), TRUE); \ - __i++) - -static Int save_tlbs (OMAP4430DUCATI_HalObject * halObject, UINT32 procId) -{ - Int i =0; - struct cr_regs cr_tmp; - struct iotlb_lock l; - - iotlb_getLock(halObject, &l); - - nr_tlbs = l.base; - if (procId == PROCTYPE_SYSM3 || procId == PROCTYPE_APPM3) { - for_each_iotlb_cr(nr_tlbs, i, cr_tmp) { - iotlb_cr_to_e(&cr_tmp, &ducati_tlbs[i]); - } - } - //else if (procId == PROCTYPE_TESLA) { - //TODO: Add along with the Tesla support. - //} - else { - GT_setFailureReason(curTrace,GT_2CLASS,"save_tlbs", - EINVAL, "Invalid Processor Id"); - return -EINVAL; - } - - return 0; - -} - -static Int restore_tlbs (OMAP4430DUCATI_HalObject * halObject, UInt32 procId) -{ - Int i = 0; - Int status = -1; - struct iotlb_lock save; - - /* Reset the base and victim values */ - save.base = 0; - save.vict = 0; - iotlb_setLock(halObject, &save); - - if (procId == PROCTYPE_SYSM3 || procId == PROCTYPE_APPM3) { - for (i = 0; i < nr_tlbs; i++) { - status = load_iotlb_entry(halObject, &ducati_tlbs[i]); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "restore_tlbs", - status, - "Error restoring the tlbs"); - goto err; - } - } - } - //else if (procId == PROCTYPE_TESLA) { - //TODO: Add along with the Tesla support. - //} - else { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "restore_tlbs", - status, - "Invalid ProcId"); - goto err; - } - - return 0; - -err: - return status; -} - -static Int save_mmu_regs (OMAP4430DUCATI_HalObject * halObject, UInt32 procId) -{ - UInt32 i = 0; - - if (halObject == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "save_mmu_regs", - -ENOMEM, - "halObject is NULL"); - return -ENOMEM; - } - - if (halObject->mmuBase == 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "save_mmu_regs", - -ENOMEM, - "halObject->mmuBase is 0"); - return -ENOMEM; - } - - for (i = 0; i < MMU_REGS_SIZE; i++) { - mmu_regs[i] = INREG32(halObject->mmuBase + (i * 4)); - } - - return 0; -} - -static Int restore_mmu_regs (OMAP4430DUCATI_HalObject * halObject, - UInt32 procId) -{ - UInt32 i = 0; - - if (halObject == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "restore_mmu_regs", - -ENOMEM, - "halObject is NULL"); - return -ENOMEM; - } - - if (halObject->mmuBase == 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "restore_mmu_regs", - -ENOMEM, - "halObject->mmuBase is 0"); - return -ENOMEM; - } - - for (i = 0; i < MMU_REGS_SIZE; i++) { - OUTREG32(halObject->mmuBase + (i * 4), mmu_regs[i]); - } - - return 0; -} - -Int save_mmu_ctxt (OMAP4430DUCATI_HalObject * halObject, UInt32 procId) -{ - Int status = -1; - - status = save_mmu_regs(halObject, procId); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "save_mmu_ctxt", - status, - "Unable to save MMU Regs"); - return status; - } - - status = save_tlbs(halObject, procId); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "save_mmu_ctxt", - status, - "Unable to save TLBs"); - return status; - } - return status; - -} - -Int restore_mmu_ctxt (OMAP4430DUCATI_HalObject * halObject, UInt32 procId) -{ - Int status = -1; - - status = restore_mmu_regs(halObject, procId); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "restore_mmu_ctxt", - status, - "Unable to restore MMU Regs"); - return status; - } - - status = restore_tlbs(halObject, procId); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "restore_mmu_ctxt", - status, - "Unable to restore TLBS"); - return status; - } - - return status; -} - - - /*========================================= - * Decides a TLB entry size - * - */ -static Int get_mmu_entry_size (UInt32 pa, UInt32 size, enum pagetype *size_tlb, - UInt32 *entry_size) -{ - Int status = 0; - Bool page_align_4kb = false; - Bool page_align_64kb = false; - Bool page_align_1mb = false; - Bool page_align_16mb = false; - UInt32 phys_addr = pa; - - - /* First check the page alignment*/ - if ((phys_addr % PAGE_SIZE_4KB) == 0) - page_align_4kb = true; - if ((phys_addr % PAGE_SIZE_64KB) == 0) - page_align_64kb = true; - if ((phys_addr % PAGE_SIZE_1MB) == 0) - page_align_1mb = true; - if ((phys_addr % PAGE_SIZE_16MB) == 0) - page_align_16mb = true; - - if ((!page_align_64kb) && (!page_align_1mb) && (!page_align_4kb)) { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "get_mmu_entry_size", - status, - "phys_addr is not properly aligned"); - goto error_exit; - } - - /* Now decide the entry size */ - if (size >= PAGE_SIZE_16MB) { - if (page_align_16mb) { - *size_tlb = SUPER_SECTION; - *entry_size = PAGE_SIZE_16MB; - } else if (page_align_1mb) { - *size_tlb = SECTION; - *entry_size = PAGE_SIZE_1MB; - } else if (page_align_64kb) { - *size_tlb = LARGE_PAGE; - *entry_size = PAGE_SIZE_64KB; - } else if (page_align_4kb) { - *size_tlb = SMALL_PAGE; - *entry_size = PAGE_SIZE_4KB; - } else { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "get_mmu_entry_size", - status, - "size and alignment are invalid"); - goto error_exit; - } - } else if (size >= PAGE_SIZE_1MB && size < PAGE_SIZE_16MB) { - if (page_align_1mb) { - *size_tlb = SECTION; - *entry_size = PAGE_SIZE_1MB; - } else if (page_align_64kb) { - *size_tlb = LARGE_PAGE; - *entry_size = PAGE_SIZE_64KB; - } else if (page_align_4kb) { - *size_tlb = SMALL_PAGE; - *entry_size = PAGE_SIZE_4KB; - } else { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "get_mmu_entry_size", - status, - "size and alignment are invalid"); - goto error_exit; - } - } else if (size > PAGE_SIZE_4KB && size < PAGE_SIZE_1MB) { - if (page_align_64kb) { - *size_tlb = LARGE_PAGE; - *entry_size = PAGE_SIZE_64KB; - } else if (page_align_4kb) { - *size_tlb = SMALL_PAGE; - *entry_size = PAGE_SIZE_4KB; - } else { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "get_mmu_entry_size", - status, - "size and alignment are invalid"); - goto error_exit; - } - } else if (size == PAGE_SIZE_4KB) { - if (page_align_4kb) { - *size_tlb = SMALL_PAGE; - *entry_size = PAGE_SIZE_4KB; - } else { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "get_mmu_entry_size", - status, - "size and alignment are invalid"); - goto error_exit; - } - } else { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "get_mmu_entry_size", - status, - "size is invalid"); - goto error_exit; - } - return 0; - -error_exit: - return status; -} - - -/*========================================= - * Add DSP MMU entries corresponding to given MPU-Physical address - * and DSP-virtual address - */ -static Int add_dsp_mmu_entry (OMAP4430DUCATI_HalObject * halObject, - UInt32 *phys_addr, UInt32 *dsp_addr, UInt32 size) -{ - UInt32 mapped_size = 0; - enum pagetype size_tlb = SECTION; - UInt32 entry_size = 0; - int status = 0; - struct iotlb_entry tlb_entry; - int retval = 0; - - while ((mapped_size < size) && (status == 0)) { - status = get_mmu_entry_size(*phys_addr, (size - mapped_size), - &size_tlb, &entry_size); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "add_dsp_mmu_entry", - status, - "get_mmu_entry_size failed"); - goto error_exit; - } - - if (size_tlb == SUPER_SECTION) - tlb_entry.pgsz = MMU_CAM_PGSZ_16M; - - else if (size_tlb == SECTION) - tlb_entry.pgsz = MMU_CAM_PGSZ_1M; - - else if (size_tlb == LARGE_PAGE) - tlb_entry.pgsz = MMU_CAM_PGSZ_64K; - - else if (size_tlb == SMALL_PAGE) - tlb_entry.pgsz = MMU_CAM_PGSZ_4K; - - tlb_entry.elsz = MMU_RAM_ELSZ_16; - tlb_entry.endian = MMU_RAM_ENDIAN_LITTLE; - tlb_entry.mixed = MMU_RAM_MIXED; - tlb_entry.prsvd = MMU_CAM_P; - tlb_entry.valid = MMU_CAM_V; - - tlb_entry.da = *dsp_addr; - tlb_entry.pa = *phys_addr; - retval = load_iotlb_entry(halObject, &tlb_entry); - if (retval < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "add_dsp_mmu_entry", - retval, - "load_iotlb_entry failed"); - goto error_exit; - } - mapped_size += entry_size; - *phys_addr += entry_size; - *dsp_addr += entry_size; - } - - return 0; - -error_exit: - printf("pte set failure retval = 0x%x, status = 0x%x \n", - retval, status); - - return retval; -} - - -static Int add_entry_ext (OMAP4430DUCATI_HalObject * halObject, - UInt32 *phys_addr, UInt32 *dsp_addr, UInt32 size) -{ - UInt32 mapped_size = 0; - enum pagetype size_tlb = SECTION; - UInt32 entry_size = 0; - Int status = 0; - UInt32 page_size = HW_PAGE_SIZE_1MB; - UInt32 flags = 0; - - flags = (DSP_MAPELEMSIZE32 | DSP_MAPLITTLEENDIAN | - DSP_MAPPHYSICALADDR); - while ((mapped_size < size) && (status == 0)) { - - /* get_mmu_entry_size fills the size_tlb and entry_size - based on alignment and size of memory to map - to DSP - size */ - status = get_mmu_entry_size (*phys_addr, - (size - mapped_size), - &size_tlb, - &entry_size); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "add_entry_ext", - status, - "get_mmu_entry_size failed"); - break; - } - else { - if (size_tlb == SUPER_SECTION) - page_size = HW_PAGE_SIZE_16MB; - else if (size_tlb == SECTION) - page_size = HW_PAGE_SIZE_1MB; - else if (size_tlb == LARGE_PAGE) - page_size = HW_PAGE_SIZE_64KB; - else if (size_tlb == SMALL_PAGE) - page_size = HW_PAGE_SIZE_4KB; - - if (status == 0) { - status = ducati_mem_map (halObject, - *phys_addr, - *dsp_addr, - page_size, - flags); - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "add_entry_ext", - status, - "ducati_mem_map failed"); - break; - } - mapped_size += entry_size; - *phys_addr += entry_size; - *dsp_addr += entry_size; - } - } - } - return status; -} - -static Int __dump_tlb_entries (OMAP4430DUCATI_HalObject * halObject, - struct cr_regs *crs, int num) -{ - int i; - struct iotlb_lock saved; - struct cr_regs tmp; - struct cr_regs *p = crs; - - iotlb_getLock(halObject, &saved); - for_each_iotlb_cr(num, i, tmp) { - if (!iotlb_cr_valid(&tmp)) - continue; - *p++ = tmp; - } - iotlb_setLock(halObject, &saved); - return p - crs; -} - -UInt32 get_DucatiVirtAdd(OMAP4430DUCATI_HalObject * halObject, UInt32 physAdd) -{ - int i, num; - struct cr_regs *cr; - struct cr_regs *p = NULL; - //DWORD dwPhys; - UInt32 lRetVal = 0; - num = 32; - if(shm_phys_addr == 0) - return 0; - cr = mmap(NULL, - sizeof(struct cr_regs) * num, - PROT_NOCACHE | PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PHYS | MAP_PRIVATE, - NOFD, - 0); - if (cr == MAP_FAILED) - { - return NULL; - } - - memset(cr, 0, sizeof(struct cr_regs) * num); - - num = __dump_tlb_entries(halObject, cr, num); - for (i = 0; i < num; i++) - { - p = cr + i; - if(physAdd >= (p->ram & 0xFFFFF000) && physAdd < ((p + 1)->ram & 0xFFFFF000)) - { - lRetVal = ((p->cam & 0xFFFFF000) + (physAdd - (p->ram & 0xFFFFF000))); - } - } - munmap(cr, sizeof(struct cr_regs) * num); - - return lRetVal; -} - - -/** - * dump_tlb_entries - dump cr arrays to given buffer - * @obj: target iommu - * @buf: output buffer - **/ -static UInt32 dump_tlb_entries (OMAP4430DUCATI_HalObject * halObject, - char *buf, UInt32 bytes) -{ - Int i, num; - struct cr_regs *cr; - Char *p = buf; - - num = bytes / sizeof(*cr); - num = min(32, num); - cr = mmap(NULL, - sizeof(struct cr_regs) * num, - PROT_NOCACHE | PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PHYS | MAP_PRIVATE, - NOFD, - 0); - if (!cr) - { - return NULL; - - } - memset(cr, 0, sizeof(struct cr_regs) * num); - - num = __dump_tlb_entries(halObject, cr, num); - for (i = 0; i < num; i++) - p += iotlb_dump_cr(cr + i, p); - munmap(cr, sizeof(struct cr_regs) * num); - return p - buf; -} - - -static Void ducati_tlb_dump (OMAP4430DUCATI_HalObject * halObject) -{ - Char *p; - - p = mmap(NULL, - 1000, - PROT_NOCACHE | PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PHYS | MAP_PRIVATE, - NOFD, - 0); - if (MAP_FAILED != p) - { - dump_tlb_entries(halObject, p, 1000); - munmap(p, 1000); - } - - return; -} - - -/*================================ - * Initialize the Ducati MMU. - *===============================*/ - -static Int ducati_mmu_init(OMAP4430DUCATI_HalObject * halObject) -{ - Int ret_val = 0; - UInt32 phys_addr = 0; - UInt32 num_l4_entries; - UInt32 i = 0; - UInt32 num_l3_mem_entries = 0; - UInt32 virt_addr = 0; - OMAP4430Ducati_MMURegs * mmuRegs = NULL; - - if (halObject == NULL) { - ret_val = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mmu_init", - ret_val, - "halObject is NULL"); - goto error_exit; - } - - if (halObject->mmuBase == 0) { - ret_val = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mmu_init", - ret_val, - "halObject->mmuBase is 0"); - goto error_exit; - } - mmuRegs = (OMAP4430Ducati_MMURegs *)halObject->mmuBase; - - num_l4_entries = (sizeof(l4_map) / sizeof(struct mmu_entry)); - num_l3_mem_entries = sizeof(l3_memory_regions) / - sizeof(struct memory_entry); - - /* Disable the MMU & TWL */ - hw_mmu_disable(halObject->mmuBase); - hw_mmu_twl_disable(halObject->mmuBase); - - - printf(" Programming Ducati memory regions\n"); - printf("=========================================\n"); - - for (i = 0; i < num_l3_mem_entries; i++) { - ret_val = Processor_translateAddr(halObject->procHandle, &phys_addr, - (unsigned int)l3_memory_regions[i].ul_virt_addr); - if (ret_val < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mmu_init", - ret_val, - "Processor_translateAddr failed"); - goto error_exit; - } - printf( "VA = [0x%x] of size [0x%x] at PA = [0x%x]\n", - (unsigned int)l3_memory_regions[i].ul_virt_addr, - (unsigned int)l3_memory_regions[i].ul_size, - (unsigned int)phys_addr); - - /* OMAP4430 SDC code */ - /* Adjust below logic if using cacheable shared memory */ - if (l3_memory_regions[i].ul_virt_addr == \ - IPU_MEM_IPC_VRING) { - shm_phys_addr = phys_addr; - } - virt_addr = l3_memory_regions[i].ul_virt_addr; - ret_val = add_dsp_mmu_entry(halObject, &phys_addr, &virt_addr, - (l3_memory_regions[i].ul_size)); - if (ret_val < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mmu_init", - ret_val, - "add_dsp_mmu_entry failed"); - goto error_exit; - } - } - - printf( " Programming Ducati L4 peripherals\n"); - printf( "=========================================\n"); - for (i = 0; i < num_l4_entries; i++) { - printf("PA [0x%x] VA [0x%x] size [0x%x]\n", - (unsigned int)l4_map[i].ul_phy_addr, - (unsigned int)l4_map[i].ul_virt_addr, - (unsigned int)l4_map[i].ul_size); - - virt_addr = l4_map[i].ul_virt_addr; - phys_addr = l4_map[i].ul_phy_addr; - if (i == 0||i == 1||i == 2){ - ret_val = add_entry_ext(halObject, &phys_addr, &virt_addr, - (l4_map[i].ul_size)); - } else { - ret_val = add_dsp_mmu_entry(halObject, &phys_addr, &virt_addr, - (l4_map[i].ul_size)); - } - if (ret_val < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mmu_init", - ret_val, - "add_dsp_mmu_entry or add_entry_ext failed"); - goto error_exit; - } - } - - /* Set the TTB to point to the L1 page table's physical address */ - OUTREG32(&mmuRegs->TTB, p_pt_attrs->l1_base_pa); - - /* Enable the TWL */ - hw_mmu_twl_enable(halObject->mmuBase); - - hw_mmu_enable(halObject->mmuBase); - - ducati_tlb_dump(halObject); - return 0; -error_exit: - return ret_val; -} - - -/**************************************************** -* -* Function which sets the TWL of the ducati -* -* -*****************************************************/ - -static Int ducati_set_twl (OMAP4430DUCATI_HalObject * halObject, Bool on) -{ - Int status = 0; - OMAP4430Ducati_MMURegs * mmuRegs = NULL; - ULONG reg; - - if (halObject == NULL) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_set_twl", - status, - "halObject is NULL"); - } - else if (halObject->mmuBase == 0) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_set_twl", - status, - "halObject->mmuBase is NULL"); - } - else { - mmuRegs = (OMAP4430Ducati_MMURegs *)halObject->mmuBase; - - /* Setting MMU to Smart Idle Mode */ - reg = INREG32(&mmuRegs->SYSCONFIG); - reg &= ~MMU_SYS_IDLE_MASK; - reg |= (MMU_SYS_IDLE_SMART | MMU_SYS_AUTOIDLE); - OUTREG32(&mmuRegs->SYSCONFIG, reg); - - /* Enabling MMU */ - reg = INREG32(&mmuRegs->CNTL); - - if (on) - OUTREG32(&mmuRegs->IRQENABLE, MMU_IRQ_TWL_MASK); - else - OUTREG32(&mmuRegs->IRQENABLE, MMU_IRQ_TLB_MISS_MASK); - - reg &= ~MMU_CNTL_MASK; - if (on) - reg |= (MMU_CNTL_MMU_EN | MMU_CNTL_TWL_EN); - else - reg |= (MMU_CNTL_MMU_EN); - - OUTREG32(&mmuRegs->CNTL, reg); - } - - return status; -} - - -/*======================================== - * This sets up the Ducati processor MMU Page tables - * - */ -static Int init_mmu_page_attribs (UInt32 l1_size, - UInt32 l1_allign, - UInt32 ls_num_of_pages) -{ - UInt32 pg_tbl_pa = 0; - off64_t offset = 0; - UInt32 pg_tbl_va = 0; - UInt32 align_size = 0; - UInt32 len = 0; - int status = 0; - - p_pt_attrs = Memory_alloc (NULL, sizeof(struct pg_table_attrs), 0, NULL); - if (p_pt_attrs) - Memory_set (p_pt_attrs, 0, sizeof(struct pg_table_attrs)); - else { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "Memory_alloc failed"); - goto error_exit; - } - - p_pt_attrs->l1_size = l1_size; - align_size = p_pt_attrs->l1_size; - p_pt_attrs->l1_tbl_alloc_sz = 0x100000; - /* Align sizes are expected to be power of 2 */ - /* we like to get aligned on L1 table size */ - pg_tbl_va = (UInt32) mmap64 (NULL, - p_pt_attrs->l1_tbl_alloc_sz, - PROT_NOCACHE | PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PHYS | MAP_PRIVATE, - NOFD, - 0x0); - if (pg_tbl_va == (UInt32)MAP_FAILED) { - pg_tbl_va = 0; - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "mmap64 failed"); - goto error_exit; - } - else { - /* Make sure the memory is contiguous */ - status = mem_offset64 ((void *)pg_tbl_va, NOFD, - p_pt_attrs->l1_tbl_alloc_sz, &offset, &len); - pg_tbl_pa = (UInt32)offset; - if (len != p_pt_attrs->l1_tbl_alloc_sz) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "phys mem is not contiguous"); - } - if (status != 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "mem_offset64 failed"); - goto error_exit; - } - } - /* Check if the PA is aligned for us */ - if ((pg_tbl_pa) & (align_size-1)) { - /* PA not aligned to page table size ,*/ - /* try with more allocation and align */ - munmap((void *)pg_tbl_va, p_pt_attrs->l1_tbl_alloc_sz); - p_pt_attrs->l1_tbl_alloc_sz = p_pt_attrs->l1_tbl_alloc_sz*2; - /* we like to get aligned on L1 table size */ - pg_tbl_va = (UInt32) mmap64 (NULL, - p_pt_attrs->l1_tbl_alloc_sz, - PROT_NOCACHE | PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PHYS | MAP_PRIVATE, - NOFD, - 0); - if (pg_tbl_va == (UInt32)MAP_FAILED) { - pg_tbl_va = 0; - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "mmap64 failed"); - goto error_exit; - } - else { - /* Make sure the memory is contiguous */ - status = mem_offset64 ((void *)pg_tbl_va, NOFD, - p_pt_attrs->l1_tbl_alloc_sz, &offset, &len); - pg_tbl_pa = (UInt32)offset; - if (len != p_pt_attrs->l1_tbl_alloc_sz) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "phys mem is not contiguous"); - } - if (status != 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "mem_offset64 failed"); - goto error_exit; - } - } - /* We should be able to get aligned table now */ - p_pt_attrs->l1_tbl_alloc_pa = pg_tbl_pa; - p_pt_attrs->l1_tbl_alloc_va = pg_tbl_va; - /* Align the PA to the next 'align' boundary */ - p_pt_attrs->l1_base_pa = ((pg_tbl_pa) + (align_size-1)) & - (~(align_size-1)); - p_pt_attrs->l1_base_va = pg_tbl_va + (p_pt_attrs->l1_base_pa - - pg_tbl_pa); - } else { - /* We got aligned PA, cool */ - p_pt_attrs->l1_tbl_alloc_pa = pg_tbl_pa; - p_pt_attrs->l1_tbl_alloc_va = pg_tbl_va; - p_pt_attrs->l1_base_pa = pg_tbl_pa; - p_pt_attrs->l1_base_va = pg_tbl_va; - } - - if (p_pt_attrs->l1_base_va) - memset((UInt8*)p_pt_attrs->l1_base_va, 0x00, p_pt_attrs->l1_size); - p_pt_attrs->l2_num_pages = ls_num_of_pages; - p_pt_attrs->l2_size = HW_MMU_COARSE_PAGE_SIZE * p_pt_attrs->l2_num_pages; - align_size = 4; /* Make it UInt32 aligned */ - /* we like to get aligned on L1 table size */ - pg_tbl_va = p_pt_attrs->l1_base_va + 0x80000; - pg_tbl_pa = p_pt_attrs->l1_base_pa + 0x80000; - p_pt_attrs->l2_tbl_alloc_pa = pg_tbl_pa; - p_pt_attrs->l2_tbl_alloc_va = pg_tbl_va; - p_pt_attrs->ls_tbl_alloc_sz = p_pt_attrs->l2_size; - p_pt_attrs->l2_base_pa = pg_tbl_pa; - p_pt_attrs->l2_base_va = pg_tbl_va; - if (p_pt_attrs->l2_base_va) - memset((UInt8*)p_pt_attrs->l2_base_va, 0x00, p_pt_attrs->l2_size); - - p_pt_attrs->pg_info = Memory_alloc(NULL, sizeof(struct page_info), 0, NULL); - if (p_pt_attrs->pg_info) - Memory_set (p_pt_attrs->pg_info, 0, sizeof(struct page_info)); - else { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "init_mmu_page_attribs", - status, - "Memory_alloc failed"); - goto error_exit; - } - return 0; - -error_exit: - if (p_pt_attrs) { - if (p_pt_attrs->pg_info) - Memory_free (NULL, p_pt_attrs->pg_info, sizeof(struct page_info)); - if (p_pt_attrs->l1_tbl_alloc_va) { - munmap ((void *)p_pt_attrs->l1_tbl_alloc_va, - p_pt_attrs->l1_tbl_alloc_sz); - } - Memory_free (NULL, p_pt_attrs, sizeof(struct pg_table_attrs)); - p_pt_attrs = NULL; - } - - return status; -} - - -/*======================================== - * This destroys the Ducati processor MMU Page tables - * - */ -static Void deinit_mmu_page_attribs (Void) -{ - if (p_pt_attrs) { - if (p_pt_attrs->pg_info) - Memory_free (NULL, p_pt_attrs->pg_info, sizeof(struct page_info)); - if (p_pt_attrs->l1_tbl_alloc_va) { - munmap ((void *)p_pt_attrs->l1_tbl_alloc_va, - p_pt_attrs->l1_tbl_alloc_sz); - } - Memory_free (NULL, p_pt_attrs, sizeof(struct pg_table_attrs)); - p_pt_attrs = NULL; - } -} - - - -/*============================================ - * This function calculates PTE address (MPU virtual) to be updated - * It also manages the L2 page tables - */ -static Int pte_set (UInt32 pa, UInt32 va, UInt32 size, - struct hw_mmu_map_attrs_t *attrs) -{ - UInt32 i; - UInt32 pte_val; - UInt32 pte_addr_l1; - UInt32 pte_size; - UInt32 pg_tbl_va; /* Base address of the PT that will be updated */ - UInt32 l1_base_va; - /* Compiler warns that the next three variables might be used - * uninitialized in this function. Doesn't seem so. Working around, - * anyways. */ - UInt32 l2_base_va = 0; - UInt32 l2_base_pa = 0; - UInt32 l2_page_num = 0; - struct pg_table_attrs *pt = p_pt_attrs; - struct iotlb_entry *mapAttrs; - int status = 0; - OMAP4430DUCATI_HalMmuEntryInfo setPteInfo; - mapAttrs = Memory_alloc(0, sizeof(struct iotlb_entry), 0, NULL); - - l1_base_va = pt->l1_base_va; - pg_tbl_va = l1_base_va; - if ((size == HW_PAGE_SIZE_64KB) || (size == HW_PAGE_SIZE_4KB)) { - /* Find whether the L1 PTE points to a valid L2 PT */ - pte_addr_l1 = hw_mmu_pte_addr_l1(l1_base_va, va); - if (pte_addr_l1 <= (pt->l1_base_va + pt->l1_size)) { - pte_val = *(UInt32 *)pte_addr_l1; - pte_size = hw_mmu_pte_sizel1(pte_val); - } else { - return -EINVAL; - } - /* FIX ME */ - /* TODO: ADD synchronication element*/ - /* sync_enter_cs(pt->hcs_object);*/ - if (pte_size == HW_MMU_COARSE_PAGE_SIZE) { - /* Get the L2 PA from the L1 PTE, and find - * corresponding L2 VA */ - l2_base_pa = hw_mmu_pte_coarsel1(pte_val); - l2_base_va = l2_base_pa - pt->l2_base_pa + - pt->l2_base_va; - l2_page_num = (l2_base_pa - pt->l2_base_pa) / - HW_MMU_COARSE_PAGE_SIZE; - } else if (pte_size == 0) { - /* L1 PTE is invalid. Allocate a L2 PT and - * point the L1 PTE to it */ - /* Find a free L2 PT. */ - for (i = 0; (i < pt->l2_num_pages) && - (pt->pg_info[i].num_entries != 0); i++) - ;; - if (i < pt->l2_num_pages) { - l2_page_num = i; - l2_base_pa = pt->l2_base_pa + (l2_page_num * - HW_MMU_COARSE_PAGE_SIZE); - l2_base_va = pt->l2_base_va + (l2_page_num * - HW_MMU_COARSE_PAGE_SIZE); - /* Endianness attributes are ignored for - * HW_MMU_COARSE_PAGE_SIZE */ - mapAttrs->endian = attrs->endianism; - mapAttrs->mixed = attrs->mixedSize; - mapAttrs->elsz= attrs->element_size; - mapAttrs->da = va; - mapAttrs->pa = pa; - status = hw_mmu_pte_set(pg_tbl_va, pa, va, size, attrs); - } else { - status = -ENOMEM; - } - } else { - /* Found valid L1 PTE of another size. - * Should not overwrite it. */ - status = -EINVAL; - } - if (status == 0) { - pg_tbl_va = l2_base_va; - if (size == HW_PAGE_SIZE_64KB) - pt->pg_info[l2_page_num].num_entries += 16; - else - pt->pg_info[l2_page_num].num_entries++; - } - } - if (status == 0) { - mapAttrs->endian = attrs->endianism; - mapAttrs->mixed = attrs->mixedSize; - mapAttrs->elsz= attrs->element_size; - mapAttrs->da = va; - mapAttrs->pa = pa; - mapAttrs->pgsz = MMU_CAM_PGSZ_16M; - setPteInfo.elementSize = attrs->element_size; - setPteInfo.endianism = attrs->endianism; - setPteInfo.masterPhyAddr = pa; - setPteInfo.mixedSize = attrs->mixedSize; - setPteInfo.size = size; - setPteInfo.slaveVirtAddr = va; - - status = hw_mmu_pte_set(pg_tbl_va, pa, va, size, attrs); - if (status == RET_OK) - status = 0; - } - Memory_free(0, mapAttrs, sizeof(struct iotlb_entry)); - return status; -} - - -/*============================================= - * This function calculates the optimum page-aligned addresses and sizes - * Caller must pass page-aligned values - */ -static Int pte_update (UInt32 pa, UInt32 va, UInt32 size, - struct hw_mmu_map_attrs_t *map_attrs) -{ - UInt32 i; - UInt32 all_bits; - UInt32 pa_curr = pa; - UInt32 va_curr = va; - UInt32 num_bytes = size; - Int status = 0; - UInt32 pg_size[] = {HW_PAGE_SIZE_16MB, HW_PAGE_SIZE_1MB, - HW_PAGE_SIZE_64KB, HW_PAGE_SIZE_4KB}; - while (num_bytes && (status == 0)) { - /* To find the max. page size with which both PA & VA are - * aligned */ - all_bits = pa_curr | va_curr; - for (i = 0; i < 4; i++) { - if ((num_bytes >= pg_size[i]) && ((all_bits & - (pg_size[i] - 1)) == 0)) { - status = pte_set(pa_curr, - va_curr, pg_size[i], map_attrs); - pa_curr += pg_size[i]; - va_curr += pg_size[i]; - num_bytes -= pg_size[i]; - /* Don't try smaller sizes. Hopefully we have - * reached an address aligned to a bigger page - * size */ - break; - } - } - } - return status; -} - - -/*============================================ - * This function maps MPU buffer to the DSP address space. It performs -* linear to physical address translation if required. It translates each -* page since linear addresses can be physically non-contiguous -* All address & size arguments are assumed to be page aligned (in proc.c) - * - */ -static Int ducati_mem_map (OMAP4430DUCATI_HalObject * halObject, - UInt32 mpu_addr, UInt32 ul_virt_addr, - UInt32 num_bytes, UInt32 map_attr) -{ - UInt32 attrs; - Int status = 0; - struct hw_mmu_map_attrs_t hw_attrs; - Int pg_i = 0; - - if (halObject == NULL) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mem_map", - status, - "halObject is NULL"); - } - else if (halObject->mmuBase == 0) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mem_map", - status, - "halObject->mmuBase is 0"); - } - else if (num_bytes == 0) { - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mem_map", - status, - "num_bytes is 0"); - } - else { - if (map_attr != 0) { - attrs = map_attr; - attrs |= DSP_MAPELEMSIZE32; - } else { - /* Assign default attributes */ - attrs = DSP_MAPVIRTUALADDR | DSP_MAPELEMSIZE32; - } - /* Take mapping properties */ - if (attrs & DSP_MAPBIGENDIAN) - hw_attrs.endianism = HW_BIG_ENDIAN; - else - hw_attrs.endianism = HW_LITTLE_ENDIAN; - - hw_attrs.mixedSize = (enum hw_mmu_mixed_size_t) - ((attrs & DSP_MAPMIXEDELEMSIZE) >> 2); - /* Ignore element_size if mixedSize is enabled */ - if (hw_attrs.mixedSize == 0) { - if (attrs & DSP_MAPELEMSIZE8) { - /* Size is 8 bit */ - hw_attrs.element_size = HW_ELEM_SIZE_8BIT; - } else if (attrs & DSP_MAPELEMSIZE16) { - /* Size is 16 bit */ - hw_attrs.element_size = HW_ELEM_SIZE_16BIT; - } else if (attrs & DSP_MAPELEMSIZE32) { - /* Size is 32 bit */ - hw_attrs.element_size = HW_ELEM_SIZE_32BIT; - } else if (attrs & DSP_MAPELEMSIZE64) { - /* Size is 64 bit */ - hw_attrs.element_size = HW_ELEM_SIZE_64BIT; - } else { - /* Mixedsize isn't enabled, so size can't be - * zero here */ - status = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mem_map", - status, - "MMU element size is zero"); - } - } - - if (status >= 0) { - /* - * Do OS-specific user-va to pa translation. - * Combine physically contiguous regions to reduce TLBs. - * Pass the translated pa to PteUpdate. - */ - if ((attrs & DSP_MAPPHYSICALADDR)) { - status = pte_update(mpu_addr, ul_virt_addr, num_bytes, - &hw_attrs); - } - - /* Don't propogate Linux or HW status to upper layers */ - if (status < 0) { - /* - * Roll out the mapped pages incase it failed in middle of - * mapping - */ - if (pg_i) - ducati_mem_unmap(halObject, ul_virt_addr, - (pg_i * PAGE_SIZE)); - } - - /* In any case, flush the TLB - * This is called from here instead from pte_update to avoid - * unnecessary repetition while mapping non-contiguous physical - * regions of a virtual region */ - hw_mmu_tlb_flushAll(halObject->mmuBase); - } - } - return status; -} - - - -/* - * ======== ducati_mem_unmap ======== - * Invalidate the PTEs for the DSP VA block to be unmapped. - * - * PTEs of a mapped memory block are contiguous in any page table - * So, instead of looking up the PTE address for every 4K block, - * we clear consecutive PTEs until we unmap all the bytes - */ -static Int ducati_mem_unmap (OMAP4430DUCATI_HalObject * halObject, - UInt32 da, UInt32 num_bytes) -{ - UInt32 L1_base_va; - UInt32 L2_base_va; - UInt32 L2_base_pa; - UInt32 L2_page_num; - UInt32 pte_val; - UInt32 pte_size; - UInt32 pte_count; - UInt32 pte_addr_l1; - UInt32 pte_addr_l2 = 0; - UInt32 rem_bytes; - UInt32 rem_bytes_l2; - UInt32 vaCurr; - Int status = 0; - UInt32 temp; - UInt32 pAddr; - UInt32 numof4Kpages = 0; - - if (halObject == NULL) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mem_unmap", - status, - "halObject is NULL"); - } - else if (halObject->mmuBase == 0) { - status = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_mem_unmap", - status, - "halObject->mmuBase is 0"); - } - else { - vaCurr = da; - rem_bytes = num_bytes; - rem_bytes_l2 = 0; - L1_base_va = p_pt_attrs->l1_base_va; - pte_addr_l1 = hw_mmu_pte_addr_l1(L1_base_va, vaCurr); - while (rem_bytes) { - UInt32 vaCurrOrig = vaCurr; - /* Find whether the L1 PTE points to a valid L2 PT */ - pte_addr_l1 = hw_mmu_pte_addr_l1(L1_base_va, vaCurr); - pte_val = *(UInt32 *)pte_addr_l1; - pte_size = hw_mmu_pte_sizel1(pte_val); - if (pte_size == HW_MMU_COARSE_PAGE_SIZE) { - /* - * Get the L2 PA from the L1 PTE, and find - * corresponding L2 VA - */ - L2_base_pa = hw_mmu_pte_coarsel1(pte_val); - L2_base_va = L2_base_pa - p_pt_attrs->l2_base_pa - + p_pt_attrs->l2_base_va; - L2_page_num = (L2_base_pa - p_pt_attrs->l2_base_pa) / - HW_MMU_COARSE_PAGE_SIZE; - /* - * Find the L2 PTE address from which we will start - * clearing, the number of PTEs to be cleared on this - * page, and the size of VA space that needs to be - * cleared on this L2 page - */ - pte_addr_l2 = hw_mmu_pte_addr_l2(L2_base_va, vaCurr); - pte_count = pte_addr_l2 & (HW_MMU_COARSE_PAGE_SIZE - 1); - pte_count = (HW_MMU_COARSE_PAGE_SIZE - pte_count) / - sizeof(UInt32); - if (rem_bytes < (pte_count * PAGE_SIZE)) - pte_count = rem_bytes / PAGE_SIZE; - - rem_bytes_l2 = pte_count * PAGE_SIZE; - /* - * Unmap the VA space on this L2 PT. A quicker way - * would be to clear pte_count entries starting from - * pte_addr_l2. However, below code checks that we don't - * clear invalid entries or less than 64KB for a 64KB - * entry. Similar checking is done for L1 PTEs too - * below - */ - while (rem_bytes_l2) { - pte_val = *(UInt32 *)pte_addr_l2; - pte_size = hw_mmu_pte_sizel2(pte_val); - /* vaCurr aligned to pte_size? */ - if ((pte_size != 0) && (rem_bytes_l2 - >= pte_size) && - !(vaCurr & (pte_size - 1))) { - /* Collect Physical addresses from VA */ - pAddr = (pte_val & ~(pte_size - 1)); - if (pte_size == HW_PAGE_SIZE_64KB) - numof4Kpages = 16; - else - numof4Kpages = 1; - temp = 0; - - if (hw_mmu_pte_clear(pte_addr_l2, - vaCurr, pte_size) == RET_OK) { - rem_bytes_l2 -= pte_size; - vaCurr += pte_size; - pte_addr_l2 += (pte_size >> 12) - * sizeof(UInt32); - } else { - status = -EFAULT; - goto EXIT_LOOP; - } - } else - status = -EFAULT; - } - if (rem_bytes_l2 != 0) { - status = -EFAULT; - goto EXIT_LOOP; - } - p_pt_attrs->pg_info[L2_page_num].num_entries -= - pte_count; - if (p_pt_attrs->pg_info[L2_page_num].num_entries - == 0) { - /* - * Clear the L1 PTE pointing to the - * L2 PT - */ - if (RET_OK != hw_mmu_pte_clear(L1_base_va, - vaCurrOrig, HW_MMU_COARSE_PAGE_SIZE)) { - status = -EFAULT; - goto EXIT_LOOP; - } - } - rem_bytes -= pte_count * PAGE_SIZE; - } else - /* vaCurr aligned to pte_size? */ - /* pte_size = 1 MB or 16 MB */ - if ((pte_size != 0) && (rem_bytes >= pte_size) && - !(vaCurr & (pte_size - 1))) { - if (pte_size == HW_PAGE_SIZE_1MB) - numof4Kpages = 256; - else - numof4Kpages = 4096; - temp = 0; - /* Collect Physical addresses from VA */ - pAddr = (pte_val & ~(pte_size - 1)); - if (hw_mmu_pte_clear(L1_base_va, vaCurr, - pte_size) == RET_OK) { - rem_bytes -= pte_size; - vaCurr += pte_size; - } else { - status = -EFAULT; - goto EXIT_LOOP; - } - } else { - status = -EFAULT; - } - } - } - /* - * It is better to flush the TLB here, so that any stale old entries - * get flushed - */ -EXIT_LOOP: - hw_mmu_tlb_flushAll(halObject->mmuBase); - return status; -} - - -/*======================================== - * This sets up the Ducati processor - * - */ -Int ducati_setup(OMAP4430DUCATI_HalObject * halObject) -{ - Int ret_val = 0; - - if (halObject->procId == PROCTYPE_SYSM3) { - ret_val = init_mmu_page_attribs(0x10000, 14, 128); - if (ret_val < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_setup", - ret_val, - "init_mmu_page_attribs failed"); - } - else { - /* Disable TWL */ - ret_val = ducati_set_twl(halObject, FALSE); - if (ret_val < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_setup", - ret_val, - "ducati_set_twl to FALSE failed"); - } - else { - ret_val = ducati_mmu_init (halObject); - if (ret_val < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_setup", - ret_val, - "ducati_mmu_init failed"); - } - else { - ret_val = ducati_set_twl(halObject, TRUE); - if (ret_val < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "ducati_setup", - ret_val, - "benelli_set_twl to TRUE failed"); - } - } - } - } - } - return ret_val; -} - - - -Void ducati_destroy(OMAP4430DUCATI_HalObject * halObject) -{ - if (halObject->procId == PROCTYPE_SYSM3) { - shm_phys_addr = 0; - deinit_mmu_page_attribs(); - } -} - - -static Void iotlb_load_cr (OMAP4430DUCATI_HalObject * halObject, - struct cr_regs *cr) -{ - ULONG reg; - OMAP4430Ducati_MMURegs * mmuRegs = - (OMAP4430Ducati_MMURegs *)halObject->mmuBase; - - reg = cr->cam | MMU_CAM_V; - OUTREG32(&mmuRegs->CAM, reg); - - reg = cr->ram; - OUTREG32(&mmuRegs->RAM, reg); - - reg = 1; - OUTREG32(&mmuRegs->FLUSH_ENTRY, reg); - - reg = 1; - OUTREG32(&mmuRegs->LD_TLB, reg); -} - - -/** - * iotlb_dump_cr - Dump an iommu tlb entry into buf - * @obj: target iommu - * @cr: contents of cam and ram register - * @buf: output buffer - **/ -static UInt32 iotlb_dump_cr (struct cr_regs *cr, char *buf) -{ - Char *p = buf; - - if(!cr || !buf) - return 0; - - /* FIXME: Need more detail analysis of cam/ram */ - p += sprintf(p, "%08x %08x %01x\n", (unsigned int)cr->cam, - (unsigned int)cr->ram, - (cr->cam & MMU_CAM_P) ? 1 : 0); - return (p - buf); -} - - - -static Int iotlb_cr_valid (struct cr_regs *cr) -{ - if (!cr) - return -EINVAL; - - return (cr->cam & MMU_CAM_V); -} - - - -static struct cr_regs *omap4_alloc_cr (struct iotlb_entry *e) -{ - struct cr_regs *cr; - - if (e->da & ~(get_cam_va_mask(e->pgsz))) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "omap4_alloc_cr", - -EINVAL, - "failed mask check"); - return NULL; - } - - cr = mmap(NULL, - sizeof(struct cr_regs), - PROT_NOCACHE | PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PHYS | MAP_PRIVATE, - NOFD, - 0); - - if (MAP_FAILED == cr) - { - GT_setFailureReason (curTrace, - GT_4CLASS, - "omap4_alloc_cr", - -EINVAL, - "mmap failed"); - return NULL; - } - - cr->cam = (e->da & MMU_CAM_VATAG_MASK) | e->prsvd | e->pgsz | e->valid; - cr->ram = e->pa | e->endian | e->elsz | e->mixed; - return cr; -} - - - -static struct cr_regs *iotlb_alloc_cr (struct iotlb_entry *e) -{ - if (!e) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "iotlb_alloc_cr", - -EINVAL, - "e is NULL"); - return NULL; - } - - return omap4_alloc_cr(e); -} - - - -/** - * load_iotlb_entry - Set an iommu tlb entry - * @obj: target iommu - * @e: an iommu tlb entry info - **/ -static Int load_iotlb_entry (OMAP4430DUCATI_HalObject * halObject, - struct iotlb_entry *e) -{ - Int err = 0; - struct iotlb_lock l; - struct cr_regs *cr; - - if (halObject == NULL) { - err = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "load_iotlb_entry", - err, - "halObject is NULL"); - goto out; - } - - if (halObject->mmuBase == NULL) { - err = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "load_iotlb_entry", - err, - "halObject->mmuBase is NULL"); - goto out; - } - - if (!e) { - err = -EINVAL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "load_iotlb_entry", - err, - "e is NULL"); - goto out; - } - - iotlb_getLock(halObject, &l); - - if (l.base == 32) { - err = -EBUSY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "load_iotlb_entry", - err, - "l.base is full"); - goto out; - } - if (!e->prsvd) { - int i; - struct cr_regs tmp; - - for_each_iotlb_cr(32, i, tmp) - if (!iotlb_cr_valid(&tmp)) - break; - - if (i == 32) { - err = -EBUSY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "load_iotlb_entry", - err, - "i == 32"); - goto out; - } - - iotlb_getLock(halObject, &l); - } else { - l.vict = l.base; - iotlb_setLock(halObject, &l); - } - - cr = iotlb_alloc_cr(e); - if (!cr){ - err = -ENOMEM; - GT_setFailureReason (curTrace, - GT_4CLASS, - "load_iotlb_entry", - err, - "iotlb_alloc_cr failed"); - goto out; - } - - iotlb_load_cr(halObject, cr); - munmap(cr, sizeof(struct cr_regs)); - - if (e->prsvd) - l.base++; - /* increment victim for next tlb load */ - if (++l.vict == 32) - l.vict = l.base; - iotlb_setLock(halObject, &l); - -out: - return err; -} - diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHal.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHal.c deleted file mode 100644 index 9b3b389..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHal.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * @file omap4430DucatiHal.c - * - * @brief Top-level Hardware Abstraction Module implementation - * - * This module implements the top-level Hardware Abstraction Layer - * for OMAP4430. - * The implementation is specific to OMAP4430. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -/* Standard headers */ -#include - -/* OSAL & utils headers */ -#include - -/* Hardware Abstraction Layer headers */ -#include <_ProcDefs.h> -#include -#include -#include -#include -#define INREG32(x) in32(x) -#define OUTREG32(x, y) out32(x, y) - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ - -/* ============================================================================= - * APIs called by OMAP4430DUCATIPROC module - * ============================================================================= - */ -/*! - * @brief Function to initialize the HAL object - * - * @param halObj Return parameter: Pointer to the HAL object - * @param initParams Optional initialization parameters - * - * @sa OMAP4430DUCATI_halExit - * OMAP4430DUCATI_phyShmemInit - */ -Int -OMAP4430DUCATI_halInit (Ptr * halObj, Ptr params,UInt16 procId) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalObject * halObject = NULL; - OMAP4430DUCATIPROC_Params *lpParams = params; - GT_2trace (curTrace, GT_ENTER, "OMAP4430DUCATI_halInit", halObj, params); - - GT_assert (curTrace, (halObj != NULL)); - - - halObject = (OMAP4430DUCATI_HalObject *) halObj ; - *halObj = Memory_calloc (NULL, sizeof (OMAP4430DUCATI_HalObject), 0, NULL); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (halObject == NULL) { - /*! @retval PROCESSOR_E_MEMORY Memory allocation failed */ - status = PROCESSOR_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halInit", - status, - "Memory allocation failed for HAL object!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - halObject = (OMAP4430DUCATI_HalObject *) *halObj ; - halObject->procId = procId; - halObject->procHandle = lpParams->procHandle; - - status = OMAP4430DUCATI_phyShmemInit (*halObj, lpParams->memEntries); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halInit", - status, - "OMAP4430DUCATI_phyShmemInit failed!"); - Memory_free (NULL, *halObj, sizeof (OMAP4430DUCATI_HalObject)); - *halObj = NULL; - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_halInit", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to finalize the HAL object - * - * @param halObj Pointer to the HAL object - * - * @sa OMAP4430DUCATI_halInit - * OMAP4430DUCATI_phyShmemExit - */ -Int -OMAP4430DUCATI_halExit (Ptr halObj, Ptr params) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalObject * halObject = NULL; - OMAP4430DUCATIPROC_Params *lpParams = params; - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATI_halExit", halObj); - - GT_assert (curTrace, (halObj != NULL)); - - halObject = (OMAP4430DUCATI_HalObject *) halObj ; - status = OMAP4430DUCATI_phyShmemExit(halObj, lpParams->memEntries); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halExit", - status, - "OMAP4430DUCATI_phyShmemExit failed!"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - if (halObj != NULL) { - /* Free the memory for the HAL object. */ - Memory_free (NULL, halObj, sizeof (OMAP4430DUCATI_HalObject)); - } - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_halExit", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -#if defined (__cplusplus) -} -#endif diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalMmu.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalMmu.c deleted file mode 100644 index d311eb5..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalMmu.c +++ /dev/null @@ -1,937 +0,0 @@ -/* - * @file omap4430DucatiHalMmu.c - * - * @brief Hardware abstraction for Memory Management Unit module. - * - * This module is responsible for handling slave MMU-related - * hardware- specific operations. - * The implementation is specific to OMAP4430DUCATI. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -/* Standard headers */ -#include - -/* OSAL and utils headers */ -#include -#include -#include - -/* Module level headers */ -#include <_ProcDefs.h> -#include - -/* Hardware Abstraction Layer headers */ -#include -#include -#include -#include -#include -#include - -/*QNX specific header include */ -#include -#include -#include - -#if defined (__cplusplus) -extern "C" { -#endif - - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ -/*! - * @brief CAM register field values - */ -#define MMU_CAM_PRESERVE (1 << 3) -#define MMU_CAM_VALID (1 << 2) - -/*! - * @brief Addresses lower than this do not go through the DSP's MMU - */ -#define MMU_GLOBAL_MEMORY 0x11000000 - -/*! - * @brief Interrupt Id for DSP MMU faults - */ -#define MMU_FAULT_INTERRUPT 132 - -/*! - * @brief Size constants - */ -#define SIZE_4KB 0x1000 -#define SIZE_64KB 0x10000 -#define SIZE_1MB 0x100000 -#define SIZE_16MB 0x1000000 - -#define MMU_SECTION_ADDR_MASK 0xFFF00000 -#define MMU_SSECTION_ADDR_MASK 0xFF000000 -#define MMU_PAGE_TABLE_MASK 0xFFFFFC00 -#define MMU_LARGE_PAGE_MASK 0xFFFF0000 -#define MMU_SMALL_PAGE_MASK 0xFFFFF000 - - -#define SLAVEVIRTADDR(x) ((x)->addr [ProcMgr_AddrType_SlaveVirt]) -#define SLAVEPHYSADDR(x) ((x)->addr [ProcMgr_AddrType_SlavePhys]) -#define MASTERPHYSADDR(x) ((x)->addr [ProcMgr_AddrType_MasterPhys]) - -#define MMUPAGE_ALIGN(size, psz) (((size) + psz - 1) & ~(psz -1)) - -#define IOPTE_SHIFT 12 -#define IOPTE_SIZE (1 << IOPTE_SHIFT) -#define IOPTE_MASK (~(IOPTE_SIZE - 1)) -#define IOPAGE_MASK IOPTE_MASK - -/*! - * @def REG32 - * @brief Regsiter access method. - */ -#define REG32(x) (*(volatile UInt32 *) (x)) - -/* ============================================================================= - * Structures used in this file - * ============================================================================= - */ - -/* ============================================================================= - * Forward declarations of internal functions - * ============================================================================= - */ -/* Enables the MMU for GEM Module. */ -Int _OMAP4430DUCATI_halMmuEnable (OMAP4430DUCATI_HalObject * halObject, - UInt32 numMemEntries, - ProcMgr_AddrInfo * memTable); - -/* Disables the MMU for GEM Module. */ -Int _OMAP4430DUCATI_halMmuDisable (OMAP4430DUCATI_HalObject * halObject); - -/* This function configures the specified addr to be in the TLB */ -Int _OMAP4430DUCATI_halMmuAddEntry (OMAP4430DUCATI_HalObject * halObject, - OMAP4430DUCATI_HalMmuEntryInfo * entry); - -int _OMAP4430DUCATI_halMmuAddStaticEntries (OMAP4430DUCATI_HalObject * halObject, - UInt32 numMemEntries, - ProcMgr_AddrInfo * memTable); - - -/* Delete entry from TLB. */ -Int _OMAP4430DUCATI_halMmuDeleteEntry (OMAP4430DUCATI_HalObject * halObject, - OMAP4430DUCATI_HalMmuEntryInfo * entry); - -/* Set entry in to TLB. */ -Int _OMAP4430DUCATI_halMmuPteSet (OMAP4430DUCATI_HalObject * halObject, - OMAP4430DUCATI_HalMmuEntryInfo * setPteInfo); - - -/* ============================================================================= - * APIs called by OMAP4430DUCATIPROC module - * ============================================================================= - */ -/*! - * @brief Function to control MMU operations for this slave device. - * - * @param halObj Pointer to the HAL object - * @param cmd MMU control command - * @param arg Arguments specific to the MMU control command - * - * @sa - */ -Int -OMAP4430DUCATI_halMmuCtrl (Ptr halObj, Processor_MmuCtrlCmd cmd, Ptr args) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalObject * halObject = NULL; - - GT_3trace (curTrace, GT_ENTER, "OMAP4430DUCATI_halMmuCtrl", halObj, cmd, args); - - GT_assert (curTrace, (halObj != NULL)); - - halObject = (OMAP4430DUCATI_HalObject *) halObj ; - - switch (cmd) { - case Processor_MmuCtrlCmd_Enable: - { - OMAP4430DUCATI_HalMmuCtrlArgs_Enable * enableArgs; - enableArgs = (OMAP4430DUCATI_HalMmuCtrlArgs_Enable *) args; - halObject = (OMAP4430DUCATI_HalObject *) halObj; - status = _OMAP4430DUCATI_halMmuEnable (halObject, - enableArgs->numMemEntries, - enableArgs->memEntries); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - /*! @retval PROCESSOR_E_FAIL Failed to configure DSP MMU. */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halMmuCtrl", - status, - "Failed to configure DSP MMU"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - break; - - case Processor_MmuCtrlCmd_Disable: - { - /* args are not used. */ - halObject = (OMAP4430DUCATI_HalObject *) halObj; - status = _OMAP4430DUCATI_halMmuDisable (halObject); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - /*! @retval PROCESSOR_E_FAIL Failed to configure DSP MMU. */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halMmuCtrl", - status, - "Failed to disable DSP MMU"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - break ; - - case Processor_MmuCtrlCmd_AddEntry: - { - OMAP4430DUCATI_HalMmuCtrlArgs_AddEntry * addEntry; - addEntry = (OMAP4430DUCATI_HalMmuCtrlArgs_AddEntry *) args; - - halObject = (OMAP4430DUCATI_HalObject *) halObj; - /* Add the entry in TLB for new request */ - //status = _OMAP4430DUCATI_halMmuAddEntry (halObject,addEntry) ; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halMmuCtrl", - status, - "Failed to dynamically add DSP MMU entry"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - } - break; - - case Processor_MmuCtrlCmd_DeleteEntry: - { - OMAP4430DUCATI_HalMmuCtrlArgs_DeleteEntry * deleteEntry; - deleteEntry = (OMAP4430DUCATI_HalMmuCtrlArgs_DeleteEntry *) args; - - halObject = (OMAP4430DUCATI_HalObject *) halObj; - - //status = _OMAP5430DUCATI_halMmuDeleteEntry (halObject,deleteEntry); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halMmuCtrl", - status, - "Failed to dynamically delete DSP MMU entry"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - break; - default: - { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halMmuCtrl", - status, - "Unsupported MMU ctrl cmd specified"); - } - break; - } - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_halMmuCtrl",status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - -/* ============================================================================= - * Internal functions - * ============================================================================= - */ -/*! - * @brief Enables and configures the DSP MMU as per provided memory map. - * - * @param halObject Pointer to the HAL object - * @param numMemEntries Number of memory entries in memTable - * @param memTable Table of memory entries to be configured - * - * @sa - */ - -Int -_OMAP4430DUCATI_halMmuAddStaticEntries (OMAP4430DUCATI_HalObject * halObject, - UInt32 numMemEntries, - ProcMgr_AddrInfo * memTable) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalMmuEntryInfo staticEntry; - UInt32 i; - - GT_3trace (curTrace, GT_ENTER, "_OMAP4430DUCATI_halMmuAddStaticEntries", - halObject, numMemEntries, memTable); - - GT_assert (curTrace, (halObject != NULL)); - /* It is possible that numMemEntries may be 0, if user does not want to - * configure any default regions. - * memTable may also be NULL. - */ - - for (i = 0 ; i < numMemEntries && (status >= 0) ; i++) { - if (SLAVEVIRTADDR (&memTable [i]) >= MMU_GLOBAL_MEMORY) { - /* Configure the TLB */ - if (memTable [i].size != 0) - { - staticEntry.slaveVirtAddr = - SLAVEVIRTADDR (&memTable [i]); - staticEntry.size = memTable[i].size; - staticEntry.masterPhyAddr = - MASTERPHYSADDR (&memTable [i]); - /*TBD : elementSize, endianism, mixedSized are hard - * coded now, must be configurable later*/ - staticEntry.elementSize = MMU_RAM_ELSZ_16; - staticEntry.endianism = LITTLE_ENDIAN; - staticEntry.mixedSize = MMU_TLBES; - status = _OMAP4430DUCATI_halMmuAddEntry (halObject, - &staticEntry); - if (status < 0) { - /*! @retval PROCESSOR_E_FAIL Failed to add MMU entry. */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuAddStaticEntries", - status, - "Failed to add MMU entry!"); - } - } - } - } - GT_1trace (curTrace, GT_LEAVE, "_OMAP4430DUCATI_halMmuAddStaticEntries", status); - - /*! @retval PROCESSOR_SUCCESS Operation completed successfully. */ - return status ; -} - - -/* ============================================================================= - * Internal functions - * ============================================================================= - */ -/*! - * @brief Function to check and clear the remote proc interrupt - * - * @param arg Optional argument to the function. - * - * @sa _OMAP4430DUCATI_halMmuInt_isr - */ -static -Bool -_OMAP4430DUCATI_halMmuCheckAndClearFunc (Ptr arg) -{ - OMAP4430DUCATI_HalObject * halObject = (OMAP4430DUCATI_HalObject *)arg; - OMAP4430DUCATI_HalMmuObject * mmuObj = &(halObject->mmuObj); - - /* Check the interrupt status */ - mmuObj->mmuIrqStatus = REG32(halObject->mmuBase + MMU_MMU_IRQSTATUS_OFFSET); - mmuObj->mmuIrqStatus &= MMU_IRQ_MASK; - if (!(mmuObj->mmuIrqStatus)) - return (FALSE); - - /* Get the fault address. */ - mmuObj->mmuFaultAddr = REG32(halObject->mmuBase + MMU_MMU_FAULT_AD_OFFSET); - - /* Print the fault information */ - GT_0trace (curTrace, GT_4CLASS, - "**************** Ducati-MMU Fault ****************"); - GT_1trace (curTrace, GT_4CLASS, - "**** addr: 0x%x", mmuObj->mmuFaultAddr); - if (mmuObj->mmuIrqStatus & MMU_IRQ_TLBMISS) - GT_0trace (curTrace, GT_4CLASS, "**** TLBMISS"); - if (mmuObj->mmuIrqStatus & MMU_IRQ_TRANSLATIONFAULT) - GT_0trace (curTrace, GT_4CLASS, "**** TRANSLATIONFAULT"); - if (mmuObj->mmuIrqStatus & MMU_IRQ_EMUMISS) - GT_0trace (curTrace, GT_4CLASS, "**** EMUMISS"); - if (mmuObj->mmuIrqStatus & MMU_IRQ_TABLEWALKFAULT) - GT_0trace (curTrace, GT_4CLASS, "**** TABLEWALKFAULT"); - if (mmuObj->mmuIrqStatus & MMU_IRQ_MULTIHITFAULT) - GT_0trace (curTrace, GT_4CLASS, "**** MULTIHITFAULT"); - GT_0trace (curTrace, GT_4CLASS, - "**************************************************"); - - /* Clear the interrupt and disable further interrupts. */ - REG32(halObject->mmuBase + MMU_MMU_IRQENABLE_OFFSET) = 0x0; - REG32(halObject->mmuBase + MMU_MMU_IRQSTATUS_OFFSET) = mmuObj->mmuIrqStatus; - - /* This is not a shared interrupt, so interrupt has always occurred */ - /*! @retval TRUE Interrupt has occurred. */ - return (TRUE); -} - -/*! - * @brief Interrupt Service Routine for Omap4430DucatiHalMmu module - * - * @param arg Optional argument to the function. - * - * @sa _OMAP4430DUCATI_halMmuCheckAndClearFunc - */ -static -Bool -_OMAP4430DUCATI_halMmuInt_isr (Ptr arg) -{ - OMAP4430DUCATI_HalObject * halObject = (OMAP4430DUCATI_HalObject *)arg; - OMAP4430DUCATIPROC_Object * proc4430Object = NULL; - - GT_1trace (curTrace, GT_ENTER, "_OMAP4430DUCATI_halMmuInt_isr", arg); - OMAP4430DUCATIPROC_open((OMAP4430DUCATIPROC_Handle *)&proc4430Object, halObject->procId); - Processor_setState(proc4430Object->procHandle, ProcMgr_State_Mmu_Fault); - OMAP4430DUCATIPROC_close((OMAP4430DUCATIPROC_Handle *)&proc4430Object); - - - GT_1trace (curTrace, GT_LEAVE, "_OMAP4430DUCATI_halMmuInt_isr", TRUE); - - /*! @retval TRUE Interrupt has been handled. */ - return (TRUE); -} - -/*! - * @brief Enables and configures the DSP MMU as per provided memory map. - * - * @param halObject Pointer to the HAL object - * @param numMemEntries Number of memory entries in memTable - * @param memTable Table of memory entries to be configured - * - * @sa - */ -Int -_OMAP4430DUCATI_halMmuEnable (OMAP4430DUCATI_HalObject * halObject, - UInt32 numMemEntries, - ProcMgr_AddrInfo * memTable) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalMmuObject * mmuObj; - OsalIsr_Params isrParams; - - GT_3trace (curTrace, GT_ENTER, "_OMAP4430DUCATI_halMmuEnable", - halObject, numMemEntries, memTable); - - GT_assert (curTrace, (halObject != NULL)); - /* It is possible that numMemEntries may be 0, if user does not want to - * configure any default regions. - * memTable may also be NULL. - */ - mmuObj = &(halObject->mmuObj); - - /* Create the ISR to listen for MMU Faults */ - isrParams.sharedInt = FALSE; - isrParams.checkAndClearFxn = &_OMAP4430DUCATI_halMmuCheckAndClearFunc; - isrParams.fxnArgs = halObject; - isrParams.intId = MMU_FAULT_INTERRUPT; - mmuObj->isrHandle = OsalIsr_create (&_OMAP4430DUCATI_halMmuInt_isr, - halObject, - &isrParams); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (mmuObj->isrHandle == NULL) { - /*! @retval PROCESSOR_E_FAIL OsalIsr_create failed */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuEnable", - status, - "OsalIsr_create failed"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - status = OsalIsr_install (mmuObj->isrHandle); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuEnable", - status, - "OsalIsr_install failed"); - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "_OMAP4430DUCATI_halMmuEnable", status); - - /*! @retval PROCESSOR_SUCCESS Operation completed successfully. */ - return status ; -} - - -/*! - * @brief Disables the DSP MMU. - * - * @param halObject Pointer to the HAL object - * - * @sa - */ -Int -_OMAP4430DUCATI_halMmuDisable (OMAP4430DUCATI_HalObject * halObject) -{ - Int status = PROCESSOR_SUCCESS; - Int tmpStatus = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalMmuObject * mmuObj; - - GT_1trace (curTrace, GT_ENTER, "_OMAP4430DUCATI_halMmuDisable", halObject); - - GT_assert (curTrace, (halObject != NULL)); - mmuObj = &(halObject->mmuObj); - - status = OsalIsr_uninstall (mmuObj->isrHandle); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuDisable", - status, - "OsalIsr_uninstall failed"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - tmpStatus = -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - OsalIsr_delete (&(mmuObj->isrHandle)); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if ((status >= 0) && (tmpStatus < 0)) { - status = tmpStatus; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuDisable", - status, - "OsalIsr_delete failed"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "_OMAP4430DUCATI_halMmuDisable", status); - - /*! @retval PROCESSOR_SUCCESS Operation completed successfully. */ - return status; -} - - -/*! - * @brief This function adds an MMU entry for the specfied address and - * size. - * - * @param halObject Pointer to the HAL object - * @param slaveVirtAddr DSP virtual address of the memory region - * @param size Size of the memory region to be configured - * @param isDynamic Is the MMU entry being dynamically added? - * - * @sa - */ -Int _OMAP4430DUCATI_halMmuAddEntry (OMAP4430DUCATI_HalObject * halObject, - OMAP4430DUCATI_HalMmuEntryInfo * entry) -{ - Int status = PROCESSOR_SUCCESS; - UInt32 * ppgd = NULL; - UInt32 * ppte = NULL; - OMAP4430DUCATI_HalMmuEntryInfo currentEntry; - OMAP4430DUCATI_HalMmuEntryInfo te; - Int32 currentEntrySize; - - GT_2trace (curTrace, GT_ENTER, "_OMAP4430DUCATI_halMmuAddEntry", - halObject, entry); - - GT_assert (curTrace, (halObject != NULL)); - GT_assert (curTrace, (entry != NULL)); - - /* Add the entry (or entries) */ - if (status >= 0) { - Memory_copy(¤tEntry, - entry, - sizeof(OMAP4430DUCATI_HalMmuEntryInfo)); - - /* Align the addresses to page size */ - currentEntry.size += (currentEntry.slaveVirtAddr & (PAGE_SIZE_4KB -1)); - currentEntry.slaveVirtAddr &= ~(PAGE_SIZE_4KB-1); - currentEntry.masterPhyAddr &= ~(PAGE_SIZE_4KB-1); - - /* Align the size as well */ - currentEntry.size = MMUPAGE_ALIGN(currentEntry.size, PAGE_SIZE_4KB); - currentEntrySize = currentEntry.size; - - /* Check every page if exists */ - do { - /* Lookup if the entry exists */ - if (1)//!*ppgd || !*ppte) - { - /* Entry doesnot exists, insert this page */ - te.size = PAGE_SIZE_4KB; - te.slaveVirtAddr = currentEntry.slaveVirtAddr; - te.masterPhyAddr = currentEntry.masterPhyAddr; - te.elementSize = ELEM_SIZE_16BIT; - te.endianism = LITTLE_ENDIAN; - te.mixedSize = MMU_TLBES; - status = _OMAP4430DUCATI_halMmuPteSet (halObject, &te); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason ( - curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuAddEntry", - status, - "Failed to in _OMAP4430DUCATI_halMmuPteSet!"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - else if (*ppgd && *ppte) { - if (currentEntry.masterPhyAddr != (*ppte & IOPAGE_MASK)) { - /* Entry doesnot exists, insert this page */ - te.size = PAGE_SIZE_4KB; - te.slaveVirtAddr = currentEntry.slaveVirtAddr; - te.masterPhyAddr = currentEntry.masterPhyAddr; - te.elementSize = ELEM_SIZE_16BIT; - te.endianism = LITTLE_ENDIAN; - te.mixedSize = MMU_TLBES; - status = _OMAP4430DUCATI_halMmuPteSet (halObject, &te); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason ( - curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuAddEntry", - status, - "Failed to in _OMAP4430DUCATI_halMmuPteSet!"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - } - - currentEntrySize -= PAGE_SIZE_4KB; - currentEntry.slaveVirtAddr += PAGE_SIZE_4KB; - currentEntry.masterPhyAddr += PAGE_SIZE_4KB; - } while (currentEntrySize); - - } - - GT_1trace (curTrace, GT_LEAVE, "_OMAP4430DUCATI_halMmuAddEntry", status); - - /*! @retval PROCESSOR_SUCCESS Operation completed successfully. */ - return status; -} - - -/*! - * @brief This function deletes an MMU entry for the specfied address and - * size. - * - * @param halObject Pointer to the HAL object - * @param slaveVirtAddr DSP virtual address of the memory region - * @param size Size of the memory region to be configured - * @param isDynamic Is the MMU entry being dynamically added? - * - * @sa - */ -Int _OMAP4430DUCATI_halMmuDeleteEntry (OMAP4430DUCATI_HalObject * halObject, - OMAP4430DUCATI_HalMmuEntryInfo * entry) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalMmuObject * mmuObj; - - - GT_2trace (curTrace, GT_ENTER, "_OMAP4430DUCATI_halMmuDeleteEntry", - halObject, entry); - - GT_assert (curTrace, (halObject != NULL)); - GT_assert (curTrace, (entry != NULL)); - //GT_assert (curTrace, (entry->slaveVirtAddr != 0)); // 0 is a valid slave virtual addr - GT_assert (curTrace, (entry->size != 0)); - - mmuObj = &(halObject->mmuObj); - - GT_1trace (curTrace, GT_LEAVE, "_OMAP4430DUCATI_halMmuDeleteEntry", status); - - /*! @retval PROCESSOR_SUCCESS Operation completed successfully. */ - return status; -} - -static ULONG HAL_MMU_PteAddrL1(const ULONG L1_base, const ULONG va) -{ - ULONG TTB_13_to_7, VA_31_to_20, desc_13_to_0; - - TTB_13_to_7 = L1_base & (0x7FUL << 13); - VA_31_to_20 = va >> (20 - 2); /* Left-shift by 2 here itself */ - desc_13_to_0 = (TTB_13_to_7 + VA_31_to_20) & (0xFFFUL << 2); - - return ( (L1_base & 0xFFFFC000) | desc_13_to_0 ); -} - -static ULONG HAL_MMU_PteAddrL2(const ULONG L2_base, const ULONG va) -{ - return ( (L2_base & 0xFFFFFC00) | ( (va >> 10) & 0x3FC ) ); -} - -#define OUTREG32(x, y) WRITE_REGISTER_ULONG(x, (ULONG)(y)) - -int OMAP4430DUCATI_InternalMMU_PteSet (const ULONG pgTblVa, - struct iotlb_entry *mapAttrs) -{ - Int status = 0; - ULONG pteAddr, pteVal; - Int numEntries = 1; - ULONG physicalAddr = mapAttrs->pa; - ULONG virtualAddr = mapAttrs->da; - - switch (mapAttrs->pgsz) - { - case MMU_CAM_PGSZ_4K: - pteAddr = HAL_MMU_PteAddrL2(pgTblVa, virtualAddr & MMU_SMALL_PAGE_MASK); - pteVal = ( (physicalAddr & MMU_SMALL_PAGE_MASK) | - (mapAttrs->endian << 9) | - (mapAttrs->elsz << 4) | - (mapAttrs->mixed << 11) | 2 - ); - break; - - case MMU_CAM_PGSZ_64K: - numEntries = 16; - pteAddr = HAL_MMU_PteAddrL2(pgTblVa, virtualAddr & MMU_LARGE_PAGE_MASK); - pteVal = ( (physicalAddr & MMU_LARGE_PAGE_MASK) | - (mapAttrs->endian << 9) | - (mapAttrs->elsz << 4) | - (mapAttrs->mixed << 11) | 1 - ); - break; - - case MMU_CAM_PGSZ_1M: - pteAddr = HAL_MMU_PteAddrL1(pgTblVa, virtualAddr & MMU_SECTION_ADDR_MASK); - pteVal = ( ( ( (physicalAddr & MMU_SECTION_ADDR_MASK) | - (mapAttrs->endian << 15) | - (mapAttrs->elsz << 10) | - (mapAttrs->mixed << 17)) & - ~0x40000) | 0x2 - ); - break; - - case MMU_CAM_PGSZ_16M: - numEntries = 16; - pteAddr = HAL_MMU_PteAddrL1(pgTblVa, virtualAddr & MMU_SSECTION_ADDR_MASK); - pteVal = ( ( (physicalAddr & MMU_SSECTION_ADDR_MASK) | - (mapAttrs->endian << 15) | - (mapAttrs->elsz << 10) | - (mapAttrs->mixed << 17) - ) | 0x40000 | 0x2 - ); - break; - - default: - return -1; - } - - while (--numEntries >= 0) - { -#ifdef MMUTEST - ((ULONG*)pteAddr)[numEntries] = pteVal; -#endif - } - - return status; -} -/*! - * @brief Updates entries in table. - * - * @param refData Argument provided to the ISR registration function - * - * @sa - */ -Int -_OMAP4430DUCATI_halMmuPteSet (OMAP4430DUCATI_HalObject * halObject, - OMAP4430DUCATI_HalMmuEntryInfo* setPteInfo) -{ - OMAP4430DUCATI_HalMmuObject * mmuObj; - struct iotlb_entry tlb_entry; - Int status = PROCESSOR_SUCCESS; -// Commented as TRACEENTER log takes long time -// GT_2trace (curTrace, -// GT_ENTER, -// "_OMAP4430DUCATI_halMmuPteSet", -// halObject, -// setPteInfo); - - GT_assert (curTrace, (halObject != NULL)); - GT_assert (curTrace, (setPteInfo != NULL)); - - mmuObj = &(halObject->mmuObj); - GT_assert(curTrace, (mmuObj != NULL)); - - switch (setPteInfo->size) { - case PAGE_SIZE_16MB: - tlb_entry.pgsz = MMU_CAM_PGSZ_16M; - break; - case PAGE_SIZE_1MB: - tlb_entry.pgsz = MMU_CAM_PGSZ_1M; - break; - case PAGE_SIZE_64KB: - tlb_entry.pgsz = MMU_CAM_PGSZ_64K; - break; - case PAGE_SIZE_4KB: - tlb_entry.pgsz = MMU_CAM_PGSZ_4K; - break; - default : - status = PROCESSOR_E_INVALIDARG; - /*! @retval PROCESSOR_E_INVALIDARG Invalid Page size passed!. */ - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuPteSet", - status, - "Invalid Page size passed!"); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status >= 0) { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - tlb_entry.prsvd = MMU_CAM_PRESERVE; - tlb_entry.valid = MMU_CAM_VALID; - /*TBD : elsz parameter has to be configured*/ - switch (setPteInfo->elementSize) { - case ELEM_SIZE_8BIT: - tlb_entry.elsz = MMU_RAM_ELSZ_8; - break; - case ELEM_SIZE_16BIT: - tlb_entry.elsz = MMU_RAM_ELSZ_16; - break; - case ELEM_SIZE_32BIT: - tlb_entry.elsz = MMU_RAM_ELSZ_32; - break; - case ELEM_SIZE_64BIT: - tlb_entry.elsz = 0x3; /* No translation */ - break; - default : - status = PROCESSOR_E_INVALIDARG; - /*! @retval PROCESSOR_E_INVALIDARG Invalid elementSize passed!*/ - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuPteSet", - status, - "Invalid elementSize passed!"); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status >= 0) { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /*TBD : endian parameter has to configured*/ - switch (setPteInfo->endianism) { - case LITTLE_ENDIAN: - tlb_entry.endian = MMU_RAM_ENDIAN_LITTLE; - break; - case BIG_ENDIAN: - tlb_entry.endian = MMU_RAM_ENDIAN_BIG; - break; - default : - status = PROCESSOR_E_INVALIDARG; - /*! @retval PROCESSOR_E_INVALIDARG Invalid endianism - * passed!. */ - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuPteSet", - status, - "Invalid endianism passed!"); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status >= 0) { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /*TBD : mixed parameter has to configured*/ - switch (setPteInfo->mixedSize) { - case MMU_TLBES: - tlb_entry.mixed = MMU_RAM_DEFAULT; - break; - case MMU_CPUES: - tlb_entry.mixed = MMU_RAM_MIXED; - break; - default : - status = PROCESSOR_E_INVALIDARG; - /*! @retval PROCESSOR_E_INVALIDARG Invalid - * mixed size passed!*/ - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuPteSet", - status, - "Invalid mixed size passed!"); - } - - tlb_entry.da = setPteInfo->slaveVirtAddr; - tlb_entry.pa = setPteInfo->masterPhyAddr; - - if (OMAP4430DUCATI_InternalMMU_PteSet(halObject->mmuBase, &tlb_entry)){ - status = PROCESSOR_E_STOREENTERY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "_OMAP4430DUCATI_halMmuPteSet", - status, - "iopgtable_store_entry failed!"); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - -// GT_1trace (curTrace, GT_LEAVE, "_OMAP4430DUCATI_halMmuPteSet", status); - - /*! @retval PROCESSOR_SUCCESS Operation completed successfully. */ - return status; -} - - - -#if defined (__cplusplus) -} -#endif diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalReset.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalReset.c deleted file mode 100644 index 0d07ff4..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHalReset.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * @file omap4430DucatiHalReset.c - * - * @brief Reset control module. - * - * This module is responsible for handling reset-related hardware- - * specific operations. - * The implementation is specific to OMAP4430DUCATI. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -/*QNX specific header include */ -#include - -/* Standard headers */ -#include - -/* OSAL & Utils headers */ -#include -#include - -/* Module level headers */ -#include <_ProcDefs.h> -#include -#include - -/* Hardware Abstraction Layer headers */ -#include -#include -#include "OMAP4430DucatiEnabler.h" -#include -#include <_ipu_pm.h> -#include - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ -#define GPT_IRQSTATUS_OFFSET 0x28 - -/* ============================================================================= - * APIs called by OMAP4430DUCATIPROC module - * ============================================================================= - */ -/*! - * @brief Function to control reset operations - * - * @param halObj Pointer to the HAL object - * @param cmd Reset control command - * @param arg Arguments specific to the reset control command - * - * @sa - */ -Int -OMAP4430DUCATI_halResetCtrl (Ptr halObj, Processor_ResetCtrlCmd cmd,UInt32 entryPt) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATI_HalObject * halObject = NULL; - UINT32 pa; - int counter = 10; - UINT32 M3RstCtrl; - UINT32 M3ClkCtrl; - UINT32 M3RstSt; - UINT32 M3ClkStCtrl; - Int ret; - - GT_3trace (curTrace, GT_ENTER, "OMAP4430DUCATI_halResetCtrl", halObj, cmd, entryPt); - - GT_assert (curTrace, (halObj != NULL)); - GT_assert (curTrace, (cmd < Processor_ResetCtrlCmd_EndValue)); - - ULONG reg = 0; - ULONG resets = 0; - pa = RM_MPU_M3_RSTCTRL; - M3RstCtrl = (UINT32)OsalDrv_ioMap(pa, sizeof(ULONG)); - - pa = CM_MPU_M3_MPU_M3_CLKCTRL; - M3ClkCtrl = (UINT32)OsalDrv_ioMap(pa, sizeof(ULONG)); - - pa = RM_MPU_M3_RSTST; - M3RstSt = (UINT32)OsalDrv_ioMap(pa, sizeof(ULONG)); - pa = CM_MPU_M3_CLKSTCTRL; - M3ClkStCtrl = (UINT32)OsalDrv_ioMap(pa, sizeof(ULONG)); - - halObject = (OMAP4430DUCATI_HalObject *) halObj ; - - switch (cmd) { - case Processor_ResetCtrlCmd_Reset: - { - switch (halObject->procId) { - case PROCTYPE_SYSM3: - /* Put SYSM3 into reset */ - SETBITREG32(M3RstCtrl, RM_MPU_M3_RST1_BIT); - /* Read back the reset control register */ - reg = INREG32(M3RstCtrl); - /* Disable the GPT3 clock, which is used by CORE0 */ - ret = ipu_pm_gpt_stop(GPTIMER_3); - if (ret != EOK) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to stop gpt 3"); - } - ret = ipu_pm_gpt_disable(GPTIMER_3); - if (ret != EOK) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to disable gpt 3"); - } - break; - case PROCTYPE_APPM3: - /* Put APPM3 into reset */ - SETBITREG32(M3RstCtrl, RM_MPU_M3_RST2_BIT); -#ifndef SYSLINK_SYSBIOS_SMP - /* Disable the GPT4 clock, which is used by CORE1 */ - ret = ipu_pm_gpt_stop(GPTIMER_4); - if (ret != EOK) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to stop gpt 4"); - } - ret = ipu_pm_gpt_disable(GPTIMER_4); - if (ret != EOK) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to disable gpt 4"); - } -#endif - break; - default: - break; - } - } - break; - - case Processor_ResetCtrlCmd_MMU_Reset: - { - switch (halObject->procId) { - case PROCTYPE_SYSM3: - /* Put M3 MMU into reset */ - SETBITREG32(M3RstCtrl, RM_MPU_M3_RST3_BIT); - /* Disable the M3 clock */ - OUTREG32(M3ClkCtrl, 0x01); - break; - case PROCTYPE_APPM3: - break; - default: - break; - } - } - break; - - case Processor_ResetCtrlCmd_MMU_Release: - { - reg = INREG32(M3RstSt); - if (reg != 0x0) { - Osal_printf("OMAP4430DUCATI_halResetCtrl: clearing reset status!"); - OUTREG32(M3RstSt,reg); - do { - if ((reg = INREG32(M3RstSt)) == 0x0) - break; - } while (--counter); - - if (reg == 0x0) { - Osal_printf("OMAP4430DUCATI_halResetCtrl: reset state reset!"); - } - else { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", status, - "Failed to clear reset status"); - } - } - if (status >= 0) { - reg = INREG32(M3RstCtrl); - Osal_printf("OMAP4430DUCATI_halResetCtrl: Reset Control [0x%x]", - reg); - - switch (halObject->procId) { - case PROCTYPE_SYSM3: - /* Module is managed automatically by HW */ - OUTREG32(M3ClkCtrl, - CM_MPU_M3_MPU_M3_CLKCTRL_MODULEMODE_HWAUTO); - /* Enable the M3 clock */ - OUTREG32(M3ClkStCtrl, CM_MPU_M3_CLKSTCTRL_CTRL_SW_WKUP); - - counter = 10; - do { - if (TESTBITREG32(M3ClkStCtrl, - CM_MPU_M3_CLKSTCTRL_CLKACTIVITY_BIT)) { - Osal_printf("M3 clock enabled:" - "CORE_CM2_DUCATI_CLKSTCTRL = 0x%x", - INREG32(M3ClkStCtrl)); - break; - } - } while (--counter); - - if (counter == 0) { - Osal_printf("FAILED TO ENABLE DUCATI M3 CLOCK !"); - return PROCESSOR_E_OSFAILURE; - } - - /* Check that releasing resets would indeed be - * effective */ - reg = INREG32(M3RstCtrl); - resets = RM_MPU_M3_RST3 | RM_MPU_M3_RST2 | RM_MPU_M3_RST1; - if (reg != resets) { - Osal_printf("OMAP4430DUCATI_halResetCtrl: " - "Resets in not proper state! [0x%x]", - reg); - OUTREG32(M3RstCtrl,resets); - counter = 10; - do { - if ((INREG32(M3RstCtrl) & resets) == resets) - break; - } while (--counter); - - if (counter == 0) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to put resets in proper state"); - } - } - - if (status >= 0) { - /* De-assert RST3, and clear the Reset status */ - Osal_printf("De-assert RST3"); - CLRBITREG32(M3RstCtrl, RM_MPU_M3_RST3_BIT); - - counter = 10; - do { - if (INREG32(M3RstSt) & RM_MPU_M3_RST3ST) - break; - } while (--counter); - if (counter == 0) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to release RST3"); - } - else { - Osal_printf("RST3 released!"); - SETBITREG32(M3RstSt, RM_MPU_M3_RST3ST_BIT); - } - } - break; - case PROCTYPE_APPM3: - break; - default: - Osal_printf("proc4430_start: ERROR input"); - break; - } - } - } - break; - - case Processor_ResetCtrlCmd_Release: - { - switch (halObject->procId) { - case PROCTYPE_SYSM3: - /* Enable the GPT3 clock, which is used by CORE0 */ - ret = ipu_pm_gpt_enable(GPTIMER_3); - if (ret != EOK) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to enable gpt 3"); - } - else { - restore_gpt_context(GPTIMER_3); - ret = ipu_pm_gpt_start(GPTIMER_3); - if (ret != EOK) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to start gpt 3"); - } - else { - /* De-assert RST1, and clear the Reset status */ - Osal_printf("De-assert RST1"); - CLRBITREG32(M3RstCtrl, RM_MPU_M3_RST1_BIT); - - counter = 10; - do { - if (INREG32(M3RstSt) & RM_MPU_M3_RST1) - break; - } while (--counter); - if (counter == 0) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to release RST1"); - } - else { - Osal_printf("RST1 released!"); - SETBITREG32(M3RstSt, RM_MPU_M3_RST1ST_BIT); - - /* Setting to HW_AUTO Mode */ - reg = INREG32(M3ClkStCtrl); - reg &= ~CM_MPU_M3_CLKSTCTRL_CTRL_BITMASK; - reg |= CM_MPU_M3_CLKSTCTRL_CTRL_HW_AUTO; - OUTREG32(M3ClkStCtrl, reg); - } - } - } - break; - case PROCTYPE_APPM3: -#ifndef SYSLINK_SYSBIOS_SMP - /* Enable the GPT4 clock, which is used by CORE1 */ - ret = ipu_pm_gpt_enable(GPTIMER_4); - if (ret != EOK) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to enable gpt 4"); - } - else { - restore_gpt_context(GPTIMER_4); - ipu_pm_gpt_start(GPTIMER_4); -#endif - - /* De-assert RST2, and clear the Reset status */ - CLRBITREG32(M3RstCtrl, RM_MPU_M3_RST2_BIT); - - counter = 10; - do { - if (INREG32(M3RstSt) & RM_MPU_M3_RST2) - break; - } while (--counter); - if (counter == 0) { - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Failed to release RST2"); - } - else { - Osal_printf("RST2 released!"); - SETBITREG32(M3RstSt, RM_MPU_M3_RST2ST_BIT); - /* Wait until ducati is in idle */ - //while(TESTBITREG32(M3ClkStCtrl, - // CM_MPU_M3_CLKSTCTRL_CLKACTIVITY_BIT)); - } -#ifndef SYSLINK_SYSBIOS_SMP - } -#endif - break; - default: - Osal_printf("OMAP430DUCATI_halResetCtrl: ERROR input"); - break; - } - } - break; - - default: - { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Unsupported reset ctrl cmd specified"); - } - break; - } - OsalDrv_ioUnmap(M3ClkStCtrl, sizeof(ULONG)); - OsalDrv_ioUnmap(M3ClkCtrl, sizeof(ULONG)); - OsalDrv_ioUnmap(M3RstCtrl, sizeof(ULONG)); - OsalDrv_ioUnmap(M3RstSt, sizeof(ULONG)); - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_halResetCtrl", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - - return status; -} - - -#if defined (__cplusplus) -} -#endif diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiProc.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiProc.c deleted file mode 100644 index 4575686..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiProc.c +++ /dev/null @@ -1,2056 +0,0 @@ -/* - * @file omap4430DucatiProc.c - * - * @brief Processor implementation for OMAP4430DUCATI. - * - * This module is responsible for taking care of device-specific - * operations for the processor. This module can be used - * stand-alone or as part of ProcMgr. - * The implementation is specific to OMAP4430DUCATI. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -/* Standard headers */ -#include - -/* OSAL & Utils headers */ -#include -#include -#include - -/* Module level headers */ -#include -#include -#include -#include -#include -#include -#include -#include <_MultiProc.h> -#include - -#if defined (__cplusplus) -extern "C" { -#endif - -#define INREG32(x) in32(x) -#define OUTREG32(x, y) out32(x, y) - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ - -/*! - * @brief Checks if a value lies in given range. - */ -#define IS_RANGE_VALID(x,min,max) (((x) < (max)) && ((x) >= (min))) - - - -/*! - * @brief OMAP4430DUCATIPROC Module state object - */ - - -/*OMAP4430 Module state object */ -typedef struct OMAP4430DUCATIPROC_module_object_tag { - UInt32 cfgSize; - /* Size of configuration structure */ - struct OMAP4430DUCATIPROC_Config cfg; - /* OMAP4430 configuration structure */ - struct OMAP4430DUCATIPROC_Config defCfg; - /* Default module configuration */ - Bool isSetup; - /* Flag to indicate if module is setup */ - OMAP4430DUCATIPROC_Handle procHandle; - /* Processor handle array. */ - IGateProvider_Handle gateHandle; - /* void * of gate to be used for local thread safety */ -}OMAP4430DUCATIPROC_ModuleObject; - - - -#define SYSLINK_CARVEOUT -/* Default memory regions */ -static ProcMgr_AddrInfo OMAP4430DUCATIPROC_defaultMemRegions [] = -#ifdef SYSLINK_CARVEOUT -{ - { - /*addr = */{ -1u, -1u, -1u, 0xA0000000, -1u}, - /*size = */0x00100000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, - { - /*addr = */{ -1u, -1u, -1u, 0x80000000, -1u}, - /*size = */0x02900000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, - { - /*addr = */{ -1u, -1u, -1u, 0x9F000000, -1u}, - /*size = */0x00100000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, - { - /*addr = */{ -1u, -1u, -1u, 0x00000000, -1u}, - /*size = */0x00600000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, -}; -#else -{ - { - /*addr = */{ -1u, -1u, -1u, 0xA0000000, -1u}, - /*size = */0x00100000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, - { - /*addr = */{ -1u, -1u, -1u, 0x9F000000, -1u}, - /*size = */0x00100000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, - { - /*addr = */{ -1u, -1u, -1u, 0x00000000, -1u}, - /*size = */0x00600000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, - { - /*addr = */{ -1u, -1u, -1u, 0x80000000, -1u}, - /*size = */0x06000000, - /*isCached = */FALSE, - /*isMapped = */FALSE, - /*mapMask = */ProcMgr_SLAVEVIRT | ProcMgr_MASTERKNLVIRT - }, -}; -#endif - -/* ============================================================================= - * Globals - * ============================================================================= - */ -/*! - * @var OMAP4430DUCATIPROC_state - * - * @brief OMAP4430DUCATIPROC state object variable - */ -#if !defined(SYSLINK_BUILD_DEBUG) -static -#endif /* if !defined(SYSLINK_BUILD_DEBUG) */ -OMAP4430DUCATIPROC_ModuleObject OMAP4430SYSM3PROC_state = -{ - sizeof (OMAP4430DUCATIPROC_Config), - {0}, - {0}, - FALSE, - NULL, - NULL -}; - -OMAP4430DUCATIPROC_ModuleObject OMAP4430APPM3PROC_state = -{ - sizeof (OMAP4430DUCATIPROC_Config), - {0}, - {0}, - FALSE, - NULL, - NULL -}; - - -/* ============================================================================= - * APIs directly called by applications - * ============================================================================= - */ -/*! - * @brief Function to get the default configuration for the - * OMAP4430DUCATIPROC module. - * - * This function can be called by the application to get their - * configuration parameter to OMAP4430DUCATIPROC_setup filled in by - * the OMAP4430DUCATIPROC module with the default parameters. If - * the user does not wish to make any change in the default - * parameters, this API is not required to be called. - * - * @param cfg Pointer to the OMAP4430DUCATIPROC module - * configuration structure in which the default config - * is to be returned. - * - * @sa OMAP4430DUCATIPROC_setup - */ -Void -OMAP4430DUCATIPROC_get_config (OMAP4430DUCATIPROC_Config * cfg, Int ProcType) -{ - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_get_config", cfg); - - GT_assert (curTrace, (cfg != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (cfg == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_get_config", - PROCESSOR_E_INVALIDARG, - "Argument of type (OMAP4430DUCATIPROC_Config *) " - "passed is null!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - switch (ProcType) - { - case PROCTYPE_SYSM3: - Memory_copy (cfg, - &(OMAP4430SYSM3PROC_state.defCfg), - sizeof (OMAP4430DUCATIPROC_Config)); - break; - - case PROCTYPE_APPM3: - Memory_copy (cfg, - &(OMAP4430APPM3PROC_state.defCfg), - sizeof (OMAP4430DUCATIPROC_Config)); - break; - - //case PROCTYPE_TESLA: - // Memory_copy (cfg, - // &(OMAP4430TESLAPROC_state.defCfg), - // sizeof (OMAP4430DUCATIPROC_Config)); - //break; - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_get_config"); -} - - -/*! - * @brief Function to setup the OMAP4430DUCATIPROC module. - * - * This function sets up the OMAP4430DUCATIPROC module. This - * function must be called before any other instance-level APIs - * can be invoked. - * Module-level configuration needs to be provided to this - * function. If the user wishes to change some specific config - * parameters, then OMAP4430DUCATIPROC_getConfig can be called to - * get the configuration filled with the default values. After - * this, only the required configuration values can be changed. If - * the user does not wish to make any change in the default - * parameters, the application can simply call - * OMAP4430DUCATIPROC_setup with NULL parameters. The default - * parameters would get automatically used. - * - * @param cfg Optional OMAP4430DUCATIPROC module configuration. If - * provided as NULL, default configuration is used. - * - * @sa OMAP4430DUCATIPROC_destroy - * GateMutex_create - */ -Int -OMAP4430DUCATIPROC_setup (OMAP4430DUCATIPROC_Config * cfg, Int ProcType) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATIPROC_Config tmpCfg; - OMAP4430DUCATIPROC_ModuleObject * pState = NULL; - Error_Block eb; - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_setup", cfg); - - Error_init(&eb); - - if (cfg == NULL) { - OMAP4430DUCATIPROC_get_config (&tmpCfg, ProcType); - cfg = &tmpCfg; - } - - switch (ProcType) - { - case PROCTYPE_SYSM3: - pState = &OMAP4430SYSM3PROC_state; - break; - case PROCTYPE_APPM3: - pState = &OMAP4430APPM3PROC_state; - break; - //case PROCTYPE_TESLA: - // pState = &OMAP4430TESLAPROC_state; - // break; - } - - if (pState == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_setup", - PROCESSOR_E_INVALIDARG, - "Unsupported procType"); - return PROCESSOR_E_INVALIDARG; - } - - /* Create a default gate handle for local module protection. */ - pState->gateHandle = (IGateProvider_Handle) - GateMutex_create ((GateMutex_Params *)NULL, &eb); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (pState->gateHandle == NULL) { - /*! @retval PROCESSOR_E_FAIL Failed to create GateMutex! */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_setup", - status, - "Failed to create GateMutex!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Copy the user provided values into the state object. */ - Memory_copy (&pState->cfg, - cfg, - sizeof (OMAP4430DUCATIPROC_Config)); - - /* Initialize the name to handles mapping array. */ - pState->procHandle = NULL; - - pState->isSetup = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_setup", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return (status); -} - - -/*! - * @brief Function to destroy the OMAP4430DUCATIPROC module. - * - * Once this function is called, other OMAP4430DUCATIPROC module - * APIs, except for the OMAP4430DUCATIPROC_getConfig API cannot be - * called anymore. - * - * @sa OMAP4430DUCATIPROC_setup - * GateMutex_delete - */ -Int -OMAP4430DUCATIPROC_destroy (Int ProcType) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATIPROC_ModuleObject * pState = NULL; - - GT_0trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_destroy"); - - switch(ProcType) - { - case PROCTYPE_SYSM3: - pState = &OMAP4430SYSM3PROC_state; - break; - case PROCTYPE_APPM3: - pState = &OMAP4430APPM3PROC_state; - break; - //case PROCTYPE_TESLA: - // pState = &OMAP4430TESLAPROC_state; - // break; - } - - if (pState == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_setup", - PROCESSOR_E_INVALIDARG, - "Unsupported procType"); - return PROCESSOR_E_INVALIDARG; - } - - /* Check if any OMAP4430DUCATIPROC instances have not been deleted so far. - * If not, delete them. - */ - if (pState->procHandle != NULL) { - OMAP4430DUCATIPROC_delete(&pState->procHandle); - } - - if (pState->gateHandle != NULL) { - GateMutex_delete ((GateMutex_Handle *) - &(pState->gateHandle)); - } - - pState->isSetup = FALSE; - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_destroy", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return (status); -} - - -/*! - * @brief Function to initialize the parameters for this Processor - * instance. - * - * @param params Configuration parameters to be returned - * - * @sa OMAP4430DUCATIPROC_create - */ -Void -OMAP4430DUCATIPROC_Params_init (OMAP4430DUCATIPROC_Handle handle, - OMAP4430DUCATIPROC_Params * params, - Int ProcType) -{ - OMAP4430DUCATIPROC_Object * procObject = - (OMAP4430DUCATIPROC_Object *) handle; - UInt32 numMemEntries = 0; - ProcMgr_AddrInfo * pMemRegn = NULL; - - GT_2trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_Params_init", - handle, params); - - GT_assert (curTrace, (params != NULL)); - - switch(ProcType) - { - case PROCTYPE_SYSM3: - pMemRegn = OMAP4430DUCATIPROC_defaultMemRegions; - numMemEntries = sizeof (OMAP4430DUCATIPROC_defaultMemRegions) / - sizeof(ProcMgr_AddrInfo); - break; - case PROCTYPE_APPM3: - pMemRegn = OMAP4430DUCATIPROC_defaultMemRegions; - numMemEntries = sizeof (OMAP4430DUCATIPROC_defaultMemRegions) / - sizeof(ProcMgr_AddrInfo); - break; - //case PROCTYPE_TESLA: - // pMemRegn = OMAP4430TESLAPROC_defaultMemRegions; - // break; - } - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (params == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_Params_init", - PROCESSOR_E_INVALIDARG, - "Argument of type (OMAP4430DUCATIPROC_Params *) " - "passed is null!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - if (handle == NULL) { - params->numMemEntries = numMemEntries; - Memory_copy ((Ptr) params->memEntries, - pMemRegn, - (sizeof(ProcMgr_AddrInfo) * params->numMemEntries)); - } - else { - /* Return updated OMAP4430DUCATIPROC instance specific parameters */ - Memory_copy (params, - &(procObject->params), - sizeof (OMAP4430DUCATIPROC_Params)); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_Params_init"); -} - -/*! - * @brief Function to create an instance of this Processor. - * - * @param name Name of the Processor instance. - * @param params Configuration parameters. - * - * @sa OMAP4430DUCATIPROC_delete - */ - -OMAP4430DUCATIPROC_Handle -OMAP4430DUCATIPROC_create (UInt16 procId, - const OMAP4430DUCATIPROC_Params * params) -{ -#if !defined(SYSLINK_BUILD_OPTIMIZE) - Int status = PROCESSOR_SUCCESS; -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Processor_Object * handle = NULL; - OMAP4430DUCATIPROC_Object * object = NULL; - IArg key; - OMAP4430DUCATIPROC_ModuleObject * pState = NULL; - List_Params listParams; - - switch(procId) - { - case PROCTYPE_SYSM3: - pState = &OMAP4430SYSM3PROC_state; - break; - case PROCTYPE_APPM3: - pState = &OMAP4430APPM3PROC_state; - break; - //case PROCTYPE_TESLA: - // pState = &OMAP4430TESLAPROC_state; - // break; - } - - GT_2trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_create", procId, params); - - GT_assert (curTrace, IS_VALID_PROCID (procId)); - GT_assert (curTrace, (params != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (pState == NULL) { - /* Not setting status here since this function does not return status.*/ - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_create", - PROCESSOR_E_INVALIDARG, - "Invalid procId specified"); - } - else if (params == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_create", - PROCESSOR_E_INVALIDARG, - "params passed is NULL!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Enter critical section protection. */ - key = IGateProvider_enter (pState->gateHandle); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - /* Check if the Processor already exists for specified procId. */ - if (pState->procHandle!= NULL) { - status = PROCESSOR_E_ALREADYEXIST; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_create", - status, - "Processor already exists for specified procId!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Allocate memory for the handle */ - handle = (Processor_Object *) Memory_calloc (NULL, - sizeof (Processor_Object), - 0, - NULL); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_create", - PROCESSOR_E_MEMORY, - "Memory allocation failed for handle!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Populate the handle fields */ - handle->procFxnTable.attach = &OMAP4430DUCATIPROC_attach; - handle->procFxnTable.detach = &OMAP4430DUCATIPROC_detach; - handle->procFxnTable.start = &OMAP4430DUCATIPROC_start; - handle->procFxnTable.stop = &OMAP4430DUCATIPROC_stop; - handle->procFxnTable.read = &OMAP4430DUCATIPROC_read; - handle->procFxnTable.write = &OMAP4430DUCATIPROC_write; - handle->procFxnTable.control = &OMAP4430DUCATIPROC_control; - handle->procFxnTable.map = &OMAP4430DUCATIPROC_map; - handle->procFxnTable.unmap = &OMAP4430DUCATIPROC_unmap; - handle->procFxnTable.translateAddr = &OMAP4430DUCATIPROC_translate; - handle->procFxnTable.virtToPhys = &OMAP4430DUCATI_virtToPhys; - handle->procFxnTable.getProcInfo = &OMAP4430DUCATIPROC_procInfo; - handle->state = ProcMgr_State_Unknown; - - /* Allocate memory for the OMAP4430DUCATIPROC handle */ - handle->object = Memory_calloc (NULL, - sizeof (OMAP4430DUCATIPROC_Object), - 0, - NULL); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle->object == NULL) { - status = PROCESSOR_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_create", - status, - "Memory allocation failed for handle->object!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - handle->procId = procId; - object = (OMAP4430DUCATIPROC_Object *) handle->object; - object->halObject = NULL; - object->procHandle = (Processor_Handle)handle; - /* Copy params into instance object. */ - Memory_copy (&(object->params), - (Ptr) params, - sizeof (OMAP4430DUCATIPROC_Params)); - object->params.procHandle = object->procHandle; - - /* Set the handle in the state object. */ - pState->procHandle = handle->object; - - /* Initialize the list of listeners */ - List_Params_init(&listParams); - handle->registeredNotifiers = List_create(&listParams); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle->registeredNotifiers == NULL) { - /*! @retval PROCESSOR_E_FAIL OsalIsr_create failed */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_create", - status, - "List_create failed"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - handle->notifiersLock = - OsalMutex_create(OsalMutex_Type_Interruptible); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle->notifiersLock == NULL) { - /*! @retval PROCESSOR_E_FAIL OsalIsr_create failed*/ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_create", - status, - "OsalMutex_create failed"); - } - } - } - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - /* Leave critical section protection. */ - IGateProvider_leave (pState->gateHandle, key); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - if (handle != NULL) { - if (handle->registeredNotifiers != NULL) { - List_delete (&handle->registeredNotifiers); - } - if (handle->object != NULL) { - Memory_free (NULL, - handle->object, - sizeof (OMAP4430DUCATIPROC_Object)); - } - Memory_free (NULL, handle, sizeof (Processor_Object)); - } - /*! @retval NULL Function failed */ - handle = NULL; - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_create", handle); - - /*! @retval Valid-Handle Operation successful */ - return (void*) handle; -} - - -/*! - * @brief Function to delete an instance of this Processor. - * - * The user provided pointer to the handle is reset after - * successful completion of this function. - * - * @param handlePtr Pointer to Handle to the Processor instance - * - * @sa OMAP4430DUCATIPROC_create - */ -Int -OMAP4430DUCATIPROC_delete (OMAP4430DUCATIPROC_Handle * handlePtr) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATIPROC_Object * object = NULL; - Processor_Object * handle = NULL; - IArg key = NULL; - OMAP4430DUCATIPROC_ModuleObject * pState = NULL; - List_Elem * elem = NULL; - Processor_RegisterElem * regElem = NULL; - - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_delete", handlePtr); - - GT_assert (curTrace, (handlePtr != NULL)); - GT_assert (curTrace, ((handlePtr != NULL) && (*handlePtr != NULL))); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handlePtr == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid NULL handlePtr pointer - specified*/ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_delete", - status, - "Invalid NULL handlePtr pointer specified"); - } - else if (*handlePtr == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid NULL *handlePtr specified */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_delete", - status, - "Invalid NULL *handlePtr specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - handle = (Processor_Object *) (*handlePtr); - /* Enter critical section protection. */ - if (handle->object != NULL) { - object = (OMAP4430DUCATIPROC_Object *) handle->object; - switch (handle->procId) - { - case PROCTYPE_SYSM3: - pState = &OMAP4430SYSM3PROC_state; - break; - case PROCTYPE_APPM3: - pState = &OMAP4430APPM3PROC_state; - break; - //case PROCTYPE_TESLA: - // pState = &OMAP4430TESLAPROC_state; - // break; - } - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (pState == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_delete", - PROCESSOR_E_INVALIDARG, - "Unsupported procType"); - return PROCESSOR_E_INVALIDARG; - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - key = IGateProvider_enter (pState->gateHandle); - - /* Reset handle in PwrMgr handle array. */ - GT_assert (curTrace, IS_VALID_PROCID (handle->procId)); - pState->procHandle = NULL; - - /* Free memory used for the PROC object. */ - Memory_free (NULL, - handle->object, - sizeof (Ptr)); - handle->object = NULL; - - /* - * Check the list of listeners to see if any are remaining - * and reply to them - */ - OsalMutex_delete(&handle->notifiersLock); - - while ((elem = List_dequeue(handle->registeredNotifiers)) != NULL) { - regElem = (Processor_RegisterElem *)elem; - - /* Check if there is an associated timer and cancel it */ - if (regElem->timer != -1) { - struct itimerspec value ; - value.it_value.tv_sec = 0; - value.it_value.tv_nsec = 0; - value.it_interval.tv_sec = 0; - value.it_interval.tv_nsec = 0; - timer_settime(regElem->timer, 0, &value, NULL); - - timer_delete(regElem->timer); - regElem->timer = -1; - } - - /* Call the callback function so it can clean up. */ - regElem->info->cbFxn(handle->procId, - NULL, - handle->state, - handle->state, - ProcMgr_EventStatus_Canceled, - regElem->info->arg); - /* Free the memory */ - Memory_free(NULL, regElem, sizeof(Processor_RegisterElem)); - } - - /* Delete the list of listeners */ - List_delete(&handle->registeredNotifiers); - - /* Free memory used for the Processor object. */ - Memory_free (NULL, handle, sizeof (Processor_Object)); - *handlePtr = NULL; - - /* Leave critical section protection. */ - IGateProvider_leave (pState->gateHandle, key); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_delete", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return (status); -} - - -/*! - * @brief Function to open a handle to an instance of this Processor. This - * function is called when access to the Processor is required from - * a different process. - * - * @param handlePtr Handle to the Processor instance - * @param procId Processor ID addressed by this Processor instance. - * - * @sa OMAP4430DUCATIPROC_close - */ -Int -OMAP4430DUCATIPROC_open (OMAP4430DUCATIPROC_Handle * handlePtr, UInt16 procId) -{ - Int status = PROCESSOR_SUCCESS; - OMAP4430DUCATIPROC_ModuleObject * pState = NULL; - - GT_2trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_open", - handlePtr, procId); - - GT_assert (curTrace, (handlePtr != NULL)); - GT_assert (curTrace, IS_VALID_PROCID (procId)); - - switch(procId) - { - case PROCTYPE_SYSM3: - pState = &OMAP4430SYSM3PROC_state; - break; - case PROCTYPE_APPM3: - pState = &OMAP4430APPM3PROC_state; - break; - //case PROCTYPE_TESLA: - // pState = &OMAP4430TESLAPROC_state; - // break; - } - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handlePtr == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid NULL handlePtr specified */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_open", - status, - "Invalid NULL handlePtr specified"); - } - else if (pState == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid procId specified */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_open", - status, - "Invalid procId specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Initialize return parameter handle. */ - *handlePtr = NULL; - - /* Check if the PwrMgr exists and return the handle if found. */ - if (pState->procHandle == NULL) { - /*! @retval PROCESSOR_E_NOTFOUND Specified instance not found */ - status = PROCESSOR_E_NOTFOUND; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_open", - status, - "Specified instance does not exist!"); - } - else { - *handlePtr = pState->procHandle; - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_open", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to close a handle to an instance of this Processor. - * - * @param handlePtr Pointer to Handle to the Processor instance - * - * @sa OMAP4430DUCATIPROC_open - */ -Int -OMAP4430DUCATIPROC_close (OMAP4430DUCATIPROC_Handle * handlePtr) -{ - Int status = PROCESSOR_SUCCESS; - - GT_1trace (curTrace, GT_ENTER, "OMAP4430M3VIDEOPROC_close", handlePtr); - - GT_assert (curTrace, (handlePtr != NULL)); - GT_assert (curTrace, ((handlePtr != NULL) && (*handlePtr != NULL))); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handlePtr == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid NULL handlePtr pointer - specified*/ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_close", - status, - "Invalid NULL handlePtr pointer specified"); - } - else if (*handlePtr == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid NULL *handlePtr specified */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_close", - status, - "Invalid NULL *handlePtr specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Nothing to be done for close. */ -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430M3VIDEOPROC_close", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/* ============================================================================= - * APIs called by Processor module (part of function table interface) - * ============================================================================= - */ -/*! - * @brief Function to initialize the slave processor - * - * @param handle Handle to the Processor instance - * @param params Attach parameters - * - * @sa OMAP4430DUCATIPROC_detach - */ -Int -OMAP4430DUCATIPROC_attach (Processor_Handle handle, - Processor_AttachParams * params) -{ - - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = NULL; - ProcMgr_AddrInfo * me; - OMAP4430DUCATIPROC_ModuleObject * pState; - OMAP4430DUCATI_HalMmuCtrlArgs_Enable enableArgs; - - GT_2trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_attach", handle, params); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (params != NULL)); - - switch(procHandle->procId) - { - case PROCTYPE_SYSM3: - pState = &OMAP4430SYSM3PROC_state; - break; - case PROCTYPE_APPM3: - pState = &OMAP4430APPM3PROC_state; - break; - } - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_attach", - status, - "Invalid handle specified"); - } - else if (params == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_attach", - status, - "Invalid params specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - object = (OMAP4430DUCATIPROC_Object *) procHandle->object; - GT_assert (curTrace, (object != NULL)); - - /* Added for Netra Ducati core0 is cortex M3 */ - params->procArch = Processor_ProcArch_M3; - GT_0trace (curTrace, - GT_2CLASS, - " OMAP4430DUCATIPROC_attach: Mapping memory regions"); - - /* Populate the return params */ - - status = OMAP4430DUCATI_halInit (&(object->halObject), &object->params, - procHandle->procId); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_attach", - status, - "OMAP4430DUCATI_halInit failed"); - } - else if (object->params.numMemEntries > ProcMgr_MAX_MEMORY_REGIONS) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_attach", - PROCESSOR_E_INVALIDARG, - "numMemEntries out of range"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - me = object->params.memEntries; - params->numMemEntries = object->params.numMemEntries; - - Memory_copy ((Ptr) params->memEntries, - (Ptr) object->params.memEntries, - sizeof (ProcMgr_AddrInfo) * params->numMemEntries); - - if ( (procHandle->bootMode == ProcMgr_BootMode_Boot) - || (procHandle->bootMode == ProcMgr_BootMode_NoLoad_Pwr)) { - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_attach", - status, - "Failed to reset the slave processor"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - GT_0trace (curTrace, - GT_1CLASS, - " OMAP4430DUCATIPROC_attach: Slave is now " - "in reset!"); - - if (procHandle->procId == PROCTYPE_SYSM3) { - /* Enable MMU */ - GT_0trace (curTrace, - GT_2CLASS, - "OMAP4430DUCATIPROC_attach: " - "Enabling Slave MMU ..."); - enableArgs.memEntries = NULL; - enableArgs.numMemEntries = 0; - status = OMAP4430DUCATI_halMmuCtrl (object->halObject, - Processor_MmuCtrlCmd_Enable, - &enableArgs); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_attach", - status, - "Failed to enable the slave MMU"); - } - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_attach", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; - -} - - -/*! - * @brief Function to detach from the Processor. - * - * @param handle Handle to the Processor instance - * - * @sa OMAP4430DUCATIPROC_attach - */ -Int -OMAP4430DUCATIPROC_detach (Processor_Handle handle) -{ - Int status = PROCESSOR_SUCCESS; - Int tmpStatus = PROCESSOR_SUCCESS; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = NULL; - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_detach", handle); - - GT_assert (curTrace, (handle != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_detach", - PROCESSOR_E_HANDLE, - "Invalid handle specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - object = (OMAP4430DUCATIPROC_Object *) procHandle->object; - GT_assert (curTrace, (object != NULL)); - - if ( (procHandle->bootMode == ProcMgr_BootMode_Boot) - || (procHandle->bootMode == ProcMgr_BootMode_NoLoad_Pwr)) { - if (procHandle->procId == PROCTYPE_SYSM3) { - /* Disable MMU */ - GT_0trace (curTrace, - GT_2CLASS, - " OMAP4430DUCATIPROC_detach: " - "Disabling Slave MMU ..."); - status = OMAP4430DUCATI_halMmuCtrl (object->halObject, - Processor_MmuCtrlCmd_Disable, - NULL); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_detach", - status, - "Failed to disable the slave MMU"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - //No need to reset.. that will be done in STOP - /* tmpStatus = OMAP4430DUCATI_halResetCtrl (object->halObject, - Processor_ResetCtrlCmd_Reset, - NULL); - GT_0trace (curTrace, - GT_2CLASS, - " OMAP4430DUCATIPROC_detach: Slave processor is " - "now in reset");*/ -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if ((tmpStatus < 0) && (status >= 0)) { - status = tmpStatus; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_detach", - status, - "Failed to reset the slave processor"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - GT_0trace (curTrace, - GT_2CLASS, - " OMAP4430DUCATIPROC_detach: Unmapping memory regions"); - - tmpStatus = OMAP4430DUCATI_halExit(object->halObject, &object->params); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if ((tmpStatus < 0) && (status >= 0)) { - status = tmpStatus; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_detach", - status, - "Failed to finalize HAL object"); - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_detach", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to start the slave processor - * - * Start the slave processor running from its entry point. - * Depending on the boot mode, this involves configuring the boot - * address and releasing the slave from reset. - * - * @param handle Handle to the Processor instance - * - * @sa OMAP4430DUCATIPROC_stop, OMAP4430DUCATIPROC_halBootCtrl, - * OMAP4430DUCATIPROC_halResetCtrl - */ -Int -OMAP4430DUCATIPROC_start (Processor_Handle handle, - UInt32 entryPt, - Processor_StartParams * params) -{ - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = procHandle->object; - - GT_3trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_start", - handle, entryPt, params); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (params != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_start", - status, - "Invalid handle specified"); - } - else if (params == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_start", - status, - "Invalid params specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_MMU_Release, - entryPt); - if (status < 0) { - /*! @retval status */ - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Reset MMU_Release failed"); - } - else { - ducati_setup(object->halObject); - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_Release, - entryPt); - if (status < 0) { - /*! @retval status */ - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Reset Release failed"); - } - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - return status; -} - - -/*! - * @brief Function to stop the slave processor - * - * Stop the execution of the slave processor. Depending on the boot - * mode, this may result in placing the slave processor in reset. - * - * @param handle Handle to the Processor instance - * - * @sa OMAP4430DUCATIPROC_start, OMAP4430DUCATIPROC_halResetCtrl - */ -Int -OMAP4430DUCATIPROC_stop (Processor_Handle handle) -{ - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = procHandle->object; - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_stop", handle); - - GT_assert (curTrace, (handle != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_stop", - status, - "Invalid handle specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_Reset, - 0); - if (status < 0) { - /*! @retval status */ - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Reset failed"); - } - - ducati_destroy(object->halObject); - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_MMU_Reset, - 0); - if (status < 0) { - /*! @retval status */ - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATI_halResetCtrl", - status, - "Reset MMU failed"); - } - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_stop", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to read from the slave processor's memory. - * - * Read from the slave processor's memory and copy into the - * provided buffer. - * - * @param handle Handle to the Processor instance - * @param procAddr Address in host processor's address space of the - * memory region to read from. - * @param numBytes IN/OUT parameter. As an IN-parameter, it takes in the - * number of bytes to be read. When the function - * returns, this parameter contains the number of bytes - * actually read. - * @param buffer User-provided buffer in which the slave processor's - * memory contents are to be copied. - * - * @sa OMAP4430DUCATIPROC_write - */ -Int -OMAP4430DUCATIPROC_read (Processor_Handle handle, - UInt32 procAddr, - UInt32 * numBytes, - Ptr buffer) -{ - Int status = PROCESSOR_SUCCESS ; - UInt8 * procPtr8 = NULL; - - GT_4trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_read", - handle, procAddr, numBytes, buffer); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (numBytes != NULL)); - GT_assert (curTrace, (buffer != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_read", - status, - "Invalid handle specified"); - } - else if (numBytes == 0) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_read", - status, - "Invalid numBytes specified"); - } - else if (buffer == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_read", - status, - "Invalid buffer specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - procPtr8 = (UInt8 *) procAddr ; - buffer = Memory_copy (buffer, procPtr8, *numBytes); - GT_assert (curTrace, (buffer != (UInt32) NULL)); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (buffer == (UInt32) NULL) { - /*! @retval PROCESSOR_E_FAIL Failed in Memory_copy */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_read", - status, - "Failed in Memory_copy"); - *numBytes = 0; - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_read",status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to write into the slave processor's memory. - * - * Read from the provided buffer and copy into the slave - * processor's memory. - * - * @param handle Handle to the Processor object - * @param procAddr Address in host processor's address space of the - * memory region to write into. - * @param numBytes IN/OUT parameter. As an IN-parameter, it takes in the - * number of bytes to be written. When the function - * returns, this parameter contains the number of bytes - * actually written. - * @param buffer User-provided buffer from which the data is to be - * written into the slave processor's memory. - * - * @sa OMAP4430DUCATIPROC_read - */ -Int -OMAP4430DUCATIPROC_write (Processor_Handle handle, - UInt32 procAddr, - UInt32 * numBytes, - Ptr buffer) -{ - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = NULL; - UInt8 * procPtr8 = NULL; - UInt8 temp8_1; - UInt8 temp8_2; - UInt8 temp8_3; - UInt8 temp8_4; - UInt32 temp; - - GT_4trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_write", - handle, procAddr, numBytes, buffer); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (numBytes != NULL)); - GT_assert (curTrace, (buffer != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_write", - status, - "Invalid handle specified"); - } - else if (numBytes == 0) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_write", - status, - "Invalid numBytes specified"); - } - else if (buffer == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_write", - status, - "Invalid buffer specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - object = (OMAP4430DUCATIPROC_Object *) procHandle->object; - GT_assert (curTrace, (object != NULL)); - if (*numBytes != sizeof (UInt32)) { - procPtr8 = (UInt8 *) procAddr ; - procAddr = (UInt32) Memory_copy (procPtr8, - buffer, - *numBytes); - GT_assert (curTrace, (procAddr != (UInt32) NULL)); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (procAddr == (UInt32) NULL) { - /*! @retval PROCESSOR_E_FAIL Failed in Memory_copy */ - status = PROCESSOR_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_write", - status, - "Failed in Memory_copy"); - *numBytes = 0; - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - else { - /* For 4 bytes, directly write as a UInt32 */ - temp8_1 = ((UInt8 *) buffer) [0]; - temp8_2 = ((UInt8 *) buffer) [1]; - temp8_3 = ((UInt8 *) buffer) [2]; - temp8_4 = ((UInt8 *) buffer) [3]; - temp = (UInt32) ( ((UInt32) temp8_4 << 24) - | ((UInt32) temp8_3 << 16) - | ((UInt32) temp8_2 << 8) - | ((UInt32) temp8_1)); - *((UInt32*) procAddr) = temp; - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_write", status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to perform device-dependent operations. - * - * Performs device-dependent control operations as exposed by this - * implementation of the Processor module. - * - * @param handle Handle to the Processor object - * @param cmd Device specific processor command - * @param arg Arguments specific to the type of command. - * - * @sa - */ -Int -OMAP4430DUCATIPROC_control (Processor_Handle handle, Int32 cmd, Ptr arg) -{ - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = NULL; - - GT_3trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_control", - handle, cmd, arg); - - GT_assert (curTrace, (handle != NULL)); - /* cmd and arg can be 0/NULL, so cannot check for validity. */ - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Invalid handle specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - object = (OMAP4430DUCATIPROC_Object *) procHandle->object; - GT_assert (curTrace, (object != NULL)); - /* No control operations currently implemented. */ - /*! @retval PROCESSOR_E_NOTSUPPORTED No control operations are supported - for this device. */ - - switch (cmd) { - case Omap4430DucatiProc_CtrlCmd_Suspend: - if (procHandle->state == ProcMgr_State_Running) { - if (procHandle->procId == PROCTYPE_SYSM3) { - status = save_mmu_ctxt(object->halObject, - procHandle->procId); - } - if (status < 0) { - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Error while saving the MMU context"); - } - else { - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_Reset, - 0); - if (status < 0) { - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Error while Resetting proc"); - } - else { - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_MMU_Reset, - 0); - if (status < 0) { - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Error while Resetting MMU"); - } - else { - Processor_setState(handle, ProcMgr_State_Suspended); - } - } - } - } - else { - status = PROCESSOR_E_INVALIDSTATE; - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Processor not is correct state to Suspend"); - } - break; - case Omap4430DucatiProc_CtrlCmd_Resume: - if (procHandle->state == ProcMgr_State_Suspended) { - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_MMU_Release, - 0); - if (status < 0) { - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Error while releasing proc MMU reset"); - } - else { - if (procHandle->procId == PROCTYPE_SYSM3) { - status = restore_mmu_ctxt(object->halObject, - procHandle->procId); - } - if (status < 0) { - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Error while restoring MMU context"); - } - else { - status = OMAP4430DUCATI_halResetCtrl(object->halObject, - Processor_ResetCtrlCmd_Release, - 0); - if (status < 0) { - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Error while releasing reset"); - } - else { - Processor_setState(handle, ProcMgr_State_Running); - } - } - } - } - else { - status = PROCESSOR_E_INVALIDSTATE; - GT_setFailureReason(curTrace, GT_4CLASS, - "OMAP4430DUCATIPROC_control", - status, - "Processor not is correct state to Resume"); - } - break; - default: - status = PROCESSOR_E_NOTSUPPORTED; - } - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_control",status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to translate slave physical address to master physical - * address. - * - * @param handle Handle to the Processor object - * @param dstAddr Returned: master physical address. - * @param srcAddr Slave physical address. - * - * @sa - */ -Int -OMAP4430DUCATIPROC_translate (Processor_Handle handle, - UInt32 * dstAddr, - UInt32 srcAddr) -{ - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = NULL; - UInt32 i; - ProcMgr_AddrInfo * ai; - ProcMgr_AddrInfo * pMemRegn = NULL; - UInt32 nRegions = 0; - - GT_3trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_translate", - handle, dstAddr, srcAddr); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (dstAddr != NULL)); - - GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_Params_init", handle); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_translate", - status, - "Invalid handle specified"); - } - else if (dstAddr == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG sglist provided as NULL */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_translate", - status, - "dstAddr provided as NULL"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - object = (OMAP4430DUCATIPROC_Object *) procHandle->object; - GT_assert (curTrace, (object != NULL)); - - pMemRegn = object->params.memEntries; - nRegions = object->params.numMemEntries; - - *dstAddr = -1u; - for (i = 0;i < nRegions;i++) - { - ai = &pMemRegn [i]; - if ( (srcAddr >= ai->addr [ProcMgr_AddrType_SlaveVirt]) - && (srcAddr < ( ai->addr [ProcMgr_AddrType_SlaveVirt] - + ai->size))) { - *dstAddr = ai->addr [ProcMgr_AddrType_MasterPhys] - + (srcAddr - ai->addr [ProcMgr_AddrType_SlaveVirt]); - break; - } - } - - if (*dstAddr == -1u) { - /*! @retval PROCESSOR_E_FAIL srcAddr not found in slave address - * space */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_translate", - status, - "srcAddr not found in slave address space"); - } - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_translate",status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to map slave address to host address space - * - * Map the provided slave address to master address space. This - * function also maps the specified address to slave MMU space. - * - * @param handle Handle to the Processor object - * @param mapType Type of mapping to be performed. - * @param addrInfo Structure containing map info. - * @param srcAddrType Source address type. - * - * @sa - */ -Int -OMAP4430DUCATIPROC_map (Processor_Handle handle, - UInt32 * dstAddr, - UInt32 nSegs, - Memory_SGList * sglist) -{ - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = NULL; - UInt32 i; - OMAP4430DUCATI_HalMmuCtrlArgs_AddEntry addEntryArgs; - - GT_4trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_map", - handle, dstAddr, nSegs, sglist); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (sglist != NULL)); - GT_assert (curTrace, (nSegs > 0)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_map", - status, - "Invalid handle specified"); - } - else if (sglist == NULL) { - /*! @retval PROCESSOR_E_INVALIDARG sglist provided as NULL */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_map", - status, - "sglist provided as NULL"); - } - else if (nSegs == 0) { - /*! @retval PROCESSOR_E_INVALIDARG Number of segments provided is 0 */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_map", - status, - "Number of segments provided is 0"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - object = (OMAP4430DUCATIPROC_Object *) procHandle->object; - GT_assert (curTrace, (object != NULL)); - /* Program the mmu with the sglist */ - /* Program the DSP MMU also */ - for (i = 0; (i < nSegs) && (status >= 0); i++) - { - addEntryArgs.masterPhyAddr = sglist [i].paddr; - addEntryArgs.size = sglist [i].size; - addEntryArgs.slaveVirtAddr = (UInt32)*dstAddr; - /*TBD : elementSize, endianism, mixedSized are hard coded now, - * must be configurable later*/ - addEntryArgs.elementSize = ELEM_SIZE_16BIT; - addEntryArgs.endianism = LITTLE_ENDIAN; - addEntryArgs.mixedSize = MMU_TLBES; - addEntryArgs.slaveVirtAddr = get_DucatiVirtAdd(object->halObject, - addEntryArgs.masterPhyAddr); - *(dstAddr) = addEntryArgs.slaveVirtAddr; - if(addEntryArgs.slaveVirtAddr == 0) { - status = OMAP4430DUCATI_halMmuCtrl (object->halObject, - Processor_MmuCtrlCmd_AddEntry, - &addEntryArgs); - - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_map", - status, - "DSP MMU configuration failed"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_map",status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to unmap slave address from host address space - * - * @param handle Handle to the Processor object - * @param dstAddr Return parameter: Pointer to receive the mapped - * address. - * @param size Size of the region to be mapped. -s * - * @sa - */ -Int -OMAP4430DUCATIPROC_unmap (Processor_Handle handle, - UInt32 addr, - UInt32 size) -{ - Int status = PROCESSOR_SUCCESS ; - Processor_Object * procHandle = (Processor_Object *) handle; - OMAP4430DUCATIPROC_Object * object = NULL; - OMAP4430DUCATI_HalMmuCtrlArgs_DeleteEntry deleteEntryArgs; - - GT_3trace (curTrace, GT_ENTER, "OMAP4430DUCATIPROC_unmap", - handle, addr, size); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (size != 0)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval PROCESSOR_E_HANDLE Invalid argument */ - status = PROCESSOR_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_unmap", - status, - "Invalid handle specified"); - } - else if (size == 0) { - /*! @retval PROCESSOR_E_INVALIDARG Size provided is zero */ - status = PROCESSOR_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_unmap", - status, - "Size provided is zero"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - object = (OMAP4430DUCATIPROC_Object *) procHandle->object; - GT_assert (curTrace, (object != NULL)); - /* Remove the entry from the DSP MMU also */ - - deleteEntryArgs.size = size; - deleteEntryArgs.slaveVirtAddr = addr; - /*TBD : elementSize, endianism, mixedSized are hard coded now, - * must be configurable later*/ - deleteEntryArgs.elementSize = ELEM_SIZE_16BIT; - deleteEntryArgs.endianism = LITTLE_ENDIAN; - deleteEntryArgs.mixedSize = MMU_TLBES; - - status = OMAP4430DUCATI_halMmuCtrl(object->halObject, - Processor_MmuCtrlCmd_DeleteEntry, - &deleteEntryArgs); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "OMAP4430DUCATIPROC_unmap", - status, - "DSP MMU configuration failed"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATIPROC_unmap",status); - - /*! @retval PROCESSOR_SUCCESS Operation successful */ - return status; -} - -Int -OMAP4430DUCATIPROC_procInfo (Processor_Handle handle, - ProcMgr_ProcInfo * procInfo) -{ - Processor_Object * procHandle = NULL; - OMAP4430DUCATIPROC_Object * object = NULL; - ProcMgr_AddrInfo * entry = NULL; - Int i = 0; - - procHandle = (Processor_Object *)handle; - object = procHandle->object; - for (i = 0; i < object->params.numMemEntries; i++) { - entry = &object->params.memEntries[i]; - - procInfo->memEntries[i].info.addr[ProcMgr_AddrType_MasterKnlVirt] = - entry->addr[ProcMgr_AddrType_MasterKnlVirt]; - - procInfo->memEntries[i].info.addr[ProcMgr_AddrType_SlaveVirt] = - entry->addr[ProcMgr_AddrType_SlaveVirt]; - - - } - procInfo->numMemEntries = object->params.numMemEntries; - return 0; -} - -Int -OMAP4430DUCATI_virtToPhys (Processor_Handle handle, - UInt32 da, - UInt32 * mappedEntries, - UInt32 numEntries) -{ - if(!handle || !mappedEntries || !numEntries) { - return -1; - } - return 0; -} - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiEnabler.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiEnabler.h deleted file mode 100644 index b968b8f..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiEnabler.h +++ /dev/null @@ -1,423 +0,0 @@ -/* - * @file OMAP4430DucatiEnabler.h - * - * @brief MMU programming module - * - * - * ============================================================================ - * - * Copyright (c) 2010-2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef _DDUCATIMMU_ENABLER_H_ -#define _DDUCATIMMU_ENABLER_H_ - -#include -#ifndef _U32 -#define _U32 -typedef unsigned long u32; -#endif -typedef unsigned short u16; - -#define PAGE_SIZE_4KB 0x1000 -#define PAGE_SIZE_64KB 0x10000 -#define PAGE_SIZE_1MB 0x100000 -#define PAGE_SIZE_16MB 0x1000000 - - -/* Define the Peripheral PAs and their Ducati VAs. */ -#define L4_PERIPHERAL_MBOX 0x4A0F4000 -#define DUCATI_PERIPHERAL_MBOX 0xAA0F4000 - -#define L4_PERIPHERAL_I2C1 0x48070000 -#define DUCATI_PERIPHERAL_I2C1 0xA8070000 -#define L4_PERIPHERAL_I2C2 0x48072000 -#define DUCATI_PERIPHERAL_I2C2 0xA8072000 -#define L4_PERIPHERAL_I2C3 0x48060000 -#define DUCATI_PERIPHERAL_I2C3 0xA8060000 - -#define L4_PERIPHERAL_DMA 0x4A056000 -#define DUCATI_PERIPHERAL_DMA 0xAA056000 - -#define L4_PERIPHERAL_GPIO1 0x4A310000 -#define DUCATI_PERIPHERAL_GPIO1 0xAA310000 -#define L4_PERIPHERAL_GPIO2 0x48055000 -#define DUCATI_PERIPHERAL_GPIO2 0xA8055000 -#define L4_PERIPHERAL_GPIO3 0x48057000 -#define DUCATI_PERIPHERAL_GPIO3 0xA8057000 - -#define L4_PERIPHERAL_GPTIMER3 0x48034000 -#define DUCATI_PERIPHERAL_GPTIMER3 0xA8034000 -#define L4_PERIPHERAL_GPTIMER4 0x48036000 -#define DUCATI_PERIPHERAL_GPTIMER4 0xA8036000 -#define L4_PERIPHERAL_GPTIMER9 0x48040000 -#define DUCATI_PERIPHERAL_GPTIMER9 0xA8040000 -#define L4_PERIPHERAL_GPTIMER11 0x48088000 -#define DUCATI_PERIPHERAL_GPTIMER11 0xA8088000 - -#define L4_PERIPHERAL_UART1 0x4806A000 -#define DUCATI_PERIPHERAL_UART1 0xA806A000 -#define L4_PERIPHERAL_UART2 0x4806C000 -#define DUCATI_PERIPHERAL_UART2 0xA806C000 -#define L4_PERIPHERAL_UART3 0x48020000 -#define DUCATI_PERIPHERAL_UART3 0xA8020000 -#define L4_PERIPHERAL_UART4 0x4806E000 -#define DUCATI_PERIPHERAL_UART4 0xA806E000 - - -#define L3_TILER_VIEW0_ADDR 0x60000000 -#define DUCATIVA_TILER_VIEW0_ADDR 0x60000000 -#define DUCATIVA_TILER_VIEW0_LEN 0x20000000 - -/* OMAP4430 SDC definitions */ -#define L4_PERIPHERAL_L4CFG 0x4A000000 -#define DUCATI_PERIPHERAL_L4CFG 0xAA000000 -#define L4_PERIPHERAL_L4EMU 0x54000000 -#define DUCATI_PERIPHERAL_L4EMU 0xB4000000 - -#define L4_PERIPHERAL_DSSCONFIG 0x58000000 -#define DUCATI_PERIPHERAL_DSSCONFIG 0xB8000000 - -#define L4_PERIPHERAL_L4PER 0x48000000 -#define DUCATI_PERIPHERAL_L4PER 0xA8000000 - -#define L3_PERIPHERAL_DMM 0x4E000000 -#define DUCATI_PERIPHERAL_DMM 0xAE000000 - -#define L3_IVAHD_CONFIG 0x5A000000 -#define DUCATI_IVAHD_CONFIG 0xBA000000 - -#define L3_IVAHD_SL2 0x5B000000 -#define DUCATI_IVAHD_SL2 0xBB000000 - -#define L3_TILER_MODE_0_1_ADDR 0x60000000 -#define DUCATI_TILER_MODE_0_1_ADDR 0x60000000 -#define DUCATI_TILER_MODE0_1_LEN 0x10000000 - -#define L3_TILER_MODE_2_ADDR 0x70000000 -#define DUCATI_TILER_MODE_2_ADDR 0x70000000 -#define L3_TILER_MODE_3_ADDR 0x78000000 -#define DUCATI_TILER_MODE_3_ADDR 0x78000000 -#define DUCATI_TILER_MODE_3_LEN 0x8000000 - -#define IPU_MEM_IPC_VRING 0xA0000000 -#define IPU_MEM_IPC_VRING_LEN 0x00100000 - -#define IPU_MEM_IPC_DATA 0x9F000000 -#define IPU_MEM_IPC_DATA_LEN 0x00100000 - -#define IPU_MEM_TEXT 0x00000000 -#define IPU_MEM_TEXT_LEN 0x00600000 - -#define IPU_MEM_DATA 0x80000000 -#define IPU_MEM_DATA_LEN 0x06000000 - - - -/* Types of mapping attributes */ - -/* MPU address is virtual and needs to be translated to physical addr */ -#define DSP_MAPVIRTUALADDR 0x00000000 -#define DSP_MAPPHYSICALADDR 0x00000001 - -/* Mapped data is big endian */ -#define DSP_MAPBIGENDIAN 0x00000002 -#define DSP_MAPLITTLEENDIAN 0x00000000 - -/* Element size is based on DSP r/w access size */ -#define DSP_MAPMIXEDELEMSIZE 0x00000004 - -/* - * Element size for MMU mapping (8, 16, 32, or 64 bit) - * Ignored if DSP_MAPMIXEDELEMSIZE enabled - */ -#define DSP_MAPELEMSIZE8 0x00000008 -#define DSP_MAPELEMSIZE16 0x00000010 -#define DSP_MAPELEMSIZE32 0x00000020 -#define DSP_MAPELEMSIZE64 0x00000040 - -#define DSP_MAPVMALLOCADDR 0x00000080 -#define DSP_MAPTILERADDR 0x00000100 - - -/* - Vikas KM: For MMU registry - Taken from iommu2.h of Linux -*/ - -#define MMU_DUCATI_ENABLER_BASE 0x55082000 -#define MMU_REVISION MMU_DUCATI_ENABLER_BASE + 0x00 -#define MMU_SYSCONFIG MMU_DUCATI_ENABLER_BASE + 0x10 -#define MMU_SYSSTATUS MMU_DUCATI_ENABLER_BASE + 0x14 -#define MMU_IRQSTATUS MMU_DUCATI_ENABLER_BASE + 0x18 -#define MMU_IRQENABLE MMU_DUCATI_ENABLER_BASE + 0x1c -#define MMU_WALKING_ST MMU_DUCATI_ENABLER_BASE + 0x40 -#define MMU_CNTL MMU_DUCATI_ENABLER_BASE + 0x44 -#define MMU_FAULT_AD MMU_DUCATI_ENABLER_BASE + 0x48 -#define MMU_TTB MMU_DUCATI_ENABLER_BASE + 0x4c -#define MMU_LOCK MMU_DUCATI_ENABLER_BASE + 0x50 -#define MMU_LD_TLB MMU_DUCATI_ENABLER_BASE + 0x54 -#define MMU_CAM MMU_DUCATI_ENABLER_BASE + 0x58 -#define MMU_RAM MMU_DUCATI_ENABLER_BASE + 0x5c -#define MMU_GFLUSH MMU_DUCATI_ENABLER_BASE + 0x60 -#define MMU_FLUSH_ENTRY MMU_DUCATI_ENABLER_BASE + 0x64 -#define MMU_READ_CAM MMU_DUCATI_ENABLER_BASE + 0x68 -#define MMU_READ_RAM MMU_DUCATI_ENABLER_BASE + 0x6c -#define MMU_EMU_FAULT_AD MMU_DUCATI_ENABLER_BASE + 0x70 - -#define MMU_REG_SIZE 256 - -typedef struct OMAP4430Ducati_MMURegs_t { - UInt32 REVISION; /* offset 0x00 */ - UInt32 reserved0[3]; /* offset 0x04-0x0C */ - UInt32 SYSCONFIG; /* offset 0x10 */ - UInt32 SYSSTATUS; /* offset 0x14 */ - UInt32 IRQSTATUS; /* offset 0x18 */ - UInt32 IRQENABLE; /* offset 0x1C */ - UInt32 reserved1[8]; /* offset 0x20-0x3C */ - UInt32 WALKING_ST; /* offset 0x40 */ - UInt32 CNTL; /* offset 0x44 */ - UInt32 FAULT_AD; /* offset 0x48 */ - UInt32 TTB; /* offset 0x4C */ - UInt32 LOCK; /* offset 0x50 */ - UInt32 LD_TLB; /* offset 0x54 */ - UInt32 CAM; /* offset 0x58 */ - UInt32 RAM; /* offset 0x5C */ - UInt32 GFLUSH; /* offset 0x60 */ - UInt32 FLUSH_ENTRY; /* offset 0x64 */ - UInt32 READ_CAM; /* offset 0x68 */ - UInt32 READ_RAM; /* offset 0x6C */ - UInt32 EMU_FAULT_AD; /* offset 0x70 */ - UInt32 reserved2[3]; /* offset 0x74-0x7C */ - UInt32 FAULT_PC; /* offset 0x80 */ - UInt32 FAULT_STATUS; /* offset 0x84 */ - UInt32 GP_REG; /* offset 0x88 */ -} OMAP4430Ducati_MMURegs; - -/* - * MMU Register bit definitions - */ -#define MMU_LOCK_BASE_SHIFT 10 -#define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT) -#define MMU_LOCK_BASE(x) \ - ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT) - -#define MMU_LOCK_VICT_SHIFT 4 -#define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT) -#define MMU_LOCK_VICT(x) \ - ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT) - -#define MMU_CAM_VATAG_SHIFT 12 -#define MMU_CAM_VATAG_MASK \ - ((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT) -#define MMU_CAM_P (1 << 3) -#define MMU_CAM_V (1 << 2) -#define MMU_CAM_PGSZ_MASK 3 -#define MMU_CAM_PGSZ_1M (0 << 0) -#define MMU_CAM_PGSZ_64K (1 << 0) -#define MMU_CAM_PGSZ_4K (2 << 0) -#define MMU_CAM_PGSZ_16M (3 << 0) - -#define MMU_RAM_PADDR_SHIFT 12 -#define MMU_RAM_PADDR_MASK \ - ((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT) -#define MMU_RAM_ENDIAN_SHIFT 9 -#define MMU_RAM_ENDIAN_MASK (1 << MMU_RAM_ENDIAN_SHIFT) -#define MMU_RAM_ENDIAN_BIG (1 << MMU_RAM_ENDIAN_SHIFT) -#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT) -#define MMU_RAM_ELSZ_SHIFT 7 -#define MMU_RAM_ELSZ_MASK (3 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_16 (1 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_32 (2 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_NONE (3 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_MIXED_SHIFT 6 -#define MMU_RAM_MIXED_MASK (1 << MMU_RAM_MIXED_SHIFT) -#define MMU_RAM_MIXED MMU_RAM_MIXED_MASK - -/* - Vikas KM: The MMU reguistry Ends Here. -*/ - - -/* - * omap2 architecture specific register bit definitions - */ -#define IOMMU_ARCH_VERSION 0x00000011 - -/* SYSCONF */ -#define MMU_SYS_IDLE_SHIFT 3 -#define MMU_SYS_IDLE_FORCE (0 << MMU_SYS_IDLE_SHIFT) -#define MMU_SYS_IDLE_NONE (1 << MMU_SYS_IDLE_SHIFT) -#define MMU_SYS_IDLE_SMART (2 << MMU_SYS_IDLE_SHIFT) -#define MMU_SYS_IDLE_MASK (3 << MMU_SYS_IDLE_SHIFT) - -#define MMU_SYS_SOFTRESET (1 << 1) -#define MMU_SYS_AUTOIDLE 1 - -/* SYSSTATUS */ -#define MMU_SYS_RESETDONE 1 - -/* IRQSTATUS & IRQENABLE */ -#define MMU_IRQ_MULTIHITFAULT (1 << 4) -#define MMU_IRQ_TABLEWALKFAULT (1 << 3) -#define MMU_IRQ_EMUMISS (1 << 2) -#define MMU_IRQ_TRANSLATIONFAULT (1 << 1) -#define MMU_IRQ_TLBMISS (1 << 0) - -#define __MMU_IRQ_FAULT \ - (MMU_IRQ_MULTIHITFAULT | MMU_IRQ_EMUMISS | MMU_IRQ_TRANSLATIONFAULT) -#define MMU_IRQ_MASK \ - (__MMU_IRQ_FAULT | MMU_IRQ_TABLEWALKFAULT | MMU_IRQ_TLBMISS) -#define MMU_IRQ_TWL_MASK (__MMU_IRQ_FAULT | MMU_IRQ_TABLEWALKFAULT) -#define MMU_IRQ_TLB_MISS_MASK (__MMU_IRQ_FAULT | MMU_IRQ_TLBMISS) - -/* MMU_CNTL */ -#define MMU_CNTL_SHIFT 1 -#define MMU_CNTL_MASK (7 << MMU_CNTL_SHIFT) -#define MMU_CNTL_EML_TLB (1 << 3) -#define MMU_CNTL_TWL_EN (1 << 2) -#define MMU_CNTL_MMU_EN (1 << 1) - - - - -#define PAGE_MASK(pg_size) (~((pg_size)-1)) -#define PG_ALIGN_LOW(addr, pg_size) ((addr) & PAGE_MASK(pg_size)) -#define PG_ALIGN_HIGH(addr, pg_size) (((addr)+(pg_size)-1) & PAGE_MASK(pg_size)) - - - -#define get_cam_va_mask(pgsz) \ - (((pgsz) == MMU_CAM_PGSZ_16M) ? 0xff000000 : \ - ((pgsz) == MMU_CAM_PGSZ_1M) ? 0xfff00000 : \ - ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 : \ - ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0) - - -struct mmu_entry { - u32 ul_phy_addr; - u32 ul_virt_addr; - u32 ul_size; -}; - -struct memory_entry { - u32 ul_virt_addr; - u32 ul_size; -}; - -struct cr_regs { - union { - struct { - u16 cam_l; - u16 cam_h; - }; - u32 cam; - }; - union { - struct { - u16 ram_l; - u16 ram_h; - }; - u32 ram; - }; -}; - -struct iotlb_lock { - short base; - short vict; -}; - - -/* OMAP4430 SDC definitions */ - -/* OMAP4430 SDC definitions */ -static const struct mmu_entry l4_map[] = { - /* TILER 8-bit and 16-bit modes */ - {L3_TILER_MODE_0_1_ADDR, DUCATI_TILER_MODE_0_1_ADDR, - (PAGE_SIZE_16MB * 16)}, - {L3_TILER_MODE_2_ADDR, DUCATI_TILER_MODE_2_ADDR, - (PAGE_SIZE_16MB * 8)}, - /* TILER: Pages-mode */ - {L3_TILER_MODE_3_ADDR, DUCATI_TILER_MODE_3_ADDR, - (PAGE_SIZE_16MB * 8)}, - /* L4_CFG: Covers all modules in L4_CFG 16MB*/ - {L4_PERIPHERAL_L4CFG, DUCATI_PERIPHERAL_L4CFG, PAGE_SIZE_16MB}, - /* L4_PER: Covers all modules in L4_PER 16MB*/ - {L4_PERIPHERAL_L4PER, DUCATI_PERIPHERAL_L4PER, PAGE_SIZE_16MB}, - /* DMM: Covers the DMM/TILER register space 1MB*/ - {L3_PERIPHERAL_DMM, DUCATI_PERIPHERAL_DMM, PAGE_SIZE_1MB}, - /* IVA_HD Config: Covers all modules in IVA_HD Config space 16MB */ - {L3_IVAHD_CONFIG, DUCATI_IVAHD_CONFIG, PAGE_SIZE_16MB}, - /* IVA_HD SL2: Covers all memory in IVA_HD SL2 space 16MB */ - {L3_IVAHD_SL2, DUCATI_IVAHD_SL2, PAGE_SIZE_16MB}, - /* CONFIG REGISTERS Starting from 0x58000000 space 16MB */ - {L4_PERIPHERAL_DSSCONFIG, DUCATI_PERIPHERAL_DSSCONFIG, PAGE_SIZE_16MB}, -}; - -#define SYSLINK_CARVEOUT -static const struct memory_entry l3_memory_regions[] = { - /* IPU_MEM_IPC_VRING */ - {IPU_MEM_IPC_VRING, PAGE_SIZE_1MB}, - /* IPU_MEM_IPC_DATA */ - {IPU_MEM_IPC_DATA, PAGE_SIZE_1MB}, - /* IPU_MEM_TEXT */ - {IPU_MEM_TEXT, PAGE_SIZE_1MB * 6}, -#ifdef SYSLINK_CARVEOUT - /* IPU_MEM_DATA */ - {IPU_MEM_DATA, PAGE_SIZE_1MB * 41}, -#else - /* IPU_MEM_DATA */ - {IPU_MEM_DATA, PAGE_SIZE_16MB * 6}, -#endif - /* IPU_MEM_IOBUFS */ - //{IPU_MEM_IOBUFS_ADDR, PAGE_SIZE_1MB * 90}, // TODO: Do we need this section? -}; - - - -Int ducati_setup (OMAP4430DUCATI_HalObject * halObject); -Void ducati_destroy (OMAP4430DUCATI_HalObject * halObject); -UInt32 get_DucatiVirtAdd (OMAP4430DUCATI_HalObject * halObject, - UInt32 physAdd); -Int save_mmu_ctxt (OMAP4430DUCATI_HalObject * halObject, UInt32 procId); -Int restore_mmu_ctxt (OMAP4430DUCATI_HalObject * halObject, UInt32 procId); - -#endif /* _DDUCATIMMU_ENABLER_H_*/ - diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHal.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHal.h deleted file mode 100644 index bd0ffd0..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHal.h +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @file OMAP4430DucatiHal.h - * - * @brief Top-level header file for Ducati Hardware Abstraction Layer. - * - * This module is responsible for handling device-specific - * operations. - * The implementation is specific to Ducati. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef OMAP4430DUCATIHAL_H_0xbbed -#define OMAP4430DUCATIHAL_H_0xbbed - - -/* Module level headers */ -#include <_ProcDefs.h> -#include "OMAP4430DucatiHalMmu.h" - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * See _ProcDefs.h - * ============================================================================= - */ -/*! - * @brief Register access method. - */ -//#define REG(x) *((volatile UInt32 *) (x)) - -typedef enum OMAP4430DUCATIPROCTYPE -{ - PROCTYPE_APPM3 = 2, - PROCTYPE_SYSM3 = 1 -}OMAP4430DUCATIPROCTYPE; - -/*! - * @brief Hardware Abstraction object. - */ -typedef struct OMAP4430DUCATI_HalObject_tag { - UInt32 CodeBase; - /*!< Virtual base address of the General Control module. */ - UInt32 M3Base; - /*!< Base address of the M3. */ - UInt32 ConstBase; - /*!< Base address of the Const. */ - UInt32 mmuBase; - /*!< Base address of the MMU module. */ - UInt32 procId; - /*!< Processor ID. */ - OMAP4430DUCATI_HalMmuObject mmuObj; - /*!< MMU abstraction. */ - Processor_Handle procHandle; - /*!< Processor handle. */ -} OMAP4430DUCATI_HalObject; - - -/* ============================================================================= - * APIs - * ============================================================================= - */ -/* Function to initialize the HAL object */ -Int OMAP4430DUCATI_halInit (Ptr * halObj, Ptr params,UInt16 procId); - -/* Function to finalize the HAL object */ -Int OMAP4430DUCATI_halExit (Ptr halObj, Ptr params); - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ - -#endif /* OMAP4430DUCATIHAL_H_0xbbed */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalMmu.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalMmu.h deleted file mode 100644 index c55a440..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalMmu.h +++ /dev/null @@ -1,267 +0,0 @@ -/** - * @file OMAP4430DucatiHalMmu.h - * - * @brief Hardware abstraction for Memory Management Unit module. - * - * This module is responsible for handling slave MMU related - * hardware- specific operations. - * The implementation is specific to OMAP4430DUCATI. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef OMAP4430DUCATIHALMMU_H_0xbbee -#define OMAP4430DUCATIHALMMU_H_0xbbee - - -/* OSAL and utils headers */ -#include -#include -#include - -/* Module level headers */ -#include <_ProcDefs.h> -#include "OMAP4430DucatiProc.h" - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * See _ProcDefs.h - * ============================================================================= - */ -/*! - * @brief Number of MMU entry sizes possible - */ -#define NUM_SIZE_ENTRIES_TLB 4 - -/*! - * @brief Page size constants - */ -#define PAGE_SIZE_4KB 0x1000 -/*! - * @brief Page size constants - */ -#define PAGE_SIZE_64KB 0x10000 -/*! - * @brief Page size constants - */ -#define PAGE_SIZE_1MB 0x100000 -/*! - * @brief Page size constants - */ -#define PAGE_SIZE_16MB 0x1000000 - -#define MMU_CAM_P (1 << 3) -#define MMU_CAM_V (1 << 2) -#define MMU_CAM_PGSZ_MASK 3 -#define MMU_CAM_PGSZ_1M (0 << 0) -#define MMU_CAM_PGSZ_64K (1 << 0) -#define MMU_CAM_PGSZ_4K (2 << 0) -#define MMU_CAM_PGSZ_16M (3 << 0) - -#define MMU_RAM_ENDIAN_SHIFT 9 -#define MMU_RAM_ENDIAN_MASK (1 << MMU_RAM_ENDIAN_SHIFT) -#define MMU_RAM_ENDIAN_BIG (1 << MMU_RAM_ENDIAN_SHIFT) -#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT) - -#define MMU_RAM_ELSZ_SHIFT 7 -#define MMU_RAM_ELSZ_MASK (3 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_16 (1 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_32 (2 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_ELSZ_NONE (3 << MMU_RAM_ELSZ_SHIFT) -#define MMU_RAM_MIXED_SHIFT 6 -#define MMU_RAM_MIXED_MASK (1 << MMU_RAM_MIXED_SHIFT) -#define MMU_RAM_MIXED MMU_RAM_MIXED_MASK -#define MMU_RAM_DEFAULT 0 - -/*! - * @brief enum for Element size. - */ -enum Omap3530_Hal_Mmu_Element_Size_tag { - ELEM_SIZE_8BIT, - ELEM_SIZE_16BIT, - ELEM_SIZE_32BIT, - ELEM_SIZE_64BIT -}; - -/*! - * @brief enum for endianism. - */ -enum Omap3530_Hal_Mmu_Endianism_tag { - LITTLE_ENDIAN, - BIG_ENDIAN -}; - -/*! - * @brief enum for endianism. - */ -enum Omap3530_Hal_Mmu_Mixed_Size_tag { - MMU_TLBES, - MMU_CPUES -}; - - -/*! - * @brief Information structure for each MMU Entry - */ -//typedef struct OMAP4430DUCATI_HalMmuEntryInfo_tag { -// List_Elem element; -// /*!< List header to enable linking of this structure into linked list. */ -// UInt32 slaveVirtAddr; -// /*!< Slave virtual address. */ -// UInt32 actualSize; -// /*!< Actual Size of Entry. */ -// UInt32 processAddr; -// /*!< Processed address. */ -// UInt32 processSize; -// /*!< Processed size. */ -// UInt32 tlbEntry; -// /*!< TLB entry of the MMU module. */ -// Bool isDynamic; -// /*!< Is the entry dynamic? */ -//} OMAP4430DUCATI_HalMmuEntryInfo; - -/*! - * @brief Hardware Abstraction object for MMU module. - */ -typedef struct OMAP4430DUCATI_HalMmuObject_tag { - UInt32 entriesCount [NUM_SIZE_ENTRIES_TLB]; - /*!< TLB entry counter in MMU. */ - List_Handle mmuEntryList; - /*!< List of MMU entries. */ - UInt32 mmuIrqStatus; - /*!< IRQ status of MMU fault that has occurred. */ - UInt32 mmuFaultAddr; - /*!< Fault address of MMU fault that has occurred. */ - OsalIsr_Handle isrHandle; - /*!< Pointer to IsrObject. */ - UInt32 tlbIndex; - /*!< Next available MMU TLB index */ - Bool isDynamic; - /*!< Indicates whether the entry is dynamically created. */ -} OMAP4430DUCATI_HalMmuObject; - -/*! - * @brief Args type for Processor_MmuCtrlCmd_Enable - */ -typedef struct OMAP4430DUCATI_HalMmuCtrlArgs_Enable_tag { - UInt32 numMemEntries; - /*!< Number of memory regions to be configured. */ - ProcMgr_AddrInfo * memEntries; - /*!< Array of information structures for memory regions to be configured. */ -} OMAP4430DUCATI_HalMmuCtrlArgs_Enable; - -/*! - * @brief Args type for Processor_MmuCtrlCmd_AddEntry - */ -//typedef struct OMAP4430DUCATI_HalMmuCtrlArgs_AddEntry_tag { -// UInt32 procAddr; -// /*!< Slave address to be mapped */ -// UInt32 size; -// /*!< Size (in bytes) of region to be mapped */ -// UInt32 mappedAddr; -// /*!< Mapped address in host address space */ -// UInt32 mappedSize; -// /*!< Mapped size */ -//} OMAP4430DUCATI_HalMmuCtrlArgs_AddEntry; - -/*! - * @brief Args type for Processor_MmuCtrlCmd_DeleteEntry - */ -/*! - * @brief Args type for Processor_MmuCtrlCmd_AddEntry - */ - - -typedef struct OMAP4430DUCATI_HalMmuEntryInfo_tag { - UInt32 slaveVirtAddr; - /*!< Slave address to be mapped */ - UInt32 size; - /*!< Size (in bytes) of region to be mapped */ - UInt32 masterPhyAddr; - /*!< Mapped address in host address space */ - UInt32 elementSize; - /*!< element size */ - UInt32 endianism; - /*!< Little / big endian */ - UInt32 mixedSize; - /*!< Types of pages in on segment*/ -}OMAP4430DUCATI_HalMmuEntryInfo ; - -struct iotlb_entry -{ - ULONG pgsz; - ULONG prsvd; - ULONG valid; - ULONG elsz; - ULONG endian; - ULONG mixed; - ULONG da; - ULONG pa; -}; -/*! - * @brief Args type for Processor_MmuCtrlCmd_DeleteEntry - */ -typedef OMAP4430DUCATI_HalMmuEntryInfo OMAP4430DUCATI_HalMmuCtrlArgs_AddEntry; -typedef OMAP4430DUCATI_HalMmuEntryInfo OMAP4430DUCATI_HalMmuCtrlArgs_DeleteEntry; - -/* ============================================================================= - * APIs - * ============================================================================= - */ -/* Function to control MMU operations for this slave device. */ -Int OMAP4430DUCATI_halMmuCtrl (Ptr halObj, Processor_MmuCtrlCmd cmd, Ptr arg); - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ - -#endif /* OMAP4430DUCATIHALMMU_H_0xbbee */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalReset.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalReset.h deleted file mode 100644 index 6bece28..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiHalReset.h +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @file OMAP4430DucatiHalReset.h - * - * @brief Reset control module header file. - * - * This module is responsible for handling reset-related hardware- - * specific operations. - * The implementation is specific to OMAP4430Ducati. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2011, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef OMAP4430DUCATIHALRESET_H_0xbbef -#define OMAP4430DUCATIHALRESET_H_0xbbef - - -/* Module level headers */ -#include <_ProcDefs.h> - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * See _ProcDefs.h - * ============================================================================= - */ -#define INREG32(x) in32(x) -#define OUTREG32(x, y) out32(x, y) -#define SETBITREG32(x, y) OUTREG32(x, (INREG32(x) | (1 << y))) -#define CLRBITREG32(x, y) OUTREG32(x, (INREG32(x) & ~(1 << y))) -#define TESTBITREG32(x, y) (((INREG32(x) & (1 << y)) >> y) & 0x1) - -#define CORE_PRM_BASE 0x4a306700 - -#define RM_MPU_M3_RSTCTRL_OFFSET 0x210 -#define RM_MPU_M3_RSTCTRL (CORE_PRM_BASE + RM_MPU_M3_RSTCTRL_OFFSET) -#define RM_MPU_M3_RST1_BIT 0 -#define RM_MPU_M3_RST1 (1 << RM_MPU_M3_RST1_BIT) -#define RM_MPU_M3_RST2_BIT 1 -#define RM_MPU_M3_RST2 (1 << RM_MPU_M3_RST2_BIT) -#define RM_MPU_M3_RST3_BIT 2 -#define RM_MPU_M3_RST3 (1 << RM_MPU_M3_RST3_BIT) - -#define RM_MPU_M3_RSTST_OFFSET 0x214 -#define RM_MPU_M3_RSTST (CORE_PRM_BASE + RM_MPU_M3_RSTST_OFFSET) -#define RM_MPU_M3_RST1ST_BIT 0 -#define RM_MPU_M3_RST1ST (1 << RM_MPU_M3_RST1ST_BIT) -#define RM_MPU_M3_RST2ST_BIT 1 -#define RM_MPU_M3_RST2ST (1 << RM_MPU_M3_RST2ST_BIT) -#define RM_MPU_M3_RST3ST_BIT 2 -#define RM_MPU_M3_RST3ST (1 << RM_MPU_M3_RST3ST_BIT) - -#define CORE_CM2_BASE 0x4a008700 - -#define CM_MPU_M3_CLKSTCTRL_OFFSET 0x200 -#define CM_MPU_M3_CLKSTCTRL (CORE_CM2_BASE + CM_MPU_M3_CLKSTCTRL_OFFSET) -#define CM_MPU_M3_CLKSTCTRL_CTRL_BITMASK 0x3 -#define CM_MPU_M3_CLKSTCTRL_CTRL_NO_SLEEP 0x0 -#define CM_MPU_M3_CLKSTCTRL_CTRL_SW_SLEEP 0x1 -#define CM_MPU_M3_CLKSTCTRL_CTRL_SW_WKUP 0x2 -#define CM_MPU_M3_CLKSTCTRL_CTRL_HW_AUTO 0x3 -#define CM_MPU_M3_CLKSTCTRL_CLKACTIVITY_BIT 8 -#define CM_MPU_M3_CLKSTCTRL_CLKACTIVITY_ON 0x1 - -#define CM_MPU_M3_MPU_M3_CLKCTRL_OFFSET 0x220 -#define CM_MPU_M3_MPU_M3_CLKCTRL (CORE_CM2_BASE + CM_MPU_M3_MPU_M3_CLKCTRL_OFFSET) -#define CM_MPU_M3_MPU_M3_CLKCTRL_MODULEMODE_BITMASK 0x3 -#define CM_MPU_M3_MPU_M3_CLKCTRL_MODULEMODE_DISABLE 0x0 -#define CM_MPU_M3_MPU_M3_CLKCTRL_MODULEMODE_HWAUTO 0x1 - - -/* ============================================================================= - * APIs - * ============================================================================= - */ -/* Function to control reset operations for this slave device. */ - - -Int OMAP4430DUCATI_halResetCtrl (Ptr halObj, Processor_ResetCtrlCmd cmd, - UInt32 entryPt); - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ - -#endif /* OMAP4430DUCATIHALRESET_H_0xbbef */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiPhyShmem.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiPhyShmem.h deleted file mode 100644 index 653c589..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiPhyShmem.h +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @file OMAP4430DucatiPhyShmem.h - * - * @brief Physical Interface Abstraction Layer for OMAP4430. - * - * This file contains the definitions for shared memory physical - * link being used with OMAP4430. - * The implementation is specific to OMAP4430. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - -#ifndef OMAP4430DucatiPhyShmem_H_0xbbec -#define OMAP4430DucatiPhyShmem_H_0xbbec - - -/* Module level headers */ -#include <_ProcDefs.h> - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * See _ProcDefs.h - * ============================================================================= - */ -#define SHAREDMEMORY_PHY_CODE0_BASEADDR 0x9D000000 -#define SHAREDMEMORY_PHY_CODE0_BASESIZE 0x00200000 - -/*! @brief Start of IPC shared memory for SysM3 */ -#define SHAREDMEMORY_PHY_BASEADDR_SYSM3 0x9CF00000 -#define SHAREDMEMORY_PHY_BASESIZE_SYSM3 0x00054000 - -/*! @brief Start of Const section for SysM3 */ -#define SHAREDMEMORY_PHY_CONST0_BASEADDR 0x9E000000 -#define SHAREDMEMORY_PHY_CONST0_BASESIZE 0x00100000 - - -/*! @brief Start of Code section for SysM3 */ -#define SHAREDMEMORY_PHY_CODE1_BASEADDR 0x9D800000 -#define SHAREDMEMORY_PHY_CODE1_BASESIZE 0x00200000 - -/*! @brief Start of IPC shared memory AppM3 */ -#define SHAREDMEMORY_PHY_BASEADDR_APPM3 0x9CF54000 -#define SHAREDMEMORY_PHY_BASESIZE_APPM3 0x000AC000 - -/*! @brief Start of Const section for AppM3 */ -#define SHAREDMEMORY_PHY_CONST1_BASEADDR 0x9E100000 -#define SHAREDMEMORY_PHY_CONST1_BASESIZE 0x00100000 - -#define OMAP4_MMU1_BASE 0x55082000 -#define OMAP4_MMU1_SIZE 0x00001000 - -#define OMAP4_MMU2_BASE 0x4A066000 -#define OMAP4_MMU2_SIZE 0x00001000 - - -#define MMU_BASE 0x5D000000 -/*! - * @brief size to be ioremapped. - */ -#define MMU_SIZE 0x1000 - - -/* ============================================================================= - * APIs - * ============================================================================= - */ -/* Initializes Shared Driver/device. */ -Int OMAP4430DUCATI_phyShmemInit (Ptr halObj, ProcMgr_AddrInfo *addrInfo); - -/* Finalizes Shared Driver/device. */ -Int OMAP4430DUCATI_phyShmemExit (Ptr halObj, ProcMgr_AddrInfo *addrInfo); - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ - -#endif /* OMAP4430DucatiPhyShmem_H_0xbbec */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiProc.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiProc.h deleted file mode 100644 index 0c1f3d9..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/OMAP4430DucatiProc.h +++ /dev/null @@ -1,355 +0,0 @@ -/** - * @file OMAP4430DucatiProc.h - * - * @brief Processor interface for OMAP4430Ducati. - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -#ifndef OMAP4430DUCATIPROC_H_0xbbed -#define OMAP4430DUCATIPROC_H_0xbbed - - -/* Module headers */ -#include -#include - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/*! - * @def OMAP4430DUCATIPROC_MODULEID - * @brief Module ID for OMAP4430DUCATI. - */ -#define OMAP4430DUCATIPROC_MODULEID (UInt16) 0xbbec - -/* ============================================================================= - * All success and failure codes for the module - * ============================================================================= - */ -/*! - * @def OMAP4430DUCATIPROC_STATUSCODEBASE - * @brief Error code base for ProcMgr. - */ -#define OMAP4430DUCATIPROC_STATUSCODEBASE (OMAP4430DUCATIPROC_MODULEID << 12u) - -/*! - * @def OMAP4430DUCATIPROC_MAKE_FAILURE - * @brief Macro to make failure code. - */ -#define OMAP4430DUCATIPROC_MAKE_FAILURE(x) ((Int)( 0x80000000 \ - | (OMAP4430DUCATIPROC_STATUSCODEBASE + (x)))) - -/*! - * @def OMAP4430DUCATIPROC_MAKE_SUCCESS - * @brief Macro to make success code. - */ -#define OMAP4430DUCATIPROC_MAKE_SUCCESS(x) (OMAP4430DUCATIPROC_STATUSCODEBASE + (x)) - -/*! - * @def OMAP4430DUCATIPROC_E_MMUENTRYEXISTS - * @brief Specified MMU entry already exists. - */ -#define OMAP4430DUCATIPROC_E_MMUENTRYEXISTS OMAP4430DUCATIPROC_MAKE_FAILURE(1) - -/*! - * @def OMAP4430DUCATIPROC_E_ISR - * @brief Error occurred during ISR operation. - */ -#define OMAP4430DUCATIPROC_E_ISR OMAP4430DUCATIPROC_MAKE_FAILURE(2) - -/*! - * @def OMAP4430DUCATIPROC_E_MMUCONFIG - * @brief Error occurred during MMU configuration - */ -#define OMAP4430DUCATIPROC_E_MMUCONFIG OMAP4430DUCATIPROC_MAKE_FAILURE(3) - -/*! - * @def OMAP4430DUCATIPROC_E_OSFAILURE - * @brief Failure in an OS-specific operation. - */ -#define OMAP4430DUCATIPROC_E_OSFAILURE OMAP4430DUCATIPROC_MAKE_FAILURE(4) - -/*! - * @def OMAP4430DUCATIPROC_E_INVALIDARG - * @brief Argument passed to a function is invalid. - */ -#define OMAP4430DUCATIPROC_E_INVALIDARG OMAP4430DUCATIPROC_MAKE_FAILURE(5) - -/*! - * @def OMAP4430DUCATIPROC_E_MEMORY - * @brief Memory allocation failed. - */ -#define OMAP4430DUCATIPROC_E_MEMORY OMAP4430DUCATIPROC_MAKE_FAILURE(6) - -/*! - * @def OMAP4430DUCATIPROC_E_HANDLE - * @brief Invalid object handle specified - */ -#define OMAP4430DUCATIPROC_E_HANDLE OMAP4430DUCATIPROC_MAKE_FAILURE(7) - -/*! - * @def OMAP4430DUCATIPROC_E_ACCESSDENIED - * @brief The operation is not permitted in this process. - */ -#define OMAP4430DUCATIPROC_E_ACCESSDENIED OMAP4430DUCATIPROC_MAKE_FAILURE(8) - -/*! - * @def OMAP4430DUCATIPROC_E_FAIL - * @brief Generic failure. - */ -#define OMAP4430DUCATIPROC_E_FAIL OMAP4430DUCATIPROC_MAKE_FAILURE(9) - -/*! - * @def OMAP4430DUCATIPROC_SUCCESS - * @brief Operation successful. - */ -#define OMAP4430DUCATIPROC_SUCCESS OMAP4430DUCATIPROC_MAKE_SUCCESS(0) - -/*! - * @def OMAP4430DUCATIPROC_S_ALREADYSETUP - * @brief The OMAP4430DUCATIPROC module has already been setup in this - * process. - */ -#define OMAP4430DUCATIPROC_S_ALREADYSETUP OMAP4430DUCATIPROC_MAKE_SUCCESS(1) - -/*! - * @def OMAP4430DUCATIPROC_S_OPENHANDLE - * @brief Other OMAP4430DUCATIPROC clients have still setup the - * OMAP4430DUCATIPROC module. - */ -#define OMAP4430DUCATIPROC_S_SETUP OMAP4430DUCATIPROC_MAKE_SUCCESS(2) - -/*! - * @def OMAP4430DUCATIPROC_S_OPENHANDLE - * @brief Other OMAP4430DUCATIPROC handles are still open in this process. - */ -#define OMAP4430DUCATIPROC_S_OPENHANDLE OMAP4430DUCATIPROC_MAKE_SUCCESS(3) - -/*! - * @def OMAP4430DUCATIPROC_S_ALREADYEXISTS - * @brief The OMAP4430DUCATIPROC instance has already been created/opened in - * this process - */ -#define OMAP4430DUCATIPROC_S_ALREADYEXISTS OMAP4430DUCATIPROC_MAKE_SUCCESS(4) - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ - -/*! - * @brief Enumerations to indicate types of control commands supported. - */ -typedef enum { - Omap4430DucatiProc_CtrlCmd_Suspend = 0u, - /*!< Suspend the remote proc. */ - Omap4430DucatiProc_CtrlCmd_Resume = 1u, - /*!< Resume the remote proc. */ - Omap4430DucatiProc_CtrlCmd_EndValue = 2u - /*!< End delimiter indicating start of invalid values for this enum */ -} Omap4430DucatiProc_CtrlCmd ; - -/*! - * @brief Module configuration structure. - */ -typedef struct OMAP4430DUCATIPROC_Config { - UInt32 reserved; /*!< Reserved field (not currently required) */ -} OMAP4430DUCATIPROC_Config; - -/*! - * @brief Configuration parameters specific to this processor. - */ -typedef struct OMAP4430DUCATIPROC_Params_tag { - UInt32 numMemEntries; - /*!< Number of memory regions to be configured. */ - ProcMgr_AddrInfo memEntries [ProcMgr_MAX_MEMORY_REGIONS]; - /*!< Array of information structures for memory regions to be configured. */ - Processor_Handle procHandle; -} OMAP4430DUCATIPROC_Params; - -/*! - * @brief Defines OMAP4430DUCATIPROC object handle - */ -/*! - * @brief DM740M3VIDEOPROC instance object. - */ -struct OMAP4430DUCATIPROC_Object_tag { - OMAP4430DUCATIPROC_Params params; - /*!< Instance parameters (configuration values) */ - Ptr halObject; - /*!< Pointer to the Hardware Abstraction Layer object. */ - ProcMgr_Handle pmHandle; - /*!< Handle to proc manager */ - Processor_Handle procHandle; - /*!< Handle to processor */ -}; - -/* Defines the OMAP4430DUCATIPROC object type. */ -typedef struct OMAP4430DUCATIPROC_Object_tag OMAP4430DUCATIPROC_Object; - -typedef struct OMAP4430DUCATIPROC_Object * OMAP4430DUCATIPROC_Handle; - - -/* ============================================================================= - * APIs - * ============================================================================= - */ - -/* Function to get the default configuration for the OMAP4430DUCATIPROC - * module. */ -Void -OMAP4430DUCATIPROC_get_config (OMAP4430DUCATIPROC_Config * cfg, - Int ProcType); - -/* Function to setup the OMAP4430DUCATIPROC module. */ -Int -OMAP4430DUCATIPROC_setup (OMAP4430DUCATIPROC_Config * cfg, - Int ProcType); - -/* Function to destroy the OMAP4430DUCATIPROC module. */ -Int -OMAP4430DUCATIPROC_destroy (Int ProcType); - -/* Function to initialize the parameters for this processor instance. */ -Void -OMAP4430DUCATIPROC_Params_init (OMAP4430DUCATIPROC_Handle handle, - OMAP4430DUCATIPROC_Params * params, - Int ProcType); - -/* Function to create an instance of this processor. */ -OMAP4430DUCATIPROC_Handle -OMAP4430DUCATIPROC_create (UInt16 procId, - const OMAP4430DUCATIPROC_Params * params); - -/* Function to delete an instance of this processor. */ -Int -OMAP4430DUCATIPROC_delete (OMAP4430DUCATIPROC_Handle * handlePtr); - -/* Function to open an instance of this processor. */ -Int -OMAP4430DUCATIPROC_open (OMAP4430DUCATIPROC_Handle * handlePtr, - UInt16 procId); - -/* Function to close an instance of this processor. */ -Int -OMAP4430DUCATIPROC_close (OMAP4430DUCATIPROC_Handle * handlePtr); - -Int -OMAP4430DUCATIPROC_attach (Processor_Handle handle, - Processor_AttachParams * params); - -Int -OMAP4430DUCATIPROC_detach (Processor_Handle handle); - -Int -OMAP4430DUCATIPROC_start (Processor_Handle handle, - UInt32 entryPt, - Processor_StartParams * params); - -Int -OMAP4430DUCATIPROC_stop (Processor_Handle handle); - -Int -OMAP4430DUCATIPROC_read (Processor_Handle handle, - UInt32 procAddr, - UInt32 * numBytes, - Ptr buffer); - -Int -OMAP4430DUCATIPROC_write (Processor_Handle handle, - UInt32 procAddr, - UInt32 * numBytes, - Ptr buffer); - -Int -OMAP4430DUCATIPROC_control (Processor_Handle handle, Int32 cmd, Ptr arg); - -Int -OMAP4430DUCATIPROC_map (Processor_Handle handle, - UInt32 * dstAddr, - UInt32 nSegs, - Memory_SGList * sglist); - -Int -OMAP4430DUCATIPROC_unmap (Processor_Handle handle, - UInt32 addr, - UInt32 size); - -Int -OMAP4430DUCATIPROC_translate (Processor_Handle handle, - UInt32 * dstAddr, - UInt32 srcAddr); - -Int OMAP4430DUCATI_virtToPhys (Processor_Handle handle, - UInt32 da, - UInt32 * mappedEntries, - UInt32 numEntries); - -Int OMAP4430DUCATIPROC_procInfo (Processor_Handle handle, - ProcMgr_ProcInfo * procInfo); - -Int -OMAP4430DUCATIPROC_registerNotify (Processor_Handle handle, - ProcMgr_CallbackFxn cbFxn, - Ptr arg, - Int32 timeout, - ProcMgr_State state []); - -Int -OMAP4430DUCATIPROC_unregisterNotify (Processor_Handle handle, - ProcMgr_CallbackFxn cbFxn, - Ptr arg, - ProcMgr_State state []); - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ - -#endif /* OMAP4430DUCATIPROC_H_0xbbec */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/Omap4430IpcInt.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/Omap4430IpcInt.h deleted file mode 100644 index ed07b38..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/Omap4430IpcInt.h +++ /dev/null @@ -1,155 +0,0 @@ -/** - * @file Omap4430IpcInt.h - * - * @brief Header file for OMAP4430 DSP IPC interrupts - * - * - * @ver 02.00.00.44_pre-alpha3 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - - -#if !defined (OMAP4430IPCINT_H) -#define OMAP4430IPCINT_H - - -#if defined (__cplusplus) -extern "C" { -#endif /* defined (__cplusplus) */ - - -/*! - * @def DM740IPCINT_MODULEID - * @brief Module ID for Notify. - */ -#define OMAP4430IPCINT_MODULEID (UInt16) 0x5f85 - - -/* ============================================================================= - * All success and failure codes for the module - * ============================================================================= - */ - -/*! - * @def DM740IPCINT_STATUSCODEBASE - * @brief Status code base for DM740IPCINT module. - */ -#define OMAP4430IPCINT_STATUSCODEBASE (OMAP4430IPCINT_MODULEID << 12u) - -/*! - * @def DM740IPCINT_MAKE_FAILURE - * @brief Macro to make error code. - */ -#define OMAP4430IPCINT_MAKE_FAILURE(x) ((Int)( 0x80000000 \ - | (OMAP4430IPCINT_STATUSCODEBASE + (x)))) - -/*! - * @def DM740IPCINT_MAKE_SUCCESS - * - * @brief Macro to make success code. - */ -#define OMAP4430IPCINT_MAKE_SUCCESS(x)(OMAP4430IPCINT_STATUSCODEBASE +(x)) - -/*! - * @def DM740IPCINT_E_FAIL - * @brief Generic failure. - */ -#define OMAP4430IPCINT_E_FAIL OMAP4430IPCINT_MAKE_FAILURE(1) - -/*! - * @def DM740IPCINT_E_INVALIDSTATE - * @brief Generic failure. - */ -#define OMAP4430IPCINT_E_INVALIDSTATE OMAP4430IPCINT_MAKE_FAILURE(2) - -/*! - * @def OMAP4430IPCINT_E_INVALIDSTATE - * @brief Generic failure. - */ -#define OMAP4430IPCINT_E_MEMORY OMAP4430IPCINT_MAKE_FAILURE(3) - -/*! - * @def DM740IPCINT_SUCCESS - * @brief Generic failure. - */ -#define OMAP4430IPCINT_SUCCESS OMAP4430IPCINT_MAKE_SUCCESS(0) -/*! - * @def DM740IPCINT_S_ALREADYSETUP - * @brief Set up already called. - */ -#define OMAP4430IPCINT_S_ALREADYSETUP OMAP4430IPCINT_MAKE_SUCCESS(1) - -/*! - * @def DM740IPCINT_S_ALREADYREGISTERED - * @brief ISR already registered. - */ -#define OMAP4430IPCINT_S_ALREADYREGISTERED OMAP4430IPCINT_MAKE_SUCCESS(2) -/* ============================================================================= - * Structures and enums - * ============================================================================= - */ -typedef struct Omap4430IpcInt_Config_tag { - UInt16 procId; - /*!< Processor id of destination processor. */ - UInt32 recvIntId; - /* recevive interrupt id */ -} Omap4430IpcInt_Config ; - - -/* ============================================================================= - * APIs - * ============================================================================= - */ -/* Function to setup interrupts for omap4430 */ -Void Omap4430IpcInt_setup (Omap4430IpcInt_Config * cfg); - -/* Function to destroy interrupt setup for omap4430 */ -Void Omap4430IpcInt_destroy (Void); - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ - - -#endif /* !defined (DM740IPCINT_H) */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/_Omap4430IpcInt.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/_Omap4430IpcInt.h deleted file mode 100644 index d9881a5..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/_Omap4430IpcInt.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @file _Omap4430IpcInt.h - * - * @brief Internal header file for OMAP4430 Ducati IPC interrupts - * - * - * @ver 02.00.00.46_alpha1 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - - -#if !defined (_OMAP4430IPCINT_H) -#define _OMAP4430IPCINT_H - - -#if defined (__cplusplus) -extern "C" { -#endif /* defined (__cplusplus) */ - -/* Function to register interrupts */ -Int32 Omap4430IpcInt_interruptRegister (UInt16 procId, - UInt32 intId, - ArchIpcInt_CallbackFxn fxn, - Ptr fxnArgs); -/* Function to unregister interrupts */ -Int32 Omap4430IpcInt_interruptUnregister (UInt16 procId); -/* Function to enable interrupts */ -Void Omap4430IpcInt_interruptEnable (UInt16 procId, UInt32 intId); -/* Function to disable interrupts */ -Void Omap4430IpcInt_interruptDisable (UInt16 procId, UInt32 intId); -/* Function to wait clear interrupt */ -Int32 Omap4430IpcInt_waitClearInterrupt (UInt16 procId, UInt32 intId); -/* Function to interrupt Ducati */ -Int32 Omap4430IpcInt_sendInterrupt (UInt16 procId, - UInt32 intId, - UInt32 value); -/* Function to clear Ducati interrupt */ -UInt32 Omap4430IpcInt_clearInterrupt (UInt16 mboxNum); - -/* Function to save the mailbox context */ -Int32 Omap4430IpcInt_mboxSaveCtxt (UInt16 procId); -/* Function to restore the mailbox context */ -Int32 Omap4430IpcInt_mboxRestoreCtxt (UInt16 procId); - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ - - -#endif /* !defined (OMAP4430IPCINT_H) */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/arch/omap4430/Omap4430IpcInt.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/arch/omap4430/Omap4430IpcInt.c deleted file mode 100644 index 46b1e9f..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/arch/omap4430/Omap4430IpcInt.c +++ /dev/null @@ -1,1333 +0,0 @@ -/* - * @file Omap4430IpcInt.c - * - * @brief OMAP4430 IPC interrupts. - * Defines necessary functions for Interrupt Handling. - * - * - * @ver 02.00.00.46_alpha1 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -/* Standard headers */ -#include - -/* OSAL headers */ -#include -#include -#include - -/* OSAL and utils headers */ -#include -#include <_MultiProc.h> -#include -#include -#include -#include - -/* Hardware Abstraction Layer */ -#include <_ArchIpcInt.h> -#include <_Omap4430IpcInt.h> -#include -#include - - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ - -/*! - * @def OMAP4430_NUMPROCS - * @brief Number of processors supported on this platform - */ -#define OMAP4430_NUMPROCS 4 -/*! - * @def OMAP4430_INDEX_DSP - * @brief Dsp index. - */ -#define OMAP4430_INDEX_DSP 0 -/*! - * @def OMAP4430_INDEX_CORE1 - * @brief CORE1 index. - */ -#define OMAP4430_INDEX_CORE1 1 -/*! - * @def OMAP4430_INDEX_CORE0 - * @brief CORE0 index. - */ -#define OMAP4430_INDEX_CORE0 2 -/*! - * @def OMAP4430_INDEX_HOST - * @brief HOST index. - */ -#define OMAP4430_INDEX_HOST 3 - -/* Macro to make a correct module magic number with refCount */ -#define OMAP4430IPCINT_MAKE_MAGICSTAMP(x) \ - ((OMAP4430IPCINT_MODULEID << 12u) | (x)) - -/*! - * @def REG - * @brief Regsiter access method. - */ -#define REG(x) *((volatile UInt32 *) (x)) -#define REG32(x) (*(volatile UInt32 *) (x)) - -/* Register access method. */ -#define REG16(A) (*(volatile UInt16 *) (A)) - -/*! - * @def AINTC_BASE_ADDR - * @brief configuraion address. - */ -#define AINTC_BASE_ADDR 0x48200000 - -/*! - * @def AINTC_BASE_SIZE - * @brief size to be ioremapped. - */ -#define AINTC_BASE_SIZE 0x1000 - -/* Mailbox management values */ -/*! - * @def OMAP4430_MAILBOX_BASE - * @brief configuraion address. - */ -#define MAILBOX_BASE 0x4A0F4000 - -/*! - * @def MAILBOX_SIZE - * @brief size to be ioremapped. - */ -#define MAILBOX_SIZE 0x1000 - -/*! - * @def MAILBOX_MAXNUM - * @brief maximum number of mailbox. - */ -#define MAILBOX_MAXNUM 0x8 - -/*! - * @def MAILBOX_MESSAGE_m_OFFSET - * @brief mailbox message address Offset from the Mailbox base - * address. m = 0 to 7 => offset = 0x40 + 0x4*m - */ -#define MAILBOX_MESSAGE_m_OFFSET(m) (0x40 + (m<<2)) - -/*! - * @def MAILBOX_MESSAGE_0_OFFSET - * @brief Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_0_OFFSET 0x40 - -/*! - * @def MAILBOX_MESSAGE_1_OFFSET - * @brief Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_1_OFFSET 0x44 - -/*! - * @def MAILBOX_MESSAGE_2_OFFSET - * @brief Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_2_OFFSET 0x48 - -/*! - * @def MAILBOX_MESSAGE_3_OFFSET - * @brief Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_3_OFFSET 0x4C - -/*! - * @def MAILBOX_MESSAGE_4_OFFSET - * @brief mailbox message 4 address Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_4_OFFSET 0x50 - -/*! - * @def MAILBOX_MESSAGE_5_OFFSET - * @brief mailbox message 5 address Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_5_OFFSET 0x54 - -/*! - * @def MAILBOX_MESSAGE_6_OFFSET - * @brief mailbox message 6 address Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_6_OFFSET 0x58 - -/*! - * @def OMAP4430_MAILBOX_BASE_OFFSET - * @brief mailbox message 7 address Offset from the Mailbox base address. - */ -#define MAILBOX_MESSAGE_7_OFFSET 0x5C - -/*! - * @def MAILBOX_MSGSTATUS_m_OFFSET - * @brief mailbox message status address Offset from the Mailbox base - * address. m = 0 to 7 => offset = 0x40 + 0x4*m - */ -#define MAILBOX_MSGSTATUS_m_OFFSET(m) (0xC0 + (m<<2)) - -/*! - * @def MAILBOX_MSGSTATUS_0_OFFSET - * @brief mailbox message 0 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_0_OFFSET 0xC0 - -/*! - * @def MAILBOX_MSGSTATUS_1_OFFSET - * @brief mailbox message 1 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_1_OFFSET 0xC4 - -/*! - * @def MAILBOX_MSGSTATUS_2_OFFSET - * @brief mailbox message 2 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_2_OFFSET 0xC8 - -/*! - * @def MAILBOX_MSGSTATUS_3_OFFSET - * @brief mailbox message 3 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_3_OFFSET 0xCC - -/*! - * @def MAILBOX_MSGSTATUS_4_OFFSET - * @brief mailbox message 4 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_4_OFFSET 0xD0 - -/*! - * @def MAILBOX_MSGSTATUS_5_OFFSET - * @brief mailbox message 5 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_5_OFFSET 0xD4 - -/*! - * @def MAILBOX_MSGSTATUS_6_OFFSET - * @brief mailbox message 6 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_6_OFFSET 0xD8 - -/*! - * @def MAILBOX_MSGSTATUS_7_OFFSET - * @brief mailbox message 7 status address Offset from the Mailbox base - * address. - */ -#define MAILBOX_MSGSTATUS_7_OFFSET 0xDC - -/*! - * @def MAILBOX_IRQSTATUS_CLEAR_OFFSET - * @brief mailbox IRQSTATUS clear address Offset from the Mailbox base - * address. - */ -#define MAILBOX_IRQSTATUS_CLEAR_OFFSET 0x104 - -/*! - * @def MAILBOX_IRQENABLE_OFFSET - * @brief mailbox IRQ enable address Offset from the Mailbox base - * address. - */ -#define MAILBOX_IRQENABLE_OFFSET 0x108 - -/*! - * @def MAILBOX_IRQDISABLE_OFFSET - * @brief mailbox IRQ disable address Offset from the Mailbox base - * address. - */ -#define MAILBOX_IRQDISABLE_OFFSET 0x10C - -/*! - * @def MAILBOX_NUMBER_0 - * @brief mailbox number 0 used by CORE0 to receive interrupts from HOST. - */ -#define MAILBOX_NUMBER_0 0 -/*! - * @def MAILBOX_NUMBER_1 - * @brief mailbox number 1 used by HOST to receive interrupts from CORE0. - */ -#define MAILBOX_NUMBER_1 1 -/*! - * @def MAILBOX_NUMBER_2 - * @brief mailbox number 2 used by HOST to receive interrupts from DSP. - */ -#define MAILBOX_NUMBER_2 2 -/*! - * @def MAILBOX_NUMBER_3 - * @brief mailbox number 3 used by DSP to receive interrupts from HOST. - */ -#define MAILBOX_NUMBER_3 3 -/*! - * @def MAILBOX_NUMBER_4 - * @brief mailbox number 4 used by CORE1 to receive interrupts from CORE0/DSP. - */ -#define MAILBOX_NUMBER_4 4 - -/* Macro used when saving the mailbox context */ -#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 0x10 * (u)) - -/* Macro for size of the mailbox FIFO */ -#define OMAP4_MAILBOX_FIFO_LENGTH 4 - -/* Msg elem used to store messages from the remote proc */ -typedef struct Omap4430IpcInt_MsgListElem_tag { - List_Elem elem; - UInt32 msg; - struct Omap4430IpcInt_MsgListElem * next; - struct Omap4430IpcInt_MsgListElem * prev; -} Omap4430IpcInt_MsgListElem; - -/*! - * @brief Device specific object - * It can be populated as per device need and it is used internally in - * the device specific implementation only. - */ -typedef struct Omap4430IpcInt_Object_tag { - Atomic isrRefCount; - /*!< ISR Reference count */ - Atomic asserted; - /*!< Indicates receipt of interrupt from particular processor */ - UInt32 recvIntId; - /*!= 0) { - /*Registering omap4430 platform with ArchIpcInt*/ -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - ArchIpcInt_object.fxnTable = &Omap4430IpcInt_fxnTable; - ArchIpcInt_object.obj = &Omap4430IpcInt_state; - - for (i = 0; i < MultiProc_getNumProcessors(); i++ ) { - Atomic_set (&(Omap4430IpcInt_state.isrObjects [i].asserted), 1); - List_Params_init(&listParams); - Omap4430IpcInt_state.isrLists [i] = List_create(&listParams); - if (Omap4430IpcInt_state.isrLists [i] == NULL) { - status = OMAP4430IPCINT_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_setup", - status, - "Failure in List_create"); - for (i = i - 1; i >= 0; i--) { - List_delete(&Omap4430IpcInt_state.isrLists [i]); - } - break; - } - } - - /* Calling MultiProc APIs here in setup save time in ISR and makes - * it small and fast with less overhead. This can be done - * regardless of status. - */ - Omap4430IpcInt_state.procIds [OMAP4430_INDEX_DSP] = - MultiProc_getId ("DSP"); - Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE1] = - MultiProc_getId ("CORE1"); - Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE0] = - MultiProc_getId ("CORE0"); - Omap4430IpcInt_state.maxProcessors = MultiProc_getNumProcessors(); - - if (status >= 0) { - /* - * Clear any pending mailbox messages and reset IRQ Enable Bits - * Mailbox 0 is used by CORE0 for receiving interrupts from HOST - * Mailbox 1 is used by HOST for receiving interrupts from CORE0 - * Mailbox 2 is used by HOST for receiving interrupts from DSP - * Mailbox 3 is used by DSP for receiving interrupts from HOST - * Mailbox 4 is used by CORE1 for receiving interrupts from CORE0/DSP - * - */ - // TBD: Can we just do a reset on the mailbox? - // Is anyone else using these mailboxes? - /* Clear the messages in the CORE0->HOST mailbox */ - while ((REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MSGSTATUS_m_OFFSET(1))) && (max_tries-- > 0)) { - /* Read the register to get the msg from the mailbox FIFO */ - msg = REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MESSAGE_m_OFFSET(1)); - } - /* Clear the messages in the HOST->CORE0 mailbox */ - max_tries = OMAP4_MAILBOX_FIFO_LENGTH; - while ((REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MSGSTATUS_m_OFFSET(0))) && (max_tries-- > 0)) { - /* Read the register to get the msg from the mailbox FIFO */ - msg = REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MESSAGE_m_OFFSET(0)); - } - /* Clear the messages in the DSP->HOST mailbox */ - max_tries = OMAP4_MAILBOX_FIFO_LENGTH; - while ((REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MSGSTATUS_m_OFFSET(2))) && (max_tries-- > 0)) { - /* Read the register to get the msg from the mailbox FIFO */ - msg = REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MESSAGE_m_OFFSET(2)); - } - /* Clear the messages in the HOST->DSP mailbox */ - max_tries = OMAP4_MAILBOX_FIFO_LENGTH; - while ((REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MSGSTATUS_m_OFFSET(3))) && (max_tries-- > 0)) { - /* Read the register to get the msg from the mailbox FIFO */ - msg = REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MESSAGE_m_OFFSET(3)); - } - /* The below seems to be needed for OMAP5 Virtio for - * slaying/restarting syslink properly - */ - /* Disables interrupts from HOST->CORE0 */ - SET_BIT(REG(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_IRQDISABLE_OFFSET + 0x20), - ((MAILBOX_NUMBER_0) << 1)); - /* Disables interrupts from HOST->DSP */ - SET_BIT(REG(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_IRQDISABLE_OFFSET + 0x20), - ((MAILBOX_NUMBER_3) << 1)); - - /* Clear the messages in the CORE0->CORE1 mailbox */ - max_tries = OMAP4_MAILBOX_FIFO_LENGTH; - while ((REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MSGSTATUS_m_OFFSET(4))) && (max_tries-- > 0)) { - /* Read the register to get the msg from the mailbox FIFO */ - msg = REG32(Omap4430IpcInt_state.mailboxBase + \ - MAILBOX_MESSAGE_m_OFFSET(4)); - } - - ArchIpcInt_object.isSetup = TRUE; - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "Omap4430IpcInt_setup"); -} - - -/*! - * @brief Function to finalize the Omap4430IpcInt module - * - * @sa Omap4430IpcInt_setup - */ -Void -Omap4430IpcInt_destroy (Void) -{ - Memory_UnmapInfo unmapInfo; - UInt32 i = 0; - - GT_0trace (curTrace, GT_ENTER, "Omap4430IpcInt_destroy"); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - - ArchIpcInt_object.isSetup = FALSE; - ArchIpcInt_object.obj = NULL; - ArchIpcInt_object.fxnTable = NULL; - - for (i = 0; i < MultiProc_getNumProcessors(); i++ ) { - if (Omap4430IpcInt_state.isrLists [i]) { - List_delete(&Omap4430IpcInt_state.isrLists [i]); - } - } - - if (Omap4430IpcInt_state.archCoreCmBase != (UInt32) NULL) { - unmapInfo.addr = Omap4430IpcInt_state.archCoreCmBase; - unmapInfo.size = AINTC_BASE_SIZE; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - Omap4430IpcInt_state.archCoreCmBase = (UInt32) NULL; - } - - if (Omap4430IpcInt_state.mailboxBase != (UInt32) NULL) { - unmapInfo.addr = Omap4430IpcInt_state.mailboxBase; - unmapInfo.size = MAILBOX_SIZE; - unmapInfo.isCached = FALSE; - Memory_unmap (&unmapInfo); - Omap4430IpcInt_state.mailboxBase = (UInt32) NULL; - } - - GT_0trace (curTrace, GT_ENTER, "Omap4430IpcInt_destroy"); -} - - -/*! - * @brief Function to register the interrupt. - * - * @param procId destination procId. - * @param intId interrupt id. - * @param fxn callback function to be called on receiving interrupt. - * @param fxnArgs arguments to the callback function. - * - * @sa Omap4430IpcInt_interruptEnable - */ - -Int32 -Omap4430IpcInt_interruptRegister (UInt16 procId, - UInt32 intId, - ArchIpcInt_CallbackFxn fxn, - Ptr fxnArgs) -{ - Int32 status = OMAP4430IPCINT_SUCCESS; - OsalIsr_Params isrParams; - - GT_4trace (curTrace, - GT_ENTER, - "Omap4430IpcInt_interruptRegister", - procId, - intId, - fxn, - fxnArgs); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - GT_assert(curTrace, (procId < MultiProc_MAXPROCESSORS)); - GT_assert(curTrace, (fxn != NULL)); - - - /* This sets the refCount variable is not initialized, upper 16 bits is - * written with module Id to ensure correctness of refCount variable. - */ - Atomic_cmpmask_and_set ( - &Omap4430IpcInt_state.isrObjects [procId].isrRefCount, - OMAP4430IPCINT_MAKE_MAGICSTAMP(0), - OMAP4430IPCINT_MAKE_MAGICSTAMP(0)); - - /* This is a normal use-case, so should not be inside - * SYSLINK_BUILD_OPTIMIZE. - */ - if (Atomic_inc_return (&Omap4430IpcInt_state.isrObjects [procId].isrRefCount) - != OMAP4430IPCINT_MAKE_MAGICSTAMP(1u)) { - /*! @retval OMAP4430IPCINT_S_ALREADYREGISTERED ISR already registered! - */ - status = OMAP4430IPCINT_S_ALREADYREGISTERED; - GT_0trace (curTrace, - GT_2CLASS, - "ISR already registered!"); - } - else { - Omap4430IpcInt_state.isrObjects [procId].fxn = fxn; - Omap4430IpcInt_state.isrObjects [procId].fxnArgs = fxnArgs; - Omap4430IpcInt_state.isrObjects [procId].recvIntId = intId; - /* Enable hardware interrupt. */ - Omap4430IpcInt_interruptEnable (procId, intId); - } - - Atomic_cmpmask_and_set (&Omap4430IpcInt_state.isrRefCount, - OMAP4430IPCINT_MAKE_MAGICSTAMP(0), - OMAP4430IPCINT_MAKE_MAGICSTAMP(0)); - - /* This is a normal use-case, so should not be inside - * SYSLINK_BUILD_OPTIMIZE. - */ - if ( Atomic_inc_return (&Omap4430IpcInt_state.isrRefCount) - != OMAP4430IPCINT_MAKE_MAGICSTAMP(1u)) { - /*! @retval OMAP4430IPCINT_S_ALREADYREGISTERED Generic ISR already set! - */ - status = OMAP4430IPCINT_S_ALREADYREGISTERED; - GT_0trace (curTrace, - GT_2CLASS, - "Generic ISR already set !"); - } - else { - isrParams.sharedInt = FALSE; - isrParams.checkAndClearFxn = &_Omap4430IpcInt_checkAndClearFunc; - isrParams.fxnArgs = NULL; - isrParams.intId = intId; - Omap4430IpcInt_state.isrHandle = OsalIsr_create (&_Omap4430IpcInt_isr, - NULL, - &isrParams); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (Omap4430IpcInt_state.isrHandle == NULL) { - /*! @retval OMAP4430IPCINT_E_FAIL OsalIsr_create failed */ - status = OMAP4430IPCINT_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_interruptRegister", - status, - "OsalIsr_create failed"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - status = OsalIsr_install (Omap4430IpcInt_state.isrHandle); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_interruptRegister", - status, - "OsalIsr_install failed"); - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - GT_1trace (curTrace, GT_LEAVE, "Omap4430IpcInt_interruptRegister", status); - - /*! @retval OMAP4430IPCINT_SUCCESS Interrupt successfully registered */ - return status; -} - -/*! - * @brief Function to Save context. - * - * @param procId The procId associated with the mailbox context being - * saved. - * - * @sa Omap4430IpcInt_mbxRestoreCtxt - */ - -Int32 -Omap4430IpcInt_mboxSaveCtxt (UInt16 procId) -{ - Int32 status = OMAP4430IPCINT_SUCCESS; - UInt32 i = 0; - - if (Omap4430IpcInt_state.mailboxBase == NULL) { - status = OMAP4430IPCINT_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_mboxSaveCtxt", - status, - "Unable to map the Mailbox memory in SaveCtxt"); - } - else { - for (i = 0; i < 4; i++) { - mailbox_context[i] = REG32(Omap4430IpcInt_state.mailboxBase + \ - OMAP4_MAILBOX_IRQENABLE(i)); - } - Omap4430IpcInt_interruptDisable(procId, 58); - } - return status; -} - -/*! - * @brief Function to Restore context. - * - * @param procId The procId associated with the mailbox context being - * restored. - * - * @sa Omap4430IpcInt_mbxSaveCtxt - */ - -Int32 -Omap4430IpcInt_mboxRestoreCtxt (UInt16 procId) -{ - Int32 status = OMAP4430IPCINT_SUCCESS; - UInt32 i = 0; - - if (Omap4430IpcInt_state.mailboxBase == NULL) { - status = OMAP4430IPCINT_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_mboxRestoreCtxt", - status, - "Unable to map the Mailbox memory in RestoreCtxt"); - } - else { - /* Set to Auto Idle mode*/ - REG(Omap4430IpcInt_state.mailboxBase + 0x10) = 0x8; - - for (i = 0; i < 4; i++) { - REG32(Omap4430IpcInt_state.mailboxBase + \ - OMAP4_MAILBOX_IRQENABLE(i)) = mailbox_context[i]; - } - - Omap4430IpcInt_interruptEnable(procId, 58); - } - - return status; -} - - -/*! - * @brief Function to unregister interrupt. - * - * @param procId destination procId - * - * @sa Omap4430IpcInt_interruptRegister - */ -Int32 -Omap4430IpcInt_interruptUnregister (UInt16 procId) -{ - Int32 status = OMAP4430IPCINT_SUCCESS; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - Int32 tmpStatus = OMAP4430IPCINT_SUCCESS; -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace,GT_ENTER,"Omap4430IpcInt_interruptUnregister", procId); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - GT_assert(curTrace, (procId < MultiProc_MAXPROCESSORS)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if ( Atomic_cmpmask_and_lt ( - &Omap4430IpcInt_state.isrObjects [procId].isrRefCount, - OMAP4430IPCINT_MAKE_MAGICSTAMP(0), - OMAP4430IPCINT_MAKE_MAGICSTAMP(1)) - == TRUE) { - /*! @retval OMAP4430IPCINT_E_INVALIDSTATE ISR was not registered */ - status = OMAP4430IPCINT_E_INVALIDSTATE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_interruptUnregister", - status, - "ISR was not registered!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* This is a normal use-case, so should not be inside - * SYSLINK_BUILD_OPTIMIZE. - */ - if (Atomic_dec_return(&Omap4430IpcInt_state.isrObjects[procId].isrRefCount) - == OMAP4430IPCINT_MAKE_MAGICSTAMP(0)) { - Omap4430IpcInt_state.isrObjects [procId].fxn = NULL; - Omap4430IpcInt_state.isrObjects [procId].fxnArgs = NULL; - Omap4430IpcInt_state.isrObjects [procId].recvIntId = -1u; - - /* Disable hardware interrupt. */ - Omap4430IpcInt_interruptDisable (procId, - Omap4430IpcInt_state.isrObjects [procId].recvIntId); - } - - if ( Atomic_dec_return (&Omap4430IpcInt_state.isrRefCount) - == OMAP4430IPCINT_MAKE_MAGICSTAMP(0)) { - status = OsalIsr_uninstall (Omap4430IpcInt_state.isrHandle); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_interruptUnregister", - status, - "OsalIsr_uninstall failed"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - tmpStatus = -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - OsalIsr_delete (&(Omap4430IpcInt_state.isrHandle)); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if ((status >= 0) && (tmpStatus < 0)) { - status = tmpStatus; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_interruptUnregister", - status, - "OsalIsr_delete failed"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "Omap4430IpcInt_interruptUnregister", - status); - - /*! @retval OMAP4430IPCINT_SUCCESS Interrupt successfully unregistered */ - return status; -} - -/*! - * @brief Function to enable the specified interrupt - * - * @param procId Remote processor ID - * @param intId interrupt id - * - * @sa Omap4430IpcInt_interruptDisable - */ -Void -Omap4430IpcInt_interruptEnable (UInt16 procId, UInt32 intId) -{ - GT_2trace (curTrace, GT_ENTER, "Omap4430IpcInt_interruptEnable", - procId, intId); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - GT_assert (curTrace, (procId < MultiProc_MAXPROCESSORS)); - - if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_DSP]) { - /* - * Mailbox 2 is used by HOST for receiving interrupts from DSP - * Mailbox 3 is used by DSP for receiving interrupts from HOST - * - */ - SET_BIT(REG(Omap4430IpcInt_state.mailboxBase + MAILBOX_IRQENABLE_OFFSET), - ( (MAILBOX_NUMBER_2) << 1)); - } - else if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE1]) { - /* - * Do nothing. Interrupt is handled through CORE0 interrupt. - */ - } - else if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE0]) { - /* - * Mailbox 1 is used by HOST for receiving interrupts from CORE0 - * Mailbox 0 is used by CORE0 for receiving interrupts from HOST - * - */ - SET_BIT(REG(Omap4430IpcInt_state.mailboxBase + MAILBOX_IRQENABLE_OFFSET), - ( (MAILBOX_NUMBER_1) << 1)); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - else { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_interruptEnable", - OMAP4430IPCINT_E_FAIL, - "Invalid procId specified"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "Omap4430IpcInt_interruptEnable"); -} - - -/*! - * @brief Function to disable the specified interrupt - * - * @param procId Remote processor ID - * @param intId interrupt id - * - * @sa Omap4430IpcInt_interruptEnable - */ -Void -Omap4430IpcInt_interruptDisable (UInt16 procId, UInt32 intId) -{ - GT_2trace (curTrace, GT_ENTER, "Omap4430IpcInt_interruptDisable", - procId, intId); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - GT_assert (curTrace, (procId < MultiProc_MAXPROCESSORS)); - - if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_DSP]) { - /* - * Mailbox 2 is used by HOST for receiving interrupts from DSP - * Mailbox 3 is used by DSP for receiving interrupts from HOST - * - */ - SET_BIT(REG(Omap4430IpcInt_state.mailboxBase + MAILBOX_IRQDISABLE_OFFSET), - ( (MAILBOX_NUMBER_2) << 1)); - } - else if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE1]) { - /* - * Do nothing. Interrupt is handled through CORE0 interrupt. - */ - } - else if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE0]) { - /* - * Mailbox 1 is used by HOST for receiving interrupts from CORE0 - * Mailbox 0 is used by CORE0 for receiving interrupts from HOST - * - */ - SET_BIT(REG(Omap4430IpcInt_state.mailboxBase + MAILBOX_IRQDISABLE_OFFSET), - ( (MAILBOX_NUMBER_1) << 1)); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - else { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_interruptDisable", - OMAP4430IPCINT_E_FAIL, - "Invalid procId specified"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "Omap4430IpcInt_interruptDisable"); -} - - -/*! - * @brief Function to wait for interrupt to be cleared. - * - * @param procId Remote processor ID - * @param intId interrupt id - * - * @sa Omap4430IpcInt_sendInterrupt - */ -Int32 -Omap4430IpcInt_waitClearInterrupt (UInt16 procId, UInt32 intId) -{ - Int32 status = OMAP4430IPCINT_SUCCESS; - int max_tries = 10; - - GT_2trace (curTrace,GT_ENTER,"Omap4430IpcInt_waitClearInterrupt", - procId, intId); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - GT_assert (curTrace, (procId < MultiProc_MAXPROCESSORS)); - - if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_DSP]) { - /* Wait for DSP to clear the previous interrupt */ - do { - if( !( REG32(( Omap4430IpcInt_state.mailboxBase - + MAILBOX_MSGSTATUS_3_OFFSET)) - & 0x3F )) - break; - } while(--max_tries); - if (max_tries == 0) { - GT_0trace(curTrace, GT_4CLASS," ** Error - DSP not clearing previous interrupt"); - } - } - else if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE0]) { - /* Wait for CORE0 to clear the previous interrupt */ - do { - if(! (REG32((Omap4430IpcInt_state.mailboxBase - + MAILBOX_MSGSTATUS_0_OFFSET)) - & 0x3F )) - break; - } while(--max_tries); - if (max_tries == 0) { - GT_0trace(curTrace, GT_4CLASS," ** Error - Core 0 not clearing previous interrupt"); - } - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - else { - /*! @retval OMAP4430IPCINT_E_FAIL Invalid procId specified */ - status = OMAP4430IPCINT_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_waitClearInterrupt", - status, - "Invalid procId specified"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace,GT_LEAVE,"Omap4430IpcInt_waitClearInterrupt", status); - - /*! @retval OMAP4430IPCINT_SUCCESS Wait for interrupt clearing successfully - completed. */ - return status ; -} - - -/*! - * @brief Function to send a specified interrupt to the DSP. - * - * @param procId Remote processor ID - * @param intId interrupt id - * @param value Value to be sent with the interrupt - * - * @sa Omap4430IpcInt_sendInterrupt - */ -Int32 -Omap4430IpcInt_sendInterrupt (UInt16 procId, UInt32 intId, UInt32 value) -{ - Int32 status = OMAP4430IPCINT_SUCCESS; - GT_3trace (curTrace, GT_ENTER, "Omap4430IpcInt_sendInterrupt", - procId, intId, value); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - GT_assert (curTrace, (procId < MultiProc_MAXPROCESSORS)); - - if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_DSP]) { - /* - * Mailbox 2 is used by HOST for receiving interrupts from DSP - * Mailbox 3 is used by DSP for receiving interrupts from HOST - * - */ - REG32(Omap4430IpcInt_state.mailboxBase + MAILBOX_MESSAGE_3_OFFSET) = value; - } else if (procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE0]|| - procId == Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE1]) { - /* - * Mailbox 1 is used by HOST for receiving interrupts from CORE0 - * Mailbox 0 is used by CORE0 for receiving interrupts from DSP - * - */ - REG32(Omap4430IpcInt_state.mailboxBase + MAILBOX_MESSAGE_0_OFFSET) = value; - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - else { - /*! @retval OMAP4430IPCINT_E_FAIL Invalid procId specified */ - status = OMAP4430IPCINT_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_sendInterrupt", - status, - "Invalid procId specified"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "Omap4430IpcInt_sendInterrupt", status); - - /*! @retval OMAP4430IPCINT_SUCCESS Interrupt successfully sent */ - return status; -} - - -/*! - * @brief Function to clear the specified interrupt received from the - * remote core. - * - * @param procId Remote processor ID - * @param intId interrupt id - * - * @sa Omap4430IpcInt_sendInterrupt - */ -UInt32 -Omap4430IpcInt_clearInterrupt (UInt16 mboxNum) -{ - UInt32 retVal = 0; - - GT_1trace (curTrace,GT_ENTER,"Omap4430IpcInt_clearInterrupt", mboxNum); - - GT_assert (curTrace,(ArchIpcInt_object.isSetup == TRUE)); - - if (mboxNum < MAILBOX_MAXNUM) { - /* Read the register to get the entry from the mailbox FIFO */ - retVal = REG32(Omap4430IpcInt_state.mailboxBase - + MAILBOX_MESSAGE_m_OFFSET(mboxNum)); - - /* Clear the IRQ status. - * If there are more in the mailbox FIFO, it will re-assert. - */ - SET_BIT(REG((Omap4430IpcInt_state.mailboxBase - + MAILBOX_IRQSTATUS_CLEAR_OFFSET)), - (mboxNum<<1)); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - else { - GT_setFailureReason (curTrace, - GT_4CLASS, - "Omap4430IpcInt_clearInterrupt", - OMAP4430IPCINT_E_FAIL, - "Invalid mailbox number specified"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "Omap4430IpcInt_clearInterrupt"); - - /*! @retval Value Value received with the interrupt. */ - return retVal; -} - - -/* - * Instead of constantly allocating and freeing the msg structures - * we just cache a few of them, and recycle them instead. - */ -#define CACHE_NUM 20 -static Omap4430IpcInt_MsgListElem *msg_cache; -static int num_msg = 0; - -static Omap4430IpcInt_MsgListElem *get_msg() -{ - Omap4430IpcInt_MsgListElem *msg; - IArg key = NULL; - - key = Gate_enterSystem(); - msg = msg_cache; - if (msg != NULL) { - msg_cache = (Omap4430IpcInt_MsgListElem *)msg_cache->next; - num_msg--; - Gate_leaveSystem(key); - } else { - Gate_leaveSystem(key); - msg = Memory_alloc(NULL, sizeof(Omap4430IpcInt_MsgListElem), 0, NULL); - } - return(msg); -} - -static void put_msg(Omap4430IpcInt_MsgListElem * msg) -{ - IArg key = NULL; - key = Gate_enterSystem(); - if (num_msg >= CACHE_NUM) { - Gate_leaveSystem(key); - Memory_free(NULL, msg, sizeof(*msg)); - } else { - msg->next = (struct Omap4430IpcInt_MsgListElem *)msg_cache; - msg_cache = msg; - num_msg++; - Gate_leaveSystem(key); - } - return; -} - - -/*! - * @brief Function to check and clear the remote proc interrupt - * - * @param arg Optional argument to the function. - * - * @sa _Omap4430IpcInt_isr - */ -static -Bool -_Omap4430IpcInt_checkAndClearFunc (Ptr arg) -{ - UInt16 procId; - UInt32 msg; - Omap4430IpcInt_MsgListElem * elem = NULL; - - if( REG32( Omap4430IpcInt_state.mailboxBase - + MAILBOX_MSGSTATUS_1_OFFSET) != 0 ){ - msg = Omap4430IpcInt_clearInterrupt (1); - procId = Omap4430IpcInt_state.procIds [OMAP4430_INDEX_CORE0]; - /* This is a message from CORE0, put the message in CORE0's list */ - elem = get_msg(); - if (elem) { - elem->msg = msg; - List_put(Omap4430IpcInt_state.isrLists[procId], (List_Elem *)elem); - } - } - if( REG32( Omap4430IpcInt_state.mailboxBase - + MAILBOX_MSGSTATUS_2_OFFSET) != 0 ){ - msg = Omap4430IpcInt_clearInterrupt (2); - procId = Omap4430IpcInt_state.procIds [OMAP4430_INDEX_DSP]; - /* This is a message from DSP, put the message in DSP's list */ - elem = get_msg(); - if (elem) { - elem->msg = msg; - List_put(Omap4430IpcInt_state.isrLists[procId], (List_Elem *)elem); - } - } - - /* This is not a shared interrupt, so interrupt has always occurred */ - /*! @retval TRUE Interrupt has occurred. */ - return (TRUE); -} - - -/*! - * @brief Interrupt Service Routine for Omap4430IpcInt module - * - * @param arg Optional argument to the function. - * - * @sa _Omap4430IpcInt_checkAndClearFunc - */ -static -Bool -_Omap4430IpcInt_isr (Ptr ref) -{ - UInt16 i = 0; - Omap4430IpcInt_MsgListElem * elem = NULL; - GT_1trace (curTrace, GT_ENTER, "_Omap4430IpcInt_isr", ref); - - for (i = 0 ; i < Omap4430IpcInt_state.maxProcessors ; i++) { - if ((elem = List_get(Omap4430IpcInt_state.isrLists [i])) != NULL) { - /*Calling the particular ISR */ - GT_assert(curTrace,(Omap4430IpcInt_state.isrObjects [i].fxn != NULL)); - if (Omap4430IpcInt_state.isrObjects [i].fxn != NULL) { - Omap4430IpcInt_state.isrObjects [i].fxn (elem->msg, - Omap4430IpcInt_state.isrObjects [i].fxnArgs); - } - put_msg(elem); - } - } - - GT_1trace (curTrace, GT_LEAVE, "_Omap4430IpcInt_isr", TRUE); - - /*! @retval TRUE Interrupt has been handled. */ - return (TRUE); -} - -#if defined (__cplusplus) -} -#endif diff --git a/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/readrprc.c b/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/readrprc.c deleted file mode 100644 index b998804..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/readrprc.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2011, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * ======== dbg-loader.c ======== - */ - -/* Standard header files */ -#include -#include -#include - -#include - -#include "_rprcloader.h" -#include "rprcfmt.h" -#include - -static int dump_image(Processor_Handle handle, void * data, int size); - -static struct rproc_fw_resource * rprc_res_table = NULL; -static int rprc_res_table_len = 0; - -/* - * ======== main ======== - */ -int load_firmware_file(Processor_Handle handle, char * filename) -{ - FILE * fp; - struct stat st; - void * data; - int size; - int status; - - if (filename == NULL) { - fprintf(stderr, "Usage: invalid filename\n"); - return (-1); - } - - if ((fp = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "Param: could not open: %s\n", filename); - return (-2); - } - - if (fstat(fileno(fp), &st) != 0) { - fprintf(stderr, "fstat failed with errno=%d\n", errno); - return -1; - } - size = st.st_size; - data = malloc(size); - if (data == NULL) { - fprintf(stderr, "Malloc failure in load_firmware_file\n"); - fclose(fp); - return -1; - } - fread(data, 1, size, fp); - fclose(fp); - - status = dump_image(handle, data, size); - - free(data); - - return status; -} - -int unload_firmware_file(void) -{ - if (rprc_res_table) { - free(rprc_res_table); - rprc_res_table = NULL; - rprc_res_table_len = 0; - } - - return 0; -} - -int get_resource_info(u32 type, char *name, u64 *da, u64 *pa, u32 *len) -{ - int i = 0; - if (rprc_res_table == NULL) - return (-1); - - for (i = 0; i < rprc_res_table_len; i++) { - if (rprc_res_table[i].type == type && !strcmp((char *)rprc_res_table[i].name, name)) - break; - } - if (i == rprc_res_table_len) - return (-2); - - *da = rprc_res_table[i].da; - *pa = rprc_res_table[i].pa; - *len = rprc_res_table[i].len; - return 0; -} -/* - * ======== dump_resources ======== - */ -static void dump_resources(Processor_Handle handle, struct rproc_fw_section * s) -{ - struct rproc_fw_resource * res = (struct rproc_fw_resource * )s->content; - int i; - u32 pa; - - printf("resource table: %d\n", sizeof(struct rproc_fw_resource)); - rprc_res_table = malloc(sizeof(struct rproc_fw_resource) * s->len); - rprc_res_table_len = s->len; - for (i = 0; i < s->len / sizeof(struct rproc_fw_resource); i++) { - /* Lookup PA */ - if (res[i].type != RSC_DEVMEM) { - Processor_translateAddr (handle, &pa, res[i].da); - res[i].pa = (u64)pa; - } - printf("resource: %d, da: 0x%llx, pa: 0x%llx,len: %d, name: %s\n", - res[i].type, res[i].da, res[i].pa, res[i].len, res[i].name); - memcpy(&rprc_res_table[i], &res[i], sizeof(struct rproc_fw_resource)); - } - printf("\n"); -} - -/* - * ======== dump_image ======== - */ -static int dump_image(Processor_Handle handle, void * data, int size) -{ - struct rproc_fw_header *hdr; - struct rproc_fw_section *s; - - hdr = (struct rproc_fw_header *)data; - - /* check that magic is what we expect */ - if (memcmp(hdr->magic, RPROC_FW_MAGIC, sizeof(hdr->magic))) { - fprintf(stderr, "invalid magic number: %.4s\n", hdr->magic); - return -1; - } - - /* baseimage information */ - printf("magic number %.4s\n", hdr->magic); - printf("header version %d\n", hdr->version); - printf("header size %d\n", hdr->header_len); - printf("header data\n%s\n", hdr->header); - - /* get the first section */ - s = (struct rproc_fw_section *)(hdr->header + hdr->header_len); - - while ((u8 *)s < (u8 *)(data + size)) { - printf("section: %d, address: 0x%llx, size: 0x%x\n", s->type, - s->da, s->len); - - if (s->type == FW_RESOURCE) { - dump_resources(handle, s); - } - - rprcloader_copy((u32)s->da, (u32)&s->content, (u32)s->len); - - s = ((void *)s->content) + s->len; - } - - return 0; -} diff --git a/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcfmt.h b/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcfmt.h deleted file mode 100644 index e25ce21..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcfmt.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2011, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _RPROCFMT_H_ -#define _RPROCFMT_H_ - -#include -#ifndef _U32 -#define _U32 -typedef unsigned int u32; -#endif -typedef unsigned long long u64; -typedef unsigned char u8; -#define __packed __attribute__ ((packed)) - -int load_firmware_file(Processor_Handle handle, char * filename); - -int unload_firmware_file(void); - -int get_resource_info(u32 type, char *name, u64 *da, u64 *pa, u32 *len); - -/** - * The following enums and structures define the binary format of the images - * we load and run the remote processors with. - * - * The binary format is as follows: - * - * struct { - * char magic[4] = { 'R', 'P', 'R', 'C' }; - * u32 version; - * u32 header_len; - * char header[...] = { header_len bytes of unformatted, textual header }; - * struct sections { - * u32 type; - * u64 da; - * u32 len; - * u8 content[...] = { len bytes of binary data }; - * } [ no limit on number of sections ]; - * } __packed; - */ - -#define RPROC_FW_MAGIC "RPRC" - -enum rproc_fw_resource_type { - RSC_CARVEOUT = 0, - RSC_DEVMEM = 1, - RSC_DEVICE = 2, - RSC_IRQ = 3, - RSC_TRACE = 4, - RSC_BOOTADDR = 5, - RSC_CRASHDUMP = 6, - RSC_SUSPENDADDR = 7, -}; - -enum rproc_fw_section_type { - FW_RESOURCE = 0, - FW_TEXT = 1, - FW_DATA = 2, - FW_MMU = 3, - FW_SIGNATURE = 4, -}; - -struct rproc_fw_resource { - u32 type; - u64 da; - u64 pa; - u32 len; - u32 flags; - u8 name[48]; -} __packed; - -struct rproc_fw_section { - u32 type; - u64 da; - u32 len; - char content[0]; -} __packed; - -struct rproc_fw_header { - char magic[4]; - u32 version; - u32 header_len; - char header[0]; -} __packed; - -#endif diff --git a/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcloader.c b/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcloader.c deleted file mode 100644 index e7cce45..0000000 --- a/qnx/src/ipc3x_dev/ti/syslink/procMgr/hlos/knl/loaders/rprc/rprcloader.c +++ /dev/null @@ -1,1319 +0,0 @@ -/* - * @file rprcoader.c - * - * @brief File-based rprc loader implementation - * - * This rprc loader opens, parses and loads the rprc file that is - * present in the master file system, onto the slave processor. - * - * @Example - * @code - * rprcloader_Handle loaderHandle = NULL; - * rprcloader_Config loaderConfig; - * rprcloader_Params loaderParams; - * - * rprcloader_getConfig (&loaderConfig); - * status = rprcloader_setup (&loaderConfig); - * - * rprcloader_Params_init (NULL, &loaderParams); - * loaderHandle = rprcloader_create (procId, &loaderParams); - * - * rprcloader_delete (&loaderHandle); - * rprcloader_destroy (); - * @endcode - * - * - * @ver 02.00.00.46_alpha1 - * - * ============================================================================ - * - * Copyright (c) 2008-2009, Texas Instruments Incorporated - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * - */ - - -/* Standard headers */ -#include - -/* OSAL & Utils headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Module level headers */ -#include -#include -#include -#include <_rprcloader.h> -#include -#include <_ProcMgr.h> -#include -#include -#include <_MultiProc.h> - -#include "rprcfmt.h" - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* ============================================================================= - * Macros and types - * ============================================================================= - */ -/* Macro to make a correct module magic number with refCount */ -#define LOADER_MAKE_MAGICSTAMP(x) ((LOADER_MODULEID << 12u) | (x)) - -#define START_SUFFIX "_Start" -#define END_SUFFIX "_End" -#define START_SUFFIX_LEN 6 -#define END_SUFFIX_LEN 4 - -/*! - * @brief rprcloader Module state object - */ -typedef struct rprcloader_ModuleObject_tag { - Atomic refCount; - /*!< Reference count */ - UInt32 configSize; - /*!< Size of configuration structure */ - rprcloader_Config cfg; - /*!< rprcloader configuration structure */ - rprcloader_Config defCfg; - /*!< Default module configuration */ - Bool isSetup; - /*!< Indicates whether the rprcloader module is setup. */ - rprcloader_Handle loaderHandles [MultiProc_MAXPROCESSORS]; - /*!< Loader handle array. */ - IGateProvider_Handle gateHandle; - /*!< Handle of gate to be used for local thread safety */ - Ptr osalDrvHandle; - /*!< OsalDriver handle for rprcloader */ -} rprcloader_ModuleObject; - -/*! - * @brief Internal rprcloader instance object. - */ -typedef struct _rprcloader_Object_tag { - rprcloader_Params params; - /*!< Instance parameters (configuration values) */ - String fileName; - /*!< Name of the file currently loaded. */ - Processor_Handle procHandle; - /*!< Handle to the Processor instance. */ - ProcMgr_Handle pmHandle; - /*!< Handle to the ProcMgr instance. */ - Processor_ProcArch procArch; - /*!< Processor architecture */ - Ptr fileDesc; - /*!< File object for the slave base image file. */ -} _rprcloader_Object; - - -/* ============================================================================= - * Globals - * ============================================================================= - */ -/*! - * @var rprcloader_state - * - * @brief rprcloader state object variable - */ -#if !defined(SYSLINK_BUILD_DEBUG) -static -#endif /* if !defined(SYSLINK_BUILD_DEBUG) */ -rprcloader_ModuleObject rprcloader_state = -{ - .isSetup = FALSE, - .configSize = sizeof (rprcloader_Config), - .gateHandle = NULL, - .osalDrvHandle = NULL -}; - -/* - * TBD: Set rprcloader_Object for DLIF functions, since CGT loader doesn't - * handle instances. - * This requires that the loading can only happen sequentially, one at a time. - */ -rprcloader_Object * rprcloader_Object_g = NULL; - -/* ============================================================================= - * Internal implementations of client Provided Functions - * ============================================================================= - */ - -/* ----------------------------------------------------------------------------- - * File I/O Interface - * - * The client side of the loader must provide basic file I/O capabilities so - * that the core loader has random access into any file that it is asked to - * load. - * ----------------------------------------------------------------------------- - */ - - -/* ----------------------------------------------------------------------------- - * Target Memory Access / Write Services - * - * To complete the loading of an object segment, the segment may need to be - * relocated before it is actually written to target memory in the space that - * was allocated for it. - * - * The client side of the loader provides the functions in this section to help - * complete the process of loading an object segment. - * - * These functions help to make the core loader truly independent of - * whether it is running on the host or target architecture and how the - * client provides for reading/writing from/to target memory. - * ----------------------------------------------------------------------------- - */ -/*! - * @brief Function to copy data into the provided segment and making it - * available to generic RPRC parser. - * Memory for buffer is allocated in this function. - * - * @param clientHandle Handle to the client loader object. - * @param memReq Memory request for this copy - * - * @sa rprcloaderTrgWrite_write - */ -Int -rprcloader_copy (UInt32 targetAddr, UInt32 dataAddr, UInt32 numBytes) -{ - Int status = LOADER_SUCCESS; - Char * sectData; - _rprcloader_Object * rprcloaderObject; - ProcMgr_AddrInfo aInfo; - UInt32 dstAddr; - - GT_3trace (curTrace, GT_ENTER, "rprcloaderTrgWrite_copy", - targetAddr, dataAddr, numBytes); - - /* TBD: temporary, until DLOAD loader passes back this object */ - GT_assert (curTrace, (rprcloader_Object_g != NULL)); - - rprcloaderObject = (_rprcloader_Object *) rprcloader_Object_g->rprcloaderObject; - GT_assert (curTrace, (rprcloaderObject != NULL)); - - /* numBytes may be 0 if a section is of size 0. */ - if (numBytes != 0) { - /* Translates slave phys to master physical address: */ - status = Processor_translateAddr (rprcloaderObject->procHandle, - &dstAddr, - (UInt32)targetAddr); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloaderTrgWrite_copy", - status, - "Processor_translateAddr failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - aInfo.addr [ProcMgr_AddrType_MasterPhys] = dstAddr; - aInfo.addr [ProcMgr_AddrType_SlaveVirt] = targetAddr; - aInfo.size = numBytes; - aInfo.isCached = FALSE; - /* - * Map master physical address to master virtual: this does NOT - * program the MMU: - */ - status = _ProcMgr_map (rprcloaderObject->pmHandle, - ( ProcMgr_MASTERKNLVIRT - | ProcMgr_SLAVEVIRT), - &aInfo, - ProcMgr_AddrType_MasterPhys); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloaderTrgWrite_copy", - status, - "ProcMgr_map failed!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - sectData = (Ptr) aInfo.addr [ProcMgr_AddrType_MasterKnlVirt]; - memcpy(sectData, (Ptr)dataAddr, numBytes); - status = _ProcMgr_unmap(rprcloaderObject->pmHandle, - (ProcMgr_MASTERKNLVIRT - | ProcMgr_SLAVEVIRT), - &aInfo, - ProcMgr_AddrType_MasterPhys); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloaderTrgWrite_copy", - status, - "ProcMgr_unmap failed!"); - } - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - GT_3trace (curTrace, GT_LEAVE, "rprcloaderTrgWrite_copy", status, - dstAddr, numBytes); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -/* ============================================================================= - * APIs directly called by applications - * ============================================================================= - */ -/*! - * @brief Function to get the default configuration for the rprcloader - * module. - * - * This function can be called by the application to get their - * configuration parameter to rprcloader_setup filled in by the - * rprcloader module with the default parameters. If the user does - * not wish to make any change in the default parameters, this API - * is not required to be called. - * - * @param cfg Pointer to the rprcloader module configuration - * structure in which the default config is to be - * returned. - * - * @sa rprcloader_setup - */ -Void -rprcloader_getConfig (rprcloader_Config * cfg) -{ - GT_1trace (curTrace, GT_ENTER, "rprcloader_getConfig", cfg); - - GT_assert (curTrace, (cfg != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (cfg == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_getConfig", - LOADER_E_INVALIDARG, - "Argument of type (rprcloader_Config *) passed " - "is null!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Memory_copy (cfg, - &rprcloader_state.defCfg, - sizeof (rprcloader_Config)); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "rprcloader_getConfig"); -} - - -/*! - * @brief Function to setup the rprcloader module. - * - * This function sets up the rprcloader module. This function must - * be called before any other instance-level APIs can be invoked. - * Module-level configuration needs to be provided to this - * function. If the user wishes to change some specific config - * parameters, then rprcloader_getConfig can be called to get the - * configuration filled with the default values. After this, only - * the required configuration values can be changed. If the user - * does not wish to make any change in the default parameters, the - * application can simply call rprcloader_setup with NULL - * parameters. The default parameters would get automatically used. - * - * @param cfg Optional rprcloader module configuration. If provided as - * NULL, default configuration is used. - * - * @sa rprcloader_destroy - * GateMutex_create - */ -Int -rprcloader_setup (rprcloader_Config * cfg) -{ - Int status = LOADER_SUCCESS; - rprcloader_Config tmpCfg; - Error_Block eb; - - GT_1trace (curTrace, GT_ENTER, "rprcloader_setup", cfg); - - Error_init(&eb); - - /* This sets the refCount variable is not initialized, upper 16 bits is - * written with module Id to ensure correctness of refCount variable. - */ - Atomic_cmpmask_and_set (&rprcloader_state.refCount, - LOADER_MAKE_MAGICSTAMP(0), - LOADER_MAKE_MAGICSTAMP(0)); - - if ( Atomic_inc_return (&rprcloader_state.refCount) - != LOADER_MAKE_MAGICSTAMP(1u)) { - status = LOADER_S_ALREADYSETUP; - GT_0trace (curTrace, - GT_2CLASS, - "rprcloader Module already initialized!"); - } - else { - if (cfg == NULL) { - rprcloader_getConfig (&tmpCfg); - cfg = &tmpCfg; - } - - /* Create a default gate handle for local module protection. */ - rprcloader_state.gateHandle = (IGateProvider_Handle) - GateMutex_create ((GateMutex_Params *) NULL, &eb); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (rprcloader_state.gateHandle == NULL) { - /*! @retval LOADER_E_FAIL Failed to create GateMutex! */ - status = LOADER_E_FAIL; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_setup", - status, - "Failed to create GateMutex!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Copy the user provided values into the state object. */ - Memory_copy (&rprcloader_state.cfg, - cfg, - sizeof (rprcloader_Config)); - - /* Initialize the name to handles mapping array. */ - Memory_set (&rprcloader_state.loaderHandles, - 0, - (sizeof (rprcloader_Handle) * MultiProc_MAXPROCESSORS)); - - /* Initialize the generic RPRC parser. */ - //DLOAD_initialize(); - - rprcloader_state.isSetup = TRUE; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_setup", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return (status); -} - - -/*! - * @brief Function to destroy the rprcloader module. - * - * Once this function is called, other rprcloader module APIs, except - * for the rprcloader_getConfig API cannot be called anymore. - * - * @sa rprcloader_setup - * GateMutex_delete - */ -Int -rprcloader_destroy (Void) -{ - Int status = LOADER_SUCCESS; - UInt16 i; - - GT_0trace (curTrace, GT_ENTER, "rprcloader_destroy"); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if ( Atomic_cmpmask_and_lt (&(rprcloader_state.refCount), - LOADER_MAKE_MAGICSTAMP(0), - LOADER_MAKE_MAGICSTAMP(1)) - == TRUE) { - /*! @retval LOADER_E_INVALIDSTATE Module was not initialized */ - status = LOADER_E_INVALIDSTATE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_destroy", - status, - "Module was not initialized!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - if ( Atomic_dec_return (&rprcloader_state.refCount) - == LOADER_MAKE_MAGICSTAMP(0)) { - /* Check if any rprcloader instances have not been deleted so far. If not, - * delete them. - */ - for (i = 0 ; i < MultiProc_MAXPROCESSORS ; i++) { - GT_assert (curTrace, (rprcloader_state.loaderHandles [i] == NULL)); - if (rprcloader_state.loaderHandles [i] != NULL) { - rprcloader_delete (&(rprcloader_state.loaderHandles [i])); - } - } - - if (rprcloader_state.gateHandle != NULL) { - GateMutex_delete ((GateMutex_Handle *) - &(rprcloader_state.gateHandle)); - } - - /* Finalize DLOAD module */ - //DLOAD_finalize (); - - rprcloader_state.isSetup = FALSE; - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_destroy", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return (status); -} - - -/*! - * @brief Function to initialize the parameters for this loader instance. - * - * @param handle Handle to the loader instance. If provided as NULL, the - * default parameters are returned, otherwise parameters - * as configured for the loader instance are returned. - * @param params Configuration parameters. - * - * @sa rprcloader_create - */ -Void -rprcloader_Params_init (rprcloader_Handle handle, rprcloader_Params * params) -{ - rprcloader_Object * rprcloader = (rprcloader_Object *) handle; - _rprcloader_Object * rprcloaderObject; - - GT_2trace (curTrace, GT_ENTER, "rprcloader_Params_init", handle, params); - - GT_assert (curTrace, (params != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (params == NULL) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_Params_init", - LOADER_E_INVALIDARG, - "Argument of type (rprcloader_Params *) passed " - "is null!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - if (handle == NULL) { - params->reserved = 0; - } - else { - rprcloaderObject = (_rprcloader_Object *) - rprcloader->rprcloaderObject; - GT_assert (curTrace, (rprcloaderObject != NULL)); - - /* Return updated rprc loader instance specific parameters. */ - Memory_copy (params, - &(rprcloaderObject->params), - sizeof (rprcloader_Params)); - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "rprcloader_Params_init"); -} - -/*! - * @brief Function to create an instance of this loader. - * - * @param procId Processor ID for which this loader instance is required. - * @param params Configuration parameters. - * - * @sa rprcloader_delete - */ -rprcloader_Handle -rprcloader_create ( UInt16 procId, - const rprcloader_Params * params) -{ -#if !defined(SYSLINK_BUILD_OPTIMIZE) - Int status = LOADER_SUCCESS; -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - Loader_Object * handle = NULL; - IArg key; - - GT_2trace (curTrace, GT_ENTER, "rprcloader_create", procId, params); - - GT_assert (curTrace, IS_VALID_PROCID (procId)); - GT_assert (curTrace, (params != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (!IS_VALID_PROCID (procId)) { - /*! @retval NULL Function failed */ - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_create", - status, - "Invalid procId specified"); - } - else if (params == NULL) { - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_create", - status, - "params passed is null!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Enter critical section protection. */ - key = IGateProvider_enter (rprcloader_state.gateHandle); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - /* Check if the loader already exists for specified procId. */ - if (rprcloader_state.loaderHandles [procId] != NULL) { - status = LOADER_E_ALREADYEXIST; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_create", - status, - "Loader already exists for specified procId!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Allocate memory for the handle */ - handle = (Loader_Object *) Memory_calloc (NULL, - sizeof (Loader_Object), - 0, - NULL); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - status = LOADER_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_create", - status, - "Memory allocation failed for handle!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - /* Populate the handle fields */ - /* Loader functions. */ - handle->loaderFxnTable.attach = &rprcloader_attach; - handle->loaderFxnTable.detach = &rprcloader_detach; - handle->loaderFxnTable.load = &rprcloader_load; - //handle->loaderFxnTable.loadSymbols = - // &rprcloader_loadSymbols; - handle->loaderFxnTable.unload = &rprcloader_unload; - handle->loaderFxnTable.getSymbolAddress = - &rprcloader_getSymbolAddress; - handle->loaderFxnTable.getEntryPt = &rprcloader_getEntryPt; - //handle->loaderFxnTable.getSectionInfo = - // &rprcloader_getSectionInfo; - //handle->loaderFxnTable.getSectionData = - // &rprcloader_getSectionData; - -#if 0 /* The following are *not* used by DLOAD RPRC loader: */ - /* File I/O Interface */ - handle->fileFxnTable.seek = &rprcloaderFile_seek; - handle->fileFxnTable.tell = &rprcloaderFile_tell; - handle->fileFxnTable.read = &rprcloaderFile_read; - handle->fileFxnTable.close = &rprcloaderFile_close; - - /* Host Memory management Interface */ - handle->memFxnTable.alloc = &rprcloaderMem_alloc; - handle->memFxnTable.free = &rprcloaderMem_free; - - /* Target Memory Allocator Interface */ - handle->trgMemFxnTable.alloc = &rprcloaderTrgMem_alloc; - handle->trgMemFxnTable.free = &rprcloaderTrgMem_free; - - /* Target Memory Access / Write Services */ - handle->trgWriteFxnTable.copy = &rprcloaderTrgWrite_copy; - handle->trgWriteFxnTable.write = &rprcloaderTrgWrite_write; - handle->trgWriteFxnTable.execute = &rprcloaderTrgWrite_execute; - handle->trgWriteFxnTable.map = &rprcloaderTrgWrite_map; - handle->trgWriteFxnTable.unmap = &rprcloaderTrgWrite_unmap; - handle->trgWriteFxnTable.translate = - &rprcloaderTrgWrite_translate; - /* Loading and Unloading of Dependent Files */ - handle->dllFxnTable.load = &rprcloaderDll_loadDependent; - handle->dllFxnTable.unload = &rprcloaderDll_unloadDependent; -#endif - - /* Allocate memory for the rprcloader object */ - handle->object = (rprcloader_Object *) - Memory_calloc (NULL, - sizeof (rprcloader_Object), - 0, - NULL); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle->object == NULL) { - status = LOADER_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_create", - status, - "Memory allocation failed for rprcloader object!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Allocate memory for the internal rprcloader object */ - ((rprcloader_Object *) (handle->object))->rprcloaderObject = - (_rprcloader_Object *) - Memory_calloc (NULL, - sizeof (_rprcloader_Object), - 0, - NULL); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (((rprcloader_Object *) - (handle->object))->rprcloaderObject == NULL) { - status = LOADER_E_MEMORY; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_create", - status, - "Memory allocation failed for internal" - " rprcloader object!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - handle->procId = procId; - rprcloader_state.loaderHandles [procId] = - (rprcloader_Handle) handle; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } - } - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Leave critical section protection. */ - IGateProvider_leave (rprcloader_state.gateHandle, key); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - if (NULL != handle) { - if (NULL != handle->object) { - Memory_free (NULL, handle->object, sizeof (rprcloader_Object)); - } - Memory_free (NULL, handle, sizeof (Loader_Object)); - } - /*! @retval NULL Function failed */ - handle = NULL; - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_create", handle); - - /*! @retval Valid-Handle Operation successful */ - return (rprcloader_Handle) handle; -} - - -/*! - * @brief Function to delete an instance of this loader. - * - * The user provided pointer to the handle is reset after - * successful completion of this function. - * - * @param handlePtr Pointer to handle to the loader instance - * - * @sa rprcloader_create - */ -Int -rprcloader_delete (rprcloader_Handle * handlePtr) -{ - Int status = LOADER_SUCCESS; - rprcloader_Object * object = NULL; - _rprcloader_Object * rprcloaderObject = NULL; - Loader_Object * handle; - IArg key; - - GT_1trace (curTrace, GT_ENTER, "rprcloader_delete", handlePtr); - - GT_assert (curTrace, (handlePtr != NULL)); - GT_assert (curTrace, ((handlePtr != NULL) && (*handlePtr != NULL))); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handlePtr == NULL) { - /*! @retval LOADER_E_INVALIDARG Invalid NULL handlePtr pointer - specified*/ - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_delete", - status, - "Invalid NULL handlePtr pointer specified"); - } - else if (*handlePtr == NULL) { - /*! @retval LOADER_E_HANDLE Invalid NULL *handlePtr specified */ - status = LOADER_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_delete", - status, - "Invalid NULL *handlePtr specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - handle = (Loader_Object *) (*handlePtr); - /* Enter critical section protection. */ - key = IGateProvider_enter (rprcloader_state.gateHandle); - - GT_assert (curTrace, (IS_VALID_PROCID (handle->procId))); - /* Reset handle in Loader handle array. */ - rprcloader_state.loaderHandles [handle->procId] = NULL; - - object = (rprcloader_Object *) handle->object; - - /* Free memory used for the rprcloader object. */ - if (handle->object != NULL) { - rprcloaderObject = ((rprcloader_Object *) - (handle->object))->rprcloaderObject; - /* Free memory used for the internal rprcloader object. */ - if (rprcloaderObject != NULL) { - Memory_free (NULL, - rprcloaderObject, - sizeof (_rprcloader_Object)); - } - - Memory_free (NULL, - handle->object, - sizeof (rprcloader_Object)); - handle->object = NULL; - rprcloader_Object_g = NULL; - } - - /* Free memory used for the Loader object. */ - Memory_free (NULL, handle, sizeof (Loader_Object)); - *handlePtr = NULL; - - /* Leave critical section protection. */ - IGateProvider_leave (rprcloader_state.gateHandle, key); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_0trace (curTrace, GT_LEAVE, "rprcloader_delete"); - - /*! @retval LOADER_SUCCESS Operation successful */ - return (status); -} - - -/*! - * @brief Function to open a handle to an instance of this loader. This - * function is called when access to the loader is required from - * a different process. - * - * @param procId Processor ID addressed by this rprcloader instance. - * @param handle Return parameter: Handle to the loader instance - * - * @sa rprcloader_close - */ -Int -rprcloader_open (rprcloader_Handle * handlePtr, UInt16 procId) -{ - Int status = LOADER_SUCCESS; - - GT_2trace (curTrace, GT_ENTER, "rprcloader_open", handlePtr, procId); - - GT_assert (curTrace, (handlePtr != NULL)); - GT_assert (curTrace, IS_VALID_PROCID (procId)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handlePtr == NULL) { - /*! @retval LOADER_E_HANDLE Invalid MULL handlePtr specified */ - status = LOADER_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_open", - status, - "Invalid NULL handlePtr specified"); - } - else if (!IS_VALID_PROCID (procId)) { - /*! @retval LOADER_E_INVALIDARG Invalid procId specified */ - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_open", - status, - "Invalid procId specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Initialize return parameter handle. */ - *handlePtr = NULL; - - /* Check if the Loader exists and return the handle if found. */ - if (rprcloader_state.loaderHandles [procId] == NULL) { - /*! @retval LOADER_E_NOTFOUND Specified instance not found */ - status = LOADER_E_NOTFOUND; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_open", - status, - "Specified rprcloader instance does not exist!"); - } - else { - *handlePtr = rprcloader_state.loaderHandles [procId]; - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_open", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to close a handle to an instance of this loader. - * - * @param handlePtr Pointer to handle to the loader instance - * - * @sa rprcloader_open - */ -Int -rprcloader_close (rprcloader_Handle * handlePtr) -{ - Int status = LOADER_SUCCESS; - - GT_1trace (curTrace, GT_ENTER, "rprcloader_close", handlePtr); - - GT_assert (curTrace, (handlePtr != NULL)); - GT_assert (curTrace, ((handlePtr != NULL) && (*handlePtr != NULL))); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handlePtr == NULL) { - /*! @retval LOADER_E_INVALIDARG Invalid NULL handlePtr pointer - specified*/ - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_close", - status, - "Invalid NULL handlePtr pointer specified"); - } - else if (*handlePtr == NULL) { - /*! @retval LOADER_E_HANDLE Invalid NULL *handlePtr specified */ - status = LOADER_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_close", - status, - "Invalid NULL *handlePtr specified"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Nothing to be done for close. */ - *handlePtr = NULL; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_close", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -/* ============================================================================= - * APIs called by Loader module (part of function table interface) - * ============================================================================= - */ -/*! - * @brief Function to attach to the Loader. - * - * @param handle Handle to the loader instance - * @param params Attach params - * - * @sa rprcloader_detach - */ -Int -rprcloader_attach (Loader_Handle handle, Loader_AttachParams * params) -{ - Int status = LOADER_SUCCESS ; - rprcloader_Object * rprcloaderObj; - - GT_2trace (curTrace, GT_ENTER, "rprcloader_attach", handle, params); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (params != NULL)); - - /* Set the procHandle. */ - rprcloaderObj = (rprcloader_Object *) (((Loader_Object *) handle)->object); - ((_rprcloader_Object *) (rprcloaderObj->rprcloaderObject))->procHandle = - params->procHandle; - ((_rprcloader_Object *) (rprcloaderObj->rprcloaderObject))->pmHandle = - params->pmHandle; - - /* Set the procArch. */ - ((_rprcloader_Object *) (rprcloaderObj->rprcloaderObject))->procArch = - params->procArch; - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_attach",status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to detach from the Loader. - * - * @param handle Handle to the loader instance - * - * @sa rprcloader_attach - */ -Int -rprcloader_detach (Loader_Handle handle) -{ - Int status = LOADER_SUCCESS; - - GT_1trace (curTrace, GT_ENTER, "rprcloader_detach", handle); - - /* Nothing to be done for this. */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_detach",status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to load the slave processor. - * - * @param handle Handle to the loader instance - * @param imagePath Full file path of the executable to be loaded - * @param argc Number of arguments to be sent to the slave main - * function - * @param argv String array for the arguments - * @param params Loader specific parameters (if any) - * @param fileId Return parameter: ID of the loaded file - * - * @sa rprcloader_unload - */ -Int -rprcloader_load (Loader_Handle handle, - String imagePath, - UInt32 argc, - String * argv, - Ptr params, - UInt32 * fileId) -{ - Int status = LOADER_SUCCESS ; - OsalKfile_Handle fileDesc = NULL; - Char * mode = "r"; - Loader_Object * loaderObj = (Loader_Object *) handle; - rprcloader_Object * rprcloaderObj; - _rprcloader_Object * _rprcloaderObj; - - GT_5trace (curTrace, GT_ENTER, "rprcloader_load", - handle, imagePath, argc, argv, params); - - /* params are not applicable for file based rprcloader. */ - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (imagePath != NULL)); - //GT_assert (curTrace, - // ( ((argc == 0) && (argv == NULL)) - // || ((argc != 0) && (argv != NULL)))) ; - GT_assert (curTrace, (fileId != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval LOADER_E_HANDLE NULL provided for argument handle. */ - status = LOADER_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_load", - status, - "NULL provided for argument handle"); - } - else if (imagePath == NULL) { - /*! @retval LOADER_E_INVALIDARG NULL provided for argument imagePath. */ - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_load", - status, - "NULL provided for argument imagePath"); - } -#if 0 - else if ( ((argc == 0) && (argv != NULL)) - || ((argc != 0) && (argv == NULL))) { - /*! @retval LOADER_E_INVALIDARG Invalid values provided for argc/argv.*/ - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_load", - status, - "Invalid values provided for argc/argv"); - } -#endif - else if (fileId == NULL) { - /*! @retval LOADER_E_INVALIDARG NULL provided for argument fileId. */ - status = LOADER_E_INVALIDARG; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_load", - status, - "NULL provided for argument fileId"); - } - else { -#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */ - status = OsalKfile_open (imagePath, mode, &fileDesc); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_load", - status, - "Failed to open file!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - GT_assert (curTrace, (fileDesc != NULL)); - rprcloaderObj = (rprcloader_Object *) loaderObj->object; - GT_assert (curTrace, (rprcloaderObj != NULL)); - _rprcloaderObj = rprcloaderObj->rprcloaderObject; - GT_assert (curTrace, (_rprcloaderObj != NULL)); - _rprcloaderObj->fileDesc = fileDesc; - - /* TBD: Temporarily set the global to the processor being loaded. */ - rprcloader_Object_g = rprcloaderObj; - - status = load_firmware_file(_rprcloaderObj->procHandle, imagePath); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_load", - status, - "Failed to load RPRC file!"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - /* Set the state of the Processor to loaded. */ - Processor_setState (_rprcloaderObj->procHandle, - ProcMgr_State_Loaded); -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } - OsalKfile_close(&fileDesc); - } - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_load", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to unload the previously loaded file on the slave - * processor. - * - * @param handle Handle to the loader instance - * @param fileId ID of the file received from the load function - * - * @sa rprcloader_load - */ -Int -rprcloader_unload (Loader_Handle handle, UInt32 fileId) -{ - Int status = LOADER_SUCCESS; - Int tmpStatus = LOADER_SUCCESS; - Loader_Object * loaderObj = (Loader_Object *) handle; - rprcloader_Object * rprcloaderObj; - _rprcloader_Object * _rprcloaderObj; - - GT_2trace (curTrace, GT_ENTER, "rprcloader_unload", handle, fileId); - - GT_assert (curTrace, (handle != NULL)); - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (handle == NULL) { - /*! @retval LOADER_E_HANDLE NULL provided for argument handle. */ - status = LOADER_E_HANDLE; - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_load", - status, - "NULL provided for argument handle"); - } - else { -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - rprcloaderObj = (rprcloader_Object *) loaderObj->object; - GT_assert (curTrace, (rprcloaderObj != NULL)); - _rprcloaderObj = rprcloaderObj->rprcloaderObject; - GT_assert (curTrace, (_rprcloaderObj != NULL)); - - unload_firmware_file(); - - /* TBD: Clear the loaded global object. */ - rprcloader_Object_g = NULL; - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_unload", - status, - "Failed to unload RPRC file!"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - //tmpStatus = OsalKfile_close ((OsalKfile_Handle *) - // &(_rprcloaderObj->fileDesc)); - if ((tmpStatus < 0) && (status >= 0)) { - status = tmpStatus; -#if !defined(SYSLINK_BUILD_OPTIMIZE) - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_unload", - status, - "Failed to close the file!"); -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - } -#if !defined(SYSLINK_BUILD_OPTIMIZE) - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_unload", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -/*! - * @brief Function to retrieve the target address of a symbol from the - * specified file. - * - * @param handle Handle to the loader instance - * @param fileId ID of the file received from the load function - * @param symName Name of the symbol - * @param symValue Return parameter: Symbol address - * - * @sa - */ -Int -rprcloader_getSymbolAddress (Loader_Handle handle, - UInt32 fileId, - String symName, - UInt32 * symValue) -{ - Int status = LOADER_SUCCESS; - - GT_4trace (curTrace, GT_ENTER, "rprcloader_getSymbolAddress", - handle, fileId, symName, symValue); - - GT_1trace (curTrace, GT_1CLASS, - "rprcloader_getSymbolAddress: symName [%s]", - symName); - - //if (!DLOAD_query_symbol(fileId, (const char *)symName, - // (TARGET_ADDRESS *)symValue)) { - // status = LOADER_E_FAIL; - //} - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_getSymbolAddress", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - -/*! - * @brief Function to retrieve the entry point of the specified file. - * - * @param handle Handle to the loader instance - * @param fileId ID of the file received from the load function - * @param entryPt Return parameter: Entry point of the executable - * - * @sa rprcloader_load - */ -Int -rprcloader_getEntryPt (Loader_Handle handle, - UInt32 fileId, - UInt32 * entryPt) -{ - Int status = LOADER_SUCCESS; - - GT_3trace (curTrace, GT_ENTER, "rprcloader_getEntryPt", - handle, fileId, entryPt); - - GT_assert (curTrace, (handle != NULL)); - GT_assert (curTrace, (entryPt != NULL)); - - - //if (!DLOAD_get_entry_point(fileId, (TARGET_ADDRESS)entryPt)) { - // status = LOADER_E_FAIL; - //} - -#if !defined(SYSLINK_BUILD_OPTIMIZE) - if (status < 0) { - GT_setFailureReason (curTrace, - GT_4CLASS, - "rprcloader_getEntryPt", - status, - "Failed to get rprc file entry point!"); - } -#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */ - - GT_1trace (curTrace, GT_LEAVE, "rprcloader_getEntryPt", status); - - /*! @retval LOADER_SUCCESS Operation successful */ - return status; -} - - -#if defined (__cplusplus) -} -#endif /* defined (__cplusplus) */ diff --git a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-resmgr/hlos/knl/Qnx/family/omap5430/ipu_pm.c b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-resmgr/hlos/knl/Qnx/family/omap5430/ipu_pm.c index 08bf04c..ac59fd8 100644 --- a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-resmgr/hlos/knl/Qnx/family/omap5430/ipu_pm.c +++ b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-resmgr/hlos/knl/Qnx/family/omap5430/ipu_pm.c @@ -1,11 +1,5 @@ /* - * @file ipu_pm.c - * - * @brief power management for remote processors. - * - * ============================================================================ - * - * Copyright (c) 2011, Texas Instruments Incorporated + * Copyright (c) 2011-2013, Texas Instruments Incorporated * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,18 +27,8 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * Contact information for paper mail: - * Texas Instruments - * Post Office Box 655303 - * Dallas, Texas 75265 - * Contact information: - * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? - * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact - * ============================================================================ - * */ - /* Standard headers */ #include @@ -80,7 +64,6 @@ #include //#include -#include #include #include <_rpmsg.h> -- 2.39.2