XilinxProcessorIPLib/drivers/v_hdmirx/src/xv_hdmirx_intr.c
static void HdmiRx_TmrIntrHandler(XV_HdmiRx *InstancePtr)
{
    u32 Status;

    /* Read Status register */
    Status = XV_HdmiRx_ReadReg(InstancePtr->Config.BaseAddress, (XV_HDMIRX_TMR_STA_OFFSET));

    /* Check for counter event */
    if ((Status) & (XV_HDMIRX_TMR_STA_CNT_EVT_MASK)) {

        // Clear counter event
        XV_HdmiRx_WriteReg(InstancePtr->Config.BaseAddress, (XV_HDMIRX_TMR_STA_OFFSET), (XV_HDMIRX_TMR_STA_CNT_EVT_MASK));

        // Idle state
        if (InstancePtr->Stream.State == XV_HDMIRX_STATE_STREAM_IDLE) {

            // The link is stable now
            // Then the aux and audio peripherals can be enabled
            XV_HdmiRx_AuxEnable(InstancePtr);
            XV_HdmiRx_AudioEnable(InstancePtr);

			/* Release HDMI RX core resets */
			XV_HdmiRx_INT_VRST(InstancePtr, FALSE);
			XV_HdmiRx_INT_LRST(InstancePtr, FALSE);

            // Enable link
            XV_HdmiRx_LinkEnable(InstancePtr, (TRUE));

            // Set stream status to init
            InstancePtr->Stream.State = XV_HDMIRX_STATE_STREAM_INIT;    // The stream init

            // Clear GetVideoPropertiesTries
            InstancePtr->Stream.GetVideoPropertiesTries = 0;

            // Load timer - 200 ms (one UHD frame is 40 ms, 5 frames)
            XV_HdmiRx_TmrStart(InstancePtr,
			XV_HdmiRx_GetTime200Ms(InstancePtr));
        }

        // Init state
        else if (InstancePtr->Stream.State == XV_HDMIRX_STATE_STREAM_INIT) {

            // Read video properties
            if (XV_HdmiRx_GetVideoProperties(InstancePtr) == XST_SUCCESS) {

            // Now we know the reference clock and color depth,
            // the pixel clock can be calculated
            // In case of YUV 422 the reference clock is the pixel clock
            if (InstancePtr->Stream.Video.ColorFormatId == XVIDC_CSF_YCRCB_422) {
                InstancePtr->Stream.PixelClk = InstancePtr->Stream.RefClk;
            }

            // For the other color spaces the pixel clock needs to be adjusted
            else {

                switch (InstancePtr->Stream.Video.ColorDepth) {
                    case XVIDC_BPC_10:
                        InstancePtr->Stream.PixelClk = (InstancePtr->Stream.RefClk * 4)/5;
                        break;

                    case XVIDC_BPC_12:
                        InstancePtr->Stream.PixelClk = (InstancePtr->Stream.RefClk * 2)/3;
                        break;

                    case XVIDC_BPC_16:
                        InstancePtr->Stream.PixelClk = InstancePtr->Stream.RefClk / 2;
                        break;

                    default:
                        InstancePtr->Stream.PixelClk = InstancePtr->Stream.RefClk;
                        break;
                }
            }

				// Call stream init callback
				if (InstancePtr->IsStreamInitCallbackSet) {
					InstancePtr->StreamInitCallback(InstancePtr->StreamInitRef);
				}
			}

            else {
		// Load timer - 200 ms (one UHD frame is 40 ms, 5 frames)
                XV_HdmiRx_TmrStart(InstancePtr,
				XV_HdmiRx_GetTime200Ms(InstancePtr));
            }
        }

        // Armed state
        else if (InstancePtr->Stream.State == XV_HDMIRX_STATE_STREAM_ARM) {

            /* Enable VTD */
            XV_HdmiRx_VtdEnable(InstancePtr);

            /* Enable interrupt */
            XV_HdmiRx_VtdIntrEnable(InstancePtr);

            // Set stream status to lock
            InstancePtr->Stream.State = XV_HDMIRX_STATE_STREAM_LOCK;
        }
    }
}
/*****************************************************************************/
/**
*
* This function is the interrupt handler for the HDMI RX TMR peripheral.
*
* @param    InstancePtr is a pointer to the XV_HdmiRx core instance.
*
* @return   None.
*
* @note     None.
*
******************************************************************************/
This function is the interrupt handler for the HDMI RX TMR peripheral.
This function is the interrupt handler for the HDMI RX TMR peripheral .
static void HdmiRx_TmrIntrHandler(XV_HdmiRx *InstancePtr)
{
    u32 Status;
    Status = XV_HdmiRx_ReadReg(InstancePtr->Config.BaseAddress, (XV_HDMIRX_TMR_STA_OFFSET));
    if ((Status) & (XV_HDMIRX_TMR_STA_CNT_EVT_MASK)) {
        XV_HdmiRx_WriteReg(InstancePtr->Config.BaseAddress, (XV_HDMIRX_TMR_STA_OFFSET), (XV_HDMIRX_TMR_STA_CNT_EVT_MASK));
        if (InstancePtr->Stream.State == XV_HDMIRX_STATE_STREAM_IDLE) {
            XV_HdmiRx_AuxEnable(InstancePtr);
            XV_HdmiRx_AudioEnable(InstancePtr);
			XV_HdmiRx_INT_VRST(InstancePtr, FALSE);
			XV_HdmiRx_INT_LRST(InstancePtr, FALSE);
            XV_HdmiRx_LinkEnable(InstancePtr, (TRUE));
            InstancePtr->Stream.State = XV_HDMIRX_STATE_STREAM_INIT;    
            InstancePtr->Stream.GetVideoPropertiesTries = 0;
            XV_HdmiRx_TmrStart(InstancePtr,
			XV_HdmiRx_GetTime200Ms(InstancePtr));
        }
        else if (InstancePtr->Stream.State == XV_HDMIRX_STATE_STREAM_INIT) {
            if (XV_HdmiRx_GetVideoProperties(InstancePtr) == XST_SUCCESS) {
            if (InstancePtr->Stream.Video.ColorFormatId == XVIDC_CSF_YCRCB_422) {
                InstancePtr->Stream.PixelClk = InstancePtr->Stream.RefClk;
            }
            else {
                switch (InstancePtr->Stream.Video.ColorDepth) {
                    case XVIDC_BPC_10:
                        InstancePtr->Stream.PixelClk = (InstancePtr->Stream.RefClk * 4)/5;
                        break;
                    case XVIDC_BPC_12:
                        InstancePtr->Stream.PixelClk = (InstancePtr->Stream.RefClk * 2)/3;
                        break;
                    case XVIDC_BPC_16:
                        InstancePtr->Stream.PixelClk = InstancePtr->Stream.RefClk / 2;
                        break;
                    default:
                        InstancePtr->Stream.PixelClk = InstancePtr->Stream.RefClk;
                        break;
                }
            }
				if (InstancePtr->IsStreamInitCallbackSet) {
					InstancePtr->StreamInitCallback(InstancePtr->StreamInitRef);
				}
			}
            else {
                XV_HdmiRx_TmrStart(InstancePtr,
				XV_HdmiRx_GetTime200Ms(InstancePtr));
            }
        }
        else if (InstancePtr->Stream.State == XV_HDMIRX_STATE_STREAM_ARM) {
            XV_HdmiRx_VtdEnable(InstancePtr);
            XV_HdmiRx_VtdIntrEnable(InstancePtr);
            InstancePtr->Stream.State = XV_HDMIRX_STATE_STREAM_LOCK;
        }
    }
}
static void HdmiRx_TmrIntrHandler ( XV_HdmiRx * InstancePtr ) { u32 Status ; Status = XV_HdmiRx_ReadReg ( InstancePtr -> Config . BaseAddress , ( XV_HDMIRX_TMR_STA_OFFSET ) ) ; if ( ( Status ) & ( XV_HDMIRX_TMR_STA_CNT_EVT_MASK ) ) { XV_HdmiRx_WriteReg ( InstancePtr -> Config . BaseAddress , ( XV_HDMIRX_TMR_STA_OFFSET ) , ( XV_HDMIRX_TMR_STA_CNT_EVT_MASK ) ) ; if ( InstancePtr -> Stream . State == XV_HDMIRX_STATE_STREAM_IDLE ) { XV_HdmiRx_AuxEnable ( InstancePtr ) ; XV_HdmiRx_AudioEnable ( InstancePtr ) ; XV_HdmiRx_INT_VRST ( InstancePtr , FALSE ) ; XV_HdmiRx_INT_LRST ( InstancePtr , FALSE ) ; XV_HdmiRx_LinkEnable ( InstancePtr , ( TRUE ) ) ; InstancePtr -> Stream . State = XV_HDMIRX_STATE_STREAM_INIT ; InstancePtr -> Stream . GetVideoPropertiesTries = 0 ; XV_HdmiRx_TmrStart ( InstancePtr , XV_HdmiRx_GetTime200Ms ( InstancePtr ) ) ; } else if ( InstancePtr -> Stream . State == XV_HDMIRX_STATE_STREAM_INIT ) { if ( XV_HdmiRx_GetVideoProperties ( InstancePtr ) == XST_SUCCESS ) { if ( InstancePtr -> Stream . Video . ColorFormatId == XVIDC_CSF_YCRCB_422 ) { InstancePtr -> Stream . PixelClk = InstancePtr -> Stream . RefClk ; } else { switch ( InstancePtr -> Stream . Video . ColorDepth ) { case XVIDC_BPC_10 : InstancePtr -> Stream . PixelClk = ( InstancePtr -> Stream . RefClk * 4 ) / 5 ; break ; case XVIDC_BPC_12 : InstancePtr -> Stream . PixelClk = ( InstancePtr -> Stream . RefClk * 2 ) / 3 ; break ; case XVIDC_BPC_16 : InstancePtr -> Stream . PixelClk = InstancePtr -> Stream . RefClk / 2 ; break ; default : InstancePtr -> Stream . PixelClk = InstancePtr -> Stream . RefClk ; break ; } } if ( InstancePtr -> IsStreamInitCallbackSet ) { InstancePtr -> StreamInitCallback ( InstancePtr -> StreamInitRef ) ; } } else { XV_HdmiRx_TmrStart ( InstancePtr , XV_HdmiRx_GetTime200Ms ( InstancePtr ) ) ; } } else if ( InstancePtr -> Stream . State == XV_HDMIRX_STATE_STREAM_ARM ) { XV_HdmiRx_VtdEnable ( InstancePtr ) ; XV_HdmiRx_VtdIntrEnable ( InstancePtr ) ; InstancePtr -> Stream . State = XV_HDMIRX_STATE_STREAM_LOCK ; } } }
This function is the interrupt handler for the HDMI RX TMR peripheral.
This function is the interrupt handler for the HDMI RX TMR peripheral .
/* Read Status register */ /* Check for counter event */ // Clear counter event // Idle state // The link is stable now // Then the aux and audio peripherals can be enabled /* Release HDMI RX core resets */ // Enable link // Set stream status to init // The stream init // Clear GetVideoPropertiesTries // Load timer - 200 ms (one UHD frame is 40 ms, 5 frames) // Init state // Read video properties // Now we know the reference clock and color depth, // the pixel clock can be calculated // In case of YUV 422 the reference clock is the pixel clock // For the other color spaces the pixel clock needs to be adjusted // Call stream init callback // Load timer - 200 ms (one UHD frame is 40 ms, 5 frames) // Armed state /* Enable VTD */ /* Enable interrupt */ // Set stream status to lock