[ipc/ipcdev.git] / qnx / src / ipc3x_dev / ti / syslink / family / common / vayu / vayuipu / vayucore0 / VAYUIpuCore0Proc.c
diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayuipu/vayucore0/VAYUIpuCore0Proc.c b/qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayuipu/vayucore0/VAYUIpuCore0Proc.c
index 7e596a6cf7a91a18137e0d64263c99f6b31dec0a..a1e24e008d9e531a4c23704850a2cb6fe102bef1 100644 (file)
*
* ============================================================================
*
- * Copyright (c) 2013-2015, Texas Instruments Incorporated
+ * Copyright (c) 2013-2016, Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* =============================================================================
*/
+/*!
+ * @brief Number of static entries in address translation table.
+ */
+#define AddrTable_STATIC_COUNT 1
+
/*!
* @brief Max entries in address translation table.
*/
/* Memory region counters */
static UInt32 AddrTable_count[NUM_IPUS] = {
- 0,
- 0
+ AddrTable_STATIC_COUNT,
+ AddrTable_STATIC_COUNT,
};
/*
* Address translation tables
+ * CAUTION: AddrTable_STATIC_COUNT must match number of entries below.
*/
-static ProcMgr_AddrInfo AddrTable_IPU1[AddrTable_SIZE];
-static ProcMgr_AddrInfo AddrTable_IPU2[AddrTable_SIZE];
+static ProcMgr_AddrInfo AddrTable_IPU1[AddrTable_SIZE] =
+{
+ /* L2 RAM */
+ {
+ .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
+ .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
+ .addr[ProcMgr_AddrType_MasterPhys] = 0x58820000u,
+ .addr[ProcMgr_AddrType_SlaveVirt] = 0x20000000u,
+ .addr[ProcMgr_AddrType_SlavePhys] = -1u,
+ .size = 0x10000u,
+ .isCached = FALSE,
+ .mapMask = ProcMgr_SLAVEVIRT,
+ .isMapped = TRUE,
+ .refCount = 0u /* refCount set to 0 for static entry */
+ },
+};
+
+static ProcMgr_AddrInfo AddrTable_IPU2[AddrTable_SIZE] =
+{
+ /* L2 RAM */
+ {
+ .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
+ .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
+ .addr[ProcMgr_AddrType_MasterPhys] = 0x55020000u,
+ .addr[ProcMgr_AddrType_SlaveVirt] = 0x20000000u,
+ .addr[ProcMgr_AddrType_SlavePhys] = -1u,
+ .size = 0x10000u,
+ .isCached = FALSE,
+ .mapMask = ProcMgr_SLAVEVIRT,
+ .isMapped = TRUE,
+ .refCount = 0u /* refCount set to 0 for static entry */
+ },
+};
static ProcMgr_AddrInfo * AddrTable[NUM_IPUS] =
{
.isSetup = FALSE,
.configSize = sizeof(VAYUIPUCORE0PROC_Config),
.gateHandle = NULL,
- .defInstParams.numMemEntries = 0,
+ .defInstParams.numMemEntries = AddrTable_STATIC_COUNT,
};
/*! @retval status */
GT_setFailureReason (curTrace,
GT_4CLASS,
- "VAYUIPUCORE0PROC_detach",
+ "VAYUIPUCORE0_halResetCtrl",
status,
"Reset MMU failed");
}
}
/* delete all dynamically added entries */
- for (i = 0; i <
+ for (i = AddrTable_STATIC_COUNT; i <
AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; i++) {
ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][i];
ai->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
ai->isMapped = FALSE;
ai->refCount = 0u;
}
- object->params.numMemEntries = 0;
- AddrTable_count[PROCID_TO_IPU(procHandle->procId)] = 0;
+ object->params.numMemEntries = AddrTable_STATIC_COUNT;
+ AddrTable_count[PROCID_TO_IPU(procHandle->procId)] =
+ AddrTable_STATIC_COUNT;
//No need to reset.. that will be done in STOP
/*tmpStatus = VAYUIPUCORE0_halResetCtrl(object->halObject,
* is required. Add the entry only if the range does not exist
* in the translation table.
*/
- for (j = 0;
- j < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; j++) {
+ /* check in static entries first */
+ for (j = 0; j < AddrTable_STATIC_COUNT; j++) {
ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][j];
+ startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
+ endAddr = startAddr + ai->size;
- if (ai->isMapped == TRUE) {
- startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
- endAddr = startAddr + ai->size;
+ if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)) {
+ found = TRUE;
+ /* refCount does not need to be incremented for static entries */
+ break;
+ }
+ }
- if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
- && ((*dstAddr + sglist[i].size) <= endAddr)) {
- found = TRUE;
- ai->refCount++;
- break;
+ /* if not found in static entries, check in dynamic entries */
+ if (!found) {
+ for (j = AddrTable_STATIC_COUNT;
+ j < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; j++) {
+ ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][j];
+
+ if (ai->isMapped == TRUE) {
+ startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
+ endAddr = startAddr + ai->size;
+
+ if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
+ && ((*dstAddr + sglist[i].size) <= endAddr)) {
+ found = TRUE;
+ ai->refCount++;
+ break;
+ }
}
}
}
/* Delete added entries from translation
* table only in last unmap called on that entry
*/
- for (i = 0;
+ for (i = AddrTable_STATIC_COUNT;
i < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; i++) {
ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][i];