XilinxProcessorIPLib/drivers/v_hdmirxss/src/xv_hdmirxss.c
int XV_HdmiRxSs_CfgInitialize(XV_HdmiRxSs *InstancePtr,
    XV_HdmiRxSs_Config *CfgPtr,
    UINTPTR EffectiveAddr)
{
  XV_HdmiRxSs *HdmiRxSsPtr = InstancePtr;
  XHdmiC_DRMInfoFrame *DrmInfoFramePtr;

  /* Verify arguments */
  Xil_AssertNonvoid(HdmiRxSsPtr != NULL);
  Xil_AssertNonvoid(CfgPtr != NULL);
  Xil_AssertNonvoid(EffectiveAddr != (UINTPTR)NULL);

  /* Setup the instance */
  memcpy((void *)&(HdmiRxSsPtr->Config), (const void *)CfgPtr,
    sizeof(XV_HdmiRxSs_Config));
  HdmiRxSsPtr->Config.BaseAddress = EffectiveAddr;

  /* Determine sub-cores included in the provided instance of subsystem */
  XV_HdmiRxSs_GetIncludedSubcores(HdmiRxSsPtr, CfgPtr->DeviceId);

  /* Initialize all included sub_cores */
  if(HdmiRxSsPtr->HdmiRxPtr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdmiRx(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }

#ifdef XPAR_XHDCP_NUM_INSTANCES
  // HDCP 1.4
  if(HdmiRxSsPtr->Hdcp14Ptr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdcp14(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }

  if(HdmiRxSsPtr->HdcpTimerPtr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdcpTimer(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }
#endif

#ifdef XPAR_XHDCP22_RX_NUM_INSTANCES
  // HDCP 2.2
  if(HdmiRxSsPtr->Hdcp22Ptr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdcp22(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }
#endif

  /* Register Callbacks */
  XV_HdmiRxSs_RegisterSubsysCallbacks(HdmiRxSsPtr);

#ifdef USE_HDCP_RX
  /* Default value */
  HdmiRxSsPtr->HdcpIsReady = (FALSE);
  XV_HdmiRxSs_HdcpSetCapability(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_BOTH);
  HdmiRxSsPtr->UserHdcpProt = XV_HDMIRXSS_HDCP_NOUSERPREF;
#endif

#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
  /* HDCP is ready when both HDCP cores are instantiated and all keys are
     loaded */
  if (HdmiRxSsPtr->Hdcp14Ptr && HdmiRxSsPtr->Hdcp22Ptr &&
      HdmiRxSsPtr->Hdcp22Lc128Ptr && HdmiRxSsPtr->Hdcp14KeyPtr &&
      HdmiRxSsPtr->Hdcp22PrivateKeyPtr) {
    HdmiRxSsPtr->HdcpIsReady = (TRUE);

    /* Set default HDCP content protection scheme */
    XV_HdmiRxSs_HdcpSetProtocol(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_14);
  }
#endif

#if defined(XPAR_XHDCP_NUM_INSTANCES)
  /* HDCP is ready when only the HDCP 1.4 core is instantiated and the key is
     loaded */
  if (!HdmiRxSsPtr->HdcpIsReady && HdmiRxSsPtr->Hdcp14Ptr &&
       HdmiRxSsPtr->Hdcp14KeyPtr) {
    HdmiRxSsPtr->HdcpIsReady = (TRUE);

    /* Set default HDCP content protection scheme */
    XV_HdmiRxSs_HdcpSetProtocol(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_14);
  }
#endif

#if defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
  /* HDCP is ready when only the HDCP 2.2 core is instantiated and the keys are
     loaded */
  if (!HdmiRxSsPtr->HdcpIsReady && HdmiRxSsPtr->Hdcp22Ptr &&
       HdmiRxSsPtr->Hdcp22Lc128Ptr && HdmiRxSsPtr->Hdcp22PrivateKeyPtr) {
    HdmiRxSsPtr->HdcpIsReady = (TRUE);

    /* Set default HDCP content protection scheme */
    XV_HdmiRxSs_HdcpSetProtocol(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_22);
  }
#endif

  /* Reset the hardware and set the flag to indicate the
     subsystem is ready
   */
  XV_HdmiRxSs_Reset(HdmiRxSsPtr);
  HdmiRxSsPtr->IsReady = XIL_COMPONENT_IS_READY;

  /* Initialize the application version with 0 <default value>.
   * Application need to set the this variable properly to let driver know
   * what version of application is being used.
   */
  HdmiRxSsPtr->AppMajVer = 0;
  HdmiRxSsPtr->AppMinVer = 0;
  DrmInfoFramePtr = XV_HdmiRxSs_GetDrmInfoframe(HdmiRxSsPtr);

  DrmInfoFramePtr->Static_Metadata_Descriptor_ID = 0xFF;
  DrmInfoFramePtr->EOTF = 0xff;

  return(XST_SUCCESS);
}
/*****************************************************************************/
/**
* This function initializes the video subsystem and included sub-cores.
* This function must be called prior to using the subsystem. Initialization
* includes setting up the instance data for top level as well as all included
* sub-core therein, and ensuring the hardware is in a known stable state.
*
* @param  InstancePtr is a pointer to the Subsystem instance to be worked on.
* @param  CfgPtr points to the configuration structure associated with the
*         subsystem instance.
* @param  EffectiveAddr is the base address of the device. If address
*         translation is being used, then this parameter must reflect the
*         virtual base address. Otherwise, the physical address should be
*         used.
*
* @return XST_SUCCESS if initialization is successful else XST_FAILURE
*
******************************************************************************/
This function initializes the video subsystem and included sub-cores.
This function must be called prior to using the subsystem. Initialization
includes setting up the instance data for top level as well as all included
sub-core therein, and ensuring the hardware is in a known stable state.
This function initializes the video subsystem and included sub - cores . This function must be called prior to using the subsystem . Initialization includes setting up the instance data for top level as well as all included sub - core therein and ensuring the hardware is in a known stable state .
int XV_HdmiRxSs_CfgInitialize(XV_HdmiRxSs *InstancePtr,
    XV_HdmiRxSs_Config *CfgPtr,
    UINTPTR EffectiveAddr)
{
  XV_HdmiRxSs *HdmiRxSsPtr = InstancePtr;
  XHdmiC_DRMInfoFrame *DrmInfoFramePtr;
  Xil_AssertNonvoid(HdmiRxSsPtr != NULL);
  Xil_AssertNonvoid(CfgPtr != NULL);
  Xil_AssertNonvoid(EffectiveAddr != (UINTPTR)NULL);
  memcpy((void *)&(HdmiRxSsPtr->Config), (const void *)CfgPtr,
    sizeof(XV_HdmiRxSs_Config));
  HdmiRxSsPtr->Config.BaseAddress = EffectiveAddr;
  XV_HdmiRxSs_GetIncludedSubcores(HdmiRxSsPtr, CfgPtr->DeviceId);
  if(HdmiRxSsPtr->HdmiRxPtr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdmiRx(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }
#ifdef XPAR_XHDCP_NUM_INSTANCES
  if(HdmiRxSsPtr->Hdcp14Ptr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdcp14(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }
  if(HdmiRxSsPtr->HdcpTimerPtr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdcpTimer(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }
#endif
#ifdef XPAR_XHDCP22_RX_NUM_INSTANCES
  if(HdmiRxSsPtr->Hdcp22Ptr)
  {
    if(XV_HdmiRxSs_SubcoreInitHdcp22(HdmiRxSsPtr) != XST_SUCCESS)
    {
      return(XST_FAILURE);
    }
  }
#endif
  XV_HdmiRxSs_RegisterSubsysCallbacks(HdmiRxSsPtr);
#ifdef USE_HDCP_RX
  HdmiRxSsPtr->HdcpIsReady = (FALSE);
  XV_HdmiRxSs_HdcpSetCapability(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_BOTH);
  HdmiRxSsPtr->UserHdcpProt = XV_HDMIRXSS_HDCP_NOUSERPREF;
#endif
#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
  if (HdmiRxSsPtr->Hdcp14Ptr && HdmiRxSsPtr->Hdcp22Ptr &&
      HdmiRxSsPtr->Hdcp22Lc128Ptr && HdmiRxSsPtr->Hdcp14KeyPtr &&
      HdmiRxSsPtr->Hdcp22PrivateKeyPtr) {
    HdmiRxSsPtr->HdcpIsReady = (TRUE);
    XV_HdmiRxSs_HdcpSetProtocol(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_14);
  }
#endif
#if defined(XPAR_XHDCP_NUM_INSTANCES)
  if (!HdmiRxSsPtr->HdcpIsReady && HdmiRxSsPtr->Hdcp14Ptr &&
       HdmiRxSsPtr->Hdcp14KeyPtr) {
    HdmiRxSsPtr->HdcpIsReady = (TRUE);
    XV_HdmiRxSs_HdcpSetProtocol(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_14);
  }
#endif
#if defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
  if (!HdmiRxSsPtr->HdcpIsReady && HdmiRxSsPtr->Hdcp22Ptr &&
       HdmiRxSsPtr->Hdcp22Lc128Ptr && HdmiRxSsPtr->Hdcp22PrivateKeyPtr) {
    HdmiRxSsPtr->HdcpIsReady = (TRUE);
    XV_HdmiRxSs_HdcpSetProtocol(HdmiRxSsPtr, XV_HDMIRXSS_HDCP_22);
  }
#endif
  XV_HdmiRxSs_Reset(HdmiRxSsPtr);
  HdmiRxSsPtr->IsReady = XIL_COMPONENT_IS_READY;
  HdmiRxSsPtr->AppMajVer = 0;
  HdmiRxSsPtr->AppMinVer = 0;
  DrmInfoFramePtr = XV_HdmiRxSs_GetDrmInfoframe(HdmiRxSsPtr);
  DrmInfoFramePtr->Static_Metadata_Descriptor_ID = 0xFF;
  DrmInfoFramePtr->EOTF = 0xff;
  return(XST_SUCCESS);
}
int XV_HdmiRxSs_CfgInitialize ( XV_HdmiRxSs * InstancePtr , XV_HdmiRxSs_Config * CfgPtr , UINTPTR EffectiveAddr ) { XV_HdmiRxSs * HdmiRxSsPtr = InstancePtr ; XHdmiC_DRMInfoFrame * DrmInfoFramePtr ; Xil_AssertNonvoid ( HdmiRxSsPtr != NULL ) ; Xil_AssertNonvoid ( CfgPtr != NULL ) ; Xil_AssertNonvoid ( EffectiveAddr != ( UINTPTR ) NULL ) ; memcpy ( ( void * ) & ( HdmiRxSsPtr -> Config ) , ( const void * ) CfgPtr , sizeof ( XV_HdmiRxSs_Config ) ) ; HdmiRxSsPtr -> Config . BaseAddress = EffectiveAddr ; XV_HdmiRxSs_GetIncludedSubcores ( HdmiRxSsPtr , CfgPtr -> DeviceId ) ; if ( HdmiRxSsPtr -> HdmiRxPtr ) { if ( XV_HdmiRxSs_SubcoreInitHdmiRx ( HdmiRxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } #ifdef XPAR_XHDCP_NUM_INSTANCES if ( HdmiRxSsPtr -> Hdcp14Ptr ) { if ( XV_HdmiRxSs_SubcoreInitHdcp14 ( HdmiRxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } if ( HdmiRxSsPtr -> HdcpTimerPtr ) { if ( XV_HdmiRxSs_SubcoreInitHdcpTimer ( HdmiRxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } #endif #ifdef XPAR_XHDCP22_RX_NUM_INSTANCES if ( HdmiRxSsPtr -> Hdcp22Ptr ) { if ( XV_HdmiRxSs_SubcoreInitHdcp22 ( HdmiRxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } #endif XV_HdmiRxSs_RegisterSubsysCallbacks ( HdmiRxSsPtr ) ; #ifdef USE_HDCP_RX HdmiRxSsPtr -> HdcpIsReady = ( FALSE ) ; XV_HdmiRxSs_HdcpSetCapability ( HdmiRxSsPtr , XV_HDMIRXSS_HDCP_BOTH ) ; HdmiRxSsPtr -> UserHdcpProt = XV_HDMIRXSS_HDCP_NOUSERPREF ; #endif #if defined ( XPAR_XHDCP_NUM_INSTANCES ) && defined ( XPAR_XHDCP22_RX_NUM_INSTANCES ) if ( HdmiRxSsPtr -> Hdcp14Ptr && HdmiRxSsPtr -> Hdcp22Ptr && HdmiRxSsPtr -> Hdcp22Lc128Ptr && HdmiRxSsPtr -> Hdcp14KeyPtr && HdmiRxSsPtr -> Hdcp22PrivateKeyPtr ) { HdmiRxSsPtr -> HdcpIsReady = ( TRUE ) ; XV_HdmiRxSs_HdcpSetProtocol ( HdmiRxSsPtr , XV_HDMIRXSS_HDCP_14 ) ; } #endif #if defined ( XPAR_XHDCP_NUM_INSTANCES ) if ( ! HdmiRxSsPtr -> HdcpIsReady && HdmiRxSsPtr -> Hdcp14Ptr && HdmiRxSsPtr -> Hdcp14KeyPtr ) { HdmiRxSsPtr -> HdcpIsReady = ( TRUE ) ; XV_HdmiRxSs_HdcpSetProtocol ( HdmiRxSsPtr , XV_HDMIRXSS_HDCP_14 ) ; } #endif #if defined ( XPAR_XHDCP22_RX_NUM_INSTANCES ) if ( ! HdmiRxSsPtr -> HdcpIsReady && HdmiRxSsPtr -> Hdcp22Ptr && HdmiRxSsPtr -> Hdcp22Lc128Ptr && HdmiRxSsPtr -> Hdcp22PrivateKeyPtr ) { HdmiRxSsPtr -> HdcpIsReady = ( TRUE ) ; XV_HdmiRxSs_HdcpSetProtocol ( HdmiRxSsPtr , XV_HDMIRXSS_HDCP_22 ) ; } #endif XV_HdmiRxSs_Reset ( HdmiRxSsPtr ) ; HdmiRxSsPtr -> IsReady = XIL_COMPONENT_IS_READY ; HdmiRxSsPtr -> AppMajVer = 0 ; HdmiRxSsPtr -> AppMinVer = 0 ; DrmInfoFramePtr = XV_HdmiRxSs_GetDrmInfoframe ( HdmiRxSsPtr ) ; DrmInfoFramePtr -> Static_Metadata_Descriptor_ID = 0xFF ; DrmInfoFramePtr -> EOTF = 0xff ; return ( XST_SUCCESS ) ; }
This function initializes the video subsystem and included sub-cores.
This function initializes the video subsystem and included sub - cores .
/* Verify arguments */ /* Setup the instance */ /* Determine sub-cores included in the provided instance of subsystem */ /* Initialize all included sub_cores */ // HDCP 1.4 // HDCP 2.2 /* Register Callbacks */ /* Default value */ /* HDCP is ready when both HDCP cores are instantiated and all keys are
     loaded */ /* Set default HDCP content protection scheme */ /* HDCP is ready when only the HDCP 1.4 core is instantiated and the key is
     loaded */ /* Set default HDCP content protection scheme */ /* HDCP is ready when only the HDCP 2.2 core is instantiated and the keys are
     loaded */ /* Set default HDCP content protection scheme */ /* Reset the hardware and set the flag to indicate the
     subsystem is ready
   */ /* Initialize the application version with 0 <default value>.
   * Application need to set the this variable properly to let driver know
   * what version of application is being used.
   */