From c3f440365491ab3d3a86a42d2eba7221cc94dcdb Mon Sep 17 00:00:00 2001 From: Shravan Kumar A Date: Fri, 18 Jul 2014 12:45:33 +0530 Subject: [PATCH] osd: Added source files Modified the source files, added selftest example, Doxygen docs Signed-off-by: Shravan Kumar A Acked-by: Srikanth Vemula --- XilinxProcessorIPLib/drivers/osd/data/osd.mdd | 100 +- XilinxProcessorIPLib/drivers/osd/data/osd.tcl | 160 +- .../drivers/osd/examples/index.html | 34 +- .../osd/examples/osd_selftest_example.c | 150 + XilinxProcessorIPLib/drivers/osd/src/Makefile | 58 +- XilinxProcessorIPLib/drivers/osd/src/xosd.c | 2738 +++++++++-------- XilinxProcessorIPLib/drivers/osd/src/xosd.h | 1595 +++++----- XilinxProcessorIPLib/drivers/osd/src/xosd_g.c | 353 +-- .../drivers/osd/src/xosd_hw.h | 1183 ++++--- .../drivers/osd/src/xosd_intr.c | 403 +-- .../drivers/osd/src/xosd_selftest.c | 107 + .../drivers/osd/src/xosd_sinit.c | 205 +- 12 files changed, 3902 insertions(+), 3184 deletions(-) create mode 100755 XilinxProcessorIPLib/drivers/osd/examples/osd_selftest_example.c create mode 100755 XilinxProcessorIPLib/drivers/osd/src/xosd_selftest.c diff --git a/XilinxProcessorIPLib/drivers/osd/data/osd.mdd b/XilinxProcessorIPLib/drivers/osd/data/osd.mdd index 6d92c645..728a9ddf 100755 --- a/XilinxProcessorIPLib/drivers/osd/data/osd.mdd +++ b/XilinxProcessorIPLib/drivers/osd/data/osd.mdd @@ -1,51 +1,51 @@ +############################################################################## +# +# Copyright (C) 2008 - 2014 Xilinx, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"),to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# Use of the Software is limited solely to applications: +# (a) running on a Xilinx device, or +# (b) that interact with a Xilinx device through a bus or interconnect. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the Xilinx shall not be used +# in advertising or otherwise to promote the sale, use or other dealings in +# this Software without prior written authorization from Xilinx. +# +# MODIFICATION HISTORY: +# +# Ver Who Date Changes +# ----- ------ -------- ------------------------------------------------------ +# 1.00a adk 02/18/14 Removed the implementation of interrupt_handler array. +# ############################################################################### -# -# Copyright (C) 2008 - 2014 Xilinx, Inc. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# Use of the Software is limited solely to applications: -# (a) running on a Xilinx device, or -# (b) that interact with a Xilinx device through a bus or interconnect. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -# Except as contained in this notice, the name of the Xilinx shall not be used -# in advertising or otherwise to promote the sale, use or other dealings in -# this Software without prior written authorization from Xilinx. -# -# MODIFICATION HISTORY: -# -## Ver Who Date Changes -# ----- ------ -------- ------------------------------------------------------ -# 1.00a adk 02/18/14 Removed the implementation of interrupt_handler array. -# -############################################################################### -OPTION psf_version = 2.1; - -BEGIN driver osd - - OPTION supported_peripherals = (v_osd_v[6-9]_[0-9]); - OPTION driver_state = ACTIVE; - OPTION copyfiles = all; - OPTION VERSION = 4.0; - OPTION NAME = osd; - - -END driver - - + +OPTION psf_version = 2.1; + +BEGIN driver osd + + OPTION supported_peripherals = (v_osd_v[6-9]_[0-9]); + OPTION driver_state = ACTIVE; + OPTION copyfiles = all; + OPTION VERSION = 4.0; + OPTION NAME = osd; + +END driver + + diff --git a/XilinxProcessorIPLib/drivers/osd/data/osd.tcl b/XilinxProcessorIPLib/drivers/osd/data/osd.tcl index b70b8d62..5a2e4ea2 100755 --- a/XilinxProcessorIPLib/drivers/osd/data/osd.tcl +++ b/XilinxProcessorIPLib/drivers/osd/data/osd.tcl @@ -1,125 +1,37 @@ -############################################################### -# (c) Copyright 2008-2014 Xilinx, Inc. All rights reserved. -# -# This file contains confidential and proprietary information -# of Xilinx, Inc. and is protected under U.S. and -# international copyright and other intellectual property -# laws. -# -# DISCLAIMER -# This disclaimer is not a license and does not grant any -# rights to the materials distributed herewith. Except as -# otherwise provided in a valid license issued to you by -# Xilinx, and to the maximum extent permitted by applicable -# law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -# WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -# AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -# BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -# INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -# (2) Xilinx shall not be liable (whether in contract or tort, -# including negligence, or under any other theory of -# liability) for any loss or damage of any kind or nature -# related to, arising under or in connection with these -# materials, including for any direct, or any indirect, -# special, incidental, or consequential loss or damage -# (including loss of data, profits, goodwill, or any type of -# loss or damage suffered as a result of any action brought -# by a third party) even if such damage or loss was -# reasonably foreseeable or Xilinx had been advised of the -# possibility of the same. -# -# CRITICAL APPLICATIONS -# Xilinx products are not designed or intended to be fail- -# safe, or for use in any application requiring fail-safe -# performance, such as life-support or safety devices or -# systems, Class III medical devices, nuclear facilities, -# applications related to the deployment of airbags, or any -# other applications that could lead to death, personal -# injury, or severe property or environmental damage -# (individually and collectively, "Critical -# Applications"). Customer assumes the sole risk and -# liability of any use of Xilinx products in Critical -# Applications, subject only to applicable laws and -# regulations governing limitations on product liability. -# -# THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -# PART OF THIS FILE AT ALL TIMES. -# MODIFICATION HISTORY: -# Ver Who Date Changes -# -------- ------ -------- ------------------------------------ -# 3.0 adk 12/10/13 Updated as per the New Tcl API's -############################################################### - -proc generate {drv_handle} { - xdefine_include_file $drv_handle "xparameters.h" "XOSD" "NUM_INSTANCES" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_NUM_LAYERS" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_LAYER0_TYPE" "C_LAYER1_TYPE" "C_LAYER2_TYPE" "C_LAYER3_TYPE" "C_LAYER4_TYPE" "C_LAYER5_TYPE" "C_LAYER6_TYPE" "C_LAYER7_TYPE" "C_LAYER0_IMEM_SIZE" "C_LAYER0_INS_BOX_EN" "C_LAYER0_INS_LINE_EN" "C_LAYER0_INS_TEXT_EN" "C_LAYER0_CLUT_SIZE" "C_LAYER0_CLUT_MEMTYPE" "C_LAYER0_FONT_NUM_CHARS" "C_LAYER0_FONT_WIDTH" "C_LAYER0_FONT_HEIGHT" "C_LAYER0_FONT_BPP" "C_LAYER0_FONT_ASCII_OFFSET" "C_LAYER0_TEXT_NUM_STRINGS" "C_LAYER0_TEXT_MAX_STRING_LENGTH" "C_LAYER1_IMEM_SIZE" "C_LAYER1_INS_BOX_EN" "C_LAYER1_INS_LINE_EN" "C_LAYER1_INS_TEXT_EN" "C_LAYER1_CLUT_SIZE" "C_LAYER1_CLUT_MEMTYPE" "C_LAYER1_FONT_NUM_CHARS" "C_LAYER1_FONT_WIDTH" "C_LAYER1_FONT_HEIGHT" "C_LAYER1_FONT_BPP" "C_LAYER1_FONT_ASCII_OFFSET" "C_LAYER1_TEXT_NUM_STRINGS" "C_LAYER1_TEXT_MAX_STRING_LENGTH" "C_LAYER2_IMEM_SIZE" "C_LAYER2_INS_BOX_EN" "C_LAYER2_INS_LINE_EN" "C_LAYER2_INS_TEXT_EN" "C_LAYER2_CLUT_SIZE" "C_LAYER2_CLUT_MEMTYPE" "C_LAYER2_FONT_NUM_CHARS" "C_LAYER2_FONT_WIDTH" "C_LAYER2_FONT_HEIGHT" "C_LAYER2_FONT_BPP" "C_LAYER2_FONT_ASCII_OFFSET" "C_LAYER2_TEXT_NUM_STRINGS" "C_LAYER2_TEXT_MAX_STRING_LENGTH" "C_LAYER3_IMEM_SIZE" "C_LAYER3_INS_BOX_EN" "C_LAYER3_INS_LINE_EN" "C_LAYER3_INS_TEXT_EN" "C_LAYER3_CLUT_SIZE" "C_LAYER3_CLUT_MEMTYPE" "C_LAYER3_FONT_NUM_CHARS" "C_LAYER3_FONT_WIDTH" "C_LAYER3_FONT_HEIGHT" "C_LAYER3_FONT_BPP" "C_LAYER3_FONT_ASCII_OFFSET" "C_LAYER3_TEXT_NUM_STRINGS" "C_LAYER3_TEXT_MAX_STRING_LENGTH" "C_LAYER4_IMEM_SIZE" "C_LAYER4_INS_BOX_EN" "C_LAYER4_INS_LINE_EN" "C_LAYER4_INS_TEXT_EN" "C_LAYER4_CLUT_SIZE" "C_LAYER4_CLUT_MEMTYPE" "C_LAYER4_FONT_NUM_CHARS" "C_LAYER4_FONT_WIDTH" "C_LAYER4_FONT_HEIGHT" "C_LAYER4_FONT_BPP" "C_LAYER4_FONT_ASCII_OFFSET" "C_LAYER4_TEXT_NUM_STRINGS" "C_LAYER4_TEXT_MAX_STRING_LENGTH" "C_LAYER5_IMEM_SIZE" "C_LAYER5_INS_BOX_EN" "C_LAYER5_INS_LINE_EN" "C_LAYER5_INS_TEXT_EN" "C_LAYER5_CLUT_SIZE" "C_LAYER5_CLUT_MEMTYPE" "C_LAYER5_FONT_NUM_CHARS" "C_LAYER5_FONT_WIDTH" "C_LAYER5_FONT_HEIGHT" "C_LAYER5_FONT_BPP" "C_LAYER5_FONT_ASCII_OFFSET" "C_LAYER5_TEXT_NUM_STRINGS" "C_LAYER5_TEXT_MAX_STRING_LENGTH" "C_LAYER6_IMEM_SIZE" "C_LAYER6_INS_BOX_EN" "C_LAYER6_INS_LINE_EN" "C_LAYER6_INS_TEXT_EN" "C_LAYER6_CLUT_SIZE" "C_LAYER6_CLUT_MEMTYPE" "C_LAYER6_FONT_NUM_CHARS" "C_LAYER6_FONT_WIDTH" "C_LAYER6_FONT_HEIGHT" "C_LAYER6_FONT_BPP" "C_LAYER6_FONT_ASCII_OFFSET" "C_LAYER6_TEXT_NUM_STRINGS" "C_LAYER6_TEXT_MAX_STRING_LENGTH" "C_LAYER7_IMEM_SIZE" "C_LAYER7_INS_BOX_EN" "C_LAYER7_INS_LINE_EN" "C_LAYER7_INS_TEXT_EN" "C_LAYER7_CLUT_SIZE" "C_LAYER7_CLUT_MEMTYPE" "C_LAYER7_FONT_NUM_CHARS" "C_LAYER7_FONT_WIDTH" "C_LAYER7_FONT_HEIGHT" "C_LAYER7_FONT_BPP" "C_LAYER7_FONT_ASCII_OFFSET" "C_LAYER7_TEXT_NUM_STRINGS" "C_LAYER7_TEXT_MAX_STRING_LENGTH" - xdefine_config_file $drv_handle "xosd_g.c" "XOSD" "DEVICE_ID" "C_BASEADDR" "C_NUM_LAYERS" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_LAYER0_TYPE" "C_LAYER1_TYPE" "C_LAYER2_TYPE" "C_LAYER3_TYPE" "C_LAYER4_TYPE" "C_LAYER5_TYPE" "C_LAYER6_TYPE" "C_LAYER7_TYPE" "C_LAYER0_IMEM_SIZE" "C_LAYER0_INS_BOX_EN" "C_LAYER0_INS_LINE_EN" "C_LAYER0_INS_TEXT_EN" "C_LAYER0_CLUT_SIZE" "C_LAYER0_CLUT_MEMTYPE" "C_LAYER0_FONT_NUM_CHARS" "C_LAYER0_FONT_WIDTH" "C_LAYER0_FONT_HEIGHT" "C_LAYER0_FONT_BPP" "C_LAYER0_FONT_ASCII_OFFSET" "C_LAYER0_TEXT_NUM_STRINGS" "C_LAYER0_TEXT_MAX_STRING_LENGTH" "C_LAYER1_IMEM_SIZE" "C_LAYER1_INS_BOX_EN" "C_LAYER1_INS_LINE_EN" "C_LAYER1_INS_TEXT_EN" "C_LAYER1_CLUT_SIZE" "C_LAYER1_CLUT_MEMTYPE" "C_LAYER1_FONT_NUM_CHARS" "C_LAYER1_FONT_WIDTH" "C_LAYER1_FONT_HEIGHT" "C_LAYER1_FONT_BPP" "C_LAYER1_FONT_ASCII_OFFSET" "C_LAYER1_TEXT_NUM_STRINGS" "C_LAYER1_TEXT_MAX_STRING_LENGTH" "C_LAYER2_IMEM_SIZE" "C_LAYER2_INS_BOX_EN" "C_LAYER2_INS_LINE_EN" "C_LAYER2_INS_TEXT_EN" "C_LAYER2_CLUT_SIZE" "C_LAYER2_CLUT_MEMTYPE" "C_LAYER2_FONT_NUM_CHARS" "C_LAYER2_FONT_WIDTH" "C_LAYER2_FONT_HEIGHT" "C_LAYER2_FONT_BPP" "C_LAYER2_FONT_ASCII_OFFSET" "C_LAYER2_TEXT_NUM_STRINGS" "C_LAYER2_TEXT_MAX_STRING_LENGTH" "C_LAYER3_IMEM_SIZE" "C_LAYER3_INS_BOX_EN" "C_LAYER3_INS_LINE_EN" "C_LAYER3_INS_TEXT_EN" "C_LAYER3_CLUT_SIZE" "C_LAYER3_CLUT_MEMTYPE" "C_LAYER3_FONT_NUM_CHARS" "C_LAYER3_FONT_WIDTH" "C_LAYER3_FONT_HEIGHT" "C_LAYER3_FONT_BPP" "C_LAYER3_FONT_ASCII_OFFSET" "C_LAYER3_TEXT_NUM_STRINGS" "C_LAYER3_TEXT_MAX_STRING_LENGTH" "C_LAYER4_IMEM_SIZE" "C_LAYER4_INS_BOX_EN" "C_LAYER4_INS_LINE_EN" "C_LAYER4_INS_TEXT_EN" "C_LAYER4_CLUT_SIZE" "C_LAYER4_CLUT_MEMTYPE" "C_LAYER4_FONT_NUM_CHARS" "C_LAYER4_FONT_WIDTH" "C_LAYER4_FONT_HEIGHT" "C_LAYER4_FONT_BPP" "C_LAYER4_FONT_ASCII_OFFSET" "C_LAYER4_TEXT_NUM_STRINGS" "C_LAYER4_TEXT_MAX_STRING_LENGTH" "C_LAYER5_IMEM_SIZE" "C_LAYER5_INS_BOX_EN" "C_LAYER5_INS_LINE_EN" "C_LAYER5_INS_TEXT_EN" "C_LAYER5_CLUT_SIZE" "C_LAYER5_CLUT_MEMTYPE" "C_LAYER5_FONT_NUM_CHARS" "C_LAYER5_FONT_WIDTH" "C_LAYER5_FONT_HEIGHT" "C_LAYER5_FONT_BPP" "C_LAYER5_FONT_ASCII_OFFSET" "C_LAYER5_TEXT_NUM_STRINGS" "C_LAYER5_TEXT_MAX_STRING_LENGTH" "C_LAYER6_IMEM_SIZE" "C_LAYER6_INS_BOX_EN" "C_LAYER6_INS_LINE_EN" "C_LAYER6_INS_TEXT_EN" "C_LAYER6_CLUT_SIZE" "C_LAYER6_CLUT_MEMTYPE" "C_LAYER6_FONT_NUM_CHARS" "C_LAYER6_FONT_WIDTH" "C_LAYER6_FONT_HEIGHT" "C_LAYER6_FONT_BPP" "C_LAYER6_FONT_ASCII_OFFSET" "C_LAYER6_TEXT_NUM_STRINGS" "C_LAYER6_TEXT_MAX_STRING_LENGTH" "C_LAYER7_IMEM_SIZE" "C_LAYER7_INS_BOX_EN" "C_LAYER7_INS_LINE_EN" "C_LAYER7_INS_TEXT_EN" "C_LAYER7_CLUT_SIZE" "C_LAYER7_CLUT_MEMTYPE" "C_LAYER7_FONT_NUM_CHARS" "C_LAYER7_FONT_WIDTH" "C_LAYER7_FONT_HEIGHT" "C_LAYER7_FONT_BPP" "C_LAYER7_FONT_ASCII_OFFSET" "C_LAYER7_TEXT_NUM_STRINGS" "C_LAYER7_TEXT_MAX_STRING_LENGTH" - xdefine_canonical_xpars $drv_handle "xparameters.h" "OSD" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_NUM_LAYERS" "C_LAYER0_TYPE" "C_LAYER1_TYPE" "C_LAYER2_TYPE" "C_LAYER3_TYPE" "C_LAYER4_TYPE" "C_LAYER5_TYPE" "C_LAYER6_TYPE" "C_LAYER7_TYPE" "C_LAYER0_IMEM_SIZE" "C_LAYER0_INS_BOX_EN" "C_LAYER0_INS_LINE_EN" "C_LAYER0_INS_TEXT_EN" "C_LAYER0_CLUT_SIZE" "C_LAYER0_CLUT_MEMTYPE" "C_LAYER0_FONT_NUM_CHARS" "C_LAYER0_FONT_WIDTH" "C_LAYER0_FONT_HEIGHT" "C_LAYER0_FONT_BPP" "C_LAYER0_FONT_ASCII_OFFSET" "C_LAYER0_TEXT_NUM_STRINGS" "C_LAYER0_TEXT_MAX_STRING_LENGTH" "C_LAYER1_IMEM_SIZE" "C_LAYER1_INS_BOX_EN" "C_LAYER1_INS_LINE_EN" "C_LAYER1_INS_TEXT_EN" "C_LAYER1_CLUT_SIZE" "C_LAYER1_CLUT_MEMTYPE" "C_LAYER1_FONT_NUM_CHARS" "C_LAYER1_FONT_WIDTH" "C_LAYER1_FONT_HEIGHT" "C_LAYER1_FONT_BPP" "C_LAYER1_FONT_ASCII_OFFSET" "C_LAYER1_TEXT_NUM_STRINGS" "C_LAYER1_TEXT_MAX_STRING_LENGTH" "C_LAYER2_IMEM_SIZE" "C_LAYER2_INS_BOX_EN" "C_LAYER2_INS_LINE_EN" "C_LAYER2_INS_TEXT_EN" "C_LAYER2_CLUT_SIZE" "C_LAYER2_CLUT_MEMTYPE" "C_LAYER2_FONT_NUM_CHARS" "C_LAYER2_FONT_WIDTH" "C_LAYER2_FONT_HEIGHT" "C_LAYER2_FONT_BPP" "C_LAYER2_FONT_ASCII_OFFSET" "C_LAYER2_TEXT_NUM_STRINGS" "C_LAYER2_TEXT_MAX_STRING_LENGTH" "C_LAYER3_IMEM_SIZE" "C_LAYER3_INS_BOX_EN" "C_LAYER3_INS_LINE_EN" "C_LAYER3_INS_TEXT_EN" "C_LAYER3_CLUT_SIZE" "C_LAYER3_CLUT_MEMTYPE" "C_LAYER3_FONT_NUM_CHARS" "C_LAYER3_FONT_WIDTH" "C_LAYER3_FONT_HEIGHT" "C_LAYER3_FONT_BPP" "C_LAYER3_FONT_ASCII_OFFSET" "C_LAYER3_TEXT_NUM_STRINGS" "C_LAYER3_TEXT_MAX_STRING_LENGTH" "C_LAYER4_IMEM_SIZE" "C_LAYER4_INS_BOX_EN" "C_LAYER4_INS_LINE_EN" "C_LAYER4_INS_TEXT_EN" "C_LAYER4_CLUT_SIZE" "C_LAYER4_CLUT_MEMTYPE" "C_LAYER4_FONT_NUM_CHARS" "C_LAYER4_FONT_WIDTH" "C_LAYER4_FONT_HEIGHT" "C_LAYER4_FONT_BPP" "C_LAYER4_FONT_ASCII_OFFSET" "C_LAYER4_TEXT_NUM_STRINGS" "C_LAYER4_TEXT_MAX_STRING_LENGTH" "C_LAYER5_IMEM_SIZE" "C_LAYER5_INS_BOX_EN" "C_LAYER5_INS_LINE_EN" "C_LAYER5_INS_TEXT_EN" "C_LAYER5_CLUT_SIZE" "C_LAYER5_CLUT_MEMTYPE" "C_LAYER5_FONT_NUM_CHARS" "C_LAYER5_FONT_WIDTH" "C_LAYER5_FONT_HEIGHT" "C_LAYER5_FONT_BPP" "C_LAYER5_FONT_ASCII_OFFSET" "C_LAYER5_TEXT_NUM_STRINGS" "C_LAYER5_TEXT_MAX_STRING_LENGTH" "C_LAYER6_IMEM_SIZE" "C_LAYER6_INS_BOX_EN" "C_LAYER6_INS_LINE_EN" "C_LAYER6_INS_TEXT_EN" "C_LAYER6_CLUT_SIZE" "C_LAYER6_CLUT_MEMTYPE" "C_LAYER6_FONT_NUM_CHARS" "C_LAYER6_FONT_WIDTH" "C_LAYER6_FONT_HEIGHT" "C_LAYER6_FONT_BPP" "C_LAYER6_FONT_ASCII_OFFSET" "C_LAYER6_TEXT_NUM_STRINGS" "C_LAYER6_TEXT_MAX_STRING_LENGTH" "C_LAYER7_IMEM_SIZE" "C_LAYER7_INS_BOX_EN" "C_LAYER7_INS_LINE_EN" "C_LAYER7_INS_TEXT_EN" "C_LAYER7_CLUT_SIZE" "C_LAYER7_CLUT_MEMTYPE" "C_LAYER7_FONT_NUM_CHARS" "C_LAYER7_FONT_WIDTH" "C_LAYER7_FONT_HEIGHT" "C_LAYER7_FONT_BPP" "C_LAYER7_FONT_ASCII_OFFSET" "C_LAYER7_TEXT_NUM_STRINGS" "C_LAYER7_TEXT_MAX_STRING_LENGTH" -} - - -# -# Given a list of arguments, define each as a canonical constant name, using -# the driver name, in an include file. -# -proc xdefine_canonical_xpars {drv_handle file_name drv_string args} { - # Open include file - set file_handle [::hsm::utils::open_include_file $file_name] - - # Get all the peripherals connected to this driver - set periphs [::hsm::utils::get_common_driver_ips $drv_handle] - - # Get the names of all the peripherals connected to this driver - foreach periph $periphs { - set peripheral_name [string toupper [get_property NAME $periph]] - lappend peripherals $peripheral_name - } - - # Get possible canonical names for all the peripherals connected to this driver - set device_id 0 - foreach periph $periphs { - set canonical_name [string toupper [format "%s_%s" $drv_string $device_id]] - lappend canonicals $canonical_name - - # Create a list of IDs of the peripherals whose hardware instance name - # doesn't match the canonical name. These IDs can be used later to - # generate canonical definitions - if { [lsearch $peripherals $canonical_name] < 0 } { - lappend indices $device_id - } - incr device_id - } - - set i 0 - foreach periph $periphs { - set periph_name [string toupper [get_property NAME $periph]] - - # Generate canonical definitions only for the peripherals whose - # canonical name is not the same as hardware instance name - if { [lsearch $canonicals $periph_name] < 0 } { - puts $file_handle "/* Canonical definitions for peripheral $periph_name */" - set canonical_name [format "%s_%s" $drv_string [lindex $indices $i]] - - foreach arg $args { - set lvalue [::hsm::utils::get_driver_param_name $canonical_name $arg] - - # The commented out rvalue is the name of the instance-specific constant - # set rvalue [::hsm::utils::get_ip_param_name $periph $arg] - - # The rvalue set below is the actual value of the parameter - set rvalue [get_property CONFIG.$arg $periph] - if {[llength $rvalue] == 0} { - set rvalue 0 - } - set rvalue [::hsm::utils::format_addr_string $rvalue $arg] - - puts $file_handle "#define $lvalue $rvalue" - - } - puts $file_handle "" - incr i - } - } - - puts $file_handle "\n/******************************************************************/\n" - close $file_handle +############################################################################## +# +# Copyright (C) 2008 - 2014 Xilinx, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"),to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# Use of the Software is limited solely to applications: +# (a) running on a Xilinx device, or +# (b) that interact with a Xilinx device through a bus or interconnect. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the Xilinx shall not be used +# in advertising or otherwise to promote the sale, use or other dealings in +# this Software without prior written authorization from Xilinx. +############################################################################### +#uses "xillib.tcl" + +proc generate {drv_handle} { + xdefine_include_file $drv_handle "xparameters.h" "XOSD" "NUM_INSTANCES" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_NUM_LAYERS" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_LAYER0_TYPE" "C_LAYER1_TYPE" "C_LAYER2_TYPE" "C_LAYER3_TYPE" "C_LAYER4_TYPE" "C_LAYER5_TYPE" "C_LAYER6_TYPE" "C_LAYER7_TYPE" "C_LAYER0_IMEM_SIZE" "C_LAYER0_INS_BOX_EN" "C_LAYER0_INS_LINE_EN" "C_LAYER0_INS_TEXT_EN" "C_LAYER0_CLUT_SIZE" "C_LAYER0_CLUT_MEMTYPE" "C_LAYER0_FONT_NUM_CHARS" "C_LAYER0_FONT_WIDTH" "C_LAYER0_FONT_HEIGHT" "C_LAYER0_FONT_BPP" "C_LAYER0_FONT_ASCII_OFFSET" "C_LAYER0_TEXT_NUM_STRINGS" "C_LAYER0_TEXT_MAX_STRING_LENGTH" "C_LAYER1_IMEM_SIZE" "C_LAYER1_INS_BOX_EN" "C_LAYER1_INS_LINE_EN" "C_LAYER1_INS_TEXT_EN" "C_LAYER1_CLUT_SIZE" "C_LAYER1_CLUT_MEMTYPE" "C_LAYER1_FONT_NUM_CHARS" "C_LAYER1_FONT_WIDTH" "C_LAYER1_FONT_HEIGHT" "C_LAYER1_FONT_BPP" "C_LAYER1_FONT_ASCII_OFFSET" "C_LAYER1_TEXT_NUM_STRINGS" "C_LAYER1_TEXT_MAX_STRING_LENGTH" "C_LAYER2_IMEM_SIZE" "C_LAYER2_INS_BOX_EN" "C_LAYER2_INS_LINE_EN" "C_LAYER2_INS_TEXT_EN" "C_LAYER2_CLUT_SIZE" "C_LAYER2_CLUT_MEMTYPE" "C_LAYER2_FONT_NUM_CHARS" "C_LAYER2_FONT_WIDTH" "C_LAYER2_FONT_HEIGHT" "C_LAYER2_FONT_BPP" "C_LAYER2_FONT_ASCII_OFFSET" "C_LAYER2_TEXT_NUM_STRINGS" "C_LAYER2_TEXT_MAX_STRING_LENGTH" "C_LAYER3_IMEM_SIZE" "C_LAYER3_INS_BOX_EN" "C_LAYER3_INS_LINE_EN" "C_LAYER3_INS_TEXT_EN" "C_LAYER3_CLUT_SIZE" "C_LAYER3_CLUT_MEMTYPE" "C_LAYER3_FONT_NUM_CHARS" "C_LAYER3_FONT_WIDTH" "C_LAYER3_FONT_HEIGHT" "C_LAYER3_FONT_BPP" "C_LAYER3_FONT_ASCII_OFFSET" "C_LAYER3_TEXT_NUM_STRINGS" "C_LAYER3_TEXT_MAX_STRING_LENGTH" "C_LAYER4_IMEM_SIZE" "C_LAYER4_INS_BOX_EN" "C_LAYER4_INS_LINE_EN" "C_LAYER4_INS_TEXT_EN" "C_LAYER4_CLUT_SIZE" "C_LAYER4_CLUT_MEMTYPE" "C_LAYER4_FONT_NUM_CHARS" "C_LAYER4_FONT_WIDTH" "C_LAYER4_FONT_HEIGHT" "C_LAYER4_FONT_BPP" "C_LAYER4_FONT_ASCII_OFFSET" "C_LAYER4_TEXT_NUM_STRINGS" "C_LAYER4_TEXT_MAX_STRING_LENGTH" "C_LAYER5_IMEM_SIZE" "C_LAYER5_INS_BOX_EN" "C_LAYER5_INS_LINE_EN" "C_LAYER5_INS_TEXT_EN" "C_LAYER5_CLUT_SIZE" "C_LAYER5_CLUT_MEMTYPE" "C_LAYER5_FONT_NUM_CHARS" "C_LAYER5_FONT_WIDTH" "C_LAYER5_FONT_HEIGHT" "C_LAYER5_FONT_BPP" "C_LAYER5_FONT_ASCII_OFFSET" "C_LAYER5_TEXT_NUM_STRINGS" "C_LAYER5_TEXT_MAX_STRING_LENGTH" "C_LAYER6_IMEM_SIZE" "C_LAYER6_INS_BOX_EN" "C_LAYER6_INS_LINE_EN" "C_LAYER6_INS_TEXT_EN" "C_LAYER6_CLUT_SIZE" "C_LAYER6_CLUT_MEMTYPE" "C_LAYER6_FONT_NUM_CHARS" "C_LAYER6_FONT_WIDTH" "C_LAYER6_FONT_HEIGHT" "C_LAYER6_FONT_BPP" "C_LAYER6_FONT_ASCII_OFFSET" "C_LAYER6_TEXT_NUM_STRINGS" "C_LAYER6_TEXT_MAX_STRING_LENGTH" "C_LAYER7_IMEM_SIZE" "C_LAYER7_INS_BOX_EN" "C_LAYER7_INS_LINE_EN" "C_LAYER7_INS_TEXT_EN" "C_LAYER7_CLUT_SIZE" "C_LAYER7_CLUT_MEMTYPE" "C_LAYER7_FONT_NUM_CHARS" "C_LAYER7_FONT_WIDTH" "C_LAYER7_FONT_HEIGHT" "C_LAYER7_FONT_BPP" "C_LAYER7_FONT_ASCII_OFFSET" "C_LAYER7_TEXT_NUM_STRINGS" "C_LAYER7_TEXT_MAX_STRING_LENGTH" + xdefine_config_file $drv_handle "xosd_g.c" "XOsd" "DEVICE_ID" "C_BASEADDR" "C_NUM_LAYERS" "C_S_AXIS_VIDEO_DATA_WIDTH" "C_LAYER0_TYPE" "C_LAYER1_TYPE" "C_LAYER2_TYPE" "C_LAYER3_TYPE" "C_LAYER4_TYPE" "C_LAYER5_TYPE" "C_LAYER6_TYPE" "C_LAYER7_TYPE" "C_LAYER0_IMEM_SIZE" "C_LAYER0_INS_BOX_EN" "C_LAYER0_INS_LINE_EN" "C_LAYER0_INS_TEXT_EN" "C_LAYER0_CLUT_SIZE" "C_LAYER0_CLUT_MEMTYPE" "C_LAYER0_FONT_NUM_CHARS" "C_LAYER0_FONT_WIDTH" "C_LAYER0_FONT_HEIGHT" "C_LAYER0_FONT_BPP" "C_LAYER0_FONT_ASCII_OFFSET" "C_LAYER0_TEXT_NUM_STRINGS" "C_LAYER0_TEXT_MAX_STRING_LENGTH" "C_LAYER1_IMEM_SIZE" "C_LAYER1_INS_BOX_EN" "C_LAYER1_INS_LINE_EN" "C_LAYER1_INS_TEXT_EN" "C_LAYER1_CLUT_SIZE" "C_LAYER1_CLUT_MEMTYPE" "C_LAYER1_FONT_NUM_CHARS" "C_LAYER1_FONT_WIDTH" "C_LAYER1_FONT_HEIGHT" "C_LAYER1_FONT_BPP" "C_LAYER1_FONT_ASCII_OFFSET" "C_LAYER1_TEXT_NUM_STRINGS" "C_LAYER1_TEXT_MAX_STRING_LENGTH" "C_LAYER2_IMEM_SIZE" "C_LAYER2_INS_BOX_EN" "C_LAYER2_INS_LINE_EN" "C_LAYER2_INS_TEXT_EN" "C_LAYER2_CLUT_SIZE" "C_LAYER2_CLUT_MEMTYPE" "C_LAYER2_FONT_NUM_CHARS" "C_LAYER2_FONT_WIDTH" "C_LAYER2_FONT_HEIGHT" "C_LAYER2_FONT_BPP" "C_LAYER2_FONT_ASCII_OFFSET" "C_LAYER2_TEXT_NUM_STRINGS" "C_LAYER2_TEXT_MAX_STRING_LENGTH" "C_LAYER3_IMEM_SIZE" "C_LAYER3_INS_BOX_EN" "C_LAYER3_INS_LINE_EN" "C_LAYER3_INS_TEXT_EN" "C_LAYER3_CLUT_SIZE" "C_LAYER3_CLUT_MEMTYPE" "C_LAYER3_FONT_NUM_CHARS" "C_LAYER3_FONT_WIDTH" "C_LAYER3_FONT_HEIGHT" "C_LAYER3_FONT_BPP" "C_LAYER3_FONT_ASCII_OFFSET" "C_LAYER3_TEXT_NUM_STRINGS" "C_LAYER3_TEXT_MAX_STRING_LENGTH" "C_LAYER4_IMEM_SIZE" "C_LAYER4_INS_BOX_EN" "C_LAYER4_INS_LINE_EN" "C_LAYER4_INS_TEXT_EN" "C_LAYER4_CLUT_SIZE" "C_LAYER4_CLUT_MEMTYPE" "C_LAYER4_FONT_NUM_CHARS" "C_LAYER4_FONT_WIDTH" "C_LAYER4_FONT_HEIGHT" "C_LAYER4_FONT_BPP" "C_LAYER4_FONT_ASCII_OFFSET" "C_LAYER4_TEXT_NUM_STRINGS" "C_LAYER4_TEXT_MAX_STRING_LENGTH" "C_LAYER5_IMEM_SIZE" "C_LAYER5_INS_BOX_EN" "C_LAYER5_INS_LINE_EN" "C_LAYER5_INS_TEXT_EN" "C_LAYER5_CLUT_SIZE" "C_LAYER5_CLUT_MEMTYPE" "C_LAYER5_FONT_NUM_CHARS" "C_LAYER5_FONT_WIDTH" "C_LAYER5_FONT_HEIGHT" "C_LAYER5_FONT_BPP" "C_LAYER5_FONT_ASCII_OFFSET" "C_LAYER5_TEXT_NUM_STRINGS" "C_LAYER5_TEXT_MAX_STRING_LENGTH" "C_LAYER6_IMEM_SIZE" "C_LAYER6_INS_BOX_EN" "C_LAYER6_INS_LINE_EN" "C_LAYER6_INS_TEXT_EN" "C_LAYER6_CLUT_SIZE" "C_LAYER6_CLUT_MEMTYPE" "C_LAYER6_FONT_NUM_CHARS" "C_LAYER6_FONT_WIDTH" "C_LAYER6_FONT_HEIGHT" "C_LAYER6_FONT_BPP" "C_LAYER6_FONT_ASCII_OFFSET" "C_LAYER6_TEXT_NUM_STRINGS" "C_LAYER6_TEXT_MAX_STRING_LENGTH" "C_LAYER7_IMEM_SIZE" "C_LAYER7_INS_BOX_EN" "C_LAYER7_INS_LINE_EN" "C_LAYER7_INS_TEXT_EN" "C_LAYER7_CLUT_SIZE" "C_LAYER7_CLUT_MEMTYPE" "C_LAYER7_FONT_NUM_CHARS" "C_LAYER7_FONT_WIDTH" "C_LAYER7_FONT_HEIGHT" "C_LAYER7_FONT_BPP" "C_LAYER7_FONT_ASCII_OFFSET" "C_LAYER7_TEXT_NUM_STRINGS" "C_LAYER7_TEXT_MAX_STRING_LENGTH" + xdefine_canonical_xpars $drv_handle "xparameters.h" "OSD" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_NUM_LAYERS" "C_LAYER0_TYPE" "C_LAYER1_TYPE" "C_LAYER2_TYPE" "C_LAYER3_TYPE" "C_LAYER4_TYPE" "C_LAYER5_TYPE" "C_LAYER6_TYPE" "C_LAYER7_TYPE" "C_LAYER0_IMEM_SIZE" "C_LAYER0_INS_BOX_EN" "C_LAYER0_INS_LINE_EN" "C_LAYER0_INS_TEXT_EN" "C_LAYER0_CLUT_SIZE" "C_LAYER0_CLUT_MEMTYPE" "C_LAYER0_FONT_NUM_CHARS" "C_LAYER0_FONT_WIDTH" "C_LAYER0_FONT_HEIGHT" "C_LAYER0_FONT_BPP" "C_LAYER0_FONT_ASCII_OFFSET" "C_LAYER0_TEXT_NUM_STRINGS" "C_LAYER0_TEXT_MAX_STRING_LENGTH" "C_LAYER1_IMEM_SIZE" "C_LAYER1_INS_BOX_EN" "C_LAYER1_INS_LINE_EN" "C_LAYER1_INS_TEXT_EN" "C_LAYER1_CLUT_SIZE" "C_LAYER1_CLUT_MEMTYPE" "C_LAYER1_FONT_NUM_CHARS" "C_LAYER1_FONT_WIDTH" "C_LAYER1_FONT_HEIGHT" "C_LAYER1_FONT_BPP" "C_LAYER1_FONT_ASCII_OFFSET" "C_LAYER1_TEXT_NUM_STRINGS" "C_LAYER1_TEXT_MAX_STRING_LENGTH" "C_LAYER2_IMEM_SIZE" "C_LAYER2_INS_BOX_EN" "C_LAYER2_INS_LINE_EN" "C_LAYER2_INS_TEXT_EN" "C_LAYER2_CLUT_SIZE" "C_LAYER2_CLUT_MEMTYPE" "C_LAYER2_FONT_NUM_CHARS" "C_LAYER2_FONT_WIDTH" "C_LAYER2_FONT_HEIGHT" "C_LAYER2_FONT_BPP" "C_LAYER2_FONT_ASCII_OFFSET" "C_LAYER2_TEXT_NUM_STRINGS" "C_LAYER2_TEXT_MAX_STRING_LENGTH" "C_LAYER3_IMEM_SIZE" "C_LAYER3_INS_BOX_EN" "C_LAYER3_INS_LINE_EN" "C_LAYER3_INS_TEXT_EN" "C_LAYER3_CLUT_SIZE" "C_LAYER3_CLUT_MEMTYPE" "C_LAYER3_FONT_NUM_CHARS" "C_LAYER3_FONT_WIDTH" "C_LAYER3_FONT_HEIGHT" "C_LAYER3_FONT_BPP" "C_LAYER3_FONT_ASCII_OFFSET" "C_LAYER3_TEXT_NUM_STRINGS" "C_LAYER3_TEXT_MAX_STRING_LENGTH" "C_LAYER4_IMEM_SIZE" "C_LAYER4_INS_BOX_EN" "C_LAYER4_INS_LINE_EN" "C_LAYER4_INS_TEXT_EN" "C_LAYER4_CLUT_SIZE" "C_LAYER4_CLUT_MEMTYPE" "C_LAYER4_FONT_NUM_CHARS" "C_LAYER4_FONT_WIDTH" "C_LAYER4_FONT_HEIGHT" "C_LAYER4_FONT_BPP" "C_LAYER4_FONT_ASCII_OFFSET" "C_LAYER4_TEXT_NUM_STRINGS" "C_LAYER4_TEXT_MAX_STRING_LENGTH" "C_LAYER5_IMEM_SIZE" "C_LAYER5_INS_BOX_EN" "C_LAYER5_INS_LINE_EN" "C_LAYER5_INS_TEXT_EN" "C_LAYER5_CLUT_SIZE" "C_LAYER5_CLUT_MEMTYPE" "C_LAYER5_FONT_NUM_CHARS" "C_LAYER5_FONT_WIDTH" "C_LAYER5_FONT_HEIGHT" "C_LAYER5_FONT_BPP" "C_LAYER5_FONT_ASCII_OFFSET" "C_LAYER5_TEXT_NUM_STRINGS" "C_LAYER5_TEXT_MAX_STRING_LENGTH" "C_LAYER6_IMEM_SIZE" "C_LAYER6_INS_BOX_EN" "C_LAYER6_INS_LINE_EN" "C_LAYER6_INS_TEXT_EN" "C_LAYER6_CLUT_SIZE" "C_LAYER6_CLUT_MEMTYPE" "C_LAYER6_FONT_NUM_CHARS" "C_LAYER6_FONT_WIDTH" "C_LAYER6_FONT_HEIGHT" "C_LAYER6_FONT_BPP" "C_LAYER6_FONT_ASCII_OFFSET" "C_LAYER6_TEXT_NUM_STRINGS" "C_LAYER6_TEXT_MAX_STRING_LENGTH" "C_LAYER7_IMEM_SIZE" "C_LAYER7_INS_BOX_EN" "C_LAYER7_INS_LINE_EN" "C_LAYER7_INS_TEXT_EN" "C_LAYER7_CLUT_SIZE" "C_LAYER7_CLUT_MEMTYPE" "C_LAYER7_FONT_NUM_CHARS" "C_LAYER7_FONT_WIDTH" "C_LAYER7_FONT_HEIGHT" "C_LAYER7_FONT_BPP" "C_LAYER7_FONT_ASCII_OFFSET" "C_LAYER7_TEXT_NUM_STRINGS" "C_LAYER7_TEXT_MAX_STRING_LENGTH" } diff --git a/XilinxProcessorIPLib/drivers/osd/examples/index.html b/XilinxProcessorIPLib/drivers/osd/examples/index.html index 55bf2979..2b01bdaf 100755 --- a/XilinxProcessorIPLib/drivers/osd/examples/index.html +++ b/XilinxProcessorIPLib/drivers/osd/examples/index.html @@ -1,17 +1,17 @@ - - - - - -Driver example applications - - - -

Example Applications for the driver osd_v3_0

-
- -

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

- - \ No newline at end of file + + + + + +Driver example applications + + + +

Example Applications for the driver osd_v3_1

+
+ +

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

+ + diff --git a/XilinxProcessorIPLib/drivers/osd/examples/osd_selftest_example.c b/XilinxProcessorIPLib/drivers/osd/examples/osd_selftest_example.c new file mode 100755 index 00000000..695fe973 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/osd/examples/osd_selftest_example.c @@ -0,0 +1,150 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file osd_selftest_example.c +* +* This file contains an example using the OSD driver to do self test +* on the core. +* +* @note None. +* +* MODIFICATION HISTORY: +*
+* Ver   Who    Date     Changes
+* ----- ------ -------- ------------------------------------------------------
+* 4.0   adk    02/18/14 First Release
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xparameters.h" +#include "xosd.h" +#include "xil_printf.h" + +/************************** Constant Definitions *****************************/ + +/** +* The following constants map to the XPAR parameters created in the +* xparameters.h file. They are defined here such that a user can easily +* change all the needed parameters in one place. +*/ +#define XOSD_DEVICE_ID XPAR_OSD_0_DEVICE_ID + +/**************************** Type Definitions *******************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/************************** Function Prototypes ******************************/ + +int XOsdSelfTestExample(u16 DeviceId); + +/************************** Variable Definitions *****************************/ + +XOsd OsdInst; /**< Instance of the OSD Device */ + +/*****************************************************************************/ +/** +* +* Main/Entry function for self test example. +* +* @return +* - XST_SUCCESS if successful. +* - XST_FAILURE if unsuccessful. +* +* @note None +* +******************************************************************************/ +int main(void) +{ + int Status; + + /* Run selftest example */ + Status = XOsdSelfTestExample(XOSD_DEVICE_ID); + + if (Status != XST_SUCCESS) { + xil_printf("OSD driver Selftest Example Failed\r\n"); + return XST_FAILURE; + } + + xil_printf("Successfully ran OSD driver Selftest Example\r\n"); + + return XST_SUCCESS; +} + +/*****************************************************************************/ +/** +* +* This function does a minimal test on the OSD driver. +* +* @param DeviceId is an ID of OSD core or device. +* +* @return +* - XST_SUCCESS if successful. +* - XST_FAILURE if unsuccessful. +* +* @note None. +* +******************************************************************************/ +int XOsdSelfTestExample(u16 DeviceId) +{ + int Status; + XOsd_Config *Config; + + /* Initialize the OSD driver so that it's ready to use look up the + * configuration in the config table, then initialize it. + */ + Config = XOsd_LookupConfig(DeviceId); + + if (NULL == Config) { + return XST_FAILURE; + } + + Status = XOsd_CfgInitialize(&OsdInst, Config, Config->BaseAddress); + + if (Status != XST_SUCCESS) { + return XST_FAILURE; + } + /* Perform a self-test to check hardware build. */ + Status = XOsd_SelfTest(&OsdInst); + + if (Status != XST_SUCCESS) { + return XST_FAILURE; + } + + return XST_SUCCESS; +} diff --git a/XilinxProcessorIPLib/drivers/osd/src/Makefile b/XilinxProcessorIPLib/drivers/osd/src/Makefile index 8ebb71ba..118e65e8 100755 --- a/XilinxProcessorIPLib/drivers/osd/src/Makefile +++ b/XilinxProcessorIPLib/drivers/osd/src/Makefile @@ -1,29 +1,29 @@ -COMPILER= -ARCHIVER= -CP=cp -COMPILER_FLAGS= -EXTRA_COMPILER_FLAGS= -LIB=libxil.a -LEVEL=0 - -RELEASEDIR=../../../lib -INCLUDEDIR=../../../include -INCLUDES=-I./. -I${INCLUDEDIR} - -INCLUDEFILES=*.h -LIBSOURCES=*.c - -OUTS = *.o - -libs: - echo "Compiling osd" - $(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES) - $(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OUTS} - make clean - -include: - ${CP} $(INCLUDEFILES) $(INCLUDEDIR) - -clean: - rm -rf ${OUTS} - +COMPILER= +ARCHIVER= +CP=cp +COMPILER_FLAGS= +EXTRA_COMPILER_FLAGS= +LIB=libxil.a +LEVEL=0 + +RELEASEDIR=../../../lib +INCLUDEDIR=../../../include +INCLUDES=-I./. -I${INCLUDEDIR} + +INCLUDEFILES=*.h +LIBSOURCES=*.c + +OUTS = *.o + +libs: + echo "Compiling osd" + $(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES) + $(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OUTS} + make clean + +include: + ${CP} $(INCLUDEFILES) $(INCLUDEDIR) + +clean: + rm -rf ${OUTS} + diff --git a/XilinxProcessorIPLib/drivers/osd/src/xosd.c b/XilinxProcessorIPLib/drivers/osd/src/xosd.c index 53df6c48..ed2dc620 100755 --- a/XilinxProcessorIPLib/drivers/osd/src/xosd.c +++ b/XilinxProcessorIPLib/drivers/osd/src/xosd.c @@ -1,1323 +1,1415 @@ -/****************************************************************************** -* -* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file xosd.c -* -* This is main code of Xilinx MVI Video On-Screen-Display (OSD) device driver. -* 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. 
-* 
-* -******************************************************************************/ - -/***************************** Include Files *********************************/ - -#include "xosd.h" -#include "xenv.h" - -/************************** Constant Definitions *****************************/ - - -/**************************** Type Definitions *******************************/ - - -/***************** Macros (Inline Functions) Definitions *********************/ - - -/************************** Function Prototypes ******************************/ - -static void PopulateLayerProperty(XOSD *InstancePtr, XOSD_Config *CfgPtr); -static void StubCallBack(void *CallBackRef); -static void StubErrCallBack(void *CallBackRef, u32 ErrorMask); - -/************************** Function Definition ******************************/ - -/*****************************************************************************/ -/** - * This function initializes an OSD device. This function must be called - * prior to using an OSD device. Initialization of an OSD includes - * setting up the instance data, and ensuring the hardware is in a quiescent - * state. - * - * @param InstancePtr is a pointer to the OSD device instance to be worked on. - * @param CfgPtr points to the configuration structure associated with the - * OSD device. - * @param EffectiveAddr is the base address of the device. If address - * translation is being used, then this parameter must reflect the - * virtual base address. Otherwise, the physical address should be - * used. - * @return XST_SUCCESS - * - *****************************************************************************/ -int XOSD_CfgInitialize(XOSD *InstancePtr, XOSD_Config *CfgPtr, - u32 EffectiveAddr) -{ - /* Verify arguments */ - Xil_AssertNonvoid(InstancePtr != NULL); - Xil_AssertNonvoid(CfgPtr != NULL); - Xil_AssertNonvoid(CfgPtr->LayerNum <= XOSD_MAX_NUM_OF_LAYERS); - Xil_AssertNonvoid(EffectiveAddr != (u32)NULL); - - /* Setup the instance */ - memset((void *)InstancePtr, 0, sizeof(XOSD)); - - memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr, - sizeof(XOSD_Config)); - InstancePtr->Config.BaseAddress = EffectiveAddr; - - /* Reset to use instruction from the OSD internal buffer */ - InstancePtr->InstructionInExternalMem = 0; - - /* Set all handlers to stub values, let user configure this data later - */ - InstancePtr->VbiStartCallBack = (XOSD_CallBack) StubCallBack; - InstancePtr->VbiEndCallBack = (XOSD_CallBack) StubCallBack; - InstancePtr->FrameDoneCallBack = (XOSD_CallBack) StubCallBack; - InstancePtr->ErrCallBack = (XOSD_ErrorCallBack) StubErrCallBack; - - /* Populate the layer properties into a array to help easy fetch later - */ - PopulateLayerProperty(InstancePtr, CfgPtr); - - /* Reset the hardware and set the flag to indicate the driver is ready - */ - XOSD_Reset(InstancePtr); - InstancePtr->IsReady = XIL_COMPONENT_IS_READY; - - return XST_SUCCESS; -} - -/*****************************************************************************/ -/** - * This function chooses the type of Vertical and Horizontal Blank Input - * Polarities. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param VerticalBlankPolarity indicates the type of vertical blank input - * polarity. Use any non-0 value for Active High and 0 for Active Low. - * @param HorizontalBlankPolarity indicates the type of horizontal blank input - * polarity. Use any non-0 value for Active High and 0 for Active Low. - * @return NONE. - * - *****************************************************************************/ -void XOSD_SetBlankPolarity(XOSD *InstancePtr, int VerticalBlankPolarity, - int HorizontalBlankPolarity) -{ - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - - - /* Read control register and clear the current polarity setup leftover - */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_CTL); - RegValue &= ~(XOSD_CTL_VBP_MASK | XOSD_CTL_HBP_MASK); - - /* Set up new blank polarities */ - if (VerticalBlankPolarity) - RegValue |= XOSD_CTL_VBP_MASK; - - if (HorizontalBlankPolarity) - RegValue |= XOSD_CTL_HBP_MASK; - - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_CTL, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function sets the screen size of the OSD Output. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param Width defines the width of the OSD output - * @param Height defines the height of the OSD output - * @return NONE. - * - *****************************************************************************/ -void XOSD_SetScreenSize(XOSD *InstancePtr, u32 Width, u32 Height) -{ - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(Width > 0); - Xil_AssertVoid(Height > 0); - Xil_AssertVoid(Width <= XOSD_SS_XSIZE_MASK); - Xil_AssertVoid(Height <= (XOSD_SS_YSIZE_MASK >> XOSD_SS_YSIZE_SHIFT)); - - /* Save the dimension info in the driver instance for error handling */ - InstancePtr->ScreenWidth = Width; - InstancePtr->ScreenHeight = Height; - - /* Update the Screen Size register */ - RegValue = Width; - RegValue |= (Height << XOSD_SS_YSIZE_SHIFT) & XOSD_SS_YSIZE_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_SS, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function gets the screen size of the OSD Output. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param WidthPtr will point to the width of the OSD output after this - * function returns. - * @param HeightPtr will point to the height of the OSD output after this - * function returns. - * @return NONE. - * - *****************************************************************************/ -void XOSD_GetScreenSize(XOSD *InstancePtr, u32 *WidthPtr, u32 *HeightPtr) -{ - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(WidthPtr != NULL); - Xil_AssertVoid(HeightPtr != NULL); - - /* Get the screen size info */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_SS); - *WidthPtr = RegValue & XOSD_SS_XSIZE_MASK; - *HeightPtr = (RegValue & XOSD_SS_YSIZE_MASK) >> XOSD_SS_YSIZE_SHIFT; - - return; -} - -/*****************************************************************************/ -/** - * This function sets the Background color used by the OSD output. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param Red indicates the red value used in the background color. - * @param Blue indicates the blue value used in the background color. - * @param Green indicates the green value used in the background color. - * @return NONE. - * - *****************************************************************************/ -void XOSD_SetBackgroundColor(XOSD *InstancePtr, u16 Red, u16 Blue, u16 Green) -{ - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - - /* Update the Background Color register */ - RegValue = Green & XOSD_BC0_YG_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_BC0, RegValue); - - RegValue = Blue & XOSD_BC1_UCBB_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_BC1, RegValue); - - RegValue = Red & XOSD_BC2_VCRR_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_BC2, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function gets the Background color used by the OSD output. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param RedPtr will point to the red value used in the background color - * after this function returns. - * @param BluePtr will point to the blue value used in the background color - * after this function returns. - * @param GreenPtr will point to the green value used in the background color - * after this function returns. - * @return NONE. - * - *****************************************************************************/ -void XOSD_GetBackgroundColor(XOSD *InstancePtr, u16 *RedPtr, u16 *BluePtr, - u16 *GreenPtr) -{ - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(RedPtr != NULL); - Xil_AssertVoid(BluePtr != NULL); - Xil_AssertVoid(GreenPtr != NULL); - - /* Get the background color */ - RegValue = XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_BC0); - *GreenPtr = (u16)(RegValue & XOSD_BC0_YG_MASK); - - RegValue = XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_BC1); - *BluePtr = (u16)(RegValue & XOSD_BC1_UCBB_MASK); - - RegValue = XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_BC2); - *RedPtr = (u16)(RegValue & XOSD_BC2_VCRR_MASK); - - return; -} - -/*****************************************************************************/ -/** - * This function sets the start position and size of an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @param XStart indicates the Horizontal start pixel of origin of the layer. - * @param YStart indicates the Vertical start line of origin of the layer. - * @param XSize indicates the Horizontal Size of the layer. - * @param YSize indicates the Vertical Size of the layer. - * @return NONE. - * - *****************************************************************************/ -void XOSD_SetLayerDimension(XOSD *InstancePtr, u8 LayerIndex, u16 XStart, - u16 YStart, u16 XSize, u16 YSize) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - Xil_AssertVoid(XSize > 0); - Xil_AssertVoid(YSize > 0); - Xil_AssertVoid((XStart + XSize) <= InstancePtr->ScreenWidth); - Xil_AssertVoid((YStart + YSize) <= InstancePtr->ScreenHeight); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Set the origin of the layer */ - RegValue = XStart & XOSD_LXP_XSTART_MASK; - RegValue |= (((u32)YStart) << XOSD_LXP_YSTART_SHIFT) & - XOSD_LXP_YSTART_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXP, - RegValue); - - /* Set the size of the layer */ - RegValue = XSize & XOSD_LXS_XSIZE_MASK; - RegValue |= (((u32)YSize) << XOSD_LXS_YSIZE_SHIFT) & - XOSD_LXS_YSIZE_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXS, - RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function gets the start position and size of an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @param XStartPtr will point to the Horizontal start pixel value of origin - * of the layer after this function returns. - * @param YStartPtr will point to the Vertical start line of origin of the - * layer after this function returns. - * @param XSizePtr will point to the Horizontal Size value of the layer after - * this function returns. - * @param YSizePtr will point to the Vertical Size value of the layer after - * this function returns. - * @return NONE. - * - *****************************************************************************/ -void XOSD_GetLayerDimension(XOSD *InstancePtr, u8 LayerIndex, u16 *XStartPtr, - u16 *YStartPtr, u16 *XSizePtr, u16 *YSizePtr) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - Xil_AssertVoid(XStartPtr != NULL); - Xil_AssertVoid(YStartPtr != NULL); - Xil_AssertVoid(XSizePtr != NULL); - Xil_AssertVoid(YSizePtr != NULL); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Get the origin of the layer */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXP); - *XStartPtr = (u16) (RegValue & XOSD_LXP_XSTART_MASK); - *YStartPtr = (u16) ((RegValue & XOSD_LXP_YSTART_MASK) >> - XOSD_LXP_YSTART_SHIFT); - - /* Get the size of the layer */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXS); - *XSizePtr = (u16) (RegValue & XOSD_LXS_XSIZE_MASK); - *YSizePtr = (u16) ((RegValue & XOSD_LXS_YSIZE_MASK) >> - XOSD_LXS_YSIZE_SHIFT); - - return; -} - -/*****************************************************************************/ -/** - * This function sets the Alpha value and mode of an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @param GlobalAlphaEnble indicates whether to enable the global Alpha. Use - * any non-0 value to enable the global Alpha, and 0 to disable it. - * @param 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. - * @return NONE. - * - *****************************************************************************/ -void XOSD_SetLayerAlpha(XOSD *InstancePtr, u8 LayerIndex, u16 GlobalAlphaEnble, - u16 GlobalAlphaValue) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Read the current Layer Control register value */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC); - - /* Update the Global Alpha Enable and the Global Alpha Value fields */ - if (GlobalAlphaEnble) - RegValue |= XOSD_LXC_GALPHAEN_MASK; - else - RegValue &= ~XOSD_LXC_GALPHAEN_MASK; - - RegValue &= ~XOSD_LXC_ALPHA_MASK; - RegValue |= (((u32)GlobalAlphaValue) << XOSD_LXC_ALPHA_SHIFT) & - XOSD_LXC_ALPHA_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function gets the Alpha value and mode of an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @param GlobalAlphaEnblePtr 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. - * @param GlobalAlphaValuePtr will point to the transparent level after this - * function returns. 0 for 100% transparent, 255 (8bit) for 0% transparent - * (100% opaque). - * @return NONE. - * - *****************************************************************************/ -void XOSD_GetLayerAlpha(XOSD *InstancePtr, u8 LayerIndex, - u16 *GlobalAlphaEnblePtr, u16 *GlobalAlphaValuePtr) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - Xil_AssertVoid(GlobalAlphaEnblePtr != NULL); - Xil_AssertVoid(GlobalAlphaValuePtr != NULL); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Read the current Layer Control register value */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC); - - /* Get the info of the Global Alpha Enable and the Global Alpha Value - * fields - */ - *GlobalAlphaEnblePtr = (u16) - ((RegValue & XOSD_LXC_GALPHAEN_MASK) ? 1 : 0); - *GlobalAlphaValuePtr = (u16) ((RegValue & XOSD_LXC_ALPHA_MASK) >> - XOSD_LXC_ALPHA_SHIFT); - - return; -} - -/*****************************************************************************/ -/** - * This function sets the priority of an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @param 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 - * @return NONE. - * - *****************************************************************************/ -void XOSD_SetLayerPriority(XOSD *InstancePtr, u8 LayerIndex, u8 Priority) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - Xil_AssertVoid(Priority <= XOSD_LAYER_PRIORITY_7); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Read the current Layer Control register value */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC); - - /* Update the Priority field */ - RegValue &= ~XOSD_LXC_PRIORITY_MASK; - RegValue |= (((u32)Priority) << XOSD_LXC_PRIORITY_SHIFT) - & XOSD_LXC_PRIORITY_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function gets the priority of an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @param PriorityPtr will point to the priority used on the layer after this - * function returns. Use XOSD_LAYER_PRIORITY_... defined in xosd_hw.h - * to interpret the value. - * @return NONE. - * - *****************************************************************************/ -void XOSD_GetLayerPriority(XOSD *InstancePtr, u8 LayerIndex, u8 *PriorityPtr) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - Xil_AssertVoid(PriorityPtr != NULL); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Read the current Layer Control register value */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC); - - /* Get the Priority field */ - *PriorityPtr = (u8)((RegValue & XOSD_LXC_PRIORITY_MASK) >> - XOSD_LXC_PRIORITY_SHIFT); - - return; -} - -/*****************************************************************************/ -/** - * This function enables an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @return NONE. - * - *****************************************************************************/ -void XOSD_EnableLayer(XOSD *InstancePtr, u8 LayerIndex) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Read the current Layer Control register value */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC); - - /* Set the Layer Enable field */ - RegValue |= XOSD_LXC_EN_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC, - RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function disables an OSD layer. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param LayerIndex indicates which layer to be worked on. Valid value range - * is from 0 to (the number of layers implemented in the device - 1). - * @return NONE. - * - *****************************************************************************/ -void XOSD_DisableLayer(XOSD *InstancePtr, u8 LayerIndex) -{ - u32 LayerBaseRegAddr; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(LayerIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != \ - XOSD_LAYER_TYPE_DISABLE); - - /* Calculate the base register address of the layer to work on */ - LayerBaseRegAddr = XOSD_L0C + (LayerIndex * XOSD_LAYER_SIZE); - - /* Read the current Layer Control register value */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC); - - /* Clear the Layer Enable field */ - RegValue &= ~XOSD_LXC_EN_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - LayerBaseRegAddr + XOSD_LXC, - RegValue); -} - -/*****************************************************************************/ -/** - * This function loads color LUT data into an OSD Graphics Controller Bank. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param 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. - * @param BankIndex indicates which GC Bank to be worked on. Valid value range - * is from 0 to XOSD_GC_BANK_NUM - 1. - * @param ColorData points to the color LUT data to be loaded. - * @return NONE. - * - *****************************************************************************/ -void XOSD_LoadColorLUTBank(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, - u32 *ColorData) -{ - u32 i; - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(GcIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == - XOSD_LAYER_TYPE_GPU); - Xil_AssertVoid(BankIndex < XOSD_GC_BANK_NUM); - Xil_AssertVoid(ColorData != NULL); - - /* Choose which bank to be loaded */ - RegValue = (((u32)BankIndex) + XOSD_GCWBA_COL0) & XOSD_GCWBA_BANK_MASK; - RegValue |= (((u32)GcIndex) << XOSD_GCWBA_GCNUM_SHIFT) - & XOSD_GCWBA_GCNUM_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCWBA, RegValue); - - /* Load color data */ - if(InstancePtr->Config.S_AXIS_VIDEO_DATA_WIDTH == 8) - { - for (i = 0; - i < (InstancePtr->Layers[GcIndex].ColorLutSize * XOSD_COLOR_ENTRY_SIZE) - / sizeof(u32); - i++) { - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - XOSD_GCD, ColorData[i]); - } - } - else // for video channel size of 10 or 12, the color size is 64bits - { - for (i = 0; - i < (InstancePtr->Layers[GcIndex].ColorLutSize * 2 * XOSD_COLOR_ENTRY_SIZE) - / sizeof(u32); - i++) { - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - XOSD_GCD, ColorData[i]); - } - - } - /* Set the active color LUT bank */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_GCABA); - RegValue &= ~(1 << (XOSD_GCABA_COL_SHIFT + GcIndex)); - RegValue |= ((u32)BankIndex) << (XOSD_GCABA_COL_SHIFT + (u32)GcIndex); - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCABA, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function loads Character Set data (font) into an OSD Graphics - * Controller Bank. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param 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. - * @param BankIndex indicates which GC Bank to be worked on. Valid value range - * is from 0 to XOSD_GC_BANK_NUM - 1. - * @param CharSetData points to the Character Set data to be loaded. - * @return NONE. - * - *****************************************************************************/ -void XOSD_LoadCharacterSetBank(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, - u32 *CharSetData) -{ - u32 RegValue; - u32 FontWriteNum; - u32 i; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(GcIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == - XOSD_LAYER_TYPE_GPU); - Xil_AssertVoid(BankIndex < XOSD_GC_BANK_NUM); - Xil_AssertVoid(CharSetData != NULL); - - /* Choose which bank to be loaded */ - RegValue = (((u32)BankIndex) + XOSD_GCWBA_CHR0) & XOSD_GCWBA_BANK_MASK; - RegValue |= (((u32)GcIndex) << XOSD_GCWBA_GCNUM_SHIFT) - & XOSD_GCWBA_GCNUM_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCWBA, RegValue); - - /* Calculate the number of write to load the whole font data set */ - FontWriteNum = ((u32)InstancePtr->Layers[GcIndex].FontWidth) * - ((u32)InstancePtr->Layers[GcIndex].FontHeight) * - ((u32)InstancePtr->Layers[GcIndex].FontBitsPerPixel); - FontWriteNum /= XOSD_FONT_BIT_TO_BYTE; - FontWriteNum *= ((u32)InstancePtr->Layers[GcIndex].FontNumChars); - FontWriteNum /= sizeof(u32); - - /* Load the font data */ - for (i = 0; i < FontWriteNum; i++) { - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCD, - CharSetData[i]); - } - - /* Set the bank to be active so the font is used by the core */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_GCABA); - RegValue &= ~(1 << (XOSD_GCABA_CHR_SHIFT + GcIndex)); - RegValue |= ((u32)BankIndex) << (XOSD_GCABA_CHR_SHIFT + (u32)GcIndex); - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCABA, RegValue); -} - -/*****************************************************************************/ -/** - * This function loads Text data into an OSD Graphics Controller Bank. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param 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. - * @param BankIndex indicates which GC Bank to be worked on. Valid value range - * is from 0 to XOSD_GC_BANK_NUM - 1. - * @param TextData points to the Text data to be loaded. - * @return NONE. - * - *****************************************************************************/ -void XOSD_LoadTextBank(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, - u32 *TextData) -{ - u32 i; - u32 RegValue; - u32 Data; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(GcIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == - XOSD_LAYER_TYPE_GPU); - Xil_AssertVoid(BankIndex < XOSD_GC_BANK_NUM); - Xil_AssertVoid(TextData != NULL); - - /* Choose which bank to be loaded */ - RegValue = (((u32)BankIndex) + XOSD_GCWBA_TXT0) & XOSD_GCWBA_BANK_MASK; - RegValue |= (((u32)GcIndex) << XOSD_GCWBA_GCNUM_SHIFT) - & XOSD_GCWBA_GCNUM_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCWBA, RegValue); - - /* Load text data */ - for (i = 0; - i < (u32)(InstancePtr->Layers[GcIndex].TextNumStrings) * - (u32)(InstancePtr->Layers[GcIndex].TextMaxStringLength) / - sizeof(u32); - i++) { - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - XOSD_GCD, TextData[i]); - } - - /* Set the active text bank */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_GCABA); - RegValue &= ~(1 << (XOSD_GCABA_TXT_SHIFT + GcIndex)); - RegValue |= ((u32)BankIndex) << (XOSD_GCABA_TXT_SHIFT + (u32)GcIndex); - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCABA, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function chooses active banks for a GC in an OSD device. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param 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. - * @param ColorBankIndex indicates the Color LUT bank to be choose as active. - * @param CharBankIndex indicates the Character Set bank to be choose as - * active. - * @param TextBankIndex indicates the Text Data bank to be choose as active. - * @param InstructionBankIndex indicates the Instruction bank to be choose as - * active. - * @return NONE. - * - *****************************************************************************/ -void XOSD_SetActiveBank(XOSD *InstancePtr, u8 GcIndex, u8 ColorBankIndex, - u8 CharBankIndex, u8 TextBankIndex, - u8 InstructionBankIndex) -{ - u32 RegValue; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(GcIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == - XOSD_LAYER_TYPE_GPU); - Xil_AssertVoid(ColorBankIndex < XOSD_GC_BANK_NUM); - Xil_AssertVoid(CharBankIndex < XOSD_GC_BANK_NUM); - Xil_AssertVoid(TextBankIndex < XOSD_GC_BANK_NUM); - Xil_AssertVoid(InstructionBankIndex < XOSD_GC_BANK_NUM); - - /* Clear the current active bank setting first */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_GCABA); - RegValue &= ~(1 << GcIndex) & XOSD_GCABA_INS_MASK; - RegValue &= ~(1 << (XOSD_GCABA_COL_SHIFT + GcIndex)) & - XOSD_GCABA_COL_MASK; - RegValue &= ~(1 << (XOSD_GCABA_TXT_SHIFT + GcIndex)) & - XOSD_GCABA_TXT_MASK; - RegValue &= ~(1 << (XOSD_GCABA_CHR_SHIFT + GcIndex)) & - XOSD_GCABA_CHR_MASK; - - /* Choose the active banks */ - RegValue |= (((u32)InstructionBankIndex) << GcIndex) & - XOSD_GCABA_INS_MASK; - RegValue |= (((u32)ColorBankIndex) << (XOSD_GCABA_COL_SHIFT + GcIndex)) - & XOSD_GCABA_COL_MASK; - RegValue |= (((u32)TextBankIndex) << (XOSD_GCABA_TXT_SHIFT + GcIndex)) - & XOSD_GCABA_TXT_MASK; - RegValue |= (((u32)CharBankIndex) << (XOSD_GCABA_CHR_SHIFT + GcIndex)) - & XOSD_GCABA_CHR_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCABA, RegValue); - - return; -} - -/*****************************************************************************/ -/** - * This function creates an instruction for an OSD. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param 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. - * @param 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. - * @param ObjType indicates the type of object to draw. Use - * one of XOSD_INS_OPCODE_... constants defined in xosd_hw.h. - * @param ObjSize indicates line width of boxes and lines and the text scale - * factor for text boxes. - * @param XStart indicates the horizontal start pixel of the Object. - * @param YStart indicates the vertical start line of the Object. - * @param XEnd indicates the horizontal end pixel of the Object. - * @param YEnd indicates the vertical end line of the Object. - * @param TextIndex indicates the string index. - * @param ColorIndex indicates the color index. - * @return 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) -{ - u32 Value; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(InstructionPtr != NULL); - Xil_AssertVoid(GcIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == - XOSD_LAYER_TYPE_GPU); - Xil_AssertVoid((ObjType == XOSD_INS_OPCODE_END) || - (ObjType == XOSD_INS_OPCODE_NOP) || - (ObjType == XOSD_INS_OPCODE_BOX) || - (ObjType == XOSD_INS_OPCODE_LINE) || - (ObjType == XOSD_INS_OPCODE_TXT) || - (ObjType == XOSD_INS_OPCODE_BOXTXT)); - Xil_AssertVoid(XEnd < InstancePtr->ScreenWidth); - Xil_AssertVoid(YEnd < InstancePtr->ScreenHeight); - Xil_AssertVoid(TextIndex < InstancePtr->Layers[GcIndex].TextNumStrings); - Xil_AssertVoid(ColorIndex < InstancePtr->Layers[GcIndex].ColorLutSize); - - /* Clear the whole instruction first */ - memset((void *)InstructionPtr, 0, XOSD_INS_SIZE * sizeof(u32)); - - /* Populate instruction word 0 fields */ - Value = ((u32)XStart) & XOSD_INS0_XSTART_MASK; - Value |= (((u32)XEnd) << XOSD_INS0_XEND_SHIFT) & - XOSD_INS0_XEND_MASK; - Value |= (((u32)GcIndex) << XOSD_INS0_GCNUM_SHIFT) & - XOSD_INS0_GCNUM_MASK; - Value |= (((u32)ObjType) << XOSD_INS0_OPCODE_SHIFT) - & XOSD_INS0_OPCODE_MASK; - InstructionPtr[XOSD_INS0] = Value; - - /* Populate instruction word 1 fields */ - Value = ((u32)TextIndex) & XOSD_INS1_TXTINDEX_MASK; - InstructionPtr[XOSD_INS1] = Value; - - /* Populate instruction word 2 fields */ - Value = ((u32)YStart) & XOSD_INS2_YSTART_MASK; - Value |= (((u32)YEnd) << XOSD_INS2_YEND_SHIFT) & XOSD_INS2_YEND_MASK; - Value |= (((u32)ObjSize) << XOSD_INS2_OBJSIZE_SHIFT) - & XOSD_INS2_OBJSIZE_MASK; - InstructionPtr[XOSD_INS2] = Value; - - /* Populate instruction word 3 fields */ - Value = ((u32)ColorIndex) & XOSD_INS3_COL_MASK; - InstructionPtr[XOSD_INS3] = Value; - - return; -} - -/*****************************************************************************/ -/** - * This function load an instruction list to be used by an Graphic Controller - * in an OSD device. - * - * @param InstancePtr is a pointer to the OSD device instance to be - * worked on. - * @param 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. - * @param BankIndex indicates which GC Bank to be worked on. Valid value range - * is from 0 to XOSD_GC_BANK_NUM. - * @param InstSetPtr is a pointer to the start of the instruction list to load - * into the OSD device. The last instruction in the list must has - * XOSD_INS_OPCODE_END type. - * @param 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 - * @return NONE. - * - *****************************************************************************/ -void XOSD_LoadInstructionList(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, - u32 *InstSetPtr, u32 InstNum) -{ - u32 RegValue; - u32 i; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertVoid(GcIndex < InstancePtr->Config.LayerNum); - Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == - XOSD_LAYER_TYPE_GPU); - Xil_AssertVoid(BankIndex < XOSD_GC_BANK_NUM); - Xil_AssertVoid(InstSetPtr != NULL); - Xil_AssertVoid(InstNum <= InstancePtr->Layers[GcIndex].InstructionNum); - - /* Choose which bank to be loaded */ - RegValue = (((u32)BankIndex) + XOSD_GCWBA_INS0) & XOSD_GCWBA_BANK_MASK; - RegValue |= (((u32)GcIndex) << XOSD_GCWBA_GCNUM_SHIFT) - & XOSD_GCWBA_GCNUM_MASK; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCWBA, RegValue); - - for (i = 0; i < InstNum * XOSD_INS_SIZE; i++) - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCD, - InstSetPtr[i]); - - /* - * Notify OSD this is the end of the instruction list by adding an END - * instruction - */ - if (InstNum < InstancePtr->Layers[GcIndex].InstructionNum) - for (i = 0; i < XOSD_INS_SIZE; i++) - XOSD_WriteReg(InstancePtr->Config.BaseAddress, - XOSD_GCD, 0); - - - /* Set the active instruction bank */ - RegValue = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_GCABA); - RegValue &= ~(1 << GcIndex); - RegValue |= BankIndex << GcIndex; - XOSD_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCABA, RegValue); - - return; -} - -/*****************************************************************************/ -/* - * This function populates the Layer array in the OSD driver instance with - * the properties of all layers. This is to help fetch the info faster later. - * - * @param InstancePtr is a pointer to the OSD device instance to be worked on. - * @param CfgPtr points to the configuration structure associated with the - * OSD device. - * @return None - * - *****************************************************************************/ -static void PopulateLayerProperty(XOSD *InstancePtr, XOSD_Config *CfgPtr) -{ - XOSD *IP; - XOSD_Config *Cfg; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(CfgPtr != NULL); - - /* Use short variable names to keep the lines in this function - * shorter - */ - IP = InstancePtr; - Cfg = CfgPtr; - - /* Layer #0 */ - IP->Layers[0].LayerType = Cfg->Layer0Type; - IP->Layers[0].InstructionNum = Cfg->Layer0InstructionMemSize; - IP->Layers[0].InstructionBoxEnable = Cfg->Layer0InstructionBoxEnable; - IP->Layers[0].InstructionLineEnable = Cfg->Layer0InstructionLineEnable; - IP->Layers[0].InstructionTextEnable = Cfg->Layer0InstructionTextEnable; - IP->Layers[0].ColorLutSize = Cfg->Layer0ColorLutSize; - IP->Layers[0].ColorLutMemoryType = Cfg->Layer0ColorLutMemoryType; - IP->Layers[0].FontNumChars = Cfg->Layer0FontNumChars; - IP->Layers[0].FontWidth = Cfg->Layer0FontWidth; - IP->Layers[0].FontHeight = Cfg->Layer0FontHeight; - IP->Layers[0].FontBitsPerPixel = Cfg->Layer0FontBitsPerPixel; - IP->Layers[0].FontAsciiOffset = Cfg->Layer0FontAsciiOffset; - IP->Layers[0].TextNumStrings = Cfg->Layer0TextNumStrings; - IP->Layers[0].TextMaxStringLength = Cfg->Layer0TextMaxStringLength; - - /* Layer #1 */ - IP->Layers[1].LayerType = Cfg->Layer1Type; - IP->Layers[1].InstructionNum = Cfg->Layer1InstructionMemSize; - IP->Layers[1].InstructionBoxEnable = Cfg->Layer1InstructionBoxEnable; - IP->Layers[1].InstructionLineEnable = Cfg->Layer1InstructionLineEnable; - IP->Layers[1].InstructionTextEnable = Cfg->Layer1InstructionTextEnable; - IP->Layers[1].ColorLutSize = Cfg->Layer1ColorLutSize; - IP->Layers[1].ColorLutMemoryType = Cfg->Layer1ColorLutMemoryType; - IP->Layers[1].FontNumChars = Cfg->Layer1FontNumChars; - IP->Layers[1].FontWidth = Cfg->Layer1FontWidth; - IP->Layers[1].FontHeight = Cfg->Layer1FontHeight; - IP->Layers[1].FontBitsPerPixel = Cfg->Layer1FontBitsPerPixel; - IP->Layers[1].FontAsciiOffset = Cfg->Layer1FontAsciiOffset; - IP->Layers[1].TextNumStrings = Cfg->Layer1TextNumStrings; - IP->Layers[1].TextMaxStringLength = Cfg->Layer1TextMaxStringLength; - - /* Layer #2 */ - IP->Layers[2].LayerType = Cfg->Layer2Type; - IP->Layers[2].InstructionNum = Cfg->Layer2InstructionMemSize; - IP->Layers[2].InstructionBoxEnable = Cfg->Layer2InstructionBoxEnable; - IP->Layers[2].InstructionLineEnable = Cfg->Layer2InstructionLineEnable; - IP->Layers[2].InstructionTextEnable = Cfg->Layer2InstructionTextEnable; - IP->Layers[2].ColorLutSize = Cfg->Layer2ColorLutSize; - IP->Layers[2].ColorLutMemoryType = Cfg->Layer2ColorLutMemoryType; - IP->Layers[2].FontNumChars = Cfg->Layer2FontNumChars; - IP->Layers[2].FontWidth = Cfg->Layer2FontWidth; - IP->Layers[2].FontHeight = Cfg->Layer2FontHeight; - IP->Layers[2].FontBitsPerPixel = Cfg->Layer2FontBitsPerPixel; - IP->Layers[2].FontAsciiOffset = Cfg->Layer2FontAsciiOffset; - IP->Layers[2].TextNumStrings = Cfg->Layer2TextNumStrings; - IP->Layers[2].TextMaxStringLength = Cfg->Layer2TextMaxStringLength; - - /* Layer #3 */ - IP->Layers[3].LayerType = Cfg->Layer3Type; - IP->Layers[3].InstructionNum = Cfg->Layer3InstructionMemSize; - IP->Layers[3].InstructionBoxEnable = Cfg->Layer3InstructionBoxEnable; - IP->Layers[3].InstructionLineEnable = Cfg->Layer3InstructionLineEnable; - IP->Layers[3].InstructionTextEnable = Cfg->Layer3InstructionTextEnable; - IP->Layers[3].ColorLutSize = Cfg->Layer3ColorLutSize; - IP->Layers[3].ColorLutMemoryType = Cfg->Layer3ColorLutMemoryType; - IP->Layers[3].FontNumChars = Cfg->Layer3FontNumChars; - IP->Layers[3].FontWidth = Cfg->Layer3FontWidth; - IP->Layers[3].FontHeight = Cfg->Layer3FontHeight; - IP->Layers[3].FontBitsPerPixel = Cfg->Layer3FontBitsPerPixel; - IP->Layers[3].FontAsciiOffset = Cfg->Layer3FontAsciiOffset; - IP->Layers[3].TextNumStrings = Cfg->Layer3TextNumStrings; - IP->Layers[3].TextMaxStringLength = Cfg->Layer3TextMaxStringLength; - - /* Layer #4 */ - IP->Layers[4].LayerType = Cfg->Layer4Type; - IP->Layers[4].InstructionNum = Cfg->Layer4InstructionMemSize; - IP->Layers[4].InstructionBoxEnable = Cfg->Layer4InstructionBoxEnable; - IP->Layers[4].InstructionLineEnable = Cfg->Layer4InstructionLineEnable; - IP->Layers[4].InstructionTextEnable = Cfg->Layer4InstructionTextEnable; - IP->Layers[4].ColorLutSize = Cfg->Layer4ColorLutSize; - IP->Layers[4].ColorLutMemoryType = Cfg->Layer4ColorLutMemoryType; - IP->Layers[4].FontNumChars = Cfg->Layer4FontNumChars; - IP->Layers[4].FontWidth = Cfg->Layer4FontWidth; - IP->Layers[4].FontHeight = Cfg->Layer4FontHeight; - IP->Layers[4].FontBitsPerPixel = Cfg->Layer4FontBitsPerPixel; - IP->Layers[4].FontAsciiOffset = Cfg->Layer4FontAsciiOffset; - IP->Layers[4].TextNumStrings = Cfg->Layer4TextNumStrings; - IP->Layers[4].TextMaxStringLength = Cfg->Layer4TextMaxStringLength; - - /* Layer #5 */ - IP->Layers[5].LayerType = Cfg->Layer5Type; - IP->Layers[5].InstructionNum = Cfg->Layer5InstructionMemSize; - IP->Layers[5].InstructionBoxEnable = Cfg->Layer5InstructionBoxEnable; - IP->Layers[5].InstructionLineEnable = Cfg->Layer5InstructionLineEnable; - IP->Layers[5].InstructionTextEnable = Cfg->Layer5InstructionTextEnable; - IP->Layers[5].ColorLutSize = Cfg->Layer5ColorLutSize; - IP->Layers[5].ColorLutMemoryType = Cfg->Layer5ColorLutMemoryType; - IP->Layers[5].FontNumChars = Cfg->Layer5FontNumChars; - IP->Layers[5].FontWidth = Cfg->Layer5FontWidth; - IP->Layers[5].FontHeight = Cfg->Layer5FontHeight; - IP->Layers[5].FontBitsPerPixel = Cfg->Layer5FontBitsPerPixel; - IP->Layers[5].FontAsciiOffset = Cfg->Layer5FontAsciiOffset; - IP->Layers[5].TextNumStrings = Cfg->Layer5TextNumStrings; - IP->Layers[5].TextMaxStringLength = Cfg->Layer5TextMaxStringLength; - - /* Layer #6 */ - IP->Layers[6].LayerType = Cfg->Layer6Type; - IP->Layers[6].InstructionNum = Cfg->Layer6InstructionMemSize; - IP->Layers[6].InstructionBoxEnable = Cfg->Layer6InstructionBoxEnable; - IP->Layers[6].InstructionLineEnable = Cfg->Layer6InstructionLineEnable; - IP->Layers[6].InstructionTextEnable = Cfg->Layer6InstructionTextEnable; - IP->Layers[6].ColorLutSize = Cfg->Layer6ColorLutSize; - IP->Layers[6].ColorLutMemoryType = Cfg->Layer6ColorLutMemoryType; - IP->Layers[6].FontNumChars = Cfg->Layer6FontNumChars; - IP->Layers[6].FontWidth = Cfg->Layer6FontWidth; - IP->Layers[6].FontHeight = Cfg->Layer6FontHeight; - IP->Layers[6].FontBitsPerPixel = Cfg->Layer6FontBitsPerPixel; - IP->Layers[6].FontAsciiOffset = Cfg->Layer6FontAsciiOffset; - IP->Layers[6].TextNumStrings = Cfg->Layer6TextNumStrings; - IP->Layers[6].TextMaxStringLength = Cfg->Layer6TextMaxStringLength; - - /* Layer #7 */ - IP->Layers[7].LayerType = Cfg->Layer7Type; - IP->Layers[7].InstructionNum = Cfg->Layer7InstructionMemSize; - IP->Layers[7].InstructionBoxEnable = Cfg->Layer7InstructionBoxEnable; - IP->Layers[7].InstructionLineEnable = Cfg->Layer7InstructionLineEnable; - IP->Layers[7].InstructionTextEnable = Cfg->Layer7InstructionTextEnable; - IP->Layers[7].ColorLutSize = Cfg->Layer7ColorLutSize; - IP->Layers[7].ColorLutMemoryType = Cfg->Layer7ColorLutMemoryType; - IP->Layers[7].FontNumChars = Cfg->Layer7FontNumChars; - IP->Layers[7].FontWidth = Cfg->Layer7FontWidth; - IP->Layers[7].FontHeight = Cfg->Layer7FontHeight; - IP->Layers[7].FontBitsPerPixel = Cfg->Layer7FontBitsPerPixel; - IP->Layers[7].FontAsciiOffset = Cfg->Layer7FontAsciiOffset; - IP->Layers[7].TextNumStrings = Cfg->Layer7TextNumStrings; - IP->Layers[7].TextMaxStringLength = Cfg->Layer7TextMaxStringLength; - - /* Convert instruction memory sizes into the maximum numbers of - * instructions supported - */ - IP->Layers[0].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - IP->Layers[1].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - IP->Layers[2].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - IP->Layers[3].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - IP->Layers[4].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - IP->Layers[5].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - IP->Layers[6].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - IP->Layers[7].InstructionNum /= XOSD_INS_MEM_SIZE_TO_NUM; - return; -} - -/*****************************************************************************/ -/** -* -* This function returns the version of an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be -* worked on. -* @param Major points to an unsigned 16-bit variable that will be assigned -* with the major version number after this function returns. Value -* range is from 0x0 to 0xF. -* @param Minor points to an unsigned 16-bit variable that will be assigned -* with the minor version number after this function returns. Value -* range is from 0x00 to 0xFF. -* @param Revision points to an unsigned 16-bit variable that will be assigned -* with the revision version number after this function returns. Value -* range is from 0xA to 0xF. -* @return None. -* @note Example: Device version should read v2.01.c if major version number -* is 0x2, minor version number is 0x1, and revision version number is -* 0xC. -* -******************************************************************************/ -void XOSD_GetVersion(XOSD *InstancePtr, u16 *Major, u16 *Minor, u16 *Revision) -{ - u32 Version; - - /* Verify arguments */ - Xil_AssertVoid(InstancePtr != NULL); - Xil_AssertVoid(Major != NULL); - Xil_AssertVoid(Minor != NULL); - Xil_AssertVoid(Revision != NULL); - - /* Read device version */ - Version = XOSD_ReadReg(InstancePtr->Config.BaseAddress, XOSD_VER); - - /* Parse the version and pass the info to the caller via output - * parameters - */ - *Major = (u16) - ((Version & XOSD_VER_MAJOR_MASK) >> XOSD_VER_MAJOR_SHIFT); - - *Minor = (u16) - ((Version & XOSD_VER_MINOR_MASK) >> XOSD_VER_MINOR_SHIFT); - - *Revision = (u16) - ((Version & XOSD_VER_REV_MASK) >> XOSD_VER_REV_SHIFT); - - return; -} - -/*****************************************************************************/ -/* - * This routine is a stub for the asynchronous callbacks. The stub is here in - * case the upper layer forgot to set the handlers. On initialization, All - * handlers except error handler are set to this callback. It is considered an - * error for this handler to be invoked. - * - *****************************************************************************/ -static void StubCallBack(void *CallBackRef) -{ - Xil_AssertVoidAlways(); -} - -/*****************************************************************************/ -/* - * This routine is a stub for the asynchronous error interrupt callback. The - * stub is here in case the upper layer forgot to set the handler. On - * initialization, Error interrupt handler is set to this callback. It is - * considered an error for this handler to be invoked. - * - *****************************************************************************/ -static void StubErrCallBack(void *CallBackRef, u32 ErrorMask) -{ - Xil_AssertVoidAlways(); -} +/****************************************************************************** +* +* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xosd.c +* +* 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 Files *********************************/ + +#include "xosd.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + +static void PopulateLayerProperty(XOsd *InstancePtr, XOsd_Config *CfgPtr); +static void StubCallBack(void *CallBackRef); +static void StubErrCallBack(void *CallBackRef, u32 ErrorMask); + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* 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. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param CfgPtr points to the configuration structure associated +* with the OSD core. +* @param 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. +* +* @return - XST_SUCCESS if XOsd_CfgInitialize was successful. +* +* @note None. +* +******************************************************************************/ +int XOsd_CfgInitialize(XOsd *InstancePtr, XOsd_Config *CfgPtr, + u32 EffectiveAddr) +{ + /* Verify arguments. */ + Xil_AssertNonvoid(CfgPtr != NULL); + Xil_AssertNonvoid(CfgPtr->LayerNum <= (XOSD_MAX_NUM_OF_LAYERS)); + Xil_AssertNonvoid(EffectiveAddr != (u32)0x0U); + + /* Setup the instance */ + (void)memset((void *)InstancePtr, 0, sizeof(XOsd)); + (void)memcpy((void *)&(InstancePtr->Config), (const void *)CfgPtr, + sizeof(XOsd_Config)); + InstancePtr->Config.BaseAddress = EffectiveAddr; + + /* Reset to use instruction from the OSD internal buffer */ + InstancePtr->InstructionInExternalMem = 0; + + /* Set all handlers to stub values, let user configure this + * data later + */ + InstancePtr->ProcStartCallBack = + (XOsd_CallBack)((void *)StubCallBack); + InstancePtr->FrameDoneCallBack = + (XOsd_CallBack)((void *)StubCallBack); + InstancePtr->ErrCallBack = + (XOsd_ErrorCallBack)((void *)StubErrCallBack); + + /* Populate the layer properties into a array to help easy + * fetch later + */ + PopulateLayerProperty(InstancePtr, CfgPtr); + + /* Reset the hardware and set the flag to indicate the + * driver is ready + */ + XOsd_Reset(InstancePtr); + InstancePtr->IsReady = (u32)(XIL_COMPONENT_IS_READY); + + return (XST_SUCCESS); +} + +/*****************************************************************************/ +/** +* +* This function sets the screen size of the OSD Output. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param Width defines the width of the OSD output. +* @param Height defines the height of the OSD output. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_SetActiveSize(XOsd *InstancePtr, u32 Width, u32 Height) +{ + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid(Width > (u32)0x0U); + Xil_AssertVoid(Height > (u32)0x0U); + Xil_AssertVoid(Width <= (u32)(XOSD_ACTSIZE_NUM_PIXEL_MASK)); + Xil_AssertVoid(Height <= ((XOSD_ACTSIZE_NUM_LINE_MASK) >> + (XOSD_ACTSIZE_NUM_LINE_SHIFT))); + + /* Save the dimension info in the driver instance for error handling */ + InstancePtr->ScreenWidth = Width; + InstancePtr->ScreenHeight = Height; + + /* Update the screen size register */ + RegValue = Width; + RegValue |= (Height << (XOSD_ACTSIZE_NUM_LINE_SHIFT)) & + (XOSD_ACTSIZE_NUM_LINE_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + (XOSD_ACTIVE_SIZE_OFFSET), RegValue); +} + +/*****************************************************************************/ +/** +* +* This function gets the screen size of the OSD Output. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param WidthPtr will point to the width of the OSD output after this +* function returns. +* @param HeightPtr will point to the height of the OSD output after this +* function returns. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_GetActiveSize(XOsd *InstancePtr, u32 *WidthPtr, u32 *HeightPtr) +{ + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid(WidthPtr != NULL); + Xil_AssertVoid(HeightPtr != NULL); + + /* Get the screen size info */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_ACTIVE_SIZE_OFFSET)); + *WidthPtr = (RegValue) & (XOSD_ACTSIZE_NUM_PIXEL_MASK); + *HeightPtr = ((RegValue) & (XOSD_ACTSIZE_NUM_LINE_MASK)) >> + (XOSD_ACTSIZE_NUM_LINE_SHIFT); +} + +/*****************************************************************************/ +/** +* +* This function sets the background color used by the OSD output. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param Red indicates the red value to be used in the background color. +* @param Blue indicates the blue value to be used in the background +* color. +* @param Green indicates the green value to be used in the background +* color. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_SetBackgroundColor(XOsd *InstancePtr, u16 Red, u16 Blue, u16 Green) +{ + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + + /* Update the background color register */ + RegValue = ((u32)Green) & (XOSD_BC0_YG_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_BC0_OFFSET), + RegValue); + RegValue = ((u32)Blue) & (XOSD_BC1_UCBB_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_BC1_OFFSET), + RegValue); + RegValue = ((u32)Red) & (XOSD_BC2_VCRR_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_BC2_OFFSET), + RegValue); +} + +/*****************************************************************************/ +/** +* +* This function gets the background color used by the OSD output. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param RedPtr will point to the red value used in the background color +* after this function returns. +* @param BluePtr will point to the blue value used in the background +* color after this function returns. +* @param GreenPtr will point to the green value used in the background +* color after this function returns. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_GetBackgroundColor(XOsd *InstancePtr, u16 *RedPtr, u16 *BluePtr, + u16 *GreenPtr) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid(RedPtr != NULL); + Xil_AssertVoid(BluePtr != NULL); + Xil_AssertVoid(GreenPtr != NULL); + + /* Get the background color */ + *GreenPtr = (u16)((XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_BC0_OFFSET))) & (XOSD_BC0_YG_MASK)); + *BluePtr = (u16)((XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_BC1_OFFSET))) & (XOSD_BC1_UCBB_MASK)); + *RedPtr = (u16)((XOsd_ReadReg(InstancePtr->Config.BaseAddress, + XOSD_BC2_OFFSET)) & (XOSD_BC2_VCRR_MASK)); +} + + +/*****************************************************************************/ +/** +* +* This function sets the start position and size of an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid +* value range is from 0 to (the number of layers implemented in +* the core - 1). +* @param XStart indicates the horizontal start pixel of origin of the +* layer. +* @param YStart indicates the vertical start line of origin of the +* layer. +* @param XSize indicates the horizontal size of the layer. +* @param YSize indicates the vertical size of the layer. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_SetLayerDimension(XOsd *InstancePtr, u8 LayerIndex, u16 XStart, + u16 YStart, u16 XSize, u16 YSize) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + Xil_AssertVoid(XSize > (u16)0x0U); + Xil_AssertVoid(YSize > (u16)0x0U); + Xil_AssertVoid(((u32)XStart + (u32)XSize) <= InstancePtr->ScreenWidth); + Xil_AssertVoid(((u32)YStart + (u32)YSize) <= + InstancePtr->ScreenHeight); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = (u32)(XOSD_L0C_OFFSET) + (((u32)LayerIndex) * + ((u32)(XOSD_LAYER_SIZE))); + + /* Set the origin of the layer */ + RegValue = ((u32)XStart) & (XOSD_LXP_XSTART_MASK); + RegValue |= (((u32)YStart) << (XOSD_LXP_YSTART_SHIFT)) & + (XOSD_LXP_YSTART_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, LayerBaseRegAddr + + (XOSD_LXP), RegValue); + + /* Set the size of the layer */ + RegValue = ((u32)XSize) & (XOSD_LXS_XSIZE_MASK); + RegValue |= (((u32)YSize) << (XOSD_LXS_YSIZE_SHIFT)) & + (XOSD_LXS_YSIZE_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXS)), RegValue); +} + +/*****************************************************************************/ +/** +* +* This function gets the start position and size of an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid +* value range is from 0 to (the number of layers implemented +* in the core - 1). +* @param XStartPtr will point to the horizontal start pixel value +* of origin of the layer after this function returns. +* @param YStartPtr will point to the vertical start line of origin +* of the layer after this function returns. +* @param XSizePtr will point to the horizontal size value of the +* layer after this function returns. +* @param YSizePtr will point to the vertical size value of the +* layer after this function returns. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_GetLayerDimension(XOsd *InstancePtr, u8 LayerIndex, u16 *XStartPtr, + u16 *YStartPtr, u16 *XSizePtr, u16 *YSizePtr) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + Xil_AssertVoid(XStartPtr != NULL); + Xil_AssertVoid(YStartPtr != NULL); + Xil_AssertVoid(XSizePtr != NULL); + Xil_AssertVoid(YSizePtr != NULL); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = (u32)(XOSD_L0C_OFFSET) + (((u32)LayerIndex) * + ((u32)XOSD_LAYER_SIZE)); + + /* Get the origin of the layer */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXP))); + *XStartPtr = (u16)((RegValue) & (XOSD_LXP_XSTART_MASK)); + *YStartPtr = (u16)((RegValue) & (XOSD_LXP_YSTART_MASK)) >> + (XOSD_LXP_YSTART_SHIFT); + + /* Get the size of the layer */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + LayerBaseRegAddr + (XOSD_LXS)); + *XSizePtr = (u16)((RegValue) & (XOSD_LXS_XSIZE_MASK)); + *YSizePtr = (u16)(((RegValue) & (XOSD_LXS_YSIZE_MASK)) >> + (XOSD_LXS_YSIZE_SHIFT)); +} + +/*****************************************************************************/ +/** +* +* This function sets the alpha value and mode of an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid value +* range is from 0 to (the number of layers implemented in the +* core - 1). +* @param GlobalAlphaEnable indicates whether to enable the global alpha. +* Use any non-0 value to enable the global alpha, and 0 to +* disable it. +* @param 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. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_SetLayerAlpha(XOsd *InstancePtr, u8 LayerIndex, + u16 GlobalAlphaEnable, u16 GlobalAlphaValue) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = (u32)(XOSD_L0C_OFFSET) + (((u32)LayerIndex) * + ((u32)(XOSD_LAYER_SIZE))); + + /* Read the current Layer Control register value */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC))); + + /* Update the global alpha enable and the global alpha value fields */ + if (GlobalAlphaEnable != (u16)0x0U) { + RegValue |= ((u32)(XOSD_LXC_GALPHAEN_MASK)); + } + else { + RegValue &= (u32)(~(XOSD_LXC_GALPHAEN_MASK)); + } + RegValue &= (u32)(~(XOSD_LXC_ALPHA_MASK)); + RegValue |= (((u32)GlobalAlphaValue) << (XOSD_LXC_ALPHA_SHIFT)) & + (XOSD_LXC_ALPHA_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC)), RegValue); +} + +/*****************************************************************************/ +/** +* +* This function gets the alpha value and mode of an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid +* value range is from 0 to (the number of layers implemented +* in the core - 1). +* @param 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. +* @param GlobalAlphaValuePtr will point to the transparent level after +* this function returns. 0 for 100% transparent, 255 (8bit) +* for 0% transparent (100% opaque). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_GetLayerAlpha(XOsd *InstancePtr, u8 LayerIndex, + u16 *GlobalAlphaEnablePtr, u16 *GlobalAlphaValuePtr) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + Xil_AssertVoid(GlobalAlphaEnablePtr != NULL); + Xil_AssertVoid(GlobalAlphaValuePtr != NULL); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = ((u32)(XOSD_L0C_OFFSET) + (((u32)LayerIndex) * + ((u32)(XOSD_LAYER_SIZE)))); + + /* Read the current layer control register value */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC))); + + /* Get the info of the global alpha enable and the global alpha value + * fields + */ + *GlobalAlphaEnablePtr = (u16)((((RegValue) & + ((u32)(XOSD_LXC_GALPHAEN_MASK))) == + (XOSD_LXC_GALPHAEN_MASK)) ? 1U : 0U); + *GlobalAlphaValuePtr = (u16)(((RegValue) & (XOSD_LXC_ALPHA_MASK)) >> + (XOSD_LXC_ALPHA_SHIFT)); +} + +/*****************************************************************************/ +/** +* +* This function sets the priority of an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid value +* range is from 0 to (the number of layers implemented in the +* core - 1). +* @param 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. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_SetLayerPriority(XOsd *InstancePtr, u8 LayerIndex, u8 Priority) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + Xil_AssertVoid(Priority <= (XOSD_LAYER_PRIORITY_7)); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = ((u32)(XOSD_L0C_OFFSET)) + ((((u32)LayerIndex) * + ((u32)(XOSD_LAYER_SIZE)))); + + /* Read the current layer control register value */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC))); + + /* Update the priority field */ + RegValue &= (u32)(~(XOSD_LXC_PRIORITY_MASK)); + RegValue |= (((u32)Priority) << (XOSD_LXC_PRIORITY_SHIFT)) + & (XOSD_LXC_PRIORITY_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC)), RegValue); +} + +/*****************************************************************************/ +/** +* +* This function gets the priority of an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid value +* range is from 0 to (the number of layers implemented in the +* core - 1). +* @param 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. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_GetLayerPriority(XOsd *InstancePtr, u8 LayerIndex, u8 *PriorityPtr) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + Xil_AssertVoid(PriorityPtr != NULL); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = ((u32)(XOSD_L0C_OFFSET)) + ((((u32)LayerIndex) * + ((u32)(XOSD_LAYER_SIZE)))); + + /* Read the current layer control register value */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC))); + + /* Get the priority field */ + *PriorityPtr = (u8)(((RegValue) & (XOSD_LXC_PRIORITY_MASK)) >> + (XOSD_LXC_PRIORITY_SHIFT)); +} + +/*****************************************************************************/ +/** +* +* This function enables an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid +* value range is from 0 to (the number of layers implemented +* in the core - 1). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_EnableLayer(XOsd *InstancePtr, u8 LayerIndex) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = ((u32)(XOSD_L0C_OFFSET)) + ((((u32)LayerIndex) * + ((u32)(XOSD_LAYER_SIZE)))); + + /* Read the current layer control register value */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC))); + + /* Set the layer enable field */ + RegValue |= (XOSD_LXC_EN_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC)), RegValue); +} + +/*****************************************************************************/ +/** +* +* This function disables an OSD layer. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param LayerIndex indicates which layer to be worked on. Valid +* value range is from 0 to (the number of layers implemented +* in the core - 1). +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_DisableLayer(XOsd *InstancePtr, u8 LayerIndex) +{ + u32 LayerBaseRegAddr; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)LayerIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[LayerIndex].LayerType != + (XOSD_LAYER_TYPE_DISABLE)); + + /* Calculate the base register address of the layer to work on */ + LayerBaseRegAddr = ((u32)(XOSD_L0C_OFFSET)) + + ((((u32)LayerIndex) * ((u32)(XOSD_LAYER_SIZE)))); + + /* Read the current layer control register value */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC))); + + /* Clear the layer enable field */ + RegValue &= (u32)(~(XOSD_LXC_EN_MASK)); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + ((LayerBaseRegAddr) + (XOSD_LXC)), RegValue); +} + +/*****************************************************************************/ +/** +* +* This function loads color look up table data into an OSD Graphics Controller +* bank. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param 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. +* @param BankIndex indicates which GC Bank to be worked on. Valid +* value range is from 0 to XOSD_GC_BANK_NUM - 1. +* @param ColorData points to the color LUT data to be loaded. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_LoadColorLUTBank(XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, + u32 ColorData[]) +{ + u32 Index; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)GcIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == + (XOSD_LAYER_TYPE_GPU)); + Xil_AssertVoid(BankIndex < (XOSD_GC_BANK_NUM)); + Xil_AssertVoid(ColorData != NULL); + + /* Choose which bank to be loaded */ + RegValue = (((u32)BankIndex) + (XOSD_GCWBA_COL0)) & + (XOSD_GCWBA_BANK_MASK); + RegValue |= (((u32)GcIndex) << (XOSD_GCWBA_GCNUM_SHIFT)) + & (XOSD_GCWBA_GCNUM_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCWBA_OFFSET), + RegValue); + + /* Load color data */ + if(InstancePtr->Config.SlaveAxisVideoDataWidth == (u16)(XOSD_DATA_8)) { + for(Index = 0x0U; + Index < ((InstancePtr->Layers[GcIndex].ColorLutSize * + (XOSD_COLOR_ENTRY_SIZE)) / sizeof(u32)); + Index++) { + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + (XOSD_GCD_OFFSET), ColorData[Index]); + } + } + /* For video channel size of 10 or 12, the color size is 64 bits */ + else { + for (Index = 0U; + Index < (((InstancePtr->Layers[GcIndex].ColorLutSize) * + ((XOSD_DATA_2) * (XOSD_COLOR_ENTRY_SIZE))) / + (sizeof(u32))); + Index++) { + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + (XOSD_GCD_OFFSET), ColorData[Index]); + } + } + /* Set the active color LUT bank */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_GCABA_OFFSET)); + RegValue &= ((u32)(~1U) << (((u32)(XOSD_GCABA_COL_SHIFT)) + + ((u32)GcIndex))); + + RegValue |= ((u32)BankIndex) << ((XOSD_GCABA_COL_SHIFT) + + ((u32)GcIndex)); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCABA_OFFSET), + RegValue); +} + +/*****************************************************************************/ +/** +* +* This function loads character set data (font) into an OSD Graphics +* Controller bank. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param 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. +* @param BankIndex indicates which GC bank to be worked on. Valid +* value range is from 0 to XOSD_GC_BANK_NUM - 1. +* @param CharSetData points to the character set data to be loaded. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_LoadCharacterSetBank(XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, + u32 CharSetData[]) +{ + u32 RegValue; + u32 FontWriteNum; + u32 Index; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)GcIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == + (XOSD_LAYER_TYPE_GPU)); + Xil_AssertVoid(BankIndex < (XOSD_GC_BANK_NUM)); + Xil_AssertVoid(CharSetData != NULL); + + /* Choose which bank to be loaded */ + RegValue = (((u32)BankIndex) + (XOSD_GCWBA_CHR0)) & + (XOSD_GCWBA_BANK_MASK); + RegValue |= (((u32)GcIndex) << (XOSD_GCWBA_GCNUM_SHIFT)) & + (XOSD_GCWBA_GCNUM_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCWBA_OFFSET), + RegValue); + + /* Calculate the number of write to load the whole font data set */ + FontWriteNum = ((u32)(InstancePtr->Layers[GcIndex].FontWidth) * + (u32)(InstancePtr->Layers[GcIndex].FontHeight) * + (u32)(InstancePtr->Layers[GcIndex].FontBitsPerPixel)); + FontWriteNum /= (u32)(XOSD_FONT_BIT_TO_BYTE); + FontWriteNum *= (u32)(InstancePtr->Layers[GcIndex].FontNumChars); + FontWriteNum /= (u32)sizeof(u32); + + /* Load the font data */ + for (Index = 0x0U; Index < FontWriteNum; Index++) { + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCD_OFFSET), + CharSetData[Index]); + } + + /* Set the bank to be active so the font is used by the core */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_GCABA_OFFSET)); + RegValue &= (u32)((~((u32)1U << (XOSD_GCABA_CHR_SHIFT)) + + ((u32)GcIndex))); + RegValue |= ((u32)BankIndex) << ((XOSD_GCABA_CHR_SHIFT) + + ((u32)GcIndex)); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCABA_OFFSET), + RegValue); +} + +/*****************************************************************************/ +/** +* +* This function loads text data into an OSD Graphics Controller bank. +* +* @param InstancePtr is a pointer to the XOsd instance to be +* worked on. +* @param 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. +* @param BankIndex indicates which GC bank to be worked on. Valid value +* range is from 0 to XOSD_GC_BANK_NUM - 1. +* @param TextData points to the text data to be loaded. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_LoadTextBank(XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, + u32 TextData[]) +{ + u32 Index; + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)GcIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == + (XOSD_LAYER_TYPE_GPU)); + Xil_AssertVoid(BankIndex < (XOSD_GC_BANK_NUM)); + Xil_AssertVoid(TextData != NULL); + + /* Choose which bank to be loaded */ + RegValue = (((u32)BankIndex) + (XOSD_GCWBA_TXT0)) & + (XOSD_GCWBA_BANK_MASK); + RegValue |= (((u32)GcIndex) << (XOSD_GCWBA_GCNUM_SHIFT)) & + (XOSD_GCWBA_GCNUM_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCWBA_OFFSET), + RegValue); + + /* Load text data */ + for (Index = 0x0U; + Index < (u32)((((u32)(InstancePtr-> + Layers[GcIndex].TextNumStrings) * + (u32)(InstancePtr->Layers[GcIndex].TextMaxStringLength)) / + sizeof(u32))); + Index++) { + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + (XOSD_GCD_OFFSET), TextData[Index]); + } + + /* Set the active text bank */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_GCABA_OFFSET)); + RegValue &= ~(1U << ((XOSD_GCABA_TXT_SHIFT) + GcIndex)); + + RegValue |= ((u32)BankIndex) << ((XOSD_GCABA_TXT_SHIFT) + + ((u32)GcIndex)); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCABA_OFFSET), + RegValue); +} + +/*****************************************************************************/ +/** +* +* This function chooses active banks for a GC in the OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param 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. +* @param ColorBankIndex indicates the color LUT bank to be choose as +* active. +* @param CharBankIndex indicates the character set bank to be chosen as +* active. +* @param TextBankIndex indicates the text data bank to be chosen as +* active. +* @param InstructionBankIndex indicates the instruction bank to be +* chosen as active. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_SetActiveBank(XOsd *InstancePtr, u8 GcIndex, u8 ColorBankIndex, + u8 CharBankIndex, u8 TextBankIndex, u8 InstructionBankIndex) +{ + u32 RegValue; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)GcIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == + (XOSD_LAYER_TYPE_GPU)); + Xil_AssertVoid(ColorBankIndex < (XOSD_GC_BANK_NUM)); + Xil_AssertVoid(CharBankIndex < (XOSD_GC_BANK_NUM)); + Xil_AssertVoid(TextBankIndex < (XOSD_GC_BANK_NUM)); + Xil_AssertVoid(InstructionBankIndex < (XOSD_GC_BANK_NUM)); + + /* Clear the current active bank setting first */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_GCABA_OFFSET)); + RegValue &= ~(1U << GcIndex) & (XOSD_GCABA_INS_MASK); + RegValue &= ~(1U << ((XOSD_GCABA_COL_SHIFT) + (GcIndex))) & + (XOSD_GCABA_COL_MASK); + RegValue &= ~(1U << ((XOSD_GCABA_TXT_SHIFT) + (GcIndex))) & + (XOSD_GCABA_TXT_MASK); + RegValue &= ~(1U << ((XOSD_GCABA_CHR_SHIFT) + (GcIndex))) & + (XOSD_GCABA_CHR_MASK); + + /* Choose the active banks */ + RegValue |= (((u32)InstructionBankIndex) << ((u32)GcIndex)) & + (XOSD_GCABA_INS_MASK); + RegValue |= (((u32)ColorBankIndex) << ((XOSD_GCABA_COL_SHIFT) + + (GcIndex))) & (XOSD_GCABA_COL_MASK); + RegValue |= (((u32)TextBankIndex) << ((XOSD_GCABA_TXT_SHIFT) + + (GcIndex))) & (XOSD_GCABA_TXT_MASK); + RegValue |= (((u32)CharBankIndex) << ((XOSD_GCABA_CHR_SHIFT) + + (GcIndex))) & (XOSD_GCABA_CHR_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, XOSD_GCABA_OFFSET, + RegValue); +} + +/*****************************************************************************/ +/** +* +* This function creates an instruction for the OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param 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. +* @param 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. +* @param ObjType indicates the type of object to draw. Use one of +* XOSD_INS_OPCODE_* constants defined in xosd_hw.h. +* @param ObjSize indicates line width of boxes and lines and the text +* scale factor for text boxes. +* @param XStart indicates the horizontal start pixel of the Object. +* @param YStart indicates the vertical start line of the Object. +* @param XEnd indicates the horizontal end pixel of the Object. +* @param YEnd indicates the vertical end line of the Object. +* @param TextIndex indicates the string index. +* @param ColorIndex indicates the color index. +* +* @return None. +* +* @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) +{ + u32 Value; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid(InstructionPtr != NULL); + Xil_AssertVoid((u16)GcIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == + (XOSD_LAYER_TYPE_GPU)); + Xil_AssertVoid((ObjType == (XOSD_INS_OPCODE_END)) || + (ObjType == (XOSD_INS_OPCODE_NOP)) || + (ObjType == (XOSD_INS_OPCODE_BOXTXT)) || + (ObjType == (XOSD_INS_OPCODE_LINE)) || + (ObjType == (XOSD_INS_OPCODE_TXT)) || + (ObjType == (XOSD_INS_OPCODE_BOX))); + Xil_AssertVoid((u32)XEnd < InstancePtr->ScreenWidth); + Xil_AssertVoid((u32)YEnd < InstancePtr->ScreenHeight); + Xil_AssertVoid(TextIndex < + InstancePtr->Layers[GcIndex].TextNumStrings); + Xil_AssertVoid(ColorIndex < InstancePtr->Layers[GcIndex].ColorLutSize); + + /* Clear the whole instruction first */ + (void)memset((void *)InstructionPtr, 0, (XOSD_INS_SIZE) * + (sizeof(u32))); + + /* Populate instruction word 0 fields */ + Value = ((u32)XStart) & (XOSD_INS0_XSTART_MASK); + Value |= (((u32)XEnd) << (XOSD_INS0_XEND_SHIFT)) & + (XOSD_INS0_XEND_MASK); + Value |= (((u32)GcIndex) << (XOSD_INS0_GCNUM_SHIFT)) & + (XOSD_INS0_GCNUM_MASK); + Value |= (((u32)ObjType) << (XOSD_INS0_OPCODE_SHIFT)) & + (XOSD_INS0_OPCODE_MASK); + InstructionPtr[XOSD_INS0] = Value; + + /* Populate instruction word 1 fields */ + Value = ((u32)TextIndex) & (XOSD_INS1_TXTINDEX_MASK); + InstructionPtr[XOSD_INS1] = Value; + + /* Populate instruction word 2 fields */ + Value = ((u32)YStart) & (XOSD_INS2_YSTART_MASK); + Value |= (((u32)YEnd) << (XOSD_INS2_YEND_SHIFT)) & + (XOSD_INS2_YEND_MASK); + Value |= (((u32)ObjSize) << (XOSD_INS2_OBJSIZE_SHIFT)) & + (XOSD_INS2_OBJSIZE_MASK); + InstructionPtr[XOSD_INS2] = Value; + + /* Populate instruction word 3 fields */ + Value = ((u32)ColorIndex) & (XOSD_INS3_COL_MASK); + InstructionPtr[XOSD_INS3] = Value; +} + +/*****************************************************************************/ +/** +* +* This function load an instruction list to be used by an Graphic Controller +* in the OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param 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. +* @param BankIndex indicates which GC Bank to be worked on. Valid +* value range is from 0 to XOSD_GC_BANK_NUM. +* @param 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. +* @param 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. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_LoadInstructionList(XOsd *InstancePtr, u8 GcIndex, u8 BankIndex, + u32 InstSetPtr[], u32 InstNum) +{ + u32 RegValue; + u32 Index; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertVoid((u16)GcIndex < InstancePtr->Config.LayerNum); + Xil_AssertVoid(InstancePtr->Layers[GcIndex].LayerType == + (XOSD_LAYER_TYPE_GPU)); + Xil_AssertVoid(BankIndex < (XOSD_GC_BANK_NUM)); + Xil_AssertVoid(InstSetPtr != NULL); + Xil_AssertVoid(InstNum <= InstancePtr->Layers[GcIndex].InstructionNum); + + /* Choose which bank to be loaded */ + RegValue = (((u32)BankIndex) + (XOSD_GCWBA_INS0)) & + (XOSD_GCWBA_BANK_MASK); + RegValue |= (((u32)GcIndex) << (XOSD_GCWBA_GCNUM_SHIFT)) & + (XOSD_GCWBA_GCNUM_MASK); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, (XOSD_GCWBA_OFFSET), + RegValue); + for (Index = 0U; Index < (InstNum * (XOSD_INS_SIZE)); Index++) { + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + (XOSD_GCD_OFFSET), InstSetPtr[Index]); + } + + /* Notify OSD this is the end of the instruction list by adding an END + * instruction + */ + if (InstNum < InstancePtr->Layers[GcIndex].InstructionNum) { + for (Index = 0x0U; Index < (XOSD_INS_SIZE); Index++) { + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + (XOSD_GCD_OFFSET), 0x0U); + } + } + + /* Set the active instruction bank */ + RegValue = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_GCABA_OFFSET)); + RegValue &= ~(1U << GcIndex); + RegValue |= ((u32)BankIndex << (u32)GcIndex); + XOsd_WriteReg(InstancePtr->Config.BaseAddress, + (XOSD_GCABA_OFFSET), RegValue); +} + +/*****************************************************************************/ +/* +* +* This function populates the layer array in the XOsd instance with +* the properties of all layers. This is to help fetch the information faster +* later. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param CfgPtr is a to the configuration structure associated with +* the OSD core. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +static void PopulateLayerProperty(XOsd *InstancePtr, XOsd_Config *CfgPtr) +{ + XOsd *IpTemp = NULL; + XOsd_Config *Cfg = NULL; + + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CfgPtr != NULL); + + /* Use short variable names to keep the lines in this function + * shorter + */ + IpTemp = InstancePtr; + Xil_AssertVoid(IpTemp != NULL); + Cfg = CfgPtr; + Xil_AssertVoid(Cfg != NULL); + + /* Layer #0 */ + IpTemp->Layers[0].LayerType = Cfg->Layer0Type; + IpTemp->Layers[0].InstructionNum = Cfg->Layer0InstructionMemSize; + IpTemp->Layers[0].InstructionBoxEnable = Cfg->Layer0InstructionBoxEnable; + IpTemp->Layers[0].InstructionLineEnable = Cfg->Layer0InstructionLineEnable; + IpTemp->Layers[0].InstructionTextEnable = Cfg->Layer0InstructionTextEnable; + IpTemp->Layers[0].ColorLutSize = Cfg->Layer0ColorLutSize; + IpTemp->Layers[0].ColorLutMemoryType = Cfg->Layer0ColorLutMemoryType; + IpTemp->Layers[0].FontNumChars = Cfg->Layer0FontNumChars; + IpTemp->Layers[0].FontWidth = Cfg->Layer0FontWidth; + IpTemp->Layers[0].FontHeight = Cfg->Layer0FontHeight; + IpTemp->Layers[0].FontBitsPerPixel = Cfg->Layer0FontBitsPerPixel; + IpTemp->Layers[0].FontAsciiOffset = Cfg->Layer0FontAsciiOffset; + IpTemp->Layers[0].TextNumStrings = Cfg->Layer0TextNumStrings; + IpTemp->Layers[0].TextMaxStringLength = Cfg->Layer0TextMaxStringLength; + + /* Layer #1 */ + IpTemp->Layers[1].LayerType = Cfg->Layer1Type; + IpTemp->Layers[1].InstructionNum = Cfg->Layer1InstructionMemSize; + IpTemp->Layers[1].InstructionBoxEnable = Cfg->Layer1InstructionBoxEnable; + IpTemp->Layers[1].InstructionLineEnable = Cfg->Layer1InstructionLineEnable; + IpTemp->Layers[1].InstructionTextEnable = Cfg->Layer1InstructionTextEnable; + IpTemp->Layers[1].ColorLutSize = Cfg->Layer1ColorLutSize; + IpTemp->Layers[1].ColorLutMemoryType = Cfg->Layer1ColorLutMemoryType; + IpTemp->Layers[1].FontNumChars = Cfg->Layer1FontNumChars; + IpTemp->Layers[1].FontWidth = Cfg->Layer1FontWidth; + IpTemp->Layers[1].FontHeight = Cfg->Layer1FontHeight; + IpTemp->Layers[1].FontBitsPerPixel = Cfg->Layer1FontBitsPerPixel; + IpTemp->Layers[1].FontAsciiOffset = Cfg->Layer1FontAsciiOffset; + IpTemp->Layers[1].TextNumStrings = Cfg->Layer1TextNumStrings; + IpTemp->Layers[1].TextMaxStringLength = Cfg->Layer1TextMaxStringLength; + + /* Layer #2 */ + IpTemp->Layers[2].LayerType = Cfg->Layer2Type; + IpTemp->Layers[2].InstructionNum = Cfg->Layer2InstructionMemSize; + IpTemp->Layers[2].InstructionBoxEnable = Cfg->Layer2InstructionBoxEnable; + IpTemp->Layers[2].InstructionLineEnable = Cfg->Layer2InstructionLineEnable; + IpTemp->Layers[2].InstructionTextEnable = Cfg->Layer2InstructionTextEnable; + IpTemp->Layers[2].ColorLutSize = Cfg->Layer2ColorLutSize; + IpTemp->Layers[2].ColorLutMemoryType = Cfg->Layer2ColorLutMemoryType; + IpTemp->Layers[2].FontNumChars = Cfg->Layer2FontNumChars; + IpTemp->Layers[2].FontWidth = Cfg->Layer2FontWidth; + IpTemp->Layers[2].FontHeight = Cfg->Layer2FontHeight; + IpTemp->Layers[2].FontBitsPerPixel = Cfg->Layer2FontBitsPerPixel; + IpTemp->Layers[2].FontAsciiOffset = Cfg->Layer2FontAsciiOffset; + IpTemp->Layers[2].TextNumStrings = Cfg->Layer2TextNumStrings; + IpTemp->Layers[2].TextMaxStringLength = Cfg->Layer2TextMaxStringLength; + + /* Layer #3 */ + IpTemp->Layers[3].LayerType = Cfg->Layer3Type; + IpTemp->Layers[3].InstructionNum = Cfg->Layer3InstructionMemSize; + IpTemp->Layers[3].InstructionBoxEnable = Cfg->Layer3InstructionBoxEnable; + IpTemp->Layers[3].InstructionLineEnable = Cfg->Layer3InstructionLineEnable; + IpTemp->Layers[3].InstructionTextEnable = Cfg->Layer3InstructionTextEnable; + IpTemp->Layers[3].ColorLutSize = Cfg->Layer3ColorLutSize; + IpTemp->Layers[3].ColorLutMemoryType = Cfg->Layer3ColorLutMemoryType; + IpTemp->Layers[3].FontNumChars = Cfg->Layer3FontNumChars; + IpTemp->Layers[3].FontWidth = Cfg->Layer3FontWidth; + IpTemp->Layers[3].FontHeight = Cfg->Layer3FontHeight; + IpTemp->Layers[3].FontBitsPerPixel = Cfg->Layer3FontBitsPerPixel; + IpTemp->Layers[3].FontAsciiOffset = Cfg->Layer3FontAsciiOffset; + IpTemp->Layers[3].TextNumStrings = Cfg->Layer3TextNumStrings; + IpTemp->Layers[3].TextMaxStringLength = Cfg->Layer3TextMaxStringLength; + + /* Layer #4 */ + IpTemp->Layers[4].LayerType = Cfg->Layer4Type; + IpTemp->Layers[4].InstructionNum = Cfg->Layer4InstructionMemSize; + IpTemp->Layers[4].InstructionBoxEnable = Cfg->Layer4InstructionBoxEnable; + IpTemp->Layers[4].InstructionLineEnable = Cfg->Layer4InstructionLineEnable; + IpTemp->Layers[4].InstructionTextEnable = Cfg->Layer4InstructionTextEnable; + IpTemp->Layers[4].ColorLutSize = Cfg->Layer4ColorLutSize; + IpTemp->Layers[4].ColorLutMemoryType = Cfg->Layer4ColorLutMemoryType; + IpTemp->Layers[4].FontNumChars = Cfg->Layer4FontNumChars; + IpTemp->Layers[4].FontWidth = Cfg->Layer4FontWidth; + IpTemp->Layers[4].FontHeight = Cfg->Layer4FontHeight; + IpTemp->Layers[4].FontBitsPerPixel = Cfg->Layer4FontBitsPerPixel; + IpTemp->Layers[4].FontAsciiOffset = Cfg->Layer4FontAsciiOffset; + IpTemp->Layers[4].TextNumStrings = Cfg->Layer4TextNumStrings; + IpTemp->Layers[4].TextMaxStringLength = Cfg->Layer4TextMaxStringLength; + + /* Layer #5 */ + IpTemp->Layers[5].LayerType = Cfg->Layer5Type; + IpTemp->Layers[5].InstructionNum = Cfg->Layer5InstructionMemSize; + IpTemp->Layers[5].InstructionBoxEnable = Cfg->Layer5InstructionBoxEnable; + IpTemp->Layers[5].InstructionLineEnable = Cfg->Layer5InstructionLineEnable; + IpTemp->Layers[5].InstructionTextEnable = Cfg->Layer5InstructionTextEnable; + IpTemp->Layers[5].ColorLutSize = Cfg->Layer5ColorLutSize; + IpTemp->Layers[5].ColorLutMemoryType = Cfg->Layer5ColorLutMemoryType; + IpTemp->Layers[5].FontNumChars = Cfg->Layer5FontNumChars; + IpTemp->Layers[5].FontWidth = Cfg->Layer5FontWidth; + IpTemp->Layers[5].FontHeight = Cfg->Layer5FontHeight; + IpTemp->Layers[5].FontBitsPerPixel = Cfg->Layer5FontBitsPerPixel; + IpTemp->Layers[5].FontAsciiOffset = Cfg->Layer5FontAsciiOffset; + IpTemp->Layers[5].TextNumStrings = Cfg->Layer5TextNumStrings; + IpTemp->Layers[5].TextMaxStringLength = Cfg->Layer5TextMaxStringLength; + + /* Layer #6 */ + IpTemp->Layers[6].LayerType = Cfg->Layer6Type; + IpTemp->Layers[6].InstructionNum = Cfg->Layer6InstructionMemSize; + IpTemp->Layers[6].InstructionBoxEnable = Cfg->Layer6InstructionBoxEnable; + IpTemp->Layers[6].InstructionLineEnable = Cfg->Layer6InstructionLineEnable; + IpTemp->Layers[6].InstructionTextEnable = Cfg->Layer6InstructionTextEnable; + IpTemp->Layers[6].ColorLutSize = Cfg->Layer6ColorLutSize; + IpTemp->Layers[6].ColorLutMemoryType = Cfg->Layer6ColorLutMemoryType; + IpTemp->Layers[6].FontNumChars = Cfg->Layer6FontNumChars; + IpTemp->Layers[6].FontWidth = Cfg->Layer6FontWidth; + IpTemp->Layers[6].FontHeight = Cfg->Layer6FontHeight; + IpTemp->Layers[6].FontBitsPerPixel = Cfg->Layer6FontBitsPerPixel; + IpTemp->Layers[6].FontAsciiOffset = Cfg->Layer6FontAsciiOffset; + IpTemp->Layers[6].TextNumStrings = Cfg->Layer6TextNumStrings; + IpTemp->Layers[6].TextMaxStringLength = Cfg->Layer6TextMaxStringLength; + + /* Layer #7 */ + IpTemp->Layers[7].LayerType = Cfg->Layer7Type; + IpTemp->Layers[7].InstructionNum = Cfg->Layer7InstructionMemSize; + IpTemp->Layers[7].InstructionBoxEnable = Cfg->Layer7InstructionBoxEnable; + IpTemp->Layers[7].InstructionLineEnable = Cfg->Layer7InstructionLineEnable; + IpTemp->Layers[7].InstructionTextEnable = Cfg->Layer7InstructionTextEnable; + IpTemp->Layers[7].ColorLutSize = Cfg->Layer7ColorLutSize; + IpTemp->Layers[7].ColorLutMemoryType = Cfg->Layer7ColorLutMemoryType; + IpTemp->Layers[7].FontNumChars = Cfg->Layer7FontNumChars; + IpTemp->Layers[7].FontWidth = Cfg->Layer7FontWidth; + IpTemp->Layers[7].FontHeight = Cfg->Layer7FontHeight; + IpTemp->Layers[7].FontBitsPerPixel = Cfg->Layer7FontBitsPerPixel; + IpTemp->Layers[7].FontAsciiOffset = Cfg->Layer7FontAsciiOffset; + IpTemp->Layers[7].TextNumStrings = Cfg->Layer7TextNumStrings; + IpTemp->Layers[7].TextMaxStringLength = Cfg->Layer7TextMaxStringLength; + + /* Convert instruction memory sizes into the maximum numbers of + * instructions supported + */ + IpTemp->Layers[0].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); + IpTemp->Layers[1].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); + IpTemp->Layers[2].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); + IpTemp->Layers[3].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); + IpTemp->Layers[4].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); + IpTemp->Layers[5].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); + IpTemp->Layers[6].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); + IpTemp->Layers[7].InstructionNum /= (XOSD_INS_MEM_SIZE_TO_NUM); +} + +/*****************************************************************************/ +/** +* +* This function returns the Version of the OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return Contents of the Version register. +* +* @note None. +* +******************************************************************************/ +u32 XOsd_GetVersion(XOsd *InstancePtr) +{ + u32 Data; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + /* Read core version */ + Data = XOsd_ReadReg(InstancePtr->Config.BaseAddress, XOSD_VER_OFFSET); + + return Data; +} + +/*****************************************************************************/ +/** +* +* This function is a stub for the asynchronous callbacks. The stub is here in +* case the upper layer forgot to set the handlers. On initialization, All +* handlers except error handler are set to this callback. It is considered an +* error for this handler to be invoked. +* +* @param CallBackRef is a callback reference passed in by the upper +* layer when setting the callback functions and passed back +* to the upper layer when the callback is invoked. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +static void StubCallBack(void *CallBackRef) +{ + (void)CallBackRef; + Xil_AssertVoidAlways(); +} + +/*****************************************************************************/ +/** +* +* This routine is a stub for the asynchronous error interrupt callback. The +* stub is here in case the upper layer forgot to set the handler. On +* initialization, error interrupt handler is set to this callback. It is +* considered an error for this handler to be invoked. +* +* @param CallBackRef is a callback reference passed in by the upper +* layer when setting the callback functions and passed back +* to the upper layer when the callback is invoked. +* @param ErrorMask is a bit mask indicating the cause of the error. Its +* value equals 'OR'ing one or more XOSD_IXR_* values defined +* in xosd_hw.h. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +static void StubErrCallBack(void *CallBackRef, u32 ErrorMask) +{ + (void)CallBackRef; + (void)ErrorMask; + Xil_AssertVoidAlways(); +} diff --git a/XilinxProcessorIPLib/drivers/osd/src/xosd.h b/XilinxProcessorIPLib/drivers/osd/src/xosd.h index feccf66f..b35a3025 100755 --- a/XilinxProcessorIPLib/drivers/osd/src/xosd.h +++ b/XilinxProcessorIPLib/drivers/osd/src/xosd.h @@ -1,694 +1,901 @@ -/****************************************************************************** -* -* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file xosd.h -* -* This is main header file of the Xilinx MVI On-Screen-Display (OSD) device -* driver. -* -* An OSD is an image superimposed on a screen picture, commonly used by modern -* televisions, VCRs, and DVD players to display information such as volume, -* channel, and time. -* -* Xilinx MVI OSD has the following main features: -* -* - Read Video Data one of three sources -* - VFBC/Frame Buffer -* - VideoBus -* - Graphics Controller -* - Alpha Compositing and Alpha Blending of up to 8 layers -* - Up to 8 priorities, one for each of the layers -* - Real-Time Graphics Controller -* - Write Composited Video Data to either -* - VFBC/Frame Buffer, or -* - VideoBus -* -* For a full description of OSD features, please see the hardware spec. -* -* Interrupt Service -* -* Four interrupt types are supported: -* -* - Vertical Blank Interval Start Interrupt -* - Vertical Blank Interval End Interrupt -* - Frame Done Interrupt -* - Error Interrupt -* -* Software Initialization -* -* Please follow the example provided with this driver for the steps -* to use this driver. -* -* Cache Coherency -* -* Alignment -* -* Limitations -* -* BUS Interface -* -*
-* MODIFICATION HISTORY:
-*
-* Ver   Who  Date     Changes
-* ----- ---- -------- -------------------------------------------------------
-* 1.00a xd   08/18/08 First release
-* 1.01a xd   07/30/10 Added device version support; Supported doxygen; Fixed
-*                     CR #534952
-* 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. 
-* 3.0   adk  19/12/13 Updated as per the New Tcl API's
-*                     
-* 
-* -******************************************************************************/ - -#ifndef XOSD_H /* prevent circular inclusions */ -#define XOSD_H /* by using protection macros */ - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************** Include Files *********************************/ - -#include "xosd_hw.h" -#include "xil_assert.h" -#include "xstatus.h" - -/************************** Constant Definitions *****************************/ - -/** @name Interrupt types for setting up callbacks - * @{ - */ -#define XOSD_HANDLER_FRAMEDONE 1 /**< Frame Done interrupt */ -#define XOSD_HANDLER_VBISTART 2 /**< Vertical Blank Interval Start - * interrupt */ -#define XOSD_HANDLER_VBIEND 3 /**< Vertical Blank Interval End - * interrupt */ -#define XOSD_HANDLER_ERROR 4 /**< Error condition interrupt */ -/*@}*/ - -/**************************** Type Definitions *******************************/ - -/** - * OSD device configuration structure. - * Each OSD device should have a configuration structure associated - */ -typedef struct { - u16 DeviceId; /**< DeviceId is the unique ID of the device */ - u32 BaseAddress; /**< BaseAddress is the physical base address of - * the device's registers */ - u16 LayerNum; /**< The number of Layers */ - u16 S_AXIS_VIDEO_DATA_WIDTH; - u16 Layer0Type; /**< Type of Layer #0 */ - u16 Layer1Type; /**< Type of Layer #1 */ - u16 Layer2Type; /**< Type of Layer #2 */ - u16 Layer3Type; /**< Type of Layer #3 */ - u16 Layer4Type; /**< Type of Layer #4 */ - u16 Layer5Type; /**< Type of Layer #5 */ - u16 Layer6Type; /**< Type of Layer #6 */ - u16 Layer7Type; /**< Type of Layer #7 */ - - /**< Layer 0 */ - u16 Layer0InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer0InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer0InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer0InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer0ColorLutSize; /**< Color Lut Size */ - u16 Layer0ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer0FontNumChars; /**< Font: Number of characters */ - u16 Layer0FontWidth; /**< Font: Width */ - u16 Layer0FontHeight; /**< Font: Height */ - u16 Layer0FontBitsPerPixel; /**< Font: Number of bits per pixel - */ - u16 Layer0FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer0TextNumStrings; /**< Text: Number of Strings */ - u16 Layer0TextMaxStringLength; /**< Text: Maximum length of a - * String */ - - /**< Layer 1 */ - u16 Layer1InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer1InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer1InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer1InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer1ColorLutSize; /**< Color Lut Size */ - u16 Layer1ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer1FontNumChars; /**< Font: Number of characters */ - u16 Layer1FontWidth; /**< Font: Width */ - u16 Layer1FontHeight; /**< Font: Height */ - u16 Layer1FontBitsPerPixel; /**< Font: Number of bits per pixel - */ - u16 Layer1FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer1TextNumStrings; /**< Text: Number of Strings */ - u16 Layer1TextMaxStringLength; /**< Text: Maximum length of a - * String */ - - /**< Layer 2 */ - u16 Layer2InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer2InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer2InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer2InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer2ColorLutSize; /**< Color Lut Size */ - u16 Layer2ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer2FontNumChars; /**< Font: Number of characters */ - u16 Layer2FontWidth; /**< Font: Width */ - u16 Layer2FontHeight; /**< Font: Height */ - u16 Layer2FontBitsPerPixel; /**< Font: Number of bits per - * pixel */ - u16 Layer2FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer2TextNumStrings; /**< Text: Number of Strings */ - u16 Layer2TextMaxStringLength; /**< Text: Maximum length of a - * String */ - - /**< Layer 3 */ - u16 Layer3InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer3InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer3InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer3InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer3ColorLutSize; /**< Color Lut Size */ - u16 Layer3ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer3FontNumChars; /**< Font: Number of characters */ - u16 Layer3FontWidth; /**< Font: Width */ - u16 Layer3FontHeight; /**< Font: Height */ - u16 Layer3FontBitsPerPixel; /**< Font: Number of bits per pixel - */ - u16 Layer3FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer3TextNumStrings; /**< Text: Number of Strings */ - u16 Layer3TextMaxStringLength; /**< Text: Maximum length of a - * String */ - - /**< Layer 4 */ - u16 Layer4InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer4InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer4InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer4InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer4ColorLutSize; /**< Color Lut Size */ - u16 Layer4ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer4FontNumChars; /**< Font: Number of characters */ - u16 Layer4FontWidth; /**< Font: Width */ - u16 Layer4FontHeight; /**< Font: Height */ - u16 Layer4FontBitsPerPixel; /**< Font: Number of bits per - * pixel */ - u16 Layer4FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer4TextNumStrings; /**< Text: Number of Strings */ - u16 Layer4TextMaxStringLength; /**< Text: Maximum length of a - * String */ - - /**< Layer 5 */ - u16 Layer5InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer5InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer5InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer5InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer5ColorLutSize; /**< Color Lut Size */ - u16 Layer5ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer5FontNumChars; /**< Font: Number of characters */ - u16 Layer5FontWidth; /**< Font: Width */ - u16 Layer5FontHeight; /**< Font: Height */ - u16 Layer5FontBitsPerPixel; /**< Font: Number of bits per - * pixel */ - u16 Layer5FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer5TextNumStrings; /**< Text: Number of Strings */ - u16 Layer5TextMaxStringLength; /**< Text: Maximum length of a - * String */ - - /**< Layer 6 */ - u16 Layer6InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer6InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer6InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer6InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer6ColorLutSize; /**< Color Lut Size */ - u16 Layer6ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer6FontNumChars; /**< Font: Number of characters */ - u16 Layer6FontWidth; /**< Font: Width */ - u16 Layer6FontHeight; /**< Font: Height */ - u16 Layer6FontBitsPerPixel; /**< Font: Number of bits per - * pixel */ - u16 Layer6FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer6TextNumStrings; /**< Text: Number of Strings */ - u16 Layer6TextMaxStringLength; /**< Text: Maximum length of a - * String */ - - /**< Layer 7 */ - u16 Layer7InstructionMemSize; /**< Instruction Memory Size */ - u16 Layer7InstructionBoxEnable; /**< Instruction Box Enable */ - u16 Layer7InstructionLineEnable; /**< Instruction Line Enable */ - u16 Layer7InstructionTextEnable; /**< Instruction Text Enable */ - u16 Layer7ColorLutSize; /**< Color Lut Size */ - u16 Layer7ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 Layer7FontNumChars; /**< Font: Number of characters */ - u16 Layer7FontWidth; /**< Font: Width */ - u16 Layer7FontHeight; /**< Font: Height */ - u16 Layer7FontBitsPerPixel; /**< Font: Number of bits per - * pixel */ - u16 Layer7FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 Layer7TextNumStrings; /**< Text: Number of Strings */ - u16 Layer7TextMaxStringLength; /**< Text: Maximum length of a - * String */ - -} XOSD_Config; - -/** - * The XOSD Layer info structure - */ -typedef struct { - u16 LayerType; /**< Type of the layer */ - u16 InstructionNum; /**< The Number of Instructions */ - u16 InstructionBoxEnable; /**< Instruction Box Enable */ - u16 InstructionLineEnable; /**< Instruction Line Enable */ - u16 InstructionTextEnable; /**< Instruction Text Enable */ - u16 ColorLutSize; /**< Color Lut Size */ - u16 ColorLutMemoryType; /**< Color Lut Memory Type */ - u16 FontNumChars; /**< Font: Number of characters */ - u16 FontWidth; /**< Font: Width */ - u16 FontHeight; /**< Font: Height */ - u16 FontBitsPerPixel; /**< Font: Number of bits per pixel */ - u16 FontAsciiOffset; /**< Font: ASCII offset of 1st - * character */ - u16 TextNumStrings; /**< Text: Number of Strings */ - u16 TextMaxStringLength; /**< Text: Maximum length of a - * String */ - -} XOSD_Layer; - -/** - * Callback type for all interrupts except error interrupt. - * - * @param CallBackRef is a callback reference passed in by the upper layer - * when setting the callback functions, and passed back to the - * upper layer when the callback is invoked. - */ -typedef void (*XOSD_CallBack) (void *CallBackRef); - -/** - * Callback type for Error interrupt. - * - * @param CallBackRef is a callback reference passed in by the upper layer - * when setting the callback functions, and passed back to the - * upper layer when the callback is invoked. - * @param ErrorMask is a bit mask indicating the cause of the error. Its - * value equals 'OR'ing one or more XOSD_IXR_* values defined in - * xosd_hw.h - */ -typedef void (*XOSD_ErrorCallBack) (void *CallBackRef, u32 ErrorMask); - -/** - * The XOSD driver instance data. An instance must be allocated for each - * OSD device in use. - */ -typedef struct { - XOSD_Config Config; /**< Hardware configuration */ - u32 IsReady; /**< Device and the driver instance are - * initialized */ - int InstructionInExternalMem; /**< Flag indicating if the instruction - list is from external memory */ - u32 ScreenHeight; /**< Screen Height of the OSD output */ - u32 ScreenWidth; /**< Screen Width of the OSD output */ - - XOSD_Layer Layers[XOSD_MAX_NUM_OF_LAYERS]; /**< Properties of layers */ - - XOSD_CallBack VbiStartCallBack; /**< Call back for Vertical Blank - * Interval (VBI) Start interrupt */ - void *VbiStartRef; /**< To be passed to the VBI Start - * interrupt callback */ - - XOSD_CallBack VbiEndCallBack; /**< Call back for Vertical Blank - * Interval (VBI) End interrupt */ - void *VbiEndRef; /**< To be passed to the VBI End - * interrupt callback */ - - XOSD_CallBack FrameDoneCallBack;/**< Call back for Frame Done interrupt - */ - void *FrameDoneRef; /**< To be passed to the Frame Done - * interrupt callback */ - - XOSD_ErrorCallBack ErrCallBack; /**< Call back for Error interrupt */ - void *ErrRef; /**< To be passed to the Error - * interrupt callback */ - -} XOSD; - -/** - * The XOSD_Instruction data structure for holding one GC instruction. - */ -typedef u32 XOSD_Instruction[XOSD_INS_SIZE]; - -/***************** Macros (Inline Functions) Definitions *********************/ - -/*****************************************************************************/ -/** -* -* This macro enables an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_Enable(XOSD *InstancePtr); -* -******************************************************************************/ -#define XOSD_Enable(InstancePtr) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ - XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) | \ - XOSD_CTL_EN_MASK) - -/*****************************************************************************/ -/** -* -* This macro disables an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_Disable(XOSD *InstancePtr); -* -******************************************************************************/ -#define XOSD_Disable(InstancePtr) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ - XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) & \ - (~XOSD_CTL_EN_MASK)) - -/*****************************************************************************/ -/** -* -* This macro tell an OSD device to pick up the register updates. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_RegUpdateEnable(XOSD *InstancePtr); -* -******************************************************************************/ -#define XOSD_RegUpdateEnable(InstancePtr) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ - XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) | \ - XOSD_CTL_RUE_MASK) - -/*****************************************************************************/ -/** -* -* This macro tell an OSD device to ignore the register updates. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_RegUpdateDisable(XOSD *InstancePtr); -* -******************************************************************************/ -#define XOSD_RegUpdateDisable(InstancePtr) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ - XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) & \ - (~XOSD_CTL_RUE_MASK)) - -/*****************************************************************************/ -/** -* -* This macro resets an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_Reset(XOSD *InstancePtr); -* -******************************************************************************/ -#define XOSD_Reset(InstancePtr) \ -{ \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_RST, \ - XOSD_RST_RESET); \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, 0); \ - (InstancePtr)->InstructionInExternalMem = 0; \ - (InstancePtr)->ScreenHeight = 0; \ - (InstancePtr)->ScreenWidth = 0; \ -} - -/*****************************************************************************/ -/** -* -* This macro enables the global interrupt on an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_IntrEnableGlobal(XOSD *InstancePtr); -* -******************************************************************************/ -#define XOSD_IntrEnableGlobal(InstancePtr) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_GIER, \ - XOSD_GIER_GIE_MASK) - -/*****************************************************************************/ -/** -* -* This macro disables the global interrupt on an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_IntrDisableGlobal(XOSD *InstancePtr); -* -******************************************************************************/ -#define XOSD_IntrDisableGlobal(InstancePtr) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_GIER, 0) - -/*****************************************************************************/ -/** -* -* This macro enables the given individual interrupt(s) on an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @param IntrType is the type of the interrupts to enable. Use OR'ing of -* XOSD_IXR_* constants defined in xosd_hw.h to create this parameter -* value. -* -* @return None -* -* @note -* -* The existing enabled interrupt(s) will remain enabled. -* -* C-style signature: -* void XOSD_IntrEnable(XOSD *InstancePtr, u32 IntrType) -* -******************************************************************************/ -#define XOSD_IntrEnable(InstancePtr, IntrType) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_IER, \ - ((IntrType) & XOSD_IXR_ALLINTR_MASK) | \ - XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_IER)) - -/*****************************************************************************/ -/** -* -* This macro disables the given individual interrupt(s) on an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @param IntrType is the type of the interrupts to disable. Use OR'ing of -* XOSD_IXR_* constants defined in xosd_hw.h to create this parameter -* value. -* -* @return None -* -* @note -* -* Any other interrupt not covered by parameter IntrType, if enabled before -* this macro is called, will remain enabled. -* -* C-style signature: -* void XOSD_IntrDisable(XOSD *InstancePtr, u32 IntrType) -* -******************************************************************************/ -#define XOSD_IntrDisable(InstancePtr, IntrType) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_IER, \ - ((~(IntrType)) & XOSD_IXR_ALLINTR_MASK) & \ - XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_IER)) - -/*****************************************************************************/ -/** -* -* This macro returns the pending interrupts of an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @return The pending interrupts of the OSD. Use XOSD_IXR_* constants -* defined in xosd_hw.h to interpret this value. -* -* @note -* -* C-style signature: -* u32 XOSD_IntrGetPending(XOSD *InstancePtr) -* -******************************************************************************/ -#define XOSD_IntrGetPending(InstancePtr) \ - (XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_IER) & \ - XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_ISR) & \ - XOSD_IXR_ALLINTR_MASK) - -/*****************************************************************************/ -/** -* -* This macro clears/acknowledges pending interrupts of an OSD device. -* -* @param InstancePtr is a pointer to the OSD device instance to be worked on. -* -* @param IntrType is the pending interrupts to clear/acknowledge. Use OR'ing -* of XOSD_IXR_* constants defined in xosd_hw.h to create this -* parameter value. -* -* @return None -* -* @note -* -* C-style signature: -* void XOSD_IntrClear(XOSD *InstancePtr, u32 IntrType) -* -******************************************************************************/ -#define XOSD_IntrClear(InstancePtr, IntrType) \ - XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_ISR, \ - (IntrType) & XOSD_IXR_ALLINTR_MASK) - -/************************** Function Prototypes ******************************/ - -/* - * Initialization and control functions in xosd.c - */ - -/* Initialization */ -int XOSD_CfgInitialize(XOSD *InstancePtr, XOSD_Config *CfgPtr, - u32 EffectiveAddr); - -/* Set Vertical and Horizontal Blank Input Polarity Types */ -void XOSD_SetBlankPolarity(XOSD *InstancePtr, int VerticalBlankPolarity, - int HorizontalBlankPolarity); - -/* Set/Get Screen Size of the OSD Output */ -void XOSD_SetScreenSize(XOSD *InstancePtr, u32 Width, u32 Height); -void XOSD_GetScreenSize(XOSD *InstancePtr, u32 *WidthPtr, u32 *HeightPtr); - -/* Set/Get Background color */ -void XOSD_SetBackgroundColor(XOSD *InstancePtr, u16 Red, u16 Blue, u16 Green); -void XOSD_GetBackgroundColor(XOSD *InstancePtr, u16 *RedPtr, u16 *BluePtr, - u16 *GreenPtr); - -/* Layer related functions */ -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 GlobalAlphaEnble, u16 GlobalAlphaValue); -void XOSD_GetLayerAlpha(XOSD *InstancePtr, u8 LayerIndex, - u16 *GlobalAlphaEnblePtr, - 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); - -/* Graphics Controller related functions */ -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); - -/* Create and load instruction(s) */ -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); - -/* Version functions */ -void XOSD_GetVersion(XOSD *InstancePtr, u16 *Major, u16 *Minor, u16 *Revision); - -/* - * Initialization functions in xosd_sinit.c - */ -XOSD_Config *XOSD_LookupConfig(u16 DeviceId); - -/* - * Interrupt related functions in xosd_intr.c - */ -void XOSD_IntrHandler(void *InstancePtr); -int XOSD_SetCallBack(XOSD *InstancePtr, u32 IntrType, - void *CallBackFunc, void *CallBackRef); - - -#ifdef __cplusplus -} -#endif - -#endif /* end of protection macro */ +/****************************************************************************** +* +* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xosd.h +* +* This is main header file of the Xilinx On-Screen-Display (OSD) core. +* +* An OSD is an image superimposed on a screen picture, commonly used by modern +* televisions, VCRs, and DVD players to display information such as volume, +* channel, and time. +* +* Xilinx OSD core has the following main features: +* +* - Read Video Data from one of three sources as +* - VFBC/Frame Buffer, +* - VideoBus and +* - Graphics Controller. +* - Alpha Compositing and Alpha Blending of up to 8 layers. +* - Up to 8 priorities, one for each of the layers. +* - Real-Time Graphics Controller. +* - Write Composited Video Data to either +* - VFBC/Frame Buffer, or +* - VideoBus. +* +* For a full description of OSD features, please see the hardware spec. +* +* Interrupt Service +* +* Three interrupt types are supported: +* +* - Processing Start Interrupt +* - Frame Done Interrupt +* - Error Interrupt +* +* Software Initialization +* +* Please follow the example provided with this driver for the steps +* to use this driver. +* +* Cache Coherency +* +* Alignment +* +* Limitations +* +* BUS Interface +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who    Date     Changes
+* ----- ------ -------- -------------------------------------------------------
+* 1.00a xd     08/18/08 First release
+* 1.01a xd     07/30/10 Added device version support; Supported Doxygen; Fixed
+*                       CR #534952
+* 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.
+* 3.0   adk    19/12/13 Updated as per the New Tcl API's.
+* 4.0   adk    02/18/14 Converted defined macros to enum types.
+*                       Removed interrupt types XOSD_HANDLER_VBISTART and
+*                       XOSD_HANDLER_VBIEND.
+*                       Added interrupt type: XOSD_HANDLER_PROCSTART.
+*                       Renamed the following function macros:
+*                       XOSD_Enable -> XOsd_Enable,
+*                       XOSD_Disable -> XOsd_Disable,
+*                       XOSD_RegUpdateEnable -> XOsd_RegUpdateEnable,
+*                       XOSD_RegUpdateDisable -> XOsd_RegUpdateDisable,
+*                       XOSD_Reset -> XOsd_Reset,
+*                       XOSD_IntrEnable -> XOsd_IntrEnable,
+*                       XOSD_IntrDisable -> XOsd_IntrDisable,
+*                       XOSD_IntrGetPending -> XOsd_IntrGetPending,
+*                       XOSD_IntrClear -> XOsd_IntrClear.
+*
+*                       Added the following function macros:
+*                       XOsd_SyncReset, XOsd_StatusGetPending, XOsd_FSyncReset.
+*
+*                       Removed the following function macros:
+*                       XOSD_IntrEnableGlobal, XOSD_IntrDisableGlobal.
+*
+*                       Renamed S_AXIS_VIDEO_DATA_WIDTH ->
+*                                                      SlaveAxisVideoDataWidth.
+*                       Removed struct members from core structure:
+*                       VbiStartCallBack, VbiStartRef, VbiEndCallBack,
+*                       VbiEndRef.
+*
+*                       Added struct members in core structure:
+*                       ProcStartCallBack, ProcStartRef.
+*
+*                       Added the following function prototypes:
+*                       XOsd_SelfTest.
+*
+*                       Removed the following function prototypes:
+*                       XOSD_SetBlankPolarity.
+*
+*                       Changes in xosd_sinit.c:
+*                       Renamed the following functions:
+*                       XOSD_LookupConfig - > XOsd_LookupConfig
+*
+*                       Changes in xosd_selftest.c:
+*                       Implemented the following functions:
+*                       XOsd_SelfTest.
+*
+*                       Changes in xosd_intr.c:
+*                       Renamed the following functions:
+*                       XOSD_IntrHandler - > XOsd_IntrHandler.
+*                       XOSD_SetCallBack -> XOsd_SetCallBack.
+*                       Removed the following handlers:
+*                       XOSD_HANDLER_VBISTART, XOSD_HANDLER_VBIEND.
+*                       Added new handler XOSD_HANDLER_PROCSTART.
+*                       Added Doxygen support, adherence to Xilinx
+*                       coding guidelines.
+*
+*                       Changes in xosd_hw.h:
+*                       Suffixed "_OFFSET" to all register offset macros.
+*                       Added register offsets, bit masks for the registers and
+*                       added backward compatibility for macros.
+*
+*                       Removed following macros:
+*                       XOSD_GIER_GIE_MASK, XOSD_IXR_GAO_MASK
+*                       XOSD_IXR_GIE_MASK, XOSD_IXR_OOE_MASK,
+*                       XOSD_IXR_IUE_MASK, XOSD_IXR_VBIE_MASK,
+*                       XOSD_IXR_VBIS_MASK, XOSD_IXR_FE_MASK, XOSD_IXR_FD_MASK,
+*                       XOSD_IXR_ALLIERR_MASK.
+*
+*                       Changes from xosd.c:
+*                       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.
+* 
+* +******************************************************************************/ + +#ifndef XOSD_H_ +#define XOSD_H_ /**< Prevent circular inclusions by + * using protection macros */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xosd_hw.h" +#include "xil_assert.h" +#include "xstatus.h" + +/************************** Constant Definitions *****************************/ + +/** @name Interrupt types for setting up callbacks + * @{ + */ +enum { + XOSD_HANDLER_PROCSTART = 1, /**< A processing start event interrupt + * type */ + XOSD_HANDLER_FRAMEDONE, /**< A frame done event interrupt + * type */ + XOSD_HANDLER_ERROR /**< An error condition interrupt + * type */ +}; +/*@}*/ + +/** @name Compatibility Macros + * @{ + */ +#define XOSD_Config XOsd_Config +#define XOSD_Layer XOsd_Layer +#define XOSD_CallBack XOsd_CallBack +#define XOSD_ErrorCallBack XOsd_ErrorCallBack +#define XOSD XOsd +#define XOSD_Instruction XOsd_Instruction +#define XOSD_Enable XOsd_Enable +#define XOSD_Disable XOsd_Disable +#define XOSD_RegUpdateEnable XOsd_RegUpdateEnable +#define XOSD_RegUpdateDisable XOsd_RegUpdateDisable +#define XOSD_Reset XOsd_Reset +#define XOSD_IntrEnable XOsd_IntrEnable +#define XOSD_IntrDisable XOsd_IntrDisable +#define XOSD_IntrGetPending XOsd_IntrGetPending +#define XOSD_IntrClear XOsd_IntrClear +#define XOSD_CfgInitialize XOsd_CfgInitialize +#define XOSD_SetScreenSize XOsd_SetActiveSize +#define XOSD_GetScreenSize XOsd_GetActiveSize +#define XOSD_SetBackgroundColor XOsd_SetBackgroundColor +#define XOSD_GetBackgroundColor XOsd_GetBackgroundColor +#define XOSD_SetLayerDimension XOsd_SetLayerDimension +#define XOSD_GetLayerDimension XOsd_GetLayerDimension +#define XOSD_SetLayerAlpha XOsd_SetLayerAlpha +#define XOSD_GetLayerAlpha XOsd_GetLayerAlpha +#define XOSD_SetLayerPriority XOsd_SetLayerPriority +#define XOSD_GetLayerPriority XOsd_GetLayerPriority +#define XOSD_EnableLayer XOsd_EnableLayer +#define XOSD_DisableLayer XOsd_DisableLayer +#define XOSD_LoadColorLUTBank XOsd_LoadColorLUTBank +#define XOSD_LoadCharacterSetBank XOsd_LoadCharacterSetBank +#define XOSD_LoadTextBank XOsd_LoadTextBank +#define XOSD_SetActiveBank XOsd_SetActiveBank +#define XOSD_CreateInstruction XOsd_CreateInstruction +#define XOSD_LoadInstructionList XOsd_LoadInstructionList +#define XOSD_LookupConfig XOsd_LookupConfig +#define XOSD_IntrHandler XOsd_IntrHandler +#define XOSD_SetCallBack XOsd_SetCallBack +/*@}*/ + +/**************************** Type Definitions *******************************/ + +/** +* OSD core configuration structure. +* Each OSD core should have a configuration structure associated. +*/ +typedef struct { + u16 DeviceId; /**< DeviceId is the unique ID + * of the core */ + u32 BaseAddress; /**< BaseAddress is the physical base address + * of the OSD core registers */ + u16 LayerNum; /**< The number of Layers */ + u16 SlaveAxisVideoDataWidth; /**< Slave Axis Video Data Width */ + u16 Layer0Type; /**< Type of Layer #0 */ + u16 Layer1Type; /**< Type of Layer #1 */ + u16 Layer2Type; /**< Type of Layer #2 */ + u16 Layer3Type; /**< Type of Layer #3 */ + u16 Layer4Type; /**< Type of Layer #4 */ + u16 Layer5Type; /**< Type of Layer #5 */ + u16 Layer6Type; /**< Type of Layer #6 */ + u16 Layer7Type; /**< Type of Layer #7 */ + + /**< Layer 0 */ + u16 Layer0InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer0InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer0InstructionLineEnable;/**< Instruction Line Enable */ + u16 Layer0InstructionTextEnable;/**< Instruction Text Enable */ + u16 Layer0ColorLutSize; /**< Color Look Up Table (LUT) Size */ + u16 Layer0ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer0FontNumChars; /**< Font: Number of characters */ + u16 Layer0FontWidth; /**< Font: Width */ + u16 Layer0FontHeight; /**< Font: Height */ + u16 Layer0FontBitsPerPixel; /**< Font: Number of bits per pixel */ + u16 Layer0FontAsciiOffset; /**< Font: ASCII offset of 1st + * character */ + u16 Layer0TextNumStrings; /**< Text: Number of Strings */ + u16 Layer0TextMaxStringLength; /**< Text: Maximum length of a + * String */ + + /**< Layer 1 */ + u16 Layer1InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer1InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer1InstructionLineEnable; /**< Instruction Line Enable */ + u16 Layer1InstructionTextEnable; /**< Instruction Text Enable */ + u16 Layer1ColorLutSize; /**< Color LUT Size */ + u16 Layer1ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer1FontNumChars; /**< Font: Number of + * characters */ + u16 Layer1FontWidth; /**< Font: Width */ + u16 Layer1FontHeight; /**< Font: Height */ + u16 Layer1FontBitsPerPixel; /**< Font: Number of bits + * per pixel */ + u16 Layer1FontAsciiOffset; /**< Font: ASCII offset of 1st + * character */ + u16 Layer1TextNumStrings; /**< Text: Number of Strings */ + u16 Layer1TextMaxStringLength; /**< Text: Maximum length of + * a String */ + + /**< Layer 2 */ + u16 Layer2InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer2InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer2InstructionLineEnable; /**< Instruction Line Enable */ + u16 Layer2InstructionTextEnable; /**< Instruction Text Enable */ + u16 Layer2ColorLutSize; /**< Color LUT Size */ + u16 Layer2ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer2FontNumChars; /**< Font: Number of + * characters */ + u16 Layer2FontWidth; /**< Font: Width */ + u16 Layer2FontHeight; /**< Font: Height */ + u16 Layer2FontBitsPerPixel; /**< Font: Number of bits + * per pixel */ + u16 Layer2FontAsciiOffset; /**< Font: ASCII offset of 1st + * character */ + u16 Layer2TextNumStrings; /**< Text: Number of Strings */ + u16 Layer2TextMaxStringLength; /**< Text: Maximum length of + * a String */ + + /**< Layer 3 */ + u16 Layer3InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer3InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer3InstructionLineEnable; /**< Instruction Line Enable */ + u16 Layer3InstructionTextEnable; /**< Instruction Text Enable */ + u16 Layer3ColorLutSize; /**< Color LUT Size */ + u16 Layer3ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer3FontNumChars; /**< Font: Number of + * characters */ + u16 Layer3FontWidth; /**< Font: Width */ + u16 Layer3FontHeight; /**< Font: Height */ + u16 Layer3FontBitsPerPixel; /**< Font: Number of bits + * per pixel */ + u16 Layer3FontAsciiOffset; /**< Font: ASCII offset of + * 1st character */ + u16 Layer3TextNumStrings; /**< Text: Number of Strings */ + u16 Layer3TextMaxStringLength; /**< Text: Maximum length of + * a String */ + + /**< Layer 4 */ + u16 Layer4InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer4InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer4InstructionLineEnable; /**< Instruction Line Enable */ + u16 Layer4InstructionTextEnable; /**< Instruction Text Enable */ + u16 Layer4ColorLutSize; /**< Color LUT Size */ + u16 Layer4ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer4FontNumChars; /**< Font: Number of + * characters */ + u16 Layer4FontWidth; /**< Font: Width */ + u16 Layer4FontHeight; /**< Font: Height */ + u16 Layer4FontBitsPerPixel; /**< Font: Number of bits + * per pixel */ + u16 Layer4FontAsciiOffset; /**< Font: ASCII offset of 1st + * character */ + u16 Layer4TextNumStrings; /**< Text: Number of Strings */ + u16 Layer4TextMaxStringLength; /**< Text: Maximum length of + * a String */ + + /**< Layer 5 */ + u16 Layer5InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer5InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer5InstructionLineEnable; /**< Instruction Line Enable */ + u16 Layer5InstructionTextEnable; /**< Instruction Text Enable */ + u16 Layer5ColorLutSize; /**< Color LUT Size */ + u16 Layer5ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer5FontNumChars; /**< Font: Number of + * characters */ + u16 Layer5FontWidth; /**< Font: Width */ + u16 Layer5FontHeight; /**< Font: Height */ + u16 Layer5FontBitsPerPixel; /**< Font: Number of bits per + * pixel */ + u16 Layer5FontAsciiOffset; /**< Font: ASCII offset of + * 1st character */ + u16 Layer5TextNumStrings; /**< Text: Number of Strings */ + u16 Layer5TextMaxStringLength; /**< Text: Maximum length of + * a String */ + + /**< Layer 6 */ + u16 Layer6InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer6InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer6InstructionLineEnable; /**< Instruction Line Enable */ + u16 Layer6InstructionTextEnable; /**< Instruction Text Enable */ + u16 Layer6ColorLutSize; /**< Color LUT Size */ + u16 Layer6ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer6FontNumChars; /**< Font: Number of + * characters */ + u16 Layer6FontWidth; /**< Font: Width */ + u16 Layer6FontHeight; /**< Font: Height */ + u16 Layer6FontBitsPerPixel; /**< Font: Number of bits + * per pixel */ + u16 Layer6FontAsciiOffset; /**< Font: ASCII offset of + * 1st character */ + u16 Layer6TextNumStrings; /**< Text: Number of Strings */ + u16 Layer6TextMaxStringLength; /**< Text: Maximum length of + * a String */ + + /**< Layer 7 */ + u16 Layer7InstructionMemSize; /**< Instruction Memory Size */ + u16 Layer7InstructionBoxEnable; /**< Instruction Box Enable */ + u16 Layer7InstructionLineEnable; /**< Instruction Line Enable */ + u16 Layer7InstructionTextEnable; /**< Instruction Text Enable */ + u16 Layer7ColorLutSize; /**< Color LUT Size */ + u16 Layer7ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 Layer7FontNumChars; /**< Font: Number of + * characters */ + u16 Layer7FontWidth; /**< Font: Width */ + u16 Layer7FontHeight; /**< Font: Height */ + u16 Layer7FontBitsPerPixel; /**< Font: Number of bits + * per pixel */ + u16 Layer7FontAsciiOffset; /**< Font: ASCII offset of + * 1st character */ + u16 Layer7TextNumStrings; /**< Text: Number of Strings */ + u16 Layer7TextMaxStringLength; /**< Text: Maximum length + * of a String */ +} XOsd_Config; + +/** +* The OSD core layer info structure +*/ +typedef struct { + + u16 LayerType; /**< Type of the layer */ + u16 InstructionNum; /**< The Number of Instructions */ + u16 InstructionBoxEnable; /**< Instruction Box Enable */ + u16 InstructionLineEnable; /**< Instruction Line Enable */ + u16 InstructionTextEnable; /**< Instruction Text Enable */ + u16 ColorLutSize; /**< Color LUT Size */ + u16 ColorLutMemoryType; /**< Color LUT Memory Type */ + u16 FontNumChars; /**< Font: Number of characters */ + u16 FontWidth; /**< Font: Width */ + u16 FontHeight; /**< Font: Height */ + u16 FontBitsPerPixel; /**< Font: Number of bits per pixel */ + u16 FontAsciiOffset; /**< Font: ASCII offset of + * 1st character */ + u16 TextNumStrings; /**< Text: Number of Strings */ + u16 TextMaxStringLength; /**< Text: Maximum length of + * a String */ +} XOsd_Layer; + +/*****************************************************************************/ +/** +* +* This function callback type for all interrupts except error interrupt. +* +* @param CallBackRef is a callback reference passed in by the upper +* layer when setting the callback functions and passed back +* to the upper layer when the callback is invoked. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +typedef void (*XOsd_CallBack)(void *CallBackRef); + +/*****************************************************************************/ +/** +* +* This function callback type for error interrupt. +* +* @param CallBackRef is a callback reference passed in by the +* upper layer when setting the callback functions, and passed +* back to the upper layer when the callback is invoked. +* @param ErrorMask is a bit mask indicating the cause of the error. Its +* value equals 'OR'ing one or more XOSD_IXR_* values defined in +* xosd_hw.h. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +typedef void (*XOsd_ErrorCallBack)(void *CallBackRef, u32 ErrorMask); + +/** +* The XOsd instance data. An instance must be allocated for each +* OSD core in use. +*/ +typedef struct { + XOsd_Config Config; /**< Hardware configuration */ + u32 IsReady; /**< Core instance is initialized */ + u32 InstructionInExternalMem; /**< Flag indicating if + * the instruction list is from + * external memory */ + u32 ScreenHeight; /**< Screen Height of the OSD output */ + u32 ScreenWidth; /**< Screen Width of the OSD output */ + + XOsd_Layer Layers[(XOSD_MAX_NUM_OF_LAYERS)]; /**< Properties of + * layers */ + + /* + * IRQ Callbacks + */ + XOsd_CallBack ProcStartCallBack; /**< Call back for Processing + * Start interrupt */ + void *ProcStartRef; /**< To be passed to the + * Process Start + * interrupt callback */ + XOsd_CallBack FrameDoneCallBack; /**< Call back for Frame Done + * interrupt */ + void *FrameDoneRef; /**< To be passed to the Frame + * Done interrupt callback */ + XOsd_ErrorCallBack ErrCallBack; /**< Call back for Error interrupt */ + void *ErrRef; /**< To be passed to the Error + * interrupt callback */ +} XOsd; + +/** +* The XOsd_Instruction data structure for holding one GC instruction. +*/ +typedef u32 XOsd_Instruction[XOSD_INS_SIZE]; + +/***************** Macros (Inline Functions) Definitions *********************/ + +/*****************************************************************************/ +/** +* +* This function macro enables an OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_Enable(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_Enable(InstancePtr) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_CTL_OFFSET), \ + ((XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_CTL_OFFSET))) | (XOSD_CTL_EN_MASK))) + +/*****************************************************************************/ +/** +* +* This function macro disables an OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_Disable(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_Disable(InstancePtr) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_CTL_OFFSET), \ + ((XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_CTL_OFFSET))) & (~(XOSD_CTL_EN_MASK)))) + +/*****************************************************************************/ +/** +* +* This function macro commits all the register value changes made so far by +* the software to the OSD core instance. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_RegUpdateEnable(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_RegUpdateEnable(InstancePtr) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_CTL_OFFSET), \ + ((XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_CTL_OFFSET))) | (XOSD_CTL_RUE_MASK))) + +/*****************************************************************************/ +/** +* +* This function macro prevents the OSD core from committing recent changes +* made so far by the software. When disabled, changes to other configuration +* registers are stored, but do not effect the behavior of the core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_RegUpdateDisable(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_RegUpdateDisable(InstancePtr) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_CTL_OFFSET), \ + ((XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_CTL_OFFSET))) & (~(XOSD_CTL_RUE_MASK)))) + +/*****************************************************************************/ +/** +* +* This function macro resets an OSD core This effects the core immediately, and +* may cause image tearing. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_Reset(XOsd *InstancePtr) +* This bit automatically clears when reset complete. +* +******************************************************************************/ +#define XOsd_Reset(InstancePtr) \ +{ \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_CTL_OFFSET), \ + (XOSD_CTL_SW_RST_MASK)); \ + (InstancePtr)->InstructionInExternalMem = (u32)0x0; \ + (InstancePtr)->ScreenHeight = (u32)0x0; \ + (InstancePtr)->ScreenWidth = (u32)0x0; \ +} + +/*****************************************************************************/ +/** +* +* This function macro enables the given individual interrupt(s) on the +* OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param IntrType is the bit-mask of the interrupts to be enabled. +* Bit positions of 1 will be enabled. Bit positions of 0 will +* keep the previous setting.This mask is formed by OR'ing of +* XOSD_IXR_*_MASK bits defined in xosd_hw.h. +* +* @return None. +* +* @note The existing enabled interrupt(s) will remain enabled. +* C-style signature: +* void XOsd_IntrEnable(XOsd *InstancePtr, u32 IntrType) +* +******************************************************************************/ +#define XOsd_IntrEnable(InstancePtr, IntrType) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_IER_OFFSET), \ + (((IntrType) & (XOSD_IXR_ALLINTR_MASK)) | \ + (XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_IER_OFFSET))))) + +/*****************************************************************************/ +/** +* +* This function macro disables the given individual interrupt(s) on the +* OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param IntrType is the bit-mask of the interrupts to be enabled. +* Bit positions of 1 will be disabled. Bit positions of 0 will +* keep the previous setting.This mask is formed by OR'ing of +* XOSD_IXR_*_MASK bits defined in xosd_hw.h. +* +* @return None. +* +* @note Any other interrupt not covered by parameter IntrType, +* if enabled before this macro is called, will remain enabled. +* C-style signature: +* void XOsd_IntrDisable(XOsd *InstancePtr, u32 IntrType) +* +******************************************************************************/ +#define XOsd_IntrDisable(InstancePtr, IntrType) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_IER_OFFSET), \ + (((~(IntrType)) & (XOSD_IXR_ALLINTR_MASK)) & \ + (XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_IER_OFFSET))))) + +/*****************************************************************************/ +/** +* +* This function macro returns the pending interrupts of the OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return The pending interrupts of the OSD core. Use XOSD_IXR_*_MASK +* constants defined in xosd_hw.h to interpret this value. +* +* @note C-style signature: +* u32 XOsd_IntrGetPending(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_IntrGetPending(InstancePtr) \ + XOsd_ReadReg((InstancePtr)->Config.BaseAddress, (XOSD_IER_OFFSET)) & \ + (XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_STATUS_OFFSET))) & (XOSD_IXR_ALLINTR_MASK) + +/*****************************************************************************/ +/** +* +* This function macro clears/acknowledges pending interrupts of the +* OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param IntrType is the pending interrupts to clear/acknowledge. +* Use OR'ing of XOSD_IXR_*_MASK constants defined in xosd_hw.h to +* create this parameter value. +* +* @return None +* +* @note C-style signature: +* void XOsd_IntrClear(XOsd *InstancePtr, u32 IntrType) +* +******************************************************************************/ +#define XOsd_IntrClear(InstancePtr, IntrType) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_STATUS_OFFSET), ((IntrType) & (XOSD_IXR_ALLINTR_MASK))) + +/*****************************************************************************/ +/** +* +* This function macro returns the pending status of the OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return The pending interrupts of the OSD. Use XOSD_IXR_* constants +* defined in xosd_hw.h to interpret this value. +* +* @note C-style signature: +* u32 XOsd_StatusGePending(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_StatusGetPending(InstancePtr) \ + XOsd_ReadReg((InstancePtr)->Config.BaseAddress, \ + (XOSD_STATUS_OFFSET)) & (XOSD_IXR_ALLINTR_MASK) + + +/*****************************************************************************/ +/** +* +* This function macro resets a OSD core at the end of the frame being +* processed. It enables core automatically synchronizes to the SOF of the core +* to prevent image tearing. This function macro is differ from XOsd_Reset(). +* +* On the next rising-edge of SOF following a call to XOsd_SyncReset(), +* all of the core's configuration registers and outputs will be reset, then the +* reset flag will be immediately released, allowing the core to immediately +* resume default operation. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_SyncReset(XOsd *InstancePtr) +* This bit automatically clears when reset complete. +* +******************************************************************************/ +#define XOsd_SyncReset(InstancePtr) \ + XOsd_WriteReg((InstancePtr)->Config.BaseAddress, (XOSD_CTL_OFFSET), \ + (XOSD_CTL_FSYNC_MASK)) + + +/*****************************************************************************/ +/** +* +* This macro resets the OSD core at the end of the frame being +* processed. It enables core automatically synchronizes to the SOF of the core +* to prevent image tearing. This function macro is differ from XOsd_Reset(). +* +* On the next rising-edge of SOF following a call to XOsd_SyncReset(), +* all of the core's configuration registers and outputs will be reset, then the +* reset flag will be immediately released, allowing the core to immediately +* resume default operation. +* +******************************************************************************/ +#define XOsd_FSyncReset XOsd_SyncReset + +/*****************************************************************************/ +/** +* +* This function macro stops an OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_Start(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_Start XOsd_Enable + +/*****************************************************************************/ +/** +* +* This function macro stops an OSD core. +* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* +* @return None. +* +* @note C-style signature: +* void XOsd_Stop(XOsd *InstancePtr) +* +******************************************************************************/ +#define XOsd_Stop XOsd_Disable + + +/************************** Function Prototypes ******************************/ + +/* Initialization and control functions in xosd.c */ + +/* Initialization */ +int XOsd_CfgInitialize(XOsd *InstancePtr, XOsd_Config *CfgPtr, + u32 EffectiveAddr); + +/* Set/Get Active Size of the OSD Output */ +void XOsd_SetActiveSize(XOsd *InstancePtr, u32 Width, u32 Height); +void XOsd_GetActiveSize(XOsd *InstancePtr, u32 *WidthPtr, u32 *HeightPtr); + +/* Set/Get Background color */ +void XOsd_SetBackgroundColor(XOsd *InstancePtr, u16 Red, u16 Blue, u16 Green); +void XOsd_GetBackgroundColor(XOsd *InstancePtr, u16 *RedPtr, u16 *BluePtr, + u16 *GreenPtr); + +/* Layer related functions */ +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); + +/* Graphics Controller related functions */ +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); + +/* Create and load instruction(s) */ +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); + +/* Version functions */ +u32 XOsd_GetVersion(XOsd *InstancePtr); + +/* Initialization functions in xosd_sinit.c */ +XOsd_Config *XOsd_LookupConfig(u16 DeviceId); + +/* Interrupt related functions in xosd_intr.c */ +void XOsd_IntrHandler(void *InstancePtr); +int XOsd_SetCallBack(XOsd *InstancePtr, u32 HandlerType, void *CallBackFunc, + void *CallBackRef); + +/* SelfTest related function in xosd_selftest.c */ +int XOsd_SelfTest(XOsd *InstancePtr); + +/************************** Variable Declarations ****************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* End of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/osd/src/xosd_g.c b/XilinxProcessorIPLib/drivers/osd/src/xosd_g.c index d9d9b282..efa0e019 100755 --- a/XilinxProcessorIPLib/drivers/osd/src/xosd_g.c +++ b/XilinxProcessorIPLib/drivers/osd/src/xosd_g.c @@ -1,191 +1,162 @@ -/****************************************************************************** -* -* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file xosd_g.c -* -* This file contains a template for configuration table of Xilinx MVI Video -* On-Screen-Display (OSD) devices. For a real hardware system, Xilinx Platform -* Studio (XPS) will automatically generate a real configuration table to match -* the configuration of the OSD devices. -* -*
-* MODIFICATION HISTORY:
-*
-* Ver   Who  Date     Changes
-* ----- ---- -------- -------------------------------------------------------
-* 1.00a xd   08/18/08 First release
-* 
-* -******************************************************************************/ - - -/***************************** Include Files *********************************/ - - -#include "xparameters.h" -#include "xosd.h" - -/** - * The configuration table for On-Screen-Display devices - */ -XOSD_Config XOSD_ConfigTable[] = -{ - { - XPAR_OSD_0_DEVICE_ID, - XPAR_OSD_0_BASEADDR, - XPAR_OSD_0_NUM_LAYERS, - XPAR_OSD_0_S_AXIS_VIDEO_DATA_WIDTH, - - XPAR_OSD_0_LAYER0_TYPE, - XPAR_OSD_0_LAYER1_TYPE, - XPAR_OSD_0_LAYER2_TYPE, - XPAR_OSD_0_LAYER3_TYPE, - XPAR_OSD_0_LAYER4_TYPE, - XPAR_OSD_0_LAYER5_TYPE, - XPAR_OSD_0_LAYER6_TYPE, - XPAR_OSD_0_LAYER7_TYPE, - - XPAR_OSD_0_LAYER0_IMEM_SIZE, - XPAR_OSD_0_LAYER0_INS_BOX_EN, - XPAR_OSD_0_LAYER0_INS_LINE_EN, - XPAR_OSD_0_LAYER0_INS_TEXT_EN, - XPAR_OSD_0_LAYER0_CLUT_SIZE, - XPAR_OSD_0_LAYER0_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER0_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER0_FONT_WIDTH, - XPAR_OSD_0_LAYER0_FONT_HEIGHT, - XPAR_OSD_0_LAYER0_FONT_BPP, - XPAR_OSD_0_LAYER0_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER0_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER0_TEXT_MAX_STRING_LENGTH, - - XPAR_OSD_0_LAYER1_IMEM_SIZE, - XPAR_OSD_0_LAYER1_INS_BOX_EN, - XPAR_OSD_0_LAYER1_INS_LINE_EN, - XPAR_OSD_0_LAYER1_INS_TEXT_EN, - XPAR_OSD_0_LAYER1_CLUT_SIZE, - XPAR_OSD_0_LAYER1_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER1_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER1_FONT_WIDTH, - XPAR_OSD_0_LAYER1_FONT_HEIGHT, - XPAR_OSD_0_LAYER1_FONT_BPP, - XPAR_OSD_0_LAYER1_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER1_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER1_TEXT_MAX_STRING_LENGTH, - - XPAR_OSD_0_LAYER2_IMEM_SIZE, - XPAR_OSD_0_LAYER2_INS_BOX_EN, - XPAR_OSD_0_LAYER2_INS_LINE_EN, - XPAR_OSD_0_LAYER2_INS_TEXT_EN, - XPAR_OSD_0_LAYER2_CLUT_SIZE, - XPAR_OSD_0_LAYER2_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER2_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER2_FONT_WIDTH, - XPAR_OSD_0_LAYER2_FONT_HEIGHT, - XPAR_OSD_0_LAYER2_FONT_BPP, - XPAR_OSD_0_LAYER2_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER2_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER2_TEXT_MAX_STRING_LENGTH, - - XPAR_OSD_0_LAYER3_IMEM_SIZE, - XPAR_OSD_0_LAYER3_INS_BOX_EN, - XPAR_OSD_0_LAYER3_INS_LINE_EN, - XPAR_OSD_0_LAYER3_INS_TEXT_EN, - XPAR_OSD_0_LAYER3_CLUT_SIZE, - XPAR_OSD_0_LAYER3_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER3_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER3_FONT_WIDTH, - XPAR_OSD_0_LAYER3_FONT_HEIGHT, - XPAR_OSD_0_LAYER3_FONT_BPP, - XPAR_OSD_0_LAYER3_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER3_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER3_TEXT_MAX_STRING_LENGTH, - - XPAR_OSD_0_LAYER4_IMEM_SIZE, - XPAR_OSD_0_LAYER4_INS_BOX_EN, - XPAR_OSD_0_LAYER4_INS_LINE_EN, - XPAR_OSD_0_LAYER4_INS_TEXT_EN, - XPAR_OSD_0_LAYER4_CLUT_SIZE, - XPAR_OSD_0_LAYER4_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER4_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER4_FONT_WIDTH, - XPAR_OSD_0_LAYER4_FONT_HEIGHT, - XPAR_OSD_0_LAYER4_FONT_BPP, - XPAR_OSD_0_LAYER4_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER4_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER4_TEXT_MAX_STRING_LENGTH, - - XPAR_OSD_0_LAYER5_IMEM_SIZE, - XPAR_OSD_0_LAYER5_INS_BOX_EN, - XPAR_OSD_0_LAYER5_INS_LINE_EN, - XPAR_OSD_0_LAYER5_INS_TEXT_EN, - XPAR_OSD_0_LAYER5_CLUT_SIZE, - XPAR_OSD_0_LAYER5_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER5_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER5_FONT_WIDTH, - XPAR_OSD_0_LAYER5_FONT_HEIGHT, - XPAR_OSD_0_LAYER5_FONT_BPP, - XPAR_OSD_0_LAYER5_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER5_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER5_TEXT_MAX_STRING_LENGTH, - - XPAR_OSD_0_LAYER6_IMEM_SIZE, - XPAR_OSD_0_LAYER6_INS_BOX_EN, - XPAR_OSD_0_LAYER6_INS_LINE_EN, - XPAR_OSD_0_LAYER6_INS_TEXT_EN, - XPAR_OSD_0_LAYER6_CLUT_SIZE, - XPAR_OSD_0_LAYER6_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER6_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER6_FONT_WIDTH, - XPAR_OSD_0_LAYER6_FONT_HEIGHT, - XPAR_OSD_0_LAYER6_FONT_BPP, - XPAR_OSD_0_LAYER6_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER6_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER6_TEXT_MAX_STRING_LENGTH, - - XPAR_OSD_0_LAYER7_IMEM_SIZE, - XPAR_OSD_0_LAYER7_INS_BOX_EN, - XPAR_OSD_0_LAYER7_INS_LINE_EN, - XPAR_OSD_0_LAYER7_INS_TEXT_EN, - XPAR_OSD_0_LAYER7_CLUT_SIZE, - XPAR_OSD_0_LAYER7_CLUT_MEMTYPE, - XPAR_OSD_0_LAYER7_FONT_NUM_CHARS, - XPAR_OSD_0_LAYER7_FONT_WIDTH, - XPAR_OSD_0_LAYER7_FONT_HEIGHT, - XPAR_OSD_0_LAYER7_FONT_BPP, - XPAR_OSD_0_LAYER7_FONT_ASCII_OFFSET, - XPAR_OSD_0_LAYER7_TEXT_NUM_STRINGS, - XPAR_OSD_0_LAYER7_TEXT_MAX_STRING_LENGTH - } -}; +/****************************************************************************** +* +* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ + +#include "xparameters.h" +#include "xosd.h" + +/* +* The configuration table for devices +*/ + +XOsd_Config XOsd_ConfigTable[] = +{ + { + XPAR_HDMI_OUTPUT_V_OSD_1_DEVICE_ID, + XPAR_HDMI_OUTPUT_V_OSD_1_BASEADDR, + XPAR_HDMI_OUTPUT_V_OSD_1_NUM_LAYERS, + XPAR_HDMI_OUTPUT_V_OSD_1_S_AXIS_VIDEO_DATA_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_TYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER0_TEXT_MAX_STRING_LENGTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER1_TEXT_MAX_STRING_LENGTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER2_TEXT_MAX_STRING_LENGTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER3_TEXT_MAX_STRING_LENGTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER4_TEXT_MAX_STRING_LENGTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER5_TEXT_MAX_STRING_LENGTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER6_TEXT_MAX_STRING_LENGTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_IMEM_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_INS_BOX_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_INS_LINE_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_INS_TEXT_EN, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_CLUT_SIZE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_CLUT_MEMTYPE, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_FONT_NUM_CHARS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_FONT_WIDTH, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_FONT_HEIGHT, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_FONT_BPP, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_FONT_ASCII_OFFSET, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_TEXT_NUM_STRINGS, + XPAR_HDMI_OUTPUT_V_OSD_1_LAYER7_TEXT_MAX_STRING_LENGTH + } +}; + + diff --git a/XilinxProcessorIPLib/drivers/osd/src/xosd_hw.h b/XilinxProcessorIPLib/drivers/osd/src/xosd_hw.h index 9269cf0d..00e69619 100755 --- a/XilinxProcessorIPLib/drivers/osd/src/xosd_hw.h +++ b/XilinxProcessorIPLib/drivers/osd/src/xosd_hw.h @@ -1,467 +1,718 @@ -/****************************************************************************** -* -* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* +/****************************************************************************** +* +* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* ******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file xosd_hw.h -* -* This header file contains identifiers and register-level driver functions (or -* macros) that can be used to access the Xilinx MVI Video On-Screen-Display -* (OSD) device. -* -* For more information about the operation of this device, see the hardware -* specification and documentation in the higher level driver xosd.h source -* code file. -* -*
-* MODIFICATION HISTORY:
-*
-* Ver	Who	 Date	  Changes
-* ----- ---- -------- -------------------------------------------------------
-* 1.00a xd   08/01/08 First release
-* 2.00a cm   06/12/12 14.1/14.2 release with address map updated to match
-*                     Video over AXI4-Stream Specification
-* 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. 
-* 
-* -******************************************************************************/ - -#ifndef XOSD_HW_H /* prevent circular inclusions */ -#define XOSD_HW_H /* by using protection macros */ - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************** Include Files *********************************/ - -#include "xil_io.h" - -/************************** Constant Definitions *****************************/ - -/** @name Register Offsets - * @{ - */ -#define XOSD_CTL 0x000 /**< Control */ -#define XOSD_SS 0x020 /**< Screen Size */ -#define XOSD_BC0 0x100 /**< Background Color Channel 0 */ -#define XOSD_BC1 0x104 /**< Background Color Channel 1 */ -#define XOSD_BC2 0x108 /**< Background Color Channel 2 */ - -#define XOSD_L0C 0x110 /**< Layer 0 Control */ -#define XOSD_L0P 0x114 /**< Layer 0 Position */ -#define XOSD_L0S 0x118 /**< Layer 0 Size */ - -#define XOSD_L1C 0x120 /**< Layer 1 Control */ -#define XOSD_L1P 0x124 /**< Layer 1 Position */ -#define XOSD_L1S 0x128 /**< Layer 1 Size */ - -#define XOSD_L2C 0x130 /**< Layer 2 Control */ -#define XOSD_L2P 0x134 /**< Layer 2 Position */ -#define XOSD_L2S 0x138 /**< Layer 2 Size */ - -#define XOSD_L3C 0x140 /**< Layer 3 Control */ -#define XOSD_L3P 0x144 /**< Layer 3 Position */ -#define XOSD_L3S 0x148 /**< Layer 3 Size */ - -#define XOSD_L4C 0x150 /**< Layer 4 Control */ -#define XOSD_L4P 0x154 /**< Layer 4 Position */ -#define XOSD_L4S 0x158 /**< Layer 4 Size */ - -#define XOSD_L5C 0x160 /**< Layer 5 Control */ -#define XOSD_L5P 0x164 /**< Layer 5 Position */ -#define XOSD_L5S 0x168 /**< Layer 5 Size */ - -#define XOSD_L6C 0x170 /**< Layer 6 Control */ -#define XOSD_L6P 0x174 /**< Layer 6 Position */ -#define XOSD_L6S 0x178 /**< Layer 6 Size */ - -#define XOSD_L7C 0x180 /**< Layer 7 Control */ -#define XOSD_L7P 0x184 /**< Layer 7 Position */ -#define XOSD_L7S 0x188 /**< Layer 7 Size */ - -#define XOSD_GCWBA 0x190 /**< GPU Write Bank Address */ -#define XOSD_GCABA 0x194 /**< GPU Active Bank Address */ -#define XOSD_GCD 0x198 /**< GPU Data */ - -#define XOSD_VER 0x010 /**< Version Register */ -#define XOSD_RST 0x000 /**< Software Reset */ - -#define XOSD_GIER 0x010 /**< Global Interrupt Enable Register */ -#define XOSD_ISR 0x004 /**< Interrupt Status Register */ -#define XOSD_IER 0x00c /**< Interrupt Enable Register */ -/*@}*/ - -/** @name Memory footprint of layers - * @{ - */ -#define XOSD_LAYER_SIZE 0x10 -#define XOSD_LXC 0x00 /**< Layer Control */ -#define XOSD_LXP 0x04 /**< Layer Position */ -#define XOSD_LXS 0x08 /**< Layer Size */ -/*@}*/ - -/** @name Graphics Controller Bank related constants - * @{ - */ -#define XOSD_GC_BANK_NUM 2 /**< The number of Banks in each - * Graphics controller */ -/*@}*/ - -/** @name OSD Control Register bit definition - * @{ - */ -#define XOSD_CTL_VBP_MASK 0x00000020 /**< Vertical Blank Polarity */ -#define XOSD_CTL_HBP_MASK 0x00000010 /**< Horizontal Blank Polarity */ -#define XOSD_CTL_RUE_MASK 0x00000002 /**< OSD Register Update Enable */ -#define XOSD_CTL_EN_MASK 0x00000001 /**< OSD Enable */ -/*@}*/ - -/** @name OSD Screen Size Register bit definition - * @{ - */ -#define XOSD_SS_YSIZE_MASK 0x0FFF0000 /**< Vertical Height of OSD Output */ -#define XOSD_SS_YSIZE_SHIFT 16 /**< Bit shift of XOSD_SS_YSIZE_MASK */ -#define XOSD_SS_XSIZE_MASK 0x00000FFF /**< Horizontal Width of OSD Output */ -/*@}*/ - -/** @name OSD Background Color Channel 0 - * @{ - */ -#define XOSD_BC0_YG_MASK 0x00000FFF /**< Y (luma) or Green */ -/*@}*/ - -/** @name OSD Background Color Channel 1 - * @{ - */ -#define XOSD_BC1_UCBB_MASK 0x00000FFF /**< U (Cb) or Blue */ -/*@}*/ - -/** @name OSD Background Color Channel 2 - * @{ - */ -#define XOSD_BC2_VCRR_MASK 0x00000FFF /**< V(Cr) or Red */ -/*@}*/ - -/** @name Maximum number of the layers - * @{ - */ -#define XOSD_MAX_NUM_OF_LAYERS 8 /**< The max number of layers */ -/*@}*/ - -/** @name OSD Layer Control (Layer 0 through (XOSD_MAX_NUM_OF_LAYERS - 1)) - * @{ - */ -#define XOSD_LXC_ALPHA_MASK 0x0FFF0000 /**< Global Alpha Value */ -#define XOSD_LXC_ALPHA_SHIFT 16 /**< Bit shift number of Global - * Alpha Value */ -#define XOSD_LXC_PRIORITY_MASK 0x00000700 /**< Layer Priority */ -#define XOSD_LXC_PRIORITY_SHIFT 8 /**< Bit shift number of Layer - * Priority */ -#define XOSD_LXC_GALPHAEN_MASK 0x00000002 /**< Global Alpha Enable */ -#define XOSD_LXC_EN_MASK 0x00000001 /**< Layer Enable */ -/*@}*/ - -/** @name OSD Layer Position (Layer 0 through (XOSD_MAX_NUM_OF_LAYERS - 1)) - * @{ - */ -#define XOSD_LXP_YSTART_MASK 0x0FFF0000 /**< Vertical start line of origin - * of layer */ -#define XOSD_LXP_YSTART_SHIFT 16 /**< Bit shift of vertical start - * line of origin of layer */ -#define XOSD_LXP_XSTART_MASK 0x00000FFF /**< Horizontal start pixel of - * origin of layer */ -/*@}*/ - -/** @name OSD Layer Size (Layer 0 through (XOSD_MAX_NUM_OF_LAYERS - 1)) - * @{ - */ -#define XOSD_LXS_YSIZE_MASK 0x0FFF0000 /**< Vertical size of layer */ -#define XOSD_LXS_YSIZE_SHIFT 16 /**< Bit shift number of vertical - * size of layer */ -#define XOSD_LXS_XSIZE_MASK 0x00000FFF /**< Horizontal size of layer */ -/*@}*/ - -/** @name OSD Graphics Controller Write Bank Address - * @{ - */ -#define XOSD_GCWBA_GCNUM_MASK 0x00000700 /**< Graphics Controller Number */ -#define XOSD_GCWBA_GCNUM_SHIFT 8 /**< Bit shift of Graphics - * Controller Number */ -#define XOSD_GCWBA_BANK_MASK 0x00000007 /**< Controls which bank to write - * GPU instructions and Color - * LUT data into. */ - -#define XOSD_GCWBA_INS0 0x00000000 /** Instruction RAM 0 */ -#define XOSD_GCWBA_INS1 0x00000001 /** Instruction RAM 1 */ -#define XOSD_GCWBA_COL0 0x00000002 /** Color LUT RAM 0 */ -#define XOSD_GCWBA_COL1 0x00000003 /** Color LUT RAM 1 */ -#define XOSD_GCWBA_TXT0 0x00000004 /** Text RAM 0 */ -#define XOSD_GCWBA_TXT1 0x00000005 /** Text RAM 1 */ -#define XOSD_GCWBA_CHR0 0x00000006 /** Character Set RAM 0 */ -#define XOSD_GCWBA_CHR1 0x00000007 /** Character Set RAM 1 */ -/*@}*/ - -/** @name OSD Graphics Controller Active Bank Address - * @{ - */ -#define XOSD_GCABA_CHR_MASK 0xFF000000 /**< Set the active Character Bank*/ -#define XOSD_GCABA_CHR_SHIFT 24 /**< Bit shift of active Character - * Bank */ -#define XOSD_GCABA_TXT_MASK 0x00FF0000 /**< Set the active Text Bank */ -#define XOSD_GCABA_TXT_SHIFT 16 /**< Bit shift of active Text Bank*/ -#define XOSD_GCABA_COL_MASK 0x0000FF00 /**< Set the active Color Table - * Bank */ -#define XOSD_GCABA_COL_SHIFT 8 /**< Bit shift of active Color Table - * Bank */ -#define XOSD_GCABA_INS_MASK 0x000000FF /**< Set the active instruction Bank - */ -/*@}*/ - -/** @name Version Register bit definition - * @{ - */ -#define XOSD_VER_MAJOR_MASK 0xFF000000 /**< Major Version*/ -#define XOSD_VER_MAJOR_SHIFT 24 /**< Major Version Bit Shift*/ -#define XOSD_VER_MINOR_MASK 0x00FF0000 /**< Minor Version */ -#define XOSD_VER_MINOR_SHIFT 16 /**< Minor Version Bit Shift*/ -#define XOSD_VER_REV_MASK 0x0000F000 /**< Revision Version */ -#define XOSD_VER_REV_SHIFT 12 /**< Revision Bit Shift*/ -/*@}*/ - -/** @name OSD Software Reset - * @{ - */ -#define XOSD_RST_RESET 0x80000000 /**< Software Reset */ -/*@}*/ - -/** @name Global Interrupt Enable Register bit definition - * @{ - */ -#define XOSD_GIER_GIE_MASK 0x80000000 /**< Global interrupt enable */ -/*@}*/ - -/** @name Interrupt Status/Enable Register bit definition - * @{ - */ -#define XOSD_IXR_GAO_MASK 0xFF000000 /**< Graphics Controller Instruction - * Overflow */ -#define XOSD_IXR_GIE_MASK 0x00FF0000 /**< Graphics Controller Instruction - * Error */ -#define XOSD_IXR_OOE_MASK 0x00000010 /**< OSD Output Overflow Error */ -#define XOSD_IXR_IUE_MASK 0x00ff0000 /**< OSD Input Underflow Error */ -#define XOSD_IXR_VBIE_MASK 0x00000004 /**< Vertical Blank Interval End */ -#define XOSD_IXR_VBIS_MASK 0x00000002 /**< Vertical Blank Interval Start*/ -#define XOSD_IXR_FE_MASK 0x00000008 /**< OSD did not complete - * processing frame before next - * Vblank */ -#define XOSD_IXR_FD_MASK 0x00000001 /**< OSD completed processing - * Frame */ -#define XOSD_IXR_ALLIERR_MASK (XOSD_IXR_GAO_MASK | \ - XOSD_IXR_GIE_MASK | \ - XOSD_IXR_OOE_MASK | \ - XOSD_IXR_IUE_MASK | \ - XOSD_IXR_FE_MASK) /**< Mask for all error - * interrupts */ - -#define XOSD_IXR_ALLINTR_MASK (XOSD_IXR_VBIE_MASK | \ - XOSD_IXR_VBIS_MASK | \ - XOSD_IXR_FD_MASK | \ - XOSD_IXR_ALLIERR_MASK) /**< Mask for all - * interrupts */ -/*@}*/ - -/** @name Layer Types - * @{ - */ -#define XOSD_LAYER_TYPE_DISABLE 0 /**< Layer is disabled */ -#define XOSD_LAYER_TYPE_GPU 1 /**< Layer's type is GPU */ -#define XOSD_LAYER_TYPE_VFBC 2 /**< Layer's type is VFBC */ -/*@}*/ - -/** @name Supported Instruction numbers given an instruction memory size - * @{ - */ -#define XOSD_INS_MEM_SIZE_TO_NUM 1 /**< Conversion to the number of - * instructions from the - * instruction memory size */ -/*@}*/ - -/** @name GC Instruction word offset definition - * @{ - */ -#define XOSD_INS0 0 /**< Instruction word 0 offset */ -#define XOSD_INS1 1 /**< Instruction word 1 offset */ -#define XOSD_INS2 2 /**< Instruction word 2 offset */ -#define XOSD_INS3 3 /**< Instruction word 3 offset */ -#define XOSD_INS_SIZE 4 /**< Size of an instruction in words */ -/*@}*/ - -/** @name GC Instruction word 0 definition - * @{ - */ -#define XOSD_INS0_OPCODE_MASK 0xF0000000 /**< Operation Code (OpCode) */ -#define XOSD_INS0_OPCODE_SHIFT 28 /**< Bit shift number of OpCode */ -#define XOSD_INS0_GCNUM_MASK 0x07000000 /**< Graphics controller number - * (GC#) */ -#define XOSD_INS0_GCNUM_SHIFT 24 /**< Bit shift number of GC# */ -#define XOSD_INS0_XEND_MASK 0x00FFF000 /**< Horizontal end pixel of the - * object */ -#define XOSD_INS0_XEND_SHIFT 12 /**< Bit shift number of Horizontal - * end pixel of the object */ -#define XOSD_INS0_XSTART_MASK 0x00000FFF /**< Horizontal start pixel of the - * Object */ -/*@}*/ - -/** @name GC Instruction word 1 definition - * @{ - */ -#define XOSD_INS1_TXTINDEX_MASK 0x0000000F /**< String Index */ -/*@}*/ - -/** @name GC Instruction word 2 definition - * @{ - */ -#define XOSD_INS2_OBJSIZE_MASK 0xFF000000 /**< Object Size */ -#define XOSD_INS2_OBJSIZE_SHIFT 24 /**< Bit shift number of Object - * Size */ -#define XOSD_INS2_YEND_MASK 0x00FFF000 /**< Vertical end line of the - * object */ -#define XOSD_INS2_YEND_SHIFT 12 /**< Bit shift number of Vertical - * end line of the object */ -#define XOSD_INS2_YSTART_MASK 0x00000FFF /**< Vertical start line of the - * Object */ -/*@}*/ - -/** @name GC Instruction word 3 definition - * @{ - */ -#define XOSD_INS3_COL_MASK 0x0000000F /**< Color Index for Box/Text */ -/*@}*/ - -/** @name GC Instruction Operation Code definition (used in Instruction word 0) - * @{ - */ -#define XOSD_INS_OPCODE_END 0x0 /**< End of instruction list */ -#define XOSD_INS_OPCODE_NOP 0x8 /**< NOP */ -#define XOSD_INS_OPCODE_BOX 0xA /**< Box */ -#define XOSD_INS_OPCODE_LINE 0xC /**< Line */ -#define XOSD_INS_OPCODE_TXT 0xE /**< Text */ -#define XOSD_INS_OPCODE_BOXTXT 0xF /**< Box Text */ -/*@}*/ - -/** @name GC color size - * @{ - */ -#define XOSD_COLOR_ENTRY_SIZE 4 /**< Size of each color entry in - * bytes */ -/*@}*/ - -/** @name GC font unit size - * @{ - */ -#define XOSD_FONT_BIT_TO_BYTE 8 /**< Ratio to convert font size - * to byte */ -/*@}*/ - -/** @name Layer priority - * @{ - */ -#define XOSD_LAYER_PRIORITY_0 0 /**< Priority 0 --- Lowest */ -#define XOSD_LAYER_PRIORITY_1 1 /**< Priority 1 */ -#define XOSD_LAYER_PRIORITY_2 2 /**< Priority 2 */ -#define XOSD_LAYER_PRIORITY_3 3 /**< Priority 3 */ -#define XOSD_LAYER_PRIORITY_4 4 /**< Priority 4 */ -#define XOSD_LAYER_PRIORITY_5 5 /**< Priority 5 */ -#define XOSD_LAYER_PRIORITY_6 6 /**< Priority 6 */ -#define XOSD_LAYER_PRIORITY_7 7 /**< Priority 7 --- Highest */ -/*@}*/ - -/**************************** Type Definitions *******************************/ - - -/***************** Macros (Inline Functions) Definitions *********************/ - -/** @name Device register I/O APIs - * @{ - */ - -#define XOSD_In32 Xil_In32 -#define XOSD_Out32 Xil_Out32 - -/*****************************************************************************/ -/** -* -* Read the given register. -* -* @param BaseAddress is the base address of the device -* @param RegOffset is the register offset to be read -* -* @return The 32-bit value of the register -* -* @note -* C-style signature: -* u32 XOSD_ReadReg(u32 BaseAddress, u32 RegOffset) -* -******************************************************************************/ -#define XOSD_ReadReg(BaseAddress, RegOffset) \ - XOSD_In32((BaseAddress) + (RegOffset)) - -/*****************************************************************************/ -/** -* -* Write the given register. -* -* @param BaseAddress is the base address of the device -* @param RegOffset is the register offset to be written -* @param Data is the 32-bit value to write to the register -* -* @return None. -* -* @note -* C-style signature: -* void XOSD_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data) -* -******************************************************************************/ -#define XOSD_WriteReg(BaseAddress, RegOffset, Data) \ - XOSD_Out32((BaseAddress) + (RegOffset), (Data)) -/*@}*/ - -/************************** Function Prototypes ******************************/ - -#ifdef __cplusplus -} -#endif - -#endif /* end of protection macro */ +/*****************************************************************************/ +/** +* +* @file xosd_hw.h +* +* This header file contains identifiers and register-level driver functions (or +* macros) that can be used to access the Xilinx Video On-Screen-Display +* (OSD) core. +* +* For more information about the operation of this core, see the hardware +* specification and documentation in the higher level driver xosd.h source +* code file. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who    Date     Changes
+* ----- ------ -------- -------------------------------------------------------
+* 1.00a xd     08/01/08 First release.
+* 2.00a cm     06/12/12 14.1/14.2 release with address map updated to match
+*                       video over AXI4-Stream Specification.
+* 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 Suffixed "_OFFSET" to all register offset macros.
+*                       Added register offsets, bit masks for the registers and
+*                       added backward compatibility for macros.
+*
+*                       Removed following macros:
+*                       XOSD_GIER_GIE_MASK, XOSD_IXR_GAO_MASK
+*                       XOSD_IXR_GIE_MASK, XOSD_IXR_OOE_MASK,
+*                       XOSD_IXR_IUE_MASK, XOSD_IXR_VBIE_MASK,
+*                       XOSD_IXR_VBIS_MASK, XOSD_IXR_FE_MASK, XOSD_IXR_FD_MASK,
+*                       XOSD_IXR_ALLIERR_MASK.
+* 
+* +******************************************************************************/ + +#ifndef XOSD_HW_H_ +#define XOSD_HW_H_ /**< Prevent circular inclusions by using + * protection macros. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************** Include Files *********************************/ + +#include "xil_io.h" + +/************************** Constant Definitions *****************************/ + +/** @name Register Offsets + * @{ + */ +#define XOSD_CTL_OFFSET 0x000 /**< Control Offset */ +#define XOSD_ACTIVE_SIZE_OFFSET 0x020 /**< Screen Size / Output Active_Size + * Offset */ +#define XOSD_BC0_OFFSET 0x100 /**< Background Color Channel 0 + * Offset */ +#define XOSD_BC1_OFFSET 0x104 /**< Background Color Channel 1 + * Offset */ +#define XOSD_BC2_OFFSET 0x108 /**< Background Color Channel 2 + * Offset */ + +#define XOSD_L0C_OFFSET 0x110 /**< Layer 0 Control Offset */ +#define XOSD_L0P_OFFSET 0x114 /**< Layer 0 Position Offset */ +#define XOSD_L0S_OFFSET 0x118 /**< Layer 0 Size Offset */ + +#define XOSD_L1C_OFFSET 0x120 /**< Layer 1 Control Offset */ +#define XOSD_L1P_OFFSET 0x124 /**< Layer 1 Position Offset */ +#define XOSD_L1S_OFFSET 0x128 /**< Layer 1 Size Offset */ + +#define XOSD_L2C_OFFSET 0x130 /**< Layer 2 Control Offset */ +#define XOSD_L2P_OFFSET 0x134 /**< Layer 2 Position Offset */ +#define XOSD_L2S_OFFSET 0x138 /**< Layer 2 Size Offset */ + +#define XOSD_L3C_OFFSET 0x140 /**< Layer 3 Control Offset */ +#define XOSD_L3P_OFFSET 0x144 /**< Layer 3 Position Offset */ +#define XOSD_L3S_OFFSET 0x148 /**< Layer 3 Size Offset */ + +#define XOSD_L4C_OFFSET 0x150 /**< Layer 4 Control Offset */ +#define XOSD_L4P_OFFSET 0x154 /**< Layer 4 Position Offset */ +#define XOSD_L4S_OFFSET 0x158 /**< Layer 4 Size Offset */ + +#define XOSD_L5C_OFFSET 0x160 /**< Layer 5 Control Offset */ +#define XOSD_L5P_OFFSET 0x164 /**< Layer 5 Position Offset */ +#define XOSD_L5S_OFFSET 0x168 /**< Layer 5 Size Offset */ + +#define XOSD_L6C_OFFSET 0x170 /**< Layer 6 Control Offset */ +#define XOSD_L6P_OFFSET 0x174 /**< Layer 6 Position Offset */ +#define XOSD_L6S_OFFSET 0x178 /**< Layer 6 Size Offset */ + +#define XOSD_L7C_OFFSET 0x180 /**< Layer 7 Control Offset */ +#define XOSD_L7P_OFFSET 0x184 /**< Layer 7 Position Offset */ +#define XOSD_L7S_OFFSET 0x188 /**< Layer 7 Size Offset */ + +#define XOSD_GCWBA_OFFSET 0x190 /**< GPU Write Bank Address Offset */ +#define XOSD_GCABA_OFFSET 0x194 /**< GPU Active Bank Address Offset */ +#define XOSD_GCD_OFFSET 0x198 /**< GPU Data Offset */ + +#define XOSD_VER_OFFSET 0x010 /**< Version Offset */ +#define XOSD_RST_OFFSET XOSD_CTL_OFFSET /**< Software Reset Offset */ + +/** + * Interrupt status register generates a interrupt if the corresponding bits + * of interrupt enable register bits are set. + */ +#define XOSD_ISR_OFFSET XOSD_STATUS /**< Interrupt Status + * Register Offset */ +#define XOSD_IER_OFFSET 0x00C /**< Interrupt Enable + * Register Offset */ + +#define XOSD_STATUS_OFFSET 0x004 /**< Status Offset */ +#define XOSD_ERROR_OFFSET 0x008 /**< Error Offset */ + +#define XOSD_OPENC_OFFSET 0x028 /**< Output Encoding Offset */ +/*@}*/ + +/** @name Memory footprint of layers + * @{ + */ +#define XOSD_LAYER_SIZE 0x10 /**< Total number of Layers */ +#define XOSD_LXC 0x00 /**< Layer Control */ +#define XOSD_LXP 0x04 /**< Layer Position */ +#define XOSD_LXS 0x08 /**< Layer Size */ +/*@}*/ + +/** @name Graphics Controller Bank related constants + * @{ + */ +#define XOSD_GC_BANK_NUM 2 /**< The number of Banks in each + * Graphics controller */ +/*@}*/ + +/** @name Active Size Register bit definition and Shift + * @{ + */ +#define XOSD_ACTSIZE_NUM_PIXEL_MASK 0x00000FFF /**< Horizontal Width of + * OSD Output Mask */ +#define XOSD_ACTSIZE_NUM_LINE_MASK 0x0FFF0000 /**< Vertical Height of + * OSD Output Mask */ +#define XOSD_ACTSIZE_NUM_LINE_SHIFT 16 /**< Vertical Height of + * OSD Output Shift */ +/*@}*/ + +/** @name Background Color Channel 0 Mask + * @{ + */ +#define XOSD_BC0_YG_MASK 0x00000FFF /**< Y (luma) or Green Mask */ +/*@}*/ + +/** @name Background Color Channel 1 Mask + * @{ + */ +#define XOSD_BC1_UCBB_MASK 0x00000FFF /**< U (Cb) or Blue Mask */ +/*@}*/ + +/** @name Background Color Channel 2 Mask + * @{ + */ +#define XOSD_BC2_VCRR_MASK 0x00000FFF /**< V(Cr) or Red Mask */ +/*@}*/ + +/** @name Maximum number of the layers + * @{ + */ +#define XOSD_MAX_NUM_OF_LAYERS 8 /**< The max number of + * layers */ +/*@}*/ + +/** @name Layer Control (Layer 0 through (XOSD_MAX_NUM_OF_LAYERS - 1)) bit + * definition and Shifts + * @{ + */ +#define XOSD_LXC_ALPHA_MASK 0x1FFF0000 /**< Global Alpha Value Mask */ +#define XOSD_LXC_ALPHA_SHIFT 16 /**< Bit shift number of + * Global Alpha Value */ +#define XOSD_LXC_PRIORITY_MASK 0x00000700 /**< Layer Priority Mask */ +#define XOSD_LXC_PRIORITY_SHIFT 8 /**< Bit shift number of + * Layer Priority */ +#define XOSD_LXC_GALPHAEN_MASK 0x00000002 /**< Global Alpha Enable + * Mask */ +#define XOSD_LXC_EN_MASK 0x00000001 /**< Layer Enable Mask */ +/*@}*/ + +/** @name Layer Position (Layer 0 through (XOSD_MAX_NUM_OF_LAYERS - 1)) bit + * definition and Shifts + * @{ + */ +#define XOSD_LXP_YSTART_MASK 0x0FFF0000 /**< Vertical start line of + * origin of layer Mask */ +#define XOSD_LXP_YSTART_SHIFT 16 /**< Bit shift of vertical start + * line of origin of layer */ +#define XOSD_LXP_XSTART_MASK 0x00000FFF /**< Horizontal start pixel of + * origin of layer Mask */ +/*@}*/ + +/** @name Layer Size (Layer 0 through (XOSD_MAX_NUM_OF_LAYERS - 1)) bit + * definition and Shift + * @{ + */ +#define XOSD_LXS_YSIZE_MASK 0x0FFF0000 /**< Vertical size of layer + * Mask */ +#define XOSD_LXS_YSIZE_SHIFT 16 /**< Bit shift number of + * vertical size of layer */ +#define XOSD_LXS_XSIZE_MASK 0x00000FFF /**< Horizontal size of + * layer Mask */ +/*@}*/ + +/** @name Graphics Controller Write Bank Address bit definition and Shift + * @{ + */ +#define XOSD_GCWBA_GCNUM_MASK 0x00000700 /**< Graphics Controller + * Number Mask */ +#define XOSD_GCWBA_GCNUM_SHIFT 8 /**< Bit shift of Graphics + * Controller Number */ +#define XOSD_GCWBA_BANK_MASK 0x00000007 /**< Controls which bank to + * write GPU instructions and + * Color LUT data into */ +#define XOSD_GCWBA_INS0 0x00000000 /**< Instruction RAM 0 */ +#define XOSD_GCWBA_INS1 0x00000001 /**< Instruction RAM 1 */ +#define XOSD_GCWBA_COL0 0x00000002 /**< Color LUT RAM 0 */ +#define XOSD_GCWBA_COL1 0x00000003 /**< Color LUT RAM 1 */ +#define XOSD_GCWBA_TXT0 0x00000004 /**< Text RAM 0 */ +#define XOSD_GCWBA_TXT1 0x00000005 /**< Text RAM 1 */ +#define XOSD_GCWBA_CHR0 0x00000006 /**< Character Set RAM 0 */ +#define XOSD_GCWBA_CHR1 0x00000007 /**< Character Set RAM 1 */ +/*@}*/ + +/** @name Graphics Controller Active Bank Address bit definition and Shifts + * @{ + */ +#define XOSD_GCABA_CHR_MASK 0xFF000000 /**< Set the active Character + * Bank Mask */ +#define XOSD_GCABA_CHR_SHIFT 24 /**< Bit shift of active + * Character Bank */ +#define XOSD_GCABA_TXT_MASK 0x00FF0000 /**< Set the active Text + * Bank Mask */ +#define XOSD_GCABA_TXT_SHIFT 16 /**< Bit shift of active Text + * Bank */ +#define XOSD_GCABA_COL_MASK 0x0000FF00 /**< Set the active Color Table + * Bank Mask */ +#define XOSD_GCABA_COL_SHIFT 8 /**< Bit shift of active Color + * Table Bank */ +#define XOSD_GCABA_INS_MASK 0x000000FF /**< Set the active instruction + * Bank Mask */ +/*@}*/ + +/** @name Version Register bit definition and Shifts + * @{ + */ +#define XOSD_VER_MAJOR_MASK 0xFF000000 /**< Major Version Mask */ +#define XOSD_VER_MAJOR_SHIFT 24 /**< Major Version Shift */ +#define XOSD_VER_MINOR_MASK 0x00FF0000 /**< Minor Version Mask */ +#define XOSD_VER_MINOR_SHIFT 16 /**< Minor Version Bit Shift */ +#define XOSD_VER_REV_MASK 0x0000F000 /**< Revision Version Mask */ +#define XOSD_VER_REV_SHIFT 12 /**< Revision Bit Shift */ +/*@}*/ + +/** @name Software Reset + * @{ + */ +#define XOSD_RST_RESET XOSD_CTL_SW_RST_MASK /**< Software Reset */ +/*@}*/ + +/** @name Interrupt Register Bit Masks. It is applicable for ISR and IER. + * @{ + */ +#define XOSD_IXR_LAYER0_ERROR_MASK 0x00000010 /**< Layer 0 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_LAYER1_ERROR_MASK 0x00000020 /**< Layer 1 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_LAYER2_ERROR_MASK 0x00000040 /**< Layer 2 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_LAYER3_ERROR_MASK 0x00000080 /**< Layer 3 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_LAYER4_ERROR_MASK 0x00000100 /**< Layer 4 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_LAYER5_ERROR_MASK 0x00000200 /**< Layer 5 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_LAYER6_ERROR_MASK 0x00000400 /**< Layer 6 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_LAYER7_ERROR_MASK 0x00000800 /**< Layer 7 Error + * interrupt enable + * Mask */ +#define XOSD_IXR_PROC_STARTED_MASK 0x00000001 /**< OSD Processing started + * Mask */ +#define XOSD_IXR_EOF_MASK 0x00000002 /**< OSD End of frame mask */ +#define XOSD_IXR_ALLERR_MASK (XOSD_IXR_LAYER0_ERROR_MASK | \ + XOSD_IXR_LAYER1_ERROR_MASK | \ + XOSD_IXR_LAYER2_ERROR_MASK | \ + XOSD_IXR_LAYER3_ERROR_MASK | \ + XOSD_IXR_LAYER4_ERROR_MASK | \ + XOSD_IXR_LAYER5_ERROR_MASK | \ + XOSD_IXR_LAYER6_ERROR_MASK | \ + XOSD_IXR_LAYER7_ERROR_MASK ) + /**< OSD Layer 0 to Layer 7 + * Error Mask */ + +#define XOSD_IXR_ALLINTR_MASK (XOSD_IXR_PROC_STARTED_MASK | \ + XOSD_IXR_EOF_MASK | \ + XOSD_IXR_ALLERR_MASK) /**< OR'ing of all + * Masks */ +/*@}*/ + +/** @name Layer Types + * @{ + */ +#define XOSD_LAYER_TYPE_DISABLE 0 /**< Layer is disabled */ +#define XOSD_LAYER_TYPE_GPU 1 /**< Layer's type is GPU */ +#define XOSD_LAYER_TYPE_VFBC 2 /**< Layer's type is VFBC */ +/*@}*/ + +/** @name Supported instruction numbers given an instruction memory size + * @{ + */ +#define XOSD_INS_MEM_SIZE_TO_NUM 1 /**< Conversion to the number + * of instructions from the + * instruction memory size */ +/*@}*/ + +/** @name GC instruction word offset definition + * @{ + */ +#define XOSD_INS0 0 /**< Instruction word 0 offset */ +#define XOSD_INS1 1 /**< Instruction word 1 offset */ +#define XOSD_INS2 2 /**< Instruction word 2 offset */ +#define XOSD_INS3 3 /**< Instruction word 3 offset */ +#define XOSD_INS_SIZE 4 /**< Size of an instruction in words */ +/*@}*/ + +/** @name GC Instruction word 0 definition and Shifts + * @{ + */ +#define XOSD_INS0_OPCODE_MASK 0xF0000000 /**< Operation Code (OpCode) + * Mask */ +#define XOSD_INS0_OPCODE_SHIFT 28 /**< Bit shift number of + * OpCode */ +#define XOSD_INS0_GCNUM_MASK 0x07000000 /**< Graphics controller number + * (GC#) Mask */ +#define XOSD_INS0_GCNUM_SHIFT 24 /**< Bit shift number of GC# */ +#define XOSD_INS0_XEND_MASK 0x00FFF000 /**< Horizontal end pixel of + * the object Mask */ + +#define XOSD_INS0_XEND_SHIFT 12 /**< Bit shift number of + * Horizontal end pixel of + * the object */ +#define XOSD_INS0_XSTART_MASK 0x00000FFF /**< Horizontal start pixel of + * the Object Mask */ +/*@}*/ + +/** @name GC Instruction word 1 definition + * @{ + */ +#define XOSD_INS1_TXTINDEX_MASK 0x0000000F /**< String Index */ +/*@}*/ + +/** @name GC Instruction word 2 definition and Shifts + * @{ + */ +#define XOSD_INS2_OBJSIZE_MASK 0xFF000000 /**< Object Size Mask */ +#define XOSD_INS2_OBJSIZE_SHIFT 24 /**< Bit shift number of Object + * Size */ +#define XOSD_INS2_YEND_MASK 0x00FFF000 /**< Vertical end line of the + * object Mask */ +#define XOSD_INS2_YEND_SHIFT 12 /**< Bit shift number of + * Vertical end line of the + * object */ +#define XOSD_INS2_YSTART_MASK 0x00000FFF /**< Vertical start line of the + * Object Mask */ +/*@}*/ + +/** @name GC Instruction word 3 definition + * @{ + */ +#define XOSD_INS3_COL_MASK 0x0000000F /**< Color Index for + * Box/Text Mask */ +/*@}*/ + +/** @name GC Instruction Operation Code definition (used in Instruction word 0) + * @{ + */ +#define XOSD_INS_OPCODE_END 0x0 /**< End of instruction list */ +#define XOSD_INS_OPCODE_NOP 0x8 /**< NOP */ +#define XOSD_INS_OPCODE_BOX 0xA /**< Box */ +#define XOSD_INS_OPCODE_LINE 0xC /**< Line */ +#define XOSD_INS_OPCODE_TXT 0xE /**< Text */ +#define XOSD_INS_OPCODE_BOXTXT 0xF /**< Box Text */ +/*@}*/ + +/** @name GC color size + * @{ + */ +#define XOSD_COLOR_ENTRY_SIZE 4 /**< Size of each color entry + * in bytes */ +/*@}*/ + +/** @name GC font unit size + * @{ + */ +#define XOSD_FONT_BIT_TO_BYTE 8 /**< Ratio to convert font size + * to byte */ +/*@}*/ + +/** @name Layer priority + * @{ + */ +#define XOSD_LAYER_PRIORITY_0 0 /**< Priority 0 --- Lowest */ +#define XOSD_LAYER_PRIORITY_1 1 /**< Priority 1 */ +#define XOSD_LAYER_PRIORITY_2 2 /**< Priority 2 */ +#define XOSD_LAYER_PRIORITY_3 3 /**< Priority 3 */ +#define XOSD_LAYER_PRIORITY_4 4 /**< Priority 4 */ +#define XOSD_LAYER_PRIORITY_5 5 /**< Priority 5 */ +#define XOSD_LAYER_PRIORITY_6 6 /**< Priority 6 */ +#define XOSD_LAYER_PRIORITY_7 7 /**< Priority 7 --- Highest */ +/*@}*/ + +/** @name Output Encoding Register bit definition + * @{ + */ +#define XOSD_OPENC_VID_FORMAT_MASK 0x0000000F /**< OSD Output Video + * Format Mask + * 0: YUV 4:2:2 + * 1: YUV 4:4:4 + * 2: RGB + * 3: YUV 4:2:0 */ +#define XOSD_OPENC_NBITS_MASK 0x00000030 /**< Vertical Height of + * OSD Output Mask */ +/*@}*/ + +/** @name Error Register bit definition + * @{ + */ +#define XOSD_ERR_LAYER7_SOF_LATE_MASK 0x80000000 /**< OSD Layer 7 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER7_SOF_EARLY_MASK 0x40000000 /**< OSD Layer 7 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER7_EOL_LATE_MASK 0x20000000 /**< OSD Layer 7 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER7_EOL_EARLY_MASK 0x10000000 /**< OSD Layer 7 error + * for EOL early */ + +#define XOSD_ERR_LAYER6_SOF_LATE_MASK 0x08000000 /**< OSD Layer 6 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER6_SOF_EARLY_MASK 0x04000000 /**< OSD Layer 6 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER6_EOL_LATE_MASK 0x02000000 /**< OSD Layer 6 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER6_EOL_EARLY_MASK 0x01000000 /**< OSD Layer 6 error + * for EOL early + * Mask */ + +#define XOSD_ERR_LAYER5_SOF_LATE_MASK 0x00800000 /**< OSD Layer 5 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER5_SOF_EARLY_MASK 0x00400000 /**< OSD Layer 5 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER5_EOL_LATE_MASK 0x00200000 /**< OSD Layer 5 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER5_EOL_EARLY_MASK 0x00100000 /**< OSD Layer 5 error + * for EOL early + * Mask */ + +#define XOSD_ERR_LAYER4_SOF_LATE_MASK 0x00080000 /**< OSD Layer 4 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER4_SOF_EARLY_MASK 0x00040000 /**< OSD Layer 4 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER4_EOL_LATE_MASK 0x00020000 /**< OSD Layer 4 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER4_EOL_EARLY_MASK 0x00010000 /**< OSD Layer 4 error + * for EOL early + * Mask */ + +#define XOSD_ERR_LAYER3_SOF_LATE_MASK 0x00008000 /**< OSD Layer 3 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER3_SOF_EARLY_MASK 0x00004000 /**< OSD Layer 3 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER3_EOL_LATE_MASK 0x00002000 /**< OSD Layer 3 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER3_EOL_EARLY_MASK 0x00001000 /**< OSD Layer 3 error + * for EOL early + * Mask */ + +#define XOSD_ERR_LAYER2_SOF_LATE_MASK 0x00000800 /**< OSD Layer 2 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER2_SOF_EARLY_MASK 0x00000400 /**< OSD Layer 2 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER2_EOL_LATE_MASK 0x00000200 /**< OSD Layer 2 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER2_EOL_EARLY_MASK 0x00000100 /**< OSD Layer 2 error + * for EOL early + * Mask */ + +#define XOSD_ERR_LAYER1_SOF_LATE_MASK 0x00000080 /**< OSD Layer 1 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER1_SOF_EARLY_MASK 0x00000040 /**< OSD Layer 1 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER1_EOL_LATE_MASK 0x00000020 /**< OSD Layer 1 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER1_EOL_EARLY_MASK 0x00000010 /**< OSD Layer 1 error + * for EOL early + * Mask */ + +#define XOSD_ERR_LAYER0_SOF_LATE_MASK 0x00000008 /**< OSD Layer 0 error + * for SOF late + * Mask */ +#define XOSD_ERR_LAYER0_SOF_EARLY_MASK 0x00000004 /**< OSD Layer 0 error + * for SOF early + * Mask */ +#define XOSD_ERR_LAYER0_EOL_LATE_MASK 0x00000002 /**< OSD Layer 0 error + * for EOL late + * Mask */ +#define XOSD_ERR_LAYER0_EOL_EARLY_MASK 0x00000001 /**< OSD Layer 0 error + * for EOL early + * Mask */ + +#define XOSD_ERR_ALL_ERR_MASK 0xFFFFFFFF /**< OSD Layer 0 to + * Layer 7 error for + * EOL late or early + * early or SOF late + * or early Mask */ +/*@}*/ + +/** @name Control Register bit definition + * @{ + */ +#define XOSD_CTL_EN_MASK 0x00000001 /**< Enable / SW Enable Mask */ +#define XOSD_CTL_RUE_MASK 0x00000002 /**< Register Update Enable + * Mask */ +#define XOSD_CTL_FSYNC_MASK 0x40000000 /**< Frame Sync Reset Mask */ +#define XOSD_CTL_SW_RST_MASK 0x80000000 /**< Core Reset Mask */ +/*@}*/ + +/** @name Constants. It is defined as constants to use instead magic numbers. + * @{ + */ +#define XOSD_DATA_8 8 +#define XOSD_DATA_2 2 +/*@}*/ + +/** @name Compatibility Macros + * @{ + */ +#define XOSD_CTL XOSD_CTL_OFFSET +#define XOSD_STATUS XOSD_STATUS_OFFSET +#define XOSD_ERROR XOSD_ERROR_OFFSET +#define XOSD_VER XOSD_VER_OFFSET +#define XOSD_SS XOSD_ACTIVE_SIZE_OFFSET +#define XOSD_OPENC XOSD_OPENC_OFFSET +#define XOSD_BC0 XOSD_BC0_OFFSET +#define XOSD_BC1 XOSD_BC1_OFFSET +#define XOSD_BC2 XOSD_BC2_OFFSET + +#define XOSD_L0C XOSD_L0C_OFFSET +#define XOSD_L0P XOSD_L0P_OFFSET +#define XOSD_L0S XOSD_L0S_OFFSET + +#define XOSD_L1C XOSD_L1C_OFFSET +#define XOSD_L1P XOSD_L1P_OFFSET +#define XOSD_L1S XOSD_L1S_OFFSET + +#define XOSD_L2C XOSD_L2C_OFFSET +#define XOSD_L2P XOSD_L2P_OFFSET +#define XOSD_L2S XOSD_L2S_OFFSET + +#define XOSD_L3C XOSD_L3C_OFFSET +#define XOSD_L3P XOSD_L3P_OFFSET +#define XOSD_L3S XOSD_L3S_OFFSET + +#define XOSD_L4C XOSD_L4C_OFFSET +#define XOSD_L4P XOSD_L4P_OFFSET +#define XOSD_L4S XOSD_L4S_OFFSET + +#define XOSD_L5C XOSD_L5C_OFFSET +#define XOSD_L5P XOSD_L5P_OFFSET +#define XOSD_L5S XOSD_L5S_OFFSET + +#define XOSD_L6C XOSD_L6C_OFFSET +#define XOSD_L6P XOSD_L6P_OFFSET +#define XOSD_L6S XOSD_L6S_OFFSET + +#define XOSD_L7C XOSD_L7C_OFFSET +#define XOSD_L7P XOSD_L7P_OFFSET +#define XOSD_L7S XOSD_L7S_OFFSET + +#define XOSD_GCWBA XOSD_GCWBA_OFFSET +#define XOSD_GCABA XOSD_GCABA_OFFSET +#define XOSD_GCD XOSD_GCD_OFFSET + +#define XOSD_RST XOSD_RST_OFFSET + +#define XOSD_ISR XOSD_ISR_OFFSET +#define XOSD_IER XOSD_IER_OFFSET + +#define XOSD_In32 XOsd_In32 +#define XOSD_Out32 XOsd_Out32 + +#define XOSD_ReadReg XOsd_ReadReg +#define XOSD_WriteReg XOsd_WriteReg +/*@}*/ + +/***************** Macros (Inline Functions) Definitions *********************/ + +/** @name Core register I/O APIs + * @{ + */ + +#define XOsd_In32 Xil_In32 +#define XOsd_Out32 Xil_Out32 + +/*****************************************************************************/ +/** +* +* This function reads the given register. +* +* @param BaseAddress is the base address of the OSD core. +* @param RegOffset is the register offset of the OSD core. +* +* @return The 32-bit value of the register. +* +* @note C-style signature: +* u32 XOsd_ReadReg(u32 BaseAddress, u32 RegOffset) +* +******************************************************************************/ +#define XOsd_ReadReg(BaseAddress, RegOffset) \ + XOsd_In32((BaseAddress) + (u32)(RegOffset)) + +/*****************************************************************************/ +/** +* +* This function writes the given register. +* +* @param BaseAddress is the base address of the OSD core. +* @param RegOffset is the register offset of the OSD core. +* @param Data is the 32-bit value to write into the core register. +* +* @return None. +* +* @note C-style signature: +* void XOsd_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data) +* +******************************************************************************/ +#define XOsd_WriteReg(BaseAddress, RegOffset, Data) \ + XOsd_Out32((BaseAddress) + (u32)(RegOffset), (Data)) +/*@}*/ + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Declarations ****************************/ + +#ifdef __cplusplus +} +#endif + +#endif /* End of protection macro */ diff --git a/XilinxProcessorIPLib/drivers/osd/src/xosd_intr.c b/XilinxProcessorIPLib/drivers/osd/src/xosd_intr.c index b873fb97..588ab9b9 100755 --- a/XilinxProcessorIPLib/drivers/osd/src/xosd_intr.c +++ b/XilinxProcessorIPLib/drivers/osd/src/xosd_intr.c @@ -1,193 +1,210 @@ -/****************************************************************************** -* -* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file xosd_intr.c -* -* This code contains interrupt related functions of Xilinx MVI Video -* On-Screen-Display device driver. Please see xosd.h for more details of -* the driver. -* -*
-* MODIFICATION HISTORY:
-*
-* Ver	Who  Date     Changes
-* ----- ---- -------- -------------------------------------------------------
-* 1.00a xd   08/18/08 First release
-* 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. 
-* 
-* -******************************************************************************/ - -#include "xosd.h" - -/*****************************************************************************/ -/** -* -* This function is the interrupt handler for the On-Screen-Display driver. -* -* This handler reads the pending interrupt from the IER/ISR, determines the -* source of the interrupts, calls according callbacks, and finally clears the -* interrupts. -* -* The application is responsible for connecting this function to the interrupt -* system. Application beyond this driver is also responsible for providing -* callbacks to handle interrupts and installing the callbacks using -* XOSD_SetCallBack() during initialization phase. An example delivered with -* this driver demonstrates how this could be done. -* -* @param InstancePtr is a pointer to the XOSD instance that just interrupted. -* @return None. -* @note None. -* -******************************************************************************/ -void XOSD_IntrHandler(void *InstancePtr) -{ - u32 PendingIntr; - u32 ErrorStatus; - XOSD *XOSDPtr; - - XOSDPtr = (XOSD *)InstancePtr; - - /* Validate parameters */ - Xil_AssertVoid(XOSDPtr != NULL); - Xil_AssertVoid(XOSDPtr->IsReady == XIL_COMPONENT_IS_READY); - - /* Get pending interrupts */ - PendingIntr = XOSD_IntrGetPending(XOSDPtr); - - /* Clear pending interrupts */ - XOSD_IntrClear(XOSDPtr, PendingIntr); - - /* Error interrupt is occurring or spurious interrupt */ - if ((0 == (PendingIntr & XOSD_IXR_ALLINTR_MASK)) || - (PendingIntr & XOSD_IXR_ALLIERR_MASK)) { - - ErrorStatus = PendingIntr & XOSD_IXR_ALLIERR_MASK; - XOSDPtr->ErrCallBack(XOSDPtr->ErrRef, ErrorStatus); - - /* The Error CallBack should reset the device and so - * there is no need to handle other interrupts - */ - return; - } - - /* A VBI Start has happened */ - if ((PendingIntr & XOSD_IXR_VBIS_MASK)) - XOSDPtr->VbiStartCallBack(XOSDPtr->VbiStartRef); - - /* A VBI End has happened */ - if ((PendingIntr & XOSD_IXR_VBIE_MASK)) - XOSDPtr->VbiEndCallBack(XOSDPtr->VbiEndRef); - - /* A Frame Done interrupt has happened */ - if ((PendingIntr & XOSD_IXR_FD_MASK)) - XOSDPtr->FrameDoneCallBack(XOSDPtr->FrameDoneRef); - -} - -/*****************************************************************************/ -/** -* -* This routine installs an asynchronous callback function for the given -* HandlerType: -* -*
-* HandlerType		   Callback Function Type
-* -----------------------  ---------------------------
-* XOSD_HANDLER_VBISTART	   XOSD_CallBack
-* XOSD_HANDLER_VBIEND	   XOSD_CallBack
-* XOSD_HANDLER_FRAMEDONE   XOSD_CallBack
-* XOSD_HANDLER_ERROR	   XOSD_ErrCallBack
-*
-* HandlerType		   Invoked by this driver when:
-* -----------------------  --------------------------------------------------
-* XOSD_HANDLER_VBISTART	   A Vertical Blank Interval Start Interrupt happens
-* XOSD_HANDLER_VBIEND	   A Vertical Blank Interval End Interrupt happens
-* XOSD_HANDLER_FRAMEDONE   A Frame Done Interrupt happens
-* XOSD_HANDLER_ERROR	   An error condition happens
-*
-* 
-* -* @param InstancePtr is a pointer to the XOSD instance to be worked on. -* @param HandlerType specifies which callback is to be attached. -* @param CallbackFunc is the address of the callback function. -* @param CallbackRef is a user data item that will be passed to the -* callback function when it is invoked. -* -* @return -* - XST_SUCCESS when handler is installed. -* - XST_INVALID_PARAM when HandlerType is invalid. -* -* @note -* Invoking this function for a handler that already has been installed replaces -* it with the new handler. -* -******************************************************************************/ -int XOSD_SetCallBack(XOSD *InstancePtr, u32 HandlerType, - void *CallBackFunc, void *CallBackRef) -{ - Xil_AssertNonvoid(InstancePtr != NULL); - Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); - Xil_AssertNonvoid(CallBackFunc != NULL); - Xil_AssertNonvoid(CallBackRef != NULL); - - switch (HandlerType) { - case XOSD_HANDLER_VBISTART: - InstancePtr->VbiStartCallBack = (XOSD_CallBack)CallBackFunc; - InstancePtr->VbiStartRef = CallBackRef; - break; - - case XOSD_HANDLER_VBIEND: - InstancePtr->VbiEndCallBack = (XOSD_CallBack)CallBackFunc; - InstancePtr->VbiEndRef = CallBackRef; - break; - - case XOSD_HANDLER_FRAMEDONE: - InstancePtr->FrameDoneCallBack = (XOSD_CallBack)CallBackFunc; - InstancePtr->FrameDoneRef = CallBackRef; - break; - - case XOSD_HANDLER_ERROR: - InstancePtr->ErrCallBack = (XOSD_ErrorCallBack)CallBackFunc; - InstancePtr->ErrRef = CallBackRef; - break; - - default: - return XST_INVALID_PARAM; - - } - return XST_SUCCESS; -} +/****************************************************************************** +* +* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xosd_intr.c +* +* This code contains interrupt related functions of Xilinx Video +* On-Screen-Display 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.
+* 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 the following functions:
+*                       XOSD_IntrHandler - > XOsd_IntrHandler.
+*                       XOSD_SetCallBack -> XOsd_SetCallBack.
+*                       Removed the following handlers:
+*                       XOSD_HANDLER_VBISTART, XOSD_HANDLER_VBIEND.
+*                       Added new handler XOSD_HANDLER_PROCSTART.
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xosd.h" + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function is the interrupt handler for the On-Screen-Display driver. +* +* This handler reads the pending interrupt from the IER/ISR, determines the +* source of the interrupts, calls according callbacks, and finally clears the +* interrupts. +* +* The application is responsible for connecting this function to the interrupt +* system. Application beyond this driver is also responsible for providing +* callbacks to handle interrupts and installing the callbacks using +* XOsd_SetCallBack() during initialization phase. +* +* @param InstancePtr is a pointer to the XOsd instance that just +* interrupted. +* +* @return None. +* +* @note None. +* +******************************************************************************/ +void XOsd_IntrHandler(void *InstancePtr) +{ + u32 PendingIntr; + u32 ErrorStatus; + XOsd *XOsdPtr = NULL; + + XOsdPtr = (XOsd *)((void *)InstancePtr); + + /* Validate arguments. */ + Xil_AssertVoid(XOsdPtr != NULL); + Xil_AssertVoid(XOsdPtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); + + /* Get pending interrupts. */ + PendingIntr = (u32)(XOsd_IntrGetPending(XOsdPtr)); + + /* Error interrupt is occurring or spurious interrupt. */ + if (((PendingIntr) & (XOSD_IXR_ERR_MASK)) == + ((XOSD_IXR_ERR_MASK))) { + ErrorStatus = (PendingIntr) & (XOSD_IXR_ERR_MASK); + XOsdPtr->ErrCallBack(XOsdPtr->ErrRef, ErrorStatus); + } + + /* A Processing start interrupt has occurred. */ + if (((PendingIntr) & (XOSD_IXR_PROC_STARTED_MASK)) == + (XOSD_IXR_PROC_STARTED_MASK)) { + XOsdPtr->ProcStartCallBack(XOsdPtr->ProcStartRef); + } + + /* A frame done interrupt has occurred. */ + if (((PendingIntr) & (XOSD_IXR_EOF_MASK)) == + (XOSD_IXR_EOF_MASK)) { + XOsdPtr->FrameDoneCallBack(XOsdPtr->FrameDoneRef); + } + + /* Clear pending interrupts. */ + XOsd_IntrClear(XOsdPtr, PendingIntr); + +} + +/*****************************************************************************/ +/** +* +* This routine installs an asynchronous callback function for the given +* HandlerType: +* +*
+* HandlerType              Callback Function Type
+* -----------------------  -------------------------------
+* XOSD_HANDLER_PROCSTART   StubCallBack
+* XOSD_HANDLER_FRAMEDONE   StubCallBack
+* XOSD_HANDLER_ERROR       StubErrCallBack
+*
+* 
+* +* @param InstancePtr is a pointer to the XOsd instance to be worked on. +* @param HandlerType specifies which callback is to be attached. +* @param CallBackFunc is the address of the callback function. +* @param CallBackRef is a user data item that will be passed to the +* callback function when it is invoked. +* +* @return - XST_SUCCESS when handler is installed. +* - XST_INVALID_PARAM when HandlerType is invalid. +* +* @note Invoking this function for a handler that already has been +* installed replaces it with the new handler. +* +******************************************************************************/ +int XOsd_SetCallBack(XOsd *InstancePtr, u32 HandlerType, + void *CallBackFunc, void *CallBackRef) +{ + int Status; + + /* Verify arguments. */ + Xil_AssertNonvoid(InstancePtr != NULL); + Xil_AssertNonvoid(InstancePtr->IsReady == + (u32)(XIL_COMPONENT_IS_READY)); + Xil_AssertNonvoid(CallBackFunc != NULL); + Xil_AssertNonvoid(CallBackRef != NULL); + Xil_AssertNonvoid((HandlerType >= (u32)(XOSD_HANDLER_PROCSTART)) && + (HandlerType <= (u32)(XOSD_HANDLER_ERROR))); + + /* Setting the HandlerType. */ + switch (HandlerType) { + case XOSD_HANDLER_PROCSTART: + InstancePtr->ProcStartCallBack = + (XOsd_CallBack)((void *)CallBackFunc); + InstancePtr->ProcStartRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + case XOSD_HANDLER_FRAMEDONE: + InstancePtr->FrameDoneCallBack = + (XOsd_CallBack)((void *)CallBackFunc); + InstancePtr->FrameDoneRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + case XOSD_HANDLER_ERROR: + InstancePtr->ErrCallBack = + (XOsd_ErrorCallBack)((void *)CallBackFunc); + InstancePtr->ErrRef = CallBackRef; + Status = (XST_SUCCESS); + break; + + default: + Status = (XST_INVALID_PARAM); + break; + } + + return Status; +} diff --git a/XilinxProcessorIPLib/drivers/osd/src/xosd_selftest.c b/XilinxProcessorIPLib/drivers/osd/src/xosd_selftest.c new file mode 100755 index 00000000..090705ab --- /dev/null +++ b/XilinxProcessorIPLib/drivers/osd/src/xosd_selftest.c @@ -0,0 +1,107 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xosd_selftest.c +* +* This file contains the self-test function for the OSD core. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who    Date     Changes
+* ----- ------ -------- --------------------------------------------------
+* 4.0   adk    02/18/14 First Release.
+*                       Implemented the following functions:
+*                       XOsd_SelfTest.
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xosd.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function reads Version register of OSD core and compares with zero +* as part of self test. +* +* @param InstancePtr is a pointer to the XOsd instance. +* +* @return - XST_SUCCESS if the Version register read test was successful. +* - XST_FAILURE if the Version register read test failed. +* +* @note None. +* +******************************************************************************/ +int XOsd_SelfTest(XOsd *InstancePtr) +{ + u32 Version; + int Status; + + /* Verify argument. */ + Xil_AssertNonvoid(InstancePtr != NULL); + + /* Read OSD core Version register. */ + Version = XOsd_ReadReg(InstancePtr->Config.BaseAddress, + (XOSD_VER_OFFSET)); + + /* Compare Version with zero. */ + if (Version != (u32)0x0) { + Status = (XST_SUCCESS); + } + else { + Status = (XST_FAILURE); + } + + return Status; +} diff --git a/XilinxProcessorIPLib/drivers/osd/src/xosd_sinit.c b/XilinxProcessorIPLib/drivers/osd/src/xosd_sinit.c index 26ec97d3..a98bdd93 100755 --- a/XilinxProcessorIPLib/drivers/osd/src/xosd_sinit.c +++ b/XilinxProcessorIPLib/drivers/osd/src/xosd_sinit.c @@ -1,98 +1,109 @@ -/****************************************************************************** -* -* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* Use of the Software is limited solely to applications: -* (a) running on a Xilinx device, or -* (b) that interact with a Xilinx device through a bus or interconnect. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -* Except as contained in this notice, the name of the Xilinx shall not be used -* in advertising or otherwise to promote the sale, use or other dealings in -* this Software without prior written authorization from Xilinx. -* +/****************************************************************************** +* +* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* ******************************************************************************/ -/*****************************************************************************/ -/** - * - * @file xosd_sinit.c - * - * This file contains the static initialization method for Xilinx MVI Video - * On-Screen-Display (OSD) device driver. - * - *
- * MODIFICATION HISTORY:
- *
- * Ver   Who  Date     Changes
- * ----- ---- -------- -------------------------------------------------------
- * 1.00a xd   08/18/08 First release
- * 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. 
- * 
- * - ******************************************************************************/ - -/***************************** Include Files *********************************/ - -#include "xosd.h" -#include "xparameters.h" - -/************************** Constant Definitions *****************************/ - - -/**************************** Type Definitions *******************************/ - - -/***************** Macros (Inline Functions) Definitions *********************/ - - -/************************** Function Prototypes ******************************/ - -/*****************************************************************************/ -/** - * XOSD_LookupConfig returns a reference to an XOSD_Config structure - * based on the unique device id, DeviceId. The return value will refer - * to an entry in the device configuration table defined in the xosd_g.c - * file. - * - * @param DeviceId is the unique device ID of the device for the lookup - * operation. - * - * @return XOSD_LookupConfig returns a reference to a config record in the - * configuration table (in xosd_g.c) corresponding to DeviceId, - * or NULL if no match is found. - * - ******************************************************************************/ -XOSD_Config *XOSD_LookupConfig(u16 DeviceId) -{ - extern XOSD_Config XOSD_ConfigTable[]; - XOSD_Config *CfgPtr = NULL; - int i; - - for (i = 0; i < XPAR_XOSD_NUM_INSTANCES; i++) { - if (XOSD_ConfigTable[i].DeviceId == DeviceId) { - CfgPtr = &XOSD_ConfigTable[i]; - break; - } - } - - return (CfgPtr); -} +/*****************************************************************************/ +/** +* +* @file xosd_sinit.c +* +* This file contains the static initialization method for Xilinx Video +* On-Screen-Display (OSD) core. +* +*
+* MODIFICATION HISTORY:
+*
+* Ver   Who    Date     Changes
+* ----- ------ -------- ------------------------------------------------------
+* 1.00a xd     08/18/08 First release
+* 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 the following functions:
+*                       XOSD_LookupConfig - > XOsd_LookupConfig
+* 
+* +******************************************************************************/ + +/***************************** Include Files *********************************/ + +#include "xosd.h" +#include "xparameters.h" + +/************************** Constant Definitions *****************************/ + + +/***************** Macros (Inline Functions) Definitions *********************/ + + +/**************************** Type Definitions *******************************/ + + +/************************** Function Prototypes ******************************/ + + +/************************** Variable Definitions *****************************/ + + +/************************** Function Definitions *****************************/ + +/*****************************************************************************/ +/** +* +* This function gets a reference to an XOsd_Config structure based on the +* unique device id, DeviceId. The return value will refer to an entry +* in the core configuration table defined in the xosd_g.c file. +* +* @param DeviceId is the unique core ID of the OSD core for the lookup +* operation. +* +* @return XOsd_Config is a reference to a config record in the +* configuration table (in xosd_g.c) corresponding to +* DeviceId or NULL if no match is found. +* +* @note None. +* +******************************************************************************/ +XOsd_Config *XOsd_LookupConfig(u16 DeviceId) +{ + extern XOsd_Config XOsd_ConfigTable[XPAR_XOSD_NUM_INSTANCES]; + XOsd_Config *CfgPtr = NULL; + u32 Index; + + for (Index = (u32)0x0; Index < (u32)(XPAR_XOSD_NUM_INSTANCES); + Index++) { + if (XOsd_ConfigTable[Index].DeviceId == DeviceId) { + CfgPtr = &XOsd_ConfigTable[Index]; + break; + } + } + + return (XOsd_Config *)CfgPtr; +}