From 245566a2c4345f4d794dee54160017c12070ef59 Mon Sep 17 00:00:00 2001 From: Andrei-Liviu Simion Date: Sat, 8 Nov 2014 13:57:56 -0800 Subject: [PATCH] dptx: Added macro header comments describing new functionality. Signed-off-by: Andrei-Liviu Simion --- .../drivers/dptx/src/xdptx_edid.c | 6 +- .../drivers/dptx/src/xdptx_hw.h | 153 ++++++++++++++---- 2 files changed, 129 insertions(+), 30 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c b/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c index 0a7bc8a3..ca726246 100644 --- a/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c +++ b/XilinxProcessorIPLib/drivers/dptx/src/xdptx_edid.c @@ -245,7 +245,7 @@ u32 XDptx_GetRemoteEdidDispIdExt(XDptx *InstancePtr, u8 *Data, return Status; } - NumExt = XDptx_GetExtBlockCount(Data); + NumExt = Data[XDPTX_EDID_EXT_BLOCK_COUNT]; for (ExtIndex = 0; ExtIndex < NumExt; ExtIndex++) { /* Get an EDID extension block. */ Status = XDptx_GetRemoteEdidBlock(InstancePtr, Data, @@ -289,7 +289,7 @@ u32 XDptx_GetRemoteEdidDispIdExt(XDptx *InstancePtr, u8 *Data, u32 XDptx_GetDispIdDataBlock(u8 *DisplayIdRaw, u8 SectionTag, u8 **DataBlockPtr) { u8 Index; - u8 DispIdSize = XDptx_GetDispIdSize(DisplayIdRaw); + u8 DispIdSize = DisplayIdRaw[XDPTX_DISPID_SIZE]; u8 *DataBlock; /* Search for a section data block matching the specified tag. */ @@ -297,7 +297,7 @@ u32 XDptx_GetDispIdDataBlock(u8 *DisplayIdRaw, u8 SectionTag, u8 **DataBlockPtr) DataBlock = &DisplayIdRaw[Index]; /* Check if the tag mataches the current section data block. */ - if (XDptx_GetDispIdDbSecTag(DataBlock) == SectionTag) { + if (DataBlock[XDPTX_DISPID_DB_SEC_TAG] == SectionTag) { *DataBlockPtr = DataBlock; return XST_SUCCESS; } diff --git a/XilinxProcessorIPLib/drivers/dptx/src/xdptx_hw.h b/XilinxProcessorIPLib/drivers/dptx/src/xdptx_hw.h index c9d0d4a5..7f0383ca 100644 --- a/XilinxProcessorIPLib/drivers/dptx/src/xdptx_hw.h +++ b/XilinxProcessorIPLib/drivers/dptx/src/xdptx_hw.h @@ -1292,41 +1292,140 @@ #define XDptx_WriteReg(BaseAddress, RegOffset, Data) \ XDptx_Out32((BaseAddress) + (RegOffset), (Data)) -#define XDptx_GetExtBlockCount(E) (E[XDPTX_EDID_EXT_BLOCK_COUNT]) -#define XDptx_IsEdidExtBlockDispId(B) \ - (B[XDPTX_EDID_EXT_BLOCK_TAG] == XDPTX_EDID_EXT_BLOCK_TAG_DISPID) +/******************************************************************************/ +/** + * Check if an Extended Display Identification Data (EDID) extension block is of + * type DisplayID. + * + * @param Ext is a pointer to the EDID extension block under comparison. + * + * @return + * - 1 if the extension block is of type DisplayID. + * - Otherwise. + * + * @note C-style signature: + * u8 XDptx_IsEdidExtBlockDispId(u8 *Ext) + * +*******************************************************************************/ +#define XDptx_IsEdidExtBlockDispId(Ext) \ + (Ext[XDPTX_EDID_EXT_BLOCK_TAG] == XDPTX_EDID_EXT_BLOCK_TAG_DISPID) -#define XDptx_GetDispIdSize(D) (D[XDPTX_DISPID_SIZE]) - -#define XDptx_GetDispIdDbSecTag(B) (B[XDPTX_DISPID_DB_SEC_TAG]) - -#define XDptx_GetDispIdTdtHTotal(B) \ - (((((B[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_HTOT_H_MASK) >> \ - XDPTX_DISPID_TDT_TOP2_HTOT_H_SHIFT) << 4) | \ - ((B[XDPTX_DISPID_TDT_TOP0] & XDPTX_DISPID_TDT_TOP0_HTOT_L_MASK) >> \ +/******************************************************************************/ +/** + * Given a Tiled Display Topology (TDT) data block, retrieve the total number of + * horizontal tiles in the tiled display. The TDT block is part of an Extended + * Display Identification Data (EDID) extension block of type DisplayID. + * + * @param Tdt is a pointer to the TDT data block. + * + * @return The total number of horizontal tiles in the tiled display. + * + * @note C-style signature: + * u8 XDptx_GetDispIdTdtHTotal(u8 *Tdt) + * +*******************************************************************************/ +#define XDptx_GetDispIdTdtHTotal(Tdt) \ + (((((Tdt[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_HTOT_H_MASK) \ + >> XDPTX_DISPID_TDT_TOP2_HTOT_H_SHIFT) << 4) | \ + ((Tdt[XDPTX_DISPID_TDT_TOP0] & XDPTX_DISPID_TDT_TOP0_HTOT_L_MASK) >> \ XDPTX_DISPID_TDT_TOP0_HTOT_L_SHIFT)) + 1) -#define XDptx_GetDispIdTdtVTotal(B) \ - (((((B[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_VTOT_H_MASK) >> \ - XDPTX_DISPID_TDT_TOP2_VTOT_H_SHIFT) << 4) | \ - (B[XDPTX_DISPID_TDT_TOP0] & XDPTX_DISPID_TDT_TOP0_VTOT_L_MASK)) + 1) +/******************************************************************************/ +/** + * Given a Tiled Display Topology (TDT) data block, retrieve the total number of + * vertical tiles in the tiled display. The TDT block is part of an Extended + * Display Identification Data (EDID) extension block of type DisplayID. + * + * @param Tdt is a pointer to the TDT data block. + * + * @return The total number of vertical tiles in the tiled display. + * + * @note C-style signature: + * u8 XDptx_GetDispIdTdtVTotal(u8 *Tdt) + * +*******************************************************************************/ +#define XDptx_GetDispIdTdtVTotal(Tdt) \ + (((((Tdt[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_VTOT_H_MASK) \ + >> XDPTX_DISPID_TDT_TOP2_VTOT_H_SHIFT) << 4) | \ + (Tdt[XDPTX_DISPID_TDT_TOP0] & XDPTX_DISPID_TDT_TOP0_VTOT_L_MASK)) + 1) -#define XDptx_GetDispIdTdtHLoc(B) \ - ((((B[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_HLOC_H_MASK) >> \ - XDPTX_DISPID_TDT_TOP2_HLOC_H_SHIFT) << 4) | \ - ((B[XDPTX_DISPID_TDT_TOP1] & XDPTX_DISPID_TDT_TOP1_HLOC_L_MASK) >> \ +/******************************************************************************/ +/** + * Given a Tiled Display Topology (TDT) data block, retrieve the horizontal tile + * location in the tiled display. The TDT block is part of an Extended Display + * Identification Data (EDID) extension block of type DisplayID. + * + * @param Tdt is a pointer to the TDT data block. + * + * @return The horizontal tile location in the tiled display represented by + * the specified TDT. + * + * @note C-style signature: + * u8 XDptx_GetDispIdTdtHLoc(u8 *Tdt) + * +*******************************************************************************/ +#define XDptx_GetDispIdTdtHLoc(Tdt) \ + ((((Tdt[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_HLOC_H_MASK) \ + >> XDPTX_DISPID_TDT_TOP2_HLOC_H_SHIFT) << 4) | \ + ((Tdt[XDPTX_DISPID_TDT_TOP1] & XDPTX_DISPID_TDT_TOP1_HLOC_L_MASK) >> \ XDPTX_DISPID_TDT_TOP1_HLOC_L_SHIFT)) -#define XDptx_GetDispIdTdtVLoc(B) \ - (((B[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_VLOC_H_MASK) << 4) \ - | (B[XDPTX_DISPID_TDT_TOP1] & XDPTX_DISPID_TDT_TOP1_VLOC_L_MASK)) +/******************************************************************************/ +/** + * Given a Tiled Display Topology (TDT) data block, retrieve the vertical tile + * location in the tiled display. The TDT block is part of an Extended Display + * Identification Data (EDID) extension block of type DisplayID. + * + * @param Tdt is a pointer to the TDT data block. + * + * @return The vertical tile location in the tiled display represented by + * the specified TDT. + * + * @note C-style signature: + * u8 XDptx_GetDispIdTdtVLoc(u8 *Tdt) + * +*******************************************************************************/ +#define XDptx_GetDispIdTdtVLoc(Tdt) \ + (((Tdt[XDPTX_DISPID_TDT_TOP2] & XDPTX_DISPID_TDT_TOP2_VLOC_H_MASK) << \ + 4) | (Tdt[XDPTX_DISPID_TDT_TOP1] & XDPTX_DISPID_TDT_TOP1_VLOC_L_MASK)) -#define XDptx_GetDispIdTdtNumTiles(B) \ - (XDptx_GetDispIdTdtHTotal(B) * XDptx_GetDispIdTdtVTotal(B)) +/******************************************************************************/ +/** + * Given a Tiled Display Topology (TDT) data block, retrieve the total number of + * tiles in the tiled display. The TDT block is part of an Extended Display + * Identification Data (EDID) extension block of type DisplayID. + * + * @param Tdt is a pointer to the TDT data block. + * + * @return The total number of tiles in the tiled display. + * + * @note C-style signature: + * u8 XDptx_GetDispIdTdtNumTiles(u8 *Tdt) + * +*******************************************************************************/ +#define XDptx_GetDispIdTdtNumTiles(Tdt) \ + (XDptx_GetDispIdTdtHTotal(Tdt) * XDptx_GetDispIdTdtVTotal(Tdt)) -#define XDptx_GetDispIdTdtTileOrder(B) \ - ((XDptx_GetDispIdTdtVLoc(B) * XDptx_GetDispIdTdtHTotal(B)) + \ - XDptx_GetDispIdTdtHLoc(B)) +/******************************************************************************/ +/** + * Given a Tiled Display Topology (TDT) data block, calculate the tiling order + * of the associated tile. The TDT block is part of an Extended Display + * Identification Data (EDID) extension block of type DisplayID. + * The tiling order starts at 0 for x,y coordinate 0,0 and increments as the + * horizontal location increases. Once the last horizontal tile has been + * reached, the next tile in the order is 0,y+1. + * + * @param Tdt is a pointer to the TDT data block. + * + * @return The total number of horizontal tiles in the tiled display. + * + * @note C-style signature: + * u8 XDptx_GetDispIdTdtTileOrder(u8 *Tdt) + * +*******************************************************************************/ +#define XDptx_GetDispIdTdtTileOrder(Tdt) \ + ((XDptx_GetDispIdTdtVLoc(Tdt) * XDptx_GetDispIdTdtHTotal(Tdt)) + \ + XDptx_GetDispIdTdtHLoc(Tdt)) #endif /* XDPTX_HW_H_ */