255 lines
12 KiB
C
Executable File
255 lines
12 KiB
C
Executable File
/* 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(x))
|
|
#define GF_SHIFTMASK(x) (GF_MASK(x)<< (GF_SHIFT(x)))
|
|
|
|
#define GF_DRF_DEF(d,r,f,c) ((d##_##r##_0_##f##_##c) << GF_SHIFT(d##_##r##_0_##f##_RANGE))
|
|
#define GF_DRF_NUM(d,r,f,n) (((n)& GF_MASK(d##_##r##_0_##f##_RANGE))<< GF_SHIFT(d##_##r##_0_##f##_RANGE))
|
|
#define GF_DRF_VAL(d,r,f,v) (((v)>> 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)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define VX_ERROR (GF_COMPONENT_REVERSE(GF_VXAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define JXD_ERROR (GF_COMPONENT_REVERSE(GF_JXDAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MXE_ERROR (GF_COMPONENT_REVERSE(GF_MXEAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MXD_ERROR (GF_COMPONENT_REVERSE(GF_MXDAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define DX_ERROR (GF_COMPONENT_REVERSE(GF_DXAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define ISP_ERROR (GF_COMPONENT_REVERSE(GF_ISPAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define BDEVSD_ERROR (GF_COMPONENT_REVERSE(GF_BDEVSDAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define I2C_ERROR (GF_COMPONENT_REVERSE(GF_I2CAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MMPROC_ERROR (GF_COMPONENT_REVERSE(GF_MMPROCAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define CAM_ERROR (GF_COMPONENT_REVERSE(GF_CAMAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MINISP_ERROR (GF_COMPONENT_REVERSE(GF_MINIMALISPAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MXDH264_ERROR (GF_COMPONENT_REVERSE(GF_MXDH264API)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MXEH264_ERROR (GF_COMPONENT_REVERSE(GF_MXEH264API)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MXDHVC1_ERROR (GF_COMPONENT_REVERSE(GF_MXDVC1API)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define MXDEMTS_ERROR (GF_COMPONENT_REVERSE(GF_MXDEMTSAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
#define RM_ERROR (GF_COMPONENT_REVERSE(GF_RMAPI)<<GF_COMPONENT_ERROR_SHIFT)
|
|
|
|
#define GFGX_ERROR (GF_ERROR | GX_ERROR)
|
|
#define GFVX_ERROR (GF_ERROR | VX_ERROR)
|
|
#define GFJXD_ERROR (GF_ERROR | JXD_ERROR)
|
|
#define GFMXE_ERROR (GF_ERROR | MXE_ERROR)
|
|
#define GFMXD_ERROR (GF_ERROR | MXD_ERROR)
|
|
#define GFDX_ERROR (GF_ERROR | DX_ERROR)
|
|
#define GFISP_ERROR (GF_ERROR | ISP_ERROR)
|
|
#define GFBDEVSD_ERROR (GF_ERROR | BDEVSD_ERROR)
|
|
#define GFI2C_ERROR (GF_ERROR | I2C_ERROR)
|
|
#define GFMMPROC_ERROR (GF_ERROR | MMPROC_ERROR)
|
|
#define GFCAM_ERROR (GF_ERROR | CAM_ERROR)
|
|
#define GFMXDH264_ERROR (GF_ERROR | MXDH264_ERROR)
|
|
#define GFMXEH264_ERROR (GF_ERROR | MXEH264_ERROR)
|
|
#define GFMXDVC1_ERROR (GF_ERROR | MXDHVC1_ERROR)
|
|
#define GFMXDEMTS_ERROR (GF_ERROR | MXDEMTS_ERROR)
|
|
#define GFRM_ERROR (GF_ERROR | RM_ERROR)
|
|
|
|
|
|
/* Function and Handle */
|
|
/** GFSDK error code.
|
|
GFSDK error codes are signed 32 bit values formed by combining the following 3 bitfields:
|
|
- bit 31 (sign) : set (0x80000000) indicating error
|
|
- bit 30-24 : 7 bit GFSDK component ID, in reversed bit order
|
|
- bit 23-0 : component local error codes
|
|
GFSDK component IDs are numbered contineously starting at 0.
|
|
Component local error codes are also numbered contineously starting at 0.
|
|
Using the 7 bit component ID in reverse bit order will asure set bits in
|
|
positions 31-24 in the combined error code to be top-aligned. Set bits in
|
|
the local error code positions 23-0 will be bottom-aligned. With this scheme
|
|
combined error codes are likely to fit into ARM immediate constants,
|
|
saving code size and execution time when error constants are accessed.
|
|
*/
|
|
typedef NvS32 GF_RETTYPE;
|
|
|
|
/** GFSDK handles to opaque structures. */
|
|
typedef void *GF_HANDLE;
|
|
typedef struct GFMinimalIspStruct_t *GFMinimalIspHandle;
|
|
typedef struct GF3DStruct_t *GF3DHandle;
|
|
typedef struct GFBDevStruct_t *GFBDevHandle;
|
|
typedef struct GFCameraStruct_t *GFCameraHandle;
|
|
typedef struct GFDiagStruct_t *GFDiagHandle;
|
|
typedef struct GFDxStruct_t *GFDxHandle;
|
|
typedef struct GFEPPStruct_t *GFEPPHandle;
|
|
typedef struct GFFDevStruct_t *GFFDevHandle;
|
|
typedef struct GFFDevDirStruct_t *GFFDevDirHandle;
|
|
typedef struct GFFDevFileStruct_t *GFFDevFileHandle;
|
|
typedef struct GFGxStruct_t *GFGxHandle;
|
|
typedef struct GFI2CStruct_t *GFI2CHandle;
|
|
typedef struct GFI2SStruct_t *GFI2SHandle;
|
|
typedef struct GFINTxStruct_t *GFINTxHandle;
|
|
typedef struct GFIspStruct_t *GFIspHandle;
|
|
typedef struct GFJxDecStruct_t *GFJxDecHandle;
|
|
typedef struct GFJxEncStruct_t *GFJxEncHandle;
|
|
typedef struct GFMmProcStruct_t *GFMmProcHandle;
|
|
typedef struct GFMxDecStruct_t *GFMxDecHandle;
|
|
typedef struct GFMxDecH264Struct_t *GFMxDecH264Handle;
|
|
typedef struct GFMxDecRV9Struct_t *GFMxDecRV9Handle;
|
|
typedef struct GFMxDecVC1Struct_t *GFMxDecVC1Handle;
|
|
typedef struct GFMxDemTSStruct_t *GFMxDemTSHandle;
|
|
typedef struct GFMxDemTSParserStruct_t *GFMxDemTSParserHandle;
|
|
typedef struct GFMxEncStruct_t *GFMxEncHandle;
|
|
typedef struct GFMxEncH264Struct_t *GFMxEncH264Handle;
|
|
typedef struct GFOSxStruct_t *GFOSxHandle;
|
|
typedef struct GFRmStruct_t *GFRmHandle;
|
|
typedef struct GFRmChStruct_t *GFRmChHandle;
|
|
typedef struct _GF_RM_DSP_TASK *GFRmDspTaskHandle;
|
|
typedef struct GFRmMemStruct_t *GFRmMemHandle;
|
|
typedef struct GFRmVmStruct_t *GFRmVmHandle;
|
|
typedef struct GFRmRdmaStruct_t *GFRmRdmaHandle;
|
|
typedef struct GFVxStruct_t *GFVxHandle;
|
|
|
|
|
|
#ifdef GF_XTENSA_RM_TASK
|
|
#define ATTRIBUTE(a) __attribute__(a)
|
|
#else
|
|
#define ATTRIBUTE(a)
|
|
#endif
|
|
|
|
|
|
/** GFSDK Component Property Structure. */
|
|
typedef struct _GFPROPERTY
|
|
{
|
|
NvU32 Capability; //!< Individual component's capability
|
|
NvU32 CapabilityEx; //!< Individual component's extended capability
|
|
} GFPROPERTY, *PGFPROPERTY;
|
|
|
|
/** Rectangle Structure. */
|
|
typedef struct _GFRECT
|
|
{
|
|
NvU16 top; //!< Top edge, inclusive
|
|
NvU16 left; //!< Left edge, inclusive
|
|
NvU16 right; //!< Right edge, inclusive
|
|
NvU16 bottom; //!< Bottom edge, inclusive
|
|
} GFRECT, *PGFRECT;
|
|
|
|
/** Component level interrupt status. */
|
|
typedef enum
|
|
{
|
|
GF_INTERRUPT_OFF_STATUS_FALSE, /**< Component level interrupt is disabled,
|
|
the interrupt status is false.
|
|
*/
|
|
GF_INTERRUPT_ON_STATUS_FALSE, /**< Component level interrupt is enabled,
|
|
the interrupt status is false.
|
|
*/
|
|
GF_INTERRUPT_OFF_STATUS_TRUE, /**< Component level interrupt is disabled,
|
|
the interrupt status is true.
|
|
*/
|
|
GF_INTERRUPT_ON_STATUS_TRUE /**< Component level interrupt is enabled,
|
|
the interrupt status is true.
|
|
*/
|
|
} GF_INTERRUPT_STATUS_TYPE;
|
|
|
|
/** GPIO status descriptor.
|
|
|
|
This structure is to return GPIO pin status after a call to GFDxFPGPIO(),
|
|
GFVxVIPGPIO(), or GFIxSDGPIO(). These operations are for common GPIO
|
|
manipulations of the input enable, output enable, output select and data bits
|
|
in the various WMP modules. The bits can be set to 1 or cleared to 0, and their
|
|
status can be obtained.
|
|
|
|
@see GFDxFPGPIO(), GFVxVIPGPIO(), GFIxSDGPIO()
|
|
*/
|
|
|
|
/* GFGPIOSTATUS - GPIO Status */
|
|
typedef struct _GFGPIOSTATUS
|
|
{
|
|
NvU32 in_data; /**< Input data bit */
|
|
NvU32 in_enable; /**< Input enable bit */
|
|
NvU32 out_enable; /**< Output enable bit */
|
|
NvU32 out_data; /**< Output data bit */
|
|
NvU32 out_select; /**< Output select bit */
|
|
} GFGPIOSTATUS, *PGFGPIOSTATUS;
|
|
|
|
/* GFBLOCKLIST - Block list */
|
|
typedef struct _GFBLOCKLIST
|
|
{
|
|
NvU32 blockIndex; // Index of block
|
|
NvU32 blockCount; // Number of blocks to this index, value of 0
|
|
// marks last block
|
|
} GFBLOCKLIST, *PGFBLOCKLIST;
|
|
|
|
/** States for Component Manager and general services.
|
|
@see GFRmComponentGet(), GFRmComponentRelease().
|
|
*/
|
|
typedef NvU32 GF_STATE_TYPE;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* __GFDEF_H__ */
|
|
|