Esempio n. 1
0
/**
*
* This function returns A, B, C and D coefficients.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgbb instance.
* @param	Coef specifies a pointer to XYCrCb2Rgb_Coefficients structure
*		in which ACoef, BCoef, CCoef, DCoef members value will be
*		updated within the range [0.0, 1.0].
*
* @return	None.
*
* @note		Floating point coefficients are represented in 17-bit fixed
*		point format where 17 bits indicates integer portion (Mantissa)
*		of the number exclusive of sign bit.
*
******************************************************************************/
void XYCrCb2Rgb_GetCoefs(XYCrCb2Rgb *InstancePtr,
				struct XYCrCb2Rgb_Coefficients *Coef)
{
	u32 CoefVal;

	/* Verify arguments. */
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(Coef != NULL);

	CoefVal = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
							(XYCC_ACOEF_OFFSET));
	Coef->ACoef = (double)CoefVal /
			(double)(1 << (XYCC_16_BIT_COEF_SHIFT));

	CoefVal = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
							(XYCC_BCOEF_OFFSET));
	Coef->BCoef = (double)CoefVal /
			(double)(1 << (XYCC_16_BIT_COEF_SHIFT));

	CoefVal = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
							(XYCC_CCOEF_OFFSET));
	Coef->CCoef = (double)CoefVal /
			(double)(1 << (XYCC_16_BIT_COEF_SHIFT));

	CoefVal = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
							(XYCC_DCOEF_OFFSET));
	Coef->DCoef = (double)CoefVal /
			(double)(1 << (XYCC_16_BIT_COEF_SHIFT));
}
Esempio n. 2
0
/**
*
* This function disables debug test pattern mode.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
*
* @return	None.
*
* @note		Debug functionality should be enabled.
*
******************************************************************************/
void XYCrCb2Rgb_DisableDbgTestPattern(XYCrCb2Rgb *InstancePtr)
{
	/* Verify arguments. */
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0);

	XYCrCb2Rgb_WriteReg(InstancePtr->Config.BaseAddress,
		(XYCC_CONTROL_OFFSET),
		((XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
			(XYCC_CONTROL_OFFSET))) & (~(XYCC_CTL_TPE_MASK))));
}
Esempio n. 3
0
/**
*
* This function sets the bypass bit of control register to switch the core to
* bypass mode if debug is enabled in the IP.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
*
* @return	None.
*
* @note		Debug functionality should be enabled.
*
******************************************************************************/
void XYCrCb2Rgb_EnableDbgByPass(XYCrCb2Rgb *InstancePtr)
{
	/* Verify arguments. */
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0);

	XYCrCb2Rgb_WriteReg(InstancePtr->Config.BaseAddress,
			(XYCC_CONTROL_OFFSET),
		XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
			(XYCC_CONTROL_OFFSET)) | (XYCC_CTL_BPE_MASK));
}
Esempio n. 4
0
/**
*
* This function gets offset compensation value from the Blue channel.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
*
* @return	BOffset is a compensation value within the range [0, 255] from
*		the Blue channel.
*
* @note		None.
*
******************************************************************************/
u32 XYCrCb2Rgb_GetBOffset(XYCrCb2Rgb *InstancePtr)
{
	u32 BOffset;

	/* Verify argument. */
	Xil_AssertNonvoid(InstancePtr != NULL);

	BOffset = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
					(XYCC_BOFFSET_OFFSET));

	return BOffset;
}
Esempio n. 5
0
/**
*
* This function gets the minimum value on RGB channels of the output.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
*
* @return	RGBMin is the minimum value within the range [0, 255] from RGB
*		channels of the output.
*
* @note		Clamping functionality should be enabled.
*
******************************************************************************/
u32 XYCrCb2Rgb_GetRGBMin(XYCrCb2Rgb *InstancePtr)
{
	u32 RGBMin;

	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->Config.HasClamp != (u16)0x0);

	RGBMin = (XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
			(XYCC_RGBMIN_OFFSET)) & XYCC_16_BIT_MASK);

	return RGBMin;
}
Esempio n. 6
0
/**
*
* This function facilitates software identification of exact version of the
* YCrCb2rGB hardware (h/w).
*
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
*
* @return	Version, contents of a Version register.
*
* @note		None.
*
******************************************************************************/
u32 XYCrCb2Rgb_GetVersion(XYCrCb2Rgb *InstancePtr)
{
	u32 Version;

	/* Verify argument. */
	Xil_AssertNonvoid(InstancePtr != NULL);

	/* Read Version register */
	Version = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
					(XYCC_VERSION_OFFSET));

	return Version;
}
Esempio n. 7
0
/**
*
* This function returns the pixel count, the number of pixels processed since
* power up. This is available only if the debugging feature is enabled.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
*
* @return	DbgPixelCount, number of pixels processed since power-up.
*
* @note		Debug functionality should be enabled.
*
******************************************************************************/
u32 XYCrCb2Rgb_GetDbgPixelCount(XYCrCb2Rgb *InstancePtr)
{
	u32 DbgPixelCount;

	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0);

	/* Pixel Throughput monitor */
	DbgPixelCount = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
						(XYCC_SYSDEBUG2_OFFSET));

	return DbgPixelCount;
}
Esempio n. 8
0
/**
*
* This function gets the active H/V sizes of the YCrCb2Rgb core from
* active size register.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
* @param	HSize is a pointer to 16-bit variable in which the number of
*		Active Pixels per scanline is returned within the range
*		[32, 8192].
* @param	VSize is a pointer to 16-bit variable in which the number of
*		Active Lines per frame is returned within the range
*		[32, 8192].
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
void XYCrCb2Rgb_GetActiveSize(XYCrCb2Rgb *InstancePtr, u16 *HSize, u16 *VSize)
{
	u32 Data;
	/* Verify arguments. */
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(HSize != NULL);
	Xil_AssertVoid(VSize != NULL);

	Data = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
			(XYCC_ACTIVE_SIZE_OFFSET));
	/* Reads Number of Active Pixels per scan line */
	*VSize = (u16)((Data &
				(XYCC_ACTSIZE_NUM_LINE_MASK)) >>
					(XYCC_ACTSIZE_NUM_LINE_SHIFT));

	/* Reads number of active lines per frame */
	*HSize = (u16)(Data &
					(XYCC_ACTSIZE_NUM_PIXEL_MASK));
}
Esempio n. 9
0
/**
*
* This function reads Version register of YCRCB2RGB core and compares with
* zero as part of self test.
*
* @param	InstancePtr is a pointer to the XCrCb2Rgb instance.
*
* @return
*		- XST_SUCCESS if the Version register read test was successful.
*		- XST_FAILURE if the Version register read test failed.
*
* @note		None.
*
******************************************************************************/
int XYCrCb2Rgb_SelfTest(XYCrCb2Rgb *InstancePtr)
{
	u32 Version;
	int Status;

	/* Verify argument. */
	Xil_AssertNonvoid(InstancePtr != NULL);

	Version = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
					(XYCC_VERSION_OFFSET));

	/* Compare Version with zero */
	if (Version != (u32)0x0) {
		Status = (XST_SUCCESS);
	}
	else {
		Status = (XST_FAILURE);
	}

	return Status;
}
Esempio n. 10
0
/**
*
* This function returns the test-pattern generator mode (enabled or not), if
* debug feature is enabled.
*
* @param	InstancePtr is a pointer to the XYCrCb2Rgb instance.
*
* @return
*		- TRUE if Test-pattern mode is enabled.
*		- FALSE if Test-pattern mode is not enabled.
*
* @note		Debug functionality should be enabled.
*
******************************************************************************/
int XYCrCb2Rgb_IsDbgTestPatternEnabled(XYCrCb2Rgb *InstancePtr)
{
	u32 DbgTestPattern;
	int Status;

	/* Verify argument. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->Config.HasDebug != (u16)0x0);

	DbgTestPattern = XYCrCb2Rgb_ReadReg(InstancePtr->Config.BaseAddress,
			(XYCC_CONTROL_OFFSET)) & (XYCC_CTL_TPE_MASK);

	if (DbgTestPattern == (XYCC_CTL_TPE_MASK)) {
		Status = (TRUE);
	}
	else {
		Status = (FALSE);
	}

	return Status;
}