debug.c

来自「Lido PXA270平台开发板的最新BSP,包括源代码」· C语言 代码 · 共 2,713 行 · 第 1/5 页

C
2,713
字号
			break;
		}

		case MBX1_TASTATEPRES_ISPCTL:
		{
			pszFlagName = "ISPTSPCtl";
			break;
		}

		case MBX1_TASTATEPRES_TSPCTL:
		{
			pszFlagName = "TSPCtl";
			break;
		}

		case MBX1_TASTATEPRES_LAYER0CTL:
		{
			pszFlagName = "TSPL0Ctl";
			break;
		}

		case MBX1_TASTATEPRES_LAYER1CTL:
		{
			pszFlagName = "TSPL1Ctl";
			break;
		}

		case MBX1_TASTATEPRES_REGIONCLIP:
		{
			pszFlagName = "RgnClip";
			break;
		}

		case MBX1_TASTATEPRES_VGP_IFDEFINITION:
		{
			pszFlagName = "VGPIFDef";
			break;
		}

		case MBX1_TASTATEPRES_FP_INPUTFORMAT:
		{
			pszFlagName = "FPFormat";
			break;
		}

		case MBX1_TASTATEPRES_VGP_VIEWPORTTRANS:
		{
			pszFlagName = "VPTrans";
			break;
		}

		case MBX1_TASTATEPRES_VGP_WCLAMPVAL:
		{
			pszFlagName = "WClamp";
			break;
		}

		default:
		{
			pszFlagName = "invalid";
			break;
		}
	}

	return pszFlagName;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeTACtl3DStateBlockHdrPresFlags
    
 PURPOSE	: Decodes the state-pesence flags in a TA-ctl/3D-state block
			  header

 PARAMETERS	: dwHeader	- A TA-Ctl/3D-state block header word
  
 RETURNS	: PSTR		- That state-presence flags set
*****************************************************************************/
PSTR DBGDecodeTACtl3DStateBlockHdrPresFlags(DWORD dwHeader)
{
	static char	pszStatePresent[100];
	DWORD			dwFlag;
	DWORD			dwNumPresent;

	dwNumPresent = 0;

	strcpy(pszStatePresent, "");

	for (dwFlag = MBX1_TASTATEPRES_ISPCTL; 
		 dwFlag <= MBX1_TASTATEPRES_VGP_WCLAMPVAL; 
		 dwFlag <<= 1)
	{
		if	(dwHeader & dwFlag)
		{
			dwHeader ^= dwFlag;

			if	(dwNumPresent > 0)
			{
				if	(dwHeader)
				{
					strcat(pszStatePresent, ", ");	
				}
			}
			strcat(pszStatePresent, DBGDecodeTACtl3DStateBlockHdrPresFlag(dwFlag));

			dwNumPresent++;
		}
	}

	if	(dwNumPresent == 0)
	{
		strcpy(pszStatePresent, "none");
	}

	if	(dwNumPresent == 9)
	{
		strcpy(pszStatePresent, "all");
	}

	return pszStatePresent;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeISPTSPSrcBlendCtl
    
 PURPOSE	: Decodes the source-blend mode in the ISP/TSP control word

 PARAMETERS	: dwISPTSPCtl	- The control word to decode
  
 RETURNS	: PSTR			- The decoded source blend mode
*****************************************************************************/
PSTR DBGDecodeISPTSPSrcBlendCtl(DWORD dwISPTSPCtl)
{
	DWORD	dwSrcBlendMode;
	PSTR	pszModeName;

	dwSrcBlendMode = dwISPTSPCtl & (~MBX1_ISPTSPCTL_SRCBLENDCLRMASK);
	switch (dwSrcBlendMode)
	{
		case MBX1_ISPTSPCTL_SRCBLENDZERO:
		{
			pszModeName = "Zero";
			break;
		}

		case MBX1_ISPTSPCTL_SRCBLENDONE:
		{
			pszModeName = "One";
			break;
		}

		case MBX1_ISPTSPCTL_SRCBLENDDESTCOL:
		{
			pszModeName = "Dest-colour";
			break;
		}

		case MBX1_ISPTSPCTL_SRCBLENDINVDESTCOL:
		{
			pszModeName = "InvDestColour";
			break;
		}

		case MBX1_ISPTSPCTL_SRCBLENDSRCALPHA:
		{
			pszModeName = "SrcAlpha";
			break;
		}

		case MBX1_ISPTSPCTL_SRCBLENDINVSRCALPHA:
		{
			pszModeName = "InvSrcAlpha";
			break;
		}

		case MBX1_ISPTSPCTL_SRCBLENDDESTALPHA:
		{
			pszModeName = "DestAlpha";
			break;
		}

		case MBX1_ISPTSPCTL_SRCBLENDINVDESTALPHA:
		{
			pszModeName = "InvDestAlpha";
			break;
		}

		default:
		{
			pszModeName = "Invalid";
			break;
		}
	}

	return pszModeName;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeISPTSPDestBlendCtl
    
 PURPOSE	: Decodes the destination-blend mode in the ISP/TSP control word

 PARAMETERS	: dwISPTSPCtl	- The control word to decode
  
 RETURNS	: PSTR			- The decoded destination blend mode
*****************************************************************************/
PSTR DBGDecodeISPTSPDestBlendCtl(DWORD dwISPTSPCtl)
{
	DWORD	dwDestBlendMode;
	PSTR	pszModeName;

	dwDestBlendMode = dwISPTSPCtl & (~MBX1_ISPTSPCTL_DESTBLENDCLRMASK);
	switch (dwDestBlendMode)
	{
		case MBX1_ISPTSPCTL_DESTBLENDZERO:
		{
			pszModeName = "Zero";
			break;
		}

		case MBX1_ISPTSPCTL_DESTBLENDONE:
		{
			pszModeName = "One";
			break;
		}

		case MBX1_ISPTSPCTL_DESTBLENDSRCCOL:
		{
			pszModeName = "SrcColour";
			break;
		}

		case MBX1_ISPTSPCTL_DESTBLENDINVSRCCOL:
		{
			pszModeName = "InvSrcColour";
			break;
		}

		case MBX1_ISPTSPCTL_DESTBLENDSRCALPHA:
		{
			pszModeName = "SrcAlpha";
			break;
		}

		case MBX1_ISPTSPCTL_DESTBLENDINVSRCALPHA:
		{
			pszModeName = "InvSrcAlpha";
			break;
		}

		case MBX1_ISPTSPCTL_DESTBLENDDESTALPHA:
		{
			pszModeName = "DestAlpha";
			break;
		}

		case MBX1_ISPTSPCTL_DESTBLENDINVDESTALPHA:
		{
			pszModeName = "InvDestAlpha";
			break;
		}

		default:
		{
			pszModeName = "Invalid";
			break;
		}
	}

	return pszModeName;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeISPTSPLogicalOp
    
 PURPOSE	: Decodes the logical-op in the ISP/TSP control word

 PARAMETERS	: dwISPTSPCtl	- The control word to decode
  
 RETURNS	: PSTR			- The decoded logical-operation
*****************************************************************************/
PSTR DBGDecodeISPTSPLogicalOp(DWORD dwISPTSPCtl)
{
	DWORD	dwLocalOpCtl;
	PSTR	pszLogicalOp;

	dwLocalOpCtl = dwISPTSPCtl & MBX1_ISPTSPCTL_LO_MASK;
	switch (dwLocalOpCtl)
	{
		case MBX1_ISPTSPCTL_LO_CLEAR:
		{
			pszLogicalOp = "Clear";
			break;
		}

		case MBX1_ISPTSPCTL_LO_AND:
		{
			pszLogicalOp = "AND";
			break;
		}

		case MBX1_ISPTSPCTL_LO_AND_REVERSE:
		{
			pszLogicalOp = "AND Reverse";
			break;
		}

		case MBX1_ISPTSPCTL_LO_COPY:
		{
			pszLogicalOp = "Copy";
			break;
		}

		case MBX1_ISPTSPCTL_LO_AND_INVERSE:
		{
			pszLogicalOp = "AND Inverse";
			break;
		}

		case MBX1_ISPTSPCTL_LO_NOOP:
		{
			pszLogicalOp = "NO-OP";
			break;
		}

		case MBX1_ISPTSPCTL_LO_XOR:
		{
			pszLogicalOp = "XOR";
			break;
		}

		case MBX1_ISPTSPCTL_LO_OR:
		{
			pszLogicalOp = "OR";
			break;
		}

		case MBX1_ISPTSPCTL_LO_NOR:
		{
			pszLogicalOp = "NOR";
			break;
		}

		case MBX1_ISPTSPCTL_LO_EQUIV:
		{
			pszLogicalOp = "Equiv";
			break;
		}

		case MBX1_ISPTSPCTL_LO_INVERT:
		{
			pszLogicalOp = "Invert";
			break;
		}

		case MBX1_ISPTSPCTL_LO_OR_REVERSE:
		{
			pszLogicalOp = "OR Reverse";
			break;
		}

		case MBX1_ISPTSPCTL_LO_COPY_INVERSE:
		{
			pszLogicalOp = "Copy Inverse";
			break;
		}

		case MBX1_ISPTSPCTL_LO_OR_INVERSE:
		{
			pszLogicalOp = "OR Inverse";
			break;
		}

		case MBX1_ISPTSPCTL_LO_NAND:
		{
			pszLogicalOp = "NAND";
			break;
		}

		case MBX1_ISPTSPCTL_LO_SET:
		{
			pszLogicalOp = "Set";
			break;
		}

		default:
		{
			pszLogicalOp = "Invalid";
			break;
		}
	}

	return pszLogicalOp;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeISPTSPBlendModeCtl
    
 PURPOSE	: Decodes the blending-mode in the ISP/TSP control word

 PARAMETERS	: dwISPTSPCtl	- The control word to decode
  
 RETURNS	: PSTR			- The decoded blending-mode
*****************************************************************************/
PSTR DBGDecodeISPTSPBlendModeCtl(DWORD dwISPTSPCtl)
{
	PSTR	pszModeName;

#if defined(FIX_HW_PRN_145)
	DWORD	dwBlendMode;

	dwBlendMode = dwISPTSPCtl & (~MBX1_ISPTSPCTL_BLENDOPMODECLRMASK);

	switch	(dwBlendMode)
	{
		case MBX1_ISPTSPCTL_BLENDOPMODELOGICALOP:
		{
			pszModeName = "LogicalOp";
			break;
		}

		case MBX1_ISPTSPCTL_BLENDOPMODEVERTEXFOG:
		{
			pszModeName = "VertexFog";
			break;
		}

		case MBX1_ISPTSPCTL_BLENDOPMODEFOGNONE:
		{
			pszModeName = "None";
			break;
		}

		case MBX1_ISPTSPCTL_BLENDOPMODELOADFOGCOLOUR:
		{
			pszModeName = "LoadFogColour";
			break;
		}

		default:
		{
			pszModeName = "Invalid";
			break;
		}
	}

#else

	IMG_BOOL	bLogOpDisabled;
	IMG_BOOL	bFogEnabled;

	bLogOpDisabled	= (dwISPTSPCtl & MBX1_ISPTSPCTL_LOGICALOPDISABLE) ? IMG_TRUE : IMG_FALSE;
	bFogEnabled		= (dwISPTSPCtl & MBX1_ISPTSPCTL_FOGENABLE) ? IMG_TRUE : IMG_FALSE;

	if(bLogOpDisabled & !bFogEnabled)
	{
		pszModeName = "Logical Op Disabled - Fog Disabled";
	}
	else if(!bLogOpDisabled & !bFogEnabled)
	{
		pszModeName = "Logical Op Enabled - Fog Disabled";
	}
	else if(bLogOpDisabled & bFogEnabled)
	{
		pszModeName = "Logical Op Disabled - Fog Enabled";
	}
	else /* (!bLogOpDisabled & bFogEnabled) */
	{
		pszModeName = "Logical Op Enabled - Fog Enabled";
	}

#endif

	return pszModeName;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeISPTSPOffsetCtl
    
 PURPOSE	: Decodes the offset-present control in the ISP/TSP control word

 PARAMETERS	: dwISPTSPCtl	- The control word to decode
  
 RETURNS	: PSTR			- The decoded control
*****************************************************************************/
PSTR DBGDecodeISPTSPOffsetCtl(DWORD dwISPTSPCtl)
{
	PSTR	pszOffsetCtlState;

	if	(dwISPTSPCtl & MBX1_ISPTSPCTL_OFFSET)
	{
		pszOffsetCtlState = "Offset Present";	
	}
	else
	{
		pszOffsetCtlState = "Offset Absent";
	}

	return pszOffsetCtlState;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeISPTSPGouraudCtl
    
 PURPOSE	: Decodes the gouraud-shading control in the ISP/TSP control word

 PARAMETERS	: dwISPTSPCtl	- The control word to decode
  
 RETURNS	: PSTR			- The decoded control
*****************************************************************************/
PSTR DBGDecodeISPTSPGouraudCtl(DWORD dwISPTSPCtl)
{
	PSTR	pszGouraudCtlState;

	if	(dwISPTSPCtl & MBX1_ISPTSPCTL_GOURAUD)
	{
		pszGouraudCtlState = "Gouraud shading";
	}
	else
	{
		pszGouraudCtlState = "Flat shading";
	}

	return pszGouraudCtlState;
}

/*****************************************************************************
 FUNCTION	: DBGDecodeISPTSPColourKeyCtl
    
 PURPOSE	: Decodes the colour-key control in the ISP/TSP control word

 PARAMETERS	: dwISPTSPCtl	- The control word to decode
  
 RETURNS	: PSTR			- The decoded control
*****************************************************************************/
PSTR DBGDecodeISPTSPColourKeyCtl(DWORD dwISPTSPCtl)
{
	DWORD	dwCKCtl;
	PSTR	pszCKCtlState;

	dwCKCtl = dwISPTSPCtl & (~MBX1_ISPTSPCTL_CKCLRMASK);
	switch (dwCKCtl)
	{
		case MBX1_ISPTSPCTL_CK0SEL:

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?