From 4157a3516df1018b2892cd4fb635b7a5b11d4743 Mon Sep 17 00:00:00 2001 From: Andrei-Liviu Simion Date: Fri, 7 Aug 2015 11:52:17 -0700 Subject: [PATCH] hdcp1x: Removed common structure and duplications. Keep commonality in the top-level instance core structure. Signed-off-by: Andrei-Liviu Simion Acked-by: Shadul Shaikh --- .../drivers/hdcp1x/src/xhdcp1x.c | 5 +---- .../drivers/hdcp1x/src/xhdcp1x.h | 20 +------------------ .../drivers/hdcp1x/src/xhdcp1x_cipher.c | 6 ------ .../drivers/hdcp1x/src/xhdcp1x_cipher_intr.c | 2 +- .../drivers/hdcp1x/src/xhdcp1x_intr.c | 4 ++-- .../drivers/hdcp1x/src/xhdcp1x_port.c | 7 ------- .../drivers/hdcp1x/src/xhdcp1x_rx.c | 3 --- .../drivers/hdcp1x/src/xhdcp1x_tx.c | 3 --- 8 files changed, 5 insertions(+), 45 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.c index 21d90f1f..ee93631c 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.c @@ -171,12 +171,9 @@ int XHdcp1x_CfgInitialize(XHdcp1x *InstancePtr, const XHdcp1x_Config *CfgPtr, /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(CfgPtr != NULL); - Xil_AssertNonvoid(InstancePtr->Common.IsReady != - XIL_COMPONENT_IS_READY); /* Initialize InstancePtr */ memset(InstancePtr, 0, sizeof(XHdcp1x)); - InstancePtr->Common.CfgPtr = CfgPtr; InstancePtr->Config = *CfgPtr; #if defined(INCLUDE_TX) @@ -199,7 +196,7 @@ int XHdcp1x_CfgInitialize(XHdcp1x *InstancePtr, const XHdcp1x_Config *CfgPtr, /* Update IsReady */ if (Status == XST_SUCCESS) { - InstancePtr->Common.IsReady = XIL_COMPONENT_IS_READY; + InstancePtr->IsReady = XIL_COMPONENT_IS_READY; } return (Status); diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h index 0ae780d7..a8e82eb7 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x.h @@ -106,8 +106,6 @@ typedef struct { * This typedef contains an instance of the HDCP cipher core */ typedef struct { - const XHdcp1x_Config *CfgPtr; /**< The cipher core config */ - u32 IsReady; /**< The ready flag */ XHdcp1x_Callback LinkFailCallback; /**< Link fail callback */ void *LinkFailRef; /**< Link fail reference */ u32 IsLinkFailCallbackSet; /**< Link fail config flag */ @@ -133,10 +131,8 @@ struct XHdcp1x_PortPhyIfAdaptorS; * This typedef contains an instance of the HDCP port */ typedef struct XHdcp1x_PortStruct { - const XHdcp1x_Config *CfgPtr; /**< The cipher core config */ const struct XHdcp1x_PortPhyIfAdaptorS *Adaptor; /**< Port adaptor */ void *PhyIfPtr; /**< The port's physical interface */ - u32 IsReady; /**< The ready flag */ XHdcp1x_Callback AuthCallback; /**< (Re)Authentication callback */ void *AuthRef; /**< (Re)Authentication reference */ u32 IsAuthCallbackSet; /**< (Re)Authentication config flag */ @@ -164,22 +160,10 @@ typedef struct { u32 RiUpdates; /**< Num of Ri updates performed */ } XHdcp1x_RxStats; -/** - * This typedef defines the elements that are common to both RX and TX HDCP - * interfaces. The fields within this typedef must align with both the RX - * and TX definitions - */ -typedef struct { - const XHdcp1x_Config *CfgPtr; /**< The cipher core config */ - u32 IsReady; /**< The ready flag */ -} XHdcp1x_Common; - /** * This typedef contains the transmit HDCP interface */ typedef struct { - const XHdcp1x_Config *CfgPtr; /**< The cipher core config */ - u32 IsReady; /**< The ready flag */ u32 CurrentState; /**< The interface's current state */ u32 PreviousState; /**< The interface's previous state */ u64 StateHelper; /**< The interface's state helper */ @@ -193,8 +177,6 @@ typedef struct { * This typedef contains the receive HDCP interface */ typedef struct { - const XHdcp1x_Config *CfgPtr; /**< The cipher core config */ - u32 IsReady; /**< The ready flag */ u32 CurrentState; /**< The interface's current state */ u32 PreviousState; /**< The interface's previous state */ u16 Flags; /**< The interface flags */ @@ -210,10 +192,10 @@ typedef struct { 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 */ XHdcp1x_Rx Rx; /**< The receive interface elements */ }; + u32 IsReady; /**< The ready flag */ } XHdcp1x; /** diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c index 9ef512f3..7c3ea712 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher.c @@ -241,11 +241,6 @@ int XHdcp1x_CipherCfgInitialize(XHdcp1x *InstancePtr, /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(CfgPtr != NULL); - Xil_AssertNonvoid(InstancePtr->Cipher.IsReady != - XIL_COMPONENT_IS_READY); - - /* Initialize InstancePtr */ - InstancePtr->Cipher.CfgPtr = CfgPtr; /* Check for mismatch on direction */ if (IsRX(InstancePtr)) { @@ -270,7 +265,6 @@ int XHdcp1x_CipherCfgInitialize(XHdcp1x *InstancePtr, /* Initialize it */ if (Status == XST_SUCCESS) { Init(InstancePtr); - InstancePtr->Cipher.IsReady = XIL_COMPONENT_IS_READY; } return (Status); diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_intr.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_intr.c index 5eab81e5..74b06d3c 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_intr.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_cipher_intr.c @@ -239,7 +239,7 @@ void XHdcp1x_CipherHandleInterrupt(void *InstancePtr) /* Verify arguments */ Xil_AssertVoid(HdcpPtr != NULL); - Xil_AssertVoid(HdcpPtr->Cipher.IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(HdcpPtr->IsReady == XIL_COMPONENT_IS_READY); /* Determine Pending */ Pending = RegRead(HdcpPtr, XHDCP1X_CIPHER_REG_INTERRUPT_STATUS); diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_intr.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_intr.c index 407482ce..55f1ea0e 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_intr.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_intr.c @@ -80,7 +80,7 @@ void XHdcp1x_CipherIntrHandler(void *InstancePtr) /* Verify arguments */ Xil_AssertVoid(HdcpPtr != NULL); - Xil_AssertVoid(HdcpPtr->Common.IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(HdcpPtr->IsReady == XIL_COMPONENT_IS_READY); /* Dispatch it to the corresponding cipher */ XHdcp1x_CipherHandleInterrupt(HdcpPtr); @@ -105,7 +105,7 @@ void XHdcp1x_PortIntrHandler(void *InstancePtr, u32 IntCause) /* Verify arguments */ Xil_AssertVoid(HdcpPtr != NULL); - Xil_AssertVoid(HdcpPtr->Common.IsReady == XIL_COMPONENT_IS_READY); + Xil_AssertVoid(HdcpPtr->IsReady == XIL_COMPONENT_IS_READY); /* Dispatch it to the corresponding port */ XHdcp1x_PortHandleInterrupt(HdcpPtr, IntCause); diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_port.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_port.c index 31333fe6..a55018b6 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_port.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_port.c @@ -117,10 +117,8 @@ int XHdcp1x_PortCfgInitialize(XHdcp1x *InstancePtr, Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(CfgPtr != NULL); Xil_AssertNonvoid(PhyIfPtr != NULL); - Xil_AssertNonvoid(InstancePtr->Port.IsReady != XIL_COMPONENT_IS_READY); /* Initialize InstancePtr */ - InstancePtr->Port.CfgPtr = CfgPtr; InstancePtr->Port.PhyIfPtr = PhyIfPtr; InstancePtr->Port.Adaptor = DetermineAdaptor(InstancePtr); @@ -133,11 +131,6 @@ int XHdcp1x_PortCfgInitialize(XHdcp1x *InstancePtr, Status = (*(InstancePtr->Port.Adaptor->Init))(InstancePtr); } - /* Set IsReady */ - if (Status == XST_SUCCESS) { - InstancePtr->Port.IsReady = XIL_COMPONENT_IS_READY; - } - return (Status); } diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_rx.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_rx.c index 63d01486..b6faf2ac 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_rx.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_rx.c @@ -181,9 +181,6 @@ int XHdcp1x_RxCfgInitialize(XHdcp1x *InstancePtr, Xil_AssertNonvoid(CfgPtr != NULL); Xil_AssertNonvoid(PhyIfPtr != NULL); - /* Initialize InstancePtr */ - InstancePtr->Rx.CfgPtr = CfgPtr; - /* Initialize cipher, port and state machine */ Status = XHdcp1x_PortCfgInitialize(InstancePtr, CfgPtr, PhyIfPtr); if (Status == XST_SUCCESS) { diff --git a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_tx.c b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_tx.c index 8678bb60..a4188b63 100644 --- a/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_tx.c +++ b/XilinxProcessorIPLib/drivers/hdcp1x/src/xhdcp1x_tx.c @@ -219,9 +219,6 @@ int XHdcp1x_TxCfgInitialize(XHdcp1x *InstancePtr, Xil_AssertNonvoid(CfgPtr != NULL); Xil_AssertNonvoid(PhyIfPtr != NULL); - /* Initialize InstancePtr */ - InstancePtr->Tx.CfgPtr = CfgPtr; - /* Initialize cipher, port and state machine */ Status = XHdcp1x_PortCfgInitialize(InstancePtr, CfgPtr, PhyIfPtr); if (Status == XST_SUCCESS) {