📄 tmbslhdmitx_local.c
字号:
/** * Copyright (C) 2006 Koninklijke Philips Electronics N.V., All Rights Reserved. * This source code and any compilation or derivative thereof is the proprietary * information of Koninklijke Philips Electronics N.V. and is confidential in * nature. Under no circumstances is this software to be exposed to or placed * under an Open Source License of any type without the expressed written * permission of Koninklijke Philips Electronics N.V. * * \file tmbslHdmiTx_local.c * * \version $Revision: 15 $ * * \date $Date: 29/10/07 14:11 $ * * \brief BSL driver component for the TDA998x HDMI Transmitter * * \section refs Reference Documents * HDMI Driver - Outline Architecture.doc * HDMI Driver - tmbslHdmiTx - SCS.doc * * \section info Change Information * * \verbatim $History: tmbslHdmiTx_local.c $ * * ***************** Version 15 ***************** * User: B.Vereecke Date: 29/10/07 Time: 14:11 * Updated in $/Source/tmbslHdmiTx/src * PR852 : remove external library dependancy * * ***************** Version 14 ***************** * User: B.Vereecke Date: 08/08/07 Time: 15:40 * Updated in $/Source/tmbslHdmiTx/Src * PR 563 : Unused shadow value for register * E_REG_P00_INT_FLAGS_2_RW * * ***************** Version 13 ***************** * User: Burnouf Date: 18/04/07 Time: 15:50 * Updated in $/Source/tmbslHdmiTx/Src * PR 50 : Manage state ST_AWAIT_RX_SENSE for TDA9981 * * ***************** Version 12 ***************** * User: Mayhew Date: 21/09/06 Time: 15:50 * Updated in $/Source/tmbslHdmiTx/Src * Cut code size in demo by using RETIF_BADPARAM * * ***************** Version 10 ***************** * User: Mayhew Date: 15/09/06 Time: 16:08 * Updated in $/Source/tmbslHdmiTx/Src * Reduce code size in setState by using local copies of DIS * * ***************** Version 8 ***************** * User: Mayhew Date: 30/06/06 Time: 13:23 * Updated in $/Source/tmbslHdmiTx/Src * EV_HDCP_BKSV_SECURE renamed to EV_HDCP_BKSV_REPEAT * * ***************** Version 6 ***************** * User: Mayhew Date: 6/06/06 Time: 13:40 * Updated in $/Source/tmbslHdmiTx/Src * Add checkUnitSetDis to reduce code size in most APIs * * ***************** Version 4 ***************** * User: Djw Date: 24/05/06 Time: 11:20 * Updated in $/Source/tmbslHdmiTx/Src * Added E_PAGE_10 for new Infoframe registers in N4. * * ***************** Version 3 ***************** * User: Mayhew Date: 10/05/06 Time: 17:09 * Updated in $/Source/tmbslHdmiTx/Src * Add HDCP state handling * * ***************** Version 2 ***************** * User: Djw Date: 20/04/06 Time: 17:32 * Updated in $/Source/tmbslHdmiTx/Src * Modification to prevent reading of shadow copies of interrupt flag * registers. * * ***************** Version 1 ***************** * User: Mayhew Date: 4/04/06 Time: 16:30 * Created in $/Source/tmbslHdmiTx/Src * Driver local code & data phase 2 \endverbatim **//*============================================================================*//* FILE CONFIGURATION *//*============================================================================*//* Defining this symbol on the compiler command line excludes some API checks *//* #define NO_RETIF_BADPARAM *//*============================================================================*//* STANDARD INCLUDE FILES *//*============================================================================*//*============================================================================*//* PROJECT INCLUDE FILES *//*============================================================================*/#include "tmbslHdmiTx.h"#include "tmbslHdmiTx_local.h"/*============================================================================*//* MACRO DEFINITIONS *//*============================================================================*//*============================================================================*//* TYPE DEFINITIONS *//*============================================================================*//*============================================================================*//* PUBLIC VARIABLE DEFINITIONS *//*============================================================================*//** The array of object instances for all concurrently supported HDMI * Transmitter units */RAM_DAT tmHdmiTxobject_t gHdmiTxInstance[HDMITX_UNITS_MAX];/** * Lookup table to map register page index to actual page number */CONST_DAT UInt8 kPageIndexToPage[E_PAGE_NUM] ={ 0x00, /* E_PAGE_00 */ 0x01, /* E_PAGE_01 */ 0x02, /* E_PAGE_02 */ 0x10, /* E_PAGE_10 */ 0x11, /* E_PAGE_11 */ 0x12 /* E_PAGE_12 */};/*============================================================================*//* STATIC VARIABLE DECLARATIONS *//*============================================================================*//** * Lookup table to map an 8-bit mask to a number of left shifts * needed to shift a value starting at bit 0 onto the mask. * Indexed by mask 0-255. For example, mask 0x00 and 0x01 need * no shift, mask 0x02 needs one shift, mask 0x03 needs no shift, * mask 0x04 needs 2 shifts, etc. * Rows were formatted by "HDMI Driver - Register List.xls" and pasted here */static CONST_DAT UInt8 kMaskToShift[256] ={/* Mask index: */ /*x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 1x */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 2x */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 3x */ 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 4x */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 5x */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 6x */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 7x */ 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 8x */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 9x */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* Ax */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* Bx */ 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* Cx */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* Dx */ 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* Ex */ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 /* Fx */};/*============================================================================*//* STATIC FUNCTION DECLARATIONS *//*============================================================================*//*============================================================================*//* PUBLIC FUNCTION DEFINITIONS *//*============================================================================*//*============================================================================*//* checkUnitSetDis *//*============================================================================*/tmErrorCode_tcheckUnitSetDis( tmUnitSelect_t txUnit, tmHdmiTxobject_t **ppDis){ /* Return error if unit numbr is out of range */ RETIF(txUnit < tmUnit0, TMBSL_ERR_HDMI_BAD_UNIT_NUMBER) RETIF(txUnit >= HDMITX_UNITS_MAX, TMBSL_ERR_HDMI_BAD_UNIT_NUMBER) /* Point to unit's Device Instance Structure */ *ppDis = &gHdmiTxInstance[txUnit]; /* Return if this device instance is not initialised */ RETIF(!(*ppDis)->bInitialized, TMBSL_ERR_HDMI_NOT_INITIALIZED) return TM_OK;}/*============================================================================*//* getHwRegisters *//*============================================================================*/tmErrorCode_tgetHwRegisters( tmHdmiTxobject_t *pDis, UInt16 regShadPageAddr, UInt8 *pData, UInt16 lenData ){ tmErrorCode_t err; /* Error code */ UInt8 regShad; /* The index to the register's shadow copy */ UInt8 regPage; /* The index to the register's page */ UInt8 regAddr; /* The register's address on the page */ UInt8 newRegPage; /* The register's new page number */ tmbslHdmiTxSysArgs_t sysArgs; /* Arguments passed to system function */ /* Unpack 1st register's shadow index, page index and address */ regShad = SPA2SHAD(regShadPageAddr); regPage = SPA2PAGE(regShadPageAddr); regAddr = SPA2ADDR(regShadPageAddr); newRegPage = kPageIndexToPage[regPage]; /* Check length does not overflow page */ RETIF_BADPARAM((regAddr+lenData) > E_REG_CURPAGE_ADR_W) /* Check 1st reg does not have a shadow - whole range assumed likewise */ RETIF_BADPARAM(regShad != E_SNONE) /* Set page register if required */ if (pDis->curRegPage != newRegPage) { /* All non-OK results are errors */ sysArgs.slaveAddr = pDis->uHwAddress; sysArgs.firstRegister = E_REG_CURPAGE_ADR_W; sysArgs.lenData = 1; sysArgs.pData = &newRegPage; err = pDis->sysFuncWrite(&sysArgs); RETIF(err != TM_OK, TMBSL_ERR_HDMI_I2C_WRITE) pDis->curRegPage = newRegPage; } /* Get I2C register range - all non-OK results are errors */ sysArgs.slaveAddr = pDis->uHwAddress; sysArgs.firstRegister = regAddr; sysArgs.lenData = (UInt8)lenData; sysArgs.pData = pData; err = pDis->sysFuncRead(&sysArgs); return (err == TM_OK) ? TM_OK : TMBSL_ERR_HDMI_I2C_READ;}/*============================================================================*//* getHwRegister *//*============================================================================*/tmErrorCode_tgetHwRegister( tmHdmiTxobject_t *pDis, UInt16 regShadPageAddr, UInt8 *pRegValue){ tmErrorCode_t err; /* Error code */ UInt8 regShad; /* The index to the register's shadow copy */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -