osd: Deprecated osd_v3_0 video driver

Deprecated osd_v3_0 and added active video driver osd_v4_0

Signed-off-by: Shravan Kumar A <skumara@xilinx.com>
Acked-by: Srikanth Vemula <svemula@xilinx.com>
This commit is contained in:
Shravan Kumar A 2014-07-18 12:45:31 +05:30 committed by Jagannadha Sutradharudu Teki
parent 57c1ab3918
commit db90a73cdd
11 changed files with 3648 additions and 0 deletions

View file

@ -0,0 +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.
#
###############################################################################
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

View file

@ -0,0 +1,125 @@
###############################################################
# (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
}

View file

@ -0,0 +1,460 @@
/******************************************************************************
*
* 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 example.c
*
* This file demonstrates how to use Xilinx Video On-Screen-Display (OSD)
* driver on Xilinx MVI OSD device.
*
* This code makes the following assumptions:
*
* - The OSD device contains at least 2 layers
* - Layer 0 has type GPU
* - Each layer has the following configuration during the hardware build
* - Font width = 8
* - Font height = 8
* - Font bits per pixel = 1
* - Number of the font characters = 128
* - Caching is disabled. Flushing and Invalidation operations for data buffer
* need to be added to this code if it is not the case.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ----- ---- -------- -------------------------------------------------------
* 1.00a xd 05/12/09 First release
* </pre>
*
* ****************************************************************************
*/
#include "xosd.h"
#include "xparameters.h"
/*
* Device related constants. Defined in xparameters.h
*/
#define OSD_DEVICE_ID XPAR_OSD_0_DEVICE_ID
/*
* OSD Device related data structures
*/
XOSD Osd; /* OSD Device driver instance */
XOSD_Config *OsdCfgPtr; /* OSD device configuration pointer */
/*
* Color table definition
*/
u32 ColorData[16] = {
0x00000000, 0xa0a25f58, 0xa08080ff, 0xa0808010,
0xa0ef5a51, 0x00000000, 0xa0465289, 0x00000000,
0xa065ba6b, 0x00000000, 0xa09017c5, 0xa0a9c860,
0xa0bc3198, 0xa010a5a9, 0xa0808080, 0xa0ada1ab
};
/*
* Text table definition
*/
char __attribute__ ((aligned (4))) TextData[8][32] = {
"String #1",
"String #2",
"String #3",
"String #4",
"String #5",
"String #6",
"String #7",
"String #8"
};
/*
* Font definition
*/
unsigned char __attribute__ ((aligned (4))) Font[128][8] = {
{0x00, 0x36, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00}, // NULL
{0x18, 0x18, 0x18, 0x1F, 0x1F, 0x18, 0x18, 0x18},
{0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03},
{0x18, 0x18, 0x18, 0xF8, 0xF8, 0x00, 0x00, 0x00},
{0x18, 0x18, 0x18, 0xF8, 0xF8, 0x18, 0x18, 0x18},
{0x00, 0x00, 0x00, 0xF8, 0xF8, 0x18, 0x18, 0x18},
{0x03, 0x07, 0x0E, 0x1C, 0x38, 0x70, 0xE0, 0xC0},
{0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x07, 0x03},
{0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF},
{0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F},
{0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF},
{0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00},
{0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF},
{0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0},
{0x00, 0x1C, 0x1C, 0x77, 0x77, 0x08, 0x1C, 0x00},
{0x00, 0x00, 0x00, 0x1F, 0x1F, 0x18, 0x18, 0x18},
{0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00},
{0x18, 0x18, 0x18, 0xFF, 0xFF, 0x18, 0x18, 0x18},
{0x00, 0x00, 0x3C, 0x7E, 0x7E, 0x7E, 0x3C, 0x00},
{0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF},
{0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0},
{0x00, 0x00, 0x00, 0xFF, 0xFF, 0x18, 0x18, 0x18},
{0x18, 0x18, 0x18, 0xFF, 0xFF, 0x00, 0x00, 0x00},
{0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0},
{0x18, 0x18, 0x18, 0x1F, 0x1F, 0x00, 0x00, 0x00},
{0x78, 0x60, 0x78, 0x60, 0x7E, 0x18, 0x1E, 0x00},
{0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x00},
{0x00, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00},
{0x00, 0x18, 0x30, 0x7E, 0x30, 0x18, 0x00, 0x00},
{0x00, 0x18, 0x0C, 0x7E, 0x0C, 0x18, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // Space
{0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00},
{0x00, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x66, 0xFF, 0x66, 0x66, 0xFF, 0x66, 0x00},
{0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00},
{0x00, 0x66, 0x6C, 0x18, 0x30, 0x66, 0x46, 0x00},
{0x1C, 0x36, 0x1C, 0x38, 0x6F, 0x66, 0x3B, 0x00},
{0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x0E, 0x1C, 0x18, 0x18, 0x1C, 0x0E, 0x00},
{0x00, 0x70, 0x38, 0x18, 0x18, 0x38, 0x70, 0x00},
{0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00},
{0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30},
{0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00},
{0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00},
{0x00, 0x3C, 0x66, 0x6E, 0x76, 0x66, 0x3C, 0x00},
{0x00, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E, 0x00},
{0x00, 0x3C, 0x66, 0x0C, 0x18, 0x30, 0x7E, 0x00},
{0x00, 0x7E, 0x0C, 0x18, 0x0C, 0x66, 0x3C, 0x00},
{0x00, 0x0C, 0x1C, 0x3C, 0x6C, 0x7E, 0x0C, 0x00},
{0x00, 0x7E, 0x60, 0x7C, 0x06, 0x66, 0x3C, 0x00},
{0x00, 0x3C, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00},
{0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x00},
{0x00, 0x3C, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00},
{0x00, 0x3C, 0x66, 0x3E, 0x06, 0x0C, 0x38, 0x00},
{0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00},
{0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30},
{0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00},
{0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00},
{0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00},
{0x00, 0x3C, 0x66, 0x0C, 0x18, 0x00, 0x18, 0x00},
{0x00, 0x3C, 0x66, 0x6E, 0x6E, 0x60, 0x3E, 0x00}, // @
{0x00, 0x18, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x00}, // A
{0x00, 0x7C, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00},
{0x00, 0x3C, 0x66, 0x60, 0x60, 0x66, 0x3C, 0x00},
{0x00, 0x78, 0x6C, 0x66, 0x66, 0x6C, 0x78, 0x00},
{0x00, 0x7E, 0x60, 0x7C, 0x60, 0x60, 0x7E, 0x00},
{0x00, 0x7E, 0x60, 0x7C, 0x60, 0x60, 0x60, 0x00},
{0x00, 0x3E, 0x60, 0x60, 0x6E, 0x66, 0x3E, 0x00},
{0x00, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00},
{0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00},
{0x00, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3C, 0x00},
{0x00, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x00},
{0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00},
{0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x00},
{0x00, 0x66, 0x76, 0x7E, 0x7E, 0x6E, 0x66, 0x00},
{0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00},
{0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x00},
{0x00, 0x3C, 0x66, 0x66, 0x66, 0x6C, 0x36, 0x00},
{0x00, 0x7C, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x00},
{0x00, 0x3C, 0x60, 0x3C, 0x06, 0x06, 0x3C, 0x00},
{0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00},
{0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7E, 0x00},
{0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00},
{0x00, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00},
{0x00, 0x66, 0x66, 0x3C, 0x3C, 0x66, 0x66, 0x00},
{0x00, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00},
{0x00, 0x7E, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00},
{0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00},
{0x00, 0x40, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00},
{0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00},
{0x00, 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00},
{0x40, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, // `
{0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00}, // a
{0x00, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x00},
{0x00, 0x00, 0x3C, 0x60, 0x60, 0x60, 0x3C, 0x00},
{0x00, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x00},
{0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00},
{0x00, 0x0E, 0x18, 0x3E, 0x18, 0x18, 0x18, 0x00},
{0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x7C},
{0x00, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x00},
{0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3C, 0x00},
{0x00, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x3C},
{0x00, 0x60, 0x60, 0x6C, 0x78, 0x6C, 0x66, 0x00},
{0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00},
{0x00, 0x00, 0x66, 0x7F, 0x7F, 0x6B, 0x63, 0x00},
{0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00},
{0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00},
{0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60},
{0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06},
{0x00, 0x00, 0x7C, 0x66, 0x60, 0x60, 0x60, 0x00},
{0x00, 0x00, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x00},
{0x00, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x0E, 0x00},
{0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00},
{0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00},
{0x00, 0x00, 0x63, 0x6B, 0x7F, 0x3E, 0x36, 0x00},
{0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00},
{0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x0C, 0x78},
{0x00, 0x00, 0x7E, 0x0C, 0x18, 0x30, 0x7E, 0x00},
{0x14, 0x10, 0x10, 0x40, 0x10, 0x10, 0x14, 0x00}, // {
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
{0x50, 0x10, 0x10, 0x04, 0x10, 0x10, 0x50, 0x00}, // }
{0x11, 0x11, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00}, // ~
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 127 DEL
};
/*
* Function prototypes
*/
static int OsdExample(int DeviceID);
static int OsdInit(int DeviceID);
static void OsdConfig(void);
static void OsdDrawBox(void);
/*****************************************************************************/
/**
*
* This is the main function for the OSD example.
*
* @param None.
*
* @return 0 to indicate success, otherwise 1.
*
* @note None.
*
******************************************************************************/
int main(void)
{
int Status;
/*
* Call the OSD example, use the Device IDs generated in xparameters.h
*/
Status = OsdExample(OSD_DEVICE_ID);
if (Status != 0)
return 1;
return 0;
}
/*****************************************************************************/
/**
*
* This function is the entry of the feature demonstrations on MVI Video OSD
* device. It initialized an OSD device, configures 2 layers, load
* text/color/font information, and draws a box to the OSD output.
*
* @param DeviceID is the device ID of the OSD device.
*
* @return 0 if all tests pass, 1 otherwise.
*
* @note None.
*
******************************************************************************/
static int OsdExample(int DeviceID)
{
int Status;
/* Initialize the OSD instance */
Status = OsdInit(DeviceID);
if (Status != XST_SUCCESS)
return 1;
/* Configure the OSD instance */
OsdConfig();
/* Draw a box */
OsdDrawBox();
/* Return success */
return 0;
}
/*****************************************************************************/
/**
*
* This function initializes the OSD device and its driver instance.
*
* @param DeviceID is the device ID of the OSD device.
*
* @return 0 if the initialization is successful; 1 otherwise.
*
* @note None.
*
******************************************************************************/
int OsdInit(int DeviceID)
{
int Status;
/* Initialize the OSD instance */
OsdCfgPtr = XOSD_LookupConfig(DeviceID);
Status = XOSD_CfgInitialize(&Osd, OsdCfgPtr, OsdCfgPtr->BaseAddress);
if (Status != XST_SUCCESS)
return 1;
/* Reset the devices */
XOSD_Reset(&Osd);
/* Enable the OSD device and tell it to pick up the register changes */
XOSD_Enable(&Osd);
XOSD_RegUpdateEnable(&Osd);
return 0;
}
/*****************************************************************************/
/**
*
* This function does the general configuration on an OSD device. The
* configuration includes:
*
* - Screen Size
* - Background Color
* - Layer 0 setup: Alpha, Priority, Dimension and enabling
* - Layer 1 setup: Alpha, Priority, Dimension and enabling
* - Loading Color/Font/Text configuration
*
* @param None.
*
* @return None.
*
* @note None.
*
******************************************************************************/
static void OsdConfig(void)
{
/* Dimension definition */
int Width = 1280;
int Height = 720;
/* Background color definition */
u8 Red = 0xFF;
u8 Blue = 0;
u8 Green = 0;
/* Layer 0/1 property definition */
int Layer0AlphaValue = 0xFF;
int Layer0Priority = XOSD_LAYER_PRIORITY_0;
int Layer0GlobalAlphaEnable = 1;
int Layer1AlphaValue = 0x80; /* 50% transparent */
int Layer1Priority = XOSD_LAYER_PRIORITY_1;
int Layer1GlobalAlphaEnable = 0;
/* Set screen size */
XOSD_SetScreenSize(&Osd, Width, Height);
/* Set Background color */
XOSD_SetBackgroundColor(&Osd, Red, Blue, Green);
/* Set up Layer 0's Alpha, Priority, Dimension and enable it */
XOSD_SetLayerAlpha(&Osd, 0, Layer0GlobalAlphaEnable, Layer0AlphaValue);
XOSD_SetLayerPriority(&Osd, 0, Layer0Priority);
XOSD_SetLayerDimension(&Osd, 0, 0, 0, Width, Height);
XOSD_EnableLayer(&Osd, 0);
/* Set up Layer 1's Alpha, Priority, Dimension and enable it */
XOSD_SetLayerAlpha(&Osd, 1, Layer1GlobalAlphaEnable, Layer1AlphaValue);
XOSD_SetLayerPriority(&Osd, 1, Layer1Priority);
XOSD_SetLayerDimension(&Osd, 1, 0, 0, Width, Height);
XOSD_EnableLayer(&Osd, 1);
/* Load color, font and text and set the active banks */
XOSD_LoadColorLUTBank(&Osd, 0, 0, ColorData);
XOSD_LoadCharacterSetBank(&Osd, 0, 0, (u32 *)Font);
XOSD_LoadTextBank(&Osd, 0, 0, (u32 *)TextData);
XOSD_SetActiveBank(&Osd, 0, 0, 0, 0, 0);
return;
}
/*****************************************************************************/
/**
*
* This function draws a box using the OSD device
*
* @param None.
*
* @return None.
*
* @note None.
*
******************************************************************************/
static void OsdDrawBox(void)
{
/* Instruction buffer */
u32 Instruction[XOSD_INS_SIZE];
/* Instruction property definition */
u16 ObjType = XOSD_INS_OPCODE_BOX; /* A box */
u8 ObjSize = 1; /* Box boarder width */
u16 XStart = 100; /* Horizontal start pixel of the box */
u16 YStart = 100; /* Vertical start line of the box */
u16 XEnd = 200; /* Horizontal end pixel of the box */
u16 YEnd = 200; /* Vertical end line of the box */
u8 TextIndex = 0; /* Ignored in box instruction case */
u8 ColorIndex = 0; /* Draw the box w/ the 1st color */
/* Create a box command instruction for GC #0 */
XOSD_CreateInstruction(&Osd, Instruction, 0,
ObjType, ObjSize,
XStart, YStart, XEnd, YEnd,
TextIndex, ColorIndex);
/* Load the instruction to draw the box in the OSD output */
XOSD_LoadInstructionList(&Osd, 0, 0, Instruction, 1);
return;
}

View file

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Driver example applications</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body bgcolor="#FFFFFF">
<h1> Example Applications for the driver osd_v3_0 </h1>
<HR>
<ul>
<li>example.c <a href="example.c">(source)</a> </li>
</ul>
<p><font face="Times New Roman" color="#800000">Copyright <20> 1995-2014 Xilinx, Inc. All rights reserved.</font></p>
</body>
</html>

View file

@ -0,0 +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}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,694 @@
/******************************************************************************
*
* 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.
*
* <b>Interrupt Service </b>
*
* Four interrupt types are supported:
*
* - Vertical Blank Interval Start Interrupt
* - Vertical Blank Interval End Interrupt
* - Frame Done Interrupt
* - Error Interrupt
*
* <b>Software Initialization </b>
*
* Please follow the example provided with this driver for the steps
* to use this driver.
*
* <b>Cache Coherency</b>
*
* <b>Alignment</b>
*
* <b>Limitations</b>
*
* <b>BUS Interface</b>
*
* <pre>
* 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
*
* </pre>
*
******************************************************************************/
#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 */

View file

@ -0,0 +1,191 @@
/******************************************************************************
*
* 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.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ----- ---- -------- -------------------------------------------------------
* 1.00a xd 08/18/08 First release
* </pre>
*
******************************************************************************/
/***************************** 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
}
};

View file

@ -0,0 +1,467 @@
/******************************************************************************
*
* 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.
*
* <pre>
* 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.
* </pre>
*
******************************************************************************/
#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 */

View file

@ -0,0 +1,193 @@
/******************************************************************************
*
* 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.
*
* <pre>
* 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.
* </pre>
*
******************************************************************************/
#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:
*
* <pre>
* 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
*
* </pre>
*
* @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;
}

View file

@ -0,0 +1,98 @@
/******************************************************************************
*
* 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.
*
* <pre>
* 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.
* </pre>
*
******************************************************************************/
/***************************** 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, <i>DeviceId</i>. 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 <i>DeviceId</i>,
* 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);
}