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

📄 tmdlhdmitx.c

📁 HDMI NXP9983 chipset controller driver
💻 C
📖 第 1 页 / 共 5 页
字号:
#endif /* NO_HDCP *//* EDID status */UInt8 edidDataStatus = HDMITX_EDID_NOT_READ;/* Flag set in case HDP ACTIVE is detected during initialization */Bool eventHPDActiveFlag = False;/* To remove the warnings */UInt8 gNoWarning;static Bool gI2CDebugAccessesEnabled = True; /* For debug purpose only, used to manage underlying I2C accessed *//*============================================================================*//*                              FUNCTIONS                                     *//*============================================================================*//******************************************************************************    \brief Get the software version of the driver.    \param pSWVersion Pointer to the version structure.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is              inconsistent******************************************************************************/tmErrorCode_t tmdlHdmiTxGetSWVersion(    tmSWVersion_t   *pSWVersion){    /* Check if SWVersion pointer is Null */    RETIF(pSWVersion == Null, TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS)    /* Copy SW version */    pSWVersion->compatibilityNr = VERSION_COMPATIBILITY;    pSWVersion->majorVersionNr = VERSION_MAJOR;    pSWVersion->minorVersionNr = VERSION_MINOR;    return TM_OK;}/******************************************************************************    \brief Get the number of available HDMI transmitters devices in the system.           A unit directly represents a physical device.    \param pUnitCount Pointer to the number of available units.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is              inconsistent******************************************************************************/tmErrorCode_t tmdlHdmiTxGetNumberOfUnits(    UInt32  *pUnitCount){    /* Check if UnitCount pointer is Null */    RETIF(pUnitCount == Null, TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS)    /* Copy the maximum number of units */    *pUnitCount = MAX_UNITS;    return TM_OK;}/******************************************************************************    \brief Get the capabilities of unit 0. Capabilities are stored into a           dedicated structure and are directly read from the HW device.    \param pCapabilities Pointer to the capabilities structure.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_BAD_UNIT_NUMBER: the unit number is wrong or              the receiver instance is not initialised            - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is              inconsistent            - TMDL_ERR_DLHDMITX_BAD_PARAMETER: a parameter is invalid or out              of range            - 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******************************************************************************/tmErrorCode_t tmdlHdmiTxGetCapabilities(    tmdlHdmiTxCapabilities_t    *pCapabilities){    /* Directly call GetCapabilitiesM function for unit 0 and return the result */    return(tmdlHdmiTxGetCapabilitiesM((tmUnitSelect_t)0, pCapabilities));}/******************************************************************************    \brief Get the capabilities of a specific unit. Capabilities are stored           into a dedicated structure and are directly read from the HW           device.    \param unit          Unit to be probed.    \param pCapabilities Pointer to the capabilities structure.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_BAD_UNIT_NUMBER: the unit number is wrong or              the receiver instance is not initialised            - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is              inconsistent            - TMDL_ERR_DLHDMITX_BAD_PARAMETER: a parameter is invalid or out              of range            - 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******************************************************************************/tmErrorCode_t tmdlHdmiTxGetCapabilitiesM(   tmUnitSelect_t           unit,   tmdlHdmiTxCapabilities_t *pCapabilities){    tmErrorCode_t   errCode = TM_OK;    tmbslHdmiTxHwFeature_t  bslDeviceCapabilities;    /* Check if unit number is in range */    RETIF((unit < 0) || (unit >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_UNIT_NUMBER)    /* Check if Capalities pointer is Null */    RETIF(pCapabilities == Null, TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS)    /* Device version */    pCapabilities->deviceVersion = unitTableTx[unit].deviceVersion ;    /* Retrieve the capabilities from the BSL layer */   	RETIF( (errCode = tmbslHdmiTxHwGetCapabilities(unit, &bslDeviceCapabilities) ) != TM_OK, errCode)	switch (bslDeviceCapabilities)	{		case tmbslHdmiTxHwNone:    /* None           feature */			pCapabilities->hdcp = False;			pCapabilities->scaler = False;			pCapabilities->audioPacket.HBR = False;			pCapabilities->audioPacket.oneBitAudio = True;			pCapabilities->audioPacket.DST = False;			pCapabilities->hdmiVersion = TMDL_HDMITX_HDMI_VERSION_1_2a;			pCapabilities->colorDepth = TMDL_HDMITX_COLORDEPTH_24; 			break;		case tmbslHdmiTxHwHDCP:    /* HDCP           feature */			pCapabilities->hdcp = True;			pCapabilities->scaler = False;			pCapabilities->audioPacket.HBR = False;			pCapabilities->audioPacket.oneBitAudio = True;			pCapabilities->audioPacket.DST = False;			pCapabilities->hdmiVersion = TMDL_HDMITX_HDMI_VERSION_1_2a;			pCapabilities->colorDepth = TMDL_HDMITX_COLORDEPTH_24; 			break;		case tmbslHdmiTxHwScaler:  /* Scaler         feature */			pCapabilities->hdcp = False;			pCapabilities->scaler = True;			pCapabilities->audioPacket.HBR = False;			pCapabilities->audioPacket.oneBitAudio = True;			pCapabilities->audioPacket.DST = False;			pCapabilities->hdmiVersion = TMDL_HDMITX_HDMI_VERSION_1_2a;			pCapabilities->colorDepth = TMDL_HDMITX_COLORDEPTH_24; 			break;		case tmbslHdmiTxHwHDCPScaler:   /* HDCP & Scaler  feature  */			pCapabilities->hdcp = True;			pCapabilities->scaler = True;			pCapabilities->audioPacket.HBR = False;			pCapabilities->audioPacket.oneBitAudio = True;			pCapabilities->audioPacket.DST = False;			pCapabilities->hdmiVersion = TMDL_HDMITX_HDMI_VERSION_1_2a;			pCapabilities->colorDepth = TMDL_HDMITX_COLORDEPTH_24; 			break;	}	    return errCode;}/******************************************************************************    \brief Open unit 0 of HdmiTx driver and provides the instance number to           the caller. Note that one unit of HdmiTx represents one physical           HDMI transmitter and that only one instance per unit can be opened.    \param pInstance Pointer to the variable that will receive the instance                     identifier.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_BAD_UNIT_NUMBER: the unit number is wrong or              the transmitter instance is not initialised            - TMDL_ERR_DLHDMITX_BAD_HANDLE: the handle number is wrong            - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is              inconsistent            - TMDL_ERR_DLHDMITX_RESOURCE_OWNED: the resource is already in use            - TMDL_ERR_DLHDMITX_INVALID_STATE: the state is invalid for              the function            - TMDL_ERR_DLHDMITX_INIT_FAILED: the unit instance is already              initialised or something wrong happened at lower level.            - TMDL_ERR_DLHDMITX_NO_RESOURCES: the resource is not available            - TMBSL_ERR_HDMI_BAD_UNIT_NUMBER: bad transmitter unit number             - TMBSL_ERR_HDMI_NOT_INITIALIZED: the unit is not initialized            - TMBSL_ERR_HDMI_BAD_PARAMETER: a parameter is invalid or out               of range            - TMBSL_ERR_HDMI_INIT_FAILED: the unit instance is already               initialised            - TMBSL_ERR_HDMI_COMPATIBILITY: the driver is not compatiable               with the internal device version code            - TMBSL_ERR_HDMI_I2C_WRITE: failed when writing to the I2C bus            - TMBSL_ERR_HDMI_I2C_READ: failed when reading the I2C bus******************************************************************************/tmErrorCode_t tmdlHdmiTxOpen(    tmInstance_t   *pInstance){    /* Directly call OpenM function for unit 0 and return the result */    return(tmdlHdmiTxOpenM(pInstance, (tmUnitSelect_t)0));}/******************************************************************************    \brief Open a specific unit of HdmiTx driver and provides the instance           number to the caller. Note that one unit of HdmiTx represents one           physical HDMI transmitter and that only one instance per unit can be           opened. This function switches driver's state machine to           "initialized" state.    \param pInstance Pointer to the structure that will receive the instance                     identifier.    \param unit      Unit number to be opened.    \return The call result:            - TM_OK: the call was successful            - TMDL_ERR_DLHDMITX_BAD_UNIT_NUMBER: the unit number is wrong or              the transmitter instance is not initialised            - TMDL_ERR_DLHDMITX_BAD_HANDLE: the handle number is wrong            - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is              inconsistent            - TMDL_ERR_DLHDMITX_RESOURCE_OWNED: the resource is already in use            - TMDL_ERR_DLHDMITX_INVALID_STATE: the state is invalid for              the function            - TMDL_ERR_DLHDMITX_INIT_FAILED: the unit instance is already              initialised or something wrong happened at lower level.            - TMDL_ERR_DLHDMITX_NO_RESOURCES: the resource is not available            - TMBSL_ERR_HDMI_BAD_UNIT_NUMBER: bad transmitter unit number             - TMBSL_ERR_HDMI_NOT_INITIALIZED: the unit is not initialized            - TMBSL_ERR_HDMI_BAD_PARAMETER: a parameter is invalid or out               of range            - TMBSL_ERR_HDMI_INIT_FAILED: the unit instance is already               initialised            - TMBSL_ERR_HDMI_COMPATIBILITY: the driver is not compatiable               with the internal device version code            - TMBSL_ERR_HDMI_I2C_WRITE: failed when writing to the I2C bus            - TMBSL_ERR_HDMI_I2C_READ: failed when reading the I2C bus******************************************************************************/tmErrorCode_t tmdlHdmiTxOpenM(    tmInstance_t   *pInstance,    tmUnitSelect_t  unit){    tmErrorCode_t           errCode;    UInt16                  i;    UInt8                   deviceVersion;    tmbslHdmiTxHwFeature_t  featureSupported;    /* Check if unit number is in range */    RETIF((unit < 0) || (unit >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_UNIT_NUMBER)    /* Check if Instance pointer is Null */    RETIF(pInstance == Null, TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS)        /* Create the semaphore to protect variables modified under interruption */    RETIF( (errCode = tmdlHdmiTxIWSemaphoreCreate(&dlHdmiTxItSemaphore[unit]) ) != TM_OK, errCode)    /* Take the sempahore */    RETIF( (errCode = tmdlHdmiTxIWSemaphoreP(dlHdmiTxItSemaphore[unit]) ) != TM_OK, errCode)    /* Check if unit is already instanciated */    RETIF_SEM(dlHdmiTxItSemaphore[unit],        unitTableTx[unit].opened == True, TMDL_ERR_DLHDMITX_RESOURCE_OWNED)    /* Check the state */    RETIF_SEM(dlHdmiTxItSemaphore[unit],         dlHdmiTxGetState(unit) != STATE_NOT_INITIALIZED, TMDL_ERR_DLHDMITX_INVALID_STATE) 	/* Instanciate unit and return corresponding instance number */    /* Since HW unit are only instanciable once, instance = unit */    unitTableTx[unit].opened          = True;    unitTableTx[unit].hdcpEnable      = False;    unitTableTx[unit].repeaterEnable  = False;    unitTableTx[unit].deviceVersion   = TMDL_HDMITX_DEVICE_UNKNOWN;    unitTableTx[unit].simplayHd       = False;    unitTableTx[unit].pCallback       = Null;    unitTableTx[unit].revocationList.pList  = Null;    unitTableTx[unit].revocationList.length = 0;        /* Recover the configuration of the device library */    RETIF_SEM(dlHdmiTxItSemaphore[unit],        tmdlHdmiTxCfgGetConfig(unit, &gtmdlHdmiTxDriverConfigTable[unit])!= TM_OK, TMDL_ERR_DLHDMITX_INIT_FAILED)        /* Create message queue associated to this instance/unit */    RETIF_SEM(dlHdmiTxItSemaphore[unit],        tmdlHdmiTxIWQueueCreate(gtmdlHdmiTxDriverConfigTable[unit].commandTaskQueueSize,        &(unitTableTx[unit].queueHandle)) != TM_OK, TMDL_ERR_DLHDMITX_NO_RESOURCES)    /* Create the command task associated to this instance/unit */    RETIF_SEM(dlHdmiTxItSemaphore[unit],        tmdlHdmiTxIWTaskCreate(commandTaskTableTx[unit],        gtmdlHdmiTxDriverConfigTable[unit].commandTaskPriority,        gtmdlHdmiTxDriverConfigTable[unit].commandTaskStackSize,        &(unitTableTx[unit].commandTaskHandle)) != TM_OK, TMDL_ERR_DLHDMITX_NO_RESOURCES)

⌨️ 快捷键说明

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