Software Drivers

xosd.c File Reference


Detailed Description

This file is main code of Xilinx Video On-Screen-Display (OSD) core. Please see xosd.h for more details of the driver.

 MODIFICATION HISTORY:

 Ver   Who    Date     Changes
 ----- ------ -------- -------------------------------------------------------
 1.00a xd     08/18/08 First release.
 1.02a xd     12/21/10 Removed endian conversion for text bank loading.
 1.03a cm     09/07/11 Updated XOsd_GetLayerAlpha(), XOsd_SetLayerAlpha(),
                       XOsd_SetBackgroundColor() and XOsd_GetBackgroundColor()
                       to allow 10 and 12 bit alpha and background colors.
 2.00a cjm    12/18/12 Converted from xio.h to xil_io.h, translating
                       basic types, MB cache functions, exceptions and
                       assertions to xil_io format.
 4.0   adk    02/18/14 Renamed S_AXIS_VIDEO_DATA_WIDTH ->
                                                      SlaveAxisVideoDataWidth.
                       Removed from XOsd_CfgInitialize:
                       VbiStartCallBack, VbiStartRef, VbiEndCallBack,
                       VbiEndRef.

                       Added in XOsd_CfgInitialize:
                       ProcStartCallBack, ProcStartRef.

                       Renamed the following function prototypes:
                       XOSD_CfgInitialize -> XOsd_CfgInitialize,
                       XOSD_SetScreenSize -> XOsd_SetActiveSize,
                       XOSD_GetScreenSize -> XOsd_GetActiveSize,
                       XOSD_SetBackgroundColor -> XOsd_SetBackgroundColor,
                       XOSD_GetBackgroundColor -> XOSD_GetBackgroundColor,
                       XOSD_SetLayerDimension -> XOsd_SetLayerDimension,
                       XOSD_GetLayerDimension -> XOsd_GetLayerDimension,
                       XOSD_SetLayerAlpha -> XOsd_SetLayerAlpha,
                       XOSD_GetLayerAlpha -> XOsd_GetLayerAlpha,
                       XOSD_SetLayerAlpha -> XOsd_SetLayerAlpha,
                       XOSD_GetLayerAlpha -> XOsd_GetLayerAlpha,
                       XOSD_SetLayerPriority -> XOsd_SetLayerPriority,
                       XOSD_GetLayerPriority -> XOsd_GetLayerPriority,
                       XOSD_EnableLayer -> XOsd_EnableLayer,
                       XOSD_DisableLayer -> XOsd_DisableLayer,
                       XOSD_LoadColorLUTBank - > XOsd_LoadColorLUTBank,
                       XOSD_LoadCharacterSetBank -> XOsd_LoadCharacterSetBank,
                       XOSD_LoadTextBank - > XOsd_LoadTextBank,
                       XOSD_SetActiveBank -> XOsd_SetActiveBank,
                       XOSD_CreateInstruction -> XOsd_CreateInstruction,
                       XOSD_LoadInstructionList -> XOsd_LoadInstructionList,
                       XOSD_LookupConfig -> XOsd_LookupConfig,
                       XOSD_IntrHandler -> XOsd_IntrHandler,
                       XOSD_SetCallBack -> XOsd_SetCallBack.

                       Changed the prototype of XOSD_GetVersion and renamed it as
                       XOsd_GetVersion

                       Removed the following function implementation:
                       XOSD_SetBlankPolarity.
 

#include "xosd.h"

Functions

int XOsd_CfgInitialize (XOsd *InstancePtr, XOsd_Config *CfgPtr, u32 EffectiveAddr)
void XOsd_SetActiveSize (XOsd *InstancePtr, u32 Width, u32 Height)
void XOsd_GetActiveSize (XOsd *InstancePtr, u32 *WidthPtr, u32 *HeightPtr)
void XOsd_SetBackgroundColor (XOsd *InstancePtr, u16 Red, u16 Blue, u16 Green)
void XOsd_GetBackgroundColor (XOsd *InstancePtr, u16 *RedPtr, u16 *BluePtr, u16 *GreenPtr)
void XOsd_SetLayerDimension (XOsd *InstancePtr, u8 LayerIndex, u16 XStart, u16 YStart, u16 XSize, u16 YSize)
void XOsd_GetLayerDimension (XOsd *InstancePtr, u8 LayerIndex, u16 *XStartPtr, u16 *YStartPtr, u16 *XSizePtr, u16 *YSizePtr)
void XOsd_SetLayerAlpha (XOsd *InstancePtr, u8 LayerIndex, u16 GlobalAlphaEnable, u16 GlobalAlphaValue)
void XOsd_GetLayerAlpha (XOsd *InstancePtr, u8 LayerIndex, u16 *GlobalAlphaEnablePtr, u16 *GlobalAlphaValuePtr)
void XOsd_SetLayerPriority (XOsd *InstancePtr, u8 LayerIndex, u8 Priority)
void XOsd_GetLayerPriority (XOsd *InstancePtr, u8 LayerIndex, u8 *PriorityPtr)
void XOsd_EnableLayer (XOsd *InstancePtr, u8 LayerIndex)
void XOsd_DisableLayer (XOsd *InstancePtr, u8 LayerIndex)
void XOsd_LoadColorLUTBank (XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, u32 ColorData[])
void XOsd_LoadCharacterSetBank (XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, u32 CharSetData[])
void XOsd_LoadTextBank (XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, u32 TextData[])
void XOsd_SetActiveBank (XOsd *InstancePtr, u8 GcIndex, u8 ColorBankIndex, u8 CharBankIndex, u8 TextBankIndex, u8 InstructionBankIndex)
void XOsd_CreateInstruction (XOsd *InstancePtr, u32 InstructionPtr[], u8 GcIndex, u16 ObjType, u8 ObjSize, u16 XStart, u16 YStart, u16 XEnd, u16 YEnd, u8 TextIndex, u8 ColorIndex)
void XOsd_LoadInstructionList (XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, u32 InstSetPtr[], u32 InstNum)
u32 XOsd_GetVersion (XOsd *InstancePtr)


Function Documentation

int XOsd_CfgInitialize ( XOsd InstancePtr,
XOsd_Config CfgPtr,
u32  EffectiveAddr 
)

This function initializes an OSD core. This function must be called prior to using an OSD core. Initialization of an OSD includes setting up the instance data and ensuring the hardware is in a quiescent state.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
CfgPtr points to the configuration structure associated with the OSD core.
EffectiveAddr is the base address of the core. If address translation is being used, then this parameter must reflect the virtual base address. Otherwise, the physical address should be used.
Returns:
- XST_SUCCESS if XOsd_CfgInitialize was successful.
Note:
None.

void XOsd_CreateInstruction ( XOsd InstancePtr,
u32  InstructionPtr[],
u8  GcIndex,
u16  ObjType,
u8  ObjSize,
u16  XStart,
u16  YStart,
u16  XEnd,
u16  YEnd,
u8  TextIndex,
u8  ColorIndex 
)

This function creates an instruction for the OSD core.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
InstructionPtr is a pointer to the instruction buffer to be populated with the instruction to be created. The upper level application is responsible for allocating this instruction buffer.
GcIndex indicates the Graphics Controller that will consume the instruction. Valid value range is from 0 to (The Number of Layers) - 1. The layer's type must be set to XOSD_LAYER_TYPE_GPU (defined in xosd_hw.h) for this function to work properly.
ObjType indicates the type of object to draw. Use one of XOSD_INS_OPCODE_* constants defined in xosd_hw.h.
ObjSize indicates line width of boxes and lines and the text scale factor for text boxes.
XStart indicates the horizontal start pixel of the Object.
YStart indicates the vertical start line of the Object.
XEnd indicates the horizontal end pixel of the Object.
YEnd indicates the vertical end line of the Object.
TextIndex indicates the string index.
ColorIndex indicates the color index.
Returns:
None.
Note:
None.

void XOsd_DisableLayer ( XOsd InstancePtr,
u8  LayerIndex 
)

This function disables an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
Returns:
None.
Note:
None.

void XOsd_EnableLayer ( XOsd InstancePtr,
u8  LayerIndex 
)

This function enables an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
Returns:
None.
Note:
None.

void XOsd_GetActiveSize ( XOsd InstancePtr,
u32 *  WidthPtr,
u32 *  HeightPtr 
)

This function gets the screen size of the OSD Output.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
WidthPtr will point to the width of the OSD output after this function returns.
HeightPtr will point to the height of the OSD output after this function returns.
Returns:
None.
Note:
None.

void XOsd_GetBackgroundColor ( XOsd InstancePtr,
u16 *  RedPtr,
u16 *  BluePtr,
u16 *  GreenPtr 
)

This function gets the background color used by the OSD output.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
RedPtr will point to the red value used in the background color after this function returns.
BluePtr will point to the blue value used in the background color after this function returns.
GreenPtr will point to the green value used in the background color after this function returns.
Returns:
None.
Note:
None.

void XOsd_GetLayerAlpha ( XOsd InstancePtr,
u8  LayerIndex,
u16 *  GlobalAlphaEnablePtr,
u16 *  GlobalAlphaValuePtr 
)

This function gets the alpha value and mode of an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
GlobalAlphaEnablePtr will point to a flag indicating whether the global alpha is enabled on a layer after this function returns. Flag 1 indicates that the global alpha is enabled, 0 indicates that it is not.
GlobalAlphaValuePtr will point to the transparent level after this function returns. 0 for 100% transparent, 255 (8bit) for 0% transparent (100% opaque).
Returns:
None.
Note:
None.

void XOsd_GetLayerDimension ( XOsd InstancePtr,
u8  LayerIndex,
u16 *  XStartPtr,
u16 *  YStartPtr,
u16 *  XSizePtr,
u16 *  YSizePtr 
)

This function gets the start position and size of an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
XStartPtr will point to the horizontal start pixel value of origin of the layer after this function returns.
YStartPtr will point to the vertical start line of origin of the layer after this function returns.
XSizePtr will point to the horizontal size value of the layer after this function returns.
YSizePtr will point to the vertical size value of the layer after this function returns.
Returns:
None.
Note:
None.

void XOsd_GetLayerPriority ( XOsd InstancePtr,
u8  LayerIndex,
u8 *  PriorityPtr 
)

This function gets the priority of an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
PriorityPtr will point to the priority used on the layer after this function returns. Use one of XOSD_LAYER_PRIORITY_0 (the lowest priority) through XOSD_LAYER_PRIORITY_7 (the highest priority) defined in xosd_hw.h to interpret the value.
Returns:
None.
Note:
None.

u32 XOsd_GetVersion ( XOsd InstancePtr  ) 

This function returns the Version of the OSD core.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
Returns:
Contents of the Version register.
Note:
None.

void XOsd_LoadCharacterSetBank ( XOsd InstancePtr,
u8  GcIndex,
u8  BankIndex,
u32  CharSetData[] 
)

This function loads character set data (font) into an OSD Graphics Controller bank.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
GcIndex indicates which Graphics Controller to work on. Valid value range is from 0 to (The Number of Layers) - 1. The layer's type must be set to XOSD_LAYER_TYPE_GPU (defined in xosd_hw.h) for this function to work properly.
BankIndex indicates which GC bank to be worked on. Valid value range is from 0 to XOSD_GC_BANK_NUM - 1.
CharSetData points to the character set data to be loaded.
Returns:
None.
Note:
None.

void XOsd_LoadColorLUTBank ( XOsd InstancePtr,
u8  GcIndex,
u8  BankIndex,
u32  ColorData[] 
)

This function loads color look up table data into an OSD Graphics Controller bank.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
GcIndex indicates which Graphics Controller to work on. Valid value range is from 0 to (The Number of Layers) - 1. The layer's type must be set to XOSD_LAYER_TYPE_GPU (defined in xosd_hw.h) for this function to work properly.
BankIndex indicates which GC Bank to be worked on. Valid value range is from 0 to XOSD_GC_BANK_NUM - 1.
ColorData points to the color LUT data to be loaded.
Returns:
None.
Note:
None.

void XOsd_LoadInstructionList ( XOsd InstancePtr,
u8  GcIndex,
u8  BankIndex,
u32  InstSetPtr[],
u32  InstNum 
)

This function load an instruction list to be used by an Graphic Controller in the OSD core.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
GcIndex indicates which Graphics Controller to work on. Valid value range is from 0 to (The Number of Layers) - 1. The layer's type must be set to XOSD_LAYER_TYPE_GPU (defined in xosd_hw.h) for this function to work properly.
BankIndex indicates which GC Bank to be worked on. Valid value range is from 0 to XOSD_GC_BANK_NUM.
InstSetPtr is a pointer to the start of the instruction list to load into the OSD core. The last instruction in the list must has XOSD_INS_OPCODE_END type.
InstNum indicates the number of the instructions in the list to load. Valid value range is from 1 to the half of the size of the instruction memory created for the Graphic Controller.
Returns:
None.
Note:
None.

void XOsd_LoadTextBank ( XOsd InstancePtr,
u8  GcIndex,
u8  BankIndex,
u32  TextData[] 
)

This function loads text data into an OSD Graphics Controller bank.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
GcIndex indicates which Graphics Controller to work on. Valid value range is from 0 to (The Number of Layers) - 1. The layer's type must be set to XOSD_LAYER_TYPE_GPU (defined in xosd_hw.h) for this function to work properly.
BankIndex indicates which GC bank to be worked on. Valid value range is from 0 to XOSD_GC_BANK_NUM - 1.
TextData points to the text data to be loaded.
Returns:
None.
Note:
None.

void XOsd_SetActiveBank ( XOsd InstancePtr,
u8  GcIndex,
u8  ColorBankIndex,
u8  CharBankIndex,
u8  TextBankIndex,
u8  InstructionBankIndex 
)

This function chooses active banks for a GC in the OSD core.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
GcIndex indicates which Graphics Controller to work on. Valid value range is from 0 to (The Number of Layers) - 1. The layer's type must be set to XOSD_LAYER_TYPE_GPU (defined in xosd_hw.h) for this function to work properly.
ColorBankIndex indicates the color LUT bank to be choose as active.
CharBankIndex indicates the character set bank to be chosen as active.
TextBankIndex indicates the text data bank to be chosen as active.
InstructionBankIndex indicates the instruction bank to be chosen as active.
Returns:
None.
Note:
None.

void XOsd_SetActiveSize ( XOsd InstancePtr,
u32  Width,
u32  Height 
)

This function sets the screen size of the OSD Output.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
Width defines the width of the OSD output.
Height defines the height of the OSD output.
Returns:
None.
Note:
None.

void XOsd_SetBackgroundColor ( XOsd InstancePtr,
u16  Red,
u16  Blue,
u16  Green 
)

This function sets the background color used by the OSD output.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
Red indicates the red value to be used in the background color.
Blue indicates the blue value to be used in the background color.
Green indicates the green value to be used in the background color.
Returns:
None.
Note:
None.

void XOsd_SetLayerAlpha ( XOsd InstancePtr,
u8  LayerIndex,
u16  GlobalAlphaEnable,
u16  GlobalAlphaValue 
)

This function sets the alpha value and mode of an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
GlobalAlphaEnable indicates whether to enable the global alpha. Use any non-0 value to enable the global alpha, and 0 to disable it.
GlobalAlphaValue indicates the transparent level. 0 for 100% transparent, 255 (8bit) for 0% transparent (100% opaque). This argument will be ignored if parameter GlobalAlphaEnble has value 0.
Returns:
None.
Note:
None.

void XOsd_SetLayerDimension ( XOsd InstancePtr,
u8  LayerIndex,
u16  XStart,
u16  YStart,
u16  XSize,
u16  YSize 
)

This function sets the start position and size of an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
XStart indicates the horizontal start pixel of origin of the layer.
YStart indicates the vertical start line of origin of the layer.
XSize indicates the horizontal size of the layer.
YSize indicates the vertical size of the layer.
Returns:
None.
Note:
None.

void XOsd_SetLayerPriority ( XOsd InstancePtr,
u8  LayerIndex,
u8  Priority 
)

This function sets the priority of an OSD layer.

Parameters:
InstancePtr is a pointer to the XOsd instance to be worked on.
LayerIndex indicates which layer to be worked on. Valid value range is from 0 to (the number of layers implemented in the core - 1).
Priority indicates the priority to be applied on the layer. Use one of XOSD_LAYER_PRIORITY_0 (the lowest priority) through XOSD_LAYER_PRIORITY_7 (the highest priority) defined in xosd_hw.h.
Returns:
None.
Note:
None.

Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.