⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tmdlhdmitx.c

📁 HDMI NXP9983 chipset controller driver
💻 C
📖 第 1 页 / 共 5 页
字号:
    instanceStatusInfoTx[instance].pEventState[event].status = TMDL_HDMITX_EVENT_DISABLED;    /* Release the sempahore */    RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode)    return TM_OK;}/******************************************************************************    \brief Get specifications of a given video format. Application can use           this function to retreives all specifications (frequencies,           resolution, etc.) of a given IA/CEA 861-D video format.           This function is synchronous.           This function is ISR friendly.    \param instance         Instance identifier.    \param resolutionID     ID of the resolution to retrieve specs from.    \param pResolutionSpecs Pointer to the structure receiving specs.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_BAD_INSTANCE: the instance number is wrong or              out of range            - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is              inconsistent            - TMDL_ERR_DLHDMITX_RESOLUTION_UNKNOWN: the resolution is unknown******************************************************************************/tmErrorCode_t tmdlHdmiTxGetVideoFormatSpecs(    tmInstance_t            instance,    tmdlHdmiTxVidFmt_t      resolutionID,    tmdlHdmiTxVidFmtSpecs_t *pResolutionSpecs){    UInt8	i;    Bool    find = False;    /* Check if instance number is in range */    RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE)    /* Check if ResolutionSpecs pointer is Null */    RETIF(pResolutionSpecs == Null, TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS)    for (i = 0; i < gtmdlHdmiTxDriverConfigTable[instance].resolutionNb; i++)    {        if(resolutionID == gtmdlHdmiTxDriverConfigTable[instance].pResolutionInfo[i].resolutionID)        {            find = True;            pResolutionSpecs->height      = gtmdlHdmiTxDriverConfigTable[instance].pResolutionInfo[i].height;            pResolutionSpecs->width       = gtmdlHdmiTxDriverConfigTable[instance].pResolutionInfo[i].width;            pResolutionSpecs->interlaced  = gtmdlHdmiTxDriverConfigTable[instance].pResolutionInfo[i].interlaced;            pResolutionSpecs->vfrequency  = gtmdlHdmiTxDriverConfigTable[instance].pResolutionInfo[i].vfrequency;            pResolutionSpecs->aspectRatio = gtmdlHdmiTxDriverConfigTable[instance].pResolutionInfo[i].aspectRatio;            break;        }    }    /* Resolution not found in table */    RETIF(find == False, TMDL_ERR_DLHDMITX_RESOLUTION_UNKNOWN)    return TM_OK;}/******************************************************************************    \brief Configures all input and output parameters : format, modes, rates,           etc. This is the main configuration function of the driver. Here           are transmitted all crucial input and output parameters of the           device.           This function is synchronous.           This function is not ISR friendly.    \param instance          Instance identifier.    \param videoInputConfig  Configuration of the input video.    \param videoOutputConfig Configuration of the output video.    \param audioInputConfig  Configuration of the input audio.    \param sinkType          Type of sink connected to the output of the Tx.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_BAD_INSTANCE: the instance number is wrong or              out of range            - TMDL_ERR_DLHDMITX_BAD_HANDLE: the handle number is wrong            - TMBSL_ERR_HDMI_BAD_UNIT_NUMBER: bad transmitter unit number            - TMBSL_ERR_HDMI_BAD_PARAMETER: a parameter was out of range            - TMBSL_ERR_HDMI_NOT_INITIALIZED: transmitter not initialized            - TMBSL_ERR_HDMI_I2C_WRITE: failed when writing to the I2C bus            - TMBSL_ERR_HDMI_I2C_READ: failed when reading to the I2C bus            - TMBSL_ERR_HDMI_OPERATION_NOT_PERMITTED: not allowed in DVI mode******************************************************************************/tmErrorCode_t tmdlHdmiTxSetInputOutput(    tmInstance_t                instance,    tmdlHdmiTxVideoInConfig_t   videoInputConfig,    tmdlHdmiTxVideoOutConfig_t  videoOutputConfig,    tmdlHdmiTxAudioInConfig_t   audioInputConfig,    tmdlHdmiTxSinkType_t        sinkType){    tmErrorCode_t           errCode;    UInt8                   pixRepeat;                  /* Pixel repetition */    tmbslHdmiTxVoutDbits_t  pathBits;                   /* Data path bit width */    tmbslHdmiTxPixEdge_t    pixelEdge;                  /* Pixel sampling edge */    tmbslHdmiTxVsMeth_t     syncMethod;                 /* Sync method */    tmbslHdmiTxPixTogl_t    toggle;                     /* Toggling */    UInt8                   syncIn;                     /* Embedded or external */    tmbslHdmiTxPixSubpkt_t  spSync;                     /* Subpacket sync */    tmbslHdmiTxBlnkSrc_t    blankit;                    /* Blanking */    tmbslHdmiTxPixRate_t    pixRateSingleDouble;        /* HDMITX_PIXRATE_SINGLE */    UInt16                  uRefPix;                    /* REFPIX for output */    UInt16                  uRefLine;                   /* REFLINE for output */    UInt16                  uScRefPix;                  /* REFPIX for scaler */    UInt16                  uScRefLine;                 /* REFLINE for scaler */    Bool                    bVerified;                  /* Scaler setting verified */    tmbslHdmiTxTopSel_t     topSel;                     /* Adjustment for interlaced output */    tmbslHdmiTxVsOnce_t     once;                       /* Line/pixel counters sync */    tmbslHdmiTxScaMode_t    scalerMode;                 /* Current scaler mode */    tmdlHdmiTxCapabilities_t audioCapabilities;	    UInt8                   *pSwapTable = Null;         /* Initialized after (depend on video mode used) */    UInt8                   *pMirrorTable = Null;       /* Initialized after (depend on video mode used) */    UInt8                   *pEnaVideoPortTable = Null; /* Initialized after (depend on video mode used) */    UInt8                   *pGndVideoPortTable = Null; /* Initialized after (depend on video mode used) */          /* Check if instance number is in range */    RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE)    /* Take the sempahore */    RETIF( (errCode = tmdlHdmiTxIWSemaphoreP(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode)    /* Update the instance status information */    instanceStatusInfoTx[instance].pVideoInfo->videoInConfig.format       = videoInputConfig.format;    instanceStatusInfoTx[instance].pVideoInfo->videoInConfig.mode         = videoInputConfig.mode;    instanceStatusInfoTx[instance].pVideoInfo->videoInConfig.syncSource   = videoInputConfig.syncSource;    instanceStatusInfoTx[instance].pVideoInfo->videoInConfig.pixelRate    = videoInputConfig.pixelRate;    instanceStatusInfoTx[instance].pVideoInfo->videoOutConfig.format      = videoOutputConfig.format;    instanceStatusInfoTx[instance].pVideoInfo->videoOutConfig.mode        = videoOutputConfig.mode;    instanceStatusInfoTx[instance].pVideoInfo->videoOutConfig.colorDepth  = videoOutputConfig.colorDepth;    /* TODO */    /*instanceStatusInfoTx[instance].pVideoInfo->videoMuteState            = */	/* Audio support */	RETIF_SEM(dlHdmiTxItSemaphore[instance],        (errCode = tmdlHdmiTxGetCapabilitiesM (instance, &audioCapabilities)) != TM_OK, errCode)        /* Test if audio input format is supported */    if ( ((audioInputConfig.format == TMDL_HDMITX_AFMT_OBA) && (audioCapabilities.audioPacket.oneBitAudio == False)) ||	         ((audioInputConfig.format == TMDL_HDMITX_AFMT_DST) && (audioCapabilities.audioPacket.DST == False)) ||             ((audioInputConfig.format == TMDL_HDMITX_AFMT_HBR) && (audioCapabilities.audioPacket.HBR == False)) )    {        /* Release the sempahore */        RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode)        return TMDL_ERR_DLHDMITX_NOT_SUPPORTED;    }    instanceStatusInfoTx[instance].pAudioInfo->audioInCfg.format            = audioInputConfig.format;    instanceStatusInfoTx[instance].pAudioInfo->audioInCfg.i2sFormat         = audioInputConfig.i2sFormat;    instanceStatusInfoTx[instance].pAudioInfo->audioInCfg.i2sQualifier      = audioInputConfig.i2sQualifier;    instanceStatusInfoTx[instance].pAudioInfo->audioInCfg.pixRate           = audioInputConfig.pixRate;    instanceStatusInfoTx[instance].pAudioInfo->audioInCfg.rate              = audioInputConfig.rate;    instanceStatusInfoTx[instance].pAudioInfo->audioInCfg.channelAllocation = audioInputConfig.channelAllocation;    /* TODO */    /*instanceStatusInfoTx[instance].pAudioInfo->audioMuteState            = */    if (sinkType == TMDL_HDMITX_SINK_EDID)    {        /* Change sink type with the currently defined in EDID */        RETIF_SEM(dlHdmiTxItSemaphore[instance],            (errCode = tmbslHdmiTxEdidGetSinkType(instance,             (tmbslHdmiTxSinkType_t *)&sinkType) ) != TM_OK, errCode)    }        if (( sinkType == TMDL_HDMITX_SINK_DVI ) &&        ((videoOutputConfig.format ==  TMDL_HDMITX_VFMT_06_720x480i_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_07_720x480i_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_10_720x480i_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_11_720x480i_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_21_720x576i_50Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_22_720x576i_50Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_25_720x576i_50Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_26_720x576i_50Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_08_720x240p_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_09_720x240p_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_12_720x240p_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_13_720x240p_60Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_23_720x288p_50Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_24_720x288p_50Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_27_720x288p_50Hz) ||         (videoOutputConfig.format ==  TMDL_HDMITX_VFMT_28_720x288p_50Hz)        )       )       /* forbid format with pixel repetition in DVI */    {       /* Release the sempahore */       RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode)                 return TMDL_ERR_DLHDMITX_BAD_PARAMETER;    }    /* Set the TMDS outputs to a forced state */    errCode = tmbslHdmiTxTmdsSetOutputs(instance,         HDMITX_TMDSOUT_FORCED0);    RETIF_SEM(dlHdmiTxItSemaphore[instance], (errCode != TM_OK) && (errCode != TMBSL_ERR_HDMI_NOT_SUPPORTED), errCode)    /* Fine-tune the TMDS serializer */    errCode = tmbslHdmiTxTmdsSetSerializer(instance,         4, 8);    RETIF_SEM(dlHdmiTxItSemaphore[instance], (errCode != TM_OK) && (errCode != TMBSL_ERR_HDMI_NOT_SUPPORTED), errCode)    /* Set video output configuration */    RETIF_SEM(dlHdmiTxItSemaphore[instance],        (errCode = tmbslHdmiTxVideoOutSetConfig(instance,         (tmbslHdmiTxSinkType_t)sinkType, (tmbslHdmiTxVoutMode_t)videoOutputConfig.mode, HDMITX_VOUT_PREFIL_OFF,		HDMITX_VOUT_YUV_BLNK_16, HDMITX_VOUT_QRANGE_FS) ) != TM_OK, errCode)    /* Set default config */    pixRepeat   = HDMITX_PIXREP_DEFAULT;    pathBits    = HDMITX_VOUT_DBITS_12;    pixelEdge   = HDMITX_PIXEDGE_CLK_POS;    syncMethod  = HDMITX_VSMETH_V_H;    toggle      = HDMITX_PIXTOGL_ENABLE;        /* Set sync details */    if (videoInputConfig.syncSource == TMDL_HDMITX_SYNCSRC_EMBEDDED)    {        /* Embedded sync */        syncIn      = EMB;        spSync      = HDMITX_PIXSUBPKT_SYNC_HEMB;        blankit     = HDMITX_BLNKSRC_VS_HEMB_VEMB;        syncMethod  = HDMITX_VSMETH_V_XDE;    }    else    {        /* External sync */        syncIn  = EXT;        spSync  = HDMITX_PIXSUBPKT_SYNC_DE;        blankit = HDMITX_BLNKSRC_NOT_DE;    }    /* Port swap table */    switch(videoInputConfig.mode)    {        case TMDL_HDMITX_VINMODE_CCIR656:            pathBits = HDMITX_VOUT_DBITS_8;            pixelEdge = HDMITX_PIXEDGE_CLK_NEG;            pSwapTable = gtmdlHdmiTxDriverConfigTable[instance].pSwapTableCCIR656;            pMirrorTable = gtmdlHdmiTxDriverConfigTable[instance].pMirrorTableCCIR656;            pEnaVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pEnableVideoPortCCIR656;            pGndVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pGroundVideoPortCCIR656;            break;        case TMDL_HDMITX_VINMODE_RGB444:            pSwapTable = gtmdlHdmiTxDriverConfigTable[instance].pSwapTableRGB444;            pMirrorTable = gtmdlHdmiTxDriverConfigTable[instance].pMirrorTableRGB444;            pEnaVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pEnableVideoPortRGB444;            pGndVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pGroundVideoPortRGB444;            break;        case TMDL_HDMITX_VINMODE_YUV444:            pSwapTable = gtmdlHdmiTxDriverConfigTable[instance].pSwapTableYUV444;            pMirrorTable = gtmdlHdmiTxDriverConfigTable[instance].pMirrorTableYUV444;            pEnaVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pEnableVideoPortYUV444;            pGndVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pGroundVideoPortYUV444;            break;        case TMDL_HDMITX_VINMODE_YUV422:            pSwapTable = gtmdlHdmiTxDriverConfigTable[instance].pSwapTableYUV422;            pMirrorTable = gtmdlHdmiTxDriverConfigTable[instance].pMirrorTableYUV422;            pEnaVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pEnableVideoPortYUV422;            pGndVideoPortTable = gtmdlHdmiTxDriverConfigTable[instance].pGroundVideoPortYUV422;            break;    }    /* Set the audio and video input port configuration */    errCode = tmbslHdmiTxSetVideoPortConfig(instance,        pEnaVideoPortTable, pGndVideoPortTable);    RETIF_SEM(dlHdmiTxItSemaphore[instance], (errCode != TM_OK) && (errCode != TMBSL_ERR_HDMI_NOT_SUPPORTED), errCode)        /* No possible to set the audio clock port config on TDA9983 */        /* Video input mapping */       errCode = tmbslHdmiTxVideoInSetMapping(instance,         pSwapTable, pMirrorTable);    RETIF_SEM(dlHdmiTxItSemaphore[instance], (errCode != TM_OK) && (errCode != TMBSL_ERR_HDMI_NOT_SUPPORTED), errCode)        /* Set fine image position */    RETIF_SEM(dlHdmiTxItSemaphore[instance],(errCode = tmbslHdmiTxVideoInSetFine(instance,spSync, HDMITX_PIXTOGL_NO_ACTION) ) != TM_OK, errCode)    /* Set input blanking */    errCode = tmbslHdmiTxVideoInSetBlanking(instance, blankit, HDMITX_BLNKCODE_ALL_0);    RETIF_SEM(dlHdmiTxItSemaphore[instance], (errCode != TM_OK) && (errCode != TMBSL_ERR_HDMI_NOT_SUPPORTED), errCode)    /* Configure video input options and control the upsampler */    RETIF_SEM(dlHdmiTxItSemaphore[instance],        (errCode = tmbslHdmiTxVideoInSetConfig(instance,         (tmbslHdmiTxVinMode_t)videoInputConfig.mode, /* (tmbslHdmiTxVidFmt_t)videoOutputConfig.format ,*/ pixelEdge, 		(tmbslHdmiTxPixRate_t)videoInputConfig.pixelRate, HDMITX_UPSAMPLE_AUTO) ) != TM_OK, errCode)    /* Only set audio for HDMI, not DVI */    if (sinkType == TMDL_HDMITX_SINK_HDMI)    {        /* Release the sempahore */        RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode)        /* Set audio parameters */        RETIF( (errCode = tmdlHdmiTxSetAudioInput(instance, audioInputConfig, sinkType) ) != TM_OK, errCode)        /* Take the sempahore */       

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -