Exemple #1
0
/**
*
* This function gets the vertical coefficient values of the Chroma Resampler
* core from all Vertical Coefficient registers of phase0 and phase1.
*
* @param	InstancePtr is a pointer to the XCresample instance.
* @param	Coeff is a pointer to the structure XVertical_Coeffs which has
*		vertical coefficients of both phases.(Phase 0 and Phase 1) in
*		which coefficients are updated.
*		Range of coefficient values is [-2, 2).
*
* @return	None.
*
* @note		For pre defined fixed coefficients filter values, ConvertType
*		should be set with 1.
*
******************************************************************************/
void XCresample_GetVCoefs(XCresample *InstancePtr, XVertical_Coeffs *Coeff)
{
    u32 Index1;
    u32 Index2;
    u32 Offset;
    s32 Data;

    /* Verify arguments. */
    Xil_AssertVoid(InstancePtr != NULL);
    Xil_AssertVoid(Coeff != NULL);
    Xil_AssertVoid(InstancePtr->Config.ConvertType == 1);

    Offset = (u32)(XCRE_COEF00_VPHASE0_OFFSET);

    /*
     * Getting coefficient values from all Vertical
     * Coefficient registers
     */
    for (Index1 = (u32)0x0; Index1 < (XCRE_NUM_OF_PHASES); Index1++) {
        for (Index2 = (u32)0x0; Index2 < (XCRE_NUM_VCOEFS);
                Index2++) {
            Data =
                (s32)(XCresample_ReadReg(
                          InstancePtr->Config.BaseAddress,
                          Offset));
            Coeff->VCoeff[Index1][Index2] =
                XCresample_FixedToFloatConv(Data);
            Offset = Offset + (XCRE_OFFSET_DIFF);
        }
    }
}
Exemple #2
0
/**
*
* This function disables debug test pattern mode in Control register of the
* Chroma Resampler core, if Debug feature is enabled.
*
* @param	InstancePtr is a pointer to the XCresample instance to be
*		worked on.
*
* @return	None.
*
* @note		Debug functionality should be enabled.
*
******************************************************************************/
void XCresample_DisableDbgTestPattern(XCresample *InstancePtr)
{
    /* Verify arguments. */
    Xil_AssertVoid(InstancePtr != NULL);
    Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0);
    XCresample_WriteReg(InstancePtr->Config.BaseAddress,
                        (XCRE_CONTROL_OFFSET),
                        ((XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                (XCRE_CONTROL_OFFSET))) & (~(XCRE_CTL_TPE_MASK))));
}
Exemple #3
0
/**
*
* This function enables the bypass mode by setting bypass bit of the Control
* register to switch the core to bypass mode if debug feature is enabled in
* the core.
*
* @param	InstancePtr is a pointer to the XCresample instance to be
*		worked on.
*
* @return	None.
*
* @note		Debug functionality should be enabled.
*
******************************************************************************/
void XCresample_EnableDbgByPass(XCresample *InstancePtr)
{
    /* Verify arguments. */
    Xil_AssertVoid(InstancePtr != NULL);
    Xil_AssertVoid(InstancePtr->Config.HasDebug != (u16)0x0);

    XCresample_WriteReg(InstancePtr->Config.BaseAddress,
                        (XCRE_CONTROL_OFFSET),
                        ((XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                (XCRE_CONTROL_OFFSET))) | (XCRE_CTL_BPE_MASK)));

}
Exemple #4
0
/**
*
* This function returns the value of chroma parity of the Chroma Resampler core
* from Encoding register.
*
* @param	InstancePtr is a pointer to the XCresample instance.
*
* @return	Chroma parity value is returned.
*		- 0 - Chroma information on Odd or First line.
*		- 1 - Chroma information on Even lines.
*
* @note		None.
*
******************************************************************************/
u8 XCresample_GetChromaParity(XCresample *InstancePtr)
{
    u32 Data;

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

    Data = ((XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                (XCRE_ENCODING_OFFSET))) & (XCRE_ENCODING_CHROMA_MASK)) >>
           (XCRE_ENCODING_CHROMA_SHIFT);

    return (u8)Data;
}
Exemple #5
0
/**
*
* This function returns the version of the Chroma Resampler core.
*
* @param	InstancePtr is a pointer to the XCresample instance.
*
* @return	Content of Version register is returned..
*
* @note		None.
*
******************************************************************************/
u32 XCresample_GetVersion(XCresample *InstancePtr)

{
    u32 Data;

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

    Data = XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                              (XCRE_VERSION_OFFSET));

    return Data;
}
Exemple #6
0
/**
*
* This functions sets the Chroma parity value of the Chroma Resampler core in
* the Encoding register.
*
* @param	InstancePtr is a pointer to the XCresample instance.
* @param	ChromaParity specifies the parity value which needs to be
*		set.(0 or 1).
*		- 0 - Chroma information on Odd or First line.
*		- 1 - Chroma information on Even lines.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
void XCresample_SetChromaParity(XCresample *InstancePtr, u8 ChromaParity)
{
    /* Verify arguments. */
    Xil_AssertVoid(InstancePtr != NULL);
    Xil_AssertVoid((ChromaParity == (XCRE_PARITY_ODD)) ||
                   (ChromaParity == (XCRE_PARITY_EVEN)));

    /* Checking type of ChromaParity value */
    if ((ChromaParity) == (XCRE_PARITY_ODD)) {
        XCresample_WriteReg(InstancePtr->Config.BaseAddress,
                            (XCRE_ENCODING_OFFSET),
                            ((XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                    (XCRE_ENCODING_OFFSET))) |
                             ((u32)(XCRE_ENCODING_CHROMA_MASK))));
    }
    if ((ChromaParity) == (XCRE_PARITY_EVEN)) {
        XCresample_WriteReg(InstancePtr->Config.BaseAddress,
                            (XCRE_ENCODING_OFFSET),
                            (XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                                (XCRE_ENCODING_OFFSET)) &
                             (u32)(~(XCRE_ENCODING_CHROMA_MASK))));
    }
}
Exemple #7
0
/**
*
* This function returns the number of pixels processed since power-up or last
* time the core is reset.
*
* @param	InstancePtr is a pointer to the XCresample instance.
*
* @return	PixelCount is the number of pixels processed since power-up.

* @note		Debug functionality should be enabled.
*
******************************************************************************/
u32 XCresample_GetDbgPixelCount(XCresample *InstancePtr)
{
    u32 PixelCount;

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

    /* Pixel throughput monitor */
    PixelCount = XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                    (XCRE_SYSDEBUG2_OFFSET));

    return PixelCount;
}
Exemple #8
0
/**
*
* This functions sets the field parity value of the Chroma Resampler core in
* the Encoding register.
*
* @param	InstancePtr is a pointer to the XCresample instance.
* @param	FieldParity specifies the parity value which needs to be
*		set.(0 or 1).
*		- 0 - for even or bottom field.
*		- 1 - for odd or top field.
*
* @return	None.
*
* @note		To this feature need to use interlaced video.
*
******************************************************************************/
void XCresample_SetFieldParity(XCresample *InstancePtr, u8 FieldParity)
{
    /* Verify arguments*/
    Xil_AssertVoid(InstancePtr != NULL);
    Xil_AssertVoid(InstancePtr->Config.Interlaced == 1);
    Xil_AssertVoid((FieldParity == (XCRE_PARITY_ODD)) ||
                   (FieldParity == (XCRE_PARITY_EVEN)));

    /* Checking the type of field parity */
    if ((FieldParity) == (XCRE_PARITY_ODD)) {
        XCresample_WriteReg(InstancePtr->Config.BaseAddress,
                            (XCRE_ENCODING_OFFSET),
                            ((XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                    (XCRE_ENCODING_OFFSET))) |
                             ((u32)(XCRE_ENCODING_FIELD_MASK))));
    }
    if ((FieldParity) == (XCRE_PARITY_EVEN)) {
        XCresample_WriteReg(InstancePtr->Config.BaseAddress,
                            (XCRE_ENCODING_OFFSET),
                            ((XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                    (XCRE_ENCODING_OFFSET))) &
                             ((u32)(~(XCRE_ENCODING_FIELD_MASK)))));
    }
}
Exemple #9
0
/**
*
* This function gets the number of Active Pixels per Scan line and number of
* Active Lines per Frame from the Active Size register.
*
* @param	InstancePtr is a pointer to the XCresample instance.
* @param	HSize is a pointer to 16-bit variable in which the number of
*		Active Pixels per Scan Line is returned (Range is 32 to 7680).
* @param	VSize is a pointer to 16-bit variable in which the number of
*		Active Lines per Frame is returned (Range is 32 to 7680).
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
void XCresample_GetActiveSize(XCresample *InstancePtr, u16 *HSize, u16 *VSize)
{
    u32 Data;
    /* Verify arguments*/
    Xil_AssertVoid(InstancePtr != NULL);
    Xil_AssertVoid(HSize != NULL);
    Xil_AssertVoid(VSize != NULL);

    Data = XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                              (XCRE_ACTIVE_SIZE_OFFSET));

    /* Number of active pixels per scan line */
    *HSize = (u16)(Data & (XCRE_ACTSIZE_NUM_PIXEL_MASK));

    /* Number of active lines per frame */
    *VSize = (u16)((Data & (XCRE_ACTSIZE_NUM_LINE_MASK)) >>
                   (XCRE_ACTSIZE_NUM_LINE_SHIFT));
}
Exemple #10
0
/**
*
* This function returns the test-pattern mode (enabled or not) from Control
* register of the Chroma Resampler core.
*
* @param	InstancePtr is a pointer to the XCresample instance to
*		be worked on.
*
* @return	Test-pattern generator mode.
*		- TRUE = Test-pattern mode is enabled.
*		- FALSE = Test-pattern mode is not enabled.
*
* @note		Debug functionality should be enabled.
*
*****************************************************************************/
int XCresample_IsDbgTestPatternEnabled(XCresample *InstancePtr)
{
    u32 DbgTestPattern;
    int Status;

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

    DbgTestPattern = (XCresample_ReadReg(InstancePtr->Config.BaseAddress,
                                         (XCRE_CONTROL_OFFSET))) & (XCRE_CTL_TPE_MASK);
    if (DbgTestPattern == (XCRE_CTL_TPE_MASK)) {
        Status = (TRUE);
    }
    else {
        Status = (FALSE);
    }

    return Status;
}
/**
*
* This function reads version register of Chroma Resampler core and compares
* with zero as part of self test.
*
* @param	InstancePtr is a pointer to the XCresample instance.
*
* @return
*		- XST_SUCCESS if the test is successful.
*		- XST_FAILURE if the test is failed.
*
* @note		None.
*
******************************************************************************/
int XCresample_SelfTest(XCresample *InstancePtr)
{
	u32 Version;
	int Status;

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

	Version = XCresample_ReadReg(InstancePtr->Config.BaseAddress,
					(XCRE_VERSION_OFFSET));

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

	return Status;
}