From aa76107d8026bfd1951321b9439f133900258e6d Mon Sep 17 00:00:00 2001 From: Andrei-Liviu Simion Date: Wed, 5 Nov 2014 19:56:46 -0800 Subject: [PATCH] dptx: Added a function to retrieve a specified data block from the DisplayId. Search for a section data block that matched a specified section tag. Signed-off-by: Andrei-Liviu Simion --- XilinxProcessorIPLib/drivers/dptx/src/xdptx.h | 2 ++ .../drivers/dptx/src/xdptx_edid.c | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h b/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h index 232acc45..4782f0ef 100644 --- a/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h +++ b/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h @@ -884,5 +884,7 @@ u32 XDptx_GetRemoteEdidBlock(XDptx *InstancePtr, u8 *Data, u8 BlockNum, u8 LinkCountTotal, u8 *RelativeAddress); u32 XDptx_GetRemoteEdidDispIdExt(XDptx *InstancePtr, u8 *Data, u8 LinkCountTotal, u8 *RelativeAddress); +u32 XDptx_GetDispIdDataBlock(u8 *DisplayIdRaw, u8 SectionTag, + u8 **DataBlockPtr); #endif /* XDPTX_H_ */ diff --git a/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c b/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c index f1ae313b..ad4ac39c 100644 --- a/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c +++ b/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c @@ -193,3 +193,37 @@ u32 XDptx_GetRemoteEdidDispIdExt(XDptx *InstancePtr, u8 *Data, * exists in sink's EDID structure. */ return XST_FAILURE; } + +u32 XDptx_GetDispIdDataBlock(u8 *DisplayIdRaw, u8 SectionTag, u8 **DataBlockPtr) +{ + u8 Index; + u8 DispIdSize = XDptx_GetDispIdSize(DisplayIdRaw); + u8 *DataBlock; + + /* Search for a section data block matching the specified tag. */ + for (Index = XDPTX_DISPID_PAYLOAD_START; Index < DispIdSize; Index++) { + DataBlock = &DisplayIdRaw[Index]; + + /* Check if the tag mataches the current section data block. */ + if (XDptx_GetDispIdDbSecTag(DataBlock) == SectionTag) { + *DataBlockPtr = DataBlock; + return XST_SUCCESS; + } + + if (DataBlock[XDPTX_DISPID_DB_SEC_SIZE] == 0) { + /* End of valid section data blocks. */ + break; + } + else { + /* Increment the search index to skip the remaining + * bytes of the current section data block. */ + Index += (XDPTX_DISPID_DB_SEC_SIZE + + DataBlock[XDPTX_DISPID_DB_SEC_SIZE]); + } + } + + /* The entire DisplayID was searched or the search ended due to data + * no longer containing a valid section data block. No section data + * block with the specified tag was found. */ + return XST_FAILURE; +}