📄 tmdlhdmitx.c
字号:
RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) return TM_OK;}/****************************************************************************** \brief Set the configuration of instance attributes. This function is required by DVP architecture rules but actually does nothing in this driver. \param instance Instance identifier. \return The call result: - TM_OK: the call was successful - TMDL_ERR_DLHDMITX_BAD_INSTANCE: the instance number is wrong or out of range******************************************************************************/tmErrorCode_t tmdlHdmiTxInstanceConfig( tmInstance_t instance){ /* Check if instance number is in range */ RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE) return TM_OK;}/****************************************************************************** \brief Setup the instance with its configuration parameters. This function allows basic instance configuration like enabling HDCP, choosing HDCP encryption mode or enabling HDCP repeater mode. \param instance Instance identifier. \param pSetupInfo Pointer to the structure containing all setup parameters. \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 - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is inconsistent - TMDL_ERR_DLHDMITX_RESOURCE_NOT_OWNED: the caller does not own the resource - TMDL_ERR_DLHDMITX_INVALID_STATE: the state is invalid for the function******************************************************************************/tmErrorCode_t tmdlHdmiTxInstanceSetup( tmInstance_t instance, tmdlHdmiTxInstanceSetupInfo_t *pSetupInfo){ tmErrorCode_t errCode; UInt16 i; /* Check if instance number is in range */ RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE) /* Check if SetupInfo pointer is NULL */ RETIF(pSetupInfo == Null, TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS) /* Take the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreP(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) /* Check if unit corresponding to instance is opened */ RETIF_SEM(dlHdmiTxItSemaphore[instance], unitTableTx[instance].opened == False, TMDL_ERR_DLHDMITX_RESOURCE_NOT_OWNED) /* Check the state */ RETIF_SEM(dlHdmiTxItSemaphore[instance], dlHdmiTxGetState(instance) != STATE_INITIALIZED, TMDL_ERR_DLHDMITX_INVALID_STATE) unitTableTx[instance].repeaterEnable = pSetupInfo->repeaterEnable; unitTableTx[instance].simplayHd = pSetupInfo->simplayHd; unitTableTx[instance].pEdidBuffer = pSetupInfo->pEdidBuffer; unitTableTx[instance].edidBufferSize = pSetupInfo->edidBufferSize; #ifndef NO_HDCP /* Reset HDCP DevLib data */ hdcpInfoListTx[instance].hdcpCheckState = TMDL_HDMITX_HDCP_CHECK_NOT_STARTED; hdcpInfoListTx[instance].hdcpErrorState = 0; hdcpInfoListTx[instance].hdcpKsvDevices = 0; hdcpInfoListTx[instance].bKsvSecure = False; for(i=0; i<TMDL_HDMITX_KSV_BYTES_PER_DEVICE; i++) { hdcpInfoListTx[instance].hdcpBksv[i] = 0; }#endif /* NO_HDCP */ /* Set state machine to Unplugged */ dlHdmiTxSetState(instance, STATE_UNPLUGGED); if (eventHPDActiveFlag == True) { /* if the HPD active was rased during the initialisation, raise the event HPD */ dlHdmiTxHandleHPD (instance); eventHPDActiveFlag = False; } /* Release the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) return TM_OK;}/****************************************************************************** \brief Get instance setup parameters. \param instance Instance identifier. \param pSetupInfo Pointer to the structure that will receive setup parameters. \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 - TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS: an input parameter is inconsistent - TMDL_ERR_DLHDMITX_RESOURCE_NOT_OWNED: the caller does not own the resource******************************************************************************/tmErrorCode_t tmdlHdmiTxGetInstanceSetup( tmInstance_t instance, tmdlHdmiTxInstanceSetupInfo_t *pSetupInfo){ tmErrorCode_t errCode; /* Check if instance number is in range */ RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE) /* Check if SetupInfo pointer is NULL */ RETIF(pSetupInfo == Null, TMDL_ERR_DLHDMITX_INCONSISTENT_PARAMS) /* Take the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreP(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) /* Check if unit corresponding to instance is opened */ RETIF_SEM(dlHdmiTxItSemaphore[instance], unitTableTx[instance].opened == False, TMDL_ERR_DLHDMITX_RESOURCE_NOT_OWNED) pSetupInfo->simplayHd = unitTableTx[instance].simplayHd; pSetupInfo->repeaterEnable = unitTableTx[instance].repeaterEnable; /* JL, TODO */ /* Release the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) return TM_OK;}/****************************************************************************** \brief Make device library handle an incoming interrupt. This function is used by application to tell the device library that the hardware sent an interrupt. \param instance Instance identifier. \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 - TMDL_ERR_DLHDMITX_RESOURCE_NOT_OWNED: the caller does not own the resource - TMDL_ERR_DLHDMITX_FULL: the queue is full ******************************************************************************/tmErrorCode_t tmdlHdmiTxHandleInterrupt( tmInstance_t instance){ tmErrorCode_t errCode; UInt8 message = 0; /* Check if instance number is in range */ RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE) RETIF( (errCode = tmdlHdmiTxIWQueueSend(unitTableTx[instance].queueHandle, message)) != TM_OK, errCode) /* Disable interrupts for Tx until the callbacks have been done by the command task */ switch(instance) { case INSTANCE_0: tmdlHdmiTxIWDisableInterrupts(TMDL_HDMI_IW_TX_1); break; case INSTANCE_1: tmdlHdmiTxIWDisableInterrupts(TMDL_HDMI_IW_TX_2); break; default: return TMDL_ERR_DLHDMITX_BAD_INSTANCE; } return TM_OK;}/****************************************************************************** \brief Register event callbacks. Only one callback is registered through this API. This callback will received the type of event that occured throug a dedicated parameter and will be called as many times as there is pending events. This function is synchronous. This function is ISR friendly. \param instance Instance identifier. \param pCallback Pointer to the callback function that will handle events from the devlib. \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 - TMDL_ERR_DLHDMITX_RESOURCE_NOT_OWNED: the caller does not own the resource - TMDL_ERR_DLHDMITX_INVALID_STATE: the state is invalid for the function******************************************************************************/tmErrorCode_t tmdlHdmiTxRegisterCallbacks( tmInstance_t instance, ptmdlHdmiTxCallback_t pCallback){ tmErrorCode_t errCode; /* 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) /* Check if unit corresponding to instance is opened */ RETIF_SEM(dlHdmiTxItSemaphore[instance], unitTableTx[instance].opened == False, TMDL_ERR_DLHDMITX_RESOURCE_NOT_OWNED) /* Check if instance state is correct */ RETIF_SEM(dlHdmiTxItSemaphore[instance], dlHdmiTxGetState(instance) != STATE_INITIALIZED, TMDL_ERR_DLHDMITX_INVALID_STATE) /* Store callback pointers */ unitTableTx[instance].pCallback = pCallback; /* Release the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) return TM_OK;}/****************************************************************************** \brief This function allows enabling a specific event. By default, all events are disabled, except input lock. \param instance Instance identifier. \param event Event to enable. \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******************************************************************************/tmErrorCode_t tmdlHdmiTxEnableEvent( tmInstance_t instance, tmdlHdmiTxEvent_t event){ tmErrorCode_t errCode; /* Check if instance number is in range */ RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE) /* Check if the event exists */ RETIF_BADPARAM(event >= EVENT_NB) /* Take the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreP(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) /* Protect the access to this ressource */ instanceStatusInfoTx[instance].pEventState[event].status = TMDL_HDMITX_EVENT_ENABLED; /* Release the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreV(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) return TM_OK;}/****************************************************************************** \brief This function allows disabling a specific event. By default, all events are disabled, except input lock. \param instance Instance identifier. \param event Event to disable. \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******************************************************************************/tmErrorCode_t tmdlHdmiTxDisableEvent( tmInstance_t instance, tmdlHdmiTxEvent_t event){ tmErrorCode_t errCode; /* Check if instance number is in range */ RETIF((instance < 0) || (instance >= MAX_UNITS), TMDL_ERR_DLHDMITX_BAD_INSTANCE) /* Check if the event exists */ RETIF_BADPARAM(event >= EVENT_NB) /* Take the sempahore */ RETIF( (errCode = tmdlHdmiTxIWSemaphoreP(dlHdmiTxItSemaphore[instance]) ) != TM_OK, errCode) /* Protect the access to this ressource */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -