本文整理汇总了C++中OSFreeMem函数的典型用法代码示例。如果您正苦于以下问题:C++ OSFreeMem函数的具体用法?C++ OSFreeMem怎么用?C++ OSFreeMem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OSFreeMem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PVRSRVAllocHandleBase
/*!
******************************************************************************
@Function PVRSRVAllocHandleBase
@Description Allocate a handle base structure for a process
@Input ppsBase - pointer to handle base structure pointer
@Output ppsBase - points to handle base structure pointer
@Return Error code or PVRSRV_OK
******************************************************************************/
PVRSRV_ERROR PVRSRVAllocHandleBase(PVRSRV_HANDLE_BASE **ppsBase)
{
PVRSRV_HANDLE_BASE *psBase;
PVRSRV_ERROR eError;
if (gpsHandleFuncs == IMG_NULL)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVAllocHandleBase: Handle management not initialised"));
return PVRSRV_ERROR_NOT_READY;
}
if (ppsBase == IMG_NULL)
{
eError = PVRSRV_ERROR_INVALID_PARAMS;
goto err;
}
psBase = OSAllocZMem(sizeof(*psBase));
if (psBase == IMG_NULL)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVAllocHandleBase: Couldn't allocate handle base"));
eError = PVRSRV_ERROR_OUT_OF_MEMORY;
goto err;
}
eError = gpsHandleFuncs->pfnCreateHandleBase(&psBase->psImplBase);
if (eError != PVRSRV_OK)
{
goto ErrorFreeHandleBase;
}
psBase->psHashTab = HASH_Create_Extended(HANDLE_HASH_TAB_INIT_SIZE,
sizeof(HAND_KEY),
HASH_Func_Default,
HASH_Key_Comp_Default);
if (psBase->psHashTab == IMG_NULL)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVAllocHandleBase: Couldn't create data pointer hash table"));
eError = PVRSRV_ERROR_UNABLE_TO_CREATE_HASH_TABLE;
goto ErrorDestroyHandleBase;
}
*ppsBase = psBase;
return PVRSRV_OK;
ErrorDestroyHandleBase:
(IMG_VOID)gpsHandleFuncs->pfnDestroyHandleBase(psBase->psImplBase);
ErrorFreeHandleBase:
OSFreeMem(psBase);
err:
return eError;
}
示例2: OSSemFree
/*
* ###################################################################
* Función :
* Descripción :
* Parmámetros :
* Retorna :
* ###################################################################
*/
OS_ERROR OSSemFree(OS_SEM *sem)
{
OS_CPU_SR sr;
if(sem->OSBlockListHead != NULL) // y no tiene procesos bloqueados
return OS_ERROR_SEM_HAVE_BLOCKED_TASK;
sr = OSEnterCriticalSection();
OSRemoveSemCreatedList(sem); // Sacar de la lista de semaforos creados
OSExitCriticalSection(sr);
OSFreeMem(sem); // y liberar la memoria
return OS_ERROR_NONE;
}
示例3: PVRSRVFreeSyncInfoKM
IMG_EXPORT
PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeSyncInfoKM(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo)
{
PVRSRV_ERROR eError;
eError = FreeDeviceMem(psKernelSyncInfo->psSyncDataMemInfoKM);
(IMG_VOID)OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(PVRSRV_KERNEL_SYNC_INFO), psKernelSyncInfo, IMG_NULL);
return eError;
}
示例4: _PVRSRVSyncPrimServerUnexportKM
static PVRSRV_ERROR
_PVRSRVSyncPrimServerUnexportKM(SERVER_SYNC_EXPORT *psExport)
{
/* FIXME: Lock */
_ServerSyncUnref(psExport->psSync);
/* FIXME: Unlock */
OSFreeMem(psExport);
return PVRSRV_OK;
}
示例5: PVRSRVAllocSharedSysMemoryKM
IMG_EXPORT PVRSRV_ERROR
PVRSRVAllocSharedSysMemoryKM(PVRSRV_PER_PROCESS_DATA *psPerProc,
IMG_UINT32 ui32Flags,
IMG_SIZE_T uSize,
PVRSRV_KERNEL_MEM_INFO **ppsKernelMemInfo)
{
PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
sizeof(PVRSRV_KERNEL_MEM_INFO),
(IMG_VOID **)&psKernelMemInfo, IMG_NULL,
"Kernel Memory Info") != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVAllocSharedSysMemoryKM: Failed to alloc memory for meminfo"));
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
OSMemSet(psKernelMemInfo, 0, sizeof(*psKernelMemInfo));
ui32Flags &= ~PVRSRV_HAP_MAPTYPE_MASK;
ui32Flags |= PVRSRV_HAP_MULTI_PROCESS;
psKernelMemInfo->ui32Flags = ui32Flags;
psKernelMemInfo->uAllocSize = uSize;
if(OSAllocPages(psKernelMemInfo->ui32Flags,
psKernelMemInfo->uAllocSize,
(IMG_UINT32)HOST_PAGESIZE(),
IMG_NULL,
0,
IMG_NULL,
&psKernelMemInfo->pvLinAddrKM,
&psKernelMemInfo->sMemBlk.hOSMemHandle)
!= PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVAllocSharedSysMemoryKM: Failed to alloc memory for block"));
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
sizeof(PVRSRV_KERNEL_MEM_INFO),
psKernelMemInfo,
0);
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
/* register with the resman */
psKernelMemInfo->sMemBlk.hResItem =
ResManRegisterRes(psPerProc->hResManContext,
RESMAN_TYPE_SHARED_MEM_INFO,
psKernelMemInfo,
0,
&FreeSharedSysMemCallBack);
*ppsKernelMemInfo = psKernelMemInfo;
return PVRSRV_OK;
}
示例6: BM_FreeMemory
static void BM_FreeMemory(void *h, u32 _base, struct BM_MAPPING *psMapping)
{
struct BM_HEAP *pBMHeap = h;
size_t uPSize;
PVR_UNREFERENCED_PARAMETER(_base);
PVR_DPF(PVR_DBG_MESSAGE,
"BM_FreeMemory (h=%08X, base=0x%x, psMapping=0x%x)", h, _base,
psMapping);
PVR_ASSERT(psMapping != NULL);
if (psMapping == NULL) {
PVR_DPF(PVR_DBG_ERROR, "BM_FreeMemory: invalid parameter");
return;
}
DevMemoryFree(psMapping);
if ((psMapping->ui32Flags & PVRSRV_MEM_INTERLEAVED) != 0)
psMapping->uSize /= 2;
if (psMapping->ui32Flags & PVRSRV_MEM_DUMMY)
uPSize = psMapping->pBMHeap->sDevArena.ui32DataPageSize;
else
uPSize = psMapping->uSize;
if (pBMHeap->ui32Attribs & PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG) {
OSFreePages(pBMHeap->ui32Attribs, uPSize,
(void *)psMapping->CpuVAddr,
psMapping->hOSMemHandle);
} else if (pBMHeap->ui32Attribs & PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG) {
struct IMG_SYS_PHYADDR sSysPAddr;
OSUnReservePhys(psMapping->CpuVAddr, uPSize,
pBMHeap->ui32Attribs, psMapping->hOSMemHandle);
sSysPAddr = SysCpuPAddrToSysPAddr(psMapping->CpuPAddr);
RA_Free(pBMHeap->pLocalDevMemArena, sSysPAddr.uiAddr,
IMG_FALSE);
} else {
PVR_DPF(PVR_DBG_ERROR,
"BM_FreeMemory: Invalid backing store type");
}
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(struct BM_MAPPING), psMapping,
NULL);
PVR_DPF(PVR_DBG_MESSAGE,
"..BM_FreeMemory (h=%08X, base=0x%x, psMapping=0x%x)",
h, _base, psMapping);
}
示例7: AllocDeviceMem
static enum PVRSRV_ERROR AllocDeviceMem(void *hDevCookie, void *hDevMemHeap,
u32 ui32Flags, u32 ui32Size,
u32 ui32Alignment,
struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo)
{
struct PVRSRV_KERNEL_MEM_INFO *psMemInfo;
void *hBuffer;
struct PVRSRV_MEMBLK *psMemBlock;
IMG_BOOL bBMError;
PVR_UNREFERENCED_PARAMETER(hDevCookie);
*ppsMemInfo = NULL;
if (OSAllocMem(PVRSRV_PAGEABLE_SELECT,
sizeof(struct PVRSRV_KERNEL_MEM_INFO),
(void **) &psMemInfo, NULL) != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR,
"AllocDeviceMem: Failed to alloc memory for block");
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
OSMemSet(psMemInfo, 0, sizeof(*psMemInfo));
psMemBlock = &(psMemInfo->sMemBlk);
psMemInfo->ui32Flags = ui32Flags | PVRSRV_MEM_RAM_BACKED_ALLOCATION;
bBMError = BM_Alloc(hDevMemHeap, NULL, ui32Size,
&psMemInfo->ui32Flags, ui32Alignment, &hBuffer);
if (!bBMError) {
PVR_DPF(PVR_DBG_ERROR, "AllocDeviceMem: BM_Alloc Failed");
OSFreeMem(PVRSRV_PAGEABLE_SELECT,
sizeof(struct PVRSRV_KERNEL_MEM_INFO), psMemInfo,
NULL);
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
psMemBlock->sDevVirtAddr = BM_HandleToDevVaddr(hBuffer);
psMemBlock->hOSMemHandle = BM_HandleToOSMemHandle(hBuffer);
psMemBlock->hBuffer = (void *)hBuffer;
psMemInfo->pvLinAddrKM = BM_HandleToCpuVaddr(hBuffer);
psMemInfo->sDevVAddr = psMemBlock->sDevVirtAddr;
psMemInfo->ui32AllocSize = ui32Size;
psMemInfo->pvSysBackupBuffer = NULL;
*ppsMemInfo = psMemInfo;
return PVRSRV_OK;
}
示例8: CloseBCDeviceCallBack
static PVRSRV_ERROR CloseBCDeviceCallBack(IMG_PVOID pvParam,
IMG_UINT32 ui32Param)
{
PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *psBCPerContextInfo;
PVRSRV_BUFFERCLASS_INFO *psBCInfo;
PVR_UNREFERENCED_PARAMETER(ui32Param);
psBCPerContextInfo = (PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *)pvParam;
psBCInfo = psBCPerContextInfo->psBCInfo;
psBCInfo->ui32RefCount--;
if(psBCInfo->ui32RefCount == 0)
{
IMG_UINT32 i;
psBCInfo->psFuncTable->pfnCloseBCDevice(psBCInfo->hExtDevice);
for(i=0; i<psBCInfo->ui32BufferCount; i++)
{
if(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo)
{
PVRSRVFreeSyncInfoKM(psBCInfo->psBuffer[i].sDeviceClassBuffer.psKernelSyncInfo);
}
}
if(psBCInfo->psBuffer)
{
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BC_BUFFER), psBCInfo->psBuffer, IMG_NULL);
psBCInfo->psBuffer = IMG_NULL;
}
}
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(PVRSRV_BUFFERCLASS_PERCONTEXT_INFO), psBCPerContextInfo, IMG_NULL);
return PVRSRV_OK;
}
示例9: SysDestroyConfigData
IMG_VOID SysDestroyConfigData(PVRSRV_SYSTEM_CONFIG *psSysConfig)
{
PLAT_DATA *psPlatData = gpsPlatData;
PVR_UNREFERENCED_PARAMETER(psSysConfig);
PCIDeInitDev(psPlatData);
OSFreeMem(psPlatData);
#if defined(SUPPORT_ION)
IonDeinit();
#endif
}
示例10: _SyncRecordListDestroy
static IMG_BOOL _SyncRecordListDestroy(PDLLIST_NODE psNode, IMG_PVOID pvCallbackData)
{
struct SYNC_RECORD *pSyncRec;
PVR_UNREFERENCED_PARAMETER(pvCallbackData);
pSyncRec = IMG_CONTAINER_OF(psNode, struct SYNC_RECORD, sNode);
dllist_remove_node(psNode);
OSFreeMem(pSyncRec);
return IMG_TRUE;
}
示例11: PVRSRVTimeTraceBufferDestroy
/*!
******************************************************************************
@Function PVRSRVTimeTraceBufferDestroy
@Description
Destroy a trace buffer.
Note: We assume that this will only be called once per process.
@Input ui32PID : PID of the process that is creating the buffer
@Return none
******************************************************************************/
PVRSRV_ERROR PVRSRVTimeTraceBufferDestroy(IMG_UINT32 ui32PID)
{
sTimeTraceBuffer *psBuffer;
#if defined(DUMP_TTRACE_BUFFERS_ON_EXIT)
PVRSRVDumpTimeTraceBuffers();
#endif
psBuffer = (sTimeTraceBuffer *) HASH_Retrieve(g_psBufferTable, (IMG_UINTPTR_T) ui32PID);
if (psBuffer)
{
if (psBuffer->pui8Data)
OSFreeMem(PVRSRV_PAGEABLE_SELECT, TIME_TRACE_BUFFER_SIZE,
psBuffer->pui8Data, NULL);
OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(sTimeTraceBuffer),
psBuffer, NULL);
HASH_Remove(g_psBufferTable, (IMG_UINTPTR_T) ui32PID);
return PVRSRV_OK;
}
PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceBufferDestroy: Can't find trace buffer in hash table"));
return PVRSRV_ERROR_INVALID_PARAMS;
}
示例12: PDumpDeInit
void PDumpDeInit(void)
{
pdumpfs_cleanup();
if (gpszFile) {
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, SZ_FILENAME_SIZE_MAX,
(void *)gpszFile, NULL);
gpszFile = NULL;
}
if (gpszScript) {
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, SZ_SCRIPT_SIZE_MAX,
(void *)gpszScript, NULL);
gpszScript = NULL;
}
if (gpszComment) {
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, SZ_COMMENT_SIZE_MAX,
(void *)gpszComment, NULL);
gpszComment = NULL;
}
}
示例13: SysDestroyConfigData
IMG_VOID SysDestroyConfigData(PVRSRV_SYSTEM_CONFIG *psSysConfig)
{
PLAT_DATA *psPlatData = gpsPlatData;
PVR_UNREFERENCED_PARAMETER(psSysConfig);
PCIDeInitDev(psPlatData);
OSFreeMem(psPlatData);
#if defined(SUPPORT_ION)
#error "Need to check this function call"
IonDeinit(NULL);
#endif
}
示例14: PVRSRVBridgeTLTestIoctl
static IMG_INT
PVRSRVBridgeTLTestIoctl(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_TLTESTIOCTL *psTLTestIoctlIN,
PVRSRV_BRIDGE_OUT_TLTESTIOCTL *psTLTestIoctlOUT,
CONNECTION_DATA *psConnection)
{
IMG_BYTE *psIn1Int = IMG_NULL;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_PVRTL_TLTESTIOCTL);
PVR_UNREFERENCED_PARAMETER(psConnection);
{
psIn1Int = OSAllocMem(PVR_TL_TEST_PARAM_MAX_SIZE * sizeof(IMG_BYTE));
if (!psIn1Int)
{
psTLTestIoctlOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
goto TLTestIoctl_exit;
}
}
/* Copy the data over */
if ( !OSAccessOK(PVR_VERIFY_READ, (IMG_VOID*) psTLTestIoctlIN->psIn1, PVR_TL_TEST_PARAM_MAX_SIZE * sizeof(IMG_BYTE))
|| (OSCopyFromUser(NULL, psIn1Int, psTLTestIoctlIN->psIn1,
PVR_TL_TEST_PARAM_MAX_SIZE * sizeof(IMG_BYTE)) != PVRSRV_OK) )
{
psTLTestIoctlOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
goto TLTestIoctl_exit;
}
psTLTestIoctlOUT->eError =
TLServerTestIoctlKM(
psTLTestIoctlIN->ui32Cmd,
psIn1Int,
psTLTestIoctlIN->ui32In2,
&psTLTestIoctlOUT->ui32Out1,
&psTLTestIoctlOUT->ui32Out2);
TLTestIoctl_exit:
if (psIn1Int)
OSFreeMem(psIn1Int);
return 0;
}
示例15: TLClientCloseStream
IMG_INTERNAL
PVRSRV_ERROR TLClientCloseStream(IMG_HANDLE hSrvHandle,
IMG_HANDLE hSD)
{
PVRSRV_ERROR eError = PVRSRV_OK;
TL_STREAM_DESC* psSD = (TL_STREAM_DESC*) hSD;
PVR_ASSERT(hSrvHandle);
PVR_ASSERT(hSD);
/* Check the caller provided connection is valid */
if(!psSD->hServerSD)
{
PVR_DPF((PVR_DBG_ERROR, "TLClientCloseStream: descriptor already closed/not open"));
return PVRSRV_ERROR_HANDLE_NOT_FOUND;
}
/* Check if acquire is outstanding, perform release if it is, ignore result
* as there is not much we can do if it is an error other than close */
if (psSD->uiReadLen != NO_ACQUIRE)
{
(void) BridgeTLReleaseData(hSrvHandle, psSD->hServerSD,
psSD->uiReadOffset, psSD->uiReadLen);
psSD->uiReadLen = psSD->uiReadOffset = NO_ACQUIRE;
}
/* Clean up DevMem resources used for this stream in this client */
DevmemReleaseCpuVirtAddr(psSD->psUMmemDesc);
DevmemFree(psSD->psUMmemDesc);
/* Ignore error, not much that can be done */
(void) DevmemUnmakeServerExportClientExport(hSrvHandle,
&psSD->sExportCookie);
/* Send close to server to clean up kernel mode resources for this
* handle and release the memory. */
eError = BridgeTLCloseStream(hSrvHandle, psSD->hServerSD);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "BridgeTLCloseStream: KM returned %d", eError));
/*/ Not much we can do with error, fall through to clean up
* return eError; */
}
OSMemSet(psSD, 0x00, sizeof(TL_STREAM_DESC));
OSFreeMem (psSD);
return eError;
}