Example #1
0
/*
 *  ======== DMM_UnMapMemory ========
 *  Purpose:
 *      Remove the mapped block from the reserved chunk.
 */
DSP_STATUS DMM_UnMapMemory(struct DMM_OBJECT *hDmmMgr, u32 addr, u32 *pSize)
{
	struct DMM_OBJECT *pDmmObj = (struct DMM_OBJECT *)hDmmMgr;
	struct MapPage *chunk;
	DSP_STATUS status = DSP_SOK;

	GT_3trace(DMM_debugMask, GT_ENTER,
		 "Entered DMM_UnMapMemory () hDmmMgr %x, "
		 "addr %x, pSize %x\n", hDmmMgr, addr, pSize);
	SYNC_EnterCS(pDmmObj->hDmmLock);
	chunk = GetMappedRegion(addr) ;
	if (chunk == NULL)
		status = DSP_ENOTFOUND ;

	if (DSP_SUCCEEDED(status)) {
		/* Unmap the region */
		*pSize = chunk->MappedSize * PG_SIZE_4K;
		chunk->bMapped = false;
		chunk->MappedSize = 0;
	}
	SYNC_LeaveCS(pDmmObj->hDmmLock);
	GT_3trace(DMM_debugMask, GT_ENTER,
		 "Leaving DMM_UnMapMemory status %x, chunk"
		 " %x,  *pSize %x\n", status, chunk, *pSize);

	return status;
}
/*
 *  ======== IRESMAN_MEMTCM_getProtocolRevision ========
 *  Function to return the revision of the protocol
 */
IRES_ProtocolRevision * IRESMAN_MEMTCM_getProtocolRevision()
{

#if (GT_TRACE == 1)
    IRES_ProtocolRevision * version;
#endif

    if (gtInit == 0) {

        GT_init();

        GT_create(&CURTRACE, "ti.sdo.fc.ires.memtcm");
    
        gtInit = 1;
    }

    GT_0trace(CURTRACE, GT_ENTER, 
            "IRESMAN_MEMTCM_getProtocolRevision> Enter\n");

#if (GT_TRACE == 1)
    version = IRESMAN_MEMTCM_CONSTRUCTFXNS.getRevision();
#endif
        
    GT_3trace(CURTRACE, GT_ENTER, 
            "IRESMAN_MEMTCM_getProtocolRevision> Exit (Version=(%d.%d.%d))\n",
            version->Major, version->Source, version->Radius); 

    return (IRESMAN_MEMTCM_CONSTRUCTFXNS.getRevision());
}
/*!
 *  @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
DM8168VIDEOM3_halResetCtrl(Ptr halObj, Processor_ResetCtrlCmd cmd, Ptr args)
{
    Int                  status    = PROCESSOR_SUCCESS;
    DM8168VIDEOM3_HalObject * halObject = NULL;

    GT_3trace(curTrace, GT_ENTER, "DM8168VIDEOM3_halResetCtrl", halObj, cmd, args);

    GT_assert(curTrace, (halObj != NULL));
    GT_assert(curTrace, (cmd < Processor_ResetCtrlCmd_EndValue));

    halObject = (DM8168VIDEOM3_HalObject *) halObj ;

    switch (cmd) {
        case Processor_ResetCtrlCmd_Reset:
        {
            /*Put ONLY Ducati M3_0 to Reset*/
            SET_BIT (REG((halObject->prcmBase) + RM_DEFAULT_RSTCTRL), 0x2);
            /* clear the status bit only if it is set*/
            if(TEST_BIT(REG((halObject->prcmBase) + RM_DEFAULT_RSTST)  , 0x2)) {
                REG((halObject->prcmBase) + RM_DEFAULT_RSTST) = 0x4;
            }
        }
        break;

        case Processor_ResetCtrlCmd_Release:
        {
            /*Bring ONLY Ducati M3_0 out of Reset*/
            CLEAR_BIT (REG((halObject->prcmBase) + RM_DEFAULT_RSTCTRL), 0x2);
            /*Check for Ducati M3_0 out of Reset*/
            while((((REG(halObject->prcmBase + RM_DEFAULT_RSTST)&0x04))!=0x04) &&
                  (((REG(halObject->prcmBase + RM_DEFAULT_RSTST)&0x14))!=0x14) &&
                  (((REG(halObject->prcmBase + RM_DEFAULT_RSTST)&0x1C))!=0x1C)) ;
            /*Check Module is in Functional Mode */
            while(((REG(halObject->prcmBase + CM_DEFAULT_DUCATI_CLKCTRL)&0x30000)>>16)!=0) ;
        }
        break;

        case Processor_ResetCtrlCmd_PeripheralUp:
        {
            /* Nothing to be done to bringup the peripherals for this device. */
        }
        break;

        default:
        {
            /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
            status = PROCESSOR_E_INVALIDARG;
            GT_setFailureReason (curTrace, GT_4CLASS,
                    "DM8168VIDEOM3_halResetCtrl", status,
                    "Unsupported reset ctrl cmd specified");
        }
        break;
    }

    GT_1trace(curTrace, GT_LEAVE, "DM8168VIDEOM3_halResetCtrl",status);

    /*! @retval PROCESSOR_SUCCESS Operation successful */
    return status;
}
Example #4
0
/*
 *  ======== COD_GetSymValue ========
 *  Purpose:
 *      Retrieve the value for the specified symbol. The symbol is first
 *      searched for literally and then, if not found, searched for as a
 *      C symbol.
 *
 */
DSP_STATUS COD_GetSymValue(struct COD_MANAGER *hMgr, char *pstrSym,
			   u32 *pulValue)
{
	struct DBLL_Symbol *pSym;

	DBC_Require(cRefs > 0);
	DBC_Require(IsValid(hMgr));
	DBC_Require(pstrSym != NULL);
	DBC_Require(pulValue != NULL);

	GT_3trace(COD_debugMask, GT_ENTER, "Entered COD_GetSymValue Args \t\n"
		  "hMgr: 0x%x\t\npstrSym: 0x%x\t\npulValue: 0x%x\n",
		  hMgr, pstrSym, pulValue);
	if (hMgr->baseLib) {
		if (!hMgr->fxns.getAddrFxn(hMgr->baseLib, pstrSym, &pSym)) {
			if (!hMgr->fxns.getCAddrFxn(hMgr->baseLib, pstrSym,
			    &pSym)) {
				GT_0trace(COD_debugMask, GT_7CLASS,
					  "COD_GetSymValue: "
					  "Symbols not found\n");
				return COD_E_SYMBOLNOTFOUND;
			}
		}
	} else {
		GT_0trace(COD_debugMask, GT_7CLASS, "COD_GetSymValue: "
			 "No Symbols loaded\n");
		return COD_E_NOSYMBOLSLOADED;
	}

	*pulValue = pSym->value;

	return DSP_SOK;
}
Example #5
0
/*
 * ======== PROCWRAP_Attach ========
 */
u32 PROCWRAP_Attach(union Trapped_Args *args, void *pr_ctxt)
{
	DSP_HPROCESSOR processor;
	DSP_STATUS status = DSP_SOK;
	struct DSP_PROCESSORATTRIN attrIn, *pAttrIn = NULL;

	GT_3trace(WCD_debugMask, GT_ENTER,
		 "PROCWRAP_Attach: entered args:\n" "0x%x"
		 " uProcessor: 0x%x\tpAttrIn: 0x%x\tphProcessor \n",
		 args->ARGS_PROC_ATTACH.uProcessor,
		 args->ARGS_PROC_ATTACH.pAttrIn,
		 args->ARGS_PROC_ATTACH.phProcessor);
	/* Optional argument */
	if (args->ARGS_PROC_ATTACH.pAttrIn) {
		cp_fm_usr(&attrIn, args->ARGS_PROC_ATTACH.pAttrIn, status, 1);
		if (DSP_SUCCEEDED(status))
			pAttrIn = &attrIn;
		else
			goto func_end;


	}
	status = PROC_Attach(args->ARGS_PROC_ATTACH.uProcessor, pAttrIn,
			    &processor, pr_ctxt);
	cp_to_usr(args->ARGS_PROC_ATTACH.phProcessor, &processor, status, 1);
func_end:
	return status;
}
Example #6
0
/*
 *  ======== DMM_MapMemory ========
 *  Purpose:
 *      Add a mapping block to the reserved chunk. DMM assumes that this block
 *  will be mapped in the DSP/IVA's address space. DMM returns an error if a
 *  mapping overlaps another one. This function stores the info that will be
 *  required later while unmapping the block.
 */
DSP_STATUS DMM_MapMemory(struct DMM_OBJECT *hDmmMgr, u32 addr, u32 size)
{
	struct DMM_OBJECT *pDmmObj = (struct DMM_OBJECT *)hDmmMgr;
	struct MapPage *chunk;
	DSP_STATUS status = DSP_SOK;

	GT_3trace(DMM_debugMask, GT_ENTER,
		 "Entered DMM_MapMemory () hDmmMgr %x, "
		 "addr %x, size %x\n", hDmmMgr, addr, size);
	SYNC_EnterCS(pDmmObj->hDmmLock);
	/* Find the Reserved memory chunk containing the DSP block to
	 * be mapped */
	chunk = (struct MapPage *)GetRegion(addr);
	if (chunk != NULL) {
		/* Mark the region 'mapped', leave the 'reserved' info as-is */
		chunk->bMapped = true;
		chunk->MappedSize = (size/PG_SIZE_4K);
	} else
		status = DSP_ENOTFOUND;
	SYNC_LeaveCS(pDmmObj->hDmmLock);
	GT_2trace(DMM_debugMask, GT_4CLASS,
		 "Leaving DMM_MapMemory status %x, chunk %x\n",
		status, chunk);
	return status;
}
/*!
 *  @brief      Insert an entry into the Translation Table
 *
 *  @param      da      Device address
 *  @param      ua      User address
 *  @param      size    Buffer size
 *
 *  @sa         _SysLinkMemUtils_removeMapElement
 */
static Int32
_SysLinkMemUtils_insertMapElement (Ptr da, Ptr ua, UInt32 size)
{
    AddrNode      * node;
    Int32           status = PROCMGR_SUCCESS;

    GT_3trace (curTrace, GT_ENTER, "_SysLinkMemUtils_insertMapElement", da, ua,
                size);

    node = Memory_alloc (NULL, sizeof (AddrNode), 0);
    if (!node) {
        status = PROCMGR_E_MEMORY;
#if !defined(SYSLINK_BUILD_OPTIMIZE)
        GT_setFailureReason (curTrace,
                             GT_4CLASS,
                             (Char *)__func__,
                             status,
                             "Error allocating node memory!");
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
    }
    else {
        node->ua = ua;
        node->da = da;
        node->size = size;
        OsalSemaphore_pend (SysLinkMemUtils_module->semList,
                            OSALSEMAPHORE_WAIT_FOREVER);
        List_put (SysLinkMemUtils_module->addrTable, &node->elem);
        OsalSemaphore_post (SysLinkMemUtils_module->semList);
    }

    GT_1trace (curTrace, GT_LEAVE, "_SysLinkMemUtils_insertMapElement", status);

    return status;
}
Example #8
0
/*
 *  ======== DMM_Create ========
 *  Purpose:
 *      Create a dynamic memory manager object.
 */
DSP_STATUS DMM_Create(OUT struct DMM_OBJECT **phDmmMgr,
		     struct DEV_OBJECT *hDevObject,
		     IN CONST struct DMM_MGRATTRS *pMgrAttrs)
{
	struct DMM_OBJECT *pDmmObject = NULL;
	DSP_STATUS status = DSP_SOK;
	DBC_Require(cRefs > 0);
	DBC_Require(phDmmMgr != NULL);

	GT_3trace(DMM_debugMask, GT_ENTER,
		 "DMM_Create: phDmmMgr: 0x%x hDevObject: "
		 "0x%x pMgrAttrs: 0x%x\n", phDmmMgr, hDevObject, pMgrAttrs);
	*phDmmMgr = NULL;
	/* create, zero, and tag a cmm mgr object */
	MEM_AllocObject(pDmmObject, struct DMM_OBJECT, DMMSIGNATURE);
	if (pDmmObject != NULL) {
		status = SYNC_InitializeCS(&pDmmObject->hDmmLock);
		if (DSP_SUCCEEDED(status))
			*phDmmMgr = pDmmObject;
		else
			DMM_Destroy(pDmmObject);
	} else {
		GT_0trace(DMM_debugMask, GT_7CLASS,
			 "DMM_Create: Object Allocation "
			 "Failure(DMM Object)\n");
		status = DSP_EMEMORY;
	}
	GT_2trace(DMM_debugMask, GT_4CLASS,
			"Leaving DMM_Create status %x pDmmObject %x\n",
			status, pDmmObject);

	return status;
}
Example #9
0
void MEM_ExtPhysPoolInit(u32 poolPhysBase, u32 poolSize)
{
	u32 poolVirtBase;

	/* get the virtual address for the physical memory pool passed */
	poolVirtBase = (u32)ioremap(poolPhysBase, poolSize);

	if ((void **)poolVirtBase == NULL) {
		GT_0trace(MEM_debugMask, GT_7CLASS,
			  "[PHYS_POOL]Mapping External "
			  "physical memory to virt failed \n");
		extPhysMemPoolEnabled = false;
	} else {
		extMemPool.physMemBase = poolPhysBase;
		extMemPool.physMemSize = poolSize;
		extMemPool.virtMemBase = poolVirtBase;
		extMemPool.nextPhysAllocPtr = poolPhysBase;
		extPhysMemPoolEnabled = true;
		GT_3trace(MEM_debugMask, GT_1CLASS,
			  "ExtMemory Pool details " "Pool"
			  "Physical mem base = %0x " "Pool Physical mem size "
			  "= %0x" "Pool Virtual mem base = %0x \n",
			  poolPhysBase, poolSize, poolVirtBase);
	}
}
Example #10
0
static void MEM_Check(void)
{
	struct memInfo *pMem;
	struct LST_ELEM *last = &mMan.lst.head;
	struct LST_ELEM *curr = mMan.lst.head.next;

	if (!LST_IsEmpty(&mMan.lst)) {
		GT_0trace(MEM_debugMask, GT_7CLASS, "*** MEMORY LEAK ***\n");
		GT_0trace(MEM_debugMask, GT_7CLASS,
			  "Addr      Size      Caller\n");
		while (curr != last) {
			pMem = (struct memInfo *)curr;
			curr = curr->next;
			if ((u32)pMem > PAGE_OFFSET &&
			    MEM_IsValidHandle(pMem, memInfoSign)) {
				GT_3trace(MEM_debugMask, GT_7CLASS,
					"%lx  %d\t [<%p>]\n",
					(u32) pMem + sizeof(struct memInfo),
					pMem->size, pMem->caller);
				MLST_RemoveElem(&mMan.lst,
						(struct LST_ELEM *) pMem);
				kfree(pMem);
			} else {
				GT_1trace(MEM_debugMask, GT_7CLASS,
					  "Invalid allocation or "
					  "Buffer underflow at %x\n",
					  (u32)pMem +	sizeof(struct memInfo));
				break;
			}
		}
	}
	DBC_Ensure(LST_IsEmpty(&mMan.lst));
}
Example #11
0
/*
 *  ======== DMM_ReserveMemory ========
 *  Purpose:
 *      Reserve a chunk of virtually contiguous DSP/IVA address space.
 */
DSP_STATUS DMM_ReserveMemory(struct DMM_OBJECT *hDmmMgr, u32 size,
							u32 *pRsvAddr)
{
	DSP_STATUS status = DSP_SOK;
	struct DMM_OBJECT *pDmmObj = (struct DMM_OBJECT *)hDmmMgr;
	struct MapPage *node;
	u32 rsvAddr = 0;
	u32 rsvSize = 0;

	GT_3trace(DMM_debugMask, GT_ENTER,
		 "Entered DMM_ReserveMemory () hDmmMgr %x, "
		 "size %x, pRsvAddr %x\n", hDmmMgr, size, pRsvAddr);
	SYNC_EnterCS(pDmmObj->hDmmLock);

	/* Try to get a DSP chunk from the free list */
	node = GetFreeRegion(size);
	if (node != NULL) {
		/*  DSP chunk of given size is available. */
		rsvAddr = DMM_ADDR_VIRTUAL(node);
		/* Calculate the number entries to use */
		rsvSize = size/PG_SIZE_4K;
		if (rsvSize < node->RegionSize) {
			/* Mark remainder of free region */
			node[rsvSize].bMapped = false;
			node[rsvSize].bReserved = false;
			node[rsvSize].RegionSize = node->RegionSize - rsvSize;
			node[rsvSize].MappedSize = 0;
		}
		/*  GetRegion will return first fit chunk. But we only use what
			is requested. */
		node->bMapped = false;
		node->bReserved = true;
		node->RegionSize = rsvSize;
		node->MappedSize = 0;
		/* Return the chunk's starting address */
		*pRsvAddr = rsvAddr;
	} else
		/*dSP chunk of given size is not available */
		status = DSP_EMEMORY;

	SYNC_LeaveCS(pDmmObj->hDmmLock);
	GT_3trace(DMM_debugMask, GT_4CLASS,
		 "Leaving ReserveMemory status %x, rsvAddr"
		 " %x, rsvSize %x\n", status, rsvAddr, rsvSize);
	return status;
}
/*!
 *  @brief      Function to control boot operations
 *
 *  @param      halObj  Pointer to the HAL object
 *  @param      cmd     Boot command
 *  @param      arg     Arguments specific to the boot command
 *
 *  @sa
 */
Int
OMAP3530_halBootCtrl (Ptr halObj, Processor_BootCtrlCmd cmd, Ptr args)
{
    Int                  status    = PROCESSOR_SUCCESS;
    OMAP3530_HalObject * halObject = NULL;

    GT_3trace (curTrace, GT_ENTER, "OMAP3530_halBootCtrl", halObj, cmd, args);

    GT_assert (curTrace, (halObj != NULL));
    GT_assert (curTrace, (cmd < Processor_BootCtrlCmd_EndValue));

    halObject = (OMAP3530_HalObject *) halObj;

    switch (cmd) {
        case Processor_BootCtrlCmd_SetEntryPoint:
        {
            /* Set the boot address */
            REG (halObject->generalCtrlBase + CONTROL_IVA2_BOOTADDR_OFFSET) =
                ((UInt32) args & 0xFFFFFC00);


            /* Set the boot mode */
            REG (halObject->generalCtrlBase + CONTROL_IVA2_BOOTMOD_OFFSET) =
                (UInt32) 0;

        }
        break ;

        case Processor_BootCtrlCmd_SetBootComplete:
        {
            /* Do nothing here for OMAP3530 gem */
        }
        break ;

        case Processor_BootCtrlCmd_ResetBootComplete:
        {
            /* Do nothing here for OMAP3530 gem */
        }
        break ;

        default:
        {
            /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
            status = PROCESSOR_E_INVALIDARG;
            GT_setFailureReason (curTrace,
                                 GT_4CLASS,
                                 "OMAP3530_halBootCtrl",
                                 status,
                                 "Unsupported boot ctrl cmd specified");
        }
        break ;
    }

    GT_1trace (curTrace, GT_LEAVE, "OMAP3530_halBootCtrl",status);

    /*! @retval PROCESSOR_SUCCESS Operation successful */
    return status;
}
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
IRES_Handle IRES_ADDRSPACE_constructHandle(
        IRES_ProtocolArgs * resProtocolArgs,
        IALG_MemRec *memRecs,
        IRESMAN_ConstructArgs * constructHandleArgs,
        IRES_Status *status)
{
    IRES_ADDRSPACE_Handle handle = (IRES_ADDRSPACE_Handle)memRecs[0].base;

    IRESMAN_ADDRSPACE_ConstructHandleArgs * constructArgs =
        (IRESMAN_ADDRSPACE_ConstructHandleArgs *)constructHandleArgs;

    GT_3trace(ti_sdo_fc_ires_addrspace_GTMask, GT_ENTER,
            "_IRES_ADDRSPACE_constructHandle> Enter (resProtcolArgs=0x%x, "
            "memRecs=0x%x, constructHandleArgs=0x%x)\n", resProtocolArgs,
            memRecs, constructHandleArgs);

    GT_assert(ti_sdo_fc_ires_addrspace_GTMask, resProtocolArgs != NULL);
    GT_assert(ti_sdo_fc_ires_addrspace_GTMask, memRecs != NULL);
    GT_assert(ti_sdo_fc_ires_addrspace_GTMask, constructHandleArgs != NULL);
    GT_assert(ti_sdo_fc_ires_addrspace_GTMask, status != NULL);

    if (handle == NULL) {
        *status = IRES_ENORESOURCE;

        GT_0trace(ti_sdo_fc_ires_addrspace_GTMask, GT_7CLASS,
                "_IRES_ADDRSPACE_constructHandle> NULL handle passed in "
                "memRecs[0].base\n");

        GT_1trace(ti_sdo_fc_ires_addrspace_GTMask, GT_ENTER,
                "_IRES_ADDRSPACE_constructHandle> Exit (handle=0x%x, "
                "status=IRES_ENORESOURCE)\n", handle);

        return ((IRES_Handle) NULL);
    }

    handle->addr = constructArgs->addr ;

    handle->len = constructArgs->len ;
    ((IRES_ADDRSPACE_IntObj *)handle)->mapBase = constructArgs->mapBase;
    ((IRES_ADDRSPACE_IntObj *)handle)->mapLen = constructArgs->mapLen;

    ((IRES_ADDRSPACE_Handle)handle)->ires.getStaticProperties =
            IRES_ADDRSPACE_getStaticProperties;

    /*
     * Use the constructHandleargs to populate the ShadowPaRams with the
     * correct link
     */

    *status = IRES_OK;

    GT_1trace(ti_sdo_fc_ires_addrspace_GTMask, GT_ENTER,
            "_IRES_ADDRSPACE_constructHandle> Exit (handle=0x%x, "
            "status=IRES_OK)\n", handle);

    return ((IRES_Handle)handle);
}
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
Int DUMALG_TI_useHDVICP(IDUMALG_Handle handle, unsigned int Id)
{
    Int i;
    DUMALG_TI_Obj * dumalg = (DUMALG_TI_Handle)handle;
    IRES_HDVICP_Handle hdvicp = NULL;

    if (dumalg->yieldFlag) {
        for (i = 0; i < NUM_RESOURCES; i++) {
            GT_2trace(ti_sdo_fc_rman_examples_hdvicp, GT_4CLASS,
                    "_DUMALG_TI_useHDVICP> Task #%d: Yielding HDVICP resource "
                    "%d\n", Id, (Int)(dumalg->hdvicp[i]));
        }

        /* Yield resource now */
        dumalg->yieldFxn((IRES_YieldResourceType)IRES_ALL,&dumalg->yieldContext,
                dumalg->yieldArgs);

            for (i = 0; i < NUM_RESOURCES; i++) {
            GT_2trace(ti_sdo_fc_rman_examples_hdvicp, GT_4CLASS,
                    "_DUMALG_TI_useHDVICP> Task #%d: HDVICP resource %d "
                    "re-acquired\n", Id, (Int)(dumalg->hdvicp[i]));
            }
    }
    else {

        /* Alg doesn't yield the resource */

#ifdef xdc_target__os_Linux
        CMEM_init();
#endif
        for (i = 0; i < NUM_RESOURCES; i++) {

            hdvicp = dumalg->resourceHandles[i];

            GT_2trace(ti_sdo_fc_rman_examples_hdvicp, GT_4CLASS,
                    "_DUMALG_TI_useHDVICP> Task #%d: Not yielding HDVICP "
                    "resource %d\n", Id, (Int)(hdvicp->id));

#ifdef xdc_target__os_Linux

            GT_3trace(ti_sdo_fc_rman_examples_hdvicp, GT_4CLASS,
                    "_DUMALG_TI_useHDVICP> Register space address 0x%x, Memory "
                    "base address 0x%x, Phy register base address 0x%x\n",
                    (unsigned int)(hdvicp->registerBaseAddress),
                    (unsigned int)(hdvicp->memoryBaseAddress),
                    (void *) CMEM_getPhys((void *)
                    (hdvicp->registerBaseAddress)));

#endif
        }
#ifdef xdc_target__os_Linux
        CMEM_exit();
#endif
    }

    return 0;
}
Example #15
0
/*
 *  ======== Memory_segFree ========
 */
Bool Memory_segFree(Int segid, Ptr addr, UInt size)
{
    GT_3trace(curTrace, GT_ENTER, "Memory_segFree(0x%lx, 0x%lx, 0x%lx)\n",
        segid, addr, size);

    free(addr);

    return (TRUE);
}
Example #16
0
/*
 *  ======== STRM_FreeBuffer ========
 *  Purpose:
 *      Frees the buffers allocated for a stream.
 */
DSP_STATUS STRM_FreeBuffer(struct STRM_OBJECT *hStrm, u8 **apBuffer,
			  u32 uNumBufs)
{
	DSP_STATUS status = DSP_SOK;
	u32 i = 0;

	#ifndef RES_CLEANUP_DISABLE
	DSP_STATUS res_status = DSP_SOK;
       u32                  hProcess;
	HANDLE	     pCtxt = NULL;
	HANDLE	     hDrvObject;
	HANDLE 		    hSTRMRes = NULL;
	#endif
	DBC_Require(cRefs > 0);
	DBC_Require(apBuffer != NULL);

	GT_3trace(STRM_debugMask, GT_ENTER, "STRM_FreeBuffer: hStrm: 0x%x\t"
		 "apBuffer: 0x%x\tuNumBufs: 0x%x\n", hStrm, apBuffer, uNumBufs);

	if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE))
		status = DSP_EHANDLE;

	if (DSP_SUCCEEDED(status)) {
		for (i = 0; i < uNumBufs; i++) {
			DBC_Assert(hStrm->hXlator != NULL);
			status = CMM_XlatorFreeBuf(hStrm->hXlator, apBuffer[i]);
			if (DSP_FAILED(status)) {
				GT_0trace(STRM_debugMask, GT_7CLASS,
					 "STRM_FreeBuffer: DSP_FAILED"
					 " to free shared memory.\n");
				break;
			}
			apBuffer[i] = NULL;
		}
	}
#ifndef RES_CLEANUP_DISABLE
	/* Update the node and stream resource status */
       /* Return PID instead of process handle */
       hProcess = current->pid;

	res_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
	if (DSP_SUCCEEDED(res_status)) {
               DRV_GetProcContext(hProcess,
				 (struct DRV_OBJECT *)hDrvObject, &pCtxt,
				 NULL, 0);
		if (pCtxt != NULL) {
			if (DRV_GetSTRMResElement(hStrm, hSTRMRes, pCtxt) !=
			   DSP_ENOTFOUND) {
				DRV_ProcUpdateSTRMRes(uNumBufs-i, hSTRMRes,
						     pCtxt);
			}
		}
	}
#endif
	return status;
}
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
IRES_Handle IRES_SDMA_constructHandle(
        IRES_ProtocolArgs * resProtocolArgs,
        IALG_MemRec *memRecs,
        IRESMAN_ConstructArgs * constructHandleArgs,
        IRES_Status *status)
{
    IRES_SDMA_Handle handle = (IRES_SDMA_Handle)memRecs[0].base;

    IRES_SDMA_ConstructHandleArgs * constructArgs =
        (IRES_SDMA_ConstructHandleArgs *)constructHandleArgs;

    GT_3trace(ti_sdo_fc_ires_sdma_GTMask, GT_ENTER,
            "_IRES_SDMA_constructHandle> Enter (resProtcolArgs=0x%x, "
            "memRecs=0x%x, constructHandleArgs=0x%x)\n", resProtocolArgs,
            memRecs, constructHandleArgs);

    GT_assert(ti_sdo_fc_ires_sdma_GTMask, resProtocolArgs != NULL);
    GT_assert(ti_sdo_fc_ires_sdma_GTMask, memRecs != NULL);
    GT_assert(ti_sdo_fc_ires_sdma_GTMask, constructHandleArgs != NULL);
    GT_assert(ti_sdo_fc_ires_sdma_GTMask, status != NULL);

    if (handle == NULL) {

        *status = IRES_ENORESOURCE;

        GT_0trace(ti_sdo_fc_ires_sdma_GTMask, GT_7CLASS,
                "_IRES_SDMA_constructHandle> NULL handle passed in "
                "memRecs[0].base\n");

        GT_1trace(ti_sdo_fc_ires_sdma_GTMask, GT_ENTER,
                "_IRES_SDMA_constructHandle> Exit (handle=0x%x, "
                "status=IRES_ENORESOURCE)\n", handle);

        return ((IRES_Handle) NULL);
    }

    ((IRES_SDMA_Handle)handle)->ires.getStaticProperties =
            IRES_SDMA_getStaticProperties;

    /*
     * Use the constructHandleargs to populate the handle
     */
    handle->channel = (SDMA_ChannelDescriptor *)
            (handle + sizeof(IRES_SDMA_Obj));

    handle->ires.persistent = constructArgs->persistent;

    *status = IRES_OK;

    GT_1trace(ti_sdo_fc_ires_sdma_GTMask, GT_ENTER,
            "_IRES_SDMA_constructHandle> Exit (handle=0x%x, "
            "status=IRES_OK)\n", handle);

    return ((IRES_Handle)handle);
}
/*!
 *  @brief      Function to control boot operations
 *
 *  @param      halObj  Pointer to the HAL object
 *  @param      cmd     Boot command
 *  @param      arg     Arguments specific to the boot command
 *
 *  @sa
 */
Int
DM8168VIDEOM3_halBootCtrl (Ptr halObj, Processor_BootCtrlCmd cmd, Ptr args)
{
    Int                  status    = PROCESSOR_SUCCESS;
    DM8168VIDEOM3_HalObject * halObject = NULL;

    GT_3trace (curTrace, GT_ENTER, "DM8168VIDEOM3_halBootCtrl", halObj, cmd, args);

    GT_assert (curTrace, (halObj != NULL));
    GT_assert (curTrace, (cmd < Processor_BootCtrlCmd_EndValue));

    halObject = (DM8168VIDEOM3_HalObject *) halObj;

    switch (cmd) {
        case Processor_BootCtrlCmd_SetEntryPoint:
        {
            /* copy _c_int00 addresses to 0x4th location of Ducati
               Last bit at this mem location has to be explicitly set to 1 to
               ensure that M3 is in THUMB mode*/
            REG (halObject->generalCtrlBase) = 0x0;
            REG (halObject->generalCtrlBase) = ((UInt32)args | 0x1);
        }
        break ;

        case Processor_BootCtrlCmd_SetBootComplete:
        {
            /* Do nothing here for DM8168VIDEOM3 gem */
        }
        break ;

        case Processor_BootCtrlCmd_ResetBootComplete:
        {
            /* Do nothing here for DM8168VIDEOM3 gem */
        }
        break ;

        default:
        {
            /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
            status = PROCESSOR_E_INVALIDARG;
            GT_setFailureReason (curTrace,
                                 GT_4CLASS,
                                 "DM8168VIDEOM3_halBootCtrl",
                                 status,
                                 "Unsupported boot ctrl cmd specified");
        }
        break ;
    }

    GT_1trace (curTrace, GT_LEAVE, "DM8168VIDEOM3_halBootCtrl",status);

    /*! @retval PROCESSOR_SUCCESS Operation successful */
    return status;
}
/*!
 *  @brief      Function to control boot operations
 *
 *  @param      halObj  Pointer to the HAL object
 *  @param      cmd     Boot command
 *  @param      arg     Arguments specific to the boot command
 *
 *  @sa
 */
Int
OMAPL1XX_halBootCtrl (Ptr halObj, Processor_BootCtrlCmd cmd, Ptr args)
{
    Int                  status    = PROCESSOR_SUCCESS;
    OMAPL1XX_HalObject * halObject = NULL;

    GT_3trace (curTrace, GT_ENTER, "OMAPL1XX_halBootCtrl", halObj, cmd, args);

    GT_assert (curTrace, (halObj != NULL));
    GT_assert (curTrace, (cmd < Processor_BootCtrlCmd_EndValue));

    halObject = (OMAPL1XX_HalObject *) halObj;

    switch (cmd) {
        case Processor_BootCtrlCmd_SetEntryPoint:
        {
            /* Set the boot address */
            REG (   halObject->baseCfgBus
                 +  halObject->offsetSysModule
                 +  BOOT_BASE_ADDR) = ((UInt32) args | 0x1);
        }
        break ;

        case Processor_BootCtrlCmd_SetBootComplete:
        {
            /* Do nothing here for OMAPL1XX gem */
        }
        break ;

        case Processor_BootCtrlCmd_ResetBootComplete:
        {
            /* Do nothing here for OMAPL1XX gem */
        }
        break ;

        default:
        {
            /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
            status = PROCESSOR_E_INVALIDARG;
            GT_setFailureReason (curTrace,
                                 GT_4CLASS,
                                 "OMAPL1XX_halBootCtrl",
                                 status,
                                 "Unsupported boot ctrl cmd specified");
        }
        break ;
    }

    GT_1trace (curTrace, GT_LEAVE, "OMAPL1XX_halBootCtrl",status);

    /*! @retval PROCESSOR_SUCCESS Operation successful */
    return status;
}
Example #20
0
/*
 *  ======== Memory_getBufferPhysicalAddress ========
 */
UInt32 Memory_getBufferPhysicalAddress(Ptr virtualAddress, Int sizeInBytes,
    Bool *isContiguous)
{
    GT_3trace(curTrace, GT_ENTER,
        "Memory_getBufferPhysicalAddress(0x%lx, 0x%lx, 0x%lx)\n",
        virtualAddress, sizeInBytes, isContiguous);

    if (isContiguous != NULL) {
        *isContiguous = TRUE;
    }
    return ((Uint32)virtualAddress);
}
/*!
 *  @brief      Function to control boot operations
 *
 *  @param      halObj  Pointer to the HAL object
 *  @param      cmd     Boot command
 *  @param      arg     Arguments specific to the boot command
 *
 *  @sa
 */
Int
DM8168DSP_halBootCtrl (Ptr halObj, Processor_BootCtrlCmd cmd, Ptr args)
{
    Int                  status    = PROCESSOR_SUCCESS;
    DM8168DSP_HalObject * halObject = NULL;

    GT_3trace (curTrace, GT_ENTER, "DM8168DSP_halBootCtrl", halObj, cmd, args);

    GT_assert (curTrace, (halObj != NULL));
    GT_assert (curTrace, (cmd < Processor_BootCtrlCmd_EndValue));

    halObject = (DM8168DSP_HalObject *) halObj;

    switch (cmd) {
        case Processor_BootCtrlCmd_SetEntryPoint:
        {
            /* copy _c_int00 addresses to dsp boot address*/
            REG (halObject->generalCtrlBase) = ((UInt32) args & 0xFFFFFC00);
        }
        break ;

        case Processor_BootCtrlCmd_SetBootComplete:
        {
            /* set boot complete bit in boot stat reg */
            REG (halObject->bootStatBase) |= 0x1;
        }
        break ;

        case Processor_BootCtrlCmd_ResetBootComplete:
        {
            /* Do nothing here for DM8168DSP gem */
        }
        break ;

        default:
        {
            /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
            status = PROCESSOR_E_INVALIDARG;
            GT_setFailureReason (curTrace,
                                 GT_4CLASS,
                                 "DM8168DSP_halBootCtrl",
                                 status,
                                 "Unsupported boot ctrl cmd specified");
        }
        break ;
    }

    GT_1trace (curTrace, GT_LEAVE, "DM8168DSP_halBootCtrl",status);

    /*! @retval PROCESSOR_SUCCESS Operation successful */
    return status;
}
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
IRES_Handle IRES_MEMTCM_constructHandle(
        IRES_ProtocolArgs * resProtocolArgs, 
        IALG_MemRec *memRecs, 
        IRESMAN_ConstructArgs * constructHandleArgs, 
        IRES_Status *status)
{
    IRES_MEMTCM_Handle handle = (IRES_MEMTCM_Handle)memRecs[0].base;

    IRES_MEMTCM_ConstructHandleArgs * constructArgs =
        (IRES_MEMTCM_ConstructHandleArgs *)constructHandleArgs;

    GT_3trace(ti_sdo_fc_ires_memtcm_GTMask, GT_ENTER, 
            "_IRES_MEMTCM_constructHandle> Enter (resProtcolArgs=0x%x, "
            "memRecs=0x%x, constructHandleArgs=0x%x)\n", resProtocolArgs, 
            memRecs, constructHandleArgs);

    GT_assert(ti_sdo_fc_ires_memtcm_GTMask, resProtocolArgs != NULL);
    GT_assert(ti_sdo_fc_ires_memtcm_GTMask, memRecs != NULL);
    GT_assert(ti_sdo_fc_ires_memtcm_GTMask, constructHandleArgs != NULL);
    GT_assert(ti_sdo_fc_ires_memtcm_GTMask, status != NULL);
    
    if (handle == NULL) {
        *status = IRES_ENORESOURCE;

        GT_0trace(ti_sdo_fc_ires_memtcm_GTMask, GT_7CLASS, 
                "_IRES_MEMTCM_constructHandle> NULL handle passed in "
                "memRecs[0].base\n");

        GT_1trace(ti_sdo_fc_ires_memtcm_GTMask, GT_ENTER, 
                "_IRES_MEMTCM_constructHandle> Exit (handle=0x%x, "
                "status=IRES_ENORESOURCE)\n", handle);

        return ((IRES_Handle) NULL);
    }

    handle->ires.persistent = constructArgs->persistent;

    handle->memSize = constructArgs->memSize;

    handle->memAddr = constructArgs->memAddr; 

    ((IRES_MEMTCM_Handle)handle)->ires.getStaticProperties = 
            IRES_MEMTCM_getStaticProperties;                

    *status = IRES_OK;

    GT_1trace(ti_sdo_fc_ires_memtcm_GTMask, GT_ENTER, 
            "_IRES_MEMTCM_constructHandle> Exit (handle=0x%x, "
            "status=IRES_OK)\n", handle);

    return ((IRES_Handle)handle);
}
Example #23
0
/*  ======== DMM_CreateTables ========
 *  Purpose:
 *      Create table to hold the information of physical address
 *      the buffer pages that is passed by the user, and the table
 *      to hold the information of the virtual memory that is reserved
 *      for DSP.
 */
DSP_STATUS DMM_CreateTables(struct DMM_OBJECT *hDmmMgr, u32 addr, u32 size)
{
	struct DMM_OBJECT *pDmmObj = (struct DMM_OBJECT *)hDmmMgr;
	DSP_STATUS status = DSP_SOK;

	GT_3trace(DMM_debugMask, GT_ENTER,
		 "Entered DMM_CreateTables () hDmmMgr %x, addr"
		 " %x, size %x\n", hDmmMgr, addr, size);
	status = DMM_DeleteTables(pDmmObj);
	if (DSP_SUCCEEDED(status)) {
		SYNC_EnterCS(pDmmObj->hDmmLock);
		dynMemMapBeg = addr;
		TableSize = (size/PG_SIZE_4K) + 1;
		/*  Create the free list */
		pVirtualMappingTable = (struct MapPage *) MEM_Calloc
		(TableSize*sizeof(struct MapPage), MEM_NONPAGED);
		if (pVirtualMappingTable == NULL)
			status = DSP_EMEMORY;
		else {
			/* This table will be used
			* to store the virtual to physical
			* address translations
			*/
			pPhysicalAddrTable = (u32 *)MEM_Calloc
				(TableSize*sizeof(u32), MEM_NONPAGED);
			GT_1trace(DMM_debugMask, GT_4CLASS,
			"DMM_CreateTables: Allocate"
			"memory for pPhysicalAddrTable=%d entries\n",
			TableSize);
			if (pPhysicalAddrTable == NULL) {
				status = DSP_EMEMORY;
				GT_0trace(DMM_debugMask, GT_7CLASS,
				    "DMM_CreateTables: Memory allocation for "
				    "pPhysicalAddrTable failed\n");
			} else {
			/* On successful allocation,
			* all entries are zero ('free') */
			iFreeRegion = 0;
			iFreeSize = TableSize*PG_SIZE_4K;
			pVirtualMappingTable[0].RegionSize = TableSize;
			}
		}
		SYNC_LeaveCS(pDmmObj->hDmmLock);
	} else
		GT_0trace(DMM_debugMask, GT_7CLASS,
			 "DMM_CreateTables: DMM_DeleteTables"
			 "Failure\n");

	GT_1trace(DMM_debugMask, GT_4CLASS, "Leaving DMM_CreateTables status"
							"0x%x\n", status);
	return status;
}
/**
 *  ======= IRES_SDMA_getRevision =======
 *  Return the revision of the protocol
 */
IRES_ProtocolRevision * IRES_SDMA_getRevision ()
{
    GT_0trace(ti_sdo_fc_ires_sdma_GTMask, GT_ENTER,
            "_IRES_SDMA_getRevision> Enter\n");

    GT_3trace(ti_sdo_fc_ires_sdma_GTMask, GT_ENTER,
            "_IRES_SDMA_getRevision> Exit (Version=(%d.%d.%d))\n",
            IRES_SDMA_PROTOCOLREVISION.Major,
            IRES_SDMA_PROTOCOLREVISION.Source,
            IRES_SDMA_PROTOCOLREVISION.Radius);

    return (&IRES_SDMA_PROTOCOLREVISION);
}
/*
 * @brief Function to set the valid data start offset of a framebuffer
 *        identified by the frame buffer number in a given frame.
 *
 * @param buf              Frame.
 * @param frameBufNum      Frame buffer number.
 * @param dataStartOffset  Valid data start offset in the frame buffer.
 */
Int32
FrameQ_setFrameBufDataStartOffset (FrameQ_Frame  frame,
                                   UInt32        frameBufNum,
                                   UInt32        dataStartOffset)
{
    Int32                   status  = FrameQ_S_SUCCESS;
    FrameQ_FrameBufInfo     *frameBufInfo;

    GT_3trace (curTrace,
               GT_ENTER,
               "FrameQ_setFrameBufDataStartOffset",
               frame,
               frameBufNum,
               dataStartOffset);

    GT_assert (curTrace, (NULL != frame));

    GT_assert (curTrace, (frame->numFrameBuffers > frameBufNum)) ;

    frameBufInfo = (FrameQ_FrameBufInfo *)&(frame->frameBufInfo[0]);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
    if (frameBufInfo[frameBufNum].bufSize <
            (dataStartOffset + frameBufInfo[frameBufNum].validSize)) {

        /*! @retval FrameQ_E_INVALIDARG  dataStartOffseti + validsize  is more
         *  than the bufSize .
         */
        status = FrameQ_E_INVALIDARG;
        GT_setFailureReason (curTrace,
                             GT_4CLASS,
                             "FrameQ_setFrameBufDataStartOffset",
                             status,
                             "(dataStartOffset + validSize) is more than the bufSize.!");

    }
    else {
#endif /*#if !defined(SYSLINK_BUILD_OPTIMIZE)*/
        frameBufInfo[frameBufNum].startOffset = dataStartOffset;
#if !defined(SYSLINK_BUILD_OPTIMIZE)
    }
#endif /*#if !defined(SYSLINK_BUILD_OPTIMIZE)*/

    GT_1trace (curTrace, GT_LEAVE, "FrameQ_setFrameBufDataStartOffset",status);

    /*! @retval FrameQ_S_SUCCESS Successfully set data start offset of a
     * frame buffer.
     */
    return (status) ;
}
Example #26
0
/*
 *  ======== Memory_segAlloc ========
 */
Ptr Memory_segAlloc(Int segid, UInt size, UInt align)
{
    Ptr buf = malloc(size);

    GT_3trace(curTrace, GT_ENTER, "Memory_segAlloc(0x%lx, 0x%lx, 0x%lx)\n",
        segid, size, align);

    if (buf == NULL) {
        return (NULL);
    }

    memset(buf, '\0', size);

    return (buf);
}
Example #27
0
/*
 *  ======== LST_InsertBefore ========
 *  Purpose:
 *      Insert the element before the existing element.
 */
void LST_InsertBefore(struct LST_LIST *pList, struct LST_ELEM *pElem,
		      struct LST_ELEM *pElemExisting)
{

	GT_3trace(LST_debugMask, GT_ENTER, "LST_InsertBefore: pList 0x%x, "
		  "pElem 0x%x pElemExisting 0x%x\n", pList, pElem,
		  pElemExisting);

	if (!pList || !pElem || !pElemExisting)
		return;

	pElemExisting->prev->next = pElem;
	pElem->prev = pElemExisting->prev;
	pElem->next = pElemExisting;
	pElemExisting->prev = pElem;
}
Example #28
0
/*
 *  ======== KFILE_Seek ========
 *  Purpose:
 *      Sets the file position indicator. NOTE:  we don't support seeking
 *      beyond the boundaries of a file.
 */
s32 KFILE_Seek(struct KFILE_FileObj *hFile, s32 lOffset, s32 cOrigin)
{
	s32 cRetVal = 0;	/* 0 for success */
	u32 dwCurPos = 0;

	struct file *fileDesc = NULL;

	GT_3trace(KFILE_debugMask, GT_ENTER, "KFILE_Seek: hFile 0x%x, "
		  "lOffset 0x%x, cOrigin 0x%x\n",
		  hFile, lOffset, cOrigin);

	/* check for valid file handle */
	if (MEM_IsValidHandle(hFile, SIGNATURE)) {
		/* based on the origin flag, move the internal pointer */

	fileDesc = hFile->fileDesc;
		switch (cOrigin) {
		case KFILE_SEEK_SET:
			dwCurPos = hFile->fileDesc->f_op->llseek(hFile->
				   fileDesc, lOffset, SEEK_SET);
			cRetVal = ((dwCurPos >= 0) ? 0 : E_KFILE_ERROR);
			break;

		case KFILE_SEEK_CUR:
			dwCurPos = hFile->fileDesc->f_op->llseek(hFile->
				   fileDesc, lOffset, SEEK_CUR);
			cRetVal = ((dwCurPos >= 0) ? 0 : E_KFILE_ERROR);
			break;
		case KFILE_SEEK_END:
			dwCurPos = hFile->fileDesc->f_op->llseek(hFile->
				   fileDesc, lOffset, SEEK_END);
			cRetVal = ((dwCurPos >= 0) ? 0 : E_KFILE_ERROR);
			break;
		default:
			cRetVal = E_KFILE_BADORIGINFLAG;
			GT_0trace(KFILE_debugMask, GT_6CLASS,
				  "KFILE_Seek:bad origin flag\n");
			break;
		}
	} else {
		cRetVal = E_KFILE_INVALIDHANDLE;
		GT_0trace(KFILE_debugMask, GT_6CLASS,
			  "KFILE_Seek:invalid file handle\n");
	}
	return cRetVal;
}
Example #29
0
/*
 *  ======== Processor_create ========
 */
Processor_Handle Processor_create(String imageName, String linkCfg,
    Processor_Attrs *attrs)
{
    Processor_Handle proc = NULL;
    File_Stat statBuf;

    GT_assert(curTrace, curInit == TRUE);

    GT_3trace(curTrace, GT_ENTER, "Processor_create> "
        "Enter(imageName='%s', linkCfg='%s', attrs=0x%x)\n", imageName,
        linkCfg, attrs);

    if (attrs == NULL) {
        attrs = &Processor_ATTRS;
    }

    if ((!Global_useLinkArbiter) &&
            (File_stat(imageName, &statBuf) != File_EOK)) {
        GT_1trace(curTrace, GT_7CLASS, "Processor_create> "
            "ERROR: cannot access file %s\n", imageName);
        return (NULL);
    }

    if ((proc = Memory_alloc(sizeof(Processor_Obj), NULL)) == NULL) {
        GT_0trace(curTrace, GT_7CLASS, "Processor_create> "
            "ERROR: Memory_alloc failed\n");
        return (NULL);
    }

    proc->attrs = *attrs;
    proc->imageName = imageName;
    proc->linkConfigName = linkCfg;
    proc->loaded = FALSE;
    proc->powerHandle = NULL;
    proc->connected = FALSE;

    if (doCmd(CREATE, proc) != SUCCESS) {
        Processor_delete(proc);
        return (NULL);
    }
    proc->loaded = TRUE;

    GT_1trace(curTrace, GT_ENTER, "Processor_create> return (0x%x)\n", proc);

    return (proc);
}
Example #30
0
/* Frees up the specified chunk of memory. */
Void
Memory_free (IHeap_Handle heap, Ptr block, SizeT size)
{
    GT_3trace (curTrace, GT_ENTER, "Memory_free", heap, block, size);

    GT_assert (curTrace, (block != NULL));
    GT_assert (curTrace, (size > 0));

    if (heap == NULL) {
        MemoryOS_free (block, size, 0);
    }
    else {
        IHeap_free (heap, block, size);
    }

    GT_0trace (curTrace, GT_LEAVE, "Memory_free");
}