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 <andrei.simion@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2014-11-05 19:56:46 -08:00 committed by Suneel Garapati
parent d584cbfdde
commit aa76107d80
2 changed files with 36 additions and 0 deletions

View file

@ -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_ */

View file

@ -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;
}