XilinxProcessorIPLib/drivers/v_hdmitxss/src/xv_hdmitxss.c
int XV_HdmiTxSs_SetCallback(XV_HdmiTxSs *InstancePtr,
		XV_HdmiTxSs_HandlerType HandlerType,
		void *CallbackFunc,
		void *CallbackRef)
{
    u32 Status;

    /* Verify arguments. */
    Xil_AssertNonvoid(InstancePtr != NULL);
    Xil_AssertNonvoid(HandlerType >= (XV_HDMITXSS_HANDLER_CONNECT));
    Xil_AssertNonvoid(CallbackFunc != NULL);
    Xil_AssertNonvoid(CallbackRef != NULL);

    /* Check for handler type */
    switch (HandlerType) {
        // Connect
        case (XV_HDMITXSS_HANDLER_CONNECT):
            InstancePtr->ConnectCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->ConnectRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // Toggle
        case (XV_HDMITXSS_HANDLER_TOGGLE):
            InstancePtr->ToggleCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->ToggleRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // Bridge Unlocked
        case (XV_HDMITXSS_HANDLER_BRDGUNLOCK):
            InstancePtr->BrdgUnlockedCallback =
			    (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->BrdgUnlockedRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // Bridge Overflow
        case (XV_HDMITXSS_HANDLER_BRDGOVERFLOW):
            InstancePtr->BrdgOverflowCallback =
			    (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->BrdgOverflowRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // Bridge Underflow
        case (XV_HDMITXSS_HANDLER_BRDGUNDERFLOW):
            InstancePtr->BrdgUnderflowCallback =
			    (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->BrdgUnderflowRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // Vsync
        case (XV_HDMITXSS_HANDLER_VS):
            InstancePtr->VsCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->VsRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // Stream down
        case (XV_HDMITXSS_HANDLER_STREAM_DOWN):
            InstancePtr->StreamDownCallback =
                (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->StreamDownRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // Stream up
        case (XV_HDMITXSS_HANDLER_STREAM_UP):
            InstancePtr->StreamUpCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->StreamUpRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;

        // HDCP authenticated
        case (XV_HDMITXSS_HANDLER_HDCP_AUTHENTICATED):
#ifdef XPAR_XHDCP_NUM_INSTANCES
            /* Register HDCP 1.4 callbacks */
            if (InstancePtr->Hdcp14Ptr) {
              XHdcp1x_SetCallback(InstancePtr->Hdcp14Ptr,
                                  XHDCP1X_HANDLER_AUTHENTICATED,
								  (void *)(XHdcp1x_Callback) CallbackFunc,
								  (void *)CallbackRef);
            }
#endif

#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
            /* Register HDCP 2.2 callbacks */
            if (InstancePtr->Hdcp22Ptr) {
              XHdcp22Tx_SetCallback(InstancePtr->Hdcp22Ptr,
                                    XHDCP22_TX_HANDLER_AUTHENTICATED,
									(void *)(XHdcp22_Tx_Callback)CallbackFunc,
									(void *)CallbackRef);
            }
#endif
            Status = (XST_SUCCESS);
            break;

        // HDCP downstream topology available
        case (XV_HDMITXSS_HANDLER_HDCP_DOWNSTREAM_TOPOLOGY_AVAILABLE):
#ifdef XPAR_XHDCP_NUM_INSTANCES
            /** Register HDCP 1.4 callbacks */
            if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetCallBack(InstancePtr->Hdcp14Ptr,
                            (XHdcp1x_HandlerType) XHDCP1X_RPTR_HDLR_REPEATER_EXCHANGE,
							(void *) (XHdcp1x_Callback)CallbackFunc,
							(void *) CallbackRef);
            }
#endif

#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
            /** Register HDCP 2.2 callbacks */
            if (InstancePtr->Hdcp22Ptr) {
              XHdcp22Tx_SetCallback(InstancePtr->Hdcp22Ptr,
                                    XHDCP22_TX_HANDLER_DOWNSTREAM_TOPOLOGY_AVAILABLE,
									(void *)(XHdcp22_Tx_Callback)CallbackFunc,
									(void *)CallbackRef);
            }
#endif
            Status = (XST_SUCCESS);
            break;

        // HDCP unauthenticated
        case (XV_HDMITXSS_HANDLER_HDCP_UNAUTHENTICATED):
#ifdef XPAR_XHDCP_NUM_INSTANCES
            /** Register HDCP 1.4 callbacks */
            if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetCallBack(InstancePtr->Hdcp14Ptr,
                            XHDCP1X_HANDLER_UNAUTHENTICATED,
							(void *) (XHdcp1x_Callback)CallbackFunc,
							(void *) CallbackRef);
            }
#endif

#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
            /** Register HDCP 2.2 callbacks */
            if (InstancePtr->Hdcp22Ptr) {
              XHdcp22Tx_SetCallback(InstancePtr->Hdcp22Ptr,
                                    XHDCP22_TX_HANDLER_UNAUTHENTICATED,
                                    (void *) (XHdcp22_Tx_Callback)CallbackFunc,
									(void *) CallbackRef);
            }
#endif
            Status = (XST_SUCCESS);
          break;

        default:
            Status = (XST_INVALID_PARAM);
            break;
    }

    return Status;
}
/*****************************************************************************/
/**
*
* This function installs an asynchronous callback function for the given
* HandlerType:
*
* <pre>
* HandlerType                     Callback Function Type
* -----------------------         ---------------------------------------------
* (XV_HDMITXSS_HANDLER_CONNECT)       HpdCallback
* (XV_HDMITXSS_HANDLER_VS)            VsCallback
* (XV_HDMITXSS_HANDLER_STREAM_DOWN)   StreamDownCallback
* (XV_HDMITXSS_HANDLER_STREAM_UP)     StreamUpCallback
* (XV_HDMITXSS_HANDLER_BRDGOVERFLOW)  BrdgOverflowCallback
* (XV_HDMITXSS_HANDLER_BRDGUNDERFLOW) BrdgUnderflowCallback
* (XV_HDMITXSS_HANDLER_HDCP_AUTHENTICATED)
* (XV_HDMITXSS_HANDLER_HDCP_DOWNSTREAM_TOPOLOGY_AVAILABLE)
* (XV_HDMITXSS_HANDLER_HDCP_UNAUTHENTICATED)
* </pre>
*
* @param    InstancePtr is a pointer to the HDMI TX Subsystem instance.
* @param    HandlerType specifies the type of handler.
* @param    CallbackFunc is the address of the callback function.
* @param    CallbackRef is a user data item that will be passed to the
*       callback function when it is invoked.
*
* @return
*       - 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
*       installed replaces it with the new handler.
*
******************************************************************************/
This function installs an asynchronous callback function for the given
HandlerType.


HandlerType                     Callback Function Type


This function installs an asynchronous callback function for the given HandlerType . HandlerType Callback Function Type
int XV_HdmiTxSs_SetCallback(XV_HdmiTxSs *InstancePtr,
		XV_HdmiTxSs_HandlerType HandlerType,
		void *CallbackFunc,
		void *CallbackRef)
{
    u32 Status;
    Xil_AssertNonvoid(InstancePtr != NULL);
    Xil_AssertNonvoid(HandlerType >= (XV_HDMITXSS_HANDLER_CONNECT));
    Xil_AssertNonvoid(CallbackFunc != NULL);
    Xil_AssertNonvoid(CallbackRef != NULL);
    switch (HandlerType) {
        case (XV_HDMITXSS_HANDLER_CONNECT):
            InstancePtr->ConnectCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->ConnectRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_TOGGLE):
            InstancePtr->ToggleCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->ToggleRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_BRDGUNLOCK):
            InstancePtr->BrdgUnlockedCallback =
			    (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->BrdgUnlockedRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_BRDGOVERFLOW):
            InstancePtr->BrdgOverflowCallback =
			    (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->BrdgOverflowRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_BRDGUNDERFLOW):
            InstancePtr->BrdgUnderflowCallback =
			    (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->BrdgUnderflowRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_VS):
            InstancePtr->VsCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->VsRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_STREAM_DOWN):
            InstancePtr->StreamDownCallback =
                (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->StreamDownRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_STREAM_UP):
            InstancePtr->StreamUpCallback = (XV_HdmiTxSs_Callback)CallbackFunc;
            InstancePtr->StreamUpRef = CallbackRef;
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_HDCP_AUTHENTICATED):
#ifdef XPAR_XHDCP_NUM_INSTANCES
            if (InstancePtr->Hdcp14Ptr) {
              XHdcp1x_SetCallback(InstancePtr->Hdcp14Ptr,
                                  XHDCP1X_HANDLER_AUTHENTICATED,
								  (void *)(XHdcp1x_Callback) CallbackFunc,
								  (void *)CallbackRef);
            }
#endif
#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
            if (InstancePtr->Hdcp22Ptr) {
              XHdcp22Tx_SetCallback(InstancePtr->Hdcp22Ptr,
                                    XHDCP22_TX_HANDLER_AUTHENTICATED,
									(void *)(XHdcp22_Tx_Callback)CallbackFunc,
									(void *)CallbackRef);
            }
#endif
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_HDCP_DOWNSTREAM_TOPOLOGY_AVAILABLE):
#ifdef XPAR_XHDCP_NUM_INSTANCES
            if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetCallBack(InstancePtr->Hdcp14Ptr,
                            (XHdcp1x_HandlerType) XHDCP1X_RPTR_HDLR_REPEATER_EXCHANGE,
							(void *) (XHdcp1x_Callback)CallbackFunc,
							(void *) CallbackRef);
            }
#endif
#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
            if (InstancePtr->Hdcp22Ptr) {
              XHdcp22Tx_SetCallback(InstancePtr->Hdcp22Ptr,
                                    XHDCP22_TX_HANDLER_DOWNSTREAM_TOPOLOGY_AVAILABLE,
									(void *)(XHdcp22_Tx_Callback)CallbackFunc,
									(void *)CallbackRef);
            }
#endif
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMITXSS_HANDLER_HDCP_UNAUTHENTICATED):
#ifdef XPAR_XHDCP_NUM_INSTANCES
            if (InstancePtr->Hdcp14Ptr) {
        XHdcp1x_SetCallBack(InstancePtr->Hdcp14Ptr,
                            XHDCP1X_HANDLER_UNAUTHENTICATED,
							(void *) (XHdcp1x_Callback)CallbackFunc,
							(void *) CallbackRef);
            }
#endif
#ifdef XPAR_XHDCP22_TX_NUM_INSTANCES
            if (InstancePtr->Hdcp22Ptr) {
              XHdcp22Tx_SetCallback(InstancePtr->Hdcp22Ptr,
                                    XHDCP22_TX_HANDLER_UNAUTHENTICATED,
                                    (void *) (XHdcp22_Tx_Callback)CallbackFunc,
									(void *) CallbackRef);
            }
#endif
            Status = (XST_SUCCESS);
          break;
        default:
            Status = (XST_INVALID_PARAM);
            break;
    }
    return Status;
}
int XV_HdmiTxSs_SetCallback ( XV_HdmiTxSs * InstancePtr , XV_HdmiTxSs_HandlerType HandlerType , void * CallbackFunc , void * CallbackRef ) { u32 Status ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( HandlerType >= ( XV_HDMITXSS_HANDLER_CONNECT ) ) ; Xil_AssertNonvoid ( CallbackFunc != NULL ) ; Xil_AssertNonvoid ( CallbackRef != NULL ) ; switch ( HandlerType ) { case ( XV_HDMITXSS_HANDLER_CONNECT ) : InstancePtr -> ConnectCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> ConnectRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_TOGGLE ) : InstancePtr -> ToggleCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> ToggleRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_BRDGUNLOCK ) : InstancePtr -> BrdgUnlockedCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> BrdgUnlockedRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_BRDGOVERFLOW ) : InstancePtr -> BrdgOverflowCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> BrdgOverflowRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_BRDGUNDERFLOW ) : InstancePtr -> BrdgUnderflowCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> BrdgUnderflowRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_VS ) : InstancePtr -> VsCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> VsRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_STREAM_DOWN ) : InstancePtr -> StreamDownCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> StreamDownRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_STREAM_UP ) : InstancePtr -> StreamUpCallback = ( XV_HdmiTxSs_Callback ) CallbackFunc ; InstancePtr -> StreamUpRef = CallbackRef ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_HDCP_AUTHENTICATED ) : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetCallback ( InstancePtr -> Hdcp14Ptr , XHDCP1X_HANDLER_AUTHENTICATED , ( void * ) ( XHdcp1x_Callback ) CallbackFunc , ( void * ) CallbackRef ) ; } #endif #ifdef XPAR_XHDCP22_TX_NUM_INSTANCES if ( InstancePtr -> Hdcp22Ptr ) { XHdcp22Tx_SetCallback ( InstancePtr -> Hdcp22Ptr , XHDCP22_TX_HANDLER_AUTHENTICATED , ( void * ) ( XHdcp22_Tx_Callback ) CallbackFunc , ( void * ) CallbackRef ) ; } #endif Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_HDCP_DOWNSTREAM_TOPOLOGY_AVAILABLE ) : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetCallBack ( InstancePtr -> Hdcp14Ptr , ( XHdcp1x_HandlerType ) XHDCP1X_RPTR_HDLR_REPEATER_EXCHANGE , ( void * ) ( XHdcp1x_Callback ) CallbackFunc , ( void * ) CallbackRef ) ; } #endif #ifdef XPAR_XHDCP22_TX_NUM_INSTANCES if ( InstancePtr -> Hdcp22Ptr ) { XHdcp22Tx_SetCallback ( InstancePtr -> Hdcp22Ptr , XHDCP22_TX_HANDLER_DOWNSTREAM_TOPOLOGY_AVAILABLE , ( void * ) ( XHdcp22_Tx_Callback ) CallbackFunc , ( void * ) CallbackRef ) ; } #endif Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMITXSS_HANDLER_HDCP_UNAUTHENTICATED ) : #ifdef XPAR_XHDCP_NUM_INSTANCES if ( InstancePtr -> Hdcp14Ptr ) { XHdcp1x_SetCallBack ( InstancePtr -> Hdcp14Ptr , XHDCP1X_HANDLER_UNAUTHENTICATED , ( void * ) ( XHdcp1x_Callback ) CallbackFunc , ( void * ) CallbackRef ) ; } #endif #ifdef XPAR_XHDCP22_TX_NUM_INSTANCES if ( InstancePtr -> Hdcp22Ptr ) { XHdcp22Tx_SetCallback ( InstancePtr -> Hdcp22Ptr , XHDCP22_TX_HANDLER_UNAUTHENTICATED , ( void * ) ( XHdcp22_Tx_Callback ) CallbackFunc , ( void * ) CallbackRef ) ; } #endif Status = ( XST_SUCCESS ) ; break ; default : Status = ( XST_INVALID_PARAM ) ; break ; } return Status ; }
This function installs an asynchronous callback function for the given
HandlerType:
This function installs an asynchronous callback function for the given HandlerType :
/* Verify arguments. */ /* Check for handler type */ // Connect // Toggle // Bridge Unlocked // Bridge Overflow // Bridge Underflow // Vsync // Stream down // Stream up // HDCP authenticated /* Register HDCP 1.4 callbacks */ /* Register HDCP 2.2 callbacks */ // HDCP downstream topology available /** Register HDCP 1.4 callbacks */ /** Register HDCP 2.2 callbacks */ // HDCP unauthenticated /** Register HDCP 1.4 callbacks */ /** Register HDCP 2.2 callbacks */