diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h index beaad932..c015cc97 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h @@ -203,8 +203,6 @@ u32 XHdcp1x_CipherGetVersion(const XHdcp1x *InstancePtr); void XHdcp1x_CipherHandleInterrupt(void *InstancePtr); -int XHdcp1x_CipherSelfTest(XHdcp1x *InstancePtr); - #ifdef __cplusplus } #endif diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_selftest.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_selftest.c deleted file mode 100644 index 5f739faa..00000000 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_selftest.c +++ /dev/null @@ -1,126 +0,0 @@ -/****************************************************************************** -* -* Copyright (C) 2015 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file xhdcp1x_selftest.c -* -* This file contains self test function for the Xilinx HDCP Cipher core. -* -*
-* MODIFICATION HISTORY:
-*
-* Ver   Who    Date     Changes
-* ----- ------ -------- --------------------------------------------------
-* 1.00         07/16/15 Initial release.
-* 
-* -******************************************************************************/ - -/***************************** Include Files *********************************/ - -#include "xhdcp1x_cipher.h" -#include "xil_assert.h" - -/************************** Constant Definitions *****************************/ - - -/***************** Macros (Inline Functions) Definitions *********************/ - - -/**************************** Type Definitions *******************************/ - - -/************************** Function Prototypes ******************************/ - - -/************************** Variable Definitions *****************************/ - - -/************************** Function Definitions *****************************/ - -/*****************************************************************************/ -/** -* This function self tests an hdcp cipher core. -* -* @param InstancePtr is the cipher core to test. -* -* @return -* - XST_SUCCESS if successful -* - XST_FAILURE otherwise. -* -* @note None. -* -******************************************************************************/ -int XHdcp1x_CipherSelfTest(XHdcp1x *InstancePtr) -{ - u32 Base = 0; - u32 Value = 0; - int Status = XST_FAILURE; - - /* Verify parameters */ - Xil_AssertNonvoid(InstancePtr != NULL); - - /* Determine Base */ - Base = InstancePtr->Config.BaseAddress; - - /* Read the version */ - Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_VERSION); - - /* Confirm the version is reasonable */ - if ((Value != 0u) && (Value != ((u32)(-1)))) { - const XHdcp1x_Config *CfgPtr = &InstancePtr->Config; - int IsRx = FALSE; - int IsHdmi = FALSE; - - /* Determine isRx */ - Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_TYPE); - Value &= XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION; - if (Value == XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX) { - IsRx = TRUE; - } - - /* Determine isHdmi */ - Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_TYPE); - Value &= XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL; - if (Value == XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI) { - IsHdmi = TRUE; - } - - /* Confirm direction and protocol match */ - if (((IsRx == CfgPtr->IsRx)) && ((IsHdmi == CfgPtr->IsHDMI))) { - Status = XST_SUCCESS; - } - } - - return (Status); -} diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_selftest.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_selftest.c index e5e6bd5e..860847ea 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_selftest.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_selftest.c @@ -70,8 +70,7 @@ /*****************************************************************************/ /** -* -* This function self tests an hdcp interface. +* This function self tests an HDCP interface. * * @param InstancePtr is the interface to test. * @@ -84,15 +83,30 @@ ******************************************************************************/ int XHdcp1x_SelfTest(XHdcp1x *InstancePtr) { - int Status = XST_SUCCESS; + const XHdcp1x_Config *CfgPtr = &InstancePtr->Config; + u32 RegVal; /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); - /* Self test the cipher */ - if (XHdcp1x_CipherSelfTest(InstancePtr) != XST_SUCCESS) { - Status = XST_FAILURE; + /* Confirm that the version is reasonable. */ + RegVal = XHdcp1x_CipherReadReg(CfgPtr->BaseAddress, + XHDCP1X_CIPHER_REG_VERSION); + if (!RegVal || (RegVal == ((u32)(-1)))) { + return (XST_FAILURE); } - return (Status); + /* Confirm that the direction matches in both SW and HW. */ + if ((!CfgPtr->IsRx && XHdcp1x_CipherIsRX(InstancePtr)) || + (CfgPtr->IsRx && XHdcp1x_CipherIsTX(InstancePtr))) { + return (XST_FAILURE); + } + + /* Confirm that the protocol matches in both SW and HW. */ + if ((!CfgPtr->IsHDMI && XHdcp1x_CipherIsHDMI(InstancePtr)) || + (CfgPtr->IsHDMI && XHdcp1x_CipherIsDP(InstancePtr))) { + return (XST_FAILURE); + } + + return (XST_SUCCESS); }