XilinxProcessorIPLib/drivers/v_hdmirxss/src/xv_hdmirxss_hdcp.c
static int XV_HdmiRxSs_HdcpProcessEvents(XV_HdmiRxSs *InstancePtr)
{
  XV_HdmiRxSs_HdcpEvent Event;
  int Status = XST_SUCCESS;

  /* Verify argument */
  Xil_AssertNonvoid(InstancePtr != NULL);

  Event = XV_HdmiRxSs_HdcpGetEvent(InstancePtr);

  switch (Event) {

    // Stream up
    case XV_HDMIRXSS_HDCP_STREAMUP_EVT :
      break;

    // Stream down
    case XV_HDMIRXSS_HDCP_STREAMDOWN_EVT :
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);
      }
#endif
      break;

    // Connect
    case XV_HDMIRXSS_HDCP_CONNECT_EVT :
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        // Set physical state
        XHdcp1x_SetPhysicalState(InstancePtr->Hdcp14Ptr, TRUE);
        XHdcp1x_Poll(InstancePtr->Hdcp14Ptr); // This is needed to ensure that the previous command is executed.
      }
#endif
      XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, InstancePtr->HdcpProtocol);
      break;

    // Disconnect
    // Enable the previous HDCP protocol
    case XV_HDMIRXSS_HDCP_DISCONNECT_EVT :
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        // Clear HDMI mode
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);

        // Set physical state
        XHdcp1x_SetPhysicalState(InstancePtr->Hdcp14Ptr, FALSE);
        XHdcp1x_Poll(InstancePtr->Hdcp14Ptr); // This is needed to ensure that the previous command is executed.
      }
#endif
      break;

#ifdef USE_HDCP_14_PROT_EVT_ENUM
    // HDCP 1.4 protocol event
    // Enable HDCP 1.4
    case XV_HDMIRXSS_HDCP_1_PROT_EVT :
#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
      if (InstancePtr->Hdcp14Ptr && InstancePtr->Hdcp22Ptr) {
        if(XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_14) != XST_SUCCESS) {
          XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_22);
        }
      }
#endif
      break;
#endif

#ifdef USE_HDCP_22_PROT_EVT_ENUM
    // HDCP 2.2 protocol event
    // Enable HDCP 2.2
    case XV_HDMIRXSS_HDCP_2_PROT_EVT :
#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
      if (InstancePtr->Hdcp14Ptr && InstancePtr->Hdcp22Ptr) {
        if(XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_22) != XST_SUCCESS) {
          XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_14);
        }
      }
#endif
      break;
#endif

    // DVI mode event
    case XV_HDMIRXSS_HDCP_DVI_MODE_EVT:
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);
      }
#endif
      break;

    // HDMI mode event
    case XV_HDMIRXSS_HDCP_HDMI_MODE_EVT:
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, TRUE);
      }
#endif
      break;

    // Sync loss event
    case XV_HDMIRXSS_HDCP_SYNC_LOSS_EVT:
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);
      }
#endif
      break;

      // Sync est/recover event
      case XV_HDMIRXSS_HDCP_SYNC_EST_EVT:
  #ifdef XPAR_XHDCP_NUM_INSTANCES
        if (InstancePtr->Hdcp14Ptr) {
          XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, TRUE);
        }
  #endif
        break;

    default :
      break;
  }

  return Status;
}
/*****************************************************************************/
/**
*
* This function processes pending events from the HDCP event queue.
*
* @param InstancePtr is a pointer to the XV_HdmiRxSs instance.
*
* @return
*  - XST_SUCCESS if action was successful
*  - XST_FAILURE if action was not successful
*
* @note   None.
*
******************************************************************************/
This function processes pending events from the HDCP event queue.
This function processes pending events from the HDCP event queue .
static int XV_HdmiRxSs_HdcpProcessEvents(XV_HdmiRxSs *InstancePtr)
{
  XV_HdmiRxSs_HdcpEvent Event;
  int Status = XST_SUCCESS;
  Xil_AssertNonvoid(InstancePtr != NULL);
  Event = XV_HdmiRxSs_HdcpGetEvent(InstancePtr);
  switch (Event) {
    case XV_HDMIRXSS_HDCP_STREAMUP_EVT :
      break;
    case XV_HDMIRXSS_HDCP_STREAMDOWN_EVT :
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);
      }
#endif
      break;
    case XV_HDMIRXSS_HDCP_CONNECT_EVT :
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetPhysicalState(InstancePtr->Hdcp14Ptr, TRUE);
        XHdcp1x_Poll(InstancePtr->Hdcp14Ptr); 
      }
#endif
      XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, InstancePtr->HdcpProtocol);
      break;
    case XV_HDMIRXSS_HDCP_DISCONNECT_EVT :
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);
        XHdcp1x_SetPhysicalState(InstancePtr->Hdcp14Ptr, FALSE);
        XHdcp1x_Poll(InstancePtr->Hdcp14Ptr); 
      }
#endif
      break;
#ifdef USE_HDCP_14_PROT_EVT_ENUM
    case XV_HDMIRXSS_HDCP_1_PROT_EVT :
#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
      if (InstancePtr->Hdcp14Ptr && InstancePtr->Hdcp22Ptr) {
        if(XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_14) != XST_SUCCESS) {
          XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_22);
        }
      }
#endif
      break;
#endif
#ifdef USE_HDCP_22_PROT_EVT_ENUM
    case XV_HDMIRXSS_HDCP_2_PROT_EVT :
#if defined(XPAR_XHDCP_NUM_INSTANCES) && defined(XPAR_XHDCP22_RX_NUM_INSTANCES)
      if (InstancePtr->Hdcp14Ptr && InstancePtr->Hdcp22Ptr) {
        if(XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_22) != XST_SUCCESS) {
          XV_HdmiRxSs_HdcpSetProtocol(InstancePtr, XV_HDMIRXSS_HDCP_14);
        }
      }
#endif
      break;
#endif
    case XV_HDMIRXSS_HDCP_DVI_MODE_EVT:
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);
      }
#endif
      break;
    case XV_HDMIRXSS_HDCP_HDMI_MODE_EVT:
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, TRUE);
      }
#endif
      break;
    case XV_HDMIRXSS_HDCP_SYNC_LOSS_EVT:
#ifdef XPAR_XHDCP_NUM_INSTANCES
      if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, FALSE);
      }
#endif
      break;
      case XV_HDMIRXSS_HDCP_SYNC_EST_EVT:
  #ifdef XPAR_XHDCP_NUM_INSTANCES
        if (InstancePtr->Hdcp14Ptr) {
          XHdcp1x_SetHdmiMode(InstancePtr->Hdcp14Ptr, TRUE);
        }
  #endif
        break;
    default :
      break;
  }
  return Status;
}
static int XV_HdmiRxSs_HdcpProcessEvents ( XV_HdmiRxSs * InstancePtr ) { XV_HdmiRxSs_HdcpEvent Event ; int Status = XST_SUCCESS ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Event = XV_HdmiRxSs_HdcpGetEvent ( InstancePtr ) ; switch ( Event ) { case XV_HDMIRXSS_HDCP_STREAMUP_EVT : break ; case XV_HDMIRXSS_HDCP_STREAMDOWN_EVT : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetHdmiMode ( InstancePtr -> Hdcp14Ptr , FALSE ) ; } #endif break ; case XV_HDMIRXSS_HDCP_CONNECT_EVT : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetPhysicalState ( InstancePtr -> Hdcp14Ptr , TRUE ) ; XHdcp1x_Poll ( InstancePtr -> Hdcp14Ptr ) ; } #endif XV_HdmiRxSs_HdcpSetProtocol ( InstancePtr , InstancePtr -> HdcpProtocol ) ; break ; case XV_HDMIRXSS_HDCP_DISCONNECT_EVT : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetHdmiMode ( InstancePtr -> Hdcp14Ptr , FALSE ) ; XHdcp1x_SetPhysicalState ( InstancePtr -> Hdcp14Ptr , FALSE ) ; XHdcp1x_Poll ( InstancePtr -> Hdcp14Ptr ) ; } #endif break ; #ifdef USE_HDCP_14_PROT_EVT_ENUM case XV_HDMIRXSS_HDCP_1_PROT_EVT : #if defined ( XPAR_XHDCP_NUM_INSTANCES ) && defined ( XPAR_XHDCP22_RX_NUM_INSTANCES ) if ( InstancePtr -> Hdcp14Ptr && InstancePtr -> Hdcp22Ptr ) { if ( XV_HdmiRxSs_HdcpSetProtocol ( InstancePtr , XV_HDMIRXSS_HDCP_14 ) != XST_SUCCESS ) { XV_HdmiRxSs_HdcpSetProtocol ( InstancePtr , XV_HDMIRXSS_HDCP_22 ) ; } } #endif break ; #endif #ifdef USE_HDCP_22_PROT_EVT_ENUM case XV_HDMIRXSS_HDCP_2_PROT_EVT : #if defined ( XPAR_XHDCP_NUM_INSTANCES ) && defined ( XPAR_XHDCP22_RX_NUM_INSTANCES ) if ( InstancePtr -> Hdcp14Ptr && InstancePtr -> Hdcp22Ptr ) { if ( XV_HdmiRxSs_HdcpSetProtocol ( InstancePtr , XV_HDMIRXSS_HDCP_22 ) != XST_SUCCESS ) { XV_HdmiRxSs_HdcpSetProtocol ( InstancePtr , XV_HDMIRXSS_HDCP_14 ) ; } } #endif break ; #endif case XV_HDMIRXSS_HDCP_DVI_MODE_EVT : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetHdmiMode ( InstancePtr -> Hdcp14Ptr , FALSE ) ; } #endif break ; case XV_HDMIRXSS_HDCP_HDMI_MODE_EVT : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetHdmiMode ( InstancePtr -> Hdcp14Ptr , TRUE ) ; } #endif break ; case XV_HDMIRXSS_HDCP_SYNC_LOSS_EVT : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetHdmiMode ( InstancePtr -> Hdcp14Ptr , FALSE ) ; } #endif break ; case XV_HDMIRXSS_HDCP_SYNC_EST_EVT : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetHdmiMode ( InstancePtr -> Hdcp14Ptr , TRUE ) ; } #endif break ; default : break ; } return Status ; }
This function processes pending events from the HDCP event queue.
This function processes pending events from the HDCP event queue .
/* Verify argument */ // Stream up // Stream down // Connect // Set physical state // This is needed to ensure that the previous command is executed. // Disconnect // Enable the previous HDCP protocol // Clear HDMI mode // Set physical state // This is needed to ensure that the previous command is executed. // HDCP 1.4 protocol event // Enable HDCP 1.4 // HDCP 2.2 protocol event // Enable HDCP 2.2 // DVI mode event // HDMI mode event // Sync loss event // Sync est/recover event