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 <andrei.simion@xilinx.com>
Acked-by: Shadul Shaikh <shaduls@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2015-08-10 01:05:06 -07:00 committed by Nava kishore Manne
parent ec723f1f41
commit 3662d31b97
4 changed files with 130 additions and 131 deletions

View file

@ -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);

View file

@ -52,7 +52,6 @@
#include <stdlib.h>
#include <string.h>
#include "xhdcp1x.h"
#include "xhdcp1x_cipher_hw.h"
#include "xhdcp1x_cipher.h"
#include "xil_assert.h"
#include "xil_types.h"

View file

@ -57,7 +57,6 @@ extern "C" {
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xhdcp1x_cipher_hw.h"
#include "xstatus.h"
#include "xil_types.h"

View file

@ -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 */