hdcp1x: Modifications for Xilinx standalone coding style.

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-07-29 04:16:21 -07:00 committed by Nava kishore Manne
parent 328077ad8b
commit 01291541a5
29 changed files with 5131 additions and 5642 deletions

View file

@ -18,8 +18,8 @@
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

View file

@ -18,8 +18,8 @@
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

View file

@ -9,7 +9,7 @@ RELEASEDIR=../../../lib
INCLUDEDIR=../../../include
INCLUDES=-I./. -I${INCLUDEDIR}
INCLUDEFILES=xhdcp1x.h xhdcp1x_port.h
INCLUDEFILES=xhdcp1x.h xhdcp1x_hw.h xhdcp1x_port.h
LIBSOURCES=*.c
OUTS = *.o

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -29,7 +29,6 @@
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
/*****************************************************************************/
/**
*
@ -42,13 +41,13 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include <stdlib.h>
#include <string.h>
#include "xhdcp1x.h"
@ -62,15 +61,16 @@
#include "xstatus.h"
/************************** Constant Definitions *****************************/
#if defined(XPAR_XHDMI_TX_NUM_INSTANCES) && (XPAR_XHDMI_TX_NUM_INSTANCES > 0)
#define INCLUDE_TX
#define INCLUDE_TX
#endif
#if defined(XPAR_XHDMI_RX_NUM_INSTANCES) && (XPAR_XHDMI_RX_NUM_INSTANCES > 0)
#define INCLUDE_RX
#define INCLUDE_RX
#endif
#if defined(XPAR_XDP_NUM_INSTANCES) && (XPAR_XDP_NUM_INSTANCES > 0)
#define INCLUDE_RX
#define INCLUDE_TX
#define INCLUDE_RX
#define INCLUDE_TX
#endif
/**
@ -83,99 +83,88 @@
/************************** Extern Declarations ******************************/
/************************** Global Declarations ******************************/
XHdcp1x_Printf XHdcp1xDebugPrintf = NULL;
XHdcp1x_LogMsg XHdcp1xDebugLogMsg = NULL;
XHdcp1x_KsvRevokeCheck XHdcp1xKsvRevokeCheck = NULL;
XHdcp1x_TimerStart XHdcp1xTimerStart = NULL;
XHdcp1x_TimerStop XHdcp1xTimerStop = NULL;
XHdcp1x_TimerDelay XHdcp1xTimerDelay = NULL;
XHdcp1x_Printf XHdcp1xDebugPrintf = NULL;
XHdcp1x_LogMsg XHdcp1xDebugLogMsg = NULL;
XHdcp1x_KsvRevokeCheck XHdcp1xKsvRevokeCheck = NULL;
XHdcp1x_TimerStart XHdcp1xTimerStart = NULL;
XHdcp1x_TimerStop XHdcp1xTimerStop = NULL;
XHdcp1x_TimerDelay XHdcp1xTimerDelay = NULL;
/***************** Macros (Inline Functions) Definitions *********************/
/*****************************************************************************/
/**
* This queries an interface to determine if it is a receiver.
*
* This queries an interface to determine if it is a receiver
* @param InstancePtr is the instance to query.
*
* @param InstancePtr the instance to query
* @return Truth value indicating receiver (TRUE) or not (FALSE).
*
* @return
* Truth value indicating receiver (TRUE) or not (FALSE)
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define IsRX(InstancePtr) (InstancePtr->Common.CfgPtr->IsRx)
#define IsRX(InstancePtr) ((InstancePtr)->Common.CfgPtr->IsRx)
/*****************************************************************************/
/**
* This queries an interface to determine if it is a transmitter.
*
* This queries an interface to determine if it is a transmitter
* @param InstancePtr is the instance to query.
*
* @param InstancePtr the instance to query
* @return Truth value indicating transmitter (TRUE) or not (FALSE).
*
* @return
* Truth value indicating transmitter (TRUE) or not (FALSE)
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define IsTX(InstancePtr) (!InstancePtr->Common.CfgPtr->IsRx)
#define IsTX(InstancePtr) (!(InstancePtr)->Common.CfgPtr->IsRx)
/*****************************************************************************/
/**
* This queries an interface to determine if it is Display Port (DP).
*
* This queries an interface to determine if it is Display Port (DP)
* @param InstancePtr is the instance to query.
*
* @param InstancePtr the instance to query
* @return Truth value indicating DP (TRUE) or not (FALSE).
*
* @return
* Truth value indicating DP (TRUE) or not (FALSE)
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define IsDP(InstancePtr) (!InstancePtr->Common.CfgPtr->IsHDMI)
#define IsDP(InstancePtr) (!(InstancePtr)->Common.CfgPtr->IsHDMI)
/*****************************************************************************/
/**
* This queries an interface to determine if it is HDMI.
*
* This queries an interface to determine if it is HDMI
* @param InstancePtr is the instance to query.
*
* @param InstancePtr the instance to query
* @return Truth value indicating HDMI (TRUE) or not (FALSE).
*
* @return
* Truth value indicating HDMI (TRUE) or not (FALSE)
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define IsHDMI(InstancePtr) (InstancePtr->Common.CfgPtr->IsHDMI)
#define IsHDMI(InstancePtr) ((InstancePtr)->Common.CfgPtr->IsHDMI)
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
* This function retrieves the configuration for this HDCP instance and fills
* in the InstancePtr->Config structure.
*
* This function determines the adaptor for a specified port device
*
* @param InstancePtr the device whose adaptor is to be determined
* @param CfgPtr the configuration of the instance
* @param PhyIfPtr pointer to the underlying physical interface
* @param InstancePtr is the device whose adaptor is to be determined.
* @param CfgPtr is the configuration of the instance.
* @param PhyIfPtr is pointer to the underlying physical interface.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_CfgInitialize(XHdcp1x *InstancePtr, const XHdcp1x_Config *CfgPtr,
void* PhyIfPtr)
void *PhyIfPtr)
{
int Status = XST_SUCCESS;
@ -219,16 +208,15 @@ int XHdcp1x_CfgInitialize(XHdcp1x *InstancePtr, const XHdcp1x_Config *CfgPtr,
/*****************************************************************************/
/**
* This function polls an HDCP interface.
*
* This function polls an hdcp interface
*
* @param InstancePtr the interface to poll
* @param InstancePtr is the interface to poll.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_Poll(XHdcp1x *InstancePtr)
@ -261,16 +249,15 @@ int XHdcp1x_Poll(XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
* This function resets an HDCP interface.
*
* This function resets an hdcp interface
*
* @param InstancePtr the interface to reset
* @param InstancePtr is the interface to reset.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_Reset(XHdcp1x *InstancePtr)
@ -303,16 +290,15 @@ int XHdcp1x_Reset(XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
* This function enables an HDCP interface.
*
* This function enables an hdcp interface
*
* @param InstancePtr the interface to enable
* @param InstancePtr is the interface to enable.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_Enable(XHdcp1x *InstancePtr)
@ -345,16 +331,15 @@ int XHdcp1x_Enable(XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
* This function disables an HDCP interface.
*
* This function disables an hdcp interface
*
* @param InstancePtr the interface to disable
* @param InstancePtr is the interface to disable.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_Disable(XHdcp1x *InstancePtr)
@ -387,17 +372,16 @@ int XHdcp1x_Disable(XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
* This function updates the state of the underlying physical interface.
*
* This function updates the state of the underlying physical interface
*
* @param InstancePtr the interface to update
* @param IsUp truth value indicating the underlying physical interface state
* @param InstancePtr is the interface to update.
* @param IsUp indicates the state of the underlying physical interface.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_SetPhysicalState(XHdcp1x *InstancePtr, int IsUp)
@ -430,17 +414,16 @@ int XHdcp1x_SetPhysicalState(XHdcp1x *InstancePtr, int IsUp)
/*****************************************************************************/
/**
*
* This function sets the lane count of a hdcp interface
*
* @param InstancePtr the interface to update
* @param LaneCount the lane count
* @param InstancePtr is the interface to update.
* @param LaneCount is the lane count.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_SetLaneCount(XHdcp1x *InstancePtr, int LaneCount)
@ -473,16 +456,15 @@ int XHdcp1x_SetLaneCount(XHdcp1x *InstancePtr, int LaneCount)
/*****************************************************************************/
/**
* This function initiates authentication of an HDCP interface.
*
* This function initiates authentication of an hdcp interface
*
* @param InstancePtr the interface to initiate authentication on
* @param InstancePtr is the interface to initiate authentication on.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_Authenticate(XHdcp1x *InstancePtr)
@ -515,17 +497,15 @@ int XHdcp1x_Authenticate(XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
*
* This function queries an interface to determine if authentication is in
* progress
* progress.
*
* @param InstancePtr the interface to query
* @param InstancePtr is the interface to query.
*
* @return
* Truth value indicating authentication in progress (TRUE) or not (FALSE)
* @return Truth value indicating authentication in progress (TRUE) or not
* (FALSE).
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_IsInProgress(const XHdcp1x *InstancePtr)
@ -547,17 +527,14 @@ int XHdcp1x_IsInProgress(const XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
*
* This function queries an interface to determine if it has successfully
* completed authentication
* completed authentication.
*
* @param InstancePtr the interface to query
* @param InstancePtr is the interface to query.
*
* @return
* Truth value indicating authenticated (TRUE) or not (FALSE)
* @return Truth value indicating authenticated (TRUE) or not (FALSE).
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_IsAuthenticated(const XHdcp1x *InstancePtr)
@ -590,17 +567,14 @@ int XHdcp1x_IsAuthenticated(const XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
*
* This function retrieves the current encryption map of the video streams
* traversing an hdcp interface
* traversing an hdcp interface.
*
* @param InstancePtr the interface to query
* @param InstancePtr is the interface to query.
*
* @return
* The current encryption map
* @return The current encryption map.
*
* @note
* None.
* @note None.
*
******************************************************************************/
u64 XHdcp1x_GetEncryption(const XHdcp1x *InstancePtr)
@ -633,18 +607,16 @@ u64 XHdcp1x_GetEncryption(const XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
* This function enables encryption on a series of streams within an HDCP
* interface.
*
* This function enables encryption on a series of streams within an hdcp
* interface
* @param InstancePtr is the interface to configure.
* @param Map is the stream map to enable encryption on.
*
* @param InstancePtr the interface to configure
* @param Map the stream map to enable encryption on
* @return XST_SUCCESS if successful.
* XST_FAILURE otherwise.
*
* @return
* XST_SUCCESS if successful
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_EnableEncryption(XHdcp1x *InstancePtr, u64 Map)
@ -666,18 +638,17 @@ int XHdcp1x_EnableEncryption(XHdcp1x *InstancePtr, u64 Map)
/*****************************************************************************/
/**
* This function disables encryption on a series of streams within an HDCP
* interface.
*
* This function disables encryption on a series of streams within an hdcp
* interface
*
* @param InstancePtr the interface to configure
* @param Map the stream map to disable encryption on
* @param InstancePtr is the interface to configure.
* @param Map is the stream map to disable encryption on.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_DisableEncryption(XHdcp1x *InstancePtr, u64 Map)
@ -699,18 +670,17 @@ int XHdcp1x_DisableEncryption(XHdcp1x *InstancePtr, u64 Map)
/*****************************************************************************/
/**
* This function sets the key selection vector that is to be used by the HDCP
* cipher.
*
* This function sets the key selection vector that is to be used by the hdcp
* cipher
*
* @param InstancePtr the interface to configure
* @param KeySelect the key selection vector
* @param InstancePtr is the interface to configure.
* @param KeySelect is the key selection vector.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_SetKeySelect(XHdcp1x *InstancePtr, u8 KeySelect)
@ -749,16 +719,13 @@ int XHdcp1x_SetKeySelect(XHdcp1x *InstancePtr, u8 KeySelect)
/*****************************************************************************/
/**
* This function handles a timeout on an HDCP interface.
*
* This function handles a timeout on an hdcp interface
* @param InstancePtr is the interface.
*
* @param InstancePtr the interface
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_HandleTimeout(void *InstancePtr)
@ -774,141 +741,112 @@ void XHdcp1x_HandleTimeout(void *InstancePtr)
XHdcp1x_TxHandleTimeout(&(HdcpPtr->Tx));
}
#endif
return;
}
/*****************************************************************************/
/**
* This function sets the debug printf function for the module.
*
* This function sets the debug printf function for the module
* @param PrintfFunc is the printf function.
*
* @param PrintfFunc the printf function
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_SetDebugPrintf(XHdcp1x_Printf PrintfFunc)
{
XHdcp1xDebugPrintf = PrintfFunc;
return;
}
/*****************************************************************************/
/**
* This function sets the debug log message function for the module.
*
* This function sets the debug log message function for the module
* @param LogFunc is the debug logging function.
*
* @param LogFunc the debug logging function
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_SetDebugLogMsg(XHdcp1x_LogMsg LogFunc)
{
XHdcp1xDebugLogMsg = LogFunc;
return;
}
/*****************************************************************************/
/**
* This function sets the KSV revocation list check function for the module.
*
* This function sets the KSV revocation list check function for the module
* @param RevokeCheckFunc is the KSV revocation list check function.
*
* @param RevokeCheckFunc the KSV revocation list check function
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_SetKsvRevokeCheck(XHdcp1x_KsvRevokeCheck RevokeCheckFunc)
{
XHdcp1xKsvRevokeCheck = RevokeCheckFunc;
return;
}
/*****************************************************************************/
/**
* This function sets timer start function for the module.
*
* This function sets timer start function for the module
* @param TimerStartFunc is the timer start function.
*
* @param TimerStartFunc the timer start function
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_SetTimerStart(XHdcp1x_TimerStart TimerStartFunc)
{
XHdcp1xTimerStart = TimerStartFunc;
return;
}
/*****************************************************************************/
/**
* This function sets timer stop function for the module.
*
* This function sets timer stop function for the module
* @param TimerStopFunc is the timer stop function.
*
* @param TimerStopFunc the timer stop function
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_SetTimerStop(XHdcp1x_TimerStop TimerStopFunc)
{
XHdcp1xTimerStop = TimerStopFunc;
return;
}
/*****************************************************************************/
/**
* This function sets timer busy delay function for the module.
*
* This function sets timer busy delay function for the module
* @param TimerDelayFunc is the timer busy delay function.
*
* @param TimerDelayFunc the timer busy delay function
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_SetTimerDelay(XHdcp1x_TimerDelay TimerDelayFunc)
{
XHdcp1xTimerDelay = TimerDelayFunc;
return;
}
/*****************************************************************************/
/**
* This function retrieves the version of the HDCP driver software.
*
* This function retrieves the version of the hdcp driver software
* @return The software driver version.
*
* @return
* The software driver version
*
* @note
* None.
* @note None.
*
******************************************************************************/
u32 XHdcp1x_GetDriverVersion(void)
@ -918,16 +856,13 @@ u32 XHdcp1x_GetDriverVersion(void)
/*****************************************************************************/
/**
* This function retrieves the cipher version of an HDCP interface.
*
* This function retrieves the cipher version of an hdcp interface
* @param InstancePtr is the interface to query.
*
* @param InstancePtr the interface to query
* @return The cipher version used by the interface
*
* @return
* The cipher version used by the interface
*
* @note
* None.
* @note None.
*
******************************************************************************/
u32 XHdcp1x_GetVersion(const XHdcp1x *InstancePtr)
@ -967,15 +902,13 @@ u32 XHdcp1x_GetVersion(const XHdcp1x *InstancePtr)
/*****************************************************************************/
/**
*
* This function performs a debug display of an hdcp instance
* This function performs a debug display of an HDCP instance.
*
* @param InstancePtr the interface to display
* @param InstancePtr is the interface to display.
*
* @return
* void
* @return None.
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_Info(const XHdcp1x *InstancePtr)
@ -1000,6 +933,4 @@ void XHdcp1x_Info(const XHdcp1x *InstancePtr)
{
XHDCP_DEBUG_PRINTF("unknown interface type\r\n");
}
return;
}

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,11 +42,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
#ifndef XHDCP1X_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_H
@ -56,6 +56,7 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#include "xil_types.h"
#include "xstatus.h"
#include "xtmrctr.h"
@ -74,13 +75,13 @@ typedef void (*XHdcp1x_Callback)(void *CallbackRef);
* This typedef defines the function interface that is to be used for debug
* print statements within this driver
*/
typedef void (*XHdcp1x_Printf)(const char* fmt, ...);
typedef void (*XHdcp1x_Printf)(const char *fmt, ...);
/**
* This typedef defines the function interface that is to be used for debug
* log message statements within this driver
*/
typedef void (*XHdcp1x_LogMsg)(const char* fmt, ...);
typedef void (*XHdcp1x_LogMsg)(const char *fmt, ...);
/**
* This typedef contains configuration information for the HDCP core.
@ -90,7 +91,8 @@ typedef struct {
u32 BaseAddress; /**< The base address of the core */
u32 SysFrequency; /**< The main clock frequency of the core */
u16 IsRx; /**< Flag indicating the core direction */
u16 IsHDMI; /**< Flag indicating the core type */
u16 IsHDMI; /**< Flag indicating if the core is meant to
work with HDMI. */
} XHdcp1x_Config;
/**
@ -116,8 +118,8 @@ typedef struct {
} XHdcp1x_Cipher;
/**
* This typedef defines the statistics collected by a port instance
*/
* This typedef defines the statistics collected by a port instance
*/
typedef struct {
u32 IntCount; /**< The number of interrupts detected */
} XHdcp1x_PortStats;
@ -142,8 +144,8 @@ typedef struct XHdcp1x_PortStruct {
} XHdcp1x_Port;
/**
* This typedef defines the statistics collected transmit port instance
*/
* This typedef defines the statistics collected transmit port instance
*/
typedef struct {
u32 AuthFailed; /**< Num of failed authentication attempts */
u32 AuthPassed; /**< Num of passed authentication attempts */
@ -154,8 +156,8 @@ typedef struct {
} XHdcp1x_TxStats;
/**
* This typedef defines the statistics collected receive port instance
*/
* This typedef defines the statistics collected receive port instance
*/
typedef struct {
u32 AuthAttempts; /**< Num of rxd authentication requests */
u32 LinkFailures; /**< Num of link verifications that failed */
@ -163,10 +165,10 @@ typedef struct {
} 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
*/
* 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 */
@ -175,8 +177,8 @@ typedef struct {
} XHdcp1x_Common;
/**
* This typedef contains the transmit HDCP interface
*/
* This typedef contains the transmit HDCP interface
*/
typedef struct {
const XHdcp1x_Config *CfgPtr; /**< The cipher core config */
u32 IsReady; /**< The ready flag */
@ -192,8 +194,8 @@ typedef struct {
} XHdcp1x_Tx;
/**
* This typedef contains the receive HDCP interface
*/
* This typedef contains the receive HDCP interface
*/
typedef struct {
const XHdcp1x_Config *CfgPtr; /**< The cipher core config */
u32 IsReady; /**< The ready flag */
@ -207,8 +209,8 @@ typedef struct {
} XHdcp1x_Rx;
/**
* This typedef contains an instance of an HDCP interface
*/
* This typedef contains an instance of an HDCP interface
*/
typedef union {
XHdcp1x_Common Common; /**< The common interface elements */
XHdcp1x_Tx Tx; /**< The transmit interface elements */
@ -219,31 +221,31 @@ typedef union {
* This typedef defines the function interface that is to be used for checking
* a specific KSV against the platforms revocation list
*/
typedef int (*XHdcp1x_KsvRevokeCheck)(const XHdcp1x *InstancePtr, u64 Ksv);
typedef int (*XHdcp1x_KsvRevokeCheck)(const XHdcp1x *InstancePtr, u64 Ksv);
/**
* This typedef defines the function interface that is to be used for starting
* a one shot timer on behalf of an HDCP interface within the underlying
* platform
*/
typedef int (*XHdcp1x_TimerStart)(const XHdcp1x *InstancePtr, u16 TmoInMs);
typedef int (*XHdcp1x_TimerStart)(const XHdcp1x *InstancePtr, u16 TmoInMs);
/**
* This typedef defines the function interface that is to be used for stopping
* a timer on behalf of an HDCP interface
*/
typedef int (*XHdcp1x_TimerStop)(const XHdcp1x *InstancePtr);
typedef int (*XHdcp1x_TimerStop)(const XHdcp1x *InstancePtr);
/**
* This typedef defines the function interface that is to be used for
* performing a busy delay on behalf of an HDCP interface
*/
typedef int (*XHdcp1x_TimerDelay)(const XHdcp1x *InstancePtr, u16 DelayInMs);
typedef int (*XHdcp1x_TimerDelay)(const XHdcp1x *InstancePtr, u16 DelayInMs);
/***************** Macros (Inline Functions) Definitions *********************/
/************************** Function Prototypes ******************************/
XHdcp1x_Config *XHdcp1x_LookupConfig(u16 DeviceId);
int XHdcp1x_CfgInitialize(XHdcp1x *InstancePtr, const XHdcp1x_Config *CfgPtr,

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -41,10 +41,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
#ifndef XHDCP1X_CIPHER_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_CIPHER_H
@ -54,6 +55,7 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xhdcp1x_cipher_hw.h"
#include "xstatus.h"
@ -191,11 +193,11 @@ u64 XHdcp1x_CipherGetLocalKsv(const XHdcp1x_Cipher *InstancePtr);
u64 XHdcp1x_CipherGetRemoteKsv(const XHdcp1x_Cipher *InstancePtr);
int XHdcp1x_CipherSetRemoteKsv(XHdcp1x_Cipher *InstancePtr, u64 Ksv);
int XHdcp1x_CipherGetB(const XHdcp1x_Cipher *InstancePtr, u32* X, u32* Y,
u32* Z);
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_CipherGetK(const XHdcp1x_Cipher *InstancePtr, u32 *X, u32 *Y,
u32 *Z);
int XHdcp1x_CipherSetK(XHdcp1x_Cipher *InstancePtr, u32 X, u32 Y, u32 Z);
u64 XHdcp1x_CipherGetMi(const XHdcp1x_Cipher *InstancePtr);
@ -207,10 +209,8 @@ u32 XHdcp1x_CipherGetVersion(const XHdcp1x_Cipher *InstancePtr);
void XHdcp1x_CipherHandlerInterrupt(void *InstancePtr);
#ifdef __cplusplus
}
#endif
#endif /* XHDCP1X_CIPHER_H */

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -46,11 +46,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Fixed RNG cipher request value
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
******************************************************************************/
#ifndef XHDCP1X_CIPHER_HW_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_CIPHER_HW_H
@ -65,76 +65,169 @@ extern "C" {
/************************** Constant Definitions *****************************/
// HDCP Cipher register offsets
#define XHDCP1X_CIPHER_REG_VERSION (0x0000u) /**< Version register offset */
#define XHDCP1X_CIPHER_REG_TYPE (0x0004u) /**< Type register offset */
#define XHDCP1X_CIPHER_REG_SCRATCH (0x0008u) /**< Scratch pad register offset */
#define XHDCP1X_CIPHER_REG_CONTROL (0x000Cu) /**< Control register offset */
#define XHDCP1X_CIPHER_REG_STATUS (0x0010u) /**< Status register offset */
#define XHDCP1X_CIPHER_REG_INTERRUPT_MASK (0x0014u) /**< Interrupt Mask register offset */
#define XHDCP1X_CIPHER_REG_INTERRUPT_STATUS (0x0018u) /**< Interrupt Status register offset */
#define XHDCP1X_CIPHER_REG_ENCRYPT_ENABLE_H (0x0020u) /**< Encryption Enable (High) register offset */
#define XHDCP1X_CIPHER_REG_ENCRYPT_ENABLE_L (0x0024u) /**< Encryption Enable (Low) register offset */
#define XHDCP1X_CIPHER_REG_VERSION (0x0000u) /**< Version register
offset */
#define XHDCP1X_CIPHER_REG_TYPE (0x0004u) /**< Type register offset */
#define XHDCP1X_CIPHER_REG_SCRATCH (0x0008u) /**< Scratch pad register
offset */
#define XHDCP1X_CIPHER_REG_CONTROL (0x000Cu) /**< Control register
offset */
#define XHDCP1X_CIPHER_REG_STATUS (0x0010u) /**< Status register
offset */
#define XHDCP1X_CIPHER_REG_INTERRUPT_MASK (0x0014u) /**< Interrupt Mask
register offset */
#define XHDCP1X_CIPHER_REG_INTERRUPT_STATUS \
(0x0018u) /**< Interrupt Status
register offset */
#define XHDCP1X_CIPHER_REG_ENCRYPT_ENABLE_H \
(0x0020u) /**< Encryption Enable (High)
register offset */
#define XHDCP1X_CIPHER_REG_ENCRYPT_ENABLE_L \
(0x0024u) /**< Encryption Enable (Low)
register offset */
#define XHDCP1X_CIPHER_REG_KEYMGMT_CONTROL (0x002Cu) /**< Key Management Control register offset */
#define XHDCP1X_CIPHER_REG_KEYMGMT_STATUS (0x0030u) /**< Key Management Status register offset */
#define XHDCP1X_CIPHER_REG_KSV_LOCAL_H (0x0038u) /**< Local KSV (High) register offset */
#define XHDCP1X_CIPHER_REG_KSV_LOCAL_L (0x003Cu) /**< Local KSV (Low) register offset */
#define XHDCP1X_CIPHER_REG_KSV_REMOTE_H (0x0040u) /**< Remote KSV (High) offset */
#define XHDCP1X_CIPHER_REG_KSV_REMOTE_L (0x0044u) /**< Remote KSV (Low) register offset */
#define XHDCP1X_CIPHER_REG_Km_H (0x0048u) /**< Km (High) register offset */
#define XHDCP1X_CIPHER_REG_Km_L (0x004Cu) /**< Km (Low) register offset */
#define XHDCP1X_CIPHER_REG_KEYMGMT_CONTROL \
(0x002Cu) /**< Key Management Control
register offset */
#define XHDCP1X_CIPHER_REG_KEYMGMT_STATUS (0x0030u) /**< Key Management Status
register offset */
#define XHDCP1X_CIPHER_REG_KSV_LOCAL_H (0x0038u) /**< Local KSV (High)
register offset */
#define XHDCP1X_CIPHER_REG_KSV_LOCAL_L (0x003Cu) /**< Local KSV (Low) register
offset */
#define XHDCP1X_CIPHER_REG_KSV_REMOTE_H (0x0040u) /**< Remote KSV (High)
offset */
#define XHDCP1X_CIPHER_REG_KSV_REMOTE_L (0x0044u) /**< Remote KSV (Low)
register offset */
#define XHDCP1X_CIPHER_REG_Km_H (0x0048u) /**< Km (High) register
offset */
#define XHDCP1X_CIPHER_REG_Km_L (0x004Cu) /**< Km (Low) register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_CONTROL (0x0050u) /**< Cipher Control register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_STATUS (0x0054u) /**< Cipher Status register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Bx (0x0058u) /**< Cipher Bx register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_By (0x005Cu) /**< Cipher By register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Bz (0x0060u) /**< Cipher Bz register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Kx (0x0064u) /**< Cipher Kx register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Ky (0x0068u) /**< Cipher Ky register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Kz (0x006Cu) /**< Cipher Kz register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mi_H (0x0070u) /**< Cipher Mi (High) register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mi_L (0x0074u) /**< Cipher Mi (Low) register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Ri (0x0078u) /**< Cipher Ri register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Ro (0x007Cu) /**< Cipher Ro register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mo_H (0x0080u) /**< Cipher Mo (High) register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mo_L (0x0084u) /**< Cipher Mo (Low) register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_CONTROL \
(0x0050u) /**< Cipher Control register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_STATUS (0x0054u) /**< Cipher Status register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Bx (0x0058u) /**< Cipher Bx register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_By (0x005Cu) /**< Cipher By register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Bz (0x0060u) /**< Cipher Bz register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Kx (0x0064u) /**< Cipher Kx register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Ky (0x0068u) /**< Cipher Ky register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Kz (0x006Cu) /**< Cipher Kz register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mi_H (0x0070u) /**< Cipher Mi (High)
register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mi_L (0x0074u) /**< Cipher Mi (Low) register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Ri (0x0078u) /**< Cipher Ri register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Ro (0x007Cu) /**< Cipher Ro register
offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mo_H (0x0080u) /**< Cipher Mo (High)
register offset */
#define XHDCP1X_CIPHER_REG_CIPHER_Mo_L (0x0084u) /**< Cipher Mo (Low) register
offset */
// HDCP Cipher register bit mask definitions
#define XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL (0x03u << 0) /**< Protocol bitmask in Type register */
#define XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION (0x01u << 2) /**< Direction bitmask in Type register */
#define XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL \
(0x03u << 0) /**< Protocol bitmask in
Type register */
#define XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION \
(0x01u << 2) /**< Direction bitmask in
Type register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_ENABLE (0x01u << 0) /**< Enable bitmask in Control register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_UPDATE (0x01u << 1) /**< Update bitmask in Control register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_NUM_LANES (0x07u << 4) /**< Num Lanes bitmask in Control register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_RESET (0x01u << 31) /**< Reset bitmask in Control register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_ENABLE \
(0x01u << 0) /**< Enable bitmask in
Control register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_UPDATE \
(0x01u << 1) /**< Update bitmask in
Control register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_NUM_LANES \
(0x07u << 4) /**< Num Lanes bitmask in
Control register */
#define XHDCP1X_CIPHER_BITMASK_CONTROL_RESET \
(0x01u << 31) /**< Reset bitmask in
Control register */
#define XHDCP1X_CIPHER_BITMASK_INTERRUPT_LINK_FAIL (0x01u << 0) /**< Link Failure bitmask in Interrupt register(s) */
#define XHDCP1X_CIPHER_BITMASK_INTERRUPT_Ri_UPDATE (0x01u << 1) /**< Ri bitmask in Interrupt register(s) */
#define XHDCP1X_CIPHER_BITMASK_INTERRUPT_LINK_FAIL \
(0x01u << 0) /**< Link Failure bitmask
in Interrupt register(s) */
#define XHDCP1X_CIPHER_BITMASK_INTERRUPT_Ri_UPDATE \
(0x01u << 1) /**< Ri bitmask in
Interrupt register(s) */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_LOCAL_KSV (0x01u << 0) /**< Read Local KSV bitmask in Key Management Control register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_BEGIN_Km (0x01u << 1) /**< Being Km bitmask in Key Management Control register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_ABORT_Km (0x01u << 2) /**< Abort Km bitmask in Key Management Control register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_SET_SELECT (0x07u << 16) /**< Key Set Select bitmask in Key Management Control register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_LOCAL_KSV \
(0x01u << 0) /**< Read Local KSV
bitmask in Key Management
Control register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_BEGIN_Km \
(0x01u << 1) /**< Being Km bitmask in
Key Management Control
register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_ABORT_Km \
(0x01u << 2) /**< Abort Km bitmask in
Key Management Control
register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_CONTROL_SET_SELECT \
(0x07u << 16) /**< Key Set Select
bitmask in Key Management
Control register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_KSV_READY (0x01u << 0) /**< Local KSV ready bitmask in Key Management Status register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_Km_READY (0x01u << 1) /**< Km Value ready bitmask in Key Management Status register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_KSV_READY \
(0x01u << 0) /**< Local KSV ready
bitmask in Key Management Status
register */
#define XHDCP1X_CIPHER_BITMASK_KEYMGMT_STATUS_Km_READY \
(0x01u << 1) /**< Km Value ready
bitmask in Key Management Status
register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_CONTROL_XOR_ENABLE (0x01u << 0) /**< XOR Enable bitmask in Cipher Control register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_CONTROL_REQUEST (0x07u << 8) /**< Request bitmask in Cipher Control register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_CONTROL_XOR_ENABLE \
(0x01u << 0) /**< XOR Enable bitmask
in Cipher Control register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_CONTROL_REQUEST \
(0x07u << 8) /**< Request bitmask in
Cipher Control register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_STATUS_XOR_IN_PROG (0x01u << 0) /**< XOR In Progress bitmask in Cipher Status register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_STATUS_REQUEST_IN_PROG (0x07u << 8) /**< Request In Progress bitmask in Cipher Status register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_STATUS_XOR_IN_PROG \
(0x01u << 0) /**< XOR In Progress
bitmask in Cipher Status
register */
#define XHDCP1X_CIPHER_BITMASK_CIPHER_STATUS_REQUEST_IN_PROG \
(0x07u << 8) /**< Request In Progress
bitmask in Cipher Status
register */
// HDCP Cipher register bit value definitions
#define XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_DP (0x00u << 0) /**< DP Protocol value in Type register */
#define XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI (0x01u << 0) /**< HDMI Protocol value in Type register */
#define XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_DP \
(0x00u << 0) /**< DP Protocol value in
Type register */
#define XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI \
(0x01u << 0) /**< HDMI Protocol value
in Type register */
#define XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX (0x00u << 2) /**< RX Direction value in Type register */
#define XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_TX (0x01u << 2) /**< TX Direction value in Type register */
#define XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX \
(0x00u << 2) /**< RX Direction value
in Type register */
#define XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_TX \
(0x01u << 2) /**< TX Direction value
in Type register */
#define XHDCP1X_CIPHER_VALUE_CIPHER_CONTROL_REQUEST_BLOCK (0x01u << 8) /**< Block Request value in Cipher Control register */
#define XHDCP1X_CIPHER_VALUE_CIPHER_CONTROL_REQUEST_REKEY (0x01u << 9) /**< ReKey Request value in Cipher Control register */
#define XHDCP1X_CIPHER_VALUE_CIPHER_CONTROL_REQUEST_RNG (0x01u << 10) /**< RNG Request value in Cipher Control register */
#define XHDCP1X_CIPHER_VALUE_CIPHER_CONTROL_REQUEST_BLOCK \
(0x01u << 8) /**< Block Request value
in Cipher Control register */
#define XHDCP1X_CIPHER_VALUE_CIPHER_CONTROL_REQUEST_REKEY \
(0x01u << 9) /**< ReKey Request value
in Cipher Control register */
#define XHDCP1X_CIPHER_VALUE_CIPHER_CONTROL_REQUEST_RNG \
(0x01u << 10) /**< RNG Request value in
Cipher Control register */
/**************************** Type Definitions *******************************/

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,13 +42,14 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xhdcp1x_cipher_hw.h"
#include "xhdcp1x_hw.h"
#include "xhdcp1x_cipher.h"
#include "xil_types.h"
@ -58,17 +59,16 @@
/***************** Macros (Inline Functions) Definitions *********************/
#define RegRead(InstancePtr, Offset) \
#define RegRead(InstancePtr, Offset) \
XHdcp1x_CipherReadReg(InstancePtr->CfgPtr->BaseAddress, Offset)
#define RegWrite(InstancePtr, Offset, Value) \
#define RegWrite(InstancePtr, Offset, Value) \
XHdcp1x_CipherWriteReg(InstancePtr->CfgPtr->BaseAddress, Offset, Value)
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This function installs an asynchronous callback function for the given
* HandlerType:
*
@ -96,7 +96,6 @@
int XHdcp1x_CipherSetCallback(XHdcp1x_Cipher *InstancePtr, u32 HandlerType,
XHdcp1x_Callback CallbackFunc, void *CallbackRef)
{
/* Locals */
u32 Status = XST_SUCCESS;
/* Verify arguments. */
@ -107,43 +106,40 @@ int XHdcp1x_CipherSetCallback(XHdcp1x_Cipher *InstancePtr, u32 HandlerType,
/* Check for handler type */
switch (HandlerType) {
/* Link Failure Callback */
case (XHDCP1X_CIPHER_HANDLER_LINK_FAILURE):
InstancePtr->LinkFailCallback = CallbackFunc;
InstancePtr->LinkFailRef = CallbackRef;
InstancePtr->IsLinkFailCallbackSet = (TRUE);
break;
/* Link Failure Callback */
case (XHDCP1X_CIPHER_HANDLER_LINK_FAILURE):
InstancePtr->LinkFailCallback = CallbackFunc;
InstancePtr->LinkFailRef = CallbackRef;
InstancePtr->IsLinkFailCallbackSet = (TRUE);
break;
/* Ri Update Callback */
case (XHDCP1X_CIPHER_HANDLER_Ri_UPDATE):
InstancePtr->RiUpdateCallback = CallbackFunc;
InstancePtr->RiUpdateRef = CallbackRef;
InstancePtr->IsRiUpdateCallbackSet = (TRUE);
break;
case (XHDCP1X_CIPHER_HANDLER_Ri_UPDATE):
InstancePtr->RiUpdateCallback = CallbackFunc;
InstancePtr->RiUpdateRef = CallbackRef;
InstancePtr->IsRiUpdateCallbackSet = (TRUE);
break;
default:
Status = (XST_INVALID_PARAM);
break;
default:
Status = (XST_INVALID_PARAM);
break;
}
/* Return */
return (Status);
}
/*****************************************************************************/
/**
* This function enables/disables the reporting of link check state changes.
*
* This function enables/disables the reporting of link check state changes
*
* @param InstancePtr the cipher core instance
* @param IsEnabled enable/disable link state change notifications
* @param InstancePtr is the cipher core instance.
* @param IsEnabled enables/disables link state change notifications.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
@ -156,7 +152,6 @@ int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
/* Check DP receive */
if (XHdcp1x_CipherIsDP(InstancePtr) &&
XHdcp1x_CipherIsRX(InstancePtr)) {
u32 Val = 0;
/* Clear any pending link state failure interrupt */
@ -182,17 +177,16 @@ int XHdcp1x_CipherSetLinkStateCheck(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
/*****************************************************************************/
/**
* This function enables/disables the reporting of Ri update notifications.
*
* This function enables/disables the reporting of Ri update notifications
*
* @param InstancePtr the cipher core instance
* @param IsEnabled enable/disable Ri update notifications
* @param InstancePtr is the cipher core instance.
* @param IsEnabled enables/disables Ri update notifications.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSetRiUpdate(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
@ -204,7 +198,6 @@ int XHdcp1x_CipherSetRiUpdate(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
/* Check HDMI receive */
if (XHdcp1x_CipherIsHDMI(InstancePtr)) {
u32 Val = 0;
/* Clear any pending link state failure interrupt */
@ -230,21 +223,18 @@ int XHdcp1x_CipherSetRiUpdate(XHdcp1x_Cipher *InstancePtr, int IsEnabled)
/*****************************************************************************/
/**
* This function is the interrupt handler for the cipher core driver.
*
* This function is the interrupt handler for the cipher core driver
* @param InstancePtr is the cipher core instance.
*
* @param InstancePtr the cipher core instance
* @return None.
*
* @return
* void
*
* @note
* none
* @note None.
*
******************************************************************************/
void XHdcp1x_CipherHandleInterrupt(void *InstancePtr)
{
XHdcp1x_Cipher *HdcpCipherPtr = (XHdcp1x_Cipher *) InstancePtr;
XHdcp1x_Cipher *HdcpCipherPtr = (XHdcp1x_Cipher *)InstancePtr;
u32 Pending = 0;
/* Verify arguments */
@ -257,7 +247,6 @@ void XHdcp1x_CipherHandleInterrupt(void *InstancePtr)
/* Check for pending */
if (Pending != 0) {
/* Clear Pending */
RegWrite(HdcpCipherPtr, XHDCP1X_CIPHER_REG_INTERRUPT_STATUS,
Pending);
@ -267,7 +256,6 @@ void XHdcp1x_CipherHandleInterrupt(void *InstancePtr)
/* Check for link integrity failure */
if (Pending & XHDCP1X_CIPHER_BITMASK_INTERRUPT_LINK_FAIL) {
/* Invoke callback if set */
if (HdcpCipherPtr->IsLinkFailCallbackSet)
(*HdcpCipherPtr->LinkFailCallback)(
@ -276,13 +264,10 @@ void XHdcp1x_CipherHandleInterrupt(void *InstancePtr)
/* 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);
}
}
return;
}

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,12 +42,12 @@
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xhdcp1x_cipher.h"
#include "xil_assert.h"
@ -70,16 +70,15 @@
/*****************************************************************************/
/**
* This function self tests an hdcp cipher core.
*
* This function self tests an hdcp cipher core
*
* @param InstancePtr the cipher core to test
* @param InstancePtr is the cipher core to test.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_CipherSelfTest(XHdcp1x_Cipher *InstancePtr)
@ -98,27 +97,29 @@ int XHdcp1x_CipherSelfTest(XHdcp1x_Cipher *InstancePtr)
Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_VERSION);
/* Confirm the version is reasonable */
if ((Value != 0u) && (Value != ((u32) (-1)))) {
if ((Value != 0u) && (Value != ((u32)(-1)))) {
const XHdcp1x_Config *CfgPtr = InstancePtr->CfgPtr;
int IsRx = FALSE;
int IsHdmi = FALSE;
/* Determine isRx */
Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_TYPE);
Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_TYPE);
Value &= XHDCP1X_CIPHER_BITMASK_TYPE_DIRECTION;
if (Value == XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX)
if (Value == XHDCP1X_CIPHER_VALUE_TYPE_DIRECTION_RX) {
IsRx = TRUE;
}
/* Determine isHdmi */
Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_TYPE);
Value = XHdcp1x_CipherReadReg(Base, XHDCP1X_CIPHER_REG_TYPE);
Value &= XHDCP1X_CIPHER_BITMASK_TYPE_PROTOCOL;
if (Value == XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI)
if (Value == XHDCP1X_CIPHER_VALUE_TYPE_PROTOCOL_HDMI) {
IsHdmi = TRUE;
}
/* Confirm direction and protocol match */
if (((IsRx == CfgPtr->IsRx)) && ((IsHdmi == CfgPtr->IsHDMI)))
if (((IsRx == CfgPtr->IsRx)) && ((IsHdmi == CfgPtr->IsHDMI))) {
Status = XST_SUCCESS;
}
}
return (Status);

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -41,10 +41,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
#ifndef XHDCP1X_DEBUG_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_DEBUG_H
@ -54,25 +55,27 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
/************************** Constant Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
#define XHDCP1X_DEBUG_PRINTF if (XHdcp1xDebugPrintf != NULL) XHdcp1xDebugPrintf
#define XHDCP1X_DEBUG_LOGMSG if (XHdcp1xDebugLogMsg != NULL) XHdcp1xDebugLogMsg
#define XHDCP1X_DEBUG_PRINTF if (XHdcp1xDebugPrintf != NULL) XHdcp1xDebugPrintf
#define XHDCP1X_DEBUG_LOGMSG if (XHdcp1xDebugLogMsg != NULL) XHdcp1xDebugLogMsg
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
/************************* External Declarations******************************/
extern XHdcp1x_Printf XHdcp1xDebugPrintf;
extern XHdcp1x_LogMsg XHdcp1xDebugLogMsg;
/************************* External Declarations *****************************/
extern XHdcp1x_Printf XHdcp1xDebugPrintf;
extern XHdcp1x_LogMsg XHdcp1xDebugLogMsg;
#ifdef __cplusplus
}
#endif
#endif /* XHDCP1X_DEBUG_H */

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,12 +42,13 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xhdcp1x_cipher.h"
#include "xil_types.h"
@ -62,22 +63,19 @@
/*****************************************************************************/
/**
* This function is the cipher interrupt handler for the HDCP module.
*
* This function is the cipher interrupt handler for the HDCP module
* @param InstancePtr is the device instance that just interrupted.
*
* @param InstancePtr the device instance that just interrupted
* @return None.
*
* @return
* void
*
* @note
* This function just forwards the interrupt along to the corresponding
* cipher core.
* @note This function just forwards the interrupt along to the
* corresponding cipher core.
*
******************************************************************************/
void XHdcp1x_CipherIntrHandler(void *InstancePtr)
{
XHdcp1x* HdcpPtr = InstancePtr;
XHdcp1x *HdcpPtr = InstancePtr;
/* Verify arguments */
Xil_AssertVoid(HdcpPtr != NULL);
@ -89,23 +87,20 @@ void XHdcp1x_CipherIntrHandler(void *InstancePtr)
/*****************************************************************************/
/**
* This function is the port interrupt handler for the HDCP module.
*
* This function is the port interrupt handler for the HDCP module
* @param InstancePtr is the device instance that just interrupted.
* @param IntCause is the interrupt cause bit map.
*
* @param InstancePtr the device instance that just interrupted
* @param IntCause the interrupt cause bit map
* @return None.
*
* @return
* void
*
* @note
* This function just forwards the interrupt along to the corresponding
* cipher core.
* @note This function just forwards the interrupt along to the
* corresponding cipher core.
*
******************************************************************************/
void XHdcp1x_PortIntrHandler(void *InstancePtr, u32 IntCause)
{
XHdcp1x* HdcpPtr = InstancePtr;
XHdcp1x *HdcpPtr = InstancePtr;
/* Verify arguments */
Xil_AssertVoid(HdcpPtr != NULL);

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,12 +42,13 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xhdcp1x_platform.h"
#include "xil_types.h"
@ -59,26 +60,24 @@
/**************************** Type Definitions *******************************/
/************************** Extern Declarations ******************************/
extern XHdcp1x_KsvRevokeCheck XHdcp1xKsvRevokeCheck;
extern XHdcp1x_TimerStart XHdcp1xTimerStart;
extern XHdcp1x_TimerStop XHdcp1xTimerStop;
extern XHdcp1x_TimerDelay XHdcp1xTimerDelay;
extern XHdcp1x_KsvRevokeCheck XHdcp1xKsvRevokeCheck;
extern XHdcp1x_TimerStart XHdcp1xTimerStart;
extern XHdcp1x_TimerStop XHdcp1xTimerStop;
extern XHdcp1x_TimerDelay XHdcp1xTimerDelay;
/************************** Function Prototypes ******************************/
/*****************************************************************************/
/**
* This function checks a KSV value to determine if it has been revoked or not.
*
* This function checks a KSV value to determine if it has been revoked or not
* @param InstancePtr is the HDCP interface.
* @param Ksv is the KSV to check.
*
* @param InstancePtr the hdcp interface
* @param Ksv the KSV to check
* @return Truth value indicating the KSV is revoked (TRUE) or not (FALSE).
*
* @return
* Truth value indicating the KSV is revoked (TRUE) or not (FALSE)
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PlatformIsKsvRevoked(const XHdcp1x *InstancePtr, u64 Ksv)
@ -98,17 +97,16 @@ int XHdcp1x_PlatformIsKsvRevoked(const XHdcp1x *InstancePtr, u64 Ksv)
/*****************************************************************************/
/**
* This function starts a timer on behalf of an HDCP interface.
*
* This function starts a timer on behalf of an hdcp interface
*
* @param InstancePtr the hdcp interface
* @param TimeoutInMs the duration of the timer in milliseconds
* @param InstancePtr is the hdcp interface.
* @param TimeoutInMs is the duration of the timer in milliseconds.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PlatformTimerStart(XHdcp1x *InstancePtr, u16 TimeoutInMs)
@ -126,19 +124,17 @@ int XHdcp1x_PlatformTimerStart(XHdcp1x *InstancePtr, u16 TimeoutInMs)
return (Status);
}
/*****************************************************************************/
/**
* This function stop a timer on behalf of an HDCP interface.
*
* This function stop a timer on behalf of an hdcp interface
*
* @param InstancePtr the hdcp interface
* @param InstancePtr is the HDCP interface.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PlatformTimerStop(XHdcp1x *InstancePtr)
@ -156,20 +152,18 @@ int XHdcp1x_PlatformTimerStop(XHdcp1x *InstancePtr)
return (Status);
}
/*****************************************************************************/
/**
* This function busy waits on a timer for a number of milliseconds.
*
* This function busy waits on a timer for a number of milliseconds
*
* @param InstancePtr the hdcp interface
* @param DelayInMs the delay time in milliseconds
* @param InstancePtr is the hdcp interface.
* @param DelayInMs is the delay time in milliseconds.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PlatformTimerBusy(XHdcp1x *InstancePtr, u16 DelayInMs)

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -41,10 +41,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
#ifndef XHDCP1X_PLATFORM_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_PLATFORM_H
@ -54,6 +55,7 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xil_types.h"
@ -64,6 +66,7 @@ extern "C" {
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
int XHdcp1x_PlatformIsKsvRevoked(const XHdcp1x *InstancePtr, u64 Ksv);
int XHdcp1x_PlatformTimerStart(XHdcp1x *InstancePtr, u16 TimeoutInMs);
@ -74,5 +77,4 @@ int XHdcp1x_PlatformTimerBusy(XHdcp1x *InstancePtr, u16 DelayInMs);
}
#endif
#endif /* XHDCP1X_PLATFORM_H */

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -28,7 +28,7 @@
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
*****************************************************************************/
******************************************************************************/
/*****************************************************************************/
/**
*
@ -41,13 +41,13 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
*****************************************************************************/
/***************************** Include Files *********************************/
#include <stdlib.h>
#include <string.h>
#include "xhdcp1x_port.h"
@ -56,6 +56,7 @@
#include "xparameters.h"
/************************** Constant Definitions *****************************/
#if defined(XPAR_XHDMI_TX_NUM_INSTANCES) && (XPAR_XHDMI_TX_NUM_INSTANCES > 0)
#define INCLUDE_HDMI_TX
#endif
@ -86,20 +87,315 @@ extern const XHdcp1x_PortPhyIfAdaptor XHdcp1x_PortDpTxAdaptor;
extern const XHdcp1x_PortPhyIfAdaptor XHdcp1x_PortDpRxAdaptor;
#endif
/*************************** Function Prototypes *****************************/
static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(
const XHdcp1x_Port *InstancePtr);
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
* This function initializes a port device.
*
* This function determines the adaptor for a specified port device
*
* @param InstancePtr the device whose adaptor is to be determined
* @param InstancePtr is the device to initialize.
* @param CfgPtr is the HDCP configuration structure.
* @param PhyIfPtr is pointer to the underlying physical interface.
*
* @return
* Pointer to the adaptor table. NULL if not found.
* - XST_SUCCESS if successful.
* - XST_NO_FEATURE if the port lacks an Init function.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortCfgInitialize(XHdcp1x_Port *InstancePtr,
const XHdcp1x_Config *CfgPtr, void *PhyIfPtr)
{
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(CfgPtr != NULL);
Xil_AssertNonvoid(PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady != XIL_COMPONENT_IS_READY);
/* Initialize InstancePtr */
memset(InstancePtr, 0, sizeof(XHdcp1x_Port));
InstancePtr->CfgPtr = CfgPtr;
InstancePtr->PhyIfPtr = PhyIfPtr;
InstancePtr->Adaptor = DetermineAdaptor(InstancePtr);
/* Sanity Check */
if (InstancePtr->Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (InstancePtr->Adaptor->Init != NULL) {
Status = (*(InstancePtr->Adaptor->Init))(InstancePtr);
}
/* Set IsReady */
if (Status == XST_SUCCESS) {
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
}
return (Status);
}
/*****************************************************************************/
/**
* This function enables a port device.
*
* @param InstancePtr is the device to enables.
*
* @return
* - XST_SUCCESS if successful.
* - XST_NO_FEATURE if the port lacks an Enable function.
*
* @note None.
*
******************************************************************************/
int XHdcp1x_PortEnable(XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (Adaptor->Enable != NULL) {
Status = (*(Adaptor->Enable))(InstancePtr);
}
return (Status);
}
/*****************************************************************************/
/**
* This function disables a port device.
*
* @param InstancePtr is the device to disables.
*
* @return
* - XST_SUCCESS if successful.
* - XST_NO_FEATURE if the port lacks a Disable function.
*
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDisable(XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (Adaptor->Disable != NULL) {
Status = (*(Adaptor->Disable))(InstancePtr);
}
return (Status);
}
/*****************************************************************************/
/**
* This function queries a port device to determine if hdcp is supported.
*
* @param InstancePtr is the device to query.
*
* @return Truth value.
*
* @note None.
*
******************************************************************************/
int XHdcp1x_PortIsCapable(const XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int IsCapable = FALSE;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->IsCapable != NULL)) {
IsCapable = (*(Adaptor->IsCapable))(InstancePtr);
}
return (IsCapable);
}
/*****************************************************************************/
/**
* This function queries a port device to determine if it is connected to a
* repeater.
*
* @param InstancePtr is the device to query.
*
* @return Truth value.
*
* @note None.
*
******************************************************************************/
int XHdcp1x_PortIsRepeater(const XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int IsRepeater = FALSE;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->IsRepeater != NULL)) {
IsRepeater = (*(Adaptor->IsRepeater))(InstancePtr);
}
return (IsRepeater);
}
/*****************************************************************************/
/**
* This function retrieves the repeater information from the connected device.
*
* @param InstancePtr is the device to query.
* @param InfoPtr is the repeater info.
*
* @return
* - XST_SUCCESS if successful.
* - XST_NO_FEATURE if the port lacks a GetRepeaterInfo function.
*
* @note None.
*
******************************************************************************/
int XHdcp1x_PortGetRepeaterInfo(XHdcp1x_Port *InstancePtr, u16 *InfoPtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InfoPtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (Adaptor->GetRepeaterInfo != NULL) {
Status = (*(Adaptor->GetRepeaterInfo))(InstancePtr, InfoPtr);
}
return (Status);
}
/*****************************************************************************/
/**
* This function reads a register from a HDCP port device.
*
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy the data read.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes read.
*
* @note None.
*
******************************************************************************/
int XHdcp1x_PortRead(const XHdcp1x_Port *InstancePtr, u8 Offset, void *Buf,
u32 BufSize)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int NumRead = 0;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(Buf != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->Read != NULL)) {
NumRead = (*(Adaptor->Read))(InstancePtr, Offset, Buf,
BufSize);
}
return (NumRead);
}
/*****************************************************************************/
/**
* This function writes a register within a HDCP port device.
*
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing at.
* @param Buf is the buffer containing the data to write.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes written.
*
* @note None.
*
******************************************************************************/
int XHdcp1x_PortWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const void *Buf,
u32 BufSize)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int NumWritten = 0;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(Buf != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->Write != NULL)) {
NumWritten = (*(Adaptor->Write))(InstancePtr, Offset, Buf,
BufSize);
}
return (NumWritten);
}
/*****************************************************************************/
/**
*
* This function determines the adaptor for a specified port device.
*
* @param InstancePtr is the device whose adaptor is to be determined.
*
* @return A pointer to the adaptor table. NULL if not found.
*
* @note None.
*
******************************************************************************/
static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(
@ -142,312 +438,3 @@ static const XHdcp1x_PortPhyIfAdaptor *DetermineAdaptor(
return (Adaptor);
}
/*****************************************************************************/
/**
*
* This function initializes a port device
*
* @param InstancePtr the device to initialize
* @param CfgPtr the hdcp configuration structure
* @param PhyIfPtr pointer to the underlying physical interface
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortCfgInitialize(XHdcp1x_Port *InstancePtr,
const XHdcp1x_Config *CfgPtr, void* PhyIfPtr)
{
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(CfgPtr != NULL);
Xil_AssertNonvoid(PhyIfPtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady != XIL_COMPONENT_IS_READY);
/* Initialize InstancePtr */
memset(InstancePtr, 0, sizeof(XHdcp1x_Port));
InstancePtr->CfgPtr = CfgPtr;
InstancePtr->PhyIfPtr = PhyIfPtr;
InstancePtr->Adaptor = DetermineAdaptor(InstancePtr);
/* Sanity Check */
if (InstancePtr->Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (InstancePtr->Adaptor->Init != NULL) {
Status = (*(InstancePtr->Adaptor->Init))(InstancePtr);
}
/* Set IsReady */
if (Status == XST_SUCCESS) {
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
}
return (Status);
}
/*****************************************************************************/
/**
*
* This function enables a port device
*
* @param InstancePtr the device to enables
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortEnable(XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (Adaptor->Enable != NULL) {
Status = (*(Adaptor->Enable))(InstancePtr);
}
return (Status);
}
/*****************************************************************************/
/**
*
* This function disables a port device
*
* @param InstancePtr the device to disables
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortDisable(XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (Adaptor->Disable != NULL) {
Status = (*(Adaptor->Disable))(InstancePtr);
}
return (Status);
}
/*****************************************************************************/
/**
*
* This function queries a port device to determine if hdcp is supported
*
* @param InstancePtr the device to query
*
* @return
* Truth value
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortIsCapable(const XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int IsCapable = FALSE;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->IsCapable != NULL)) {
IsCapable = (*(Adaptor->IsCapable))(InstancePtr);
}
return (IsCapable);
}
/*****************************************************************************/
/**
*
* This function queries a port device to determine if it is connected to a
* repeater.
*
* @param InstancePtr the device to query
*
* @return
* Truth value
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortIsRepeater(const XHdcp1x_Port *InstancePtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int IsRepeater = FALSE;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->IsRepeater != NULL)) {
IsRepeater = (*(Adaptor->IsRepeater))(InstancePtr);
}
return (IsRepeater);
}
/*****************************************************************************/
/**
*
* This function retrieves the repeater information from the connected device
*
* @param InstancePtr the device to query
* @param InfoPtr the repeater info
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortGetRepeaterInfo(XHdcp1x_Port *InstancePtr, u16 *InfoPtr)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int Status = XST_SUCCESS;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InfoPtr != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Sanity Check */
if (Adaptor == NULL) {
Status = XST_NO_FEATURE;
}
/* Invoke adaptor function if present */
else if (Adaptor->GetRepeaterInfo != NULL) {
Status = (*(Adaptor->GetRepeaterInfo))(InstancePtr, InfoPtr);
}
return (Status);
}
/*****************************************************************************/
/**
*
* This function reads a register from a hdcp port device
*
* @param InstancePtr the device to read from
* @param Offset the offset to start reading from
* @param Buf the buffer to copy the data read
* @param BufSize the size of the buffer
*
* @return
* The number of bytes read
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortRead(const XHdcp1x_Port *InstancePtr, u8 Offset, void *Buf,
u32 BufSize)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int NumRead = 0;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(Buf != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->Read != NULL)) {
NumRead = (*(Adaptor->Read))(InstancePtr, Offset, Buf,
BufSize);
}
/* Return */
return (NumRead);
}
/*****************************************************************************/
/**
*
* This function writes a register within a hdcp port device
*
* @param InstancePtr the device to write to
* @param Offset the offset to start writing at
* @param Buf the buffer containing the data to write
* @param BufSize the size of the buffer
*
* @return
* The number of bytes written
*
* @note
* None.
*
******************************************************************************/
int XHdcp1x_PortWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const void *Buf,
u32 BufSize)
{
const XHdcp1x_PortPhyIfAdaptor *Adaptor = NULL;
int NumWritten = 0;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(Buf != NULL);
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Invoke adaptor function if present */
if ((Adaptor != NULL) && (Adaptor->Write != NULL)) {
NumWritten = (*(Adaptor->Write))(InstancePtr, Offset, Buf,
BufSize);
}
return (NumWritten);
}

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,11 +42,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
#ifndef XHDCP1X_PORT_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_PORT_H
@ -56,6 +56,7 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xparameters.h"
#include "xstatus.h"
@ -86,7 +87,8 @@ typedef struct XHdcp1x_PortPhyIfAdaptorS {
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 info */
int (*GetRepeaterInfo)(const XHdcp1x_Port*, u16*); /**< Gets repeater
info */
void (*IntrHandler)(XHdcp1x_Port *, u32); /**< Interrupt handler */
} XHdcp1x_PortPhyIfAdaptor;
@ -94,25 +96,23 @@ typedef struct XHdcp1x_PortPhyIfAdaptorS {
/*****************************************************************************/
/**
*
* This macro converts from an unsigned integer to a little endian formatted
* buffer
*
* @param buf the buffer to write to
* @param uint the unsigned integer to convert
* @param numbits the number of bits within the unsigned integer to use
* @param buf the buffer to write to
* @param uint the unsigned integer to convert
* @param numbits the number of bits within the unsigned integer to use
*
* @return
* void
* @return None.
*
* @note
* The value of the "uint" parameter is destroyed by a call to this macro
* @note The value of the "uint" parameter is destroyed by a call to this
* macro
*
******************************************************************************/
#define XHDCP1X_PORT_UINT_TO_BUF(buf, uint, numbits) \
if ((numbits) > 0) { \
int byte; \
for (byte=0; byte<=(((numbits)-1)>>3); byte++) { \
for (byte = 0; byte <= (((numbits) - 1) >> 3); byte++) { \
buf[byte] = (uint8_t) (uint & 0xFFu); \
uint >>= 8; \
} \
@ -120,26 +120,23 @@ typedef struct XHdcp1x_PortPhyIfAdaptorS {
/*****************************************************************************/
/**
*
* This macro converts from a little endian formatted buffer to an unsigned
* integer value
*
* @param uint the unsigned integer to write
* @param buf the buffer to convert
* @param numbits the number of bits within the buffer to use
* @param uint the unsigned integer to write
* @param buf the buffer to convert
* @param numbits the number of bits within the buffer to use
*
* @return
* void
* @return None.
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define XHDCP1X_PORT_BUF_TO_UINT(uint, buf, numbits) \
if ((numbits) > 0) { \
int byte; \
uint = 0; \
for (byte=(((numbits)-1)>>3); byte>=0; byte--) { \
for (byte = (((numbits) - 1) >> 3); byte >= 0; byte--) { \
uint <<= 8; \
uint |= buf[byte]; \
} \
@ -147,64 +144,55 @@ typedef struct XHdcp1x_PortPhyIfAdaptorS {
/*****************************************************************************/
/**
*
* This macro sets a bit within a little endian formatted buffer
*
* @param buf the buffer to write to
* @param bitnum the bit to set
* @param buf the buffer to write to
* @param bitnum the bit to set
*
* @return
* void
* @return None.
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define XHDCP1X_PORT_BSET_IN_BUF(buf, bitnum) \
buf[(bitnum)>>3] |= (1u << ((bitnum) & 0x07u));
buf[(bitnum) >> 3] |= (1u << ((bitnum) & 0x07u));
/*****************************************************************************/
/**
*
* This macro clears a bit within a little endian formatted buffer
*
* @param buf the buffer to write to
* @param bitnum the bit to clear
* @param buf the buffer to write to
* @param bitnum the bit to clear
*
* @return
* void
* @return None.
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define XHDCP1X_PORT_BCLR_IN_BUF(buf, bitnum) \
buf[(bitnum)>>3] &= ~(1u << ((bitnum) & 0x07u));
buf[(bitnum) >> 3] &= ~(1u << ((bitnum) & 0x07u));
/*****************************************************************************/
/**
*
* This macro tests a bit within a little endian formatted buffer
*
* @param buf the buffer containing the bit to test
* @param bitnum the bit to test
* @param buf the buffer containing the bit to test
* @param bitnum the bit to test
*
* @return
* void
* @return None.
*
* @note
* None.
* @note None.
*
******************************************************************************/
#define XHDCP1X_PORT_BTST_IN_BUF(buf, bitnum) \
(buf[(bitnum)>>3] & (1u << ((bitnum) & 0x07u)))
(buf[(bitnum) >> 3] & (1u << ((bitnum) & 0x07u)))
/************************** Function Prototypes ******************************/
int XHdcp1x_PortCfgInitialize(XHdcp1x_Port *InstancePtr,
const XHdcp1x_Config* ConfigPtr, void *PhyIfPtr);
const XHdcp1x_Config *ConfigPtr, void *PhyIfPtr);
int XHdcp1x_PortSetCallback(XHdcp1x_Port* InstancePtr, u32 HandlerType,
int XHdcp1x_PortSetCallback(XHdcp1x_Port *InstancePtr, u32 HandlerType,
XHdcp1x_Callback Callback, void *Parameter);
int XHdcp1x_PortEnable(XHdcp1x_Port *InstancePtr);

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,7 +42,7 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
@ -56,6 +56,7 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#if defined(XHDCP1X_PORT_HDMI_H)
#error "cannot include both xhdcp1x_port_dp.h and xhdcp1x_port_hdmi.h"
#endif
@ -122,7 +123,6 @@ extern "C" {
*/
#define XHDCP1X_PORT_DPCD_BASE (0x68000u) /**< Base Addr in DPCD */
/**************************** Type Definitions *******************************/
/***************** Macros (Inline Functions) Definitions *********************/

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -29,7 +29,6 @@
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
/*****************************************************************************/
/**
*
@ -43,14 +42,14 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xparameters.h"
#if defined(XPAR_XDP_NUM_INSTANCES) && (XPAR_XDP_NUM_INSTANCES > 0)
#include <stdlib.h>
#include <string.h>
@ -67,348 +66,34 @@
/***************** Macros (Inline Functions) Definitions *********************/
/*************************** 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,
u32 BufSize);
static void NotifyTx(const XHdcp1x_Port *InstancePtr);
static void ProcessAKsvWrite(void *CallbackRef);
static void ProcessRoRead(void *CallbackRef);
static void ProcessBinfoRead(void *CallbackRef);
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
* This function enables a HDCP port device.
*
* This reads a register from the hdcp port device
*
* @param InstancePtr device to read from
* @param Offset offset to start reading from
* @param Buf buffer to copy data read
* @param BufSize size of buffer
* @param InstancePtr is the device to enable.
*
* @return
* number of bytes read
* - XST_SUCCESS if successful.
*
* @note
* None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
XDprx* HwDp = InstancePtr->PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 RegOffset = 0;
int NumRead = 0;
/* Determine RegOffset */
RegOffset = XDP_RX_DPCD_HDCP_TABLE;
RegOffset += Offset;
/* Iterate through the reads */
do {
u32 Value = 0;
u32 Alignment = 0;
u32 NumThisTime = 0;
int Idx = 0;
/* Determine Alignment */
Alignment = (RegOffset & 0x03ul);
/* Determine NumThisTime */
NumThisTime = 4;
if (Alignment != 0) {
NumThisTime = (4 - Alignment);
}
if (NumThisTime > BufSize) {
NumThisTime = BufSize;
}
/* Determine Value */
Value = XDprx_ReadReg(Base, (RegOffset & ~0x03ul));
/* Check for adjustment of Value */
if (Alignment != 0)
Value >>= (8*Alignment);
/* Update theBuf */
for (Idx=0; Idx<NumThisTime; Idx++) {
Buf[Idx] = (u8) (Value & 0xFFul);
Value >>= 8;
}
/* Update for loop */
Buf += NumThisTime;
BufSize -= NumThisTime;
RegOffset += NumThisTime;
NumRead += NumThisTime;
}
while (BufSize > 0);
return (NumRead);
}
/*****************************************************************************/
/**
*
* This writes a register from the hdcp port device
*
* @param InstancePtr device to write to
* @param Offset offset to start writing at
* @param Buf buffer containing data to write
* @param BufSize size of buffer
*
* @return
* number of bytes written
*
* @note
* None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XDprx* HwDp = InstancePtr->PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 RegOffset = 0;
int NumWritten = 0;
/* Determine RegOffset */
RegOffset = XDP_RX_DPCD_HDCP_TABLE;
RegOffset += Offset;
/* Iterate through the writes */
do {
u32 Value = 0;
u32 Alignment = 0;
u32 NumThisTime = 0;
int Idx = 0;
/* Determine Alignment */
Alignment = (RegOffset & 0x03ul);
/* Determine NumThisTime */
NumThisTime = 4;
if (Alignment != 0) {
NumThisTime = (4 - Alignment);
}
if (NumThisTime > BufSize) {
NumThisTime = BufSize;
}
/* Check for simple case */
if (NumThisTime == 4) {
/* Determine Value */
for (Idx=3; Idx>=0; Idx--) {
Value <<= 8;
Value |= Buf[Idx];
}
}
/* Otherwise - must read and modify existing memory */
else {
u32 Mask = 0;
u32 Temp = 0;
/* Determine Mask */
Mask = 0xFFu;
if (Alignment != 0) {
Mask <<= (8*Alignment);
}
/* Initialize Value */
Value = XDprx_ReadReg(Base, (RegOffset & ~0x03ul));
/* Update theValue */
for (Idx=0; Idx<NumThisTime; Idx++) {
Temp = Buf[Idx];
Temp <<= (8*(Alignment+Idx));
Value &= ~Mask;
Value |= Temp;
Mask <<= 8;
}
}
/* Write Value */
XDprx_WriteReg(Base, (RegOffset & ~0x03ul), Value);
/* Update for loop */
Buf += NumThisTime;
BufSize -= NumThisTime;
RegOffset += NumThisTime;
NumWritten += NumThisTime;
}
while (BufSize > 0);
return (NumWritten);
}
/*****************************************************************************/
/**
*
* This function notifies the tx end of the link of an event of interest
*
* @param InstancePtr device to perform the notification
*
* @return
* void
*
* @note
* None.
*
******************************************************************************/
static void NotifyTx(const XHdcp1x_Port *InstancePtr)
{
XDprx* HwDp = InstancePtr->PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 Value = 0;
u8 Ainfo = 0;
/* Read Ainfo */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Ainfo, sizeof(Ainfo));
/* Check for regular HPD pulse notification */
if ((Ainfo & 0x01u) == 0) {
/* Send a 500us HPD pulse */
XDp_RxGenerateHpdInterrupt(HwDp, 500u);
}
/* Otherwise - must use HPD IRQ */
else {
/* #### WORK TO DO #### */
}
/* Always generate CP IRQ */
Value = XDprx_ReadReg(Base, XDP_RX_DEVICE_SERVICE_IRQ);
Value |= XDP_RX_DEVICE_SERVICE_IRQ_CP_IRQ_MASK;
XDprx_WriteReg(Base, XDP_RX_DEVICE_SERVICE_IRQ, Value);
return;
}
/*****************************************************************************/
/**
*
* This function process a write to the AKsv register from the tx device
*
* @param CallbackRef device to whose register was written
*
* @return
* void
*
* @note
* This function initiates the side effects of the tx device writing the
* Aksv register. This is currently updates some status bits as well as
* kick starts a re-authentication process.
*
******************************************************************************/
static void ProcessAKsvWrite(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
/* Clear bit 0 of Ainfo register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
Value &= 0xFEu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
/* Clear bits 3:2 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
Value &= 0xF3u;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(InstancePtr->AuthRef);
}
return;
}
/*****************************************************************************/
/**
*
* This function process a read of the Ro' register by the tx device
*
* @param CallbackRef device to whose register was read
*
* @return
* void
*
* @note
* This function initiates the side effects of the tx device read the Ro'
* register. This is currently limited to the clearing of bits within
* device's Bstatus register.
*
******************************************************************************/
static void ProcessRoRead(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
/* Clear bit 1 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
Value &= 0xFDu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
return;
}
/*****************************************************************************/
/**
*
* This function process a read of the Binfo register by the tx device
*
* @param CallbackRef device to whose register was read
*
* @return
* void
*
* @note
* This function initiates the side effects of the tx device read the Binfo
* register. This is currently limited to the clearing of bits within
* device's Bstatus register.
*
******************************************************************************/
static void ProcessBinfoRead(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
/* Clear bit 0 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
Value &= 0xFEu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
return;
}
/*****************************************************************************/
/**
*
* This function enables a hdcp port device
*
* @param InstancePtr device to enable
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxEnable(XHdcp1x_Port *InstancePtr)
{
XDprx* HwDp = InstancePtr->PhyIfPtr;
XDprx *HwDp = InstancePtr->PhyIfPtr;
u32 IntMask = 0;
u8 Buf[4];
int Status = XST_SUCCESS;
@ -456,21 +141,19 @@ int XHdcp1x_PortDpRxEnable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function disables a HDCP port device.
*
* This function disables a hdcp port device
*
* @param InstancePtr device to disable
* @param InstancePtr is the device to disable.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxDisable(XHdcp1x_Port *InstancePtr)
{
XDprx* HwDp = InstancePtr->PhyIfPtr;
XDprx *HwDp = InstancePtr->PhyIfPtr;
u32 IntMask = 0;
u8 Offset = 0;
u8 Value = 0;
@ -500,16 +183,15 @@ int XHdcp1x_PortDpRxDisable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function initializes a HDCP port device.
*
* This function initializes a hdcp port device
*
* @param InstancePtr device to initialize
* @param InstancePtr is the device to initialize.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxInit(XHdcp1x_Port *InstancePtr)
@ -531,18 +213,16 @@ int XHdcp1x_PortDpRxInit(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
*
* This function reads a register from a hdcp port device
* This function reads a register from a HDCP port device.
*
* @param InstancePtr device to read from
* @param Offset offset to start reading from
* @param Buf buffer to copy data read
* @param BufSize size of buffer
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy data read.
* @param BufSize is the size of the buffer.
*
* @return
* number of bytes read
* @return Is the number of bytes read.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
@ -563,19 +243,16 @@ int XHdcp1x_PortDpRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
/*****************************************************************************/
/**
* This function writes a register from a HDCP port device.
*
* This function writes a register from a hdcp port device
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing to.
* @param Buf is the buffer containing data to write.
* @param BufSize is the size of the buffer.
*
* @param InstancePtr device to write to
* @param Offset offset to start writing to
* @param Buf buffer containing data to write
* @param BufSize size of buffer
* @return The number of bytes written.
*
* @return
* number of bytes written
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
@ -594,47 +271,305 @@ int XHdcp1x_PortDpRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
return (RegWrite(InstancePtr, Offset, Buf, BufSize));
}
#if 0
/*****************************************************************************/
/**
* This reads a register from the HDCP port device.
*
* This handles an interrupt generated by a hdcp port device
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy data read.
* @param BufSize is the size of the buffer.
*
* @param InstancePtr the device to write to
* @param IntCause the interrupt cause bit map
* @return The number of bytes read.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_PortDpRxIntrHandler(XHdcp1x_Port *InstancePtr, u32 IntCause)
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
XDprx *HwDp = InstancePtr->PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 RegOffset = 0;
int NumRead = 0;
/* Determine RegOffset */
RegOffset = XDP_RX_DPCD_HDCP_TABLE;
RegOffset += Offset;
/* Iterate through the reads */
do {
u32 Value = 0;
u32 Alignment = 0;
u32 NumThisTime = 0;
int Idx = 0;
/* Determine Alignment */
Alignment = (RegOffset & 0x03ul);
/* Determine NumThisTime */
NumThisTime = 4;
if (Alignment != 0) {
NumThisTime = (4 - Alignment);
}
if (NumThisTime > BufSize) {
NumThisTime = BufSize;
}
/* Determine Value */
Value = XDprx_ReadReg(Base, (RegOffset & ~0x03ul));
/* Check for adjustment of Value */
if (Alignment != 0)
Value >>= (8 * Alignment);
/* Update theBuf */
for (Idx = 0; Idx < NumThisTime; Idx++) {
Buf[Idx] = (u8) (Value & 0xFFul);
Value >>= 8;
}
/* Update for loop */
Buf += NumThisTime;
BufSize -= NumThisTime;
RegOffset += NumThisTime;
NumRead += NumThisTime;
}
while (BufSize > 0);
return (NumRead);
}
/*****************************************************************************/
/**
* This writes a register from the HDCP port device.
*
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing at.
* @param Buf is the buffer containing data to write.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes written.
*
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XDprx *HwDp = InstancePtr->PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 RegOffset = 0;
int NumWritten = 0;
/* Determine RegOffset */
RegOffset = XDP_RX_DPCD_HDCP_TABLE;
RegOffset += Offset;
/* Iterate through the writes */
do {
u32 Value = 0;
u32 Alignment = 0;
u32 NumThisTime = 0;
int Idx = 0;
/* Determine Alignment */
Alignment = (RegOffset & 0x03ul);
/* Determine NumThisTime */
NumThisTime = 4;
if (Alignment != 0) {
NumThisTime = (4 - Alignment);
}
if (NumThisTime > BufSize) {
NumThisTime = BufSize;
}
/* Check for simple case */
if (NumThisTime == 4) {
/* Determine Value */
for (Idx = 3; Idx >= 0; Idx--) {
Value <<= 8;
Value |= Buf[Idx];
}
}
/* Otherwise - must read and modify existing memory */
else {
u32 Mask = 0;
u32 Temp = 0;
/* Determine Mask */
Mask = 0xFFu;
if (Alignment != 0) {
Mask <<= (8 * Alignment);
}
/* Initialize Value */
Value = XDprx_ReadReg(Base, (RegOffset & ~0x03ul));
/* Update theValue */
for (Idx = 0; Idx < NumThisTime; Idx++) {
Temp = Buf[Idx];
Temp <<= (8 * (Alignment + Idx));
Value &= ~Mask;
Value |= Temp;
Mask <<= 8;
}
}
/* Write Value */
XDprx_WriteReg(Base, (RegOffset & ~0x03ul), Value);
/* Update for loop */
Buf += NumThisTime;
BufSize -= NumThisTime;
RegOffset += NumThisTime;
NumWritten += NumThisTime;
}
while (BufSize > 0);
return (NumWritten);
}
/*****************************************************************************/
/**
* This function notifies the tx end of the link of an event of interest.
*
* @param InstancePtr is the device to perform the notification.
*
* @return None.
*
* @note None.
*
******************************************************************************/
static void NotifyTx(const XHdcp1x_Port *InstancePtr)
{
XDprx *HwDp = InstancePtr->PhyIfPtr;
u32 Base = HwDp->Config.BaseAddr;
u32 Value = 0;
u8 Ainfo = 0;
/* Read Ainfo */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Ainfo, sizeof(Ainfo));
/* Check for regular HPD pulse notification */
if ((Ainfo & 0x01u) == 0) {
/* Send a 500us HPD pulse */
XDp_RxGenerateHpdInterrupt(HwDp, 500u);
}
/* Otherwise - must use HPD IRQ */
else {
/* #### WORK TO DO #### */
}
/* Always generate CP IRQ */
Value = XDprx_ReadReg(Base, XDP_RX_DEVICE_SERVICE_IRQ);
Value |= XDP_RX_DEVICE_SERVICE_IRQ_CP_IRQ_MASK;
XDprx_WriteReg(Base, XDP_RX_DEVICE_SERVICE_IRQ, Value);
}
/*****************************************************************************/
/**
* This function process a write to the AKsv register from the tx device.
*
* @param CallbackRef is the device to whose register was written.
*
* @return None.
*
* @note This function initiates the side effects of the tx device
* writing the Aksv register. This is currently updates some status
* bits as well as kick starts a re-authentication process.
*
******************************************************************************/
static void ProcessAKsvWrite(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Check for AKsv write */
if (IntCause & XDP_RX_INTERRUPT_MASK_HDCP_AKSV_WRITE_MASK) {
ProcessAKsvWrite(InstancePtr);
}
/* Check for Ro read */
if (IntCause & XDP_RX_INTERRUPT_MASK_HDCP_RO_READ_MASK) {
ProcessRoRead(InstancePtr);
}
/* Check for Binfo read */
if (IntCause & XDP_RX_INTERRUPT_MASK_HDCP_BINFO_READ_MASK) {
ProcessBinfoRead(InstancePtr);
}
/* Update statistics */
InstancePtr->Stats.IntCount++;
return;
/* Clear bit 0 of Ainfo register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
Value &= 0xFEu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
/* Clear bits 3:2 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
Value &= 0xF3u;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(InstancePtr->AuthRef);
}
}
#endif
/*****************************************************************************/
/**
* This function process a read of the Ro' register by the tx device.
*
* @param CallbackRef is the device to whose register was read.
*
* @return None.
*
* @note This function initiates the side effects of the tx device read
* the Ro' register. This is currently limited to the clearing of
* bits within device's Bstatus register.
*
******************************************************************************/
static void ProcessRoRead(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
/* Clear bit 1 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
Value &= 0xFDu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
}
/*****************************************************************************/
/**
* This function process a read of the Binfo register by the tx device.
*
* @param CallbackRef is the device to whose register was read.
*
* @return None.
*
* @note This function initiates the side effects of the tx device read
* the Binfo register. This is currently limited to the clearing of
* bits within device's Bstatus register.
*
******************************************************************************/
static void ProcessBinfoRead(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = CallbackRef;
u8 Value = 0;
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
/* Update statistics */
InstancePtr->Stats.IntCount++;
/* Clear bit 0 of Bstatus register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
Value &= 0xFEu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1);
}
/*****************************************************************************/
/**
* This tables defines adaptor for DP RX HDCP port driver
*
******************************************************************************/
@ -649,7 +584,7 @@ const XHdcp1x_PortPhyIfAdaptor XHdcp1x_PortDpRxAdaptor =
NULL,
NULL,
NULL,
// &XHdcp1x_PortDpRxIntrHandler,
};
#endif /* defined(XPAR_XDP_RX_NUM_INSTANCES) && (XPAR_XDP_RX_NUM_INSTANCES > 0) */
#endif
/* defined(XPAR_XDP_RX_NUM_INSTANCES) && (XPAR_XDP_RX_NUM_INSTANCES > 0) */

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,15 +42,14 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Fixed link verification handling
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xparameters.h"
#if defined(XPAR_XDP_NUM_INSTANCES) && (XPAR_XDP_NUM_INSTANCES > 0)
#include "xhdcp1x_port.h"
#include "xhdcp1x_port_dp.h"
@ -65,135 +64,27 @@
/***************** Macros (Inline Functions) Definitions *********************/
/*************************** 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,
u32 BufSize);
static void CheckForRxStatusChange(XHdcp1x_Port *InstancePtr);
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
* This function enables a HDCP port device.
*
* This reads a register from the hdcp port device
*
* @param InstancePtr the device to read from
* @param Offset the offset to start reading from
* @param Buf the buffer to copy the data read
* @param BufSize the size of the buffer
* @param InstancePtr is the id of the device to enable.
*
* @return
* The number of bytes read
* - XST_SUCCESS if successful.
* - XST_NOT_ENABLE otherwise.
*
* @note
* None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
/* Locals */
XDptx* DpHw = InstancePtr->PhyIfPtr;
u32 Address = 0;
int NumRead = 0;
/* Determine Address */
Address = Offset;
Address += 0x68000u;
/* Read it */
if (XDp_TxAuxRead(DpHw, Address, BufSize, Buf) == XST_SUCCESS) {
NumRead = BufSize;
}
/* Return */
return (NumRead);
}
/*****************************************************************************/
/**
*
* This writes a register from the hdcp port device
*
* @param InstancePtr the device to write to
* @param Offset the offset to start writing at
* @param Buf the buffer containing the data to write
* @param BufSize the size of the buffer
*
* @return
* The number of bytes written
*
* @note
* None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
/* Locals */
XDptx* DpHw = InstancePtr->PhyIfPtr;
u32 Address = 0;
int NumWritten = 0;
/* Determine Address */
Address = Offset;
Address += 0x68000u;
/* Write it */
if (XDp_TxAuxWrite(DpHw, Address, BufSize, (u8*) Buf) == XST_SUCCESS) {
NumWritten = BufSize;
}
/* Return */
return (NumWritten);
}
/*****************************************************************************/
/**
*
* This function checks for a link integrity check failure or re-auth request
*
* @param InstancePtr the device to process the failure
*
* @return
* void
*
* @note
* None
*
******************************************************************************/
static void CheckForRxStatusChange(XHdcp1x_Port *InstancePtr)
{
u8 Value = 0;
/* Read the Bstatus register */
if (RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1) > 0) {
u8 ReauthMask = 0;
/* Determine ReauthMask */
ReauthMask = XHDCP1X_PORT_BIT_BSTATUS_LINK_FAILURE;
ReauthMask |= XHDCP1X_PORT_BIT_BSTATUS_REAUTH_REQUEST;
/* Check for link failure or re-authentication requested */
if ((Value & ReauthMask) != 0) {
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(
InstancePtr->AuthRef);
}
}
}
return;
}
/*****************************************************************************/
/**
*
* This function enables a hdcp port device
*
* @param InstancePtr the id of the device to enable
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxEnable(XHdcp1x_Port *InstancePtr)
@ -215,16 +106,14 @@ int XHdcp1x_PortDpTxEnable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function disables a HDCP port device.
*
* This function disables a hdcp port device
*
* @param InstancePtr the id of the device to disable
* @param InstancePtr is the id of the device to disable.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxDisable(XHdcp1x_Port *InstancePtr)
@ -241,16 +130,15 @@ int XHdcp1x_PortDpTxDisable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function initializes a HDCP port device.
*
* This function initializes a hdcp port device
*
* @param InstancePtr the device to initialize
* @param InstancePtr is the device to initialize.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxInit(XHdcp1x_Port *InstancePtr)
@ -264,7 +152,7 @@ int XHdcp1x_PortDpTxInit(XHdcp1x_Port *InstancePtr)
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
/* Ensure that the dp video path routes through the hdcp core */
Base = ((XDptx*) InstancePtr->PhyIfPtr)->Config.BaseAddr;
Base = ((XDptx *)InstancePtr->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);
@ -279,16 +167,13 @@ int XHdcp1x_PortDpTxInit(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function confirms the presence/capability of the remote HDCP device.
*
* This function confirms the presence/capability of the remote hdcp device
* @param InstancePtr is the device to query.
*
* @param InstancePtr the device to query
* @return Truth value.
*
* @return
* Truth value
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxIsCapable(const XHdcp1x_Port *InstancePtr)
@ -312,15 +197,13 @@ int XHdcp1x_PortDpTxIsCapable(const XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
*
* This function confirms if the remote hdcp device is a repeater
* This function confirms if the remote HDCP device is a repeater.
*
* @param InstancePtr the device to query
* @param InstancePtr is the device to query.
*
* @return
* Truth value
* @return Truth value.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxIsRepeater(const XHdcp1x_Port *InstancePtr)
@ -343,16 +226,17 @@ int XHdcp1x_PortDpTxIsRepeater(const XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function retrieves the repeater information.
*
* This function retrieves the repeater information
*
* @param InstancePtr the device to query
* @param InstancePtr is the device to query.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_DEVICE_BUSY if the device is busy.
* - XST_NO_FEATURE if feature not part of repeater.
* - XST_RECV_ERROR if receiver read failed.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
@ -366,17 +250,14 @@ int XHdcp1x_PortDpTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
/* Read the remote capabilities */
if (RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS, &Value, 1) > 0) {
/* Check for repeater */
if ((Value & XHDCP1X_PORT_BIT_BCAPS_REPEATER) != 0) {
/* Read the remote status */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS,
&Value, 1);
/* Check for ready */
if ((Value & XHDCP1X_PORT_BIT_BSTATUS_READY) != 0) {
u8 Buf[2];
u16 U16Value = 0;
@ -389,7 +270,6 @@ int XHdcp1x_PortDpTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
/* Update Info */
*Info = (U16Value & 0x0FFFu);
}
else {
Status = XST_DEVICE_BUSY;
@ -408,19 +288,16 @@ int XHdcp1x_PortDpTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
/*****************************************************************************/
/**
* This function reads a register from a HDCP port device.
*
* This function reads a register from a hdcp port device
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy the data read.
* @param BufSize is the size of the buffer.
*
* @param InstancePtr the device to read from
* @param Offset the offset to start reading from
* @param Buf the buffer to copy the data read
* @param BufSize the size of the buffer
* @return The number of bytes read.
*
* @return
* The number of bytes read
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
@ -441,19 +318,16 @@ int XHdcp1x_PortDpTxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
/*****************************************************************************/
/**
* This function writes a register from a HDCP port device.
*
* This function writes a register from a hdcp port device
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing to.
* @param Buf is the buffer containing the data to write.
* @param BufSize is the size of the buffer.
*
* @param InstancePtr the device to write to
* @param Offset the offset to start writing to
* @param Buf the buffer containing the data to write
* @param BufSize the size of the buffer
* @return The number of bytes written.
*
* @return
* The number of bytes written
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortDpTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
@ -474,17 +348,14 @@ int XHdcp1x_PortDpTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
/*****************************************************************************/
/**
* This handles an interrupt generated by a HDCP port device.
*
* This handles an interrupt generated by a hdcp port device
* @param InstancePtr is the device to write to.
* @param IntCause is the interrupt cause bit map.
*
* @param InstancePtr the device to write to
* @param IntCause the interrupt cause bit map
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_PortDpTxIntrHandler(XHdcp1x_Port *InstancePtr, u32 IntCause)
@ -506,13 +377,110 @@ void XHdcp1x_PortDpTxIntrHandler(XHdcp1x_Port *InstancePtr, u32 IntCause)
if (HpdDetected) {
CheckForRxStatusChange(InstancePtr);
}
return;
}
/*****************************************************************************/
/**
* This reads a register from the HDCP port device.
*
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy the data read.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes read.
*
* @note None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
XDptx *DpHw = InstancePtr->PhyIfPtr;
u32 Address = 0;
int NumRead = 0;
/* Determine Address */
Address = Offset;
Address += 0x68000u;
/* Read it */
if (XDp_TxAuxRead(DpHw, Address, BufSize, Buf) == XST_SUCCESS) {
NumRead = BufSize;
}
return (NumRead);
}
/*****************************************************************************/
/**
* This writes a register from the HDCP port device.
*
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing at.
* @param Buf is the buffer containing the data to write.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes written.
*
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XDptx *DpHw = InstancePtr->PhyIfPtr;
u32 Address = 0;
int NumWritten = 0;
/* Determine Address */
Address = Offset;
Address += 0x68000u;
/* Write it */
if (XDp_TxAuxWrite(DpHw, Address, BufSize, (u8 *)Buf) == XST_SUCCESS) {
NumWritten = BufSize;
}
return (NumWritten);
}
/*****************************************************************************/
/**
* This function checks for a link integrity check failure or re-auth request.
*
* @param InstancePtr is the device to process the failure.
*
* @return None.
*
* @note None.
*
******************************************************************************/
static void CheckForRxStatusChange(XHdcp1x_Port *InstancePtr)
{
u8 Value = 0;
/* Read the Bstatus register */
if (RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &Value, 1) > 0) {
u8 ReauthMask = 0;
/* Determine ReauthMask */
ReauthMask = XHDCP1X_PORT_BIT_BSTATUS_LINK_FAILURE;
ReauthMask |= XHDCP1X_PORT_BIT_BSTATUS_REAUTH_REQUEST;
/* Check for link failure or re-authentication requested */
if ((Value & ReauthMask) != 0) {
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(
InstancePtr->AuthRef);
}
}
}
}
/*****************************************************************************/
/**
* This tables defines the adaptor for the DP TX HDCP port driver
*
******************************************************************************/
@ -529,4 +497,5 @@ const XHdcp1x_PortPhyIfAdaptor XHdcp1x_PortDpTxAdaptor =
&XHdcp1x_PortDpTxIntrHandler,
};
#endif /* defined(XPAR_XDP_TX_NUM_INSTANCES) && (XPAR_XDP_TX_NUM_INSTANCES > 0) */
#endif
/* defined(XPAR_XDP_TX_NUM_INSTANCES) && (XPAR_XDP_TX_NUM_INSTANCES > 0) */

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,7 +42,7 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
@ -130,7 +130,6 @@ extern "C" {
/************************** Function Prototypes ******************************/
#ifdef __cplusplus
}
#endif

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,14 +42,14 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xparameters.h"
#if defined(XPAR_XHDMI_RX_NUM_INSTANCES) && (XPAR_XHDMI_RX_NUM_INSTANCES > 0)
#include <stdlib.h>
#include <string.h>
@ -65,128 +65,26 @@
/***************** Macros (Inline Functions) Definitions *********************/
/*************************** 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,
u32 BufSize);
static void ProcessAKsvWrite(void *CallbackRef);
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
* This function enables a HDCP port device.
*
* This reads a register from the hdcp port device
*
* @param InstancePtr the device to read from
* @param Offset the offset to start reading from
* @param Buf the Bufer to copy the data read
* @param BufSize the size of the Bufer
* @param InstancePtr is the id of the device to enable.
*
* @return
* The number of bytes read
* - XST_SUCCESS if successful.
*
* @note
* None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
/* Locals */
XHdmi_Rx *HdmiRx = InstancePtr->PhyIfPtr;
u32 NumLeft = BufSize;
/* Write the offset */
XHdmiRx_DdcHdcpSetAddress(HdmiRx, Offset);
/* Read the buffer */
while (NumLeft-- > 0) {
*Buf++ = XHdmiRx_DdcHdcpReadData(HdmiRx);
}
/* Return */
return ((int) BufSize);
}
/*****************************************************************************/
/**
*
* This writes a register from the hdcp port device
*
* @param InstancePtr the device to write to
* @param Offset the offset to start writing at
* @param Buf the Bufer containing the data to write
* @param BufSize the size of the Bufer
*
* @return
* The number of bytes written
*
* @note
* None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XHdmi_Rx *HdmiRx = InstancePtr->PhyIfPtr;
u32 NumLeft = BufSize;
/* Write the offset */
XHdmiRx_DdcHdcpSetAddress(HdmiRx, Offset);
/* Write the buffer */
while (NumLeft-- > 0) {
XHdmiRx_DdcHdcpWriteData(HdmiRx, *Buf++);
}
/* Return */
return ((int) BufSize);
}
/*****************************************************************************/
/**
*
* This function process a write to the AKsv register from the tx device
*
* @param CallbackRef the device to whose register was written
*
* @return
* void
*
* @note
* This function initiates the side effects of the tx device writing the Aksv
* register. This is currently updates some status bits as well as kick
* starts a re-authentication process.
*
******************************************************************************/
static void ProcessAKsvWrite(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = (XHdcp1x_Port *) CallbackRef;
u8 Value = 0;
/* Update statistics */
InstancePtr->Stats.IntCount++;
/* Clear bit 1 of the Ainfo register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
Value &= 0xFDu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(InstancePtr->AuthRef);
}
return;
}
/*****************************************************************************/
/**
*
* This function enables a hdcp port device
*
* @param InstancePtr the id of the device to enable
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxEnable(XHdcp1x_Port *InstancePtr)
@ -233,16 +131,14 @@ int XHdcp1x_PortHdmiRxEnable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function disables a HDCP port device.
*
* This function disables a hdcp port device
*
* @param InstancePtr the id of the device to disable
* @param InstancePtr is the id of the device to disable.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxDisable(XHdcp1x_Port *InstancePtr)
@ -259,7 +155,7 @@ int XHdcp1x_PortHdmiRxDisable(XHdcp1x_Port *InstancePtr)
Xil_AssertNonvoid(InstancePtr->PhyIfPtr != NULL);
/* Determine HdmiRxBase */
HdmiRxBase = ((XHdmi_Rx*) InstancePtr->PhyIfPtr)->Config.BaseAddress;
HdmiRxBase = ((XHdmi_Rx *)InstancePtr->PhyIfPtr)->Config.BaseAddress;
/* Disable the hdcp ddc slave */
Value = XHdmiRx_ReadReg(HdmiRxBase, XHDMI_RX_DDC_CTRL_SET_OFFSET);
@ -279,16 +175,15 @@ int XHdcp1x_PortHdmiRxDisable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function initializes a HDCP port device.
*
* This function initializes a hdcp port device
*
* @param InstancePtr the device to initialize
* @param InstancePtr is the device to initialize.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxInit(XHdcp1x_Port *InstancePtr)
@ -310,18 +205,16 @@ int XHdcp1x_PortHdmiRxInit(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
*
* This function reads a register from a hdcp port device
* This function reads a register from a HDCP port device.
*
* @param InstancePtr the device to read from
* @param Offset the offset to start reading from
* @param Buf the Bufer to copy the data read
* @param BufSize the size of the Bufer
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy the data read.
* @param BufSize is the size of the buffer.
*
* @return
* The number of bytes read
* @return The number of bytes read.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
@ -342,19 +235,16 @@ int XHdcp1x_PortHdmiRxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
/*****************************************************************************/
/**
* This function writes a register from a HDCP port device.
*
* This function writes a register from a hdcp port device
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing to.
* @param Buf is the buffer containing the data to write.
* @param BufSize is the size of the buffer.
*
* @param InstancePtr the device to write to
* @param Offset the offset to start writing to
* @param Buf the Bufer containing the data to write
* @param BufSize the size of the Bufer
* @return The number of bytes written.
*
* @return
* The number of bytes written
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
@ -373,37 +263,102 @@ int XHdcp1x_PortHdmiRxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
return (RegWrite(InstancePtr, Offset, Buf, BufSize));
}
#if 0
/*****************************************************************************/
/**
* This reads a register from the HDCP port device.
*
* This function serves as the interrupt handler for the hdcp port device
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy the data read.
* @param BufSize is the size of the buffer.
*
* @param CallbackRef the device that generated the interrupt
* @return The number of bytes read.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_PortHdmiRxIntrHandler(XHdcp1x_Port *InstancePtr, u32 IntCause)
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
XHdmi_Rx *HdmiRx = InstancePtr->PhyIfPtr;
u32 NumLeft = BufSize;
/* Process the Aksv write as it is the only hdcp interrupt */
ProcessAKsvWrite(InstancePtr);
/* Write the offset */
XHdmiRx_DdcHdcpSetAddress(HdmiRx, Offset);
/* Return */
return;
/* Read the buffer */
while (NumLeft-- > 0) {
*Buf++ = XHdmiRx_DdcHdcpReadData(HdmiRx);
}
return ((int) BufSize);
}
#endif
/*****************************************************************************/
/**
* This writes a register from the HDCP port device.
*
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing at.
* @param Buf is the buffer containing the data to write.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes written.
*
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XHdmi_Rx *HdmiRx = InstancePtr->PhyIfPtr;
u32 NumLeft = BufSize;
/* Write the offset */
XHdmiRx_DdcHdcpSetAddress(HdmiRx, Offset);
/* Write the buffer */
while (NumLeft-- > 0) {
XHdmiRx_DdcHdcpWriteData(HdmiRx, *Buf++);
}
return ((int) BufSize);
}
/*****************************************************************************/
/**
* This function process a write to the AKsv register from the tx device.
*
* @param CallbackRef is the device to whose register was written.
*
* @return None.
*
* @note This function initiates the side effects of the tx device
* writing the Aksv register. This is currently updates some status
* bits as well as kick starts a re-authentication process.
*
******************************************************************************/
static void ProcessAKsvWrite(void *CallbackRef)
{
XHdcp1x_Port *InstancePtr = (XHdcp1x_Port *) CallbackRef;
u8 Value = 0;
/* Update statistics */
InstancePtr->Stats.IntCount++;
/* Clear bit 1 of the Ainfo register */
RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
Value &= 0xFDu;
RegWrite(InstancePtr, XHDCP1X_PORT_OFFSET_AINFO, &Value, 1);
/* Invoke authentication callback if set */
if (InstancePtr->IsAuthCallbackSet) {
(*(InstancePtr->AuthCallback))(InstancePtr->AuthRef);
}
}
/*****************************************************************************/
/**
* This tables defines the adaptor for the HDMI RX HDCP port driver
*
******************************************************************************/
@ -418,7 +373,7 @@ const XHdcp1x_PortPhyIfAdaptor XHdcp1x_PortHdmiRxAdaptor =
NULL,
NULL,
NULL,
// &XHdcp1x_PortHdmiRxIntrHandler,
};
#endif /* defined(XPAR_XHDMI_RX_NUM_INSTANCES) && (XPAR_XHDMI_RX_NUM_INSTANCES > 0) */
#endif
/* defined(XPAR_XHDMI_RX_NUM_INSTANCES) && (XPAR_XHDMI_RX_NUM_INSTANCES > 0) */

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -42,14 +42,14 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xparameters.h"
#if defined(XPAR_XHDMI_TX_NUM_INSTANCES) && (XPAR_XHDMI_TX_NUM_INSTANCES > 0)
#include <stdlib.h>
#include <string.h>
@ -60,125 +60,32 @@
#include "xil_types.h"
/************************** Constant Definitions *****************************/
#define WRITE_CHUNK_SZ (8)
/**************************** Type Definitions *******************************/
/***************** Macros (Inline Functions) Definitions *********************/
/*************************** 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,
u32 BufSize);
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
* This function enables a HDCP port device.
*
* This reads a register from the hdcp port device
*
* @param InstancePtr the device to read from
* @param Offdry the offset to start reading from
* @param Buf the buffer to copy the data read
* @param BufSize the size of the buffer
* @param InstancePtr is the id of the device to enable.
*
* @return
* The number of bytes read
* - XST_SUCCESS if successful.
*
* @note
* None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
XHdmi_Tx* HdmiTx = InstancePtr->PhyIfPtr;
u8 Slave = 0x3Au;
int NumRead = 0;
/* Write the address and check for failure */
if (XHdmiTx_DdcWrite(HdmiTx, Slave, 1, &Offset, FALSE)
!= XST_SUCCESS) {
NumRead = -1;
}
/* Read the data back and check for failure */
else if (XHdmiTx_DdcRead(HdmiTx, Slave, BufSize, Buf, TRUE)
!= XST_SUCCESS) {
NumRead = -2;
}
/* Success - just update NumRead */
else {
NumRead = (int) BufSize;
}
return (NumRead);
}
/*****************************************************************************/
/**
*
* This writes a register from the hdcp port device
*
* @param InstancePtr the device to write to
* @param Offset the offset to start writing at
* @param Buf the buffer containing the data to write
* @param BufSize the size of the buffer
*
* @return
* The number of bytes written
*
* @note
* None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XHdmi_Tx* HdmiTx = InstancePtr->PhyIfPtr;
u8 Slave = 0x3Au;
u8 TxBuf[WRITE_CHUNK_SZ+1];
int NumWritten = 0;
int ThisTime = 0;
/* Iterate through the buffer */
do {
/* Determine ThisTime */
ThisTime = WRITE_CHUNK_SZ;
if (ThisTime > BufSize) {
ThisTime = BufSize;
}
/* Format TxBuf */
TxBuf[0] = Offset;
memcpy(&(TxBuf[1]), Buf, ThisTime);
/* Write the TxBuf */
if (XHdmiTx_DdcWrite(HdmiTx, Slave, (ThisTime+1), TxBuf, TRUE)
!= XST_SUCCESS) {
/* Update NumWritten and break */
NumWritten = -1;
break;
}
/* Update for loop */
NumWritten += ThisTime;
Buf += ThisTime;
BufSize -= ThisTime;
} while ((BufSize != 0) && (NumWritten > 0));
/* Return */
return (NumWritten);
}
/*****************************************************************************/
/**
*
* This function enables a hdcp port device
*
* @param InstancePtr the id of the device to enable
*
* @return
* XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxEnable(XHdcp1x_Port *InstancePtr)
@ -200,16 +107,14 @@ int XHdcp1x_PortHdmiTxEnable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function disables a HDCP port device.
*
* This function disables a hdcp port device
*
* @param InstancePtr the id of the device to disable
* @param InstancePtr is the id of the device to disable.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxDisable(XHdcp1x_Port *InstancePtr)
@ -226,16 +131,15 @@ int XHdcp1x_PortHdmiTxDisable(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function initializes an HDCP port device.
*
* This function initializes a hdcp port device
*
* @param InstancePtr the device to initialize
* @param InstancePtr is the device to initialize.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxInit(XHdcp1x_Port *InstancePtr)
@ -256,16 +160,13 @@ int XHdcp1x_PortHdmiTxInit(XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function confirms the presence/capability of the remote HDCP device.
*
* This function confirms the presence/capability of the remote hdcp device
* @param InstancePtr is the device to query.
*
* @param InstancePtr the device to query
* @return Truth value.
*
* @return
* Truth value
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxIsCapable(const XHdcp1x_Port *InstancePtr)
@ -288,16 +189,13 @@ int XHdcp1x_PortHdmiTxIsCapable(const XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function confirms if the remote HDCP device is a repeater.
*
* This function confirms if the remote hdcp device is a repeater
* @param InstancePtr is the device to query.
*
* @param InstancePtr the device to query
* @return Truth value.
*
* @return
* Truth value
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxIsRepeater(const XHdcp1x_Port *InstancePtr)
@ -320,16 +218,16 @@ int XHdcp1x_PortHdmiTxIsRepeater(const XHdcp1x_Port *InstancePtr)
/*****************************************************************************/
/**
* This function retrieves the repeater information.
*
* This function retrieves the repeater information
*
* @param InstancePtr the device to query
* @param InstancePtr is the device to query.
*
* @return
* XST_SUCCESS if successful.
* - XST_SUCCESS if successful.
* - XST_DEVICE_BUSY if the device is busy.
* - XST_RECV_ERROR if receiver read failed.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info)
@ -343,7 +241,6 @@ int XHdcp1x_PortHdmiTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info
/* Read the remote capabilities */
if (RegRead(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS, &Value, 1) > 0) {
u8 ReadyMask = 0;
/* Determine ReadyMask */
@ -352,7 +249,6 @@ int XHdcp1x_PortHdmiTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info
/* Check for repeater and ksv fifo ready */
if ((Value & ReadyMask) == ReadyMask) {
u8 Buf[2];
u16 U16Value = 0;
@ -379,22 +275,19 @@ int XHdcp1x_PortHdmiTxGetRepeaterInfo(const XHdcp1x_Port *InstancePtr, u16 *Info
/*****************************************************************************/
/**
* This function reads a register from a HDCP port device.
*
* This function reads a register from a hdcp port device
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy the data read.
* @param BufSize is the size of the buffer.
*
* @param InstancePtr the device to read from
* @param Offset the offset to start reading from
* @param Buf the buffer to copy the data read
* @param BufSize the size of the buffer
* @return The number of bytes read.
*
* @return
* The number of bytes read
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxRead(const XHdcp1x_Port* InstancePtr, u8 Offset,
int XHdcp1x_PortHdmiTxRead(const XHdcp1x_Port *InstancePtr, u8 Offset,
void *Buf, u32 BufSize)
{
/* Verify arguments. */
@ -412,19 +305,16 @@ int XHdcp1x_PortHdmiTxRead(const XHdcp1x_Port* InstancePtr, u8 Offset,
/*****************************************************************************/
/**
* This function writes a register from a HDCP port device.
*
* This function writes a register from a hdcp port device
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing to.
* @param Buf is the buffer containing the data to write.
* @param BufSize is the size of the buffer.
*
* @param InstancePtr the device to write to
* @param Offset the offset to start writing to
* @param Buf the buffer containing the data to write
* @param BufSize the size of the buffer
* @return The number of bytes written.
*
* @return
* The number of bytes written
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_PortHdmiTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
@ -445,7 +335,99 @@ int XHdcp1x_PortHdmiTxWrite(XHdcp1x_Port *InstancePtr, u8 Offset,
/*****************************************************************************/
/**
* This reads a register from the HDCP port device.
*
* @param InstancePtr is the device to read from.
* @param Offset is the offset to start reading from.
* @param Buf is the buffer to copy the data read.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes read.
*
* @note None.
*
******************************************************************************/
static int RegRead(const XHdcp1x_Port *InstancePtr, u8 Offset, u8 *Buf,
u32 BufSize)
{
XHdmi_Tx *HdmiTx = InstancePtr->PhyIfPtr;
u8 Slave = 0x3Au;
int NumRead = 0;
/* Write the address and check for failure */
if (XHdmiTx_DdcWrite(HdmiTx, Slave, 1, &Offset, FALSE)
!= XST_SUCCESS) {
NumRead = -1;
}
/* Read the data back and check for failure */
else if (XHdmiTx_DdcRead(HdmiTx, Slave, BufSize, Buf, TRUE)
!= XST_SUCCESS) {
NumRead = -2;
}
/* Success - just update NumRead */
else {
NumRead = (int) BufSize;
}
return (NumRead);
}
/*****************************************************************************/
/**
* This writes a register from the HDCP port device.
*
* @param InstancePtr is the device to write to.
* @param Offset is the offset to start writing at.
* @param Buf is the buffer containing the data to write.
* @param BufSize is the size of the buffer.
*
* @return The number of bytes written.
*
* @note None.
*
******************************************************************************/
static int RegWrite(XHdcp1x_Port *InstancePtr, u8 Offset, const u8 *Buf,
u32 BufSize)
{
XHdmi_Tx *HdmiTx = InstancePtr->PhyIfPtr;
u8 Slave = 0x3Au;
u8 TxBuf[WRITE_CHUNK_SZ + 1];
int NumWritten = 0;
int ThisTime = 0;
/* Iterate through the buffer */
do {
/* Determine ThisTime */
ThisTime = WRITE_CHUNK_SZ;
if (ThisTime > BufSize) {
ThisTime = BufSize;
}
/* Format TxBuf */
TxBuf[0] = Offset;
memcpy(&(TxBuf[1]), Buf, ThisTime);
/* Write the TxBuf */
if (XHdmiTx_DdcWrite(HdmiTx, Slave, (ThisTime + 1), TxBuf, TRUE)
!= XST_SUCCESS) {
/* Update NumWritten and break */
NumWritten = -1;
break;
}
/* Update for loop */
NumWritten += ThisTime;
Buf += ThisTime;
BufSize -= ThisTime;
}
while ((BufSize != 0) && (NumWritten > 0));
/* Return */
return (NumWritten);
}
/*****************************************************************************/
/**
* This tables defines the adaptor for the HDMI TX HDCP port driver
*
******************************************************************************/
@ -462,4 +444,5 @@ const XHdcp1x_PortPhyIfAdaptor XHdcp1x_PortHdmiTxAdaptor =
NULL,
};
#endif /* defined(XPAR_XHDMI_TX_NUM_INSTANCES) && (XPAR_XHDMI_TX_NUM_INSTANCES > 0) */
#endif
/* defined(XPAR_XHDMI_TX_NUM_INSTANCES) && (XPAR_XHDMI_TX_NUM_INSTANCES > 0) */

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -41,13 +41,13 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xhdcp1x_port.h"
#include "xil_assert.h"
#include "xil_types.h"
@ -63,7 +63,6 @@
/*****************************************************************************/
/**
*
* This function installs an asynchronous callback function for the given
* HandlerType:
*
@ -83,7 +82,7 @@
* - XST_SUCCESS if callback function installed successfully.
* - XST_INVALID_PARAM when HandlerType is invalid.
*
* @note Invoking this function for a handler that already has been
* @note Invoking this function for a handler that already has been
* installed replaces it with the new handler.
*
******************************************************************************/
@ -100,17 +99,16 @@ int XHdcp1x_PortSetCallback(XHdcp1x_Port *InstancePtr, u32 HandlerType,
/* Check for handler type */
switch (HandlerType) {
/* Authentication Callback */
case (XHDCP1X_PORT_HANDLER_AUTHENTICATE):
InstancePtr->AuthCallback = CallbackFunc;
InstancePtr->AuthRef = CallbackRef;
InstancePtr->IsAuthCallbackSet = (TRUE);
break;
/* Authentication Callback */
case (XHDCP1X_PORT_HANDLER_AUTHENTICATE):
InstancePtr->AuthCallback = CallbackFunc;
InstancePtr->AuthRef = CallbackRef;
InstancePtr->IsAuthCallbackSet = (TRUE);
break;
default:
Status = (XST_INVALID_PARAM);
break;
default:
Status = (XST_INVALID_PARAM);
break;
}
return (Status);
@ -118,17 +116,14 @@ int XHdcp1x_PortSetCallback(XHdcp1x_Port *InstancePtr, u32 HandlerType,
/*****************************************************************************/
/**
* This handles an interrupt generated by a HDCP port device.
*
* This handles an interrupt generated by a hdcp port device
* @param InstancePtr is the device to write to.
* @param IntCause is the interrupt cause bit map.
*
* @param InstancePtr the device to write to
* @param IntCause the interrupt cause bit map
* @return None.
*
* @return
* void
*
* @note
* None.
* @note None.
*
******************************************************************************/
void XHdcp1x_PortHandleInterrupt(XHdcp1x_Port *InstancePtr, u32 IntCause)
@ -141,11 +136,9 @@ void XHdcp1x_PortHandleInterrupt(XHdcp1x_Port *InstancePtr, u32 IntCause)
/* Determine Adaptor */
Adaptor = InstancePtr->Adaptor;
/* Check for adaptor function and invoke if present*/
/* Check for adaptor function and invoke if present */
if ((Adaptor != NULL) && (Adaptor->IntrHandler != NULL)) {
InstancePtr->Stats.IntCount++;
(*(Adaptor->IntrHandler))(InstancePtr, IntCause);
}
return;
}

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -41,10 +41,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
#ifndef XHDCP1X_RX_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_RX_H
@ -54,6 +55,7 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xparameters.h"
#include "xstatus.h"
@ -66,8 +68,9 @@ extern "C" {
/***************** Macros (Inline Functions) Definitions *********************/
/************************** Function Prototypes ******************************/
int XHdcp1x_RxCfgInitialize(XHdcp1x_Rx *InstancePtr,
const XHdcp1x_Config *CfgPtr, void* PhyIfPtr);
const XHdcp1x_Config *CfgPtr, void *PhyIfPtr);
int XHdcp1x_RxPoll(XHdcp1x_Rx *InstancePtr);

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -29,7 +29,6 @@
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
/*****************************************************************************/
/**
*
@ -42,13 +41,13 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include <stdlib.h>
#include <string.h>
#include "xhdcp1x.h"
@ -72,15 +71,15 @@
/*****************************************************************************/
/**
*
* This function self tests an hdcp interface
* This function self tests an hdcp interface.
*
* @param InstancePtr the interface to test
* @param InstancePtr is the interface to test.
*
* @return
* XST_SUCCESS if successful
* - XST_SUCCESS if successful.
* - XST_FAILURE otherwise.
*
* @note
* None.
* @note None.
*
******************************************************************************/
int XHdcp1x_SelfTest(XHdcp1x *InstancePtr)

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -41,13 +41,13 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.01 07/23/15 Additional documentation and formating
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xhdcp1x_cipher.h"
#include "xparameters.h"
@ -61,29 +61,27 @@
/************************** Function Prototypes ******************************/
/************************** Variable Definitions *****************************/
extern XHdcp1x_Config XHdcp1x_ConfigTable[];
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This function returns a reference to an XHdcp1x_Config structure based on
* specified device ID.
*
* @param DeviceID the unique core ID of the HDCP interface
* @param DeviceID is the unique core ID of the HDCP interface.
*
* @return
* A reference to the config record in the configuration table (in xhdcp_g.c)
* corresponding the specified DeviceID. NULL if no match is found.
* @return A reference to the config record in the configuration table (in
* xhdcp_g.c) corresponding the specified DeviceID. NULL if no
* match is found.
*
* @note
* None.
* @note None.
*
******************************************************************************/
XHdcp1x_Config *XHdcp1x_LookupConfig(u16 DeviceID)
{
/* Locals */
XHdcp1x_Config *OneToCheck = XHdcp1x_ConfigTable;
XHdcp1x_Config *CfgPtr = NULL;
u32 NumLeft = XPAR_XHDCP_NUM_INSTANCES;
@ -91,18 +89,19 @@ XHdcp1x_Config *XHdcp1x_LookupConfig(u16 DeviceID)
/* Iterate through the configuration table */
do {
/* Is this the one? */
if (OneToCheck->DeviceId == DeviceID)
if (OneToCheck->DeviceId == DeviceID) {
CfgPtr = OneToCheck;
}
/* Update for loop */
OneToCheck++;
NumLeft--;
} while ((NumLeft > 0) && (CfgPtr == NULL));
}
while ((NumLeft > 0) && (CfgPtr == NULL));
/* Sanity Check */
if (CfgPtr != 0) {
u32 Value = 0;
u32 BaseAddress = CfgPtr->BaseAddress;
@ -127,6 +126,5 @@ XHdcp1x_Config *XHdcp1x_LookupConfig(u16 DeviceID)
}
}
/* Return */
return (CfgPtr);
}

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,8 @@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
@ -41,10 +41,11 @@
*
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------------------
* 1.00 07/16/15 Initial release.
* 1.00 fidus 07/16/15 Initial release.
* </pre>
*
******************************************************************************/
#ifndef XHDCP1X_TX_H
/**< Prevent circular inclusions by using protection macros */
#define XHDCP1X_TX_H
@ -54,6 +55,7 @@ extern "C" {
#endif
/***************************** Include Files *********************************/
#include "xhdcp1x.h"
#include "xparameters.h"
#include "xstatus.h"
@ -66,6 +68,7 @@ extern "C" {
/***************** Macros (Inline Functions) Definitions *********************/
/************************** Function Prototypes ******************************/
int XHdcp1x_TxCfgInitialize(XHdcp1x_Tx *InstancePtr,
const XHdcp1x_Config *CfgPtr, void *PhyIfPtr);