本文整理汇总了C++中IMG_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ IMG_ASSERT函数的具体用法?C++ IMG_ASSERT怎么用?C++ IMG_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMG_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SYSDEVKM_OpenDevice
/*!
******************************************************************************
@Function SYSDEVKM_OpenDevice
******************************************************************************/
IMG_RESULT SYSDEVKM_OpenDevice(
IMG_CHAR * pszDeviceName,
IMG_HANDLE * phSysDevHandle
)
{
IMG_UINT32 ui32Result;
SYSDEVKM_sDevice * psDevice;
/* Allocate a device structure...*/
psDevice = IMG_MALLOC(sizeof(*psDevice));
IMG_ASSERT(psDevice != IMG_NULL);
if (psDevice == IMG_NULL)
{
return IMG_ERROR_OUT_OF_MEMORY;
}
IMG_MEMSET(psDevice, 0, sizeof(*psDevice));
/* Get the device id...*/
ui32Result = SYSDEVU_GetDeviceId(pszDeviceName, &psDevice->ui32DeviceId);
IMG_ASSERT(ui32Result == IMG_SUCCESS);
if (ui32Result != IMG_SUCCESS)
{
return ui32Result;
}
/* Return the device handle...*/
*phSysDevHandle = psDevice;
/* Update count...*/
SYSOSKM_DisableInt();
gsActiveOpenCnt++;
SYSOSKM_EnableInt();
return IMG_SUCCESS;
}
示例2: POOL_PoolCreate
/*!
******************************************************************************
@Function POOL_PoolCreate
******************************************************************************/
IMG_RESULT POOL_PoolCreate(
IMG_HANDLE * phPoolHandle
)
{
POOL_sResPool * psResPool;
IMG_UINT32 ui32Result;
IMG_ASSERT(gInitialised);
/* Allocate a pool structure...*/
psResPool = IMG_MALLOC(sizeof(*psResPool));
IMG_ASSERT(psResPool != IMG_NULL);
if (psResPool == IMG_NULL)
{
return IMG_ERROR_OUT_OF_MEMORY;
}
IMG_MEMSET(psResPool, 0, sizeof(*psResPool));
/* Initialise the pool info...*/
LST_init(&psResPool->sFreeResList);
LST_init(&psResPool->sActResList);
/* Create mutex...*/
ui32Result = SYSOSKM_CreateMutex(&psResPool->hMutexHandle);
IMG_ASSERT(ui32Result == IMG_SUCCESS);
if (ui32Result != IMG_SUCCESS)
{
goto error_create_mutex;
}
/* Create context for the Id generator...*/
ui32Result = IDGEN_CreateContext(POOL_IDGEN_MAX_ID, POOL_IDGEN_BLOCK_SIZE,IMG_FALSE, &psResPool->hIdGenHandle);
IMG_ASSERT(ui32Result == IMG_SUCCESS);
if (ui32Result != IMG_SUCCESS)
{
goto error_create_context;
}
/* Disable interrupts. */
SYSOSKM_DisableInt();
/* Add to list of pools...*/
LST_add(&gsPoolList, psResPool);
/* Enable interrupts. */
SYSOSKM_EnableInt();
/* Return handle to pool...*/
*phPoolHandle = psResPool;
return IMG_SUCCESS;
/* Error handling. */
error_create_context:
SYSOSKM_DestroyMutex(psResPool->hMutexHandle);
error_create_mutex:
IMG_FREE(psResPool);
return ui32Result;
}
示例3: jpg_vlc_decode_direct_symbols
static uint32_t
jpg_vlc_decode_direct_symbols(const vlc_symbol_code_jpeg * symbol_code, uint16_t * const table_ram, const uint32_t width,
const uint32_t leading) {
uint32_t offset, limit;
uint16_t entry;
/* this function is only for codes short enough to produce valid symbols */
IMG_ASSERT( symbol_code->code_length <= leading + width );
IMG_ASSERT( symbol_code->code_length > leading );
/* lose bits already decoded */
offset = symbol_code->code << leading;
offset &= JPG_MAKE_MASK(JPG_VLC_MAX_CODE_LEN);
/* convert truncated code to offset */
offset >>= (JPG_VLC_MAX_CODE_LEN - width);
/* expand offset to encorporate undefined code bits */
limit = offset + (1 << (width - (symbol_code->code_length - leading)));
/* for all code variants - insert symbol into the decode direct result table */
entry = jpg_vlc_valid_symbol( symbol_code, leading );
for (; offset < limit; offset++) {
table_ram[offset] = entry;
}
/* return the number of entries written */
return limit - offset - 1;
}
示例4: VXDIO_PDUMPDisableCmds
/*!
******************************************************************************
@Function VXDIO_PDUMPDisableCmds
******************************************************************************/
IMG_UINT32
VXDIO_PDUMPDisableCmds(
const IMG_HANDLE hVxdCtx,
IMG_UINT32 ui32MemRegion,
IMG_UINT32 ui32Offset,
IMG_UINT32 ui32DisableFlags
)
{
VXDIO_sContext *psVxdCtx = (VXDIO_sContext *)hVxdCtx;
IMG_ASSERT(psVxdCtx != IMG_NULL);
IMG_ASSERT(psVxdCtx->ui32MemSpaceCount != 0);
if (ui32MemRegion >= psVxdCtx->ui32MemSpaceCount)
{
REPORT(REPORT_MODULE_VXDIO, REPORT_ERR,
"A valid VXD memory region must be provided");
return IMG_ERROR_INVALID_PARAMETERS;
}
TALPDUMP_DisableCmds(psVxdCtx->pahMemSpace[ui32MemRegion],
ui32Offset, ui32DisableFlags);
return IMG_SUCCESS;
}
示例5: SYSDEVU_InvokeDevKmLisr
/*!
******************************************************************************
@Function SYSDEVU_InvokeDevKmLisr
******************************************************************************/
IMG_RESULT SYSDEVU_InvokeDevKmLisr(
IMG_UINT32 ui32DeviceId
)
{
IMG_UINT32 ui32Result;
SYSDEVU_sInfo *dev = findDeviceById(ui32DeviceId);
if(!gSysDevInitialised || !dev)
{
IMG_ASSERT(gSysDevInitialised);
IMG_ASSERT(dev);
ui32Result = IMG_ERROR_INVALID_PARAMETERS;
return ui32Result;
}
IMG_ASSERT(dev->pfnDevKmLisr != IMG_NULL);
if(dev->pfnDevKmLisr == IMG_NULL)
{
ui32Result = IMG_ERROR_INVALID_PARAMETERS;
return ui32Result;
}
dev->pfnDevKmLisr(dev->pvParam);
return IMG_SUCCESS;
}
示例6: CpuKmAddrToCpuPAddr
static IMG_PHYSADDR CpuKmAddrToCpuPAddr(
SYSMEM_Heap * heap,
IMG_VOID * pvCpuKmAddr
)
{
IMG_PHYSADDR ret = 0;
if(virt_addr_valid(pvCpuKmAddr))
{
/* direct mapping of kernel addresses.
* this works for kmalloc.
*/
ret = virt_to_phys(pvCpuKmAddr);
}
else
{
/* walk the page table.
* Works for ioremap, vmalloc, and kmalloc(GPF_DMA),
but not, for some reason, kmalloc(GPF_KERNEL)
*/
struct page * pg = vmalloc_to_page(pvCpuKmAddr);
if(pg) {
ret = page_to_phys(pg);
}
else {
IMG_ASSERT(!"vmalloc_to_page failure");
}
}
IMG_ASSERT(ret != 0);
return ret;
}
示例7: POOL_Free
/*!
********************************************************************************
@Function POOL_Free
@Description
Free an sObject previously allocated from an sObject sPool.
@Input psPool : Object Pool pointer.
@Output hObject : Handle to the object to be freed.
@Return IMG_RESULT : IMG_SUCCESS or an error code.
********************************************************************************/
IMG_RESULT POOL_Free(
struct sPool * const psPool,
IMG_HANDLE const hObject
)
{
struct sObject * psObject = IMG_NULL;
IMG_UINT32 ui32Result = IMG_ERROR_FATAL;
IMG_ASSERT(IMG_NULL != psPool);
IMG_ASSERT(IMG_NULL != hObject);
if (IMG_NULL == psPool ||
IMG_NULL == hObject)
{
ui32Result = IMG_ERROR_INVALID_PARAMETERS;
goto error;
}
psObject = (struct sObject *)hObject;
psObject->psNext = psPool->psObjects;
psPool->psObjects = psObject;
ui32Result = IMG_SUCCESS;
error:
return ui32Result;
}
示例8: SYSDEVU_GetMemoryInfo
IMG_VOID SYSDEVU_GetMemoryInfo(
IMG_UINT32 ui32DeviceId,
IMG_VOID ** ppvKmMemory,
IMG_PHYSADDR * ppaPhysMemory,
IMG_UINT64 * pui64MemSize,
IMG_UINT64 * pui64DevMemoryBase
) {
#ifndef __FAKE_HW__
SYSDEVU_sInfo *dev = findDeviceById(ui32DeviceId);
if(!gSysDevInitialised || !dev)
{
IMG_ASSERT(gSysDevInitialised);
IMG_ASSERT(dev);
return;
}
if(ppvKmMemory)
*ppvKmMemory = dev->pui32KmMemBase;
if(ppaPhysMemory)
*ppaPhysMemory = dev->paPhysMemBase;
if(pui64MemSize)
*pui64MemSize = dev->ui32MemSize;
if(pui64DevMemoryBase)
*pui64DevMemoryBase = (IMG_UINT64)dev->pui64DevMemoryBase;
#endif
}
示例9: mmu_GetTileRegion
/*!
******************************************************************************
@Function mmu_GetTileRegion
******************************************************************************/
IMG_INT32 mmu_GetTileRegion(
IMG_UINT32 ui32MMUId,
IMG_UINT64 ui64DevVirtAddr
)
{
IMG_UINT32 i;
MMU_sContextCB *psContextCB = mmu_GetContext(ui32MMUId);
IMG_ASSERT(gbMMUInitialised);
IMG_ASSERT (psContextCB);
/* If the context has tile regions...*/
if (psContextCB->bTiledRegionDefined)
{
/* Loop over regions...*/
for (i=0; i<MMU_NUMBER_OF_TILED_REGIONS; i++)
{
/* If region defined...*/
if (psContextCB->asTiledRegionCB[i].ui64Size != 0)
{
/* If device virtual address is within a tiled region...*/
if (
(ui64DevVirtAddr >= psContextCB->asTiledRegionCB[i].ui64DevVirtAddr) &&
(ui64DevVirtAddr < (psContextCB->asTiledRegionCB[i].ui64DevVirtAddr+psContextCB->asTiledRegionCB[i].ui64Size))
)
{
return i;
}
}
}
}
return -1;
}
示例10: LOG_Enable
/*!
******************************************************************************
@Function LOG_Enable
******************************************************************************/
IMG_VOID LOG_Enable(
IMG_UINT32 ui32Api,
LOG_eLevel eLevel,
LOG_eLogMode eLogMode
)
{
if (ui32Api == LOG_ALL_APIS)
{
/* Loop over APIs */
for (ui32Api=0; ui32Api<API_ID_MAX; ui32Api++)
{
LOG_Enable(ui32Api, eLevel, eLogMode);
}
}
else
{
IMG_ASSERT(gInitialised);
/* Ensure that the API is valid */
IMG_ASSERT(ui32Api < API_ID_MAX);
gbLogEnabled = IMG_TRUE;
/* Set log level and mode */
gaeLogApi[ui32Api].eLevel = eLevel;
gaeLogApi[ui32Api].eLogMode = eLogMode;
}
}
示例11: SYSDEVU_SetPowerState
/*!
******************************************************************************
@Function SYSDEVU_SetPowerState
******************************************************************************/
IMG_VOID SYSDEVU_SetPowerState(
IMG_HANDLE hSysDevHandle,
SYSOSKM_ePowerState ePowerState,
IMG_BOOL forAPM
)
{
SYSDEVU_sInfo * psDevice = (SYSDEVU_sInfo *)hSysDevHandle;
IMG_ASSERT(gSysDevInitialised);
IMG_ASSERT(hSysDevHandle != IMG_NULL);
if (hSysDevHandle == IMG_NULL)
{
return;
}
switch(ePowerState) {
case SYSOSKM_POWERSTATE_S5: // suspend
SYSDEVU_HandleSuspend(psDevice, forAPM);
break;
case SYSOSKM_POWERSTATE_S0: // resume
SYSDEVU_HandleResume(psDevice, forAPM);
break;
}
}
示例12: MMU_Setup
/*!
******************************************************************************
@Function MMU_Setup
******************************************************************************/
IMG_RESULT MMU_Setup (
IMG_UINT32 ui32MMUId,
IMG_UINT64 ui64PCAddress,
IMG_UINT32 ui32MMUType,
MMU_pfnReadMem pfnReadMem
)
{
MMU_sContextCB *psContextCB;
IMG_ASSERT(gbMMUInitialised);
IMG_ASSERT(ui32MMUId < MMU_NUMBER_OF_CONTEXTS);
psContextCB = &gasContextCBs[ui32MMUId];
if (psContextCB->ui32MMUType == MMU_TYPE_NONE)
gui32ContextsInUse++;
memset(psContextCB, 0, sizeof(MMU_sContextCB));
psContextCB->ui64PCAddress = ui64PCAddress;
psContextCB->ui32MMUType = ui32MMUType;
psContextCB->ui32BusWidth = gasMMUTypesLookup[ui32MMUType].ui32BusWidth;
psContextCB->pfnReadLookup = pfnReadMem;
psContextCB->pfnReadPage = pfnReadMem;
return IMG_SUCCESS;
}
示例13: SYSDEVU_RegisterDevKmLisr
/*!
******************************************************************************
@Function SYSDEVU_RegisterDevKmLisr
******************************************************************************/
IMG_VOID SYSDEVU_RegisterDevKmLisr(
IMG_HANDLE hSysDevHandle,
SYSDEVU_pfnDevKmLisr pfnDevKmLisr,
IMG_VOID * pvParam
)
{
SYSDEVU_sInfo * dev = (SYSDEVU_sInfo *)hSysDevHandle;
IMG_ASSERT(gSysDevInitialised);
IMG_ASSERT(hSysDevHandle != IMG_NULL);
if (hSysDevHandle == IMG_NULL)
{
return;
}
if (
(pfnDevKmLisr != IMG_NULL) &&
(dev->pfnDevKmLisr != IMG_NULL)
)
{
IMG_ASSERT(dev->pfnDevKmLisr == pfnDevKmLisr);
IMG_ASSERT(dev->pvParam == pvParam);
}
else
{
dev->pfnDevKmLisr = pfnDevKmLisr;
dev->pvParam = pvParam;
}
}
示例14: SYSDEVU_CpuPAddrToDevPAddr
/*!
******************************************************************************
@Function SYSDEVU_CpuPAddrToDevPAddr
******************************************************************************/
IMG_PHYSADDR SYSDEVU_CpuPAddrToDevPAddr(
IMG_HANDLE hSysDevHandle,
IMG_PHYSADDR paCpuPAddr
)
{
SYSDEVU_sInfo * psSysDev = (SYSDEVU_sInfo *)hSysDevHandle;
IMG_ASSERT(gSysDevInitialised);
IMG_ASSERT(hSysDevHandle != IMG_NULL);
if (hSysDevHandle == IMG_NULL)
{
return 0;
}
/*
* If conversion routines isn't added by the customer ( using sysdev ),
* we assume that it's a unified memory model where pa == dev_pa
*/
if (!psSysDev->ops->paddr_to_devpaddr)
return paCpuPAddr;
return psSysDev->ops->paddr_to_devpaddr(psSysDev, paCpuPAddr);
}
示例15: SYSDEVU_Initialise
/*!
******************************************************************************
@Function SYSDEVU_Initialise
******************************************************************************/
IMG_RESULT SYSDEVU_Initialise(IMG_VOID)
{
/* If not initialised...*/
if (!gSysDevInitialised)
{
IMG_RESULT eResult;
eResult = SYSOSKM_CreateAtomic(&gsActiveOpenCnt);
IMG_ASSERT(eResult == IMG_SUCCESS);
if (eResult != IMG_SUCCESS)
{
return eResult;
}
LST_init(&gsDevList);
eResult = SYSOSKM_CreateMutex(&hNextDeviceIdMutex);
IMG_ASSERT(eResult == IMG_SUCCESS);
if (eResult != IMG_SUCCESS)
{
return eResult;
}
/* use a magic number to help detect dereferences of
DeviceId when (wrongly) casted as a pointer */
gui32NextDeviceId = 0xbeef00;
/* Now we are initialised...*/
gSysDevInitialised = IMG_TRUE;
}
return IMG_SUCCESS;
}