From 3662d31b971c77f9799d9cb8472800d4b59da019 Mon Sep 17 00:00:00 2001 From: Andrei-Liviu Simion Date: Mon, 10 Aug 2015 01:05:06 -0700 Subject: [PATCH] hdcp1x: Exposed register definitions for the core. - Renamed xhdcp1x_cipher_hw.h to xhdcp1x_hw.h - Moved low-level macros to the new xhdcp1x_hw.h file. - Included xhdcp1x_hw.h in xhdcp1x.h, exposing register definitions to the user. Signed-off-by: Andrei-Liviu Simion Acked-by: Shadul Shaikh --- .../drivers/hdcp1x/src/xhdcp1x.h | 126 +---------------- .../drivers/hdcp1x/src/xhdcp1x_cipher.c | 1 - .../drivers/hdcp1x/src/xhdcp1x_cipher.h | 1 - .../src/{xhdcp1x_cipher_hw.h => xhdcp1x_hw.h} | 133 +++++++++++++++++- 4 files changed, 130 insertions(+), 131 deletions(-) rename XilinxProcessorIPLib/drivers/hdcp1x/src/{xhdcp1x_cipher_hw.h => xhdcp1x_hw.h} (70%) diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h index 2f3284cd..ed82289b 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h @@ -58,6 +58,7 @@ extern "C" { /***************************** Include Files *********************************/ #include "xil_types.h" +#include "xhdcp1x_hw.h" #include "xstatus.h" #include "xtmrctr.h" @@ -225,131 +226,6 @@ typedef int (*XHdcp1x_TimerDelay)(const XHdcp1x *InstancePtr, u16 DelayInMs); /***************** Macros (Inline Functions) Definitions *********************/ -/*****************************************************************************/ -/** -* This queries a cipher to determine if it is enabled. -* -* @param InstancePtr is the instance to query. -* -* @return Truth value indicating transmitter (TRUE) or not (FALSE). -* -* @note None. -* -******************************************************************************/ -#define XHdcp1x_CipherIsEnabled(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_CONTROL) & \ - XHDCP1X_CIPHER_BITMASK_CONTROL_ENABLE) != 0) - -/*****************************************************************************/ -/** -* This queries a cipher to determine if the XOR (encryption) function is -* currently in progress. -* -* @param InstancePtr is the instance to query. -* -* @return Truth value indicating in progress (TRUE) or not (FALSE). -* -* @note None. -* -******************************************************************************/ -#define XHdcp1x_CipherXorInProgress(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_CIPHER_STATUS) & \ - XHDCP1X_CIPHER_BITMASK_CIPHER_STATUS_XOR_IN_PROG) != 0) - -/*****************************************************************************/ -/** -* This queries a cipher to determine if the local KSV is ready to read. -* -* @param InstancePtr is the instance to query. -* -* @return Truth value indicating ready (TRUE) or not (FALSE). -* -* @note None. -* -******************************************************************************/ -#define XHdcp1x_CipherLocalKsvReady(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_KEYMGMT_STATUS) & \ - XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_KSV_READY) != 0) - -/*****************************************************************************/ -/** -* This queries a cipher to determine if the Km value is ready. -* -* @param InstancePtr is the instance to query. -* -* @return Truth value indicating ready (TRUE) or not (FALSE). -* -* @note None. -* -******************************************************************************/ -#define XHdcp1x_CipherKmReady(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_KEYMGMT_STATUS) & \ - XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_Km_READY) != 0) - -/*****************************************************************************/ -/** -* -* This macro checks if a core supports the Display Port protocol -* -* @param InstancePtr is a pointer to the XHdcp1x core instance. -* -* @return Truth value indicating DP (TRUE) or not (FALSE) -* -******************************************************************************/ -#define XHdcp1x_IsDP(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL) \ - == XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_DP) - -/*****************************************************************************/ -/** -* -* This macro checks if a core supports the HDMI protocol -* -* @param InstancePtr is a pointer to the XHdcp1x core instance. -* -* @return Truth value indicating HDMI (TRUE) or not (FALSE) -* -******************************************************************************/ -#define XHdcp1x_IsHDMI(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL) \ - == XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI) - -/*****************************************************************************/ -/** -* -* This macro checks if a core supports the receive direction -* -* @param InstancePtr is a pointer to the XHdcp1x core instance. -* -* @return Truth value indicating receive (TRUE) or not (FALSE) -* -******************************************************************************/ -#define XHdcp1x_IsRX(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION) \ - == XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX) - -/*****************************************************************************/ -/** -* -* This macro checks if a core supports the transmit direction -* -* @param InstancePtr is a pointer to the XHdcp1x core instance. -* -* @return Truth value indicating transmit (TRUE) or not (FALSE) -* -******************************************************************************/ -#define XHdcp1x_IsTX(InstancePtr) \ - ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ - XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION) \ - == XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_TX) - /************************** Function Prototypes ******************************/ XHdcp1x_Config *XHdcp1x_LookupConfig(u16 DeviceId); diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c index f00c09d8..dfbfd354 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c @@ -52,7 +52,6 @@ #include #include #include "xhdcp1x.h" -#include "xhdcp1x_cipher_hw.h" #include "xhdcp1x_cipher.h" #include "xil_assert.h" #include "xil_types.h" diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h index 5890ec67..9802bcaf 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.h @@ -57,7 +57,6 @@ extern "C" { /***************************** Include Files *********************************/ #include "xhdcp1x.h" -#include "xhdcp1x_cipher_hw.h" #include "xstatus.h" #include "xil_types.h" diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_hw.h b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_hw.h similarity index 70% rename from XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_hw.h rename to XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_hw.h index 0a9925a8..cf7b7e6e 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_hw.h +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_hw.h @@ -32,7 +32,7 @@ /*****************************************************************************/ /** * -* @file xhdcp1x_cipher_hw.h +* @file xhdcp1x_hw.h * * This header file contains identifiers and register-level core functions (or * macros) that can be used to access the Xilinx HDCP cipher core. @@ -51,9 +51,9 @@ * ******************************************************************************/ -#ifndef XHDCP1X_CIPHER_HW_H +#ifndef XHDCP1X_HW_H /**< Prevent circular inclusions by using protection macros */ -#define XHDCP1X_CIPHER_HW_H +#define XHDCP1X_HW_H #ifdef __cplusplus extern "C" { @@ -276,6 +276,131 @@ extern "C" { #define XHdcp1x_WriteReg(BaseAddress, RegOffset, Data) \ XHdcp1x_Out32((BaseAddress) + ((u32)RegOffset), (u32)(Data)) +/*****************************************************************************/ +/** +* This queries a cipher to determine if it is enabled. +* +* @param InstancePtr is the instance to query. +* +* @return Truth value indicating transmitter (TRUE) or not (FALSE). +* +* @note None. +* +******************************************************************************/ +#define XHdcp1x_CipherIsEnabled(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_CONTROL) & \ + XHDCP1X_CIPHER_BITMASK_CONTROL_ENABLE) != 0) + +/*****************************************************************************/ +/** +* This queries a cipher to determine if the XOR (encryption) function is +* currently in progress. +* +* @param InstancePtr is the instance to query. +* +* @return Truth value indicating in progress (TRUE) or not (FALSE). +* +* @note None. +* +******************************************************************************/ +#define XHdcp1x_CipherXorInProgress(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_CIPHER_STATUS) & \ + XHDCP1X_CIPHER_BITMASK_CIPHER_STATUS_XOR_IN_PROG) != 0) + +/*****************************************************************************/ +/** +* This queries a cipher to determine if the local KSV is ready to read. +* +* @param InstancePtr is the instance to query. +* +* @return Truth value indicating ready (TRUE) or not (FALSE). +* +* @note None. +* +******************************************************************************/ +#define XHdcp1x_CipherLocalKsvReady(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_KEYMGMT_STATUS) & \ + XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_KSV_READY) != 0) + +/*****************************************************************************/ +/** +* This queries a cipher to determine if the Km value is ready. +* +* @param InstancePtr is the instance to query. +* +* @return Truth value indicating ready (TRUE) or not (FALSE). +* +* @note None. +* +******************************************************************************/ +#define XHdcp1x_CipherKmReady(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_KEYMGMT_STATUS) & \ + XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_Km_READY) != 0) + +/*****************************************************************************/ +/** +* +* This macro checks if a core supports the Display Port protocol +* +* @param InstancePtr is a pointer to the XHdcp1x core instance. +* +* @return Truth value indicating DP (TRUE) or not (FALSE) +* +******************************************************************************/ +#define XHdcp1x_IsDP(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL) \ + == XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_DP) + +/*****************************************************************************/ +/** +* +* This macro checks if a core supports the HDMI protocol +* +* @param InstancePtr is a pointer to the XHdcp1x core instance. +* +* @return Truth value indicating HDMI (TRUE) or not (FALSE) +* +******************************************************************************/ +#define XHdcp1x_IsHDMI(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL) \ + == XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI) + +/*****************************************************************************/ +/** +* +* This macro checks if a core supports the receive direction +* +* @param InstancePtr is a pointer to the XHdcp1x core instance. +* +* @return Truth value indicating receive (TRUE) or not (FALSE) +* +******************************************************************************/ +#define XHdcp1x_IsRX(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION) \ + == XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX) + +/*****************************************************************************/ +/** +* +* This macro checks if a core supports the transmit direction +* +* @param InstancePtr is a pointer to the XHdcp1x core instance. +* +* @return Truth value indicating transmit (TRUE) or not (FALSE) +* +******************************************************************************/ +#define XHdcp1x_IsTX(InstancePtr) \ + ((XHdcp1x_ReadReg((InstancePtr)->Config.BaseAddress, \ + XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION) \ + == XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_TX) + /************************** Function Prototypes ******************************/ /************************** Variable Declarations ****************************/ @@ -284,4 +409,4 @@ extern "C" { } #endif -#endif /* XHDCP1X_CIPHER_HW_H */ +#endif /* XHDCP1X_HW_H */