XilinxProcessorIPLib/drivers/v_hdmitxss/src/xv_hdmitxss.c
int XV_HdmiTxSs_CfgInitialize(XV_HdmiTxSs *InstancePtr,
                              XV_HdmiTxSs_Config *CfgPtr,
                              UINTPTR EffectiveAddr)
{
  XV_HdmiTxSs *HdmiTxSsPtr = InstancePtr;

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

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

  /* Initialize InfoFrame */
  (void)memset((void *)&(HdmiTxSsPtr->AVIInfoframe), 0, sizeof(XHdmiC_AVI_InfoFrame));
  (void)memset((void *)&(HdmiTxSsPtr->VSIF), 0, sizeof(XHdmiC_VSIF));
  (void)memset((void *)&(HdmiTxSsPtr->AudioInfoframe), 0, sizeof(XHdmiC_AudioInfoFrame));
  memset((void *)&(HdmiTxSsPtr->DrmInfoframe), 0, sizeof(XHdmiC_DRMInfoFrame));
  HdmiTxSsPtr->DrmInfoframe.Static_Metadata_Descriptor_ID = 0xff;
  HdmiTxSsPtr->DrmInfoframe.EOTF = 0xff;

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

  /* Initialize all included sub_cores */

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

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

  if (HdmiTxSsPtr->HdmiTxPtr) {
    if (XV_HdmiTxSs_SubcoreInitHdmiTx(HdmiTxSsPtr) != XST_SUCCESS) {
      return(XST_FAILURE);
    }
    XV_HdmiTx_SetAxiClkFreq(HdmiTxSsPtr->HdmiTxPtr,
                            HdmiTxSsPtr->Config.AxiLiteClkFreq);
  }

#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
  // HDCP 2.2
  if (HdmiTxSsPtr->Hdcp22Ptr) {
    if (XV_HdmiTxSs_SubcoreInitHdcp22(HdmiTxSsPtr) != XST_SUCCESS){
      return(XST_FAILURE);
    }
  }
#endif

  if (HdmiTxSsPtr->VtcPtr) {
    if (XV_HdmiTxSs_SubcoreInitVtc(HdmiTxSsPtr) != XST_SUCCESS) {
      return(XST_FAILURE);
    }
  }

  /* Register Callbacks */
  XV_HdmiTxSs_RegisterSubsysCallbacks(HdmiTxSsPtr);

  /* Set default HDCP protocol */
  HdmiTxSsPtr->HdcpProtocol = XV_HDMITXSS_HDCP_NONE;

  /* HDCP ready flag */

#ifdef USE_HDCP_TX
  /* Default value */
  HdmiTxSsPtr->HdcpIsReady = (FALSE);
  XV_HdmiTxSs_HdcpSetCapability(HdmiTxSsPtr, XV_HDMITXSS_HDCP_BOTH);
#endif

#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_TX_NUM_INSTANCES)
  /* HDCP is ready when both HDCP cores are instantiated and both keys
     are loaded */
  if (HdmiTxSsPtr->Hdcp14Ptr && HdmiTxSsPtr->Hdcp22Ptr &&
      HdmiTxSsPtr->Hdcp22Lc128Ptr && HdmiTxSsPtr->Hdcp22SrmPtr &&
      HdmiTxSsPtr->Hdcp14KeyPtr) {
    HdmiTxSsPtr->HdcpIsReady = (TRUE);
  }
#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 (!HdmiTxSsPtr->HdcpIsReady && HdmiTxSsPtr->Hdcp14Ptr &&
       HdmiTxSsPtr->Hdcp14KeyPtr) {
    HdmiTxSsPtr->HdcpIsReady = (TRUE);
  }
#endif

#if defined(XPAR_XHDCP22_TX_NUM_INSTANCES)
  /* HDCP is ready when only the HDCP 2.2 core is instantiated and the key
     is loaded */
  if (!HdmiTxSsPtr->HdcpIsReady && HdmiTxSsPtr->Hdcp22Ptr &&
       HdmiTxSsPtr->Hdcp22Lc128Ptr &&
      HdmiTxSsPtr->Hdcp22SrmPtr) {
    HdmiTxSsPtr->HdcpIsReady = (TRUE);
  }
#endif

  /* Set the flag to indicate the subsystem is ready */
  XV_HdmiTxSs_Reset(HdmiTxSsPtr);
  HdmiTxSsPtr->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.
   */
  HdmiTxSsPtr->AppMajVer = 0;
  HdmiTxSsPtr->AppMinVer = 0;

  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_HdmiTxSs_CfgInitialize(XV_HdmiTxSs *InstancePtr,
                              XV_HdmiTxSs_Config *CfgPtr,
                              UINTPTR EffectiveAddr)
{
  XV_HdmiTxSs *HdmiTxSsPtr = InstancePtr;
  Xil_AssertNonvoid(HdmiTxSsPtr != NULL);
  Xil_AssertNonvoid(CfgPtr != NULL);
  Xil_AssertNonvoid(EffectiveAddr != (UINTPTR)NULL);
  memcpy((void *)&(HdmiTxSsPtr->Config), (const void *)CfgPtr,
    sizeof(XV_HdmiTxSs_Config));
  HdmiTxSsPtr->Config.BaseAddress = EffectiveAddr;
  (void)memset((void *)&(HdmiTxSsPtr->AVIInfoframe), 0, sizeof(XHdmiC_AVI_InfoFrame));
  (void)memset((void *)&(HdmiTxSsPtr->VSIF), 0, sizeof(XHdmiC_VSIF));
  (void)memset((void *)&(HdmiTxSsPtr->AudioInfoframe), 0, sizeof(XHdmiC_AudioInfoFrame));
  memset((void *)&(HdmiTxSsPtr->DrmInfoframe), 0, sizeof(XHdmiC_DRMInfoFrame));
  HdmiTxSsPtr->DrmInfoframe.Static_Metadata_Descriptor_ID = 0xff;
  HdmiTxSsPtr->DrmInfoframe.EOTF = 0xff;
  XV_HdmiTxSs_GetIncludedSubcores(HdmiTxSsPtr, CfgPtr->DeviceId);
#ifdef XPAR_XHDCP_NUM_INSTANCES
  if (HdmiTxSsPtr->Hdcp14Ptr) {
    if (XV_HdmiTxSs_SubcoreInitHdcp14(HdmiTxSsPtr) != XST_SUCCESS){
      return(XST_FAILURE);
    }
  }
  if (HdmiTxSsPtr->HdcpTimerPtr) {
    if (XV_HdmiTxSs_SubcoreInitHdcpTimer(HdmiTxSsPtr) != XST_SUCCESS){
      return(XST_FAILURE);
    }
  }
#endif
  if (HdmiTxSsPtr->HdmiTxPtr) {
    if (XV_HdmiTxSs_SubcoreInitHdmiTx(HdmiTxSsPtr) != XST_SUCCESS) {
      return(XST_FAILURE);
    }
    XV_HdmiTx_SetAxiClkFreq(HdmiTxSsPtr->HdmiTxPtr,
                            HdmiTxSsPtr->Config.AxiLiteClkFreq);
  }
#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
  if (HdmiTxSsPtr->Hdcp22Ptr) {
    if (XV_HdmiTxSs_SubcoreInitHdcp22(HdmiTxSsPtr) != XST_SUCCESS){
      return(XST_FAILURE);
    }
  }
#endif
  if (HdmiTxSsPtr->VtcPtr) {
    if (XV_HdmiTxSs_SubcoreInitVtc(HdmiTxSsPtr) != XST_SUCCESS) {
      return(XST_FAILURE);
    }
  }
  XV_HdmiTxSs_RegisterSubsysCallbacks(HdmiTxSsPtr);
  HdmiTxSsPtr->HdcpProtocol = XV_HDMITXSS_HDCP_NONE;
#ifdef USE_HDCP_TX
  HdmiTxSsPtr->HdcpIsReady = (FALSE);
  XV_HdmiTxSs_HdcpSetCapability(HdmiTxSsPtr, XV_HDMITXSS_HDCP_BOTH);
#endif
#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_TX_NUM_INSTANCES)
  if (HdmiTxSsPtr->Hdcp14Ptr && HdmiTxSsPtr->Hdcp22Ptr &&
      HdmiTxSsPtr->Hdcp22Lc128Ptr && HdmiTxSsPtr->Hdcp22SrmPtr &&
      HdmiTxSsPtr->Hdcp14KeyPtr) {
    HdmiTxSsPtr->HdcpIsReady = (TRUE);
  }
#endif
#if defined(XPAR_XHDCP_NUM_INSTANCES)
  if (!HdmiTxSsPtr->HdcpIsReady && HdmiTxSsPtr->Hdcp14Ptr &&
       HdmiTxSsPtr->Hdcp14KeyPtr) {
    HdmiTxSsPtr->HdcpIsReady = (TRUE);
  }
#endif
#if defined(XPAR_XHDCP22_TX_NUM_INSTANCES)
  if (!HdmiTxSsPtr->HdcpIsReady && HdmiTxSsPtr->Hdcp22Ptr &&
       HdmiTxSsPtr->Hdcp22Lc128Ptr &&
      HdmiTxSsPtr->Hdcp22SrmPtr) {
    HdmiTxSsPtr->HdcpIsReady = (TRUE);
  }
#endif
  XV_HdmiTxSs_Reset(HdmiTxSsPtr);
  HdmiTxSsPtr->IsReady = XIL_COMPONENT_IS_READY;
  HdmiTxSsPtr->AppMajVer = 0;
  HdmiTxSsPtr->AppMinVer = 0;
  return(XST_SUCCESS);
}
int XV_HdmiTxSs_CfgInitialize ( XV_HdmiTxSs * InstancePtr , XV_HdmiTxSs_Config * CfgPtr , UINTPTR EffectiveAddr ) { XV_HdmiTxSs * HdmiTxSsPtr = InstancePtr ; Xil_AssertNonvoid ( HdmiTxSsPtr != NULL ) ; Xil_AssertNonvoid ( CfgPtr != NULL ) ; Xil_AssertNonvoid ( EffectiveAddr != ( UINTPTR ) NULL ) ; memcpy ( ( void * ) & ( HdmiTxSsPtr -> Config ) , ( const void * ) CfgPtr , sizeof ( XV_HdmiTxSs_Config ) ) ; HdmiTxSsPtr -> Config . BaseAddress = EffectiveAddr ; ( void ) memset ( ( void * ) & ( HdmiTxSsPtr -> AVIInfoframe ) , 0 , sizeof ( XHdmiC_AVI_InfoFrame ) ) ; ( void ) memset ( ( void * ) & ( HdmiTxSsPtr -> VSIF ) , 0 , sizeof ( XHdmiC_VSIF ) ) ; ( void ) memset ( ( void * ) & ( HdmiTxSsPtr -> AudioInfoframe ) , 0 , sizeof ( XHdmiC_AudioInfoFrame ) ) ; memset ( ( void * ) & ( HdmiTxSsPtr -> DrmInfoframe ) , 0 , sizeof ( XHdmiC_DRMInfoFrame ) ) ; HdmiTxSsPtr -> DrmInfoframe . Static_Metadata_Descriptor_ID = 0xff ; HdmiTxSsPtr -> DrmInfoframe . EOTF = 0xff ; XV_HdmiTxSs_GetIncludedSubcores ( HdmiTxSsPtr , CfgPtr -> DeviceId ) ; #ifdef XPAR_XHDCP_NUM_INSTANCES if ( HdmiTxSsPtr -> Hdcp14Ptr ) { if ( XV_HdmiTxSs_SubcoreInitHdcp14 ( HdmiTxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } if ( HdmiTxSsPtr -> HdcpTimerPtr ) { if ( XV_HdmiTxSs_SubcoreInitHdcpTimer ( HdmiTxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } #endif if ( HdmiTxSsPtr -> HdmiTxPtr ) { if ( XV_HdmiTxSs_SubcoreInitHdmiTx ( HdmiTxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } XV_HdmiTx_SetAxiClkFreq ( HdmiTxSsPtr -> HdmiTxPtr , HdmiTxSsPtr -> Config . AxiLiteClkFreq ) ; } #ifdef XPAR_XHDCP22_TX_NUM_INSTANCES if ( HdmiTxSsPtr -> Hdcp22Ptr ) { if ( XV_HdmiTxSs_SubcoreInitHdcp22 ( HdmiTxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } #endif if ( HdmiTxSsPtr -> VtcPtr ) { if ( XV_HdmiTxSs_SubcoreInitVtc ( HdmiTxSsPtr ) != XST_SUCCESS ) { return ( XST_FAILURE ) ; } } XV_HdmiTxSs_RegisterSubsysCallbacks ( HdmiTxSsPtr ) ; HdmiTxSsPtr -> HdcpProtocol = XV_HDMITXSS_HDCP_NONE ; #ifdef USE_HDCP_TX HdmiTxSsPtr -> HdcpIsReady = ( FALSE ) ; XV_HdmiTxSs_HdcpSetCapability ( HdmiTxSsPtr , XV_HDMITXSS_HDCP_BOTH ) ; #endif #if defined ( XPAR_XHDCP_NUM_INSTANCES ) && defined ( XPAR_XHDCP22_TX_NUM_INSTANCES ) if ( HdmiTxSsPtr -> Hdcp14Ptr && HdmiTxSsPtr -> Hdcp22Ptr && HdmiTxSsPtr -> Hdcp22Lc128Ptr && HdmiTxSsPtr -> Hdcp22SrmPtr && HdmiTxSsPtr -> Hdcp14KeyPtr ) { HdmiTxSsPtr -> HdcpIsReady = ( TRUE ) ; } #endif #if defined ( XPAR_XHDCP_NUM_INSTANCES ) if ( ! HdmiTxSsPtr -> HdcpIsReady && HdmiTxSsPtr -> Hdcp14Ptr && HdmiTxSsPtr -> Hdcp14KeyPtr ) { HdmiTxSsPtr -> HdcpIsReady = ( TRUE ) ; } #endif #if defined ( XPAR_XHDCP22_TX_NUM_INSTANCES ) if ( ! HdmiTxSsPtr -> HdcpIsReady && HdmiTxSsPtr -> Hdcp22Ptr && HdmiTxSsPtr -> Hdcp22Lc128Ptr && HdmiTxSsPtr -> Hdcp22SrmPtr ) { HdmiTxSsPtr -> HdcpIsReady = ( TRUE ) ; } #endif XV_HdmiTxSs_Reset ( HdmiTxSsPtr ) ; HdmiTxSsPtr -> IsReady = XIL_COMPONENT_IS_READY ; HdmiTxSsPtr -> AppMajVer = 0 ; HdmiTxSsPtr -> AppMinVer = 0 ; 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 */ /* Initialize InfoFrame */ /* Determine sub-cores included in the provided instance of subsystem */ /* Initialize all included sub_cores */ // HDCP 1.4 // HDCP 2.2 /* Register Callbacks */ /* Set default HDCP protocol */ /* HDCP ready flag */ /* Default value */ /* HDCP is ready when both HDCP cores are instantiated and both keys
     are loaded */ /* HDCP is ready when only the HDCP 1.4 core is instantiated and the key
     is loaded */ /* HDCP is ready when only the HDCP 2.2 core is instantiated and the key
     is loaded */ /* 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.
   */