XilinxProcessorIPLib/drivers/v_hdmirx/src/xv_hdmirx_intr.c
int XV_HdmiRx_SetCallback(XV_HdmiRx *InstancePtr,
		XV_HdmiRx_HandlerType HandlerType,
		void *CallbackFunc,
		void *CallbackRef)
{
    u32 Status;

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

    /* Check for handler type */
    switch (HandlerType) {

        case (XV_HDMIRX_HANDLER_CONNECT):
            InstancePtr->ConnectCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->ConnectRef = CallbackRef;
            InstancePtr->IsConnectCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        case (XV_HDMIRX_HANDLER_AUX):
            InstancePtr->AuxCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->AuxRef = CallbackRef;
            InstancePtr->IsAuxCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        case (XV_HDMIRX_HANDLER_AUD):
            InstancePtr->AudCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->AudRef = CallbackRef;
            InstancePtr->IsAudCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        case (XV_HDMIRX_HANDLER_LNKSTA):
            InstancePtr->LnkStaCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->LnkStaRef = CallbackRef;
            InstancePtr->IsLnkStaCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Ddc
        case (XV_HDMIRX_HANDLER_DDC):
            InstancePtr->DdcCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->DdcRef = CallbackRef;
            InstancePtr->IsDdcCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Stream down
        case (XV_HDMIRX_HANDLER_STREAM_DOWN):
            InstancePtr->StreamDownCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->StreamDownRef = CallbackRef;
            InstancePtr->IsStreamDownCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Stream Init
        case (XV_HDMIRX_HANDLER_STREAM_INIT):
            InstancePtr->StreamInitCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->StreamInitRef = CallbackRef;
            InstancePtr->IsStreamInitCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Stream up
        case (XV_HDMIRX_HANDLER_STREAM_UP):
            InstancePtr->StreamUpCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->StreamUpRef = CallbackRef;
            InstancePtr->IsStreamUpCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // HDCP
        case (XV_HDMIRX_HANDLER_HDCP):
            InstancePtr->HdcpCallback = (XV_HdmiRx_HdcpCallback)CallbackFunc;
            InstancePtr->HdcpRef = CallbackRef;
            InstancePtr->IsHdcpCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // HDCP 1.4 Event
        case (XV_HDMIRX_HANDLER_DDC_HDCP_14_PROT):
            InstancePtr->Hdcp14ProtEvtCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->Hdcp14ProtEvtRef = CallbackRef;
            InstancePtr->IsHdcp14ProtEvtCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // HDCP 2.2 Event
        case (XV_HDMIRX_HANDLER_DDC_HDCP_22_PROT):
            InstancePtr->Hdcp22ProtEvtCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->Hdcp22ProtEvtRef = CallbackRef;
            InstancePtr->IsHdcp22ProtEvtCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        case (XV_HDMIRX_HANDLER_LINK_ERROR):
            InstancePtr->LinkErrorCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->LinkErrorRef = CallbackRef;
            InstancePtr->IsLinkErrorCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Bridge FIFO Overflow
        case (XV_HDMIRX_HANDLER_BRDG_OVERFLOW):
            InstancePtr->BrdgOverflowCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->BrdgOverflowRef = CallbackRef;
            InstancePtr->IsBrdgOverflowCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Sync Loss
        case (XV_HDMIRX_HANDLER_SYNC_LOSS):
            InstancePtr->SyncLossCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->SyncLossRef = CallbackRef;
            InstancePtr->IsSyncLossCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Mode
        case (XV_HDMIRX_HANDLER_MODE):
            InstancePtr->ModeCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->ModeRef = CallbackRef;
            InstancePtr->IsModeCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // TMDS clock ratio
        case (XV_HDMIRX_HANDLER_TMDS_CLK_RATIO):
            InstancePtr->TmdsClkRatioCallback =
                                  (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->TmdsClkRatioRef = CallbackRef;
            InstancePtr->IsTmdsClkRatioCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;

        // Vic Error
        case (XV_HDMIRX_HANDLER_VIC_ERROR):
            InstancePtr->VicErrorCallback =
                                  (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->VicErrorRef = CallbackRef;
            InstancePtr->IsVicErrorCallbackSet = (TRUE);
            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_HDMIRX_HANDLER_VTD)         VtdCallback
* (XV_HDMIRX_HANDLER_AUX)      AuxCallback
* (XV_HDMIRX_HANDLER_AUD)      AudCallback
* (XV_HDMIRX_HANDLER_LNKSTA)   LnkStaCallback
* (XV_HDMIRX_HANDLER_PIO)      PioCallback
* </pre>
*
* @param    InstancePtr is a pointer to the HDMI RX core 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_HdmiRx_SetCallback(XV_HdmiRx *InstancePtr,
		XV_HdmiRx_HandlerType HandlerType,
		void *CallbackFunc,
		void *CallbackRef)
{
    u32 Status;
    Xil_AssertNonvoid(InstancePtr != NULL);
    Xil_AssertNonvoid(HandlerType >= (XV_HDMIRX_HANDLER_CONNECT));
    Xil_AssertNonvoid(CallbackFunc != NULL);
    Xil_AssertNonvoid(CallbackRef != NULL);
    switch (HandlerType) {
        case (XV_HDMIRX_HANDLER_CONNECT):
            InstancePtr->ConnectCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->ConnectRef = CallbackRef;
            InstancePtr->IsConnectCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_AUX):
            InstancePtr->AuxCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->AuxRef = CallbackRef;
            InstancePtr->IsAuxCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_AUD):
            InstancePtr->AudCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->AudRef = CallbackRef;
            InstancePtr->IsAudCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_LNKSTA):
            InstancePtr->LnkStaCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->LnkStaRef = CallbackRef;
            InstancePtr->IsLnkStaCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_DDC):
            InstancePtr->DdcCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->DdcRef = CallbackRef;
            InstancePtr->IsDdcCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_STREAM_DOWN):
            InstancePtr->StreamDownCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->StreamDownRef = CallbackRef;
            InstancePtr->IsStreamDownCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_STREAM_INIT):
            InstancePtr->StreamInitCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->StreamInitRef = CallbackRef;
            InstancePtr->IsStreamInitCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_STREAM_UP):
            InstancePtr->StreamUpCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->StreamUpRef = CallbackRef;
            InstancePtr->IsStreamUpCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_HDCP):
            InstancePtr->HdcpCallback = (XV_HdmiRx_HdcpCallback)CallbackFunc;
            InstancePtr->HdcpRef = CallbackRef;
            InstancePtr->IsHdcpCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
         1.4 Event
        case (XV_HDMIRX_HANDLER_DDC_HDCP_14_PROT):
            InstancePtr->Hdcp14ProtEvtCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->Hdcp14ProtEvtRef = CallbackRef;
            InstancePtr->IsHdcp14ProtEvtCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
         2.2 Event
        case (XV_HDMIRX_HANDLER_DDC_HDCP_22_PROT):
            InstancePtr->Hdcp22ProtEvtCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->Hdcp22ProtEvtRef = CallbackRef;
            InstancePtr->IsHdcp22ProtEvtCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_LINK_ERROR):
            InstancePtr->LinkErrorCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->LinkErrorRef = CallbackRef;
            InstancePtr->IsLinkErrorCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_BRDG_OVERFLOW):
            InstancePtr->BrdgOverflowCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->BrdgOverflowRef = CallbackRef;
            InstancePtr->IsBrdgOverflowCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_SYNC_LOSS):
            InstancePtr->SyncLossCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->SyncLossRef = CallbackRef;
            InstancePtr->IsSyncLossCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_MODE):
            InstancePtr->ModeCallback = (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->ModeRef = CallbackRef;
            InstancePtr->IsModeCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_TMDS_CLK_RATIO):
            InstancePtr->TmdsClkRatioCallback =
                                  (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->TmdsClkRatioRef = CallbackRef;
            InstancePtr->IsTmdsClkRatioCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        case (XV_HDMIRX_HANDLER_VIC_ERROR):
            InstancePtr->VicErrorCallback =
                                  (XV_HdmiRx_Callback)CallbackFunc;
            InstancePtr->VicErrorRef = CallbackRef;
            InstancePtr->IsVicErrorCallbackSet = (TRUE);
            Status = (XST_SUCCESS);
            break;
        default:
            Status = (XST_INVALID_PARAM);
            break;
    }
    return Status;
}
int XV_HdmiRx_SetCallback ( XV_HdmiRx * InstancePtr , XV_HdmiRx_HandlerType HandlerType , void * CallbackFunc , void * CallbackRef ) { u32 Status ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( HandlerType >= ( XV_HDMIRX_HANDLER_CONNECT ) ) ; Xil_AssertNonvoid ( CallbackFunc != NULL ) ; Xil_AssertNonvoid ( CallbackRef != NULL ) ; switch ( HandlerType ) { case ( XV_HDMIRX_HANDLER_CONNECT ) : InstancePtr -> ConnectCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> ConnectRef = CallbackRef ; InstancePtr -> IsConnectCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_AUX ) : InstancePtr -> AuxCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> AuxRef = CallbackRef ; InstancePtr -> IsAuxCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_AUD ) : InstancePtr -> AudCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> AudRef = CallbackRef ; InstancePtr -> IsAudCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_LNKSTA ) : InstancePtr -> LnkStaCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> LnkStaRef = CallbackRef ; InstancePtr -> IsLnkStaCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_DDC ) : InstancePtr -> DdcCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> DdcRef = CallbackRef ; InstancePtr -> IsDdcCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_STREAM_DOWN ) : InstancePtr -> StreamDownCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> StreamDownRef = CallbackRef ; InstancePtr -> IsStreamDownCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_STREAM_INIT ) : InstancePtr -> StreamInitCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> StreamInitRef = CallbackRef ; InstancePtr -> IsStreamInitCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_STREAM_UP ) : InstancePtr -> StreamUpCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> StreamUpRef = CallbackRef ; InstancePtr -> IsStreamUpCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_HDCP ) : InstancePtr -> HdcpCallback = ( XV_HdmiRx_HdcpCallback ) CallbackFunc ; InstancePtr -> HdcpRef = CallbackRef ; InstancePtr -> IsHdcpCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_DDC_HDCP_14_PROT ) : InstancePtr -> Hdcp14ProtEvtCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> Hdcp14ProtEvtRef = CallbackRef ; InstancePtr -> IsHdcp14ProtEvtCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_DDC_HDCP_22_PROT ) : InstancePtr -> Hdcp22ProtEvtCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> Hdcp22ProtEvtRef = CallbackRef ; InstancePtr -> IsHdcp22ProtEvtCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_LINK_ERROR ) : InstancePtr -> LinkErrorCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> LinkErrorRef = CallbackRef ; InstancePtr -> IsLinkErrorCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_BRDG_OVERFLOW ) : InstancePtr -> BrdgOverflowCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> BrdgOverflowRef = CallbackRef ; InstancePtr -> IsBrdgOverflowCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_SYNC_LOSS ) : InstancePtr -> SyncLossCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> SyncLossRef = CallbackRef ; InstancePtr -> IsSyncLossCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_MODE ) : InstancePtr -> ModeCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> ModeRef = CallbackRef ; InstancePtr -> IsModeCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_TMDS_CLK_RATIO ) : InstancePtr -> TmdsClkRatioCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> TmdsClkRatioRef = CallbackRef ; InstancePtr -> IsTmdsClkRatioCallbackSet = ( TRUE ) ; Status = ( XST_SUCCESS ) ; break ; case ( XV_HDMIRX_HANDLER_VIC_ERROR ) : InstancePtr -> VicErrorCallback = ( XV_HdmiRx_Callback ) CallbackFunc ; InstancePtr -> VicErrorRef = CallbackRef ; InstancePtr -> IsVicErrorCallbackSet = ( TRUE ) ; 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 */ // Ddc // Stream down // Stream Init // Stream up // HDCP // HDCP 1.4 Event // HDCP 2.2 Event // Bridge FIFO Overflow // Sync Loss // Mode // TMDS clock ratio // Vic Error