hdcp1x: Cipher and port APIs to act on top-level.

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-06 13:26:15 -07:00 committed by Nava kishore Manne
parent 260237c241
commit 5edc951b10
17 changed files with 324 additions and 427 deletions

View file

@ -684,34 +684,12 @@ int XHdcp1x_DisableEncryption(XHdcp1x *InstancePtr, u64 Map)
******************************************************************************/
int XHdcp1x_SetKeySelect(XHdcp1x *InstancePtr, u8 KeySelect)
{
XHdcp1x_Cipher *CipherPtr = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
#if defined(INCLUDE_TX)
/* Check for TX */
if (IsTX(InstancePtr)) {
CipherPtr = &InstancePtr->Cipher;
}
else
#endif
#if defined(INCLUDE_RX)
/* Check for RX */
if (IsRX(InstancePtr)) {
CipherPtr = &InstancePtr->Cipher;
}
else
#endif
{
CipherPtr = NULL;
}
/* Set it */
if (CipherPtr != NULL) {
Status = XHdcp1x_CipherSetKeySelect(CipherPtr, KeySelect);
}
Status = XHdcp1x_CipherSetKeySelect(InstancePtr, KeySelect);
return (Status);
}
@ -866,34 +844,12 @@ u32 XHdcp1x_GetDriverVersion(void)
******************************************************************************/
u32 XHdcp1x_GetVersion(const XHdcp1x *InstancePtr)
{
const XHdcp1x_Cipher *CipherPtr = NULL;
u32 Version = 0;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
#if defined(INCLUDE_TX)
/* Check for TX */
if (IsTX(InstancePtr)) {
CipherPtr = &InstancePtr->Cipher;
}
else
#endif
#if defined(INCLUDE_RX)
/* Check for RX */
if (IsRX(InstancePtr)) {
CipherPtr = &InstancePtr->Cipher;
}
else
#endif
{
CipherPtr = NULL;
}
/* Set it */
if (CipherPtr != NULL) {
Version = XHdcp1x_CipherGetVersion(CipherPtr);
}
Version = XHdcp1x_CipherGetVersion(InstancePtr);
return (Version);
}

View file

@ -172,7 +172,6 @@ typedef struct {
typedef struct {
const XHdcp1x_Config *CfgPtr; /**< The cipher core config */
u32 IsReady; /**< The ready flag */
XHdcp1x_Port Port; /**< The interface's port */
} XHdcp1x_Common;
/**
@ -181,7 +180,6 @@ typedef struct {
typedef struct {
const XHdcp1x_Config *CfgPtr; /**< The cipher core config */
u32 IsReady; /**< The ready flag */
XHdcp1x_Port Port; /**< The interface's port */
u32 CurrentState; /**< The interface's current state */
u32 PreviousState; /**< The interface's previous state */
u64 StateHelper; /**< The interface's state helper */
@ -197,7 +195,6 @@ typedef struct {
typedef struct {
const XHdcp1x_Config *CfgPtr; /**< The cipher core config */
u32 IsReady; /**< The ready flag */
XHdcp1x_Port Port; /**< The interface's port */
u32 CurrentState; /**< The interface's current state */
u32 PreviousState; /**< The interface's previous state */
u16 Flags; /**< The interface flags */
@ -211,6 +208,7 @@ typedef struct {
typedef struct {
XHdcp1x_Config Config; /**< The core config */
XHdcp1x_Cipher Cipher; /**< The interface's cipher */
XHdcp1x_Port Port; /**< The interface's port */
union {
XHdcp1x_Common Common; /**< The common interface elements */
XHdcp1x_Tx Tx; /**< The transmit interface elements */

View file

@ -76,7 +76,7 @@
*
******************************************************************************/
#define RegRead(InstancePtr, Reg) \
XHdcp1x_CipherReadReg(InstancePtr->CfgPtr->BaseAddress, Reg)
XHdcp1x_CipherReadReg(InstancePtr->Config.BaseAddress, Reg)
/*****************************************************************************/
/**
@ -92,7 +92,7 @@
*
******************************************************************************/
#define RegWrite(InstancePtr, Reg, Value) \
XHdcp1x_CipherWriteReg(InstancePtr->CfgPtr->BaseAddress, Reg, Value)
XHdcp1x_CipherWriteReg(InstancePtr->Config.BaseAddress, Reg, Value)
/*****************************************************************************/
/**
@ -213,9 +213,9 @@
/*************************** Function Prototypes *****************************/
static void Enable(XHdcp1x_Cipher *InstancePtr);
static void Disable(XHdcp1x_Cipher *InstancePtr);
static void Init(XHdcp1x_Cipher *InstancePtr);
static void Enable(XHdcp1x *InstancePtr);
static void Disable(XHdcp1x *InstancePtr);
static void Init(XHdcp1x *InstancePtr);
/************************** Function Definitions *****************************/
@ -233,7 +233,7 @@ static void Init(XHdcp1x_Cipher *InstancePtr);
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherCfgInitialize(XHdcp1x_Cipher *InstancePtr,
int XHdcp1x_CipherCfgInitialize(XHdcp1x *InstancePtr,
const XHdcp1x_Config *CfgPtr)
{
int Status = XST_SUCCESS;
@ -241,11 +241,11 @@ int XHdcp1x_CipherCfgInitialize(XHdcp1x_Cipher *InstancePtr,
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(CfgPtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady != XIL_COMPONENT_IS_READY);
Xil_AssertNonvoid(InstancePtr->Cipher.IsReady !=
XIL_COMPONENT_IS_READY);
/* Initialize InstancePtr */
memset(InstancePtr, 0, sizeof(XHdcp1x_Cipher));
InstancePtr->CfgPtr = CfgPtr;
InstancePtr->Cipher.CfgPtr = CfgPtr;
/* Check for mismatch on direction */
if (IsRX(InstancePtr)) {
@ -270,7 +270,7 @@ int XHdcp1x_CipherCfgInitialize(XHdcp1x_Cipher *InstancePtr,
/* Initialize it */
if (Status == XST_SUCCESS) {
Init(InstancePtr);
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
InstancePtr->Cipher.IsReady = XIL_COMPONENT_IS_READY;
}
return (Status);
@ -287,7 +287,7 @@ int XHdcp1x_CipherCfgInitialize(XHdcp1x_Cipher *InstancePtr,
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherIsLinkUp(const XHdcp1x_Cipher *InstancePtr)
int XHdcp1x_CipherIsLinkUp(const XHdcp1x *InstancePtr)
{
int IsUp = FALSE;
@ -318,7 +318,7 @@ int XHdcp1x_CipherIsLinkUp(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherEnable(XHdcp1x_Cipher *InstancePtr)
int XHdcp1x_CipherEnable(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
@ -349,7 +349,7 @@ int XHdcp1x_CipherEnable(XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherDisable(XHdcp1x_Cipher *InstancePtr)
int XHdcp1x_CipherDisable(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
@ -377,7 +377,7 @@ int XHdcp1x_CipherDisable(XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetKeySelect(XHdcp1x_Cipher *InstancePtr, u8 KeySelect)
int XHdcp1x_CipherSetKeySelect(XHdcp1x *InstancePtr, u8 KeySelect)
{
int Status = XST_SUCCESS;
u32 Value = 0;
@ -410,7 +410,7 @@ int XHdcp1x_CipherSetKeySelect(XHdcp1x_Cipher *InstancePtr, u8 KeySelect)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherDoRequest(XHdcp1x_Cipher *InstancePtr,
int XHdcp1x_CipherDoRequest(XHdcp1x *InstancePtr,
XHdcp1x_CipherRequestType Request)
{
u32 Value = 0;
@ -463,7 +463,7 @@ int XHdcp1x_CipherDoRequest(XHdcp1x_Cipher *InstancePtr,
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherIsRequestComplete(const XHdcp1x_Cipher *InstancePtr)
int XHdcp1x_CipherIsRequestComplete(const XHdcp1x *InstancePtr)
{
u32 Value = 0;
int IsComplete = TRUE;
@ -494,7 +494,7 @@ int XHdcp1x_CipherIsRequestComplete(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
u32 XHdcp1x_CipherGetNumLanes(const XHdcp1x_Cipher *InstancePtr)
u32 XHdcp1x_CipherGetNumLanes(const XHdcp1x *InstancePtr)
{
u32 NumLanes = 0;
@ -525,7 +525,7 @@ u32 XHdcp1x_CipherGetNumLanes(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetNumLanes(XHdcp1x_Cipher *InstancePtr, u32 NumLanes)
int XHdcp1x_CipherSetNumLanes(XHdcp1x *InstancePtr, u32 NumLanes)
{
int Status = XST_SUCCESS;
u32 Value = 0;
@ -575,7 +575,7 @@ int XHdcp1x_CipherSetNumLanes(XHdcp1x_Cipher *InstancePtr, u32 NumLanes)
* This is the reason for the additional check in this code.
*
******************************************************************************/
u64 XHdcp1x_CipherGetEncryption(const XHdcp1x_Cipher *InstancePtr)
u64 XHdcp1x_CipherGetEncryption(const XHdcp1x *InstancePtr)
{
u64 StreamMap = 0;
@ -615,7 +615,7 @@ u64 XHdcp1x_CipherGetEncryption(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherEnableEncryption(XHdcp1x_Cipher *InstancePtr, u64 StreamMap)
int XHdcp1x_CipherEnableEncryption(XHdcp1x *InstancePtr, u64 StreamMap)
{
u32 Value = 0;
@ -684,7 +684,7 @@ int XHdcp1x_CipherEnableEncryption(XHdcp1x_Cipher *InstancePtr, u64 StreamMap)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherDisableEncryption(XHdcp1x_Cipher *InstancePtr, u64 StreamMap)
int XHdcp1x_CipherDisableEncryption(XHdcp1x *InstancePtr, u64 StreamMap)
{
u32 Val = 0;
int DisableXor = TRUE;
@ -764,7 +764,7 @@ int XHdcp1x_CipherDisableEncryption(XHdcp1x_Cipher *InstancePtr, u64 StreamMap)
* @note None.
*
******************************************************************************/
u64 XHdcp1x_CipherGetLocalKsv(const XHdcp1x_Cipher *InstancePtr)
u64 XHdcp1x_CipherGetLocalKsv(const XHdcp1x *InstancePtr)
{
u32 Val = 0;
u32 Guard = 0x400ul;
@ -823,7 +823,7 @@ u64 XHdcp1x_CipherGetLocalKsv(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
u64 XHdcp1x_CipherGetRemoteKsv(const XHdcp1x_Cipher *InstancePtr)
u64 XHdcp1x_CipherGetRemoteKsv(const XHdcp1x *InstancePtr)
{
u64 Ksv = 0;
@ -854,7 +854,7 @@ u64 XHdcp1x_CipherGetRemoteKsv(const XHdcp1x_Cipher *InstancePtr)
* complete.
*
******************************************************************************/
int XHdcp1x_CipherSetRemoteKsv(XHdcp1x_Cipher *InstancePtr, u64 Ksv)
int XHdcp1x_CipherSetRemoteKsv(XHdcp1x *InstancePtr, u64 Ksv)
{
u32 Value = 0;
u32 Guard = 0x400ul;
@ -925,8 +925,7 @@ int XHdcp1x_CipherSetRemoteKsv(XHdcp1x_Cipher *InstancePtr, u64 Ksv)
* this portion of the B register is not returned to the caller.
*
******************************************************************************/
int XHdcp1x_CipherGetB(const XHdcp1x_Cipher *InstancePtr, u32 *X, u32 *Y,
u32 *Z)
int XHdcp1x_CipherGetB(const XHdcp1x *InstancePtr, u32 *X, u32 *Y, u32 *Z)
{
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
@ -973,7 +972,7 @@ int XHdcp1x_CipherGetB(const XHdcp1x_Cipher *InstancePtr, u32 *X, u32 *Y,
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetB(XHdcp1x_Cipher *InstancePtr, u32 X, u32 Y, u32 Z)
int XHdcp1x_CipherSetB(XHdcp1x *InstancePtr, u32 X, u32 Y, u32 Z)
{
u32 Value = 0;
@ -1027,8 +1026,7 @@ int XHdcp1x_CipherSetB(XHdcp1x_Cipher *InstancePtr, u32 X, u32 Y, u32 Z)
* this portion of the K register is not returned to the caller.
*
******************************************************************************/
int XHdcp1x_CipherGetK(const XHdcp1x_Cipher *InstancePtr, u32 *X, u32 *Y,
u32 *Z)
int XHdcp1x_CipherGetK(const XHdcp1x *InstancePtr, u32 *X, u32 *Y, u32 *Z)
{
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
@ -1075,7 +1073,7 @@ int XHdcp1x_CipherGetK(const XHdcp1x_Cipher *InstancePtr, u32 *X, u32 *Y,
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetK(XHdcp1x_Cipher *InstancePtr, u32 X, u32 Y, u32 Z)
int XHdcp1x_CipherSetK(XHdcp1x *InstancePtr, u32 X, u32 Y, u32 Z)
{
u32 Value = 0;
@ -1123,7 +1121,7 @@ int XHdcp1x_CipherSetK(XHdcp1x_Cipher *InstancePtr, u32 X, u32 Y, u32 Z)
* @note None.
*
******************************************************************************/
u64 XHdcp1x_CipherGetMi(const XHdcp1x_Cipher *InstancePtr)
u64 XHdcp1x_CipherGetMi(const XHdcp1x *InstancePtr)
{
u64 Mi = 0;
@ -1154,7 +1152,7 @@ u64 XHdcp1x_CipherGetMi(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
u16 XHdcp1x_CipherGetRi(const XHdcp1x_Cipher *InstancePtr)
u16 XHdcp1x_CipherGetRi(const XHdcp1x *InstancePtr)
{
u16 Ri = 0;
@ -1184,7 +1182,7 @@ u16 XHdcp1x_CipherGetRi(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
u64 XHdcp1x_CipherGetMo(const XHdcp1x_Cipher *InstancePtr)
u64 XHdcp1x_CipherGetMo(const XHdcp1x *InstancePtr)
{
u64 Mo = 0;
@ -1216,7 +1214,7 @@ u64 XHdcp1x_CipherGetMo(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
u16 XHdcp1x_CipherGetRo(const XHdcp1x_Cipher *InstancePtr)
u16 XHdcp1x_CipherGetRo(const XHdcp1x *InstancePtr)
{
u16 Ro = 0;
@ -1245,7 +1243,7 @@ u16 XHdcp1x_CipherGetRo(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
u32 XHdcp1x_CipherGetVersion(const XHdcp1x_Cipher *InstancePtr)
u32 XHdcp1x_CipherGetVersion(const XHdcp1x *InstancePtr)
{
u32 Version = 0;
@ -1269,7 +1267,7 @@ u32 XHdcp1x_CipherGetVersion(const XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
static void Enable(XHdcp1x_Cipher *InstancePtr)
static void Enable(XHdcp1x *InstancePtr)
{
u32 Value = 0;
@ -1312,7 +1310,7 @@ static void Enable(XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
static void Disable(XHdcp1x_Cipher *InstancePtr)
static void Disable(XHdcp1x *InstancePtr)
{
u32 Value = 0;
@ -1353,7 +1351,7 @@ static void Disable(XHdcp1x_Cipher *InstancePtr)
* @note None.
*
******************************************************************************/
static void Init(XHdcp1x_Cipher *InstancePtr)
static void Init(XHdcp1x *InstancePtr)
{
u32 Value = 0;

View file

@ -108,7 +108,7 @@ typedef enum {
*
******************************************************************************/
#define XHdcp1x_CipherIsDP(InstancePtr) \
((XHdcp1x_CipherReadReg((InstancePtr->CfgPtr)->BaseAddress, \
((XHdcp1x_CipherReadReg((InstancePtr)->Config.BaseAddress, \
XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL) \
== XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_DP)
@ -123,7 +123,7 @@ typedef enum {
*
******************************************************************************/
#define XHdcp1x_CipherIsHDMI(InstancePtr) \
((XHdcp1x_CipherReadReg((InstancePtr->CfgPtr)->BaseAddress, \
((XHdcp1x_CipherReadReg((InstancePtr)->Config.BaseAddress, \
XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL) \
== XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI)
@ -138,7 +138,7 @@ typedef enum {
*
******************************************************************************/
#define XHdcp1x_CipherIsRX(InstancePtr) \
((XHdcp1x_CipherReadReg((InstancePtr->CfgPtr)->BaseAddress, \
((XHdcp1x_CipherReadReg((InstancePtr)->Config.BaseAddress, \
XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION) \
== XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX)
@ -153,63 +153,58 @@ typedef enum {
*
******************************************************************************/
#define XHdcp1x_CipherIsTX(InstancePtr) \
((XHdcp1x_CipherReadReg((InstancePtr->CfgPtr)->BaseAddress, \
((XHdcp1x_CipherReadReg((InstancePtr)->Config.BaseAddress, \
XHDCP1X_CIPHER_REG_TYPE) & XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION) \
== XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_TX)
/************************** Function Prototypes ******************************/
int XHdcp1x_CipherCfgInitialize(XHdcp1x_Cipher *InstancePtr,
int XHdcp1x_CipherCfgInitialize(XHdcp1x *InstancePtr,
const XHdcp1x_Config *CfgPtr);
int XHdcp1x_CipherSetCallback(XHdcp1x_Cipher *InstancePtr, u32 HandlerType,
int XHdcp1x_CipherSetCallback(XHdcp1x *InstancePtr, u32 HandlerType,
XHdcp1x_Callback Callback, void *Ref);
int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x_Cipher *InstancePtr,
int IsEnabled);
int XHdcp1x_CipherIsLinkUp(const XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherSetRiUpdate(XHdcp1x_Cipher *InstancePtr, int IsEnabled);
int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x *InstancePtr, int IsEnabled);
int XHdcp1x_CipherIsLinkUp(const XHdcp1x *InstancePtr);
int XHdcp1x_CipherSetRiUpdate(XHdcp1x *InstancePtr, int IsEnabled);
int XHdcp1x_CipherEnable(XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherDisable(XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherEnable(XHdcp1x *InstancePtr);
int XHdcp1x_CipherDisable(XHdcp1x *InstancePtr);
int XHdcp1x_CipherSetKeySelect(XHdcp1x_Cipher *InstancePtr, u8 KeySelect);
int XHdcp1x_CipherSetKeySelect(XHdcp1x *InstancePtr, u8 KeySelect);
int XHdcp1x_CipherDoRequest(XHdcp1x_Cipher *InstancePtr,
int XHdcp1x_CipherDoRequest(XHdcp1x *InstancePtr,
XHdcp1x_CipherRequestType Request);
int XHdcp1x_CipherIsRequestComplete(const XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherIsRequestComplete(const XHdcp1x *InstancePtr);
u32 XHdcp1x_CipherGetNumLanes(const XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherSetNumLanes(XHdcp1x_Cipher *InstancePtr, u32 NumLanes);
u32 XHdcp1x_CipherGetNumLanes(const XHdcp1x *InstancePtr);
int XHdcp1x_CipherSetNumLanes(XHdcp1x *InstancePtr, u32 NumLanes);
u64 XHdcp1x_CipherGetEncryption(const XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherEnableEncryption(XHdcp1x_Cipher *InstancePtr,
u64 StreamMap);
int XHdcp1x_CipherDisableEncryption(XHdcp1x_Cipher *InstancePtr,
u64 StreamMap);
u64 XHdcp1x_CipherGetEncryption(const XHdcp1x *InstancePtr);
int XHdcp1x_CipherEnableEncryption(XHdcp1x *InstancePtr, u64 StreamMap);
int XHdcp1x_CipherDisableEncryption(XHdcp1x *InstancePtr, u64 StreamMap);
u64 XHdcp1x_CipherGetLocalKsv(const XHdcp1x_Cipher *InstancePtr);
u64 XHdcp1x_CipherGetRemoteKsv(const XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherSetRemoteKsv(XHdcp1x_Cipher *InstancePtr, u64 Ksv);
u64 XHdcp1x_CipherGetLocalKsv(const XHdcp1x *InstancePtr);
u64 XHdcp1x_CipherGetRemoteKsv(const XHdcp1x *InstancePtr);
int XHdcp1x_CipherSetRemoteKsv(XHdcp1x *InstancePtr, u64 Ksv);
int XHdcp1x_CipherGetB(const XHdcp1x_Cipher *InstancePtr, u32 *X, u32 *Y,
u32 *Z);
int XHdcp1x_CipherSetB(XHdcp1x_Cipher *InstancePtr, u32 X, u32 Y, u32 Z);
int XHdcp1x_CipherGetK(const XHdcp1x_Cipher *InstancePtr, u32 *X, u32 *Y,
u32 *Z);
int XHdcp1x_CipherSetK(XHdcp1x_Cipher *InstancePtr, u32 X, u32 Y, u32 Z);
int XHdcp1x_CipherGetB(const XHdcp1x *InstancePtr, u32 *X, u32 *Y, u32 *Z);
int XHdcp1x_CipherSetB(XHdcp1x *InstancePtr, u32 X, u32 Y, u32 Z);
int XHdcp1x_CipherGetK(const XHdcp1x *InstancePtr, u32 *X, u32 *Y, u32 *Z);
int XHdcp1x_CipherSetK(XHdcp1x *InstancePtr, u32 X, u32 Y, u32 Z);
u64 XHdcp1x_CipherGetMi(const XHdcp1x_Cipher *InstancePtr);
u16 XHdcp1x_CipherGetRi(const XHdcp1x_Cipher *InstancePtr);
u64 XHdcp1x_CipherGetMo(const XHdcp1x_Cipher *InstancePtr);
u16 XHdcp1x_CipherGetRo(const XHdcp1x_Cipher *InstancePtr);
u64 XHdcp1x_CipherGetMi(const XHdcp1x *InstancePtr);
u16 XHdcp1x_CipherGetRi(const XHdcp1x *InstancePtr);
u64 XHdcp1x_CipherGetMo(const XHdcp1x *InstancePtr);
u16 XHdcp1x_CipherGetRo(const XHdcp1x *InstancePtr);
u32 XHdcp1x_CipherGetVersion(const XHdcp1x_Cipher *InstancePtr);
u32 XHdcp1x_CipherGetVersion(const XHdcp1x *InstancePtr);
void XHdcp1x_CipherHandleInterrupt(void *InstancePtr);
int XHdcp1x_CipherSelfTest(XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherSelfTest(XHdcp1x *InstancePtr);
#ifdef __cplusplus
}

View file

@ -60,10 +60,10 @@
/***************** Macros (Inline Functions) Definitions *********************/
#define RegRead(InstancePtr, Offset) \
XHdcp1x_CipherReadReg(InstancePtr->CfgPtr->BaseAddress, Offset)
XHdcp1x_CipherReadReg(InstancePtr->Config.BaseAddress, Offset)
#define RegWrite(InstancePtr, Offset, Value) \
XHdcp1x_CipherWriteReg(InstancePtr->CfgPtr->BaseAddress, Offset, Value)
XHdcp1x_CipherWriteReg(InstancePtr->Config.BaseAddress, Offset, Value)
/************************** Function Definitions *****************************/
@ -93,7 +93,7 @@
* installed replaces it with the new handler.
*
******************************************************************************/
int XHdcp1x_CipherSetCallback(XHdcp1x_Cipher *InstancePtr, u32 HandlerType,
int XHdcp1x_CipherSetCallback(XHdcp1x *InstancePtr, u32 HandlerType,
XHdcp1x_Callback CallbackFunc, void *CallbackRef)
{
u32 Status = XST_SUCCESS;
@ -108,16 +108,16 @@ int XHdcp1x_CipherSetCallback(XHdcp1x_Cipher *InstancePtr, u32 HandlerType,
switch (HandlerType) {
/* Link Failure Callback */
case (XHDCP1X_CIPHER_HANDLER_LINK_FAILURE):
InstancePtr->LinkFailCallback = CallbackFunc;
InstancePtr->LinkFailRef = CallbackRef;
InstancePtr->IsLinkFailCallbackSet = (TRUE);
InstancePtr->Cipher.LinkFailCallback = CallbackFunc;
InstancePtr->Cipher.LinkFailRef = CallbackRef;
InstancePtr->Cipher.IsLinkFailCallbackSet = (TRUE);
break;
/* Ri Update Callback */
case (XHDCP1X_CIPHER_HANDLER_Ri_UPDATE):
InstancePtr->RiUpdateCallback = CallbackFunc;
InstancePtr->RiUpdateRef = CallbackRef;
InstancePtr->IsRiUpdateCallbackSet = (TRUE);
InstancePtr->Cipher.RiUpdateCallback = CallbackFunc;
InstancePtr->Cipher.RiUpdateRef = CallbackRef;
InstancePtr->Cipher.IsRiUpdateCallbackSet = (TRUE);
break;
default:
@ -142,7 +142,7 @@ int XHdcp1x_CipherSetCallback(XHdcp1x_Cipher *InstancePtr, u32 HandlerType,
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x *InstancePtr, int IsEnabled)
{
int Status = XST_SUCCESS;
@ -189,7 +189,7 @@ int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetRiUpdate(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
int XHdcp1x_CipherSetRiUpdate(XHdcp1x *InstancePtr, int IsEnabled)
{
int Status = XST_SUCCESS;
@ -234,40 +234,41 @@ int XHdcp1x_CipherSetRiUpdate(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
******************************************************************************/
void XHdcp1x_CipherHandleInterrupt(void *InstancePtr)
{
XHdcp1x_Cipher *HdcpCipherPtr = (XHdcp1x_Cipher *)InstancePtr;
XHdcp1x *HdcpPtr = InstancePtr;
u32 Pending = 0;
/* Verify arguments */
Xil_AssertVoid(HdcpCipherPtr != NULL);
Xil_AssertVoid(HdcpCipherPtr->IsReady == XIL_COMPONENT_IS_READY);
Xil_AssertVoid(HdcpPtr != NULL);
Xil_AssertVoid(HdcpPtr->Cipher.IsReady == XIL_COMPONENT_IS_READY);
/* Determine Pending */
Pending = RegRead(HdcpCipherPtr, XHDCP1X_CIPHER_REG_INTERRUPT_STATUS);
Pending &= ~RegRead(HdcpCipherPtr, XHDCP1X_CIPHER_REG_INTERRUPT_MASK);
Pending = RegRead(HdcpPtr, XHDCP1X_CIPHER_REG_INTERRUPT_STATUS);
Pending &= ~RegRead(HdcpPtr, XHDCP1X_CIPHER_REG_INTERRUPT_MASK);
/* Check for pending */
if (Pending != 0) {
/* Clear Pending */
RegWrite(HdcpCipherPtr, XHDCP1X_CIPHER_REG_INTERRUPT_STATUS,
Pending);
RegWrite(HdcpPtr, XHDCP1X_CIPHER_REG_INTERRUPT_STATUS, Pending);
/* Update statistics */
HdcpCipherPtr->Stats.IntCount++;
HdcpPtr->Cipher.Stats.IntCount++;
/* Check for link integrity failure */
if (Pending & XHDCP1X_CIPHER_BITMASK_INTERRUPT_LINK_FAIL) {
/* Invoke callback if set */
if (HdcpCipherPtr->IsLinkFailCallbackSet)
(*HdcpCipherPtr->LinkFailCallback)(
HdcpCipherPtr->LinkFailRef);
if (HdcpPtr->Cipher.IsLinkFailCallbackSet) {
(*HdcpPtr->Cipher.LinkFailCallback)(
HdcpPtr->Cipher.LinkFailRef);
}
}
/* Check for change to Ri register */
if (Pending & XHDCP1X_CIPHER_BITMASK_INTERRUPT_Ri_UPDATE) {
/* Invoke callback if set */
if (HdcpCipherPtr->IsRiUpdateCallbackSet)
(*HdcpCipherPtr->RiUpdateCallback)(
HdcpCipherPtr->RiUpdateRef);
if (HdcpPtr->Cipher.IsRiUpdateCallbackSet) {
(*HdcpPtr->Cipher.RiUpdateCallback)(
HdcpPtr->Cipher.RiUpdateRef);
}
}
}
}

View file

@ -81,7 +81,7 @@
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSelfTest(XHdcp1x_Cipher *InstancePtr)
int XHdcp1x_CipherSelfTest(XHdcp1x *InstancePtr)
{
u32 Base = 0;
u32 Value = 0;
@ -91,14 +91,14 @@ int XHdcp1x_CipherSelfTest(XHdcp1x_Cipher *InstancePtr)
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Base */
Base = InstancePtr->CfgPtr->BaseAddress;
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->CfgPtr;
const XHdcp1x_Config *CfgPtr = &InstancePtr->Config;
int IsRx = FALSE;
int IsHdmi = FALSE;

View file

@ -83,7 +83,7 @@ void XHdcp1x_CipherIntrHandler(void *InstancePtr)
Xil_AssertVoid(HdcpPtr->Common.IsReady == XIL_COMPONENT_IS_READY);
/* Dispatch it to the corresponding cipher */
XHdcp1x_CipherHandleInterrupt(&(HdcpPtr->Cipher));
XHdcp1x_CipherHandleInterrupt(HdcpPtr);
}
/*****************************************************************************/
@ -108,5 +108,6 @@ void XHdcp1x_PortIntrHandler(void *InstancePtr, u32 IntCause)
Xil_AssertVoid(HdcpPtr->Common.IsReady == XIL_COMPONENT_IS_READY);
/* Dispatch it to the corresponding port */
XHdcp1x_PortHandleInterrupt(&(HdcpPtr->Common.Port), IntCause);
XHdcp1x_PortHandleInterrupt(HdcpPtr, IntCause);
}

View file

@ -89,8 +89,7 @@ extern const XHdcp1x_PortPhyIfAdaptor XHdcp1x_PortDpRxAdaptor;
/*************************** Function Prototypes *****************************/
static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(
const XHdcp1x_Port *InstancePtr);
static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(XHdcp1x *InstancePtr);
/************************** Function Definitions *****************************/
@ -109,7 +108,7 @@ static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(
* @note None.
*
******************************************************************************/
int XHdcp1x_PortCfgInitialize(XHdcp1x_Port *InstancePtr,
int XHdcp1x_PortCfgInitialize(XHdcp1x *InstancePtr,
const XHdcp1x_Config *CfgPtr, void *PhyIfPtr)
{
int Status = XST_SUCCESS;
@ -118,26 +117,25 @@ int XHdcp1x_PortCfgInitialize(XHdcp1x_Port *InstancePtr,
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(CfgPtr != NULL);
Xil_AssertNonvoid(PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady != XIL_COMPONENT_IS_READY);
Xil_AssertNonvoid(InstancePtr->Port.IsReady != XIL_COMPONENT_IS_READY);
/* Initialize InstancePtr */
memset(InstancePtr, 0, sizeof(XHdcp1x_Port));
InstancePtr->CfgPtr = CfgPtr;
InstancePtr->PhyIfPtr = PhyIfPtr;
InstancePtr->Adaptor = DetermineAdaptor(InstancePtr);
InstancePtr->Port.CfgPtr = CfgPtr;
InstancePtr->Port.PhyIfPtr = PhyIfPtr;
InstancePtr->Port.Adaptor = DetermineAdaptor(InstancePtr);
/* Sanity Check */
if (InstancePtr->Adaptor == NULL) {
if (InstancePtr->Port.Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (InstancePtr->Adaptor->Init != NULL) {
Status = (*(InstancePtr->Adaptor->Init))(InstancePtr);
else if (InstancePtr->Port.Adaptor->Init != NULL) {
Status = (*(InstancePtr->Port.Adaptor->Init))(InstancePtr);
}
/* Set IsReady */
if (Status == XST_SUCCESS) {
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
InstancePtr->Port.IsReady = XIL_COMPONENT_IS_READY;
}
return (Status);
@ -156,7 +154,7 @@ int XHdcp1x_PortCfgInitialize(XHdcp1x_Port *InstancePtr,
* @note None.
*
******************************************************************************/
int XHdcp1x_PortEnable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortEnable(XHdcp1x *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
@ -165,7 +163,7 @@ int XHdcp1x_PortEnable(XHdcp1x_Port *InstancePtr)
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
@ -192,7 +190,7 @@ int XHdcp1x_PortEnable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDisable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDisable(XHdcp1x *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
@ -201,7 +199,7 @@ int XHdcp1x_PortDisable(XHdcp1x_Port *InstancePtr)
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
@ -226,7 +224,7 @@ int XHdcp1x_PortDisable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortIsCapable(const XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortIsCapable(const XHdcp1x *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int IsCapable = FALSE;
@ -235,7 +233,7 @@ int XHdcp1x_PortIsCapable(const XHdcp1x_Port *InstancePtr)
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->IsCapable != NULL)) {
@ -257,7 +255,7 @@ int XHdcp1x_PortIsCapable(const XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortIsRepeater(const XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortIsRepeater(const XHdcp1x *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int IsRepeater = FALSE;
@ -266,7 +264,7 @@ int XHdcp1x_PortIsRepeater(const XHdcp1x_Port *InstancePtr)
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->IsRepeater != NULL)) {
@ -290,7 +288,7 @@ int XHdcp1x_PortIsRepeater(const XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortGetRepeaterInfo(XHdcp1x_Port *InstancePtr, u16 *InfoPtr)
int XHdcp1x_PortGetRepeaterInfo(XHdcp1x *InstancePtr, u16 *InfoPtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
@ -300,7 +298,7 @@ int XHdcp1x_PortGetRepeaterInfo(XHdcp1x_Port *InstancePtr, u16 *InfoPtr)
Xil_AssertNonvoid(InfoPtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
@ -328,7 +326,7 @@ int XHdcp1x_PortGetRepeaterInfo(XHdcp1x_Port *InstancePtr, u16 *InfoPtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortRead(const XHdcp1x_Port *InstancePtr, u8 Offset, void *Buf,
int XHdcp1x_PortRead(const XHdcp1x *InstancePtr, u8 Offset, void *Buf,
u32 BufSize)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
@ -339,7 +337,7 @@ int XHdcp1x_PortRead(const XHdcp1x_Port *InstancePtr, u8 Offset, void *Buf,
Xil_AssertNonvoid(Buf != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->Read != NULL)) {
@ -364,7 +362,7 @@ int XHdcp1x_PortRead(const XHdcp1x_Port *InstancePtr, u8 Offset, void *Buf,
* @note None.
*
******************************************************************************/
int XHdcp1x_PortWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const void *Buf,
int XHdcp1x_PortWrite(XHdcp1x *InstancePtr, u8 Offset, const void *Buf,
u32 BufSize)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
@ -375,7 +373,7 @@ int XHdcp1x_PortWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const void *Buf,
Xil_AssertNonvoid(Buf != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->Write != NULL)) {
@ -398,11 +396,10 @@ int XHdcp1x_PortWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const void *Buf,
* @note None.
*
******************************************************************************/
static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(
const XHdcp1x_Port *InstancePtr)
static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(XHdcp1x *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
const XHdcp1x_Config *CfgPtr = InstancePtr->CfgPtr;
XHdcp1x_Config *CfgPtr = &InstancePtr->Config;
#if defined(INCLUDE_HDMI_RX)
/* Check for HDMI Rx */

View file

@ -80,16 +80,16 @@ typedef enum {
* underlying physical interface that it is running over
*/
typedef struct XHdcp1x_PortPhyIfAdaptorS {
int (*Init)(XHdcp1x_Port*); /**< Initialization function */
int (*Enable)(XHdcp1x_Port*); /**< Enable function */
int (*Disable)(XHdcp1x_Port*); /**< Disable function */
int (*Read)(const XHdcp1x_Port*, u8, void*, u32); /**< Reg read */
int (*Write)(XHdcp1x_Port*, u8, const void*, u32); /**< Reg write */
int (*IsCapable)(const XHdcp1x_Port*); /**< Tests for HDCP capable */
int (*IsRepeater)(const XHdcp1x_Port*); /**< Tests for repeater */
int (*GetRepeaterInfo)(const XHdcp1x_Port*, u16*); /**< Gets repeater
int (*Init)(XHdcp1x *); /**< Initialization function */
int (*Enable)(XHdcp1x *); /**< Enable function */
int (*Disable)(XHdcp1x *); /**< Disable function */
int (*Read)(const XHdcp1x *, u8, void*, u32); /**< Reg read */
int (*Write)(XHdcp1x *, u8, const void*, u32); /**< Reg write */
int (*IsCapable)(const XHdcp1x *); /**< Tests for HDCP capable */
int (*IsRepeater)(const XHdcp1x *); /**< Tests for repeater */
int (*GetRepeaterInfo)(const XHdcp1x *, u16*); /**< Gets repeater
info */
void (*IntrHandler)(XHdcp1x_Port *, u32); /**< Interrupt handler */
void (*IntrHandler)(XHdcp1x *, u32); /**< Interrupt handler */
} XHdcp1x_PortPhyIfAdaptor;
/***************** Macros (Inline Functions) Definitions *********************/
@ -189,23 +189,23 @@ typedef struct XHdcp1x_PortPhyIfAdaptorS {
/************************** Function Prototypes ******************************/
int XHdcp1x_PortCfgInitialize(XHdcp1x_Port *InstancePtr,
int XHdcp1x_PortCfgInitialize(XHdcp1x *InstancePtr,
const XHdcp1x_Config *ConfigPtr, void *PhyIfPtr);
int XHdcp1x_PortSetCallback(XHdcp1x_Port *InstancePtr, u32 HandlerType,
int XHdcp1x_PortSetCallback(XHdcp1x *InstancePtr, u32 HandlerType,
XHdcp1x_Callback Callback, void *Parameter);
int XHdcp1x_PortEnable(XHdcp1x_Port *InstancePtr);
int XHdcp1x_PortDisable(XHdcp1x_Port *InstancePtr);
int XHdcp1x_PortIsCapable(const XHdcp1x_Port *InstancePtr);
int XHdcp1x_PortIsRepeater(const XHdcp1x_Port *InstancePtr);
int XHdcp1x_PortGetRepeaterInfo(XHdcp1x_Port *InstancePtr, u16 *Info);
int XHdcp1x_PortRead(const XHdcp1x_Port *InstancePtr, u8 Offset, void *Buf,
int XHdcp1x_PortEnable(XHdcp1x *InstancePtr);
int XHdcp1x_PortDisable(XHdcp1x *InstancePtr);
int XHdcp1x_PortIsCapable(const XHdcp1x *InstancePtr);
int XHdcp1x_PortIsRepeater(const XHdcp1x *InstancePtr);
int XHdcp1x_PortGetRepeaterInfo(XHdcp1x *InstancePtr, u16 *Info);
int XHdcp1x_PortRead(const XHdcp1x *InstancePtr, u8 Offset, void *Buf,
u32 BufSize);
int XHdcp1x_PortWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const void *Buf,
int XHdcp1x_PortWrite(XHdcp1x *InstancePtr, u8 Offset, const void *Buf,
u32 BufSize);
void XHdcp1x_PortHandleInterrupt(XHdcp1x_Port *InstancePtr, u32 IntCause);
void XHdcp1x_PortHandleInterrupt(XHdcp1x *InstancePtr, u32 IntCause);
#ifdef __cplusplus
}

View file

@ -68,9 +68,8 @@
/*************************** Function Prototypes *****************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize);
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf, u32 BufSize);
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize);
static void ProcessAKsvWrite(void *CallbackRef);
static void ProcessRoRead(void *CallbackRef);
@ -90,16 +89,16 @@ static void ProcessBinfoRead(void *CallbackRef);
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxEnable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpRxEnable(XHdcp1x *InstancePtr)
{
XDprx *HwDp = InstancePtr->PhyIfPtr;
XDprx *HwDp = InstancePtr->Port.PhyIfPtr;
u32 IntMask = 0;
u8 Buf[4];
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Initialize Buf */
memset(Buf, 0, 4);
@ -150,9 +149,9 @@ int XHdcp1x_PortDpRxEnable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxDisable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpRxDisable(XHdcp1x *InstancePtr)
{
XDprx *HwDp = InstancePtr->PhyIfPtr;
XDprx *HwDp = InstancePtr->Port.PhyIfPtr;
u32 IntMask = 0;
u8 Offset = 0;
u8 Value = 0;
@ -161,7 +160,7 @@ int XHdcp1x_PortDpRxDisable(XHdcp1x_Port *InstancePtr)
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Disable interrupts */
IntMask = XDP_RX_INTERRUPT_MASK_HDCP_AKSV_WRITE_MASK;
@ -193,13 +192,13 @@ int XHdcp1x_PortDpRxDisable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxInit(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpRxInit(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Disable it */
if (XHdcp1x_PortDpRxDisable(InstancePtr) != XST_SUCCESS) {
@ -224,7 +223,7 @@ int XHdcp1x_PortDpRxInit(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortDpRxRead(const XHdcp1x *InstancePtr, u8 Offset,
void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -254,7 +253,7 @@ int XHdcp1x_PortDpRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortDpRxWrite(XHdcp1x *InstancePtr, u8 Offset,
const void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -284,10 +283,9 @@ int XHdcp1x_PortDpRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf, u32 BufSize)
{
XDprx *HwDp = InstancePtr->PhyIfPtr;
XDprx *HwDp = InstancePtr->Port.PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 RegOffset = 0;
int NumRead = 0;
@ -353,10 +351,9 @@ static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf, u32 BufSize)
{
XDprx *HwDp = InstancePtr->PhyIfPtr;
XDprx *HwDp = InstancePtr->Port.PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 RegOffset = 0;
int NumWritten = 0;
@ -445,14 +442,14 @@ static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
******************************************************************************/
static void ProcessAKsvWrite(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
XHdcp1x *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
InstancePtr->Port.Stats.IntCount++;
/* Clear bit 0 of Ainfo register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
@ -465,8 +462,8 @@ static void ProcessAKsvWrite(void *CallbackRef)
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(InstancePtr->AuthRef);
if (InstancePtr->Port.IsAuthCallbackSet) {
(*(InstancePtr->Port.AuthCallback))(InstancePtr->Port.AuthRef);
}
}
@ -485,14 +482,14 @@ static void ProcessAKsvWrite(void *CallbackRef)
******************************************************************************/
static void ProcessRoRead(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
XHdcp1x *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
InstancePtr->Port.Stats.IntCount++;
/* Clear bit 1 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
@ -515,14 +512,14 @@ static void ProcessRoRead(void *CallbackRef)
******************************************************************************/
static void ProcessBinfoRead(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
XHdcp1x *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
InstancePtr->Port.Stats.IntCount++;
/* Clear bit 0 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);

View file

@ -66,11 +66,10 @@
/*************************** Function Prototypes *****************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf, u32 BufSize);
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize);
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize);
static void CheckForRxStatusChange(XHdcp1x_Port *InstancePtr);
static void CheckForRxStatusChange(XHdcp1x *InstancePtr);
/************************** Function Definitions *****************************/
@ -87,14 +86,14 @@ static void CheckForRxStatusChange(XHdcp1x_Port *InstancePtr);
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxEnable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpTxEnable(XHdcp1x *InstancePtr)
{
u8 Value = 0;
int Status = XST_NOT_ENABLED;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Read anything to ensure that the remote end is present */
if ((RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS, &Value, 1)) > 0) {
@ -116,7 +115,7 @@ int XHdcp1x_PortDpTxEnable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxDisable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpTxDisable(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
@ -141,7 +140,7 @@ int XHdcp1x_PortDpTxDisable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxInit(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpTxInit(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
u32 Base = 0;
@ -149,10 +148,10 @@ int XHdcp1x_PortDpTxInit(XHdcp1x_Port *InstancePtr)
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Ensure that the dp video path routes through the hdcp core */
Base = ((XDptx *)InstancePtr->PhyIfPtr)->Config.BaseAddr;
Base = ((XDptx *)InstancePtr->Port.PhyIfPtr)->Config.BaseAddr;
Value = XDptx_ReadReg(Base, XDP_TX_HDCP_ENABLE);
Value |= XDP_TX_HDCP_ENABLE_BYPASS_DISABLE_MASK;
XDptx_WriteReg(Base, XDP_TX_HDCP_ENABLE, Value);
@ -176,7 +175,7 @@ int XHdcp1x_PortDpTxInit(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxIsCapable(const XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpTxIsCapable(const XHdcp1x *InstancePtr)
{
u8 Value = 0;
int IsCapable = FALSE;
@ -206,7 +205,7 @@ int XHdcp1x_PortDpTxIsCapable(const XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxIsRepeater(const XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortDpTxIsRepeater(const XHdcp1x *InstancePtr)
{
u8 Value = 0;
int IsRepeater = FALSE;
@ -239,7 +238,7 @@ int XHdcp1x_PortDpTxIsRepeater(const XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
int XHdcp1x_PortDpTxGetRepeaterInfo(const XHdcp1x *InstancePtr, u16 *Info)
{
u8 Value = 0;
int Status = XST_SUCCESS;
@ -300,7 +299,7 @@ int XHdcp1x_PortDpTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortDpTxRead(const XHdcp1x *InstancePtr, u8 Offset,
void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -330,7 +329,7 @@ int XHdcp1x_PortDpTxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortDpTxWrite(XHdcp1x *InstancePtr, u8 Offset,
const void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -358,7 +357,7 @@ int XHdcp1x_PortDpTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
void XHdcp1x_PortDpTxIntrHandler(XHdcp1x_Port *InstancePtr, u32 IntCause)
void XHdcp1x_PortDpTxIntrHandler(XHdcp1x *InstancePtr, u32 IntCause)
{
int HpdDetected = 0;
@ -393,10 +392,10 @@ void XHdcp1x_PortDpTxIntrHandler(XHdcp1x_Port *InstancePtr, u32 IntCause)
* @note None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
XDptx *DpHw = InstancePtr->PhyIfPtr;
XDptx *DpHw = InstancePtr->Port.PhyIfPtr;
u32 Address = 0;
int NumRead = 0;
@ -426,10 +425,10 @@ static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XDptx *DpHw = InstancePtr->PhyIfPtr;
XDptx *DpHw = InstancePtr->Port.PhyIfPtr;
u32 Address = 0;
int NumWritten = 0;
@ -456,7 +455,7 @@ static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
* @note None.
*
******************************************************************************/
static void CheckForRxStatusChange(XHdcp1x_Port *InstancePtr)
static void CheckForRxStatusChange(XHdcp1x *InstancePtr)
{
u8 Value = 0;
@ -471,9 +470,9 @@ static void CheckForRxStatusChange(XHdcp1x_Port *InstancePtr)
/* Check for link failure or re-authentication requested */
if ((Value & ReauthMask) != 0) {
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(
InstancePtr->AuthRef);
if (InstancePtr->Port.IsAuthCallbackSet) {
(*(InstancePtr->Port.AuthCallback))(
InstancePtr->Port.AuthRef);
}
}
}

View file

@ -67,9 +67,8 @@
/*************************** Function Prototypes *****************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize);
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf, u32 BufSize);
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize);
static void ProcessAKsvWrite(void *CallbackRef);
@ -87,7 +86,7 @@ static void ProcessAKsvWrite(void *CallbackRef);
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxEnable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiRxEnable(XHdcp1x *InstancePtr)
{
XHdmi_Rx *HdmiRx = NULL;
u8 Buf[4];
@ -95,10 +94,10 @@ int XHdcp1x_PortHdmiRxEnable(XHdcp1x_Port *InstancePtr)
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Determine HdmiRx */
HdmiRx = InstancePtr->PhyIfPtr;
HdmiRx = InstancePtr->Port.PhyIfPtr;
/* Initialize the Bstatus register */
memset(Buf, 0, 4);
@ -141,7 +140,7 @@ int XHdcp1x_PortHdmiRxEnable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxDisable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiRxDisable(XHdcp1x *InstancePtr)
{
u8 Offset = 0;
u8 U8Value = 0;
@ -152,10 +151,11 @@ int XHdcp1x_PortHdmiRxDisable(XHdcp1x_Port *InstancePtr)
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Determine HdmiRxBase */
HdmiRxBase = ((XHdmi_Rx *)InstancePtr->PhyIfPtr)->Config.BaseAddress;
HdmiRxBase =
((XHdmi_Rx *)InstancePtr->Port.PhyIfPtr)->Config.BaseAddress;
/* Disable the hdcp ddc slave */
Value = XHdmiRx_ReadReg(HdmiRxBase, XHDMI_RX_DDC_CTRL_SET_OFFSET);
@ -186,13 +186,13 @@ int XHdcp1x_PortHdmiRxDisable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxInit(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiRxInit(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Disable it */
if (XHdcp1x_PortHdmiRxDisable(InstancePtr) != XST_SUCCESS) {
@ -217,7 +217,7 @@ int XHdcp1x_PortHdmiRxInit(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortHdmiRxRead(const XHdcp1x *InstancePtr, u8 Offset,
void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -247,7 +247,7 @@ int XHdcp1x_PortHdmiRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortHdmiRxWrite(XHdcp1x *InstancePtr, u8 Offset,
const void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -277,10 +277,9 @@ int XHdcp1x_PortHdmiRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf, u32 BufSize)
{
XHdmi_Rx *HdmiRx = InstancePtr->PhyIfPtr;
XHdmi_Rx *HdmiRx = InstancePtr->Port.PhyIfPtr;
u32 NumLeft = BufSize;
/* Write the offset */
@ -308,10 +307,9 @@ static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf, u32 BufSize)
{
XHdmi_Rx *HdmiRx = InstancePtr->PhyIfPtr;
XHdmi_Rx *HdmiRx = InstancePtr->Port.PhyIfPtr;
u32 NumLeft = BufSize;
/* Write the offset */
@ -340,11 +338,11 @@ static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
******************************************************************************/
static void ProcessAKsvWrite(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = (XHdcp1x_Port *) CallbackRef;
XHdcp1x *InstancePtr = CallbackRef;
u8 Value = 0;
/* Update statistics */
InstancePtr->Stats.IntCount++;
InstancePtr->Port.Stats.IntCount++;
/* Clear bit 1 of the Ainfo register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
@ -352,8 +350,8 @@ static void ProcessAKsvWrite(void *CallbackRef)
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(InstancePtr->AuthRef);
if (InstancePtr->Port.IsAuthCallbackSet) {
(*(InstancePtr->Port.AuthCallback))(InstancePtr->Port.AuthRef);
}
}

View file

@ -69,9 +69,8 @@
/*************************** Function Prototypes *****************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize);
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf, u32 BufSize);
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize);
/************************** Function Definitions *****************************/
@ -88,14 +87,14 @@ static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxEnable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiTxEnable(XHdcp1x *InstancePtr)
{
u8 Value = 0;
int Status = XST_NOT_ENABLED;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Read anything to ensure that the remote end is present */
if ((RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS, &Value, 1)) > 0) {
@ -117,7 +116,7 @@ int XHdcp1x_PortHdmiTxEnable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxDisable(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiTxDisable(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
@ -142,13 +141,13 @@ int XHdcp1x_PortHdmiTxDisable(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxInit(XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiTxInit(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->Port.PhyIfPtr != NULL);
/* Disable it */
if (XHdcp1x_PortHdmiTxDisable(InstancePtr) != XST_SUCCESS) {
@ -169,7 +168,7 @@ int XHdcp1x_PortHdmiTxInit(XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxIsCapable(const XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiTxIsCapable(const XHdcp1x *InstancePtr)
{
u8 Value = 0;
int IsCapable = FALSE;
@ -198,7 +197,7 @@ int XHdcp1x_PortHdmiTxIsCapable(const XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxIsRepeater(const XHdcp1x_Port *InstancePtr)
int XHdcp1x_PortHdmiTxIsRepeater(const XHdcp1x *InstancePtr)
{
u8 Value = 0;
int IsRepeater = FALSE;
@ -230,7 +229,7 @@ int XHdcp1x_PortHdmiTxIsRepeater(const XHdcp1x_Port *InstancePtr)
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
int XHdcp1x_PortHdmiTxGetRepeaterInfo(const XHdcp1x *InstancePtr, u16 *Info)
{
u8 Value = 0;
int Status = XST_SUCCESS;
@ -287,7 +286,7 @@ int XHdcp1x_PortHdmiTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortHdmiTxRead(const XHdcp1x *InstancePtr, u8 Offset,
void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -317,7 +316,7 @@ int XHdcp1x_PortHdmiTxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
int XHdcp1x_PortHdmiTxWrite(XHdcp1x *InstancePtr, u8 Offset,
const void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -347,10 +346,9 @@ int XHdcp1x_PortHdmiTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
* @note None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
static int RegRead(const XHdcp1x *InstancePtr, u8 Offset, u8 *Buf, u32 BufSize)
{
XHdmi_Tx *HdmiTx = InstancePtr->PhyIfPtr;
XHdmi_Tx *HdmiTx = InstancePtr->Port.PhyIfPtr;
u8 Slave = 0x3Au;
int NumRead = 0;
@ -386,10 +384,9 @@ static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
static int RegWrite(XHdcp1x *InstancePtr, u8 Offset, const u8 *Buf, u32 BufSize)
{
XHdmi_Tx *HdmiTx = InstancePtr->PhyIfPtr;
XHdmi_Tx *HdmiTx = InstancePtr->Port.PhyIfPtr;
u8 Slave = 0x3Au;
u8 TxBuf[WRITE_CHUNK_SZ + 1];
int NumWritten = 0;

View file

@ -86,7 +86,7 @@
* installed replaces it with the new handler.
*
******************************************************************************/
int XHdcp1x_PortSetCallback(XHdcp1x_Port *InstancePtr, u32 HandlerType,
int XHdcp1x_PortSetCallback(XHdcp1x *InstancePtr, u32 HandlerType,
XHdcp1x_Callback CallbackFunc, void *CallbackRef)
{
u32 Status = XST_SUCCESS;
@ -101,9 +101,9 @@ int XHdcp1x_PortSetCallback(XHdcp1x_Port *InstancePtr, u32 HandlerType,
switch (HandlerType) {
/* Authentication Callback */
case (XHDCP1X_PORT_HANDLER_AUTHENTICATE):
InstancePtr->AuthCallback = CallbackFunc;
InstancePtr->AuthRef = CallbackRef;
InstancePtr->IsAuthCallbackSet = (TRUE);
InstancePtr->Port.AuthCallback = CallbackFunc;
InstancePtr->Port.AuthRef = CallbackRef;
InstancePtr->Port.IsAuthCallbackSet = (TRUE);
break;
default:
@ -126,7 +126,7 @@ int XHdcp1x_PortSetCallback(XHdcp1x_Port *InstancePtr, u32 HandlerType,
* @note None.
*
******************************************************************************/
void XHdcp1x_PortHandleInterrupt(XHdcp1x_Port *InstancePtr, u32 IntCause)
void XHdcp1x_PortHandleInterrupt(XHdcp1x *InstancePtr, u32 IntCause)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
@ -134,11 +134,11 @@ void XHdcp1x_PortHandleInterrupt(XHdcp1x_Port *InstancePtr, u32 IntCause)
Xil_AssertVoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
Adaptor = InstancePtr->Port.Adaptor;
/* Check for adaptor function and invoke if present */
if ((Adaptor != NULL) && (Adaptor->IntrHandler != NULL)) {
InstancePtr->Stats.IntCount++;
InstancePtr->Port.Stats.IntCount++;
(*(Adaptor->IntrHandler))(InstancePtr, IntCause);
}
}

View file

@ -174,8 +174,6 @@ static const char *StateToString(tState State);
int XHdcp1x_RxCfgInitialize(XHdcp1x *InstancePtr,
const XHdcp1x_Config *CfgPtr, void *PhyIfPtr)
{
XHdcp1x_Cipher *CipherPtr = NULL;
XHdcp1x_Port *PortPtr = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
@ -187,11 +185,9 @@ int XHdcp1x_RxCfgInitialize(XHdcp1x *InstancePtr,
InstancePtr->Rx.CfgPtr = CfgPtr;
/* Initialize cipher, port and state machine */
CipherPtr = &InstancePtr->Cipher;
PortPtr = &InstancePtr->Rx.Port;
Status = XHdcp1x_PortCfgInitialize(PortPtr, CfgPtr, PhyIfPtr);
Status = XHdcp1x_PortCfgInitialize(InstancePtr, CfgPtr, PhyIfPtr);
if (Status == XST_SUCCESS) {
Status = XHdcp1x_CipherCfgInitialize(CipherPtr, CfgPtr);
Status = XHdcp1x_CipherCfgInitialize(InstancePtr, CfgPtr);
if (Status == XST_SUCCESS) {
Init(InstancePtr);
}
@ -356,7 +352,7 @@ int XHdcp1x_RxSetLaneCount(XHdcp1x *InstancePtr, int LaneCount)
Xil_AssertNonvoid(LaneCount > 0);
/* Set it */
return (XHdcp1x_CipherSetNumLanes(&InstancePtr->Cipher, LaneCount));
return (XHdcp1x_CipherSetNumLanes(InstancePtr, LaneCount));
}
/*****************************************************************************/
@ -427,7 +423,7 @@ u64 XHdcp1x_RxGetEncryption(const XHdcp1x *InstancePtr)
Xil_AssertNonvoid(InstancePtr != NULL);
/* Get it */
return (XHdcp1x_CipherGetEncryption(&InstancePtr->Cipher));
return (XHdcp1x_CipherGetEncryption(InstancePtr));
}
/*****************************************************************************/
@ -467,7 +463,7 @@ int XHdcp1x_RxInfo(const XHdcp1x *InstancePtr)
XHDCP1X_DEBUG_PRINTF("Driver Version: %d.%02d.%02d\r\n",
((Version >> 16) &0xFFFFu), ((Version >> 8) & 0xFFu),
(Version & 0xFFu));
Version = XHdcp1x_CipherGetVersion(&InstancePtr->Cipher);
Version = XHdcp1x_CipherGetVersion(InstancePtr);
XHDCP1X_DEBUG_PRINTF("Cipher Version: %d.%02d.%02d\r\n",
((Version >> 16) &0xFFFFu), ((Version >> 8) & 0xFFu),
(Version & 0xFFu));
@ -488,7 +484,7 @@ int XHdcp1x_RxInfo(const XHdcp1x *InstancePtr)
XHDCP1X_DEBUG_PRINTF("\r\n");
XHDCP1X_DEBUG_PRINTF("Port Stats\r\n");
XHDCP1X_DEBUG_PRINTF("Int Count: %d\r\n",
InstancePtr->Rx.Port.Stats.IntCount);
InstancePtr->Port.Stats.IntCount);
return (XST_SUCCESS);
}
@ -616,15 +612,13 @@ static void RiUpdateCallback(void *Parameter)
******************************************************************************/
static void SetCheckLinkState(XHdcp1x *InstancePtr, int IsEnabled)
{
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
/* Check for DP */
if (IsDP(InstancePtr)) {
XHdcp1x_CipherSetLinkStateCheck(CipherPtr, IsEnabled);
XHdcp1x_CipherSetLinkStateCheck(InstancePtr, IsEnabled);
}
/* Check for HDMI */
else if (IsHDMI(InstancePtr)) {
XHdcp1x_CipherSetRiUpdate(CipherPtr, IsEnabled);
XHdcp1x_CipherSetRiUpdate(InstancePtr, IsEnabled);
}
}
@ -641,46 +635,44 @@ static void SetCheckLinkState(XHdcp1x *InstancePtr, int IsEnabled)
******************************************************************************/
static void Enable(XHdcp1x *InstancePtr)
{
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
XHdcp1x_Port *PortPtr = &(InstancePtr->Rx.Port);
u64 MyKsv = 0;
u8 Buf[8];
/* Disable and register the link failure callback */
XHdcp1x_CipherSetLinkStateCheck(CipherPtr, FALSE);
XHdcp1x_CipherSetCallback(CipherPtr,
XHdcp1x_CipherSetLinkStateCheck(InstancePtr, FALSE);
XHdcp1x_CipherSetCallback(InstancePtr,
XHDCP1X_CIPHER_HANDLER_LINK_FAILURE,
&LinkFailCallback, InstancePtr);
/* Disable and register the Ri callback */
XHdcp1x_CipherSetRiUpdate(CipherPtr, FALSE);
XHdcp1x_CipherSetCallback(CipherPtr,
XHdcp1x_CipherSetRiUpdate(InstancePtr, FALSE);
XHdcp1x_CipherSetCallback(InstancePtr,
XHDCP1X_CIPHER_HANDLER_Ri_UPDATE,
&RiUpdateCallback, InstancePtr);
/* Enable the crypto engine */
XHdcp1x_CipherEnable(CipherPtr);
XHdcp1x_CipherEnable(InstancePtr);
/* Read MyKsv */
MyKsv = XHdcp1x_CipherGetLocalKsv(CipherPtr);
MyKsv = XHdcp1x_CipherGetLocalKsv(InstancePtr);
/* If unknown - try against for good luck */
if (MyKsv == 0) {
MyKsv = XHdcp1x_CipherGetLocalKsv(CipherPtr);
MyKsv = XHdcp1x_CipherGetLocalKsv(InstancePtr);
}
/* Initialize Bksv */
memset(Buf, 0, 8);
XHDCP1X_PORT_UINT_TO_BUF(Buf, MyKsv, XHDCP1X_PORT_SIZE_BKSV * 8);
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_BKSV, Buf,
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BKSV, Buf,
XHDCP1X_PORT_SIZE_BKSV);
/* Register the re-authentication callback */
XHdcp1x_PortSetCallback(PortPtr, XHDCP1X_PORT_HANDLER_AUTHENTICATE,
XHdcp1x_PortSetCallback(InstancePtr, XHDCP1X_PORT_HANDLER_AUTHENTICATE,
&AuthCallback, InstancePtr);
/* Enable the hdcp port */
XHdcp1x_PortEnable(PortPtr);
XHdcp1x_PortEnable(InstancePtr);
}
/*****************************************************************************/
@ -697,8 +689,8 @@ static void Enable(XHdcp1x *InstancePtr)
static void Disable(XHdcp1x *InstancePtr)
{
/* Disable the hdcp cipher and port */
XHdcp1x_PortDisable(&(InstancePtr->Rx.Port));
XHdcp1x_CipherDisable(&InstancePtr->Cipher);
XHdcp1x_PortDisable(InstancePtr);
XHdcp1x_CipherDisable(InstancePtr);
/* Clear statistics */
memset(&(InstancePtr->Rx.Stats), 0, sizeof(InstancePtr->Rx.Stats));
@ -718,8 +710,6 @@ static void Disable(XHdcp1x *InstancePtr)
******************************************************************************/
static void StartComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
XHdcp1x_Port *PortPtr = &(InstancePtr->Rx.Port);
u8 Buf[8];
u64 Value = 0;
u32 X = 0;
@ -734,16 +724,16 @@ static void StartComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
/* Determine theAKsv */
memset(Buf, 0, 8);
XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_AKSV, Buf,
XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_AKSV, Buf,
XHDCP1X_PORT_SIZE_AKSV);
XHDCP1X_PORT_BUF_TO_UINT(Value, Buf, XHDCP1X_PORT_SIZE_AKSV * 8);
/* Load the cipher with the remote ksv */
XHdcp1x_CipherSetRemoteKsv(CipherPtr, Value);
XHdcp1x_CipherSetRemoteKsv(InstancePtr, Value);
/* Update theU64Value with An */
memset(Buf, 0, 8);
XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_AN, Buf,
XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_AN, Buf,
XHDCP1X_PORT_SIZE_AN);
XHDCP1X_PORT_BUF_TO_UINT(Value, Buf, XHDCP1X_PORT_SIZE_AN * 8);
@ -753,10 +743,10 @@ static void StartComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
Y = (u32) (Value & 0x0FFFFFFFul);
Value >>= 28;
Z = (u32) (Value & 0x000000FFul);
XHdcp1x_CipherSetB(CipherPtr, X, Y, Z);
XHdcp1x_CipherSetB(InstancePtr, X, Y, Z);
/* Initiate the block cipher */
XHdcp1x_CipherDoRequest(CipherPtr, XHDCP1X_CIPHER_REQUEST_BLOCK);
XHdcp1x_CipherDoRequest(InstancePtr, XHDCP1X_CIPHER_REQUEST_BLOCK);
}
/*****************************************************************************/
@ -773,11 +763,8 @@ static void StartComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void PollForComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
/* Check for done */
if (XHdcp1x_CipherIsRequestComplete(CipherPtr)) {
XHdcp1x_Port *PortPtr = &(InstancePtr->Rx.Port);
if (XHdcp1x_CipherIsRequestComplete(InstancePtr)) {
u8 Buf[4];
u16 Ro = 0;
@ -785,21 +772,21 @@ static void PollForComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
DebugLog(InstancePtr, "computations complete");
/* Read theRo */
Ro = XHdcp1x_CipherGetRo(CipherPtr);
Ro = XHdcp1x_CipherGetRo(InstancePtr);
/* Initialize Buf */
memset(Buf, 0, 4);
XHDCP1X_PORT_UINT_TO_BUF(Buf, Ro, 16);
/* Update the value of Ro' */
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_RO, Buf, 2);
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_RO, Buf, 2);
#if defined(XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE)
/* Update the Bstatus to indicate Ro' available */
XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHDCP1X_PORT_SIZE_BSTATUS);
Buf[0] |= XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE;
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHDCP1X_PORT_SIZE_BSTATUS);
#endif
/* Update NextStatePtr */
@ -826,15 +813,13 @@ static void PollForComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void UpdateRi(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
XHdcp1x_Port *PortPtr = &(InstancePtr->Rx.Port);
char LogBuf[20];
u8 Buf[4];
u16 Ri = 0;
u16 RememberRi = 0;
/* Read Ri */
Ri = XHdcp1x_CipherGetRi(CipherPtr);
Ri = XHdcp1x_CipherGetRi(InstancePtr);
/* Update RememberRi */
RememberRi = Ri;
@ -844,14 +829,14 @@ static void UpdateRi(XHdcp1x *InstancePtr, tState *NextStatePtr)
XHDCP1X_PORT_UINT_TO_BUF(Buf, Ri, XHDCP1X_PORT_SIZE_RO * 8);
/* Update the value of Ro' */
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_RO, Buf, sizeof(Ri));
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_RO, Buf, sizeof(Ri));
#if defined(XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE)
/* Update the Bstatus to indicate Ro' available */
XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHDCP1X_PORT_SIZE_BSTATUS);
Buf[0] |= XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE;
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHDCP1X_PORT_SIZE_BSTATUS);
#endif
@ -879,7 +864,7 @@ static void UpdateRi(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void CheckLinkIntegrity(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
if (XHdcp1x_CipherIsLinkUp(&InstancePtr->Cipher)) {
if (XHdcp1x_CipherIsLinkUp(InstancePtr)) {
*NextStatePtr = STATE_AUTHENTICATED;
}
else {
@ -903,14 +888,13 @@ static void ReportLinkIntegrityFailure(XHdcp1x *InstancePtr,
tState *NextStatePtr)
{
#if defined(XHDCP1X_PORT_BIT_BSTATUS_LINK_FAILURE)
XHdcp1x_Port *PortPtr = &(InstancePtr->Rx.Port);
u8 Buf[XHDCP1X_PORT_SIZE_BSTATUS];
/* Update the Bstatus register */
XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHDCP1X_PORT_SIZE_BSTATUS);
Buf[0] |= XHDCP1X_PORT_BIT_BSTATUS_LINK_FAILURE;
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf,
XHDCP1X_PORT_SIZE_BSTATUS);
#endif
@ -1225,7 +1209,7 @@ static void EnterState(XHdcp1x *InstancePtr, tState State, tState *NextStatePtr)
/* For physical layer down */
case STATE_PHYDOWN:
InstancePtr->Rx.Flags &= ~FLAG_PHY_UP;
XHdcp1x_CipherDisable(&InstancePtr->Cipher);
XHdcp1x_CipherDisable(InstancePtr);
break;
/* Otherwise */
@ -1263,7 +1247,7 @@ static void ExitState(XHdcp1x *InstancePtr, tState State)
/* For physical layer down */
case STATE_PHYDOWN:
XHdcp1x_CipherEnable(&InstancePtr->Cipher);
XHdcp1x_CipherEnable(InstancePtr);
break;
/* Otherwise */

View file

@ -85,16 +85,12 @@
int XHdcp1x_SelfTest(XHdcp1x *InstancePtr)
{
int Status = XST_SUCCESS;
XHdcp1x_Cipher *CipherPtr = NULL;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine CipherPtr */
CipherPtr = &InstancePtr->Cipher;
/* Self test the cipher */
if (XHdcp1x_CipherSelfTest(CipherPtr) != XST_SUCCESS) {
if (XHdcp1x_CipherSelfTest(InstancePtr) != XST_SUCCESS) {
Status = XST_FAILURE;
}

View file

@ -212,8 +212,6 @@ static const char *StateToString(tState State);
int XHdcp1x_TxCfgInitialize(XHdcp1x *InstancePtr,
const XHdcp1x_Config *CfgPtr, void *PhyIfPtr)
{
XHdcp1x_Cipher *CipherPtr = NULL;
XHdcp1x_Port *PortPtr = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
@ -225,11 +223,9 @@ int XHdcp1x_TxCfgInitialize(XHdcp1x *InstancePtr,
InstancePtr->Tx.CfgPtr = CfgPtr;
/* Initialize cipher, port and state machine */
CipherPtr = &InstancePtr->Cipher;
PortPtr = &InstancePtr->Tx.Port;
Status = XHdcp1x_PortCfgInitialize(PortPtr, CfgPtr, PhyIfPtr);
Status = XHdcp1x_PortCfgInitialize(InstancePtr, CfgPtr, PhyIfPtr);
if (Status == XST_SUCCESS) {
Status = XHdcp1x_CipherCfgInitialize(CipherPtr, CfgPtr);
Status = XHdcp1x_CipherCfgInitialize(InstancePtr, CfgPtr);
if (Status == XST_SUCCESS) {
Init(InstancePtr);
}
@ -394,7 +390,7 @@ int XHdcp1x_TxSetLaneCount(XHdcp1x *InstancePtr, int LaneCount)
Xil_AssertNonvoid(LaneCount > 0);
/* Set it */
return (XHdcp1x_CipherSetNumLanes(&InstancePtr->Cipher, LaneCount));
return (XHdcp1x_CipherSetNumLanes(InstancePtr, LaneCount));
}
/*****************************************************************************/
@ -550,8 +546,7 @@ int XHdcp1x_TxDisableEncryption(XHdcp1x *InstancePtr, u64 StreamMap)
Xil_AssertNonvoid(InstancePtr != NULL);
/* Disable it */
Status = XHdcp1x_CipherDisableEncryption(&InstancePtr->Cipher,
StreamMap);
Status = XHdcp1x_CipherDisableEncryption(InstancePtr, StreamMap);
/* Update InstancePtr */
if (Status == XST_SUCCESS) {
@ -622,7 +617,7 @@ int XHdcp1x_TxInfo(const XHdcp1x *InstancePtr)
XHDCP1X_DEBUG_PRINTF("Driver Version: %d.%02d.%02d\r\n",
((Version >> 16) &0xFFFFu), ((Version >> 8) & 0xFFu),
(Version & 0xFFu));
Version = XHdcp1x_CipherGetVersion(&InstancePtr->Cipher);
Version = XHdcp1x_CipherGetVersion(InstancePtr);
XHDCP1X_DEBUG_PRINTF("Cipher Version: %d.%02d.%02d\r\n",
((Version >> 16) &0xFFFFu), ((Version >> 8) & 0xFFu),
(Version & 0xFFu));
@ -649,7 +644,7 @@ int XHdcp1x_TxInfo(const XHdcp1x *InstancePtr)
XHDCP1X_DEBUG_PRINTF("\r\n");
XHDCP1X_DEBUG_PRINTF("Port Stats\r\n");
XHDCP1X_DEBUG_PRINTF("Int Count: %d\r\n",
InstancePtr->Tx.Port.Stats.IntCount);
InstancePtr->Port.Stats.IntCount);
return (XST_SUCCESS);
}
@ -817,22 +812,20 @@ static void SetCheckLinkState(XHdcp1x *InstancePtr, int IsEnabled)
{
/* Check for HDMI */
if (IsHDMI(InstancePtr)) {
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
/* Check for enabled */
if (IsEnabled) {
/* Register Callback */
XHdcp1x_CipherSetCallback(CipherPtr,
XHdcp1x_CipherSetCallback(InstancePtr,
XHDCP1X_CIPHER_HANDLER_Ri_UPDATE,
&CheckLinkCallback, InstancePtr);
/* Enable it */
XHdcp1x_CipherSetRiUpdate(CipherPtr, TRUE);
XHdcp1x_CipherSetRiUpdate(InstancePtr, TRUE);
}
/* Otherwise */
else {
/* Disable it */
XHdcp1x_CipherSetRiUpdate(CipherPtr, FALSE);
XHdcp1x_CipherSetRiUpdate(InstancePtr, FALSE);
}
}
}
@ -857,7 +850,7 @@ static void EnableEncryption(XHdcp1x *InstancePtr)
/* Determine StreamMap */
StreamMap =
XHdcp1x_CipherGetEncryption(&InstancePtr->Cipher);
XHdcp1x_CipherGetEncryption(InstancePtr);
/* Check if there is something to do */
if (StreamMap != InstancePtr->Tx.EncryptionMap) {
@ -865,7 +858,7 @@ static void EnableEncryption(XHdcp1x *InstancePtr)
BusyDelay(InstancePtr, TMO_5MS);
/* Enable it */
XHdcp1x_CipherEnableEncryption(&InstancePtr->Cipher,
XHdcp1x_CipherEnableEncryption(InstancePtr,
InstancePtr->Tx.EncryptionMap);
}
}
@ -885,7 +878,7 @@ static void EnableEncryption(XHdcp1x *InstancePtr)
******************************************************************************/
static void DisableEncryption(XHdcp1x *InstancePtr)
{
u64 StreamMap = XHdcp1x_CipherGetEncryption(&InstancePtr->Cipher);
u64 StreamMap = XHdcp1x_CipherGetEncryption(InstancePtr);
/* Check if encryption actually enabled */
if (StreamMap != 0) {
@ -893,8 +886,7 @@ static void DisableEncryption(XHdcp1x *InstancePtr)
StreamMap = (u64)(-1);
/* Disable it all */
XHdcp1x_CipherDisableEncryption(&InstancePtr->Cipher,
StreamMap);
XHdcp1x_CipherDisableEncryption(InstancePtr, StreamMap);
/* Wait at least a frame */
BusyDelay(InstancePtr, TMO_5MS);
@ -918,15 +910,15 @@ static void Enable(XHdcp1x *InstancePtr)
memset(&(InstancePtr->Tx.Stats), 0, sizeof(InstancePtr->Tx.Stats));
/* Enable the crypto engine */
XHdcp1x_CipherEnable(&InstancePtr->Cipher);
XHdcp1x_CipherEnable(InstancePtr);
/* Register the re-authentication callback */
XHdcp1x_PortSetCallback(&InstancePtr->Tx.Port,
XHdcp1x_PortSetCallback(InstancePtr,
XHDCP1X_PORT_HANDLER_AUTHENTICATE,
&ReauthenticateCallback, InstancePtr);
/* Enable the hdcp port */
XHdcp1x_PortEnable(&InstancePtr->Tx.Port);
XHdcp1x_PortEnable(InstancePtr);
}
/*****************************************************************************/
@ -943,10 +935,10 @@ static void Enable(XHdcp1x *InstancePtr)
static void Disable(XHdcp1x *InstancePtr)
{
/* Disable the hdcp port */
XHdcp1x_PortDisable(&InstancePtr->Tx.Port);
XHdcp1x_PortDisable(InstancePtr);
/* Disable the cryto engine */
XHdcp1x_CipherDisable(&InstancePtr->Cipher);
XHdcp1x_CipherDisable(InstancePtr);
/* Disable the timer */
StopTimer(InstancePtr);
@ -972,7 +964,7 @@ static void Disable(XHdcp1x *InstancePtr)
static void CheckRxCapable(const XHdcp1x *InstancePtr, tState *NextStatePtr)
{
/* Check for capable */
if (XHdcp1x_PortIsCapable(&InstancePtr->Tx.Port)) {
if (XHdcp1x_PortIsCapable(InstancePtr)) {
/* Log */
DebugLog(InstancePtr, "rx hdcp capable");
@ -1001,17 +993,16 @@ static void CheckRxCapable(const XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static u64 GenerateAn(XHdcp1x *InstancePtr)
{
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
u64 An = 0;
/* Attempt to generate An */
if (XHdcp1x_CipherDoRequest(CipherPtr, XHDCP1X_CIPHER_REQUEST_RNG) ==
if (XHdcp1x_CipherDoRequest(InstancePtr, XHDCP1X_CIPHER_REQUEST_RNG) ==
XST_SUCCESS) {
/* Wait until done */
while (!XHdcp1x_CipherIsRequestComplete(CipherPtr));
while (!XHdcp1x_CipherIsRequestComplete(InstancePtr));
/* Update theAn */
An = XHdcp1x_CipherGetMi(CipherPtr);
An = XHdcp1x_CipherGetMi(InstancePtr);
}
/* Check if zero */
@ -1068,8 +1059,6 @@ static int IsKsvValid(u64 Ksv)
******************************************************************************/
static void ExchangeKsvs(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Port *PortPtr = &InstancePtr->Tx.Port;
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
u8 Buf[8];
/* Initialize Buf */
@ -1079,7 +1068,8 @@ static void ExchangeKsvs(XHdcp1x *InstancePtr, tState *NextStatePtr)
*NextStatePtr = STATE_UNAUTHENTICATED;
/* Read the Bksv from remote end */
if (XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_BKSV, Buf, 5) > 0) {
if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BKSV,
Buf, 5) > 0) {
u64 RemoteKsv = 0;
/* Determine theRemoteKsv */
@ -1100,7 +1090,7 @@ static void ExchangeKsvs(XHdcp1x *InstancePtr, tState *NextStatePtr)
u64 An = 0;
/* Check for repeater and update InstancePtr */
if (XHdcp1x_PortIsRepeater(&InstancePtr->Tx.Port)) {
if (XHdcp1x_PortIsRepeater(InstancePtr)) {
InstancePtr->Tx.Flags |= FLAG_IS_REPEATER;
}
else {
@ -1114,21 +1104,21 @@ static void ExchangeKsvs(XHdcp1x *InstancePtr, tState *NextStatePtr)
InstancePtr->Tx.StateHelper = An;
/* Determine theLocalKsv */
LocalKsv = XHdcp1x_CipherGetLocalKsv(CipherPtr);
LocalKsv = XHdcp1x_CipherGetLocalKsv(InstancePtr);
/* Load the cipher with the remote ksv */
XHdcp1x_CipherSetRemoteKsv(CipherPtr, RemoteKsv);
XHdcp1x_CipherSetRemoteKsv(InstancePtr, RemoteKsv);
/* Send An to remote */
XHDCP1X_PORT_UINT_TO_BUF(Buf, An,
XHDCP1X_PORT_SIZE_AN * 8);
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_AN, Buf,
XHDCP1X_PORT_SIZE_AN);
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AN,
Buf, XHDCP1X_PORT_SIZE_AN);
/* Send AKsv to remote */
XHDCP1X_PORT_UINT_TO_BUF(Buf, LocalKsv,
XHDCP1X_PORT_SIZE_AKSV * 8);
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_AKSV,
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AKSV,
Buf, XHDCP1X_PORT_SIZE_AKSV);
/* Update NextStatePtr */
@ -1156,7 +1146,6 @@ static void ExchangeKsvs(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void StartComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
u64 Value = 0;
u32 X = 0;
u32 Y = 0;
@ -1177,10 +1166,10 @@ static void StartComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
if ((InstancePtr->Tx.Flags & FLAG_IS_REPEATER) != 0) {
Z |= (1ul << 8);
}
XHdcp1x_CipherSetB(CipherPtr, X, Y, Z);
XHdcp1x_CipherSetB(InstancePtr, X, Y, Z);
/* Initiate the block cipher */
XHdcp1x_CipherDoRequest(CipherPtr, XHDCP1X_CIPHER_REQUEST_BLOCK);
XHdcp1x_CipherDoRequest(InstancePtr, XHDCP1X_CIPHER_REQUEST_BLOCK);
}
/*****************************************************************************/
@ -1198,7 +1187,7 @@ static void StartComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
static void PollForComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
/* Check for done */
if (XHdcp1x_CipherIsRequestComplete(&InstancePtr->Cipher)) {
if (XHdcp1x_CipherIsRequestComplete(InstancePtr)) {
DebugLog(InstancePtr, "computations complete");
*NextStatePtr = STATE_VALIDATERX;
}
@ -1221,8 +1210,6 @@ static void PollForComputations(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void ValidateRx(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Port *PortPtr = &InstancePtr->Tx.Port;
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
u8 Buf[2];
int NumTries = 3;
@ -1232,7 +1219,7 @@ static void ValidateRx(XHdcp1x *InstancePtr, tState *NextStatePtr)
/* Attempt to read Ro */
do {
/* Read the remote Ro' */
if (XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_RO,
if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_RO,
Buf, 2) > 0) {
char LogBuf[32];
u16 RemoteRo = 0;
@ -1242,7 +1229,7 @@ static void ValidateRx(XHdcp1x *InstancePtr, tState *NextStatePtr)
XHDCP1X_PORT_BUF_TO_UINT(RemoteRo, Buf, 2 * 8);
/* Determine theLLocalRoocalRo */
LocalRo = XHdcp1x_CipherGetRo(CipherPtr);
LocalRo = XHdcp1x_CipherGetRo(InstancePtr);
/* Compare the Ro values */
if (LocalRo == RemoteRo) {
@ -1297,8 +1284,6 @@ static void ValidateRx(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void CheckLinkIntegrity(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Port *PortPtr = &InstancePtr->Tx.Port;
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
u8 Buf[2];
int NumTries = 3;
@ -1308,7 +1293,7 @@ static void CheckLinkIntegrity(XHdcp1x *InstancePtr, tState *NextStatePtr)
/* Iterate through the tries */
do {
/* Read the remote Ri' */
if (XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_RO,
if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_RO,
Buf, 2) > 0) {
char LogBuf[48];
@ -1319,7 +1304,7 @@ static void CheckLinkIntegrity(XHdcp1x *InstancePtr, tState *NextStatePtr)
XHDCP1X_PORT_BUF_TO_UINT(RemoteRi, Buf, 16);
/* Determine theLocalRi */
LocalRi = XHdcp1x_CipherGetRi(CipherPtr);
LocalRi = XHdcp1x_CipherGetRi(InstancePtr);
/* Compare the local and remote values */
if (LocalRi == RemoteRi) {
@ -1373,10 +1358,8 @@ static void CheckLinkIntegrity(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void TestForRepeater(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Port *PortPtr = &InstancePtr->Tx.Port;
/* Check for repeater */
if (XHdcp1x_PortIsRepeater(PortPtr)) {
if (XHdcp1x_PortIsRepeater(InstancePtr)) {
u8 Buf[XHDCP1X_PORT_SIZE_AINFO];
/* Update InstancePtr */
@ -1384,7 +1367,7 @@ static void TestForRepeater(XHdcp1x *InstancePtr, tState *NextStatePtr)
/* Clear AINFO */
memset(Buf, 0, XHDCP1X_PORT_SIZE_AINFO);
XHdcp1x_PortWrite(PortPtr, XHDCP1X_PORT_OFFSET_AINFO, Buf,
XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, Buf,
XHDCP1X_PORT_SIZE_AINFO);
/* Update NextStatePtr */
@ -1419,12 +1402,11 @@ static void TestForRepeater(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static void PollForWaitForReady(XHdcp1x *InstancePtr, tState *NextStatePtr)
{
XHdcp1x_Port *PortPtr = &InstancePtr->Tx.Port;
u16 RepeaterInfo = 0;
int Status = XST_SUCCESS;
/* Attempt to read the repeater info */
Status = XHdcp1x_PortGetRepeaterInfo(PortPtr, &RepeaterInfo);
Status = XHdcp1x_PortGetRepeaterInfo(InstancePtr, &RepeaterInfo);
if (Status == XST_SUCCESS) {
/* Check that neither cascade or device numbers exceeded */
if ((RepeaterInfo & 0x0880u) == 0) {
@ -1479,8 +1461,6 @@ static void PollForWaitForReady(XHdcp1x *InstancePtr, tState *NextStatePtr)
******************************************************************************/
static int ValidateKsvList(XHdcp1x *InstancePtr, u16 RepeaterInfo)
{
XHdcp1x_Port *PortPtr = &InstancePtr->Tx.Port;
XHdcp1x_Cipher *CipherPtr = &InstancePtr->Cipher;
SHA1Context Sha1Context;
u8 Buf[24];
int NumToRead = 0;
@ -1508,7 +1488,7 @@ static int ValidateKsvList(XHdcp1x *InstancePtr, u16 RepeaterInfo)
}
/* Read the next chunk of the list */
if (XHdcp1x_PortRead(PortPtr, XHDCP1X_PORT_OFFSET_KSVFIFO,
if (XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_KSVFIFO,
Buf, NumThisTime) > 0) {
/* Update the calculation of V */
SHA1Input(&Sha1Context, Buf, NumThisTime);
@ -1537,7 +1517,7 @@ static int ValidateKsvList(XHdcp1x *InstancePtr, u16 RepeaterInfo)
SHA1Input(&Sha1Context, Buf, 2);
/* Insert the Mo into the SHA-1 transform */
Mo = XHdcp1x_CipherGetMo(CipherPtr);
Mo = XHdcp1x_CipherGetMo(InstancePtr);
XHDCP1X_PORT_UINT_TO_BUF(Buf, Mo, 64);
SHA1Input(&Sha1Context, Buf, 8);
@ -1562,7 +1542,7 @@ static int ValidateKsvList(XHdcp1x *InstancePtr, u16 RepeaterInfo)
CalcValue |= *Sha1Buf++;
/* Read the value from the far end */
if (XHdcp1x_PortRead(PortPtr, Offset, Buf,
if (XHdcp1x_PortRead(InstancePtr, Offset, Buf,
4) > 0) {
/* Determine ReadValue */
XHDCP1X_PORT_BUF_TO_UINT(ReadValue,
@ -2278,7 +2258,7 @@ static void EnterState(XHdcp1x *InstancePtr, tState State, tState *NextStatePtr)
case STATE_PHYDOWN:
InstancePtr->Tx.Flags &= ~FLAG_PHY_UP;
DisableEncryption(InstancePtr);
XHdcp1x_CipherDisable(&InstancePtr->Cipher);
XHdcp1x_CipherDisable(InstancePtr);
break;
/* Otherwise */
@ -2331,7 +2311,7 @@ static void ExitState(XHdcp1x *InstancePtr, tState State)
/* For physical layer down */
case STATE_PHYDOWN:
XHdcp1x_CipherEnable(&InstancePtr->Cipher);
XHdcp1x_CipherEnable(InstancePtr);
break;
/* Otherwise */