/* Copyright (c) 2006 NVIDIA Corporation. All rights reserved. * * NVIDIA Corporation and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation * and any modifications thereto. Any use, reproduction, disclosure or * distribution of this software and related documentation without an * express license agreement from NVIDIA Corporation is strictly prohibited. */ /* * File: GFDef.h * GFSDK Definition header file */ #ifndef __GFDEF_H__ #define __GFDEF_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "GFDefScr.h" /* Register field manipulation using xxx_RANGE macros defined in hardware * header files. */ #define GF_LOWBIT(x) (0?x) #define GF_HIGHBIT(x) (1?x) #define GF_SIZE(x) (GF_HIGHBIT(x)-GF_LOWBIT(x)+1) #define GF_SHIFT(x) ((0?x)%32) #define GF_MASK(x) (0xFFFFFFFFUL>>(31-((1?x)%32)+((0?x)%32))) #define GF_BITS(val, x) (((val) & GF_MASK(x))<> GF_SHIFT(d##_##r##_0_##f##_RANGE))& GF_MASK(d##_##r##_0_##f##_RANGE)) #define GF_FLD_SET_DRF_NUM(d,r,f,n,v) ((v & ~GF_SHIFTMASK(d##_##r##_0_##f##_RANGE)) | GF_DRF_NUM(d,r,f,n)) #define GF_FLD_SET_DRF_DEF(d,r,f,c,v) (((v) & ~GF_SHIFTMASK(d##_##r##_0_##f##_RANGE)) | GF_DRF_DEF(d,r,f,c)) #define GF_RESETVAL(d,r) (d##_##r##_0_RESET_VAL) #define OP_DRF_DEF(o,f,c) ((o##_##f##_##c) << GF_SHIFT(o##_##f##_RANGE)) #define OP_DRF_NUM(o,f,n) (((n)& GF_MASK(o##_##f##_RANGE))<< GF_SHIFT(o##_##f##_RANGE)) #define OP_DRF_VAL(o,f,v) (((v)>> GF_SHIFT(o##_##f##_RANGE))& GF_MASK(o##_##f##_RANGE)) #define OP_FLD_SET_DRF_NUM(o,f,n,v) ((v & ~GF_SHIFTMASK(o##_##f##_RANGE)) | GF_DRF_NUM(o,f,n)) #define OP_FLD_SET_DRF_DEF(o,f,c,v) (((v) & ~GF_SHIFTMASK(o##_##f##_RANGE)) | GF_DRF_DEF(o,f,c)) /* Default Return Codes */ /* - All errors has MSB set, indicate a negative val. */ /** Macro to test if an error code of type GF_RETTYPE signals failure. @param code (GF_RETTYPE) Error code @return Evaluates to \a true on failure, \a false on success. */ #define ISGFERROR(code) ((GF_RETTYPE)(code) < GF_SUCCESS) /** Macro to test if an error code of type GF_RETTYPE signals success. @param code (GF_RETTYPE) Error code @return Evaluates to \a true on success, \a false on failure. */ #define ISGFSUCCESS(code) ((GF_RETTYPE)(code) >= GF_SUCCESS) /** Common error code: Generic error. */ #define GF_ERROR 0x80000000L /** Common error code: Success (not an error). */ #define GF_SUCCESS 0x00000000L /** Common error code: Busy (not an error). */ #define GF_ERROR_BUSY 0x80000001L /** Common error code: Out of memory. This can be CPU heap memory, or GPU memory. */ #define GF_ERROR_OUT_MEMORY 0x80000003L /** Common error code: Bad parameter. */ #define GF_ERROR_BAD_PARAMETER 0x80000005L #define GF_COMPONENT_ERROR_SHIFT 24 /** Macro to reverse bits of the 7 bit component ID. See GF_RETTYPE for explanation. */ #define GF_COMPONENT_REVERSE(c) ((((c)&64)>>6)|(((c)&32)>>4)|(((c)&16)>>2)|((c)&8)|(((c)&4)<<2)|(((c)&2)<<4)|(((c)&1)<<6)) #define GX_ERROR (GF_COMPONENT_REVERSE(GF_GXAPI)<