📄 tmbslhdmitx_2.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_2.c * * \version $Revision: 29 $ * * \date $Date: 29/10/07 14:11 $ * * \brief BSL driver component for the TDA9983 HDMI Transmitter * * \section refs Reference Documents * HDMI Driver - Outline Architecture.doc * HDMI Driver - tmbslHdmiTx - SCS.doc * * \section info Change Information * * \verbatim $History: tmbslHdmiTx_2.c $ * * ******************* Version 29 ***************** * User: B.Vereecke Date: 29/10/07 Time: 14:11 * Updated in $/Source/tmbslHdmiTx/src * PR852 : remove external library dependancy * * * ***************** Version 28 ***************** * User: B.Vereecke Date: 17/10/07 Time: 14:11 * Updated in $/Source/tmbslHdmiTx/src * PR872 : add new formats, 1080p24/25/30 * * * ***************** Version 27 ***************** * User: J. Lamotte Date: 01/06/07 Time: 12:00 * Updated in $/Source/tmbslHdmiTx/src * PR359 (PR176) : Modify SetHwRegisters call in * tmbslHdmiTxMatrixSetConversion API * * * ***************** Version 26 ***************** * User: J. Lamotte Date: 14/05/07 Time: 10:30 * Updated in $/Source/tmbslHdmiTx/src * PR322 (PR176) : Remove 3 DLL compilation warnings * (calculateCheckusm, getEdidBlock, * tmbslHdmiTxpktSetVsInfoframe) * * * ***************** Version 25 ***************** * User: Burnouf Date: 18/04/07 Time: 13:25 * Updated in $/Source/tmbslHdmiTx/src * PR50 : Send event EV_SINKON for TDA9981 * * ***************** Version 24 ***************** * User: Burnouf Date: 29/11/06 Time: 17:06 * Updated in $/Source/tmbslHdmiTx/Src * PNF79 and PR11 allow driver to go in state connected if EDID checksum * is bad * * ***************** Version 23 ***************** * User: Mayhew Date: 23/11/06 Time: 15:06 * Updated in $/Source/tmbslHdmiTx/Src * PNF78 Ensure that DDC is disconnected from I2C after bad EDID read * * ***************** Version 21 ***************** * User: Mayhew Date: 10/11/06 Time: 10:11 * Updated in $/Source/tmbslHdmiTx/Src * PNF68 RETIF_REG_FAIL macro replaces RETIF checks after register set/get * calls, and compiled out to save code space * * ***************** Version 19 ***************** * User: Mayhew Date: 2/11/06 Time: 16:54 * Updated in $/Source/tmbslHdmiTx/Src * Remove N3 support * * ***************** Version 17 ***************** * User: Mayhew Date: 21/09/06 Time: 15:49 * Updated in $/Source/tmbslHdmiTx/Src * Cut code size in demo by using RETIF_BADPARAM * * ***************** Version 15 ***************** * User: Djw Date: 22/08/06 Time: 9:56 * Updated in $/Source/tmbslHdmiTx/Src * Updated file configuration info. * * ***************** Version 14 ***************** * User: Mayhew Date: 10/07/06 Time: 13:09 * Updated in $/Source/tmbslHdmiTx/Src * Fix file header comment * * ***************** Version 12 ***************** * User: Mayhew Date: 30/06/06 Time: 13:26 * Updated in $/Source/tmbslHdmiTx/Src * EdidSinkType replaced by SinkType. Set full colourspace for VGA format * 1 as well as for PC formats. * * ***************** Version 10 ***************** * User: Djw Date: 16/06/06 Time: 12:04 * Updated in $/Source/tmbslHdmiTx/Src * Added use of alternate i2c address for EDID. More conditional * compilation for demoboard build. * * ***************** Version 8 ***************** * User: Mayhew Date: 5/06/06 Time: 16:39 * Updated in $/Source/tmbslHdmiTx/Src * Save code space by replacing API unit checks with checkUnitSetDis. * * ***************** Version 7 ***************** * User: Djw Date: 24/05/06 Time: 15:30 * Updated in $/Source/tmbslHdmiTx/Src * Minor change to force EDID reads of block 0 or 1 to occur without * segment pointer - thus keeping compatibility with older EDIDs. * * ***************** Version 5 ***************** * User: Djw Date: 24/05/06 Time: 11:19 * Updated in $/Source/tmbslHdmiTx/Src * Added conditional compilation for demoboard build. Added N4 EDID * capability with Seg Ptr writing. Added all InfoFrames with N4 version * checking; InfoFrames use page 10h on N4. * * ***************** Version 4 ***************** * User: Mayhew Date: 10/05/06 Time: 17:08 * Updated in $/Source/tmbslHdmiTx/Src * Rename local E_ enums to public HDMITX_ enums * * ***************** Version 3 ***************** * User: Djw Date: 20/04/06 Time: 18:03 * Updated in $/Source/tmbslHdmiTx/Src * Fixed logic problem with EDID block parsing on block 1 upwards * (checksum test). Added workaround for EDID ghost register problem on * n3 device. * * ***************** Version 2 ***************** * User: Mayhew Date: 11/04/06 Time: 14:09 * Updated in $/Source/tmbslHdmiTx/Src * Fixed Bad Parameter error in MatrixSetConversion and fixed wrong block * version in video infoframe. * * ***************** Version 1 ***************** * User: Mayhew Date: 4/04/06 Time: 16:28 * Created in $/Source/tmbslHdmiTx/Src * Driver phase 2 \endverbatim **//*============================================================================*//* FILE CONFIGURATION *//*============================================================================*//* Defining this symbol on the compiler command line excludes some API checks *//* #define NO_RETIF_BADPARAM *//* Defining this symbol on the compiler command line excludes some API checks *//* #define NO_RETIF_REG_FAIL *//* Defining this symbol on the compiler command line excludes unused code *//* #define DEMO_BUILD *//*============================================================================*//* STANDARD INCLUDE FILES *//*============================================================================*//*============================================================================*//* PROJECT INCLUDE FILES *//*============================================================================*/#include "tmbslHdmiTx.h"#include "tmbslHdmiTx_local.h"/*============================================================================*//* MACRO DEFINITIONS *//*============================================================================*/#define EDID_NUMBER_MAX_DTD_BLK_1 6/** EDID block 0 parse start point */#define EDID_BLK0_BASE_DTD 0x36#define EDID_BLK1_OFFSET_BASE_DTD 2/** EDID block 0 extension block count */#define EDID_BLK0_EXT_CNT 0x7E/** EDID extension block parse start point */#define EDID_BLK_EXT_BASE 0x04/** CEA extension block type */#define EDID_CEA_EXTENSION 0x02/** CEA Block Map */#define EDID_BLOCK_MAP 0xF0/** NB Max of descriptor DTD or monitor in block 0 */#define EDID_NB_MAX_DESCRIP_BLK_IN_BLK_0 4#define EDID_MONITOR_NAME_DESC_DATA_TYPE 252#define EDID_MONITOR_RANGE_DESC_DATA_TYPE 253/*============================================================================*//* TYPE DEFINITIONS *//*============================================================================*//*============================================================================*//* PUBLIC VARIABLE DEFINITIONS *//*============================================================================*//*============================================================================*//* STATIC VARIABLE DECLARATIONS *//*============================================================================*//** * Lookup table for colour space conversion matrix register sets. * Each array consists of 31 register values from MAT_CONTROL through * to MAT_OO3_LSB */static CONST_DAT UInt8 kMatrixPreset[MATRIX_PRESET_QTY][MATRIX_PRESET_SIZE] ={ {0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x6F, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x6F, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x6F, 0x0, 0x40, 0x0, 0x40, 0x0, 0x40 }, /* RGB Full to RGB Limited */ {0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x4, 0x1, 0x7, 0x0, 0x64, 0x6, 0x88, 0x1, 0xC2, 0x7, 0xB7, 0x6, 0xD6, 0x7, 0x68, 0x1, 0xC2, 0x0, 0x40, 0x2, 0x0, 0x2, 0x0 }, /* RGB Full to BT601 */ {0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x75, 0x0, 0xBB, 0x0, 0x3F, 0x6, 0x68, 0x1, 0xC2, 0x7, 0xD7, 0x6, 0xA6, 0x7, 0x99, 0x1, 0xC2, 0x0, 0x40, 0x2, 0x0, 0x2, 0x0 }, /* RGB Full to BT709 */ {0x1, 0x7, 0xC0, 0x7, 0xC0, 0x7, 0xC0, 0x2, 0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, /* RGB Limited to RGB Full */ {0x2, 0x7, 0xC0, 0x7, 0xC0, 0x7, 0xC0, 0x2, 0x59, 0x1, 0x32, 0x0, 0x75, 0x6, 0x4A, 0x2, 0x0C, 0x7, 0xAB, 0x6, 0xA5, 0x7, 0x4F, 0x2, 0x0C, 0x0, 0x40, 0x2, 0x0, 0x2, 0x0 }, /* RGB Limited to BT601 */ {0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x0, 0x40, 0x0, 0x40 }, /* BT709 to RGB Limited */ {0x1, 0x7, 0xC0, 0x6, 0x0, 0x6, 0x0, 0x2, 0x0, 0x0, 0x62, 0x0, 0x33, 0x0, 0x0, 0x1, 0xF7, 0x7, 0xDB, 0x0, 0x0, 0x7, 0xC7, 0x1, 0xFB, 0x0, 0x40, 0x2, 0x0, 0x2, 0x0 } /* BT709 to BT601 */}; /** * This table gives us the index into the kMatrixPreset array, based * on the input and output colourspaces. * The co-ordinates into this array are tmbslHdmiTxColourspace_t enums. * The value of -1 is returned for matching input/output colourspaces. */static CONST_DAT Int kMatrixIndex[HDMITX_CS_NUM][HDMITX_CS_NUM] ={ {-1, E_MATRIX_RGBF_2_RGBL, E_MATRIX_RGBF_2_BT601, E_MATRIX_RGBF_2_BT709}, {E_MATRIX_RGBL_2_RGBF, -1, E_MATRIX_RGBL_2_BT601, E_MATRIX_RGBL_2_BT709}, {E_MATRIX_BT601_2_RGBF, E_MATRIX_BT601_2_RGBL, -1, E_MATRIX_BT601_2_BT709}, {E_MATRIX_BT709_2_RGBF, E_MATRIX_BT709_2_RGBL, E_MATRIX_BT709_2_BT601, -1}};/*============================================================================*//* STATIC FUNCTION DECLARATIONS *//*============================================================================*/static UInt8 calculateChecksum (UInt8 *pData, Int numBytes);static tmErrorCode_t getEdidBlock (tmHdmiTxobject_t *pDis, Int blockNumber);static tmErrorCode_t parseEdidBlock (tmHdmiTxobject_t *pDis, Int blockNumber);static Bool storeDtdBlock (tmHdmiTxobject_t *pDis, UInt8 blockPtr);static Bool storeMonitorDescriptor (tmHdmiTxobject_t *pDis, UInt8 blockPtr);/*============================================================================*//* PUBLIC FUNCTION DEFINITIONS *//*============================================================================*//*============================================================================*//* tmbslHdmiTxEdidGetAudioCapabilities *//*============================================================================*/#ifndef DEMO_BUILDtmErrorCode_ttmbslHdmiTxEdidGetAudioCapabilities( tmUnitSelect_t txUnit, tmbslHdmiTxEdidSad_t *pEdidAFmts, UInt aFmtLength, UInt *pAFmtsAvail, UInt8 *pAudioFlags){ tmHdmiTxobject_t *pDis; /* Pointer to Device Instance Structure */ tmErrorCode_t err; /* Error code */ UInt i; /* Loop index */ UInt8 edidResult; /* Check unit parameter and point to TX unit object */ err = checkUnitSetDis(txUnit, &pDis); RETIF(err != TM_OK, err) /* Check remaining parameter(s) */ RETIF_BADPARAM(pEdidAFmts == Null) RETIF_BADPARAM(aFmtLength < 1) RETIF_BADPARAM(pAFmtsAvail == Null) RETIF_BADPARAM(pAudioFlags == Null) /* IF the EdidStatus value is not valid in the Device Instance Structure * THEN call tmbslHdmiTxEdidGetBlockData. */ if (pDis->EdidStatus == HDMITX_EDID_NOT_READ) { err = tmbslHdmiTxEdidGetBlockData(txUnit, Null, 0, 0, &edidResult); /* IF the result is not TM_OK THEN return it. */ RETIF(err != TM_OK, err) } /* Copy the Device Instance Structure EdidAFmts descriptors to * pEdidAFmts until we run out or no more space in structure. */ if (pDis->EdidSadCnt > 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -