XilinxProcessorIPLib/drivers/dp12txss/examples/src/key/keymgmt.c
KEYMGMT_tError
KEYMGMT_Init(
  void
)
{
#if DEBUG_KEYMGMT_INIT
	xil_printf(">>>> Initializing the Key Management Module ... \r\n");
#endif
  /* Locals */
  KEYMGMT_tError theError = KEYMGMT_ERROR_NONE;

  /* Sanity Check */
  if (!gIsInitialized)
  {
	if(gIsKeyWrittenInEeeprom)
	{
		if (Init_IIC() != XST_SUCCESS){
			theError = -3;
	#if DEBUG_KEYMGMT_INIT
		xil_printf("IIC Init done: %s:%s:%d: Error = %d \r\n",
				__FILE__,__func__,__LINE__,theError);
	#endif
		}
	}
    /* Initialize the key management device module */
    if (KEYMGMTDEV_Init() != KEYMGMT_ERROR_NONE){
        theError = -1;
#if DEBUG_KEYMGMT_INIT
      xil_printf("Key Mgmt DEVICE Init done: \r\n\t%s:%s:%d: Error = %d \r\n",
		  __FILE__,__func__,__LINE__,theError);
#endif
    }
    /* Initialize the key management loader module */
    else if (KEYMGMTLDR_Init() != KEYMGMT_ERROR_NONE){
        theError = -2;
#if DEBUG_KEYMGMT_INIT
	xil_printf("Key Mgmt Loader module Init done: \r\n\t");
	xil_printf("%s:%s:%d: Error = %d \r\n",__FILE__,__func__,__LINE__,theError);
#endif
    }

#if DEBUG_KEYMGMT_INIT
    xil_printf("KEYMGMTDEV_Init done , error = %d \r\n",theError);
    xil_printf("KEYMGMTLDR_Init done , error = %d \r\n",theError);
#endif

    /* Update gIsInitialized */
    gIsInitialized = TRUE;
  }

  /* Return */
  return (theError);
}
/*****************************************************************************/
/**
*
* This function initializes the key management module
*
* @return
*   HDCP_ERROR_NONE if successful.
*
* @note
*   None.
*
******************************************************************************/
This function initializes the key management module
This function initializes the key management module
KEYMGMT_tError
KEYMGMT_Init(
  void
)
{
#if DEBUG_KEYMGMT_INIT
	xil_printf(">>>> Initializing the Key Management Module ... \r\n");
#endif
  KEYMGMT_tError theError = KEYMGMT_ERROR_NONE;
  if (!gIsInitialized)
  {
	if(gIsKeyWrittenInEeeprom)
	{
		if (Init_IIC() != XST_SUCCESS){
			theError = -3;
	#if DEBUG_KEYMGMT_INIT
		xil_printf("IIC Init done: %s:%s:%d: Error = %d \r\n",
				__FILE__,__func__,__LINE__,theError);
	#endif
		}
	}
    if (KEYMGMTDEV_Init() != KEYMGMT_ERROR_NONE){
        theError = -1;
#if DEBUG_KEYMGMT_INIT
      xil_printf("Key Mgmt DEVICE Init done: \r\n\t%s:%s:%d: Error = %d \r\n",
		  __FILE__,__func__,__LINE__,theError);
#endif
    }
    else if (KEYMGMTLDR_Init() != KEYMGMT_ERROR_NONE){
        theError = -2;
#if DEBUG_KEYMGMT_INIT
	xil_printf("Key Mgmt Loader module Init done: \r\n\t");
	xil_printf("%s:%s:%d: Error = %d \r\n",__FILE__,__func__,__LINE__,theError);
#endif
    }
#if DEBUG_KEYMGMT_INIT
    xil_printf("KEYMGMTDEV_Init done , error = %d \r\n",theError);
    xil_printf("KEYMGMTLDR_Init done , error = %d \r\n",theError);
#endif
    gIsInitialized = TRUE;
  }
  return (theError);
}
KEYMGMT_tError KEYMGMT_Init ( void ) { #if DEBUG_KEYMGMT_INIT xil_printf ( " \r \n " ) ; #endif KEYMGMT_tError theError = KEYMGMT_ERROR_NONE ; if ( ! gIsInitialized ) { if ( gIsKeyWrittenInEeeprom ) { if ( Init_IIC ( ) != XST_SUCCESS ) { theError = -3 ; #if DEBUG_KEYMGMT_INIT xil_printf ( " \r \n " , __FILE__ , __func__ , __LINE__ , theError ) ; #endif } } if ( KEYMGMTDEV_Init ( ) != KEYMGMT_ERROR_NONE ) { theError = -1 ; #if DEBUG_KEYMGMT_INIT xil_printf ( " \r \n \t \r \n " , __FILE__ , __func__ , __LINE__ , theError ) ; #endif } else if ( KEYMGMTLDR_Init ( ) != KEYMGMT_ERROR_NONE ) { theError = -2 ; #if DEBUG_KEYMGMT_INIT xil_printf ( " \r \n \t " ) ; xil_printf ( " \r \n " , __FILE__ , __func__ , __LINE__ , theError ) ; #endif } #if DEBUG_KEYMGMT_INIT xil_printf ( " \r \n " , theError ) ; xil_printf ( " \r \n " , theError ) ; #endif gIsInitialized = TRUE ; } return ( theError ) ; }
This function initializes the key management module
This function initializes the key management module
/* Locals */ /* Sanity Check */ /* Initialize the key management device module */ /* Initialize the key management loader module */ /* Update gIsInitialized */ /* Return */